Ejemplo n.º 1
0
        //集約エラーハンドラ
        private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            URLMonInterop.ResetProxyInProcessToDefault();
            FiddlerApplication.Shutdown();

            if (e.ExceptionObject is Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
                File.AppendAllText("log.txt", $"{ex.Message}{ex.StackTrace}");
            }
            else
            {
                Console.WriteLine(e.ToString());
            }

            //TODO:ロギング処理など
            MessageBox.Show(
                $"不明なエラーが発生しました。アプリケーションを終了します。{e.ToString()}",
                "エラー",
                MessageBoxButton.OK,
                MessageBoxImage.Error);

            Environment.Exit(1);
        }
Ejemplo n.º 2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            DispatcherHelper.UIDispatcher = this.Dispatcher;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            // 証明書インストール
            if (!CertMaker.rootCertExists())
            {
                CertMaker.createRootCert();
                CertMaker.trustRootCert();
            }

            // プロキシサーバー開始
            FiddlerApplication.Startup(24791, true, true);

            this.MainWindow = new MainWindow()
            {
                DataContext = new MainWindowViewModel()
            };
            this.MainWindow.ShowDialog();


            // プロキシサーバー終了
            URLMonInterop.ResetProxyInProcessToDefault();
            FiddlerApplication.Shutdown();
        }
Ejemplo n.º 3
0
 private void Form1_Formclosed(object sender, FormClosedEventArgs e)
 {
     try
     {
         URLMonInterop.ResetProxyInProcessToDefault();
         FiddlerApplication.Shutdown();
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
 public void Stop()
 {
     // プロキシサーバー終了
     URLMonInterop.ResetProxyInProcessToDefault();
     FiddlerApplication.Shutdown();
 }