Ejemplo n.º 1
0
        public ConfigControl(Injection oInjection, Interceptor oInterceptor, LocalData oLocalData)
        {
            this.oInjection   = oInjection;
            this.oInterceptor = oInterceptor;
            this.oLocalData   = oLocalData;
            InitializeComponent();

            // 绑定自定义事件
            this.oInterceptor.RosinWrite  += RosinWriteHandler;  // 写日志事件
            this.oInterceptor.RosinCreate += RosinCreateHandler; // 创建日志事件

            // 初始化日志页面列表
            this.InitPageList();
        }
Ejemplo n.º 2
0
        public ConfigControl(Injection oInjection, Interceptor oInterceptor, LocalData oLocalData)
        {
            this.oInjection = oInjection;
            this.oInterceptor = oInterceptor;
            this.oLocalData = oLocalData;
            InitializeComponent();

            // 绑定自定义事件
            this.oInterceptor.RosinWrite += RosinWriteHandler; // 写日志事件
            this.oInterceptor.RosinCreate += RosinCreateHandler; // 创建日志事件

            // 初始化日志页面列表
            this.InitPageList();
        }
Ejemplo n.º 3
0
        private void InitializeComponent()
        {
            Debug.Log("Rosin running...");

            // 初始化相关文件路径
            if (!Directory.Exists(Config.FiddlerPath.RosinDir))
            {
                Directory.CreateDirectory(Config.FiddlerPath.RosinDir);
            }
            if (!Directory.Exists(Config.FiddlerPath.RosinLogDir))
            {
                Directory.CreateDirectory(Config.FiddlerPath.RosinLogDir);
            }

            if (!File.Exists(CONFIG.GetPath("Responses")))
            {
                string header = "HTTP/1.1 200 OK\r\nContent-Type: application/x-javascript\r\nConnection: close\r\nContent-Length: 0\r\n";
                header += "Access-Control-Allow-Credentials: true\r\nAccess-Control-Allow-Methods: GET,POST,OPTIONS\r\nAccess-Control-Allow-Origin:*\r\n\r\n";

                byte[] arrHeaders = System.Text.Encoding.ASCII.GetBytes(header);

                FileStream oFS = File.Create(CONFIG.GetPath("Responses") + "rosinpost.dat");
                oFS.Write(arrHeaders, 0, arrHeaders.Length);
                oFS.Close();

                // 模拟https的443接口响应,但是不能生效,改变实现策略,暂时注释掉
                // string httpsHeader = "HTTP/1.1 200 Connection Established\r\nFiddlerGateway: Direct\r\nStartTime: 19:25:13.898\r\nConnection: close\r\n\r\n";
                // byte[] arrHttpsHeaders = System.Text.Encoding.ASCII.GetBytes(httpsHeader);

                // FileStream oFSHttps = File.Create(CONFIG.GetPath("Responses") + "rosinhttps.dat");
                // oFSHttps.Write(arrHttpsHeaders, 0, arrHttpsHeaders.Length);
                // oFSHttps.Close();
            }

            this.iInjection   = new Injection();   // 实例化注入模块
            this.iInterceptor = new Interceptor(); // 实例化拦截模块
            this.iLocalData   = new LocalData();   // 实例化本地日志存储模块

            this.oConfigControl = new ConfigControl(iInjection, iInterceptor, iLocalData);
        }
Ejemplo n.º 4
0
        private void InitializeComponent()
        {
            Debug.Log("Rosin running...");

            // 初始化相关文件路径
            if (!Directory.Exists(Config.FiddlerPath.RosinDir))
            {
                Directory.CreateDirectory(Config.FiddlerPath.RosinDir);
            }
            if (!Directory.Exists(Config.FiddlerPath.RosinLogDir))
            {
                Directory.CreateDirectory(Config.FiddlerPath.RosinLogDir);
            }

            if (!File.Exists(CONFIG.GetPath("Responses")))
            {
                string header = "HTTP/1.1 200 OK\r\nContent-Type: application/x-javascript\r\nConnection: close\r\nContent-Length: 0\r\n";
                header += "Access-Control-Allow-Credentials: true\r\nAccess-Control-Allow-Methods: GET,POST,OPTIONS\r\nAccess-Control-Allow-Origin:*\r\n\r\n";

                byte[] arrHeaders = System.Text.Encoding.ASCII.GetBytes(header);

                FileStream oFS = File.Create(CONFIG.GetPath("Responses") + "rosinpost.dat");
                oFS.Write(arrHeaders, 0, arrHeaders.Length);
                oFS.Close();

                // 模拟https的443接口响应,但是不能生效,改变实现策略,暂时注释掉
                // string httpsHeader = "HTTP/1.1 200 Connection Established\r\nFiddlerGateway: Direct\r\nStartTime: 19:25:13.898\r\nConnection: close\r\n\r\n";
                // byte[] arrHttpsHeaders = System.Text.Encoding.ASCII.GetBytes(httpsHeader);

                // FileStream oFSHttps = File.Create(CONFIG.GetPath("Responses") + "rosinhttps.dat");
                // oFSHttps.Write(arrHttpsHeaders, 0, arrHttpsHeaders.Length);
                // oFSHttps.Close();
            }

            this.iInjection = new Injection(); // 实例化注入模块
            this.iInterceptor = new Interceptor(); // 实例化拦截模块
            this.iLocalData = new LocalData(); // 实例化本地日志存储模块

            this.oConfigControl = new ConfigControl(iInjection, iInterceptor, iLocalData);
        }