Fiddler二次开发 C#

在Fiddler工具面板出自定义个面板, 分析当前fiddler 请求区域所有请求

开发语言:C#  +  Microsoft Visual Studio 2010

 先看看分析内容:总请求,总耗流,加载时间(面板最后一个请求-第一个请求),最耗时请求,最耗流请求,重复请求

 

 代码片段:

面板-设置按钮,展示框等

public class UserInterface : UserControl
{
    private TabPage tabPage; //添加一个标签页 用来放置控件
    //private CheckBox chkb_Enabled;  //用来启用或禁用插件
    private TextBox textBox_Result;  //用来保存最后的结果
    private Button btn_Clear;  //清空按钮
    private Button btn_ClearAll;
    private Button btn_ClearAndStart;  //清空所有按钮
    private Button btn_get_HttpData;  //获取请求信息
    private Button btn_get_PerformanceData;  //获取性能信息

 初始化UI,和java差不多

 public void InitializeUI() //初始化UI
    {
        this.tabPage = new TabPage("不点一下吗");
        this.tabPage.AutoScroll = true;

        this.btn_Clear = new Button();
        this.btn_Clear.Text = "Clear";
        this.btn_Clear.Left = 120;
        this.btn_Clear.Top = 10;

        this.btn_ClearAll = new Button();
        this.btn_ClearAll.Text = "ClearAll";
        this.btn_ClearAll.Left = 20;
        this.btn_ClearAll.Top = 10;

fiddler回调获取信息细节:

 Session[] selectSessions = FiddlerApplication.UI.GetAllSessions();  //获取面板的所有请求
            sessionSize = selectSessions.Length;
            foreach (Session session in selectSessions)  //遍历
            {
                long c = ConvertDateTimeInt(session.Timers.ClientBeginRequest);  //获取第一个请求时间
                long e = ConvertDateTimeInt(session.Timers.ClientDoneResponse);
                long currentflow = 0;if (session.requestBodyBytes.LongLength!=null)
                 requestSize += session.requestBodyBytes.LongLength;  //获取请求耗流大小
       
}

设置生成调试:保存进入fiddler/script/{文件夹}

 

原文地址:https://www.cnblogs.com/season-xie/p/6337680.html