Пример #1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static void Main(string[] args)
        {
            try
            {
                var cwd = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                Directory.SetCurrentDirectory(new Uri(cwd).LocalPath);
                using (Stream stream = System.Reflection.Assembly.GetExecutingAssembly()
                                       .GetManifestResourceStream("DwarfCorp.version.txt"))
                    using (StreamReader reader = new StreamReader(stream))
                        Commit = reader.ReadToEnd();
            }
            catch (Exception) { }

#if CREATE_CRASH_LOGS
            try
#endif
            {
                Thread.CurrentThread.CurrentCulture   = System.Globalization.CultureInfo.InvariantCulture;
                Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture;
                //fbDeprofiler.DeProfiler.Load();
                using (DwarfGame game = new DwarfGame())
                {
                    game.Run();
                }

                SignalShutdown();
            }
#if CREATE_CRASH_LOGS
            catch (Exception exception)
            {
                WriteExceptionLog(exception);
            }
#endif
        }
Пример #2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static void Main(string[] args)
        {
            try
            {
                var cwd = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                Directory.SetCurrentDirectory(new Uri(cwd).LocalPath);
                using (Stream stream = new FileStream("version.txt", FileMode.Open))
                    using (StreamReader reader = new StreamReader(stream))
                        Commit = reader.ReadToEnd();
                Commit = Commit.Trim();
            }
            catch (Exception) { }
            System.Net.ServicePointManager.ServerCertificateValidationCallback = SSLCallback;
#if CREATE_CRASH_LOGS
            try
#endif
#if !DEBUG
            try
#endif
            {
                Thread.CurrentThread.CurrentCulture   = System.Globalization.CultureInfo.InvariantCulture;
                Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture;
                //fbDeprofiler.DeProfiler.Load();
                using (DwarfGame game = new DwarfGame())
                {
                    foreach (var arg in args)
                    {
                        if (arg == "--test-save")
                        {
                            game.DoSaveLoadtest();
                        }
                    }
                    game.Run();
                }

                SignalShutdown();
            }
#if CREATE_CRASH_LOGS
            catch (Exception exception)
            {
                WriteExceptionLog(exception);
            }
#endif
#if !DEBUG
            catch (Exception exception)
            {
                SDL2.SDL.SDL_ShowSimpleMessageBox(SDL2.SDL.SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR, "Unhandled Exception!", String.Format("An unhandled exception occurred in DwarfCorp. This has been reported to Completely Fair Games LLC.\n {0}", exception.ToString()), IntPtr.Zero);
                WriteExceptionLog(exception);
            }
#endif
        }
Пример #3
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static void Main(string[] args)
        {
            try
            {
                var cwd = global::System.IO.Path.GetDirectoryName(global::System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                Directory.SetCurrentDirectory(new Uri(cwd).LocalPath);
                using (Stream stream = global::System.Reflection.Assembly.GetExecutingAssembly()
                                       .GetManifestResourceStream("DwarfCorp.version.txt"))
                    using (StreamReader reader = new StreamReader(stream))
                        Commit = reader.ReadToEnd();

                Commit = Commit.Trim();
            }
            catch (Exception) { }

            Thread.CurrentThread.CurrentCulture   = global::System.Globalization.CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = global::System.Globalization.CultureInfo.InvariantCulture;


#if !DEBUG
            try
#endif
            {
#if XNA_BUILD
                fbDeprofiler.DeProfiler.Load();
#endif
                using (DwarfGame game = new DwarfGame())
                {
                    game.Run();
                }

                while (AssetManagement.Steam.Steam.HasTransaction(a => true))
                {
                    AssetManagement.Steam.Steam.Update();
                }

                SignalShutdown();
            }
#if !DEBUG
            catch (Exception exception)
            {
                WriteExceptionLog(exception);
                string report = "This was automatically reported to the devs to help us debug!";
                if (!GameSettings.Default.AllowReporting)
                {
                    report = "You have opted out of automatic crash reporting.";
                }
                System.Windows.Forms.MessageBox.Show(String.Format("An unhandled exception occurred in DwarfCorp. {1} \n {0}", exception.ToString(), report), "ERROR");
            }
#endif
        }
Пример #4
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static void Main(string[] args)
        {
#if CREATE_CRASH_LOGS
            try
#endif
            {
                using (DwarfGame game = new DwarfGame())
                {
                    game.Run();
                }

                SignalShutdown();
            }
#if CREATE_CRASH_LOGS
            catch (Exception exception)
            {
                WriteExceptionLog(exception);
            }
#endif
        }
Пример #5
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static void Main(string[] args)
        {
            try
            {
                var cwd = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                Directory.SetCurrentDirectory(new Uri(cwd).LocalPath);
                using (Stream stream = System.Reflection.Assembly.GetExecutingAssembly()
                                       .GetManifestResourceStream("DwarfCorp.version.txt"))
                    using (StreamReader reader = new StreamReader(stream))
                        Commit = reader.ReadToEnd();
            }
            catch (Exception) { }

            Thread.CurrentThread.CurrentCulture   = System.Globalization.CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture;

#if !DEBUG
            try
#endif
            {
                fbDeprofiler.DeProfiler.Load();
                using (DwarfGame game = new DwarfGame())
                {
                    game.Run();
                }

                SignalShutdown();
            }
#if !DEBUG
            catch (Exception exception)
            {
                WriteExceptionLog(exception);
                System.Windows.Forms.MessageBox.Show(String.Format("An unhandled exception occurred in DwarfCorp. This has been reported to Completely Fair Games LLC.\n {0}", exception.ToString()), "ERROR");
            }
#endif
        }
Пример #6
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static void Main(string[] args)
        {
            try
            {
                var cwd = global::System.IO.Path.GetDirectoryName(global::System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                Directory.SetCurrentDirectory(new Uri(cwd).LocalPath);
                using (Stream stream = global::System.Reflection.Assembly.GetExecutingAssembly()
                                       .GetManifestResourceStream("DwarfCorp.version.txt"))
                    using (StreamReader reader = new StreamReader(stream))
                        Commit = reader.ReadToEnd();

                Commit = Commit.Trim();
            }
            catch (Exception) { }

            Thread.CurrentThread.CurrentCulture   = global::System.Globalization.CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = global::System.Globalization.CultureInfo.InvariantCulture;

            GameSettings.Load();


#if !DEBUG
            try
            {
                if (GameSettings.Current.AllowReporting)
                {
                    ravenClient = new RavenClient("https://*****:*****@sentry.io/192119");
                    ravenClient.Tags["Version"]  = Program.Version;
                    ravenClient.Tags["Commit"]   = Program.Commit;
                    ravenClient.Tags["Platform"] = "XNA";
                    ravenClient.Tags["OS"]       = "Windows";
                }
            }
            catch (Exception exception)
            {
                Console.Error.WriteLine(exception.ToString());
            }
#endif

#if !DEBUG
            try
#endif
            {
                fbDeprofiler.DeProfiler.Load();

                using (DwarfGame game = new DwarfGame())
                {
                    game.Run();
                }

                while (AssetManagement.Steam.Steam.HasTransaction(a => true))
                {
                    AssetManagement.Steam.Steam.Update();
                }

                SignalShutdown();
            }
#if !DEBUG
            catch (HandledException exception)
            {
                WriteExceptionLog(exception.InnerException);
            }
            catch (Exception exception)
            {
                CaptureException(exception);
                WriteExceptionLog(exception);
                var report = GameSettings.Current.AllowReporting ? "This was automatically reported to the devs to help us debug!" : "You have opted out of automatic crash reporting.";
                System.Windows.Forms.MessageBox.Show(String.Format("An unhandled exception occurred in DwarfCorp. {1} \n {0}", exception.ToString(), report), "ERROR");
            }
#endif
        }