static void Main() { onBoot(); Application.ThreadException += new ThreadExceptionEventHandler(applicationThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomainUnhandledException); SystemEvents.SessionEnding += new SessionEndingEventHandler(sessionEnding); Mutex procMutex = new Mutex(false, APP_IDENT); if (procMutex.WaitOne(0) && GlobalProcMtx.Create(Consts.PROJECT_GUI_IDENT, APP_TITLE)) { checkSelfDir(); Directory.SetCurrentDirectory(selfDir); checkAloneExe(); checkLogonUser(); Ground.i = new Ground(); Utils.AntiWindowsDefenderSmartScreen(); //Gnd.i.logger.clear(); Ground.i.loadConf(); Ground.i.loadData(); // Kill Zombies { using (NamedEventObject ev = new NamedEventObject(Consts.EV_STOP_SENDER)) { ev.set(); } using (NamedEventObject ev = new NamedEventObject(Consts.EV_STOP_RECORDER)) { ev.set(); } // crypTunnel -> CrypTunnelProc.cs } // orig > Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainWin()); // < orig Ground.i.saveData(); // release Gnd.i { // noop } FileTools.clearTMP(); GlobalProcMtx.Release(); procMutex.ReleaseMutex(); } procMutex.Close(); }
static void Main() { onBoot(); Application.ThreadException += new ThreadExceptionEventHandler(applicationThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomainUnhandledException); SystemEvents.SessionEnding += new SessionEndingEventHandler(sessionEnding); Mutex procMutex = new Mutex(false, APP_IDENT); if (procMutex.WaitOne(0) && GlobalProcMtx.Create(APP_IDENT, APP_TITLE)) { checkSelfDir(); Directory.SetCurrentDirectory(selfDir); checkAloneExe(); checkLogonUser(); // orig > Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainWin()); // < orig GlobalProcMtx.Release(); procMutex.ReleaseMutex(); } procMutex.Close(); }
static void Main() { BootTools.OnBoot(); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); SystemEvents.SessionEnding += new SessionEndingEventHandler(SessionEnding); Mutex procMutex = new Mutex(false, APP_IDENT); if (procMutex.WaitOne(0) && GlobalProcMtx.Create(APP_IDENT, APP_TITLE)) { CheckSelfDir(); CheckCopiedExe(); // orig > Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainWin()); // < orig GlobalProcMtx.Release(); procMutex.ReleaseMutex(); } procMutex.Close(); }
static void Main() { onBoot(); Application.ThreadException += new ThreadExceptionEventHandler(applicationThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomainUnhandledException); SystemEvents.SessionEnding += new SessionEndingEventHandler(sessionEnding); Mutex procMutex = new Mutex(false, APP_IDENT); if (procMutex.WaitOne(0) && GlobalProcMtx.Create(APP_IDENT, APP_TITLE)) { checkSelfDir(); Directory.SetCurrentDirectory(selfDir); checkAloneExe(); checkLogonUser(); Utils.AntiWindowsDefenderSmartScreen(); Gnd.i.loadConf(); Gnd.i.loadData(); Gnd.i.n2Listener = new N2Listener(); Gnd.i.problemInfos = ProblemInfoUtils.loadProblemInfos(); // おまけ、ゴミ掃除 { File.Delete("Error.csv"); File.Delete("LoadedData.csv"); } Utils.WriteLog("Main 1.1"); // orig > Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainWin()); // < orig // ここではフォームを開けない -----> MainWin_FormClosed() Utils.WriteLog("Main 2.1"); Gnd.i.saveData(); Utils.WriteLog("Main 2.2"); FileTools.clearTMP(); Utils.WriteLog("Main 2.3"); GlobalProcMtx.Release(); procMutex.ReleaseMutex(); } procMutex.Close(); }
static void Main() { onBoot(); Application.ThreadException += new ThreadExceptionEventHandler(applicationThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomainUnhandledException); SystemEvents.SessionEnding += new SessionEndingEventHandler(sessionEnding); Mutex procMutex = new Mutex(false, APP_IDENT); if (procMutex.WaitOne(0) && GlobalProcMtx.Create(APP_IDENT, APP_TITLE)) { checkSelfDir(); Directory.SetCurrentDirectory(selfDir); checkAloneExe(); checkLogonUser(); Gnd.i.loadConf(); Gnd.i.loadData(); Directory.CreateDirectory(Utils.getMediaDir()); // orig > Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainWin()); // < orig ProcessTools._終了を待っているプロセスを捨てて例外を投げろ = true; Gnd.i.saveData(); BusyDlg.perform(delegate { if (Conv.curr != null) { Conv.curr.end(); Conv.curr = null; } FileTools.deletePath(Utils.getMediaDir()); }); FileTools.clearTMP(); GlobalProcMtx.Release(); procMutex.ReleaseMutex(); } procMutex.Close(); }
static void Main() { onBoot(); Application.ThreadException += new ThreadExceptionEventHandler(applicationThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomainUnhandledException); SystemEvents.SessionEnding += new SessionEndingEventHandler(sessionEnding); Mutex procMutex = new Mutex(false, APP_IDENT); if (procMutex.WaitOne(0) && GlobalProcMtx.Create(APP_IDENT, APP_TITLE)) { checkSelfDir(); Directory.SetCurrentDirectory(selfDir); checkAloneExe(); checkLogonUser(); // TMP clear { using (new WorkingDir()) { } FileTools.clearTMP(); } Gnd.i.loadConf(); Gnd.i.loadData(); // orig > Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainWin()); // < orig //Gnd.i.saveData(); // moved -> MainWin.postPerform // release Gnd.i { // moved -> MainWin.postPerform } FileTools.clearTMP(); GlobalProcMtx.Release(); procMutex.ReleaseMutex(); } procMutex.Close(); }
static void Main() { BootTools.OnBoot(); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); SystemEvents.SessionEnding += new SessionEndingEventHandler(SessionEnding); Mutex procMutex = new Mutex(false, APP_IDENT); if (procMutex.WaitOne(0) && GlobalProcMtx.Create(APP_IDENT, APP_TITLE)) { CheckSelfDir(); CheckCopiedExe(); Gnd.NormLog = new Logger(StringTools.Combine( BootTools.SelfDir, Path.GetFileNameWithoutExtension(BootTools.SelfFile) + "_normal.log" )); Utils.AntiWindowsDefenderSmartScreen(); Gnd.ConvLog = new Logger(StringTools.Combine( BootTools.SelfDir, Path.GetFileNameWithoutExtension(BootTools.SelfFile) + "_conversion.log" )); Gnd.LoadData(); // orig > Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainWin()); // < orig Gnd.SaveData(); Gnd.NormLog.Close(); Gnd.ConvLog.Close(); GlobalProcMtx.Release(); procMutex.ReleaseMutex(); } procMutex.Close(); }
static void Main() { Application.ThreadException += new ThreadExceptionEventHandler(ApplicationThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomainUnhandledException); SystemEvents.SessionEnding += new SessionEndingEventHandler(SessionEnding); OnBoot(); Mutex procMutex = new Mutex(false, APP_IDENT); if (procMutex.WaitOne(0)) { if (GlobalProcMtx.Create(APP_IDENT, APP_TITLE)) { CheckSelfFile(); Directory.SetCurrentDirectory(SelfDir); CheckAloneExe(); CheckLogonUserAndTmp(); if (MessageBox.Show( @"実行中のサーバー(HTT.exe)を全て終了して下さい。 本ツール実行中はサーバーを起動しないで下さい。 続行するにはOKを押して下さい。", APP_TITLE + " / 確認", MessageBoxButtons.OKCancel, MessageBoxIcon.Information ) == DialogResult.OK ) { // orig > Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainWin()); // < orig } GlobalProcMtx.Release(); } procMutex.ReleaseMutex(); } procMutex.Close(); }
static void Main() { BootTools.OnBoot(); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); SystemEvents.SessionEnding += new SessionEndingEventHandler(SessionEnding); Mutex procMutex = new Mutex(false, "{b68179af-7285-4a8c-a16e-f36b107e42cc}"); if (procMutex.WaitOne(0) && GlobalProcMtx.Create("{82820e8e-4256-4c75-87a2-9a9851f46c5b}", APP_TITLE)) { CheckSelfDir(); CheckCopiedExe(); Gnd.Init(); Gnd.LoadConf(); Gnd.LoadFromFile(); // orig > Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainWin()); // < orig // ここではフォームは開けない -> MainWin.cs CloseWindow() Gnd.SaveToFile(); GlobalProcMtx.Release(); procMutex.ReleaseMutex(); } procMutex.Close(); }
static void Main() { onBoot(); Application.ThreadException += new ThreadExceptionEventHandler(applicationThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomainUnhandledException); SystemEvents.SessionEnding += new SessionEndingEventHandler(sessionEnding); Mutex procMutex = new Mutex(false, APP_IDENT); if (procMutex.WaitOne(0) && GlobalProcMtx.Create(APP_IDENT, APP_TITLE)) { string bootOpenFile = null; // コマンド引数 { ArgsReader ar = new ArgsReader(); for (; ;) { if (ar.argIs("/dummy")) { continue; } if (ar.hasArgs()) { bootOpenFile = FileTools.toFullPath(ar.nextArg()); break; } break; } } checkSelfDir(); Directory.SetCurrentDirectory(selfDir); checkAloneExe(); checkLogonUser(); Utils.AntiWindowsDefenderSmartScreen(); Gnd.i.loadConf(); Gnd.i.loadData(); Gnd.i.bootOpenFile = bootOpenFile; Gnd.i.logger.writeLine("プログラムを起動しています。"); // orig > Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new PseudoMainWin()); // < orig Gnd.i.saveData(); // release Gnd.i { Gnd.i.mediaDataSync.Dispose(); Gnd.i.mediaDataSync = null; } FileTools.clearTMP(); Gnd.i.logger.writeLine("プログラムを終了します。"); GlobalProcMtx.Release(); procMutex.ReleaseMutex(); } procMutex.Close(); }