94 lines
2.0 KiB
C#
94 lines
2.0 KiB
C#
using Fiddler;
|
|
using System;
|
|
using Standard;
|
|
using System.Windows.Forms;
|
|
using Util;
|
|
|
|
namespace Response
|
|
{
|
|
public sealed class ResponseDecode : Inspector2, IResponseInspector2, IBaseInspector2
|
|
{
|
|
private bool mBDirty;
|
|
private bool mBReadOnly;
|
|
private byte[] mBody;
|
|
private HTTPResponseHeaders mResponseHeaders;
|
|
private ResponseTextViewer mResponseTextViewer;
|
|
|
|
public ResponseDecode()
|
|
{
|
|
mResponseTextViewer = new ResponseTextViewer();
|
|
}
|
|
|
|
public bool bDirty
|
|
{
|
|
get
|
|
{
|
|
return mBDirty;
|
|
}
|
|
}
|
|
|
|
public byte[] body
|
|
{
|
|
get
|
|
{
|
|
return mBody;
|
|
}
|
|
|
|
set
|
|
{
|
|
mBody = value;
|
|
byte[] decodedBody = DecodeUtil.DoDecryption(headers, mBody).Result;
|
|
if (decodedBody != null)
|
|
{
|
|
mResponseTextViewer.body = decodedBody;
|
|
}
|
|
else
|
|
{
|
|
Clear();
|
|
mResponseTextViewer.body = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool bReadOnly
|
|
{
|
|
get
|
|
{
|
|
return mBReadOnly;
|
|
}
|
|
|
|
set
|
|
{
|
|
mBReadOnly = value;
|
|
}
|
|
}
|
|
|
|
public HTTPResponseHeaders headers
|
|
{
|
|
get
|
|
{
|
|
return mResponseHeaders;
|
|
}
|
|
set
|
|
{
|
|
mResponseHeaders = value;
|
|
}
|
|
}
|
|
|
|
public override void AddToTab(TabPage o)
|
|
{
|
|
mResponseTextViewer.AddToTab(o);
|
|
o.Text = "EProtobuf";
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
mBody = null;
|
|
mResponseTextViewer.Clear();
|
|
}
|
|
|
|
// 在 Tab 上的摆放位置
|
|
public override int GetOrder() => 200;
|
|
}
|
|
}
|