static Exception StartGame(GameConfig config) { #if !DEBUG try { #endif var game = new FreelancerGame(config); game.Run(); return(null); #if !DEBUG } catch (Exception ex) { // no point in trying to recover from unrecoverable state //game.Crashed(); Console.Out.WriteLine("Unhandled {0}: ", ex.GetType().Name); Console.Out.WriteLine(ex.Message); Console.Out.WriteLine(ex.StackTrace); return(ex); } #endif }
public static void Main(string[] args) { FreelancerGame flgame = null; AppHandler.Run(() => { Func <string> filePath = null; if (args.Length > 0) { filePath = () => args[0]; } var cfg = GameConfig.Create(true, filePath); flgame = new FreelancerGame(cfg); flgame.Run(); }, () => flgame.Crashed()); }
public static void Main(string[] args) { if (Platform.RunningOS == OS.Windows) { string bindir = Path.GetDirectoryName(typeof(MainClass).Assembly.Location); var fullpath = Path.Combine(bindir, IntPtr.Size == 8 ? "x64" : "x86"); SetDllDirectory(fullpath); } if (!Platform.CheckDependencies()) { return; } FreelancerGame flgame = null; #if !DEBUG var domain = AppDomain.CurrentDomain; domain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => { var ex = (Exception)(e.ExceptionObject); CrashWindow.Run("Uh-oh!", "Librelancer has crashed. See the log for more information.", ex.Message + "\n" + ex.StackTrace); }; try { #endif Func <string> filePath = null; if (args.Length > 0) { filePath = () => args[0]; } var cfg = GameConfig.Create(true, filePath); flgame = new FreelancerGame(cfg); flgame.Run(); #if !DEBUG } catch (Exception ex) { try { flgame.Crashed(); } catch { } CrashWindow.Run("Uh-oh!", "Librelancer has crashed. See the log for more information.", ex.Message + "\n" + ex.StackTrace); } #endif }