コード例 #1
0
        public void OnLoad()
        {
            AddFiddlerObjectLog("OnLoad");
            //string workPath = string.Format("{0}\\FreeHttp", System.Windows.Forms.Application.StartupPath);
            string workPath = string.Format("{0}\\FreeHttp", Directory.GetCurrentDirectory());

            if (!isOnLoad)
            {
                tabPage      = new TabPage();
                tabPage.Text = "Free Http";
                if (FiddlerApplication.UI.tabsViews.ImageList != null)
                {
                    Image myIco = FreeHttp.Resources.MyResource.freehttpico;
                    FiddlerApplication.UI.tabsViews.ImageList.Images.Add(myIco);
                    tabPage.ImageIndex = FiddlerApplication.UI.tabsViews.ImageList.Images.Count - 1;
                }
                try
                {
                    if (!Directory.Exists(workPath))
                    {
                        AddFiddlerObjectLog(string.Format("Create working directory {0}", workPath));
                        Directory.CreateDirectory(workPath);
                    }
                    AddFiddlerObjectLog(string.Format("load configuration"));
                    myFreeHttpWindow = new FreeHttpWindow(SerializableHelper.DeserializeRuleList(), SerializableHelper.DeserializeData <FiddlerModificSettingInfo>("FreeHttp\\FreeHttpSetting.xml"), SerializableHelper.DeserializeContractData <FreeHttp.AutoTest.RunTimeStaticData.ActuatorStaticDataCollection>("FreeHttp\\FreeHttpStaticDataCollection.xml"));
                }
                catch (Exception ex)
                {
                    AddFiddlerObjectLog(string.Format("load configuration fial ,{0}", ex.Message));
                }
                finally
                {
                    if (myFreeHttpWindow == null)
                    {
                        myFreeHttpWindow = new FreeHttpWindow(null, null, null);
                    }
                }
                myFreeHttpWindow.OnUpdataFromSession   += myFreeHttpWindow_OnUpdataFromSession;
                myFreeHttpWindow.OnGetSessionRawData   += myFreeHttpWindow_OnGetSessionRawData;
                myFreeHttpWindow.OnGetSessionEventArgs += MyFreeHttpWindow_OnGetSessionEventArgs;
                myFreeHttpWindow.OnGetSessionSeekHead  += myFreeHttpWindow_OnGetSessionSeekHead;
                myFreeHttpWindow.Dock   = DockStyle.Fill;
                myFreeHttpWindow.Enter += myFreeHttpWindow_Enter;
                tabPage.Controls.Add(myFreeHttpWindow);
                FiddlerApplication.UI.tabsViews.TabPages.Add(tabPage);
                Fiddler.FiddlerApplication.UI.Deactivate             += UI_Deactivate;
                FiddlerApplication.UI.tabsViews.SelectedIndexChanged += tabsViews_SelectedIndexChanged;
                FiddlerApplication.OnWebSocketMessage += FiddlerApplication_OnWebSocketMessage;

                upgradeService = new UpgradeService();
                upgradeService.GetUpgradeMes += upgradeService_GetUpgradeMes;
                operationReportService        = new OperationReportService();

                isOnLoad = true;
            }
        }