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().ToString(); txtSupposedClass.Text = jo["supposedClassName"]?.Value().ToString(); if (!jo["ok"].Value()) { tecJson.Text = string.Empty; tecJson.Text = jo["message"].Value().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; } } }