Exemplo n.º 1
0
 private void UpdateUIForSaveMissing(string saveName, Exception ex)
 {
     this.State           = MainMenu.MainMenuState.Normal;
     MainMenu.AccumErrors = MainMenu.AccumErrors + "ACCOUNT FILE NOT FOUND: Account " + saveName + " appears to be missing. It may have been moved or deleted. Reported Error:\r\n" + Utils.GenerateReportFromException(ex) + "\r\n";
     if (this.hasSentErrorEmail)
     {
         return;
     }
     new Thread((ThreadStart)(() => Utils.SendErrorEmail(ex, "Save Missing ", "")))
     {
         IsBackground = true,
         Name         = "SaveMissingErrorReportThread"
     }.Start();
     this.hasSentErrorEmail = true;
 }
Exemplo n.º 2
0
 private void UpdateUIForSaveCreationFailed(Exception ex)
 {
     this.State           = MainMenu.MainMenuState.Normal;
     MainMenu.AccumErrors = MainMenu.AccumErrors + "CRITICAL ERROR CREATING ACCOUNT: Reported Error:\r\n" + Utils.GenerateReportFromException(ex) + "\r\n";
     if (this.hasSentErrorEmail)
     {
         return;
     }
     new Thread((ThreadStart)(() => Utils.SendErrorEmail(ex, "Account Creation Error ", "")))
     {
         IsBackground = true,
         Name         = "SaveAccCreationErrorReportThread"
     }.Start();
     this.hasSentErrorEmail = true;
 }
Exemplo n.º 3
0
 private void UpdateUIForSaveCorruption(string saveName, Exception ex)
 {
     this.State           = MainMenu.MainMenuState.Normal;
     MainMenu.AccumErrors = MainMenu.AccumErrors + string.Format(LocaleTerms.Loc("ACCOUNT FILE CORRUPTION: Account {0} appears to be corrupted, and will not load."), (object)saveName) + " Reported Error:\r\n" + Utils.GenerateReportFromException(ex) + "\r\n";
     if (this.hasSentErrorEmail)
     {
         return;
     }
     new Thread((ThreadStart)(() => Utils.SendErrorEmail(ex, "Save Corruption ", "")))
     {
         IsBackground = true,
         Name         = "SaveCorruptErrorReportThread"
     }.Start();
     this.hasSentErrorEmail = true;
 }
Exemplo n.º 4
0
        private void drawMainMenuButtons(bool canRun)
        {
            int num1 = 135;
            int num2;

            if (Button.doButton(1, 180, num2 = num1 + 65, 450, 50, LocaleTerms.Loc("New Session"), new Color?(MainMenu.buttonColor)) && canRun)
            {
                this.NextStartedGameShouldBeDLCAccelerated = false;
                this.State = MainMenu.MainMenuState.NewUser;
                this.loginScreen.ClearTextBox();
                this.loginScreen.ResetForNewAccount();
            }
            bool   hasSaves = SaveFileManager.HasSaves;
            string text     = LocaleTerms.Loc("No Accounts");

            if (hasSaves)
            {
                text = !this.canLoad ? LocaleTerms.Loc("Invalid Last Account : Login Manually") : string.Format(LocaleTerms.Loc("Continue with account [{0}]"), (object)SaveFileManager.LastLoggedInUser.Username);
            }
            int num3;

            if (Button.doButton(1102, 180, num3 = num2 + 65, 450, 28, text, new Color?(this.canLoad ? MainMenu.buttonColor : Color.Black)) && this.canLoad)
            {
                this.loginScreen.ClearTextBox();
                this.loginScreen.LoadGameForUserFileAndUsername(SaveFileManager.LastLoggedInUser.FileUsername, SaveFileManager.LastLoggedInUser.Username);
            }
            int num4;

            if (Button.doButton(11, 180, num4 = num3 + 39, 450, 50, LocaleTerms.Loc("Login"), new Color?(hasSaves ? MainMenu.buttonColor : Color.Black)))
            {
                if (hasSaves)
                {
                    try
                    {
                        this.State = MainMenu.MainMenuState.Login;
                        this.loginScreen.ClearTextBox();
                        this.loginScreen.ResetForLogin();
                    }
                    catch (Exception ex)
                    {
                        Utils.writeToFile(LocaleTerms.Loc("OS Load Error") + ": " + ex.ToString() + "\n\n" + ex.StackTrace, "crashLog.txt");
                    }
                }
            }
            int num5;

            if (Button.doButton(3, 180, num5 = num4 + 65, 450, 50, LocaleTerms.Loc("Settings"), new Color?(MainMenu.buttonColor)))
            {
                this.ScreenManager.AddScreen((GameScreen) new OptionsMenu(), new PlayerIndex?(this.ScreenManager.controllingPlayer));
            }
            int num6;
            int y = num6 = num5 + 65;

            if (Settings.isServerMode)
            {
                if (Button.doButton(4, 180, y, 450, 50, "Start Relay Server", new Color?(MainMenu.buttonColor)))
                {
                    this.ScreenManager.AddScreen((GameScreen) new ServerScreen(), new PlayerIndex?(this.ScreenManager.controllingPlayer));
                }
                y += 65;
            }
            if (Settings.AllowExtensionMode)
            {
                if (Button.doButton(5, 180, y, 450, 50, "Extensions", new Color?(MainMenu.buttonColor)))
                {
                    this.State = MainMenu.MainMenuState.Extensions;
                    this.extensionsScreen.Reset();
                }
                y += 65;
            }
            if (Settings.HasLabyrinthsDemoStartMainMenuButton && DLC1SessionUpgrader.HasDLC1Installed)
            {
                if (Button.doButton(7, 180, y, 450, 28, "New Labyrinths Accelerated Session", new Color?(Color.Lerp(Utils.AddativeWhite, new Color(68, 162, 194), 1f - Utils.rand(0.3f)))) && canRun)
                {
                    this.NextStartedGameShouldBeDLCAccelerated = true;
                    this.State = MainMenu.MainMenuState.NewUser;
                    this.loginScreen.ClearTextBox();
                    this.loginScreen.ResetForNewAccount();
                }
                y += 65;
            }
            if (Button.doButton(15, 180, y, 450, 28, LocaleTerms.Loc("Exit"), new Color?(MainMenu.exitButtonColor)))
            {
                MusicManager.stop();
                Game1.threadsExiting = true;
                Game1.getSingleton().Exit();
            }
            int num7 = y + 30;

            if (!PlatformAPISettings.RemoteStorageRunning)
            {
                TextItem.doFontLabel(new Vector2(180f, (float)num7), LocaleTerms.Loc("WARNING: Error connecting to Steam Cloud"), GuiData.smallfont, new Color?(Color.DarkRed), float.MaxValue, float.MaxValue, false);
                num7 += 20;
            }
            if (string.IsNullOrWhiteSpace(MainMenu.AccumErrors))
            {
                return;
            }
            TextItem.doFontLabel(new Vector2(180f, (float)num7), MainMenu.AccumErrors, GuiData.smallfont, new Color?(Color.DarkRed), float.MaxValue, float.MaxValue, false);
            int num8 = num7 + 20;
        }
Exemplo n.º 5
0
 private void HookUpCreationEvents()
 {
     this.loginScreen.RequestGoBack += (Action)(() => this.State = MainMenu.MainMenuState.Normal);
     this.loginScreen.StartNewGameForUsernameAndPass += (Action <string, string>)((username, pass) =>
     {
         if (SaveFileManager.AddUser(username, pass))
         {
             string filePathForLogin = SaveFileManager.GetFilePathForLogin(username, pass);
             this.ExitScreen();
             MainMenu.resetOS();
             if (!Settings.soundDisabled)
             {
                 this.ScreenManager.playAlertSound();
             }
             try
             {
                 OS os = new OS();
                 os.SaveGameUserName    = filePathForLogin;
                 os.SaveUserAccountName = username;
                 if (this.NextStartedGameShouldBeDLCAccelerated)
                 {
                     os.IsDLCConventionDemo = true;
                     os.Flags.AddFlag("TutorialComplete");
                     Settings.EnableDLC         = true;
                     Settings.initShowsTutorial = false;
                     os.initShowsTutorial       = false;
                 }
                 this.ScreenManager.AddScreen((GameScreen)os, new PlayerIndex?(this.ScreenManager.controllingPlayer));
                 os.Flags.AddFlag("startVer:" + MainMenu.OSVersion);
                 if (!this.NextStartedGameShouldBeDLCAccelerated)
                 {
                     return;
                 }
                 SessionAccelerator.AccelerateSessionToDLCStart((object)os);
                 os.delayer.Post(ActionDelayer.Wait(0.15), (Action)(() => Game1.getSingleton().IsMouseVisible = true));
                 this.NextStartedGameShouldBeDLCAccelerated = false;
             }
             catch (Exception ex)
             {
                 this.UpdateUIForSaveCreationFailed(ex);
             }
         }
         else
         {
             this.loginScreen.ResetForNewAccount();
             this.loginScreen.WriteToHistory(" ERROR: Username invalid or already in use.");
         }
     });
     this.loginScreen.LoadGameForUserFileAndUsername += (Action <string, string>)((userFile, username) =>
     {
         this.ExitScreen();
         MainMenu.resetOS();
         if (SaveFileManager.StorageMethods[0].FileExists(userFile))
         {
             OS.WillLoadSave = true;
             OS os = new OS();
             os.SaveGameUserName    = userFile;
             os.SaveUserAccountName = username;
             try
             {
                 this.ScreenManager.AddScreen((GameScreen)os, new PlayerIndex?(this.ScreenManager.controllingPlayer));
             }
             catch (XmlException ex)
             {
                 this.UpdateUIForSaveCorruption(userFile, (Exception)ex);
             }
             catch (FormatException ex)
             {
                 this.UpdateUIForSaveCorruption(userFile, (Exception)ex);
             }
             catch (NullReferenceException ex)
             {
                 this.UpdateUIForSaveCorruption(userFile, (Exception)ex);
             }
             catch (FileNotFoundException ex)
             {
                 this.UpdateUIForSaveMissing(userFile, (Exception)ex);
             }
             catch (ContentLoadException ex1)
             {
                 string str = Utils.ReadEntireContentsOfStream(SaveFileManager.StorageMethods[0].GetFileReadStream(userFile));
                 if (str.Contains("DigiPets"))
                 {
                     string data = str.Replace("DigiPets", "Neopals").Replace("DigiPoints", "Neopoints");
                     for (int index = 0; index < 3; ++index)
                     {
                         try
                         {
                             Thread.Sleep(200);
                             SaveFileManager.StorageMethods[0].WriteFileData(userFile, data);
                             break;
                         }
                         catch (IOException ex2)
                         {
                         }
                         Thread.Sleep(500);
                     }
                     MainMenu.AccumErrors = "-- Savefile Automatically Upgraded - Try again! --";
                 }
                 else
                 {
                     this.UpdateUIForSaveCorruption(userFile, (Exception)ex1);
                 }
             }
         }
         else
         {
             OS.WillLoadSave = false;
             this.UpdateUIForSaveMissing(userFile, (Exception) new FileNotFoundException());
         }
     });
     this.attractModeScreen.Start += (Action)(() =>
     {
         try
         {
             this.ExitScreen();
             MainMenu.resetOS();
             if (!Settings.soundDisabled)
             {
                 this.ScreenManager.playAlertSound();
             }
             this.ScreenManager.AddScreen((GameScreen) new OS(), new PlayerIndex?(this.ScreenManager.controllingPlayer));
         }
         catch (Exception ex)
         {
             Utils.writeToFile("OS Load Error: " + ex.ToString() + "\n\n" + ex.StackTrace, "crashLog.txt");
         }
     });
     this.attractModeScreen.StartDLC += (Action)(() =>
     {
         try
         {
             this.ExitScreen();
             MainMenu.resetOS();
             Settings.EnableDLC = true;
             Settings.initShowsTutorial = false;
             if (!Settings.soundDisabled)
             {
                 this.ScreenManager.playAlertSound();
             }
             OS os = new OS();
             os.IsDLCConventionDemo = true;
             os.Flags.AddFlag("TutorialComplete");
             os.SaveGameUserName = "******" + Settings.ConventionLoginName + ".xml";
             os.SaveUserAccountName = Settings.ConventionLoginName;
             this.ScreenManager.AddScreen((GameScreen)os, new PlayerIndex?(this.ScreenManager.controllingPlayer));
             os.allFactions.setCurrentFaction("Bibliotheque", os);
             ThemeManager.setThemeOnComputer((object)os.thisComputer, "DLC/Themes/RiptideClassicTheme.xml");
             ThemeManager.switchTheme((object)os, "DLC/Themes/RiptideClassicTheme.xml");
             for (int index1 = 0; index1 < 60; ++index1)
             {
                 int index2;
                 do
                 {
                     index2 = Utils.random.Next(os.netMap.nodes.Count);
                 }while (os.netMap.nodes[index2].idName == "mainHub" || os.netMap.nodes[index2].idName == "entropy00" || os.netMap.nodes[index2].idName == "entropy01");
                 os.netMap.discoverNode(os.netMap.nodes[index2]);
             }
             os.delayer.Post(ActionDelayer.Wait(0.15), (Action)(() =>
             {
                 Game1.getSingleton().IsMouseVisible = true;
                 os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22], "SSHCrack.exe"));
                 os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21], "FTPBounce.exe"));
                 MissionFunctions.runCommand(7, "changeSong");
                 MusicManager.stop();
             }));
             os.delayer.Post(ActionDelayer.Wait(38.0), (Action)(() => ComputerLoader.loadMission("Content/DLC/Missions/Demo/DLCDemointroMission1.xml", false)));
         }
         catch (Exception ex)
         {
             Utils.writeToFile("OS Load Error: " + ex.ToString() + "\n\n" + ex.StackTrace, "crashLog.txt");
         }
     });
     this.extensionsScreen.ExitClicked += (Action)(() => this.State = MainMenu.MainMenuState.Normal);
     this.extensionsScreen.CreateNewAccountForExtension_UserAndPass += (Action <string, string>)((user, pass) => MainMenu.CreateNewAccountForExtensionAndStart(user, pass, this.ScreenManager, (GameScreen)this, this.extensionsScreen));
     this.extensionsScreen.LoadAccountForExtension_FileAndUsername  += (Action <string, string>)((userFile, username) =>
     {
         this.ExitScreen();
         MainMenu.resetOS();
         Settings.IsInExtensionMode = true;
         OS.WillLoadSave            = SaveFileManager.StorageMethods[0].FileExists(userFile);
         this.ScreenManager.AddScreen((GameScreen) new OS()
         {
             SaveGameUserName    = userFile,
             SaveUserAccountName = username
         }, new PlayerIndex?(this.ScreenManager.controllingPlayer));
     });
 }