Пример #1
0
        static void Main()
        {
            GameMain game = null;

            try
            {
                game = new GameMain();
                game.GraphicsDevice.PresentationParameters.IsFullScreen = false;
            }
            catch (Exception e)
            {
                if (game != null)
                {
                    game.Dispose();
                }
                CrashDump(null, "crashreport.log", e);
                return;
            }

#if DEBUG
            game.Run();
#else
            bool attemptRestart = false;

            do
            {
                try
                {
                    game.Run();
                    attemptRestart = false;
                }
                catch (Exception e)
                {
                    if (restartAttempts < 5 && CheckException(game, e))
                    {
                        attemptRestart = true;
                        restartAttempts++;
                    }
                    else
                    {
                        CrashDump(game, "crashreport.log", e);
                        attemptRestart = false;
                    }
                }
            } while (attemptRestart);
#endif

            try
            {
                game.Dispose();
            }
            catch (Exception e)
            {
                CrashDump(null, "crashreport.log", e);
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            GameMain game          = null;
            string   executableDir = "";

#if !DEBUG
            try
            {
#endif
            executableDir = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            SteamManager.Initialize();
            game = new GameMain(args);
            game.Run();
            game.Dispose();
#if !DEBUG
        }
        catch (Exception e)
        {
            try
            {
                CrashDump(game, Path.Combine(executableDir, "crashreport.log"), e);
            }
            catch (Exception e2)
            {
                CrashMessageBox("Barotrauma seems to have crashed, and failed to generate a crash report: "
                                + e2.Message + "\n" + e2.StackTrace.ToString(),
                                null);
            }
            game?.Dispose();
            return;
        }
#endif
        }
Пример #3
0
        static void Main(string[] args)
        {
            string executableDir = "";

#if !DEBUG
            AppDomain currentDomain = AppDomain.CurrentDomain;
            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(CrashHandler);
#endif

#if LINUX
            setLinuxEnv();
#endif

            Game          = null;
            executableDir = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            Directory.SetCurrentDirectory(executableDir);
            SteamManager.Initialize();
            EnableNvOptimus();
            Game = new GameMain(args);
            Game.Run();
            Game.Dispose();
            FreeNvOptimus();

            CrossThread.ProcessTasks();
        }
Пример #4
0
        static void Main(string[] args)
        {
            GameMain game = null;

#if !DEBUG
            try
            {
#endif
            SteamManager.Initialize();
            game = new GameMain(args);
            game.Run();
            game.Dispose();
#if !DEBUG
        }
        catch (Exception e)
        {
            try
            {
                CrashDump(game, "crashreport.log", e);
            }
            catch (Exception e2)
            {
                CrashMessageBox("Barotrauma seems to have crashed, and failed to generate a crash report: "
                                + e2.Message + "\n" + e2.StackTrace.ToString(),
                                null);
            }
            game?.Dispose();
            return;
        }
#endif
        }
Пример #5
0
 private static void CrashHandler(object sender, UnhandledExceptionEventArgs args)
 {
     try
     {
         Game?.Exit();
         CrashDump(Game, "crashreport.log", (Exception)args.ExceptionObject);
         Game?.Dispose();
     }
     catch
     {
         //exception handler is broken, we have a serious problem here!!
         return;
     }
 }
Пример #6
0
        static void Main()
        {
            SteamManager.Initialize();
            GameMain game = null;

#if !DEBUG
            try
            {
#endif
            game = new GameMain();
#if !DEBUG
        }
        catch (Exception e)
        {
            if (game != null)
            {
                game.Dispose();
            }
            CrashDump(null, "crashreport.log", e);
            return;
        }
#endif

#if DEBUG
            game.Run();
#else
            bool attemptRestart = false;

            do
            {
                try
                {
                    game.Run();
                    attemptRestart = false;
                }
                catch (Exception e)
                {
                    if (restartAttempts < 5 && CheckException(game, e))
                    {
                        attemptRestart = true;
                        restartAttempts++;
                    }
                    else
                    {
                        CrashDump(game, "crashreport.log", e);
                        attemptRestart = false;
                    }
                }
            } while (attemptRestart);
#endif

#if !DEBUG
            try
            {
#endif
            game.Dispose();
#if !DEBUG
        }
        catch (Exception e)
        {
            CrashDump(null, "crashreport.log", e);
        }
#endif
        }