Пример #1
0
        static void Main()
        {
            using (var game = new GameMain())
            {
#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.txt", e);
                            attemptRestart = false;
                        }
                    }
                } while (attemptRestart);
#endif
            }
        }
Пример #2
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);
            }
        }
Пример #3
0
        static void Main()
        {
#if WINDOWS
            SetErrorMode(ErrorModes.SEM_NOGPFAULTERRORBOX);
#endif
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnrecoverableCrashHandler);

            try
            {
                CrashRestarted = false;
                game           = new GameMain();
                inputThread    = new Thread(new ThreadStart(game.ProcessInput));
                inputThread.Start();
                game.Run();
                inputThread.Abort(); inputThread.Join();
                if (GameSettings.SendUserStatistics)
                {
                    GameAnalytics.OnStop();
                }
            }
            catch (Exception e)
            {
                string CrashName = "crashreport" + "_" + DateTime.Now.ToShortDateString() + "_" + DateTime.Now.ToShortTimeString() + ".txt";

                CrashName = CrashName.Replace(":", "");
                CrashName = CrashName.Replace("../", "");
                CrashName = CrashName.Replace("/", "");
                CrashDump(game, CrashName, e);
                //inputThread.Abort(); inputThread.Join();
            }
        }
Пример #4
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
        }
Пример #5
0
        static void Main(string[] args)
        {
#if !DEBUG
            AppDomain currentDomain = AppDomain.CurrentDomain;
            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(CrashHandler);
#endif

#if LINUX
            setLinuxEnv();
#endif
            Console.WriteLine("Barotrauma Dedicated Server " + GameMain.Version +
                              " (" + AssemblyInfo.BuildString + ", branch " + AssemblyInfo.GitBranch + ", revision " + AssemblyInfo.GitRevision + ")");
            if (Console.IsOutputRedirected)
            {
                Console.WriteLine("Output redirection detected; colored text and command input will be disabled.");
            }
            if (Console.IsInputRedirected)
            {
                Console.WriteLine("Redirected input is detected but is not supported by this application. Input will be ignored.");
            }

            string executableDir = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            Directory.SetCurrentDirectory(executableDir);
            Game = new GameMain(args);

            Game.Run();
            if (GameSettings.SendUserStatistics)
            {
                GameAnalytics.OnQuit();
            }
            SteamManager.ShutDown();
        }
Пример #6
0
        static void Main(string[] args)
        {
            GameMain game        = null;
            Thread   inputThread = null;

#if !DEBUG
            try
            {
#endif
            game        = new GameMain(args);
            inputThread = new Thread(new ThreadStart(DebugConsole.UpdateCommandLine));
            inputThread.Start();
            game.Run();
            inputThread.Abort(); inputThread.Join();
            if (GameSettings.SendUserStatistics)
            {
                GameAnalytics.OnStop();
            }
            SteamManager.ShutDown();
#if !DEBUG
        }

        catch (Exception e)
        {
            CrashDump(game, "servercrashreport.log", e);
            inputThread.Abort(); inputThread.Join();
        }
#endif
        }
Пример #7
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();
        }
Пример #8
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
        }
Пример #9
0
        static void Main()
        {
#if WINDOWS
            SetErrorMode(ErrorModes.SEM_NOGPFAULTERRORBOX);
#endif
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnrecoverableCrashHandler);

            using (game = new GameMain())
            {
#if DEBUG
                game.Run();
#else
                bool attemptRestart = false;
                CrashRestarted = false;

                do
                {
                    try
                    {
                        game.Run();
                        attemptRestart = false;
                    }
                    catch (Exception e)
                    {
                        if (restartAttempts < 5 && CheckException(game, e))
                        {
                            attemptRestart = true;
                            restartAttempts++;
                        }
                        else
                        {
                            string CrashName = "crashreport" + "_" + DateTime.Now.ToShortDateString() + "_" + DateTime.Now.ToShortTimeString() + ".txt";

                            CrashName = CrashName.Replace(":", "");
                            CrashName = CrashName.Replace("../", "");
                            CrashName = CrashName.Replace("/", "");
                            CrashDump(game, CrashName, e);
                        }
                    }
                } while (attemptRestart);
#endif
            }
        }
Пример #10
0
        static void Main()
        {
            GameMain game        = null;
            Thread   inputThread = null;

            try
            {
                game        = new GameMain();
                inputThread = new Thread(new ThreadStart(game.ProcessInput));
                inputThread.Start();
                game.Run();
                inputThread.Abort(); inputThread.Join();
            }
            catch (Exception e)
            {
                CrashDump(game, "servercrashreport.txt", e);
                inputThread.Abort(); inputThread.Join();
            }
        }
Пример #11
0
        static void Main(string[] args)
        {
            GameMain game = null;

#if !DEBUG
            try
            {
#endif
            game = new GameMain(args);
            DebugConsole.InputThread = null;
#if !DEBUG
            if (!args.Contains("-ownerkey") && !args.Contains("-steamid"))
            {
#endif
            DebugConsole.InputThread = new Thread(new ThreadStart(DebugConsole.UpdateCommandLine));
            DebugConsole.InputThread.IsBackground = true;
            DebugConsole.InputThread.Start();
#if !DEBUG
        }
        else
        {
            Console.WriteLine("Server launched through client, command line IO disabled");
        }
#endif
            game.Run();
            DebugConsole.InputThread?.Abort(); DebugConsole.InputThread?.Join();
            if (GameSettings.SendUserStatistics)
            {
                GameAnalytics.OnQuit();
            }
            SteamManager.ShutDown();
#if !DEBUG
        }
        catch (Exception e)
        {
            CrashDump(game, "servercrashreport.log", e);
            GameMain.Server?.NotifyCrash();
            DebugConsole.InputThread?.Abort(); DebugConsole.InputThread?.Join();
        }
#endif
        }
Пример #12
0
        static void Main(string[] args)
        {
#if !DEBUG
            AppDomain currentDomain = AppDomain.CurrentDomain;
            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(CrashHandler);
#endif

#if LINUX
            setLinuxEnv();
#endif
            Console.WriteLine("Barotrauma Dedicated Server " + GameMain.Version +
                              " (" + AssemblyInfo.GetBuildString() + ", branch " + AssemblyInfo.GetGitBranch() + ", revision " + AssemblyInfo.GetGitRevision() + ")");

            Game = new GameMain(args);

            Game.Run();
            if (GameSettings.SendUserStatistics)
            {
                GameAnalytics.OnQuit();
            }
            SteamManager.ShutDown();
        }
Пример #13
0
        static void Main()
        {
            GameMain game        = null;
            Thread   inputThread = null;

            try
            {
                game        = new GameMain();
                inputThread = new Thread(new ThreadStart(game.ProcessInput));
                inputThread.Start();
                game.Run();
                inputThread.Abort(); inputThread.Join();
                if (GameSettings.SendUserStatistics)
                {
                    GameAnalytics.OnStop();
                }
            }
            catch (Exception e)
            {
                CrashDump(game, "servercrashreport.txt", e);
                inputThread.Abort(); inputThread.Join();
            }
        }
Пример #14
0
        static void Main(string[] args)
        {
#if !DEBUG
            AppDomain currentDomain = AppDomain.CurrentDomain;
            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(CrashHandler);
#endif

#if LINUX
            setLinuxEnv();
#endif
            Console.WriteLine("Barotrauma Dedicated Server " + GameMain.Version +
                              " (" + AssemblyInfo.BuildString + ", branch " + AssemblyInfo.GitBranch + ", revision " + AssemblyInfo.GitRevision + ")");

            string executableDir = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            Directory.SetCurrentDirectory(executableDir);
            Game = new GameMain(args);

            Game.Run();
            if (GameSettings.SendUserStatistics)
            {
                GameAnalytics.OnQuit();
            }
            SteamManager.ShutDown();
        }
Пример #15
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
        }