private void RunOptionsAndReturnExitCode(IFoESMM app, Options opts) { Log.InitializeLogger(opts.Logging, opts.Trace); Log.I("foesmm started"); string gameCodeBase; if (opts.Game != null && File.Exists(gameCodeBase = Path.Combine(CurrentDirectory, $"foesmm.game.{opts.Game}.dll"))) { var game = LoadGame(gameCodeBase); if (opts.StartGame) { RunGame(game, opts.Profile); } else { ManageGame(game); } } else { var chooser = new GameChooserWindow(PreloadGames()); chooser.Show(); } }
public static void ProcessException(IFoESMM app, Exception exception) { var appdata = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Path.Combine("foesmm", "crushdumps")); if (!Directory.Exists(appdata)) { Directory.CreateDirectory(appdata); } var filename = $"dump-{DateTime.UtcNow:yyyyMMdd-HHmmss}.txt"; var crashdump = Path.Combine(appdata, filename); Log.D(crashdump); var computerInfo = new ComputerInfo(); var dump = string.Concat( app.CrashTrace, app.CurrentGame?.CrashTrace, $"OS: {computerInfo.OSFullName} v{computerInfo.OSVersion}\n", Wine.IsWine ? $"Wine: v{Wine.GetVersion()}, Host: {Wine.GetHost()}\n" : null, $"Exception Signature: {exception.Guid()}\n", $"Source: {Path.GetFileName(exception.FirstFrame().GetFileName())}:{exception.FirstFrame().GetFileLineNumber()}\n", exception.StackTrace ); var innerException = exception.InnerException; while (innerException != null) { dump += innerException.ToString(); innerException = innerException.InnerException; } ; Log.F(dump); File.WriteAllText(crashdump, dump); var reporter = new CrashReporter(app, exception.Message, crashdump); reporter.ShowDialog(); Console.WriteLine(); }
private void HandleParseError(IFoESMM app, IEnumerable <Error> errors) { Console.WriteLine("Exit"); app.Shutdown(); }