private void StartFullDLCTest() { this.ExitScreen(); MainMenu.resetOS(); if (!Settings.soundDisabled) { this.ScreenManager.playAlertSound(); } OS os = new OS(); string username = "******"; SaveFileManager.AddUser(username, "test"); string fileNameForUsername = SaveFileManager.GetSaveFileNameForUsername(username); os.IsDLCConventionDemo = true; os.Flags.AddFlag("TutorialComplete"); Settings.EnableDLC = true; Settings.initShowsTutorial = false; os.SaveGameUserName = fileNameForUsername; os.SaveUserAccountName = username; os.initShowsTutorial = false; this.ScreenManager.AddScreen((GameScreen)os, new PlayerIndex?(this.ScreenManager.controllingPlayer)); SessionAccelerator.AccelerateSessionToDLCStart((object)os); os.delayer.Post(ActionDelayer.Wait(0.15), (Action)(() => Game1.getSingleton().IsMouseVisible = true)); }
public void apply() { bool flag = false; if (this.windowed != this.getIfWindowed()) { Game1.getSingleton().graphics.ToggleFullScreen(); Settings.windowed = this.getIfWindowed(); flag = true; } if (this.resolutionChanged) { string[] strArray = this.resolutions[this.currentResIndex].Split(this.xArray); int int32_1 = Convert.ToInt32(strArray[0]); int int32_2 = Convert.ToInt32(strArray[1]); Game1.getSingleton().graphics.PreferredBackBufferWidth = int32_1; Game1.getSingleton().graphics.PreferredBackBufferHeight = int32_2; Game1.getSingleton().graphics.PreferMultiSampling = SettingsLoader.ShouldMultisample; PostProcessor.GenerateMainTarget(Game1.getSingleton().graphics.GraphicsDevice); } GuiData.ActivateFontConfig(this.fontConfigs[this.currentFontIndex]); if (this.resolutionChanged || flag) { Game1.getSingleton().graphics.ApplyChanges(); Game1.getSingleton().setNewGraphics(); } else { this.ExitScreen(); } SettingsLoader.writeStatusFile(); }
public void apply() { var flag = false; if (windowed != getIfWindowed()) { Game1.getSingleton().graphics.ToggleFullScreen(); Settings.windowed = getIfWindowed(); flag = true; } if (resolutionChanged) { var strArray = resolutions[currentResIndex].Split(xArray); var num1 = Convert.ToInt32(strArray[0]); var num2 = Convert.ToInt32(strArray[1]); Game1.getSingleton().graphics.PreferredBackBufferWidth = num1; Game1.getSingleton().graphics.PreferredBackBufferHeight = num2; } GuiData.ActivateFontConfig(fontConfigs[currentFontIndex]); if (resolutionChanged || flag) { Game1.getSingleton().graphics.ApplyChanges(); Game1.getSingleton().setNewGraphics(); } else { ExitScreen(); } SettingsLoader.writeStatusFile(); }
public LogoCustomConnectDisplayDaemon(Computer c, OS os, string logoImageName, string titleImageName, bool logoShouldClipoverdraw, string buttonAlignment) : base(c, LocaleTerms.Loc("Logo Display Override"), os) { this.isListed = false; this.logoImageName = logoImageName; this.titleImageName = titleImageName; this.LogoShouldClipOverdraw = logoShouldClipoverdraw; this.buttonAlignmentName = buttonAlignment; if (!Enum.TryParse <AlignmentX>(buttonAlignment, true, out this.ButtonsAlignment)) { this.ButtonsAlignment = AlignmentX.Right; } string path1 = Utils.GetFileLoadPrefix() + logoImageName; if (path1.EndsWith(".jpg") || path1.EndsWith(".png")) { using (FileStream fileStream = File.OpenRead(path1)) this.LogoImage = Texture2D.FromStream(Game1.getSingleton().GraphicsDevice, (Stream)fileStream); } else { this.LogoImage = os.content.Load <Texture2D>(logoImageName); } string path2 = Utils.GetFileLoadPrefix() + titleImageName; if (path2.EndsWith(".jpg") || path2.EndsWith(".png")) { using (FileStream fileStream = File.OpenRead(path2)) this.TitleImage = Texture2D.FromStream(Game1.getSingleton().GraphicsDevice, (Stream)fileStream); } else { this.TitleImage = os.content.Load <Texture2D>(titleImageName); } }
public static void writeStatusFile() { GraphicsDevice graphicsDevice = Game1.getSingleton().GraphicsDevice; if (graphicsDevice == null) { return; } Utils.writeToFile(graphicsDevice.PresentationParameters.BackBufferWidth.ToString() + "\r\n" + (object)graphicsDevice.PresentationParameters.BackBufferHeight + "\r\n" + (Game1.getSingleton().graphics.IsFullScreen ? "true" : "false") + "\r\n" + "bloom: " + (PostProcessor.bloomEnabled ? "true" : "false") + "\r\n" + "scanlines: " + (PostProcessor.scanlinesEnabled ? "true" : "false") + "\r\n" + "muted: " + (MusicManager.isMuted ? "true" : "false") + "\r\n" + "volume: " + MusicManager.getVolume().ToString((IFormatProvider)CultureInfo.InvariantCulture) + "\r\n" + "fontConfig: " + GuiData.ActiveFontConfig.name + "\r\n" + "hasSaved: " + (object)SettingsLoader.hasEverSaved + "\r\n" + "shouldMultisample: " + (object)SettingsLoader.ShouldMultisample + "\r\n" + "defaultLocale: " + Settings.ActiveLocale + "\r\n" + "drawMusicVis: " + (object)SettingsLoader.ShouldDrawMusicVis + "\r\n", SettingsLoader.settingsPath); }
public override void HandleInput(InputState input) { base.HandleInput(input); GuiData.doInput(input); if (!Settings.debugCommandsEnabled || !Utils.keyPressed(input, Keys.F8, new PlayerIndex?())) { return; } ExitScreen(); Game1.getSingleton().Exit(); }
public static void writeStatusFile() { var graphicsDevice = Game1.getSingleton().GraphicsDevice; Utils.writeToFile( string.Concat( string.Concat( (graphicsDevice.PresentationParameters.BackBufferWidth.ToString() + "\r\n" + graphicsDevice.PresentationParameters.BackBufferHeight + "\r\n" + (Game1.getSingleton().graphics.IsFullScreen ? "true" : "false") + "\r\n" + "bloom: " + (PostProcessor.bloomEnabled ? "true" : "false") + "\r\n" + "scanlines: " + (PostProcessor.scanlinesEnabled ? "true" : "false") + "\r\n" + "muted: " + (MusicManager.isMuted ? "true" : "false") + "\r\n"), "volume: ", MusicManager.getVolume(), "\r\n") + "fontConfig: " + GuiData.ActiveFontConfig.name + "\r\n", "hasSaved: ", hasEverSaved, "\r\n"), "Settings.txt"); }
private void drawDemoModeButtons(bool canRun) { if (Button.doButton(1, 180, 200, 450, 50, LocaleTerms.Loc("New Session"), new Color?(MainMenu.buttonColor))) { if (canRun) { try { this.ExitScreen(); MainMenu.resetOS(); this.ScreenManager.playAlertSound(); this.ScreenManager.AddScreen((GameScreen) new OS(), new PlayerIndex?(this.ScreenManager.controllingPlayer)); } catch (Exception ex) { Utils.writeToFile(LocaleTerms.Loc("OS Load Error") + ": " + ex.ToString() + "\n\n" + ex.StackTrace, "crashLog.txt"); } } } if (Button.doButton(11, 180, 265, 450, 50, LocaleTerms.Loc("Load Session"), new Color?(this.canLoad ? MainMenu.buttonColor : Color.Black))) { if (this.canLoad) { try { if (canRun) { this.ExitScreen(); MainMenu.resetOS(); OS.WillLoadSave = true; this.ScreenManager.AddScreen((GameScreen) new OS(), new PlayerIndex?(this.ScreenManager.controllingPlayer)); } } catch (Exception ex) { Utils.writeToFile(LocaleTerms.Loc("OS Load Error") + ": " + ex.ToString() + "\n\n" + ex.StackTrace, "crashLog.txt"); } } } if (!Button.doButton(15, 180, 330, 450, 28, LocaleTerms.Loc("Exit"), new Color?(MainMenu.exitButtonColor))) { return; } MusicManager.stop(); Game1.threadsExiting = true; Game1.getSingleton().Exit(); }
private void drawDemoModeButtons(bool canRun) { if (Button.doButton(1, 180, 200, 450, 50, "New Session", buttonColor)) { if (canRun) { try { ExitScreen(); resetOS(); ScreenManager.playAlertSound(); ScreenManager.AddScreen(new OS(), ScreenManager.controllingPlayer); } catch (Exception ex) { Utils.writeToFile("OS Load Error: " + ex + "\n\n" + ex.StackTrace, "crashLog.txt"); } } } if (Button.doButton(11, 180, 265, 450, 50, "Load Session", canLoad ? buttonColor : Color.Black)) { if (canLoad) { try { if (canRun) { ExitScreen(); resetOS(); OS.WillLoadSave = true; ScreenManager.AddScreen(new OS(), ScreenManager.controllingPlayer); } } catch (Exception ex) { Utils.writeToFile("OS Load Error: " + ex + "\n\n" + ex.StackTrace, "crashLog.txt"); } } } if (!Button.doButton(15, 180, 330, 450, 28, "Exit", exitButtonColor)) { return; } MusicManager.stop(); Game1.threadsExiting = true; Game1.getSingleton().Exit(); }
public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); if (this.IsDLCDemoScreen) { float totalSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds; this.pointEffect.Update(totalSeconds); this.HexBackground.Update(totalSeconds); } if (!otherScreenHasFocus && !coveredByOtherScreen) { this.timeOnThisScreen += gameTime.ElapsedGameTime.TotalSeconds; } if (this.timeOnThisScreen > 5.0 && Keyboard.GetState().GetPressedKeys().Length > 0) { if (Settings.isConventionDemo) { OS.currentInstance.ScreenManager.AddScreen((GameScreen) new MainMenu()); OS.currentInstance.ExitScreen(); OS.currentInstance = (OS)null; } else { Game1.getSingleton().Exit(); } } else if (this.timeOnThisScreen > (this.IsDLCDemoScreen ? 51.5 : 20.0)) { if (Settings.isConventionDemo) { OS.currentInstance.ScreenManager.AddScreen((GameScreen) new MainMenu()); OS.currentInstance.ExitScreen(); OS.currentInstance = (OS)null; this.ExitScreen(); MainMenu.resetOS(); } else { Game1.getSingleton().Exit(); } } PostProcessor.EndingSequenceFlashOutActive = false; PostProcessor.EndingSequenceFlashOutPercentageComplete = 0.0f; PostProcessor.dangerModeEnabled = false; }
public static void SendErrorEmail(Exception ex, string postfix = "", string extraData = "") { var body = string.Concat( GenerateReportFromException(ex) + "\r\n White:" + white + "\r\n WhiteDisposed:" + white.IsDisposed + "\r\n SmallFont:" + GuiData.smallfont + "\r\n TinyFont:" + GuiData.tinyfont + "\r\n LineEffectTarget:" + FlickeringTextEffect.GetReportString() + "\r\n PostProcessort stuff:" + PostProcessor.GetStatusReportString(), "\r\nRESOLUTION:\r\n ", Game1.getSingleton().GraphicsDevice.PresentationParameters.BackBufferWidth, "x") + Game1.getSingleton().GraphicsDevice.PresentationParameters.BackBufferHeight + "\r\nFullscreen: " + (Game1.getSingleton().graphics.IsFullScreen ? "true" : "false") + "\r\n Adapter: " + Game1.getSingleton().GraphicsDevice.Adapter.Description + "\r\n Device Name: " + Game1.getSingleton().GraphicsDevice.Adapter.DeviceName + "\r\n Status: " + Game1.getSingleton().GraphicsDevice.GraphicsDeviceStatus + "\r\n Extra:\r\n" + extraData + "\r\n"; SendRealWorldEmail( "Hackent " + postfix + MainMenu.OSVersion + " Crash " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(), "*****@*****.**", body); }
public override void Update(float t) { base.Update(t); if (!this.IsActive) { return; } this.elapsedTime += t; if (!this.AwaitingInput && (double)this.elapsedTime > (this.blocksComplete < 11 ? -8.30000019073486 : 0.0) + 9.19999980926514) { this.elapsedTime = 0.0f; ++this.blocksComplete; if (this.blocksComplete >= this.SequenceBlocks.Count || this.ShouldSkipDialogueTypeout && this.blocksComplete == 12) { this.AwaitingInput = true; Game1.getSingleton().IsMouseVisible = true; this.blocksComplete = this.SequenceBlocks.Count - 1; } } }
private void StartLoadingInTexturesForMemory() { this.OutputTextures.Clear(); for (int index = 0; index < this.OutputData.Count; ++index) { string assetName = this.OutputData[index]; Texture2D texture2D = (Texture2D)null; string path = Utils.GetFileLoadPrefix() + assetName; if (path.EndsWith(".jpg") || path.EndsWith(".png")) { using (FileStream fileStream = File.OpenRead(path)) texture2D = Texture2D.FromStream(Game1.getSingleton().GraphicsDevice, (Stream)fileStream); } else { texture2D = this.os.content.Load <Texture2D>(assetName); } this.OutputTextures.Add(texture2D); } }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); try { PostProcessor.begin(); this.ScreenManager.FadeBackBufferToBlack((int)byte.MaxValue); GuiData.startDraw(); Rectangle dest1 = new Rectangle(0, 0, this.ScreenManager.GraphicsDevice.Viewport.Width, this.ScreenManager.GraphicsDevice.Viewport.Height); Rectangle destinationRectangle = new Rectangle(-20, -20, this.ScreenManager.GraphicsDevice.Viewport.Width + 40, this.ScreenManager.GraphicsDevice.Viewport.Height + 40); Rectangle dest2 = new Rectangle(dest1.X + dest1.Width / 4, dest1.Height / 4, dest1.Width / 2, dest1.Height / 4); GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Color.Black); if (Settings.DrawHexBackground) { this.hexBackground.Draw(dest1, GuiData.spriteBatch, Color.Transparent, Settings.lighterColorHexBackground ? new Color(20, 20, 20) : new Color(15, 15, 15, 0), HexGridBackground.ColoringAlgorithm.NegaitiveSinWash, 0.0f); } TextItem.DrawShadow = false; switch (this.State) { case MainMenu.MainMenuState.NewUser: this.DrawLoginScreen(dest2, true); break; case MainMenu.MainMenuState.Login: this.DrawLoginScreen(dest2, false); break; case MainMenu.MainMenuState.Extensions: this.DrawBackgroundAndTitle(); this.extensionsScreen.Draw(new Rectangle(180, 150, Math.Min(700, dest1.Width / 2), (int)((double)dest1.Height * 0.699999988079071)), GuiData.spriteBatch, this.ScreenManager); break; default: if (Settings.isLockedDemoMode) { this.attractModeScreen.Draw(dest1, GuiData.spriteBatch); break; } bool canRun = this.DrawBackgroundAndTitle(); if (Settings.isLockedDemoMode) { this.drawDemoModeButtons(canRun); } else { this.drawMainMenuButtons(canRun); if (Settings.testingMenuItemsEnabled) { this.drawTestingMainMenuButtons(canRun); } } break; } GuiData.endDraw(); PostProcessor.end(); this.ScreenManager.FadeBackBufferToBlack((int)byte.MaxValue - (int)this.TransitionAlpha); } catch (ObjectDisposedException ex) { if (this.hasSentErrorEmail) { throw ex; } string body = Utils.GenerateReportFromException((Exception)ex) + "\r\n Font:" + (object)this.titleFont + "\r\n White:" + (object)Utils.white + "\r\n WhiteDisposed:" + (object)Utils.white.IsDisposed + "\r\n SmallFont:" + (object)GuiData.smallfont + "\r\n TinyFont:" + (object)GuiData.tinyfont + "\r\n LineEffectTarget:" + FlickeringTextEffect.GetReportString() + "\r\n PostProcessort stuff:" + PostProcessor.GetStatusReportString() + "\r\nRESOLUTION:\r\n " + (object)Game1.getSingleton().GraphicsDevice.PresentationParameters.BackBufferWidth + "x" + (object)Game1.getSingleton().GraphicsDevice.PresentationParameters.BackBufferHeight + "\r\nFullscreen: " + (Game1.getSingleton().graphics.IsFullScreen ? "true" : "false") + "\r\n Adapter: " + Game1.getSingleton().GraphicsDevice.Adapter.Description + "\r\n Device Name: " + Game1.getSingleton().GraphicsDevice.Adapter.DeviceName + "\r\n Status: " + (object)Game1.getSingleton().GraphicsDevice.GraphicsDeviceStatus; Utils.SendRealWorldEmail("Hacknet " + MainMenu.OSVersion + " Crash " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(), "*****@*****.**", body); this.hasSentErrorEmail = true; SettingsLoader.writeStatusFile(); } }
public bool getIfWindowed() { return(Game1.getSingleton().graphics.IsFullScreen); }
private void drawTestingMainMenuButtons(bool canRun) { if (Button.doButton(8801, 634, 200, 225, 23, "New Test Session", buttonColor) && canRun) { ExitScreen(); resetOS(); if (!Settings.soundDisabled) { ScreenManager.playAlertSound(); } var os = new OS(); ScreenManager.AddScreen(os, ScreenManager.controllingPlayer); os.delayer.RunAllDelayedActions(); os.threadedSaveExecute(); ScreenManager.RemoveScreen(os); OS.WillLoadSave = true; resetOS(); ScreenManager.AddScreen(new OS(), ScreenManager.controllingPlayer); } if (Button.doButton(8803, 634, 225, 225, 23, "New Entropy Accelerated Session", buttonColor) && canRun) { ExitScreen(); resetOS(); if (!Settings.soundDisabled) { ScreenManager.playAlertSound(); } var os1 = new OS(); os1.SaveGameUserName = "******"; os1.SaveUserAccountName = "entropyTest"; ScreenManager.AddScreen(os1, ScreenManager.controllingPlayer); os1.Flags.AddFlag("TutorialComplete"); os1.delayer.RunAllDelayedActions(); os1.threadedSaveExecute(); ScreenManager.RemoveScreen(os1); OS.WillLoadSave = true; resetOS(); Settings.initShowsTutorial = false; var os2 = new OS(); ScreenManager.AddScreen(os2, ScreenManager.controllingPlayer); MissionFunctions.runCommand(0, "EntropyFastFowardSetup"); os2.delayer.Post(ActionDelayer.Wait(1.0), () => Game1.getSingleton().IsMouseVisible = true); } if (Button.doButton(8806, 634, 250, 225, 23, "Run Test Suite", buttonColor)) { testSuiteResult = TestSuite.TestSaveLoadOnFile(ScreenManager); } if (Button.doButton(8809, 634, 275, 225, 23, "Export Animation", buttonColor)) { var TitleFill = new Rectangle(0, 0, 300, 100); AnimatedSpriteExporter.ExportAnimation("OutNowAnim", "OutNow", TitleFill.Width, TitleFill.Height, 24f, 40f, GuiData.spriteBatch.GraphicsDevice, t => new OS { highlightColor = new Color(166, byte.MaxValue, 215) }.timer += t, (sb, dest) => { sb.Draw(Utils.white, dest, new Color(13, 13, 13)); FlickeringTextEffect.DrawFlickeringText(TitleFill, "OUT NOW", 8f, 0.7f, titleFont, null, new Color(216, 216, 216)); }, 1); } if (Button.doButton(8812, 634, 300, 225, 23, "New CSEC Accel Session", buttonColor) && canRun) { ExitScreen(); resetOS(); if (!Settings.soundDisabled) { ScreenManager.playAlertSound(); } var os1 = new OS(); ScreenManager.AddScreen(os1, ScreenManager.controllingPlayer); os1.Flags.AddFlag("TutorialComplete"); os1.delayer.RunAllDelayedActions(); os1.threadedSaveExecute(); ScreenManager.RemoveScreen(os1); OS.WillLoadSave = true; resetOS(); Settings.initShowsTutorial = false; var os2 = new OS(); ScreenManager.AddScreen(os2, ScreenManager.controllingPlayer); MissionFunctions.runCommand(0, "CSECFastFowardSetup"); os2.delayer.Post(ActionDelayer.Wait(1.0), () => Game1.getSingleton().IsMouseVisible = true); } if (testSuiteResult == null) { return; } TextItem.doFontLabel(new Vector2(635f, 325f), Utils.SuperSmartTwimForWidth(testSuiteResult, 600, GuiData.tinyfont), GuiData.tinyfont, testSuiteResult.Length > 250 ? Utils.AddativeRed : Utils.AddativeWhite, float.MaxValue, float.MaxValue); }
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; }
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)); }); }
private void drawTestingMainMenuButtons(bool canRun) { SpriteFont tinyfont = GuiData.tinyfont; string text = "FONT:"; for (int index = 0; index < tinyfont.Characters.Count; ++index) { text += (string)(object)tinyfont.Characters[index]; if (index % 20 == 0) { text += "\n"; } } if (true) { text = "Labyrinths Testers:\nPress \"Start Full DLC Test\" to begin\n\n" + text; } GuiData.spriteBatch.DrawString(tinyfont, text, new Vector2(867f, 200f), Color.White); if (Button.doButton(8801, 634, 200, 225, 23, "New Test Session", new Color?(MainMenu.buttonColor)) && canRun && canRun) { this.ExitScreen(); MainMenu.resetOS(); if (!Settings.soundDisabled) { this.ScreenManager.playAlertSound(); } OS os = new OS(); os.SaveGameUserName = "******"; os.SaveUserAccountName = "__test"; this.ScreenManager.AddScreen((GameScreen)os, new PlayerIndex?(this.ScreenManager.controllingPlayer)); os.Flags.AddFlag("TutorialComplete"); os.delayer.RunAllDelayedActions(); os.threadedSaveExecute(false); this.ScreenManager.RemoveScreen((GameScreen)os); OS.WillLoadSave = true; MainMenu.resetOS(); os = new OS(); os.SaveGameUserName = "******"; os.SaveUserAccountName = "__test"; this.ScreenManager.AddScreen((GameScreen)os, new PlayerIndex?(this.ScreenManager.controllingPlayer)); os.delayer.Post(ActionDelayer.Wait(0.1), (Action)(() => Game1.getSingleton().IsMouseVisible = true)); os.delayer.Post(ActionDelayer.Wait(0.4), (Action)(() => { os.runCommand("debug"); ComputerLoader.loadMission("Content/Missions/MainHub/Intro/Intro01.xml", false); })); if (!Settings.EnableDLC) { ComputerLoader.loadMission("Content/Missions/BitMission0.xml", false); } } if (Button.doButton(8803, 634, 225, 225, 23, "New DLC Test Session", new Color?(Settings.EnableDLC ? Color.Gray : MainMenu.buttonColor)) && canRun && canRun) { this.ExitScreen(); MainMenu.resetOS(); if (!Settings.soundDisabled) { this.ScreenManager.playAlertSound(); } OS os1 = new OS(); os1.SaveGameUserName = "******"; os1.SaveUserAccountName = "__test"; this.ScreenManager.AddScreen((GameScreen)os1, new PlayerIndex?(this.ScreenManager.controllingPlayer)); SessionAccelerator.AccelerateSessionToDLCHA((object)os1); os1.threadedSaveExecute(false); this.ScreenManager.RemoveScreen((GameScreen)os1); OS.WillLoadSave = true; MainMenu.resetOS(); Settings.initShowsTutorial = false; OS os2 = new OS(); os2.SaveGameUserName = "******"; os2.SaveUserAccountName = "__test"; this.ScreenManager.AddScreen((GameScreen)os2, new PlayerIndex?(this.ScreenManager.controllingPlayer)); os2.delayer.Post(ActionDelayer.Wait(0.15), (Action)(() => Game1.getSingleton().IsMouseVisible = true)); } if (Button.doButton(8806, 634, 250, 225, 23, "Run Test Suite", new Color?(MainMenu.buttonColor))) { this.testSuiteResult = TestSuite.RunTestSuite(this.ScreenManager, false); } if (Button.doButton(8809, 634, 275, 225, 23, "Run Quick Tests", new Color?(MainMenu.buttonColor))) { this.testSuiteResult = TestSuite.RunTestSuite(this.ScreenManager, true); } else { if (Button.doButton(8812, 634, 300, 225, 23, "Start Full DLC Test", new Color?(MainMenu.buttonColor)) && canRun) { this.StartFullDLCTest(); } if (this.testSuiteResult == null) { return; } TextItem.doFontLabel(new Vector2(635f, 325f), Utils.SuperSmartTwimForWidth(this.testSuiteResult, 600, GuiData.tinyfont), GuiData.tinyfont, new Color?(this.testSuiteResult.Length > 950 ? Utils.AddativeRed : Utils.AddativeWhite), float.MaxValue, float.MaxValue, false); } }
public static void CrashProgram() { MusicManager.stop(); Game1.threadsExiting = true; Game1.getSingleton().Exit(); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); PostProcessor.begin(); this.ScreenManager.FadeBackBufferToBlack((int)byte.MaxValue); GuiData.startDraw(); int x = 0; int y = 0; Viewport viewport = this.ScreenManager.GraphicsDevice.Viewport; int width = viewport.Width; viewport = this.ScreenManager.GraphicsDevice.Viewport; int height = viewport.Height; PatternDrawer.draw(new Rectangle(x, y, width, height), 0.5f, Color.Black, new Color(2, 2, 2), GuiData.spriteBatch); if (Button.doButton(999, 10, 10, 220, 30, "<- " + LocaleTerms.Loc("Back"), new Color?(Color.Gray))) { SettingsLoader.writeStatusFile(); this.ExitScreen(); } if (Button.doButton(9907, 10, 44, 220, 20, LocaleTerms.Loc("Apply Changes"), new Color?(Color.LightBlue))) { this.needsApply = true; } int num1 = 100; TextItem.doLabel(new Vector2(400f, (float)num1), LocaleTerms.Loc("Resolutions"), new Color?(), 200f); int currentResIndex = this.currentResIndex; this.currentResIndex = SelectableTextList.doFancyList(10, 400, num1 + 36, 200, 450, this.resolutions, this.currentResIndex, new Color?(), false); if (!this.mouseHasBeenReleasedOnThisScreen) { this.currentResIndex = currentResIndex; } else if (SelectableTextList.wasActivated) { this.resolutionChanged = true; } if (!this.startedFromGameContext) { TextItem.doLabel(new Vector2(620f, (float)num1), LocaleTerms.Loc("Language"), new Color?(), 200f); int currentLocaleIndex = this.currentLocaleIndex; this.currentLocaleIndex = SelectableTextList.doFancyList(1013, 620, num1 + 36, 200, 450, this.localeNames, this.currentLocaleIndex, new Color?(), false); if (!this.mouseHasBeenReleasedOnThisScreen) { this.currentLocaleIndex = currentLocaleIndex; } else if (SelectableTextList.wasActivated) { LocaleActivator.ActivateLocale(LocaleActivator.SupportedLanguages[this.currentLocaleIndex].Code, Game1.getSingleton().Content); Settings.ActiveLocale = LocaleActivator.SupportedLanguages[this.currentLocaleIndex].Code; } } int num2 = 64; float MaxWidth = 280f; int num3; TextItem.doLabel(new Vector2(100f, (float)(num3 = num2 + 36)), LocaleTerms.Loc("Fullscreen"), new Color?(), MaxWidth); int num4; this.windowed = CheckBox.doCheckBox(20, 100, num4 = num3 + 34, this.windowed, new Color?()); int num5; TextItem.doLabel(new Vector2(100f, (float)(num5 = num4 + 32)), LocaleTerms.Loc("Bloom"), new Color?(), MaxWidth); int num6; PostProcessor.bloomEnabled = CheckBox.doCheckBox(21, 100, num6 = num5 + 34, PostProcessor.bloomEnabled, new Color?()); int num7; TextItem.doLabel(new Vector2(100f, (float)(num7 = num6 + 32)), LocaleTerms.Loc("Scanlines"), new Color?(), MaxWidth); int num8; PostProcessor.scanlinesEnabled = CheckBox.doCheckBox(22, 100, num8 = num7 + 34, PostProcessor.scanlinesEnabled, new Color?()); int num9; TextItem.doLabel(new Vector2(100f, (float)(num9 = num8 + 32)), LocaleTerms.Loc("Multisampling"), new Color?(), MaxWidth); bool shouldMultisample = SettingsLoader.ShouldMultisample; int num10; SettingsLoader.ShouldMultisample = CheckBox.doCheckBox(221, 100, num10 = num9 + 34, SettingsLoader.ShouldMultisample, new Color?()); if (shouldMultisample != SettingsLoader.ShouldMultisample) { this.resolutionChanged = true; } int num11; TextItem.doLabel(new Vector2(100f, (float)(num11 = num10 + 32)), LocaleTerms.Loc("Audio Visualiser"), new Color?(), MaxWidth); int num12; SettingsLoader.ShouldDrawMusicVis = CheckBox.doCheckBox(223, 100, num12 = num11 + 34, SettingsLoader.ShouldDrawMusicVis, new Color?()); int num13; TextItem.doLabel(new Vector2(100f, (float)(num13 = num12 + 32)), LocaleTerms.Loc("Sound Enabled"), new Color?(), MaxWidth); int num14; MusicManager.setIsMuted(!CheckBox.doCheckBox(23, 100, num14 = num13 + 34, !MusicManager.isMuted, new Color?())); int num15; TextItem.doLabel(new Vector2(100f, (float)(num15 = num14 + 32)), LocaleTerms.Loc("Music Volume"), new Color?(), MaxWidth); int num16; MusicManager.setVolume(SliderBar.doSliderBar(24, 100, num16 = num15 + 34, 210, 30, 1f, 0.0f, MusicManager.getVolume(), 1f / 1000f)); int num17; TextItem.doLabel(new Vector2(100f, (float)(num17 = num16 + 32)), LocaleTerms.Loc("Text Size"), new Color?(), MaxWidth); int currentFontIndex = this.currentFontIndex; int num18; this.currentFontIndex = SelectableTextList.doFancyList(25, 100, num18 = num17 + 34, 200, 160, this.fontConfigs, this.currentFontIndex, new Color?(), false); if (this.currentFontIndex != currentFontIndex && this.startedFromGameContext) { try { if (OS.currentInstance != null) { OS.currentInstance.terminal.reset(); } } catch (Exception ex) { Console.WriteLine((object)ex); Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex)); } } if (Button.doButton(990, 10, num18 + 150, 220, 30, LocaleTerms.Loc("Apply Changes"), new Color?(Color.LightBlue))) { this.needsApply = true; } GuiData.endDraw(); PostProcessor.end(); }
private void drawMainMenuButtons(bool canRun) { var num1 = 135; int num2; if (Button.doButton(1, 180, num2 = num1 + 65, 450, 50, "New Session", buttonColor) && canRun) { State = MainMenuState.NewUser; loginScreen.ResetForNewAccount(); } int num3; if ( Button.doButton(1102, 180, num3 = num2 + 65, 450, 28, canLoad ? "Continue with account [" + SaveFileManager.LastLoggedInUser.Username + "]" : "No Accounts", canLoad ? buttonColor : Color.Black) && canLoad) { loginScreen.LoadGameForUserFileAndUsername(SaveFileManager.LastLoggedInUser.FileUsername, SaveFileManager.LastLoggedInUser.Username); } int num4; if (Button.doButton(11, 180, num4 = num3 + 39, 450, 50, "Login", canLoad ? buttonColor : Color.Black)) { if (canLoad) { try { State = MainMenuState.Login; loginScreen.ResetForLogin(); } catch (Exception ex) { Utils.writeToFile("OS Load Error: " + ex + "\n\n" + ex.StackTrace, "crashLog.txt"); } } } int num5; if (Button.doButton(3, 180, num5 = num4 + 65, 450, 50, "Settings", buttonColor)) { ScreenManager.AddScreen(new OptionsMenu(), ScreenManager.controllingPlayer); } int num6; var y = num6 = num5 + 65; if (Settings.isServerMode) { if (Button.doButton(4, 180, y, 450, 50, "Start Relay Server", buttonColor)) { ScreenManager.AddScreen(new ServerScreen(), ScreenManager.controllingPlayer); } y += 65; } if (Settings.AllowAdventureMode) { if (Button.doButton(5, 180, y, 450, 50, "Adventure Session", buttonColor)) { ExitScreen(); resetOS(); Settings.IsInAdventureMode = true; if (!Settings.soundDisabled) { ScreenManager.playAlertSound(); } ScreenManager.AddScreen(new OS(), ScreenManager.controllingPlayer); } y += 65; } if (Button.doButton(15, 180, y, 450, 28, "Exit", exitButtonColor)) { MusicManager.stop(); Game1.threadsExiting = true; Game1.getSingleton().Exit(); } var num7 = y + 30; if (!PlatformAPISettings.RemoteStorageRunning) { TextItem.doFontLabel(new Vector2(180f, num7), "WARNING: Error connecting to Steam Cloud", GuiData.smallfont, Color.DarkRed, float.MaxValue, float.MaxValue); num7 += 20; } if (string.IsNullOrWhiteSpace(AccumErrors)) { return; } TextItem.doFontLabel(new Vector2(180f, num7), AccumErrors, GuiData.smallfont, Color.DarkRed, float.MaxValue, float.MaxValue); var num8 = num7 + 20; }
public static bool ExecuteProgram(object os_object, string[] arguments) { OS os = (OS)os_object; string[] strArray = arguments; bool flag1 = true; if (strArray[0].ToLower().Equals("connect")) { Programs.connect(strArray, os); flag1 = false; } else if (strArray[0].Equals("disconnect") || strArray[0].Equals("dc")) { Programs.disconnect(strArray, os); } else if (strArray[0].Equals("ls") || strArray[0].Equals("dir")) { Programs.ls(strArray, os); } else if (strArray[0].Equals("cd")) { Programs.cd(strArray, os); } else if (strArray[0].Equals("cd..")) { strArray = new string[2] { "cd", ".." }; Programs.cd(strArray, os); } else if (strArray[0].Equals("cat") || strArray[0].Equals("more") || strArray[0].Equals("less")) { Programs.cat(strArray, os); } else if (strArray[0].Equals("exe")) { Programs.execute(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("probe") || strArray[0].Equals("nmap")) { Programs.probe(strArray, os); } else if (strArray[0].Equals("scp")) { Programs.scp(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("scan")) { Programs.scan(strArray, os); flag1 = false; } else if (strArray[0].Equals("rm") || strArray[0].Equals("del")) { Programs.rm(strArray, os); flag1 = false; } else if (strArray[0].Equals("mv")) { Programs.mv(strArray, os); flag1 = false; } else if (strArray[0].Equals("ps")) { Programs.ps(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("kill") || strArray[0].Equals("pkill")) { Programs.kill(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("reboot")) { Programs.reboot(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("opencdtray")) { Programs.opCDTray(strArray, os, true); flag1 = false; } else if (strArray[0].ToLower().Equals("closecdtray")) { Programs.opCDTray(strArray, os, false); flag1 = false; } else if (strArray[0].Equals("replace")) { Programs.replace2(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("analyze")) { Programs.analyze(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("solve")) { Programs.solve(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("clear")) { Programs.clear(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("upload") || strArray[0].Equals("up")) { Programs.upload(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("login")) { Programs.login(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("addnote")) { Programs.addNote(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals(":(){:|:&};:")) { ProgramRunner.ExecuteProgram((object)os, new string[1] { "forkbomb" }); } else if (strArray[0].ToLower().Equals("append")) { flag1 = false; string[] quoteSeperatedArgs = Utils.GetQuoteSeperatedArgs(strArray); Folder currentFolder = Programs.getCurrentFolder(os); if (quoteSeperatedArgs.Length > 1) { FileEntry fileEntry1 = currentFolder.searchForFile(quoteSeperatedArgs[1]); int num = 2; if (fileEntry1 == null) { fileEntry1 = currentFolder.searchForFile(os.display.commandArgs[1]); if (fileEntry1 == null) { os.write("Usage: append [FILENAME] [LINE TO APPEND]"); return(flag1); } os.write("No filename provided"); os.write("Assuming active flag file \"" + fileEntry1.name + "\" For editing"); if (strArray.Length == 1) { strArray = new string[2] { "append", fileEntry1.name } } ; else { strArray[1] = fileEntry1.name; } num = 1; } if (fileEntry1 != null) { string str1 = ""; for (int index = num; index < quoteSeperatedArgs.Length; ++index) { str1 = str1 + quoteSeperatedArgs[index] + " "; } FileEntry fileEntry2 = fileEntry1; string str2 = fileEntry2.data + "\n" + str1; fileEntry2.data = str2; flag1 = true; strArray[0] = "cat"; strArray[1] = fileEntry1.name; for (int index = 2; index < strArray.Length; ++index) { strArray[index] = ""; } Programs.cat(strArray, os); } } else { os.write("Usage: append [FILENAME] [LINE TO APPEND]"); return(flag1); } } else if (strArray[0].Equals("remline")) { FileEntry fileEntry = Programs.getCurrentFolder(os).searchForFile(strArray[1]); if (fileEntry != null) { int length = fileEntry.data.LastIndexOf('\n'); if (length < 0) { length = 0; } fileEntry.data = fileEntry.data.Substring(0, length); flag1 = true; strArray[0] = "cat"; for (int index = 2; index < strArray.Length; ++index) { strArray[index] = ""; } Programs.cat(strArray, os); } } else if (strArray[0].Equals("getString")) { Programs.getString(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("reloadtheme")) { FileEntry fileEntry = os.thisComputer.files.root.searchForFolder("sys").searchForFile("x-server.sys"); if (fileEntry != null) { OSTheme themeForDataString = ThemeManager.getThemeForDataString(fileEntry.data); ThemeManager.switchTheme((object)os, themeForDataString); } flag1 = false; } else if (strArray[0].Equals("FirstTimeInitdswhupwnemfdsiuoewnmdsmffdjsklanfeebfjkalnbmsdakj")) { Programs.firstTimeInit(strArray, os, false); flag1 = false; } else if (strArray[0].Equals("chat")) { string message = "chat " + os.username + " "; for (int index = 1; index < strArray.Length; ++index) { message = message + strArray[index] + " "; } if (os.multiplayer) { os.sendMessage(message); } flag1 = false; } else if ((strArray[0].Equals("exitdemo") || strArray[0].Equals("resetdemo")) && Settings.isDemoMode) { MusicManager.transitionToSong("Music/Ambient/AmbientDrone_Clipped"); MainMenu mainMenu = new MainMenu(); os.ScreenManager.AddScreen((GameScreen)mainMenu); MainMenu.resetOS(); os.ExitScreen(); OS.currentInstance = (OS)null; flag1 = false; if (Settings.MultiLingualDemo) { LocaleActivator.ActivateLocale("zh-cn", Game1.getSingleton().Content); } } else if (strArray[0].Equals("fh") && OS.DEBUG_COMMANDS) { Programs.fastHack(strArray, os); flag1 = false; } else if (strArray[0].Equals("ra") && OS.DEBUG_COMMANDS) { Programs.revealAll(strArray, os); flag1 = false; } else if (strArray[0].Equals("deathseq") && OS.DEBUG_COMMANDS) { os.TraceDangerSequence.BeginTraceDangerSequence(); flag1 = false; } else if (strArray[0].Equals("testcredits") && OS.DEBUG_COMMANDS) { os.endingSequence.IsActive = true; flag1 = false; } else if (strArray[0].Equals("addflag") && OS.DEBUG_COMMANDS) { if (strArray.Length < 2) { os.write("\nFlag to add required\n"); } os.Flags.AddFlag(strArray[1]); flag1 = false; } else if (strArray[0].Equals("addTestEmails") && OS.DEBUG_COMMANDS) { for (int index = 0; index < 4; ++index) { ((MailServer)os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(MailServer.generateEmail("testEmail " + (object)index + " " + Utils.getRandomByte().ToString(), "test", "test"), os.defaultUser.name); } flag1 = false; } else if (strArray[0].Equals("dscan") && OS.DEBUG_COMMANDS) { if (strArray.Length < 2) { os.write("\nNode ID Required\n"); } bool flag2 = false; for (int index = 0; index < os.netMap.nodes.Count; ++index) { if (os.netMap.nodes[index].idName.ToLower().StartsWith(strArray[1].ToLower())) { os.netMap.discoverNode(os.netMap.nodes[index]); os.netMap.nodes[index].highlightFlashTime = 1f; flag2 = true; break; } } if (!flag2) { os.write("Node ID Not found"); } flag1 = false; } else if (strArray[0].Equals("revmany") && OS.DEBUG_COMMANDS) { 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.netMap.lastAddedNode = os.thisComputer; os.homeAssetServerID = "dhsDrop"; os.homeNodeID = "dhs"; os.netMap.discoverNode(Programs.getComputer(os, "dhs")); os.netMap.discoverNode(Programs.getComputer(os, "dhsDrop")); flag1 = false; } else if (strArray[0].ToLower().Equals("reloadext") && OS.DEBUG_COMMANDS) { if (Settings.IsInExtensionMode) { ExtensionLoader.ReloadExtensionNodes((object)os); } flag1 = false; } else if (strArray[0].Equals("testsave") && OS.DEBUG_COMMANDS || strArray[0].Equals("save!(SJN!*SNL8vAewew57WewJdwl89(*4;;;&!)@&(ak'^&#@J3KH@!*")) { os.threadedSaveExecute(false); SettingsLoader.writeStatusFile(); flag1 = false; } else if (strArray[0].Equals("testload") && OS.DEBUG_COMMANDS) { flag1 = false; } else if (strArray[0].Equals("teststrikerhack") && OS.DEBUG_COMMANDS) { os.delayer.Post(ActionDelayer.Wait(3.0), (Action)(() => MissionFunctions.runCommand(1, "triggerDLCHackRevenge"))); flag1 = false; } else if (strArray[0].Equals("linkToCSECPostDLC") && OS.DEBUG_COMMANDS) { os.execute("dscan mainhub"); os.allFactions.setCurrentFaction("hub", os); os.currentFaction.playerValue = 2; os.Flags.AddFlag("dlc_complete"); os.Flags.AddFlag("dlc_csec_end_facval:0"); MissionFunctions.runCommand(1, "addRank"); flag1 = false; } else if (strArray[0].Equals("debug") && OS.DEBUG_COMMANDS) { int num = PortExploits.services.Count; if (strArray.Length > 1) { try { num = Convert.ToInt32(strArray[1]); } catch (Exception ex) { } } for (int index = 0; index < PortExploits.services.Count && index <= num; ++index) { os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[PortExploits.portNums[index]], PortExploits.cracks[PortExploits.portNums[index]])); } os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[9], PortExploits.cracks[9])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[10], PortExploits.cracks[10])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[11], PortExploits.cracks[11])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[12], PortExploits.cracks[12])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[13], PortExploits.cracks[13])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[14], PortExploits.cracks[14])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[15], PortExploits.cracks[15])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[16], PortExploits.cracks[16])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[17], PortExploits.cracks[17])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[31], PortExploits.cracks[31])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[33], PortExploits.cracks[33])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[34], PortExploits.cracks[34])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[35], PortExploits.cracks[35])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[36], PortExploits.cracks[36])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[37], PortExploits.cracks[37])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[38], PortExploits.cracks[38])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[39], PortExploits.cracks[39])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[41], PortExploits.cracks[41])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[554], PortExploits.cracks[554])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[40], PortExploits.cracks[40])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.DangerousPacemakerFirmware, "KBT_TestFirmware.dll")); os.Flags.AddFlag("dechead"); os.Flags.AddFlag("decypher"); os.Flags.AddFlag("csecBitSet01Complete"); os.Flags.AddFlag("csecRankingS2Pass"); os.Flags.AddFlag("CSEC_Member"); os.Flags.AddFlag("bitPathStarted"); flag1 = false; for (int index = 0; index < 4; ++index) { Computer c = new Computer("DebugShell" + (object)index, NetworkMap.generateRandomIP(), os.netMap.getRandomPosition(), 0, (byte)2, os); c.adminIP = os.thisComputer.adminIP; os.netMap.nodes.Add(c); os.netMap.discoverNode(c); } os.netMap.discoverNode("practiceServer"); os.netMap.discoverNode("entropy00"); } else if (strArray[0].Equals("flash") && OS.DEBUG_COMMANDS) { os.traceTracker.start(40f); os.warningFlash(); flag1 = false; os.IncConnectionOverlay.Activate(); } else if (strArray[0].Equals("cycletheme") && OS.DEBUG_COMMANDS) { Action <OSTheme> ctheme = (Action <OSTheme>)(theme => ThemeManager.switchTheme((object)os, theme)); int next = 1; double delay = 1.2; Action cthemeAct = (Action)(() => { ctheme((OSTheme)next); next = (next + 1) % 7; }); cthemeAct += (Action)(() => os.delayer.Post(ActionDelayer.Wait(delay), cthemeAct)); cthemeAct(); } else if (strArray[0].Equals("testdlc") && OS.DEBUG_COMMANDS) { MissionFunctions.runCommand(0, "demoFinalMissionEndDLC"); flag1 = false; } else if (strArray[0].Equals("testircentries") && OS.DEBUG_COMMANDS) { DLCHubServer daemon = Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer)) as DLCHubServer; for (int index = 0; index < 100; ++index) { daemon.IRCSystem.AddLog("Test", "Test Message\nMultiline\nMessage", (string)null); } flag1 = false; } else if (strArray[0].Equals("testirc") && OS.DEBUG_COMMANDS) { DLCHubServer daemon = Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer)) as DLCHubServer; daemon.IRCSystem.AddLog("Test", "Test Message", (string)null); daemon.IRCSystem.AddLog("Channel", "Test Message\nfrom channel", (string)null); flag1 = false; } else if (strArray[0].Equals("flashtest") && OS.DEBUG_COMMANDS) { if (!PostProcessor.dangerModeEnabled) { PostProcessor.dangerModeEnabled = true; PostProcessor.dangerModePercentComplete = 0.5f; } else { PostProcessor.dangerModeEnabled = false; PostProcessor.dangerModePercentComplete = 0.0f; } flag1 = false; } else if (strArray[0].Equals("dectest") && OS.DEBUG_COMMANDS) { string str1 = "this is a test message for the encrypter"; string str2 = FileEncrypter.EncryptString(str1, "header message", "1.2.3.4.5", "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongpass", (string)null); os.write(str1); os.write(" "); os.write(" "); os.write(str2); os.write(" "); os.write(" "); os.write(FileEncrypter.MakeReplacementsForDisplay(FileEncrypter.DecryptString(str2, "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongpass")[2])); os.write(" "); os.write(FileEncrypter.MakeReplacementsForDisplay(FileEncrypter.DecryptString(str2, "wrongPass")[2] == null ? "NULL" : "CORRECT")); os.write(" "); } else if (strArray[0].Equals("test") && OS.DEBUG_COMMANDS) { ((DLCHubServer)Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer))).AddMission((ActiveMission)ComputerLoader.readMission("Content/DLC/Missions/Attack/AttackMission.xml"), (string)null, false); } else if (strArray[0].Equals("testtrace") && OS.DEBUG_COMMANDS) { MissionFunctions.runCommand(1, "triggerDLCHackRevenge"); } else if (strArray[0].Equals("testboot") && OS.DEBUG_COMMANDS) { os.BootAssitanceModule.IsActive = true; os.bootingUp = false; os.canRunContent = false; MusicManager.stop(); } else if (strArray[0].Equals("testhhbs") && OS.DEBUG_COMMANDS) { os.write(HostileHackerBreakinSequence.IsInBlockingHostileFileState((object)os) ? "BLOCKED" : "SAFE"); } else if (strArray[0].Equals("printflags") && OS.DEBUG_COMMANDS) { os.write(os.Flags.GetSaveString()); } else if (strArray[0].Equals("loseadmin") && OS.DEBUG_COMMANDS) { os.connectedComp.adminIP = os.connectedComp.ip; flag1 = false; } else if (strArray[0].Equals("runcmd") && OS.DEBUG_COMMANDS) { if (strArray.Length > 1) { string name = strArray[1]; int num = 0; if (strArray.Length > 2) { num = Convert.ToInt32(strArray[1]); } MissionFunctions.runCommand(num, name); } } else if (strArray[0].ToLower().Equals("runhackscript") && OS.DEBUG_COMMANDS) { if (strArray.Length > 1) { string scriptName = strArray[1]; try { HackerScriptExecuter.runScript(scriptName, (object)os, os.thisComputer.ip, os.thisComputer.ip); } catch (Exception ex) { os.write("Error launching script " + scriptName); os.write(Utils.GenerateReportFromExceptionCompact(ex)); } } } else if (strArray[0].Equals("MotIsTheBest") && OS.DEBUG_COMMANDS) { os.runCommand("probe"); os.runCommand("exe WebServerWorm 80"); os.runCommand("exe SSHcrack 22"); os.runCommand("exe SMTPoverflow 25"); os.runCommand("exe FTPBounce 21"); } else if (strArray[0].Equals("help") || strArray[0].Equals("Help") || strArray[0].Equals("?") || strArray[0].Equals("man")) { int page = 0; if (strArray.Length > 1) { try { page = Convert.ToInt32(strArray[1]); if (page > Helpfile.getNumberOfPages()) { os.write("Invalid Page Number - Displaying First Page"); page = 0; } } catch (FormatException ex) { os.write("Invalid Page Number"); } catch (OverflowException ex) { os.write("Invalid Page Number"); } } Helpfile.writeHelp(os, page); flag1 = false; } else { if (strArray[0] != "") { int num = ProgramRunner.AttemptExeProgramExecution(os, strArray); if (num == 0) { os.write("Execution failed"); } else if (num < 0) { os.write("No Command " + strArray[0] + " - Check Syntax\n"); } } flag1 = false; } if (flag1) { if (!os.commandInvalid) { os.display.command = strArray[0]; os.display.commandArgs = strArray; os.display.typeChanged(); } else { os.commandInvalid = false; } } return(flag1); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); try { PostProcessor.begin(); ScreenManager.FadeBackBufferToBlack(byte.MaxValue); GuiData.startDraw(); var dest1 = new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height); var destinationRectangle = new Rectangle(-20, -20, ScreenManager.GraphicsDevice.Viewport.Width + 40, ScreenManager.GraphicsDevice.Viewport.Height + 40); var dest2 = new Rectangle(dest1.X + dest1.Width / 4, dest1.Height / 4, dest1.Width / 2, dest1.Height / 4); GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Color.Black); hexBackground.Draw(dest1, GuiData.spriteBatch, Color.Transparent, Settings.lighterColorHexBackground ? new Color(20, 20, 20) : new Color(10, 10, 10, 0), HexGridBackground.ColoringAlgorithm.NegaitiveSinWash, 0.0f); TextItem.DrawShadow = false; switch (State) { case MainMenuState.NewUser: DrawLoginScreen(dest2, true); break; case MainMenuState.Login: DrawLoginScreen(dest2, false); break; default: if (Settings.isLockedDemoMode) { attractModeScreen.Draw(dest1, GuiData.spriteBatch); break; } FlickeringTextEffect.DrawLinedFlickeringText(new Rectangle(180, 120, 340, 100), "HACKNET", 7f, 0.55f, titleFont, null, titleColor, 2); TextItem.doFontLabel(new Vector2(520f, 178f), "OS " + OSVersion, GuiData.smallfont, titleColor * 0.5f, 600f, 26f); var canRun = true; if (Settings.IsExpireLocked) { var timeSpan = Settings.ExpireTime - DateTime.Now; string text; if (timeSpan.TotalSeconds < 1.0) { text = "TEST BUILD EXPIRED - EXECUTION DISABLED"; canRun = false; } else { text = "Test Build : Expires in " + timeSpan; } TextItem.doFontLabel(new Vector2(180f, 105f), text, GuiData.smallfont, Color.Red * 0.8f, 600f, 26f); } if (Settings.isLockedDemoMode) { drawDemoModeButtons(canRun); break; } drawMainMenuButtons(canRun); if (Settings.testingMenuItemsEnabled) { drawTestingMainMenuButtons(canRun); } break; } GuiData.endDraw(); PostProcessor.end(); ScreenManager.FadeBackBufferToBlack(byte.MaxValue - TransitionAlpha); } catch (ObjectDisposedException ex) { if (hasSentErrorEmail) { throw ex; } var body = string.Concat( Utils.GenerateReportFromException(ex) + "\r\n Font:" + titleFont + "\r\n White:" + Utils.white + "\r\n WhiteDisposed:" + Utils.white.IsDisposed + "\r\n SmallFont:" + GuiData.smallfont + "\r\n TinyFont:" + GuiData.tinyfont + "\r\n LineEffectTarget:" + FlickeringTextEffect.GetReportString() + "\r\n PostProcessort stuff:" + PostProcessor.GetStatusReportString(), "\r\nRESOLUTION:\r\n ", Game1.getSingleton().GraphicsDevice.PresentationParameters.BackBufferWidth, "x") + Game1.getSingleton().GraphicsDevice.PresentationParameters.BackBufferHeight + "\r\nFullscreen: " + (Game1.getSingleton().graphics.IsFullScreen ? "true" : "false") + "\r\n Adapter: " + Game1.getSingleton().GraphicsDevice.Adapter.Description + "\r\n Device Name: " + Game1.getSingleton().GraphicsDevice.Adapter.DeviceName + "\r\n Status: " + Game1.getSingleton().GraphicsDevice.GraphicsDeviceStatus; Utils.SendRealWorldEmail( "Hackent " + OSVersion + " Crash " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(), "*****@*****.**", body); hasSentErrorEmail = true; SettingsLoader.writeStatusFile(); } }