private static void Main(string[] args) { Trace.Listeners.Add(new ConsoleTraceListener()); string chobbyTag = null; string engineOverride = null; if (args.Length > 0) { if (args[0] == "--help" || args[0] == "-h" || args[0] == "/?") { MessageBox.Show("chobby.exe [rapid_tag] [engine_override] \n\nUse chobby:stable or chobby:test\nTo run local dev version use chobby.exe dev"); } chobbyTag = args[0]; if (args.Length > 1) engineOverride = args[1]; } var startupPath = Path.GetDirectoryName(Path.GetFullPath(Application.ExecutablePath)); if (!SpringPaths.IsDirectoryWritable(startupPath)) { MessageBox.Show("Please move this program to a writable folder", "Cannot write to startup folder", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Application.EnableVisualStyles(); var cf = new ChobbylaForm(new Chobbyla(startupPath, chobbyTag, engineOverride)) { StartPosition = FormStartPosition.CenterScreen }; cf.ShowDialog(); }
private static void Main(string[] args) { Trace.Listeners.Add(new ConsoleTraceListener()); string chobbyTag = null; string engineOverride = null; if (args.Length > 0) { if (args[0] == "--help" || args[0] == "-h" || args[0] == "/?") { MessageBox.Show("chobby.exe [rapid_tag] [engine_override] \n\nUse zkmenu:stable or chobby:test\nTo run local dev version use chobby.exe dev"); } chobbyTag = args[0]; if (args.Length > 1) engineOverride = args[1]; } var startupPath = Path.GetDirectoryName(Path.GetFullPath(Application.ExecutablePath)); if (!SpringPaths.IsDirectoryWritable(startupPath)) { MessageBox.Show("Please move this program to a writable folder", "Cannot write to startup folder", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Application.EnableVisualStyles(); try { var chobbyla = new Chobbyla(startupPath, chobbyTag, engineOverride); var cf = new ChobbylaForm(chobbyla) { StartPosition = FormStartPosition.CenterScreen }; if (cf.ShowDialog() == DialogResult.OK) { chobbyla.Run().Wait(); Environment.Exit(0); } } catch (Exception ex) { Trace.TraceError("Error starting chobby: {0}", ex); MessageBox.Show(ex.ToString(), "Error starting Chobby", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private static void RunWrapper(Chobbyla chobbyla, ulong connectLobbyID, TextWriter logWriter, StringBuilder logSb) { if (!chobbyla.IsSteamFolder) // not steam, show gui { var cf = new ChobbylaForm(chobbyla) { StartPosition = FormStartPosition.CenterScreen }; if (cf.ShowDialog() != DialogResult.OK) { return; } } else if (!chobbyla.Prepare().Result) { return; // otherwise just do simple prepare, no gui } var springRunOk = chobbyla.Run(connectLobbyID, logWriter); Trace.TraceInformation("Spring exited"); if (!springRunOk) { Trace.TraceWarning("Spring crash detected"); } logWriter.Flush(); var logStr = logSb.ToString(); var syncError = CrashReportHelper.IsDesyncMessage(logStr); if (syncError) { Trace.TraceWarning("Sync error detected"); } var openGlFail = logStr.Contains("No OpenGL drivers installed.") || logStr.Contains("Please go to your GPU vendor's website and download their drivers.") || logStr.Contains("minimum required OpenGL version not supported, aborting") || logStr.Contains("Update your graphic-card driver!"); if (openGlFail) { Trace.TraceWarning("Outdated OpenGL detected"); MessageBox.Show("You have outdated graphics card drivers!\r\nPlease try finding ones for your graphics card and updating them.", "Outdate graphics card driver detected", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if ((!springRunOk && !openGlFail) || syncError) // crash has occured { if ( MessageBox.Show("We would like to send crash/desync data to Zero-K repository, it can contain chat. Do you agree?", "Automated crash report", MessageBoxButtons.OKCancel) == DialogResult.OK) { var ret = CrashReportHelper.ReportCrash(logSb.ToString(), syncError, chobbyla.engine); if (ret != null) { try { Process.Start(ret.HtmlUrl.ToString()); } catch { } } } try { GameAnalytics.AddErrorEvent(EGAErrorSeverity.Critical, "Spring crash"); } catch (Exception ex) { Trace.TraceError("Error adding GA error event: {0}", ex); } } }
private static void RunWrapper(Chobbyla chobbyla, ulong connectLobbyID, TextWriter logWriter, StringBuilder logSb) { if (!chobbyla.IsSteamFolder) // not steam, show gui { var cf = new ChobbylaForm(chobbyla) { StartPosition = FormStartPosition.CenterScreen }; if (cf.ShowDialog() != DialogResult.OK) { return; } } else if (!chobbyla.Prepare().Result) { return; // otherwise just do simple prepare, no gui } var springRunOk = chobbyla.Run(connectLobbyID, logWriter); Trace.TraceInformation("Spring exited"); if (!springRunOk) { Trace.TraceWarning("Spring crash detected"); } logWriter.Flush(); var logStr = logSb.ToString(); var syncError = CrashReportHelper.IsDesyncMessage(logStr); if (syncError) { Trace.TraceWarning("Sync error detected"); } var openGlFail = logStr.Contains("No OpenGL drivers installed.") || logStr.Contains("This stack trace indicates a problem with your graphic card driver") || logStr.Contains("Please go to your GPU vendor's website and download their drivers.") || logStr.Contains("minimum required OpenGL version not supported, aborting") || logStr.Contains("Update your graphic-card driver!"); if (openGlFail) { Trace.TraceWarning("Outdated OpenGL detected"); if (Environment.OSVersion.Platform == PlatformID.Unix) { if (MessageBox.Show("You have outdated graphics card drivers!\r\nPlease try finding ones for your graphics card and updating them. \r\n\r\nWould you like to see our Linux graphics driver guide?", "Outdated graphics card driver detected", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Process.Start("http://zero-k.info/mediawiki/index.php?title=Optimized_Graphics_Linux"); } } else { MessageBox.Show("You have outdated graphics card drivers!\r\nPlease try finding ones for your graphics card and updating them.", "Outdated graphics card driver detected", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } var luaErr = logStr.Contains("LUA_ERRRUN"); if ((!springRunOk && !openGlFail) || syncError || luaErr || !string.IsNullOrEmpty(chobbyla.BugReportTitle)) // crash has occured { if ( MessageBox.Show("We would like to send crash/desync data to Zero-K repository, it can contain chat. Do you agree?", "Automated crash report", MessageBoxButtons.OKCancel) == DialogResult.OK) { var crashType = syncError ? CrashType.Desync : luaErr ? CrashType.LuaError : CrashType.Crash; if (!string.IsNullOrEmpty(chobbyla.BugReportTitle)) { crashType = CrashType.UserReport; } var ret = CrashReportHelper.ReportCrash(logSb.ToString(), crashType, chobbyla.engine, chobbyla.BugReportTitle, chobbyla.BugReportDescription); if (ret != null) { try { Process.Start(ret.HtmlUrl.ToString()); } catch { } } } try { GameAnalytics.AddErrorEvent(EGAErrorSeverity.Critical, "Spring crash"); } catch (Exception ex) { Trace.TraceError("Error adding GA error event: {0}", ex); } } }