Files
EmoneyFiddlerPlugins/FiddlerDecryption/Controls/RequestDecodeControl.cs
2026-01-07 11:33:05 +08:00

69 lines
1.7 KiB
C#

using Newtonsoft.Json.Linq;
using System;
using System.Windows.Forms;
namespace FiddlerDecryption.Controls
{
public partial class RequestDecodeControl : UserControl
{
public RequestDecodeControl()
{
InitializeComponent();
}
private void tecJson_TextChanged(object sender, EventArgs e)
{
UpdateAndCheckFoldings();
}
private void UpdateAndCheckFoldings()
{
tecJson.Document.FoldingManager.UpdateFoldings(null, null);
}
public void SetData(JObject jo, string auth)
{
txtAuth.Text = auth;
if (jo == null)
{
Clear();
return;
}
txtProtoId.Text = jo["protocolId"]?.Value<string>().ToString();
txtSupposedClass.Text = jo["supposedClassName"]?.Value<string>().ToString();
if (!jo["ok"].Value<bool>())
{
tecJson.Text = string.Empty;
tecJson.Text = jo["message"].Value<string>().ToString();
UpdateAndCheckFoldings();
}
else
{
tecJson.Text = string.Empty;
tecJson.Text = jo.ToString(Newtonsoft.Json.Formatting.Indented);
UpdateAndCheckFoldings();
}
}
public void Clear()
{
tecJson.Text = string.Empty;
txtAuth.Clear();
txtProtoId.Clear();
txtProtoName.Clear();
txtSupposedClass.Clear();
}
public void AddToTab(TabPage o)
{
o.Text = "EProtobuf";
o.Controls.Add(this);
o.Controls[0].Dock = DockStyle.Fill;
}
}
}