static void Main() { System.Environment.CurrentDirectory = Path.GetDirectoryName(Application.ExecutablePath); var errorHandler = new ErrorHandlerPPD(); errorHandler.Initialize(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Game game = null; try { PPDSetting.Initialize(); game = new MyGame(new PPDExecuteArg(new string[] { })); game.Run(); } catch (Exception e) { SplashForm.CloseSplash(); errorHandler.ProcessError(e); if (game != null) { try { game.Window.RescueData(); } catch { } game.Window.Close(); } } finally { if (game != null) { game.Dispose(); game = null; } } }
static void Initialize(string[] args) { var arg = new PPDExecuteArg(args); PPDSetting.Initialize( isDebug: arg.Count > 0, songDir: arg.ContainsKey("songdir") ? arg["songdir"] : "", langIso: arg.ContainsKey("lang") ? arg["lang"] : null, disableExpansion: arg.ContainsKey("disableexpansion"), disableShader: arg.ContainsKey("disableshader")); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var errorHandler = new SendErrorHandler(); errorHandler.Initialize(); if (args == null || args.Length == 0) { if (!CheckInstallInfo()) { MessageBox.Show(Utility.Language["InstallInfoError"]); return; } if (!CheckVersion()) { MessageBox.Show(Utility.Language["UpdateExists"]); #if DEBUG #else if (File.Exists("PPDUpdater.exe")) { var psi = new ProcessStartInfo(); psi.FileName = "PPDUpdater.exe"; Process.Start(psi); } #endif return; } if (!CheckAssembly(out string errors)) { MessageBox.Show(String.Format("{0}:\r\n{1}", Utility.Language["AssemblyError"], errors)); return; } } RunExpansion(); using (MyGame game = new MyGame(arg)) { try { game.Run(); } catch (Exception e) { errorHandler.ProcessError(e); } } if (expansionProcess != null && !expansionProcess.HasExited) { expansionProcess.CloseMainWindow(); if (!expansionProcess.WaitForExit(1000)) { expansionProcess.Kill(); } } }