Exemple #1
0
        public static void ReInitPeopleForExtension()
        {
            People.all.Clear();
            People.hackers.Clear();
            People.hubAgents.Clear();
            int    num  = 0;
            string path = Path.Combine(Utils.GetFileLoadPrefix(), "People");

            if (Directory.Exists(path))
            {
                foreach (FileSystemInfo file in new DirectoryInfo(path).GetFiles("*.xml"))
                {
                    Person person = People.loadPersonFromFile(LocalizedFileLoader.GetLocalizedFilepath(path + "/" + Path.GetFileName(file.Name)));
                    if (person != null)
                    {
                        People.all.Insert(0, person);
                        ++num;
                    }
                }
            }
            for (int index = num; index < 200; ++index)
            {
                bool   male    = Utils.flipCoin();
                string fName   = male ? People.maleNames[Utils.random.Next(People.maleNames.Length)] : People.femaleNames[Utils.random.Next(People.femaleNames.Length)];
                string surname = People.surnames[Utils.random.Next(People.surnames.Length)];
                People.all.Add(new Person(fName, surname, male, false, UsernameGenerator.getName()));
            }
            People.hackers = new List <Person>();
            People.generatePeopleForList(People.hackers, 10, true);
            People.hubAgents = new List <Person>();
            People.generatePeopleForList(People.hubAgents, 22, true);
        }
Exemple #2
0
        public void doEmailViewerDisplay(Rectangle bounds, SpriteBatch sb)
        {
            Vector2 vector2 = new Vector2((float)(bounds.X + 2), (float)(bounds.Y + 20));

            if (Button.doButton(800007, (int)vector2.X, (int)vector2.Y, bounds.Width - 20 - this.corner.Width, 30, LocaleTerms.Loc("Return to Inbox"), new Color?(this.os.darkBackgroundColor)))
            {
                this.state = 3;
            }
            vector2.Y += 35f;
            Rectangle tmpRect = GuiData.tmpRect;

            tmpRect.X      = bounds.X + 1;
            tmpRect.Y      = (int)vector2.Y;
            tmpRect.Width  = bounds.Width - 2;
            tmpRect.Height = 38;
            sb.Draw(Utils.white, tmpRect, this.textColor);
            vector2.Y += 3f;
            sb.DrawString(GuiData.UITinyfont, "<" + this.emailData[1] + ">", vector2, Color.Black);
            vector2.Y += 18f;
            sb.DrawString(GuiData.UITinyfont, LocaleTerms.Loc("Subject") + ": " + LocalizedFileLoader.SafeFilterString(this.emailData[2]), vector2, Color.Black);
            vector2.Y += 25f;
            vector2.X += 20f;
            int       num1       = 25;
            int       num2       = (this.emailData.Length - 4 + 1) * num1;
            Rectangle textBounds = new Rectangle((int)vector2.X, (int)vector2.Y, bounds.Width - 22, (int)((double)bounds.Height - ((double)vector2.Y - (double)bounds.Y) - (double)num2));
            string    str1;

            if (LocaleActivator.ActiveLocaleIsCJK())
            {
                string str2 = "\t";
                str1 = Utils.SuperSmartTwimForWidth(LocalizedFileLoader.SafeFilterString(this.emailData[3].Replace("。\n", str2).Replace("\n", "").Replace(str2, "。\n").Replace(str2, "!\n").Replace(str2, "!\n")), bounds.Width - 50, GuiData.tinyfont).Replace("\r\n\r\n\r\n", "\r\n\r\n");
            }
            else
            {
                str1 = Utils.SmartTwimForWidth(LocalizedFileLoader.SafeFilterString(this.emailData[3]), bounds.Width - 50, GuiData.tinyfont);
            }
            vector2.Y += (float)this.DrawMailMessageText(textBounds, sb, str1.Split(Utils.newlineDelim));
            vector2.Y += (float)(num1 - 5);
            int startingButtonIndex = 0;

            for (int index = 4; index < this.emailData.Length; ++index)
            {
                if (AttachmentRenderer.RenderAttachment(this.emailData[index], (object)this.os, vector2, startingButtonIndex, MailServer.buttonSound))
                {
                    ++startingButtonIndex;
                    vector2.Y += (float)num1;
                }
            }
            vector2.Y = (float)(bounds.Y + bounds.Height - 35);
            if (!Button.doButton(90200, (int)vector2.X, (int)vector2.Y, 300, 30, LocaleTerms.Loc("Reply"), new Color?()))
            {
                return;
            }
            this.emailReplyStrings.Clear();
            this.addingNewReplyString   = false;
            this.missionIncompleteReply = false;
            this.state = 5;
        }
Exemple #3
0
 public void removeMission(string missionPath)
 {
     for (int index = 0; index < this.missions.Count; ++index)
     {
         if (this.missions[index].reloadGoalsSourceFile == LocalizedFileLoader.GetLocalizedFilepath(missionPath))
         {
             this.removeMission(index);
             --index;
         }
     }
 }
Exemple #4
0
 private void doCatDisplay()
 {
     if (this.os.hasConnectionPermission(false))
     {
         if (Button.doButton(299999, this.bounds.X + (this.bounds.Width - 41), this.bounds.Y + 12, 27, 29, "<-", new Color?()))
         {
             this.os.runCommand("ls");
         }
         Rectangle tmpRect = GuiData.tmpRect;
         tmpRect.Width  = this.bounds.Width;
         tmpRect.X      = this.bounds.X;
         tmpRect.Y      = this.bounds.Y + 1;
         tmpRect.Height = this.bounds.Height - 2;
         if (this.os.connectedComp != null && this.os.connectedComp.ip != this.LastDisplayedFileSourceIP && this.LastDisplayedFileSourceIP != this.os.thisComputer.ip)
         {
             this.command = "dc";
         }
         else
         {
             string data = "";
             for (int index = 1; index < this.commandArgs.Length; ++index)
             {
                 data = data + this.commandArgs[index] + " ";
             }
             string text1 = LocalizedFileLoader.SafeFilterString(data);
             if (this.LastDisplayedFileFolder.searchForFile(text1.Trim()) == null)
             {
                 this.os.postFXDrawActions += (Action)(() =>
                 {
                     Rectangle rectangle = new Rectangle(this.bounds.X + 1, this.bounds.Y + this.bounds.Height / 2 - 70, this.bounds.Width - 2, 140);
                     this.spriteBatch.Draw(Utils.white, rectangle, this.os.lockedColor);
                     TextItem.doCenteredFontLabel(rectangle, "File Not Found", GuiData.font, Color.White, false);
                 });
                 this.catScroll = Vector2.Zero;
             }
             else
             {
                 TextItem.doFontLabel(new Vector2((float)this.x, (float)(this.y + 3)), text1, GuiData.font, new Color?(Color.White), (float)(this.bounds.Width - 70), float.MaxValue, false);
                 int       num          = 55;
                 Rectangle dest         = new Rectangle(tmpRect.X + 4, tmpRect.Y + num, tmpRect.Width - 6, tmpRect.Height - num - 2);
                 string    displayCache = this.os.displayCache;
                 this.y += 70;
                 string text2 = Utils.SuperSmartTwimForWidth(LocalizedFileLoader.SafeFilterString(displayCache), this.bounds.Width - 40, GuiData.tinyfont);
                 this.catTextRegion.Draw(dest, text2, this.spriteBatch);
             }
         }
     }
     else
     {
         this.command = "connect";
     }
 }
Exemple #5
0
 public static void LoadInDLCPeople()
 {
     if (!Settings.EnableDLC || !DLC1SessionUpgrader.HasDLC1Installed)
     {
         return;
     }
     foreach (FileSystemInfo file in new DirectoryInfo("Content/DLC/People").GetFiles("*.xml"))
     {
         Person person = People.loadPersonFromFile(LocalizedFileLoader.GetLocalizedFilepath("Content/DLC/People/" + Path.GetFileName(file.Name)));
         if (person != null)
         {
             People.all.Insert(0, person);
         }
     }
 }
Exemple #6
0
        public static void init()
        {
            People.maleNames   = Utils.readEntireFile("Content/PersonData/MaleNames.txt").Replace("\r", "").Split(Utils.newlineDelim);
            People.femaleNames = Utils.readEntireFile("Content/PersonData/FemaleNames.txt").Replace("\r", "").Split(Utils.newlineDelim);
            People.surnames    = Utils.readEntireFile("Content/PersonData/Surnames.txt").Replace("\r", "").Split(Utils.newlineDelim);
            People.all         = new List <Person>(200);
            int num = 0;

            FileInfo[]    files      = new DirectoryInfo("Content/People").GetFiles("*.xml");
            List <string> stringList = new List <string>();

            for (int index = 0; index < files.Length; ++index)
            {
                stringList.Add("Content/People/" + Path.GetFileName(files[index].Name));
            }
            if (Settings.EnableDLC && DLC1SessionUpgrader.HasDLC1Installed)
            {
                foreach (FileSystemInfo file in new DirectoryInfo("Content/DLC/People").GetFiles("*.xml"))
                {
                    stringList.Add("Content/DLC/People/" + Path.GetFileName(file.Name));
                }
                People.PeopleWereGeneratedWithDLCAdditions = true;
            }
            for (int index = 0; index < stringList.Count; ++index)
            {
                Person person = People.loadPersonFromFile(LocalizedFileLoader.GetLocalizedFilepath(stringList[index]));
                if (person != null)
                {
                    People.all.Add(person);
                    ++num;
                }
                else
                {
                    Console.WriteLine("Person Load Error: " + stringList[index]);
                }
            }
            for (int index = num; index < 200; ++index)
            {
                bool   male    = Utils.flipCoin();
                string fName   = male ? People.maleNames[Utils.random.Next(People.maleNames.Length)] : People.femaleNames[Utils.random.Next(People.femaleNames.Length)];
                string surname = People.surnames[Utils.random.Next(People.surnames.Length)];
                People.all.Add(new Person(fName, surname, male, false, UsernameGenerator.getName()));
            }
            People.hackers = new List <Person>();
            People.generatePeopleForList(People.hackers, 10, true);
            People.hubAgents = new List <Person>();
            People.generatePeopleForList(People.hubAgents, 22, true);
        }
Exemple #7
0
        public static void LoadIntoOS(string filepath, object OSobj)
        {
            OS os = (OS)OSobj;

            using (FileStream fileStream = File.OpenRead(LocalizedFileLoader.GetLocalizedFilepath(Utils.GetFileLoadPrefix() + filepath)))
            {
                RunnableConditionalActions conditionalActions = RunnableConditionalActions.Deserialize(XmlReader.Create((Stream)fileStream));
                for (int index = 0; index < conditionalActions.Actions.Count; ++index)
                {
                    os.ConditionalActions.Actions.Add(conditionalActions.Actions[index]);
                }
            }
            if (os.ConditionalActions.IsUpdating)
            {
                return;
            }
            os.ConditionalActions.Update(0.0f, (object)os);
        }
Exemple #8
0
        public static void UpgradeSession(object osobj, bool needsNodeInjection)
        {
            OS os = (OS)osobj;

            MemoryDumpInjector.InjectMemory(LocalizedFileLoader.GetLocalizedFilepath("Content/DLC/Missions/Injections/MemoryDumps/GibsonLink.xml"), (object)Programs.getComputer(os, "polarSnakeDest"));
            MemoryDumpInjector.InjectMemory(LocalizedFileLoader.GetLocalizedFilepath("Content/DLC/Missions/Injections/MemoryDumps/NaixHome.xml"), (object)Programs.getComputer(os, "naixGateway"));
            MemoryDumpInjector.InjectMemory(LocalizedFileLoader.GetLocalizedFilepath("Content/DLC/Missions/Injections/MemoryDumps/BitDropBox.xml"), (object)Programs.getComputer(os, "BitWorkServer"));
            MemoryDumpInjector.InjectMemory(LocalizedFileLoader.GetLocalizedFilepath("Content/DLC/Missions/Injections/MemoryDumps/ExpandKeysInjection.xml"), (object)Programs.getComputer(os, "portcrack01"));
            if (os.thisComputer.Memory == null)
            {
                os.thisComputer.Memory = new MemoryContents();
            }
            os.allFactions.factions.Add("Bibliotheque", (Faction)CustomFaction.ParseFromFile("Content/DLC/DLCFaction.xml"));
            if (needsNodeInjection)
            {
                if (People.all == null)
                {
                    People.init();
                }
                else if (!People.PeopleWereGeneratedWithDLCAdditions)
                {
                    People.LoadInDLCPeople();
                }
                List <string> dlcList = BootLoadList.getDLCList();
                for (int index = 0; index < dlcList.Count; ++index)
                {
                    Computer.loadFromFile(dlcList[index]);
                }
                ComputerLoader.postAllLoadedActions();
            }
            Computer computer = Programs.getComputer(os, "ispComp");

            if (!computer.ports.Contains(443))
            {
                computer.ports.Add(443);
            }
            if (computer.ports.Contains(6881))
            {
                return;
            }
            computer.ports.Add(6881);
        }
Exemple #9
0
        private int DrawMailMessageText(Rectangle textBounds, SpriteBatch sb, string[] text)
        {
            if (this.sectionedPanel == null || this.sectionedPanel.PanelHeight != this.GetRenderTextHeight())
            {
                this.sectionedPanel = new ScrollableSectionedPanel(this.GetRenderTextHeight(), sb.GraphicsDevice);
            }
            this.sectionedPanel.NumberOfPanels = text.Length;
            int itemsDrawn = 0;

            this.sectionedPanel.Draw((Action <int, Rectangle, SpriteBatch>)((index, dest, spBatch) =>
            {
                spBatch.DrawString(GuiData.tinyfont, LocalizedFileLoader.SafeFilterString(text[index]), new Vector2((float)dest.X, (float)dest.Y), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.8f);
                ++itemsDrawn;
            }), sb, textBounds);
            if (this.sectionedPanel.NumberOfPanels * this.sectionedPanel.PanelHeight < textBounds.Height)
            {
                return(this.sectionedPanel.NumberOfPanels * this.sectionedPanel.PanelHeight);
            }
            return(textBounds.Height);
        }
Exemple #10
0
        public void getRenderText()
        {
            string data = AdvancedTutorial.feedbackSequence[this.state];

            char[] chArray = new char[1] {
                '\n'
            };
            string[] strArray = data.Split(this.hintButtonDelimiter, StringSplitOptions.RemoveEmptyEntries);
            if (strArray.Length > 1)
            {
                this.hintButtonText = DisplayModule.cleanSplitForWidth(strArray[1], 178).Split(chArray);
                data = strArray[0];
                this.hintTextFadeTimer = 0.0f;
            }
            else
            {
                this.hintButtonText = (string[])null;
            }
            this.renderText = Utils.SuperSmartTwimForWidth(LocalizedFileLoader.SafeFilterString(data), this.bounds.Width - 10, GuiData.tinyfont).Split(chArray);
        }
Exemple #11
0
        public IntroTextModule(Rectangle location, OS operatingSystem)
            : base(location, operatingSystem)
        {
            this.bounds       = location;
            this.timer        = 0.0f;
            this.complete     = false;
            this.textIndex    = 0;
            this.finishedText = false;
            int      x        = 0;
            int      y        = 0;
            Viewport viewport = this.spriteBatch.GraphicsDevice.Viewport;
            int      width    = viewport.Width;

            viewport = this.spriteBatch.GraphicsDevice.Viewport;
            int height = viewport.Height;

            this.fullscreen = new Rectangle(x, y, width, height);
            string str = this.os.multiplayer ? "Content/MultiplayerIntroText.txt" : (this.os.IsDLCConventionDemo ? "Content/DLC/Docs/DemoIntroText.txt" : "Content/BitSpeech.txt");

            if (Settings.IsInExtensionMode)
            {
                str = Path.Combine(ExtensionLoader.ActiveExtensionInfo.FolderPath, "Intro.txt");
                if (!File.Exists(str))
                {
                    str = Path.Combine(ExtensionLoader.ActiveExtensionInfo.FolderPath, "intro.txt");
                }
            }
            if (File.Exists(str))
            {
                this.text = Utils.CleanFilterStringToRenderable(LocalizedFileLoader.Read(str).Replace("\t", "    ")).Split(IntroTextModule.delims, StringSplitOptions.RemoveEmptyEntries);
            }
            else
            {
                this.text = new string[1] {
                    "   "
                }
            };
        }
Exemple #12
0
        public static void runScript(string scriptName, object os, string sourceCompReplacer = null, string targetCompReplacer = null)
        {
            string[] separator = new string[4] {
                " $#%#$\r\n", " $#%#$\n", "$#%#$\r\n", "$#%#$\n"
            };
            string localizedFilepath = LocalizedFileLoader.GetLocalizedFilepath(Utils.GetFileLoadPrefix() + scriptName);

            if (!File.Exists(localizedFilepath))
            {
                localizedFilepath = LocalizedFileLoader.GetLocalizedFilepath("Content/" + scriptName);
            }
            string str = Utils.readEntireFile(localizedFilepath);

            if (sourceCompReplacer != null)
            {
                str = str.Replace("[SOURCE_COMP]", sourceCompReplacer);
            }
            if (targetCompReplacer != null)
            {
                str = str.Replace("[TARGET_COMP]", targetCompReplacer);
            }
            string[] script = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
            if (!OS.TestingPassOnly)
            {
                Thread thread = new Thread((ThreadStart)(() => HackerScriptExecuter.executeThreadedScript(script, (OS)os)))
                {
                    IsBackground = true, CurrentCulture = Game1.culture, CurrentUICulture = Game1.culture
                };
                thread.IsBackground = true;
                thread.Name         = "OpposingHackerThread";
                thread.Start();
            }
            else
            {
                HackerScriptExecuter.executeThreadedScript(script, (OS)os);
            }
        }
 public static void CopyHelpFile()
 {
     try
     {
         if (File.Exists(HostileHackerBreakinSequence.HelpFilePath))
         {
             return;
         }
         File.Copy(LocalizedFileLoader.GetLocalizedFilepath("Content/DLC/Misc/" + (Environment.OSVersion.Platform == PlatformID.Win32NT ? "Win_AllyHelpFile.txt" : "Unix_AllyHelpFile.txt")), HostileHackerBreakinSequence.HelpFilePath);
         if (Environment.OSVersion.Platform != PlatformID.Win32NT)
         {
             Process.Start("chmod", " -x " + HostileHackerBreakinSequence.HelpFilePath);
         }
     }
     catch (UnauthorizedAccessException ex)
     {
         Utils.AppendToErrorFile("HHBreakinSequence error : Insufficient permissions for folder access.\r\n" + Utils.GenerateReportFromException((Exception)ex));
         Console.WriteLine("HHSequence Error " + Utils.GenerateReportFromException((Exception)ex));
     }
     catch (Exception ex)
     {
         Console.WriteLine("HHSequence Error " + Utils.GenerateReportFromException(ex));
     }
 }
Exemple #14
0
 public override void LoadContent()
 {
     base.LoadContent();
     this.bounceEffect = new NodeBounceEffect()
     {
         NodeHitDelay       = 0.02f,
         TimeBetweenBounces = 0.2f
     };
     string[] strArray = LocalizedFileLoader.Read("Content/Post/AdvancedTutorialData.txt").Replace("\r\n", "\n").Split(new string[1] {
         "\n\n%&%&%&%\n"
     }, StringSplitOptions.None);
     if (AdvancedTutorial.feedbackSequence != null && AdvancedTutorial.loadedLocale != Settings.ActiveLocale)
     {
         AdvancedTutorial.feedbackSequence = (List <string>)null;
     }
     AdvancedTutorial.loadedLocale = Settings.ActiveLocale ?? "";
     if (AdvancedTutorial.commandSequence == null)
     {
         AdvancedTutorial.altCommandequence = new List <string[]>();
         for (int index = 0; index < 15; ++index)
         {
             AdvancedTutorial.altCommandequence.Add(new string[0]);
         }
         AdvancedTutorial.commandSequence = new List <string>();
         AdvancedTutorial.commandSequence.Add("&#*@(&#@(&#@&)@&#)(@&)@#");
         AdvancedTutorial.commandSequence.Add("connect " + this.os.thisComputer.ip);
         AdvancedTutorial.commandSequence.Add("scan");
         AdvancedTutorial.commandSequence.Add("dc");
         AdvancedTutorial.altCommandequence[3] = new string[1]
         {
             "disconnect"
         };
         AdvancedTutorial.commandSequence.Add("connect");
         AdvancedTutorial.commandSequence.Add("probe");
         AdvancedTutorial.altCommandequence[5] = new string[1]
         {
             "nmap"
         };
         AdvancedTutorial.commandSequence.Add("porthack");
         AdvancedTutorial.commandSequence.Add("scan");
         AdvancedTutorial.commandSequence.Add("ls");
         AdvancedTutorial.altCommandequence[8] = new string[1]
         {
             "dir"
         };
         AdvancedTutorial.commandSequence.Add("cd bin");
         AdvancedTutorial.altCommandequence[9] = new string[3]
         {
             "cd ../bin",
             "cd ../../bin",
             "cd /bin"
         };
         AdvancedTutorial.commandSequence.Add("cat config.txt");
         AdvancedTutorial.altCommandequence[10] = new string[1]
         {
             "less config.txt"
         };
         AdvancedTutorial.commandSequence.Add("cd ..");
         AdvancedTutorial.altCommandequence[11] = new string[2]
         {
             "cd..",
             "cd /"
         };
         AdvancedTutorial.commandSequence.Add("cd log");
         AdvancedTutorial.altCommandequence[12] = new string[3]
         {
             "cd ../log",
             "cd ../../log",
             "cd /log"
         };
         AdvancedTutorial.commandSequence.Add("rm *");
         AdvancedTutorial.commandSequence.Add("dc");
         AdvancedTutorial.altCommandequence[14] = new string[1]
         {
             "disconnect"
         };
     }
     if (AdvancedTutorial.feedbackSequence == null)
     {
         AdvancedTutorial.feedbackSequence = new List <string>();
         AdvancedTutorial.feedbackSequence.Add(strArray[0]);
         AdvancedTutorial.feedbackSequence.Add(strArray[1]);
         AdvancedTutorial.feedbackSequence.Add(strArray[2]);
         AdvancedTutorial.feedbackSequence.Add(strArray[3]);
         AdvancedTutorial.feedbackSequence.Add(strArray[4]);
         AdvancedTutorial.feedbackSequence.Add(strArray[5]);
         AdvancedTutorial.feedbackSequence.Add(strArray[6]);
         AdvancedTutorial.feedbackSequence.Add(strArray[7]);
         AdvancedTutorial.feedbackSequence.Add(strArray[8]);
         AdvancedTutorial.feedbackSequence.Add(strArray[9]);
         AdvancedTutorial.feedbackSequence.Add(strArray[10]);
         AdvancedTutorial.feedbackSequence.Add(strArray[11]);
         AdvancedTutorial.feedbackSequence.Add(strArray[12]);
         AdvancedTutorial.feedbackSequence.Add(strArray[13]);
         AdvancedTutorial.feedbackSequence.Add(strArray[14]);
         AdvancedTutorial.feedbackSequence.Add(strArray[15]);
     }
     this.stepCompletionSequence = new List <Action>();
     for (int index = 0; index < AdvancedTutorial.feedbackSequence.Count; ++index)
     {
         this.stepCompletionSequence.Add((Action)null);
     }
     this.stepCompletionSequence[1] = (Action)(() =>
     {
         this.os.netMap.visible = true;
         this.os.netMap.inputLocked = false;
     });
     this.stepCompletionSequence[2] = (Action)(() =>
     {
         this.os.display.visible = true;
         this.os.display.inputLocked = false;
     });
     this.stepCompletionSequence[3] = (Action)(() => this.os.netMap.inputLocked = true);
     this.stepCompletionSequence[4] = (Action)(() => this.os.netMap.inputLocked = false);
     this.stepCompletionSequence[5] = (Action)(() =>
     {
         this.os.display.inputLocked = true;
         this.os.ram.inputLocked = true;
         this.os.netMap.inputLocked = true;
         this.os.terminal.visible = true;
         this.os.terminal.inputLocked = false;
         this.os.terminal.clearCurrentLine();
     });
     this.stepCompletionSequence[8] = (Action)(() =>
     {
         this.os.display.inputLocked = false;
         this.os.ram.inputLocked = false;
     });
     this.state = 0;
     this.getRenderText();
 }
Exemple #15
0
        private void doProbeDisplay()
        {
            Rectangle rectangle = Rectangle.Empty;
            Computer  computer  = this.os.connectedComp == null ? this.os.thisComputer : this.os.connectedComp;

            if (computer.proxyActive)
            {
                rectangle = this.bounds;
                ++rectangle.X;
                ++rectangle.Y;
                rectangle.Width  -= 2;
                rectangle.Height -= 2;
                PatternDrawer.draw(rectangle, 0.8f, Color.Transparent, this.os.superLightWhite, this.os.ScreenManager.SpriteBatch);
            }
            if (Button.doButton(299999, this.bounds.X + (this.bounds.Width - 50), this.bounds.Y + this.y, 27, 27, "<-", new Color?()))
            {
                this.command = "connect";
            }
            this.spriteBatch.DrawString(GuiData.font, LocaleTerms.Loc("Open Ports"), new Vector2((float)this.x, (float)this.y), Color.White);
            this.y += 40;
            this.spriteBatch.DrawString(GuiData.smallfont, computer.name + " @" + computer.ip, new Vector2((float)this.x, (float)this.y), Color.White);
            this.y += 30;
            int    num   = Math.Max(computer.portsNeededForCrack + 1, 0);
            string str   = string.Concat((object)num);
            bool   flag1 = num > 100;

            if (flag1)
            {
                if (this.invioableSecurityCacheString == null)
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    for (int index = 0; index < str.Length; ++index)
                    {
                        stringBuilder.Append(Utils.getRandomChar());
                    }
                    this.invioableSecurityCacheString = stringBuilder.ToString();
                }
                else
                {
                    this.invioabilityCharChangeTimer -= (float)this.os.lastGameTime.ElapsedGameTime.TotalSeconds;
                    if ((double)this.invioabilityCharChangeTimer <= 0.0)
                    {
                        StringBuilder stringBuilder = new StringBuilder(this.invioableSecurityCacheString);
                        stringBuilder[Utils.random.Next(stringBuilder.Length)] = Utils.random.NextDouble() > 0.3 ? Utils.getRandomNumberChar() : Utils.getRandomChar();
                        this.invioableSecurityCacheString = stringBuilder.ToString();
                        this.invioabilityCharChangeTimer  = 0.025f;
                    }
                }
                str = this.invioableSecurityCacheString;
            }
            this.spriteBatch.DrawString(GuiData.smallfont, LocalizedFileLoader.SafeFilterString(LocaleTerms.Loc("Open Ports Required for Crack:")) + " " + str, new Vector2((float)this.x, (float)this.y), flag1 ? Color.Lerp(Color.Red, this.os.brightLockedColor, Utils.randm(0.5f) + 0.5f) : this.os.highlightColor);
            this.y += 40;
            if (flag1)
            {
                rectangle.X      = this.bounds.X + 2;
                rectangle.Y      = this.y;
                rectangle.Width  = this.bounds.Width - 4;
                rectangle.Height = 110;
                this.DrawInvioabilityEffect(rectangle);
                this.y += rectangle.Height + 10;
            }
            if (computer.hasProxy)
            {
                rectangle.X      = this.x;
                rectangle.Y      = this.y;
                rectangle.Width  = this.bounds.Width - 10;
                rectangle.Height = 40;
                PatternDrawer.draw(rectangle, 1f, computer.proxyActive ? this.os.topBarColor : Color.Lerp(this.os.unlockedColor, Color.Black, 0.2f), computer.proxyActive ? this.os.shellColor * 0.3f : this.os.unlockedColor, this.os.ScreenManager.SpriteBatch);
                if (computer.proxyActive)
                {
                    rectangle.Width = (int)((double)rectangle.Width * (1.0 - (double)computer.proxyOverloadTicks / (double)computer.startingOverloadTicks));
                    this.spriteBatch.Draw(Utils.white, rectangle, Color.Black * 0.5f);
                }
                this.spriteBatch.DrawString(GuiData.smallfont, computer.proxyActive ? LocaleTerms.Loc("Proxy Detected") : LocaleTerms.Loc("Proxy Bypassed"), new Vector2((float)(this.x + 4), (float)(this.y + 2)), Color.Black);
                this.spriteBatch.DrawString(GuiData.smallfont, computer.proxyActive ? LocaleTerms.Loc("Proxy Detected") : LocaleTerms.Loc("Proxy Bypassed"), new Vector2((float)(this.x + 3), (float)(this.y + 1)), computer.proxyActive ? Color.White : this.os.highlightColor);
                this.y += 60;
            }
            if (computer.firewall != null)
            {
                rectangle.X      = this.x;
                rectangle.Y      = this.y;
                rectangle.Width  = this.bounds.Width - 10;
                rectangle.Height = 40;
                bool flag2 = !computer.firewall.solved;
                PatternDrawer.draw(rectangle, 1f, flag2 ? this.os.topBarColor : Color.Lerp(this.os.unlockedColor, Color.Black, 0.2f), flag2 ? this.os.shellColor * 0.3f : this.os.unlockedColor, this.os.ScreenManager.SpriteBatch);
                this.spriteBatch.DrawString(GuiData.smallfont, flag2 ? LocaleTerms.Loc("Firewall Detected") : LocaleTerms.Loc("Firewall Solved"), new Vector2((float)(this.x + 4), (float)(this.y + 2)), Color.Black);
                this.spriteBatch.DrawString(GuiData.smallfont, flag2 ? LocaleTerms.Loc("Firewall Detected") : LocaleTerms.Loc("Firewall Solved"), new Vector2((float)(this.x + 3), (float)(this.y + 1)), flag2 ? Color.White : this.os.highlightColor);
                this.y += 60;
            }
            Vector2 zero = Vector2.Zero;

            rectangle.X      = this.x + 1;
            rectangle.Width  = 420;
            rectangle.Height = 41;
            Vector2 position = new Vector2((float)(rectangle.X + rectangle.Width - 36), (float)(rectangle.Y + 7));

            this.x += 10;
            for (int index = 0; index < computer.ports.Count; ++index)
            {
                rectangle.Y = this.y + 4;
                position.Y  = (float)(rectangle.Y + 4);
                this.spriteBatch.Draw(Utils.white, rectangle, (int)computer.portsOpen[index] > 0 ? this.os.unlockedColor : this.os.lockedColor);
                this.spriteBatch.Draw((int)computer.portsOpen[index] > 0 ? this.openLockSprite : this.lockSprite, position, Color.White);
                string  text1     = "Port#: " + (object)computer.GetDisplayPortNumberFromCodePort(computer.ports[index]);
                Vector2 vector2_1 = GuiData.font.MeasureString(text1);
                this.spriteBatch.DrawString(GuiData.font, text1, new Vector2((float)this.x, (float)(this.y + 3)), Color.White);
                string  text2     = " - " + PortExploits.services[computer.ports[index]];
                Vector2 vector2_2 = GuiData.smallfont.MeasureString(text2);
                float   scale     = Math.Min(1f, (float)((double)rectangle.Width - (double)vector2_1.X - 50.0) / vector2_2.X);
                this.spriteBatch.DrawString(GuiData.smallfont, text2, new Vector2((float)this.x + vector2_1.X, (float)(this.y + 4)), Color.White, 0.0f, Vector2.Zero, scale, SpriteEffects.None, 0.8f);
                this.y += 45;
            }
        }
 public static string Read(string filepath)
 {
     return(LocalizedFileLoader.FilterStringForLocalization(File.ReadAllText(LocalizedFileLoader.GetLocalizedFilepath(filepath))));
 }
 public static string GetHelpText()
 {
     return(File.ReadAllText(LocalizedFileLoader.GetLocalizedFilepath("Content/DLC/Misc/" + (Environment.OSVersion.Platform == PlatformID.Win32NT ? "Win_AllyHelpFile.txt" : "Unix_AllyHelpFile.txt"))));
 }