public bool attemptSolve(string attempt, object os) { if (attempt.Length != this.solution.Length) { string str = attempt.Length < this.solution.Length ? LocaleTerms.Loc("Too few characters") : LocaleTerms.Loc("Too many characters"); ((OS)os).write(LocaleTerms.Loc("Solution Incorrect Length") + " - " + str); } else if (attempt.ToLower().Equals(this.solution.ToLower())) { this.solved = true; return(true); } return(false); }
public override void Completed() { base.Completed(); Computer computer = Programs.getComputer(this.os, this.targetIP); if (computer == null) { return; } computer.openPort(6881, this.os.thisComputer.ip); this.os.write(" - " + LocaleTerms.Loc("Torrent Stream Injection Complete") + " - "); this.isComplete = true; this.completionFlashTimer = this.completionFlashDuration; }
public override void Completed() { base.Completed(); Computer computer = Programs.getComputer(this.os, this.targetIP); if (computer != null) { computer.openPort(21, this.os.thisComputer.ip); this.os.write(">> " + LocaleTerms.Loc("FTP Sprint Crack Successful")); } this.points.FlashComplete(); this.points.Explode(30); this.points.timeRemainingWithoutAttract = 10f; }
private void RenderMenuMainState(Rectangle dest, SpriteBatch sb) { int num1 = 5; int height = Math.Min(dest.Height / (num1 + 1), 32); int num2 = (int)((double)(dest.Height - height * (num1 + 1)) / 2.0); bool flag = this.State == MemoryForensicsExe.MemForensicsState.Processing; Color color = flag ? Color.Gray : Color.White; Rectangle dest1 = new Rectangle(dest.X + 20, dest.Y + num2, (int)((double)dest.Width * 0.899999976158142), height); Rectangle destinationRectangle = new Rectangle(dest.X + 2, dest1.Y - 4, dest.Width - 4, dest1.Height * (num1 + 1)); sb.Draw(Utils.white, destinationRectangle, Color.Black * 0.8f); if (height <= 6) { return; } TextItem.doFontLabelToSize(dest1, LocaleTerms.Loc("Memory Dump") + " : " + this.filenameLoaded, GuiData.smallfont, Color.LightGray, true, true); dest1.Y += dest1.Height + 2; if (Button.doButton(381023801, dest1.X, dest1.Y, dest1.Width, dest1.Height, LocaleTerms.Loc("Process Recent Commands Run..."), new Color?(color)) && !flag) { this.MoveToProcessing(); this.OutputData.Clear(); this.OutputData.AddRange((IEnumerable <string>) this.ActiveMem.CommandsRun); this.AnnouncementData = LocaleTerms.Loc("Results for recently run commands remaining in cached memory") + "::"; } dest1.Y += dest1.Height + 2; if (Button.doButton(381023803, dest1.X, dest1.Y, dest1.Width, dest1.Height, LocaleTerms.Loc("Process Files in Memory..."), new Color?(color)) && !flag) { this.MoveToProcessing(); this.OutputData.Clear(); this.OutputData.AddRange((IEnumerable <string>) this.ActiveMem.DataBlocks); this.AnnouncementData = LocaleTerms.Loc("Results for accessed non-binary file fragments in cached memory") + "::"; } dest1.Y += dest1.Height + 2; if (Button.doButton(381023807, dest1.X, dest1.Y, dest1.Width, dest1.Height, LocaleTerms.Loc("Process Images in Memory..."), new Color?(color)) && !flag) { this.MoveToProcessing(); this.IsDisplayingImages = true; this.OutputData.Clear(); this.OutputData.AddRange((IEnumerable <string>) this.ActiveMem.Images); Task.Factory.StartNew((Action)(() => this.StartLoadingInTexturesForMemory())); this.AnnouncementData = LocaleTerms.Loc("Results for accessed image-type tagged binary fragments in cached memory") + "::"; } dest1.Y += dest1.Height + 2; if (Button.doButton(381023809, dest1.X, dest1.Y, dest1.Width, dest1.Height, LocaleTerms.Loc("Exit"), new Color?(this.os.lockedColor))) { this.isExiting = true; } dest1.Y += dest1.Height + 2; }
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; }
public void writeAnalyzePass(object os_object, object target_object) { Computer target = (Computer)target_object; OS os = (OS)os_object; if (target.firewallAnalysisInProgress) { os.write("-" + LocaleTerms.Loc("Analysis already in Progress") + "-"); } else { os.delayer.PostAnimation(this.generateOutputPass(this.analysisPasses, os, target)); ++this.analysisPasses; } }
private void DrawRecord(Rectangle bounds, SpriteBatch sb, DeathRowDatabaseDaemon.DeathRowEntry entry) { bounds.X += 2; bounds.Width -= 2; bool drawShadow = TextItem.DrawShadow; TextItem.DrawShadow = false; int height = 850; ScrollablePanel.beginPanel(98302836, new Rectangle(bounds.X, bounds.Y, bounds.Width, height), this.recordScrollPosition); int num1 = bounds.Width - 16; Vector2 vector2_1 = new Vector2(5f, 5f); GuiData.spriteBatch.Draw(DeathRowDatabaseDaemon.Logo, new Rectangle((int)vector2_1.X, (int)vector2_1.Y, 60, 60), Color.White); vector2_1.X += 70f; TextItem.doFontLabel(vector2_1, "DEATH ROW : EXECUTED OFFENDERS LISTING", GuiData.titlefont, new Color?(this.themeColor), (float)(num1 - 80), 45f, false); vector2_1.Y += 22f; if (Button.doButton(98102855, (int)vector2_1.X, (int)vector2_1.Y, bounds.Width / 2, 25, "Return", new Color?(Color.Black))) { this.SelectedIndex = -1; } vector2_1.X = 5f; vector2_1.Y += 55f; TextItem.doFontLabel(vector2_1, "RECORD " + entry.RecordNumber, GuiData.titlefont, new Color?(Color.White), (float)(num1 - 4), 60f, false); vector2_1.Y += 70f; int seperatorHeight = 18; int margin = 12; vector2_1 = this.DrawCompactLabel(LocaleTerms.Loc("Name") + ":", entry.LName + ", " + entry.FName, vector2_1, margin, seperatorHeight, num1); vector2_1 = this.DrawCompactLabel(LocaleTerms.Loc("Age") + ":", entry.Age, vector2_1, margin, seperatorHeight, num1); int num2 = 20; int num3 = 20; Vector2 vector2_2 = Vector2.Zero; TextItem.doFontLabel(vector2_1, LocaleTerms.Loc("Incident Report") + ":", GuiData.smallfont, new Color?(this.themeColor), (float)num1, float.MaxValue, false); vector2_1.Y += (float)num2; TextItem.DrawShadow = false; Vector2 vector2_3 = TextItem.doMeasuredSmallLabel(vector2_1, Utils.SmartTwimForWidth(entry.IncidentReport, num1, GuiData.smallfont), new Color?(Color.White)); vector2_1.Y += Math.Max(vector2_3.Y, (float)num2); vector2_1.Y += (float)num3; TextItem.doFontLabel(vector2_1, LocaleTerms.Loc("Final Statement") + ":", GuiData.smallfont, new Color?(this.themeColor), (float)num1, float.MaxValue, false); vector2_1.Y += (float)num2; vector2_2 = TextItem.doMeasuredSmallLabel(vector2_1, Utils.SmartTwimForWidth(entry.Statement, num1, GuiData.smallfont), new Color?(Color.White)); vector2_1.Y += (float)num3; this.recordScrollPosition = ScrollablePanel.endPanel(98302836, this.recordScrollPosition, bounds, (float)(height - bounds.Height), true); TextItem.DrawShadow = drawShadow; }
public void contractAbbandoned(object osIn) { OS os = (OS)osIn; if (this.PlayerLosesValueOnAbandon) { this.playerValue -= 10; if (this.playerValue < 0) { this.playerValue = 0; } } string email = MailServer.generateEmail(LocaleTerms.Loc("Contract Abandoned"), string.Format(Utils.readEntireFile("Content/LocPost/ContractAbandonedEmail.txt"), (object)this.getRank(), (object)this.getMaxRank(), (object)this.name), this.name + " ReplyBot"); ((MailServer)os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(email, os.defaultUser.name); }
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(); }
public override void Draw(float t) { base.Draw(t); this.drawOutline(); this.drawTarget("app:"); Rectangle contentAreaDest = this.GetContentAreaDest(); ZoomingDotGridEffect.Render(contentAreaDest, this.spriteBatch, this.os.timer, this.os.highlightColor * 0.4f); int x = contentAreaDest.X + 10; int width = contentAreaDest.Width - 20; int y1 = contentAreaDest.Y + 50; if (this.isExiting) { return; } if (Button.doButton(10777001 + this.PID, x, y1, width, 20, LocaleTerms.Loc("Scatter"), new Color?(this.os.netMap.SortingAlgorithm == NetmapSortingAlgorithm.Scatter ? Color.White : this.os.highlightColor))) { this.os.netMap.SortingAlgorithm = NetmapSortingAlgorithm.Scatter; } int y2 = y1 + 25; if (Button.doButton(10777003 + this.PID, x, y2, width, 20, LocaleTerms.Loc("Grid"), new Color?(this.os.netMap.SortingAlgorithm == NetmapSortingAlgorithm.Grid ? Color.White : this.os.highlightColor))) { this.os.netMap.SortingAlgorithm = NetmapSortingAlgorithm.Grid; } int y3 = y2 + 25; if (Button.doButton(10777005 + this.PID, x, y3, width, 20, LocaleTerms.Loc("Scan Sequence Grid"), new Color?(this.os.netMap.SortingAlgorithm == NetmapSortingAlgorithm.LockGrid ? Color.White : this.os.highlightColor))) { this.os.netMap.SortingAlgorithm = NetmapSortingAlgorithm.LockGrid; this.os.netMap.visibleNodes = this.os.netMap.visibleNodes.Distinct <int>().ToList <int>(); } int y4 = y3 + 25; if (this.AllowChaos && Button.doButton(10777019 + this.PID, x, y4, width, 20, LocaleTerms.Loc("CHAOS"), new Color?(this.os.netMap.SortingAlgorithm == NetmapSortingAlgorithm.Chaos ? Color.White : this.os.highlightColor))) { this.os.netMap.SortingAlgorithm = NetmapSortingAlgorithm.Chaos; } int num = y4 + 25; if (Button.doButton(10777088 + this.PID, x, contentAreaDest.Y + contentAreaDest.Height - 24, width, 20, LocaleTerms.Loc("Exit"), new Color?(this.os.lockedColor))) { this.isExiting = true; } }
private void DrawBrowse(Rectangle dest, SpriteBatch spriteBatch) { Rectangle drawRectForRow1 = this.GetDrawRectForRow(0, 12); bool flag = this.Permissions == DatabaseDaemon.DatabasePermissions.Public || this.comp.adminIP == this.os.thisComputer.ip; TextItem.doFontLabelToSize(drawRectForRow1, string.Format(LocaleTerms.Loc("{0} : Records"), (object)this.name), GuiData.font, Color.White, true, true); Rectangle drawRectForRow2 = this.GetDrawRectForRow(0, 0); PatternDrawer.draw(drawRectForRow2, 0.5f, Color.Transparent, this.ThemeColor * 0.2f, spriteBatch, PatternDrawer.thinStripe); Rectangle rectangle = new Rectangle(drawRectForRow2.X + 4, drawRectForRow2.Y + drawRectForRow2.Height / 2 + 12, drawRectForRow2.Width / 3, drawRectForRow2.Height / 2 - 15); if (Button.doButton(71118000, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, LocaleTerms.Loc("Back"), new Color?(Color.Gray))) { this.State = DatabaseDaemon.DatabaseState.Welcome; } if (this.DataType == (Type)null || string.IsNullOrWhiteSpace(this.DataTypeIdentifier) || this.DataTypeIdentifier.ToLower() == "none") { Rectangle drawRectForRow3 = this.GetDrawRectForRow(1, 2); drawRectForRow3.Height += (int)((double)this.blockSize * (double)(this.blocksHigh - 3)); PatternDrawer.draw(drawRectForRow3, 0.4f, Color.Black * 0.3f, Utils.makeColorAddative(this.ThemeColor) * 0.25f, spriteBatch, PatternDrawer.binaryTile); TextItem.doCenteredFontLabel(this.GetDrawRectForRow(3, 8), " - " + LocaleTerms.Loc("API Access Enabled") + " - ", GuiData.smallfont, Color.White, false); } else { Rectangle ListDest = this.GetDrawRectForRow(1, 4); ListDest.Height += (int)((double)this.blockSize * ((double)this.blocksHigh - 2.5)); this.ScrollPanel.NumberOfPanels = this.DatasetFolder.files.Count; this.ScrollPanel.Draw((Action <int, Rectangle, SpriteBatch>)((i, bounds, sb) => { FileEntry file = this.DatasetFolder.files[i]; string text = "REC#" + i.ToString("000") + " : " + this.GetAnnounceNameForFileName(file.name); int width = Math.Max(160, bounds.Width / 3); if (Button.doButton(71118100 + i, bounds.X, bounds.Y + 2, width, bounds.Height - 4, string.Format(LocaleTerms.Loc("View Record #{0}"), (object)i.ToString("000")), new Color?(this.ThemeColor))) { this.ActiveFile = this.DatasetFolder.files[i]; this.State = DatabaseDaemon.DatabaseState.EntryDisplay; this.DeserializedFile = (object)null; } Vector2 vector2 = GuiData.smallfont.MeasureString(text); Rectangle destinationRectangle = new Rectangle(bounds.X + bounds.Width / 3 + 6, bounds.Y + bounds.Height / 2 - 1, ListDest.Width - (width + (int)vector2.X + 26), 1); sb.Draw(Utils.white, destinationRectangle, Color.White * 0.1f); TextItem.doFontLabel(new Vector2((float)(destinationRectangle.X + destinationRectangle.Width) + 6f, (float)bounds.Y + 2f), text, GuiData.smallfont, new Color?(Color.White), (float)bounds.Width, (float)bounds.Height, false); }), spriteBatch, ListDest); } }
public MessageBoardDaemon(Computer c, OS os) : base(c, LocaleTerms.Loc("Message Board"), os) { if (MessageBoardDaemon.Images == null) { MessageBoardDaemon.Images = new Dictionary <MessageBoardPostImage, Texture2D>(); MessageBoardDaemon.Images.Add(MessageBoardPostImage.Academic, os.content.Load <Texture2D>("Sprites/Academic_Logo")); MessageBoardDaemon.Images.Add(MessageBoardPostImage.Sun, os.content.Load <Texture2D>("Sprites/Sun")); MessageBoardDaemon.Images.Add(MessageBoardPostImage.Snake, os.content.Load <Texture2D>("Sprites/Snake")); MessageBoardDaemon.Images.Add(MessageBoardPostImage.Circle, os.content.Load <Texture2D>("CircleOutline")); MessageBoardDaemon.Images.Add(MessageBoardPostImage.Duck, os.content.Load <Texture2D>("Sprites/Duck")); MessageBoardDaemon.Images.Add(MessageBoardPostImage.Page, os.content.Load <Texture2D>("Sprites/Page")); MessageBoardDaemon.Images.Add(MessageBoardPostImage.Speech, os.content.Load <Texture2D>("Sprites/SpeechBubble")); MessageBoardDaemon.Images.Add(MessageBoardPostImage.Mod, os.content.Load <Texture2D>("Sprites/Hammer")); MessageBoardDaemon.Images.Add(MessageBoardPostImage.Chip, os.content.Load <Texture2D>("Sprites/Chip")); } this.threadsPanel = new ScrollableSectionedPanel(415, GuiData.spriteBatch.GraphicsDevice); }
private void doDisconnectForcedDisplay() { this.tmpRect.X = this.bounds.X + 2; this.tmpRect.Width = this.bounds.Width - 4; this.tmpRect.Y = this.bounds.Y + this.bounds.Height / 6 * 2; this.tmpRect.Height = this.bounds.Height / 3; Rectangle tmpRect = this.tmpRect; double num1 = Math.Abs(Math.Sin((double)this.os.timer)); int num2 = (int)(num1 * 40.0); Rectangle destinationRectangle = Utils.InsetRectangle(tmpRect, -1 * num2); destinationRectangle.X = this.tmpRect.X; destinationRectangle.Width = this.tmpRect.Width; this.spriteBatch.Draw(Utils.white, destinationRectangle, Utils.AddativeRed * (float)(1.0 - num1)); this.spriteBatch.Draw(Utils.white, this.tmpRect, this.os.indentBackgroundColor); Vector2 position = new Vector2((float)(this.tmpRect.X + this.bounds.Width / 2) - GuiData.font.MeasureString(LocaleTerms.Loc("Connection Denied by Remote Server")).X / 2f, (float)(this.bounds.Y + this.bounds.Height / 2 - 10)); this.spriteBatch.DrawString(GuiData.font, LocaleTerms.Loc("Connection Denied by Remote Server"), position, this.os.brightLockedColor); }
public void RenderMainDisplay(Rectangle dest, SpriteBatch sb) { dest = this.RenderMainDisplayHeaders(dest, sb); switch (this.State) { case MemoryForensicsExe.MemForensicsState.Error: PatternDrawer.draw(dest, 1f, Color.Transparent, Utils.AddativeRed, this.spriteBatch, PatternDrawer.errorTile); Rectangle rectangle1 = new Rectangle(dest.X, dest.Y + dest.Height / 3, dest.Width, 60); sb.Draw(Utils.white, rectangle1, Color.Black * 0.4f); TextItem.doFontLabelToSize(rectangle1, LocaleTerms.Loc("ERROR"), GuiData.font, Color.White, true, true); Rectangle rectangle2 = new Rectangle(dest.X, rectangle1.Y + rectangle1.Height + 2, dest.Width, dest.Height / 2); sb.Draw(Utils.white, rectangle2, Color.Black * 0.8f); string text = Utils.SuperSmartTwimForWidth(this.ErrorMessage.Length > 500 ? this.ErrorMessage.Substring(0, 500) : this.ErrorMessage, rectangle2.Width, GuiData.smallfont); TextItem.doFontLabelToSize(rectangle2, text, GuiData.smallfont, Utils.AddativeRed, true, true); if (!Button.doButton(381023801, dest.X + 2, rectangle2.Y + rectangle2.Height + 2, this.bounds.Width / 3, 30, LocaleTerms.Loc("Close"), new Color?(this.os.lockedColor))) { break; } this.isExiting = true; break; case MemoryForensicsExe.MemForensicsState.ReadingFile: Rectangle bounds = new Rectangle(dest.X, dest.Y, (int)((double)dest.Width * ((double)this.timeInCurrentState / 2.0)), dest.Height); bounds = new Rectangle(dest.X + (int)((double)dest.Width * (1.0 - (double)this.timeInCurrentState / 2.0)), dest.Y, (int)((double)dest.Width * ((double)this.timeInCurrentState / 2.0)), dest.Height); this.GridEffect.RenderGrid(bounds, sb, this.ThemeColorDark * 0.5f, this.ThemeColorMain, this.ThemeColorDark, false); break; case MemoryForensicsExe.MemForensicsState.Main: this.DrawMainStateBackground(dest, sb); this.RenderMenuMainState(dest, sb); break; case MemoryForensicsExe.MemForensicsState.Processing: this.DrawMainStateBackground(dest, sb); this.RenderResultsDisplayMainState(dest, sb, true); break; case MemoryForensicsExe.MemForensicsState.DisplayingSolution: this.DrawMainStateBackground(dest, sb); this.RenderResultsDisplayMainState(dest, sb, false); break; } }
public void DisconnectTarget() { this.os.execute("disconnect"); this.os.display.command = "connectiondenied"; this.os.delayer.Post(ActionDelayer.NextTick(), (Action)(() => this.os.display.command = "connectiondenied")); this.os.write(" "); this.os.write(" "); this.os.write("------------------------------"); this.os.write("------------------------------"); this.os.write(" "); this.os.write("--- " + LocaleTerms.Loc("CONNECTION ERROR") + " ---"); this.os.write(" "); this.os.write(LocaleTerms.Loc("Message from Server:")); this.os.write(string.Format(LocaleTerms.Loc("Whitelist Authenticator denied connection from IP {0}"), (object)this.os.thisComputer.ip)); this.os.write(" "); this.os.write("------------------------------"); this.os.write("------------------------------"); this.os.write(" "); }
private void DrawIPEntryScreen(Rectangle bounds, SpriteBatch sb) { TextItem.doFontLabel(new Vector2((float)(bounds.X + 30), (float)(bounds.Y + 20)), LocaleTerms.Loc("IP Entry") + " :: " + this.scannedComputer.ip, GuiData.font, new Color?(Color.White), (float)bounds.Width, float.MaxValue, false); TextItem.doFontLabel(new Vector2((float)(bounds.X + 30), (float)(bounds.Y + 70)), LocaleTerms.Loc("Identified as") + " :\"" + this.scannedComputer.name + "\"", GuiData.smallfont, new Color?(Color.White), (float)bounds.Width, float.MaxValue, false); sb.Draw(this.os.display.GetComputerImage(this.scannedComputer), new Vector2((float)(bounds.X + 30), (float)(bounds.Y + 100)), Color.White); int x = bounds.X + 30 + 130; int y1 = bounds.Y + 100; if (Button.doButton(3388301, x, y1, bounds.Width - 180, 30, LocaleTerms.Loc("Assign New IP"), new Color?(this.os.brightUnlockedColor))) { bool flag; do { this.scannedComputer.ip = NetworkMap.generateRandomIP(); flag = false; for (int index = 0; index < this.os.netMap.nodes.Count; ++index) { if (this.os.netMap.nodes[index].ip == this.scannedComputer.ip && this.os.netMap.nodes[index].idName != this.scannedComputer.idName) { flag = true; } } }while (flag); if (this.os.thisComputer.idName == this.scannedComputer.idName) { this.os.thisComputerIPReset(); } } int y2 = y1 + 34; if (Button.doButton(3388304, x, y2, bounds.Width - 180, 30, LocaleTerms.Loc("Flag for Inspection") + (this.inspectionFlagged ? " : " + LocaleTerms.Loc("ACTIVE") : ""), new Color?(this.inspectionFlagged ? Color.Gray : this.os.highlightColor))) { this.inspectionFlagged = true; } int y3 = y2 + 34; if (!Button.doButton(3388308, x, y3, bounds.Width - 180, 30, LocaleTerms.Loc("Prioritize Routing"), new Color?(this.os.highlightColor))) { ; } this.drawBackButton(bounds, ISPDaemon.ISPDaemonState.Welcome); }
private IEnumerator <ActionDelayer.Condition> generateOutputPass(int pass, OS os, Computer target) { target.firewallAnalysisInProgress = true; os.write(string.Format(LocaleTerms.Loc("Firewall Analysis Pass {0}"), (object)this.analysisPasses) + "\n"); yield return(ActionDelayer.Wait(0.03)); os.write("--------------------"); yield return(ActionDelayer.Wait(0.03)); string preceedeString = " "; double secondsDelayPerLine = 0.08 + 0.06 * (double)pass + (double)this.additionalDelay; for (int i = 0; i < this.solutionLength; ++i) { os.write(preceedeString + this.generateOutputLine(i)); yield return(ActionDelayer.Wait(secondsDelayPerLine)); } os.write("--------------------\n"); target.firewallAnalysisInProgress = false; }
public void registerAsDefaultBootDaemon() { if (!this.comp.AllowsDefaultBootModule) { return; } FileEntry fileEntry = this.comp.files.root.searchForFolder("sys").searchForFile(ComputerTypeInfo.getDefaultBootDaemonFilename((object)this)); if (fileEntry != null) { if (fileEntry.data != "[Locked]") { fileEntry.data = LocaleTerms.Loc(this.name); } } else { this.comp.files.root.searchForFolder("sys").files.Add(new FileEntry(LocaleTerms.Loc(this.name), ComputerTypeInfo.getDefaultBootDaemonFilename((object)this))); } }
public MissionListingServer(Computer c, string serviceName, string group, OS _os, bool _isPublic = false, bool _isAssigner = false) : base(c, serviceName, _os) { this.groupName = group; this.topBar = this.os.content.Load <Texture2D>("Panel"); this.corner = this.os.content.Load <Texture2D>("Corner"); if (group.Equals("Entropy")) { this.themeColor = new Color(3, 102, 49); this.logo = this.os.content.Load <Texture2D>("EntropyLogo"); } else if (group.Equals("NetEdu")) { this.themeColor = new Color(119, 104, 160); this.logo = this.os.content.Load <Texture2D>("Sprites/Academic_Logo"); } else if (group.Equals("Kellis Biotech")) { this.themeColor = new Color(106, 176, (int)byte.MaxValue); this.logo = this.os.content.Load <Texture2D>("Sprites/KellisLogo"); } else { this.themeColor = new Color(204, 163, 27); this.logo = this.os.content.Load <Texture2D>("SlashbotLogo"); } this.logoRect = new Rectangle(0, 0, 64, 64); this.isPublic = _isPublic; this.missionAssigner = _isAssigner; this.state = !this.isPublic ? 0 : 1; this.missions = new List <ActiveMission>(); this.branchMissions = new List <List <ActiveMission> >(); if (this.isPublic) { this.listingTitle = string.Format(LocaleTerms.Loc("{0} News"), (object)group); } else { this.listingTitle = LocaleTerms.Loc("Available Contracts"); } }
private void DrawEntry(Rectangle dest, SpriteBatch spriteBatch) { if (this.DeserializedFile == null) { try { this.DeserializedFile = ObjectSerializer.DeserializeObject(Utils.GenerateStreamFromString(this.DeCleanXMLForFile(this.ActiveFile.data)), this.DataType); } catch (Exception ex) { this.State = DatabaseDaemon.DatabaseState.Error; this.errorMessage = LocaleTerms.Loc("Error De-serializing Entry") + " : " + this.ActiveFile.name + "\n" + Utils.GenerateReportFromException(ex).Replace("Hacknet", "Database"); return; } } Rectangle drawRectForRow = this.GetDrawRectForRow(0, 0); drawRectForRow.Height = drawRectForRow.Height / 2; TextItem.doFontLabelToSize(drawRectForRow, string.Format(LocaleTerms.Loc("Entry for {0}"), (object)this.GetAnnounceNameForFileName(this.ActiveFile.name)), GuiData.font, Color.White, true, true); drawRectForRow.Y += drawRectForRow.Height; if (Button.doButton(7301991, drawRectForRow.X, drawRectForRow.Y, drawRectForRow.Width / 2, drawRectForRow.Height, LocaleTerms.Loc("Back"), new Color?(Color.Gray))) { this.State = DatabaseDaemon.DatabaseState.Browse; this.ActiveFile = (FileEntry)null; this.DeserializedFile = (object)null; } else { Rectangle bounds = new Rectangle((int)this.BlockStartTopLeft.X, (int)this.BlockStartTopLeft.Y + (int)this.blockSize, (int)((double)this.blockSize * (double)(this.blocksWide - 1)), (int)((double)this.blockSize * (double)(this.blocksHigh - 2))); if (this.HasSpecialCaseDraw) { ReflectiveRenderer.PreRenderForObject += (Action <Vector2, Type, string>)((pos, targetType, targetValue) => this.DrawSpecialCase(pos, bounds, targetType, targetValue, spriteBatch)); } ReflectiveRenderer.RenderObject(this.DeserializedFile, bounds, spriteBatch, this.ScrollPanel, this.ThemeColor); if (this.HasSpecialCaseDraw) { ReflectiveRenderer.PreRenderForObject = (Action <Vector2, Type, string>)null; } } }
public MissionListingServer(Computer c, string serviceName, string iconPath, string articleFolderPath, Color themeColor, OS _os, bool _isPublic = false, bool _isAssigner = false) : base(c, serviceName, _os) { this.groupName = serviceName; this.topBar = this.os.content.Load <Texture2D>("Panel"); this.corner = this.os.content.Load <Texture2D>("Corner"); this.themeColor = themeColor; string str = "Content/"; if (Settings.IsInExtensionMode) { str = ExtensionLoader.ActiveExtensionInfo.FolderPath + "/"; } try { using (FileStream fileStream = File.OpenRead(str + iconPath)) this.logo = Texture2D.FromStream(GuiData.spriteBatch.GraphicsDevice, (Stream)fileStream); } catch (Exception ex) { this.logo = this.os.content.Load <Texture2D>("Sprites/Academic_Logo"); } this.NeedsCustomFolderLoad = true; this.CustomFolderLoadPath = str + articleFolderPath; this.CustomFolderLoadPath = this.CustomFolderLoadPath.Replace('\\', '/'); if (!this.CustomFolderLoadPath.EndsWith("/")) { this.CustomFolderLoadPath += "/"; } this.logoRect = new Rectangle(0, 0, 64, 64); this.isPublic = _isPublic; this.missionAssigner = _isAssigner; this.state = !this.isPublic ? 0 : 1; this.missions = new List <ActiveMission>(); this.branchMissions = new List <List <ActiveMission> >(); this.listingTitle = !this.isPublic ? LocaleTerms.Loc("Available Contracts") : serviceName; this.HasCustomColor = true; this.IconReloadPath = iconPath; this.ArticleFolderPath = articleFolderPath; }
private void drawMultipleEntriesState(Rectangle bounds, SpriteBatch sb) { float num1 = 22f; float num2 = 2f; Vector2 pos = new Vector2((float)bounds.X + 20f, (float)bounds.Y + 10f); int num3 = (int)Math.Min((float)this.searchResultsNames.Count, (float)(((double)bounds.Height - 40.0 - 40.0 - 80.0) / ((double)num1 + (double)num2))); TextItem.doFontLabel(pos, LocaleTerms.Loc("Multiple Matches"), GuiData.font, new Color?(), float.MaxValue, float.MaxValue, false); pos.Y += 30f; if (num3 > this.searchResultsNames.Count) { TextItem.doFontLabel(new Vector2(pos.X, pos.Y - 18f), LocaleTerms.Loc("Some Results Omitted"), GuiData.tinyfont, new Color?(), float.MaxValue, float.MaxValue, false); } sb.Draw(Utils.white, new Rectangle((int)pos.X, (int)pos.Y, (int)((double)bounds.Width - (double)pos.X - 5.0), 2), Color.White); pos.Y += 12f; for (int index = 0; index < num3; ++index) { if (Button.doButton(1237000 + index, (int)pos.X, (int)pos.Y, (int)((double)bounds.Width * 0.666), (int)num1, this.searchResultsNames[index], new Color?(this.darkThemeColor))) { this.searchedName = this.searchResultsNames[index]; this.state = AcademicDatabaseDaemon.ADDState.MultiMatchSearch; this.searchStartTime = this.os.timer; } pos.Y += num1 + num2; } pos.Y += 5f; sb.Draw(Utils.white, new Rectangle((int)pos.X, (int)pos.Y, (int)((double)bounds.Width - (double)pos.X - 5.0), 2), Color.White); pos.Y += 10f; if (Button.doButton(12346080, (int)pos.X, (int)pos.Y, 160, 25, LocaleTerms.Loc("Refine Search"), new Color?(this.themeColor))) { this.state = AcademicDatabaseDaemon.ADDState.Seach; this.os.execute("getString Name"); } if (!Button.doButton(12346085, (int)pos.X + 170, (int)pos.Y, 160, 25, LocaleTerms.Loc("Go Back"), new Color?(this.darkThemeColor))) { return; } this.state = AcademicDatabaseDaemon.ADDState.Welcome; }
private void DrawError(Rectangle dest, SpriteBatch sb) { Rectangle drawRectForRow1 = this.GetDrawRectForRow(0, 12); bool flag = this.Permissions == DatabaseDaemon.DatabasePermissions.Public || this.comp.adminIP == this.os.thisComputer.ip; TextItem.doFontLabelToSize(drawRectForRow1, this.name, GuiData.font, Color.White, false, true); PatternDrawer.draw(new Rectangle(dest.X + 1, (int)this.BlockStartTopLeft.Y, dest.Width - 2, (int)((double)this.blockSize * 2.0)), 0.5f, Color.Transparent, Utils.AddativeRed * 0.2f, sb, flag ? PatternDrawer.thinStripe : PatternDrawer.errorTile); TextItem.doFontLabelToSize(this.GetDrawRectForRow(1, 12), LocaleTerms.Loc("ERROR"), GuiData.font, Utils.AddativeRed * 0.8f, true, true); Rectangle drawRectForRow2 = this.GetDrawRectForRow(2, 14); if (Button.doButton(73616101, (int)this.BlockStartTopLeft.X, drawRectForRow2.Y, dest.Width / 2, drawRectForRow2.Height, LocaleTerms.Loc("Back"), new Color?(this.ThemeColor))) { this.State = DatabaseDaemon.DatabaseState.Welcome; } Rectangle rectangle = this.GetDrawRectForRow(3, 14); rectangle.Height = (int)(((double)this.blocksHigh - 4.0) * (double)this.blockSize); rectangle = Utils.InsetRectangle(rectangle, 2); string text = Utils.SuperSmartTwimForWidth(this.errorMessage, rectangle.Width, GuiData.smallfont); this.TextRegion.Draw(rectangle, text, sb, Utils.AddativeRed); }
private void StartAssignment() { if (!this.AllAssignmentsComplete) { if (this.IsOnAssignment1) { this.PhaseTitle = "74.125.23.121"; this.PhaseSubtitle = LocaleTerms.Loc("Download Tools") + "\n" + LocaleTerms.Loc("Delete System Files"); } else { this.PhaseTitle = "216.239.32.181"; this.PhaseSubtitle = LocaleTerms.Loc("Adapt") + "\n" + LocaleTerms.Loc("Advance"); } this.State = this.IsOnAssignment1 ? DLCIntroExe.IntroState.OnMission1 : DLCIntroExe.IntroState.OnMission2; this.TimeInThisState = 0.0f; this.LoadedMission = (ActiveMission)ComputerLoader.readMission(this.IsOnAssignment1 ? this.assignment1MissionPath : this.assignment2MissionPath); } else { this.CompleteExecution(); } }
public static void ReadInTerms(string termsFilepath, bool clearPreviouslyLoadedTerms = true) { char[] separator = new char[1] { '\t' }; if (clearPreviouslyLoadedTerms) { LocaleTerms.ActiveTerms.Clear(); } string[] strArray1 = File.ReadAllLines(termsFilepath); for (int index = 1; index < strArray1.Length; ++index) { if (strArray1[index].StartsWith("\t")) { string[] strArray2 = strArray1[index].Split(separator, StringSplitOptions.RemoveEmptyEntries); if (strArray2.Length > 1 && !LocaleTerms.ActiveTerms.ContainsKey(strArray2[0]) && !LocaleTerms.ActiveTerms.ContainsKey(LocaleTerms.RemoveQuotes(strArray2[0]))) { string input = strArray2[1].Replace("[%\\n%]", "\n"); LocaleTerms.ActiveTerms.Add(LocaleTerms.RemoveQuotes(strArray2[0]), LocaleTerms.RemoveQuotes(input)); } } } }
public override void initFiles() { base.initFiles(); this.rootFolder = new Folder("PointClicker"); this.savesFolder = new Folder("Saves"); int num1 = 50; int num2 = 0; for (int index = 0; index < num1; ++index) { string name; do { name = People.all[index + num2].handle; if (name == null) { ++num2; } }while (index + num2 < People.all.Count && name == null); if (index == 22) { name = "Mengsk"; } if (index == 28) { name = "Bit"; } if (name != null) { this.AddSaveForName(name, index == 22 || index == 28); } } this.rootFolder.folders.Add(this.savesFolder); this.comp.files.root.folders.Add(this.rootFolder); this.rootFolder.files.Add(new FileEntry(Computer.generateBinaryString(1000), "config.ini")); this.rootFolder.files.Add(new FileEntry(LocaleTerms.Loc("IMPORTANT : NEVER DELETE OR RE-NAME") + " \"config.ini\"\n " + LocaleTerms.Loc("IT IS SYSTEM CRITICAL!") + " " + LocaleTerms.Loc("Removing it causes instant crash. DO NOT TEST THIS"), "IMPORTANT_README_DONT_CRASH.txt")); }
internal virtual void DrawNonAdminDisplay(Rectangle dest, SpriteBatch sb) { Rectangle destinationRectangle = new Rectangle(dest.X + 1, dest.Y, dest.Width, 1); sb.Draw(Utils.white, destinationRectangle, Utils.AddativeRed); int height1 = 120; Rectangle rectangle = new Rectangle(dest.X, dest.Y + (dest.Height / 2 - height1), dest.Width, height1); sb.Draw(Utils.white, rectangle, Color.Black * 0.8f); int stripHeight = 20; this.DrawCautionLinedMessage(Utils.InsetRectangle(rectangle, 4), stripHeight, Color.Red, "ACCESS DENIED", sb, (Texture2D)null, 0); int height2 = 90; Rectangle dest1 = Utils.InsetRectangle(new Rectangle(rectangle.X, rectangle.Y + stripHeight + 2, rectangle.Width, height2), 20); dest1.Y = rectangle.Y + rectangle.Height + 2; dest1.Height = 30; TextItem.doFontLabelToSize(dest1, LocaleTerms.Loc("Non-Admin Account Detected - Login to Proceed or Disconnect Now"), GuiData.font, Color.Black, true, false); TextItem.doFontLabelToSize(dest1, LocaleTerms.Loc("Non-Admin Account Detected - Login to Proceed or Disconnect Now"), GuiData.font, Color.Red * 0.7f, true, false); int width = 340; int x = dest.X + dest.Width / 2 - width / 2; int y1 = dest1.Y + dest1.Height + 10; int height3 = 40; if (Button.doButton(302001, x, y1, width, height3, LocaleTerms.Loc("Login"), new Color?(Color.Gray))) { this.os.runCommand("login"); this.os.terminal.clearCurrentLine(); } int y2 = y1 + (height3 + 6); if (!Button.doButton(302003, x, y2, width, 40, LocaleTerms.Loc("Disconnect"), new Color?(Color.Red))) { return; } this.os.runCommand("dc"); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); PostProcessor.begin(); GuiData.startDraw(); GuiData.spriteBatch.Draw(Utils.white, this.Fullscreen, Color.Black); if (this.IsDLCDemoScreen) { this.HexBackground.Draw(Utils.GetFullscreen(), GuiData.spriteBatch, Utils.AddativeRed * 0.2f, Color.Black, HexGridBackground.ColoringAlgorithm.OutlinedSinWash, 0.0f); this.pointEffect.Render(Utils.GetFullscreen(), GuiData.spriteBatch); GuiData.spriteBatch.Draw(Utils.white, this.Fullscreen, Color.Black * 0.5f); } Rectangle dest = Utils.InsetRectangle(this.Fullscreen, 200); dest.Y = dest.Y + dest.Height / 2 - 200; dest.Height = 400; Rectangle destinationRectangle = new Rectangle(this.Fullscreen.X, dest.Y + 50, this.Fullscreen.Width, dest.Height - 148); GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Utils.AddativeRed * (0.5f + Utils.randm(0.1f))); string text = "HACKNET"; FlickeringTextEffect.DrawLinedFlickeringText(dest, text, this.IsDLCDemoScreen ? 5f : 18f, this.IsDLCDemoScreen ? 0.8f : 0.7f, GuiData.titlefont, (object)null, Color.White, 6); dest.Y += 400; dest.Height = 120; SpriteFont font = GuiData.titlefont; if (Settings.ActiveLocale != "en-us") { font = GuiData.font; } string input = this.IsDLCDemoScreen ? "EXPANSION COMING DECEMBER" : "MORE SOON"; FlickeringTextEffect.DrawFlickeringText(dest, Utils.FlipRandomChars(LocaleTerms.Loc(input), this.IsDLCDemoScreen ? 0.0045 : 0.008), -8f, 0.7f, font, (object)null, Color.Gray); FlickeringTextEffect.DrawFlickeringText(dest, Utils.FlipRandomChars(LocaleTerms.Loc(input), 0.03), -8f, 0.7f, font, (object)null, Utils.AddativeWhite * 0.15f); GuiData.endDraw(); PostProcessor.end(); }
private void InitGameSettings() { this.upgradeNames.Add(LocaleTerms.Loc("Click Me!")); this.upgradeNames.Add(LocaleTerms.Loc("Autoclicker v1")); this.upgradeNames.Add(LocaleTerms.Loc("Autoclicker v2")); this.upgradeNames.Add(LocaleTerms.Loc("Pointereiellion")); this.upgradeValues.Add(0.04f); this.upgradeValues.Add(1f); this.upgradeValues.Add(10f); this.upgradeValues.Add(200f); this.storyBeats.Add("Your glorious ClickPoints empire begins"); this.storyBeats.Add("The hard days of manual button clicking labour seem endless, but a better future is in sight."); this.storyBeats.Add("The investment is returned - you finally turn a profit."); this.storyBeats.Add("Your long days of labour to gather the initial 12 points are a fast-fading memory."); this.storyBeats.Add("You reach international acclaim as a prominent and incredibly wealthy point collector."); this.storyBeats.Add("Your enormous pile of points is now larger than Everest"); this.storyBeats.Add("The ClickPoints continent is declared : a landmass made entirely of your insane wealth."); this.storyBeatChangers.Add(0L); this.storyBeatChangers.Add(5L); this.storyBeatChangers.Add(15L); this.storyBeatChangers.Add(200L); this.storyBeatChangers.Add(100000L); this.storyBeatChangers.Add(1000000000000L); this.storyBeatChangers.Add(11111000000000000L); for (int index = 3; index < 50; ++index) { this.upgradeNames.Add(LocaleTerms.Loc("Upgrade") + " " + (object)(index + 1)); this.upgradeValues.Add((float)Math.Max((double)(index * index * index * index * index), 0.01)); } for (int index = 0; index < this.upgradeValues.Count; ++index) { this.upgradeCosts.Add((float)((double)this.upgradeValues[index] * (double)(1 + index / 50 * 5) * (double)this.UpgradeCostMultiplier * (1.0 + (double)this.UpgradeCostMultiplier * ((double)((index + 1) / this.upgradeValues.Count) * 5.0)))); } this.upgradeCosts[0] = 0.0f; this.upgradeCosts[1] = 12f; }
public override void navigatedTo() { base.navigatedTo(); FileEntry fileEntry = this.comp.files.root.searchForFolder("home").searchForFile("CreditsData.txt"); if (fileEntry == null) { this.CreditsData = new string[2] { "- " + LocaleTerms.Loc("Critical Error") + " -", LocaleTerms.Loc("Datafile not found") } } ; else { this.CreditsData = fileEntry.data.Split(Utils.robustNewlineDelim, StringSplitOptions.None); } if (!this.os.Flags.HasFlag("dlc_complete")) { return; } this.showingCredits = true; }