Esempio n. 1
0
 public Game1()
 {
     culture = new CultureInfo("en-US");
     Thread.CurrentThread.CurrentCulture = culture;
     Thread.CurrentThread.CurrentUICulture = culture;
     threadsExiting = false;
     graphics = new GraphicsDeviceManager(this);
     graphics.GraphicsProfile = GraphicsProfile.HiDef;
     graphics.PreferMultiSampling = true;
     graphics.DeviceDisposing += graphics_DeviceDisposing;
     graphics.DeviceResetting += graphics_DeviceResetting;
     graphics.DeviceReset += graphics_DeviceReset;
     SettingsLoader.checkStatus();
     if (SettingsLoader.didLoad)
     {
         CanLoadContent = true;
         graphics.PreferredBackBufferWidth = Math.Min(SettingsLoader.resWidth, 4096);
         graphics.PreferredBackBufferHeight = Math.Min(SettingsLoader.resHeight, 4096);
         graphics.IsFullScreen = SettingsLoader.isFullscreen;
     }
     else if (Settings.windowed)
     {
         graphics.PreferredBackBufferWidth = 1280;
         graphics.PreferredBackBufferHeight = 800;
         CanLoadContent = true;
     }
     else
     {
         graphicsPreparedHandler = graphics_PreparingDeviceSettings;
         graphics.PreparingDeviceSettings += graphicsPreparedHandler;
         graphics.PreferredBackBufferWidth = 1280;
         graphics.PreferredBackBufferHeight = 800;
         graphics.IsFullScreen = true;
     }
     IsMouseVisible = true;
     IsFixedTimeStep = false;
     Content.RootDirectory = "Content";
     singleton = this;
     Exiting += handleExit;
     PlatformAPISettings.InitPlatformAPI();
     StatsManager.InitStats();
 }
Esempio n. 2
0
 private static void Main(string[] args)
 {
     using (var game1 = new Game1())
     {
         try
         {
             game1.Run();
         }
         catch (Exception ex1)
         {
             var str1 = Utils.GenerateReportFromException(ex1);
             try
             {
                 if (OS.currentInstance != null)
                 {
                     str1 = str1 + "\r\n\r\n" + OS.currentInstance.Flags.GetSaveString() + "\r\n\r\n";
                     str1 = string.Concat(str1, "Timer : ", (float) (OS.currentInstance.timer/60.0), "mins\r\n");
                     str1 = str1 + "Display cache : " + OS.currentInstance.displayCache + "\r\n";
                     str1 = str1 + "String Cache : " + OS.currentInstance.getStringCache + "\r\n";
                     str1 = str1 + "Terminal--------------\r\n" +
                            OS.currentInstance.terminal.GetRecentTerminalHistoryString() + "-------------\r\n";
                 }
                 else
                     str1 += "\r\n\r\nOS INSTANCE NULL\r\n\r\n";
                 str1 = str1 + "\r\nMenuErrorCache: " + MainMenu.AccumErrors + "\r\n";
             }
             catch (Exception ex2)
             {
             }
             var str2 = str1 + "\r\n\r\nPlatform API: " + PlatformAPISettings.Report +
                        "\r\n\r\nGraphics Device Reset Log: " + GraphicsDeviceResetLog + "\r\n\r\nCurrent Time: " +
                        DateTime.Now.ToShortTimeString() + "\r\n";
             Utils.writeToFile(str2, "CrashReport_" + Guid.NewGuid().ToString().Replace(" ", "_") + ".txt");
             Utils.SendRealWorldEmail(
                 "Hackent " + MainMenu.OSVersion + " Crash " + DateTime.Now.ToShortDateString() + " " +
                 DateTime.Now.ToShortTimeString(), "*****@*****.**", str2);
         }
     }
 }