Exemple #1
0
        public override bool Check(object os_obj)
        {
            if (!this.hasHadFrameWhereThisWasFalse)
            {
                this.hasHadFrameWhereThisWasFalse = true;
                return(false);
            }
            bool flag = ((OS)os_obj).connectedComp == null || ((OS)os_obj).connectedComp == ((OS)os_obj).thisComputer;

            if (string.IsNullOrWhiteSpace(this.target) || this.target.ToLower() == "none")
            {
                return(flag);
            }
            OS       os       = (OS)os_obj;
            Computer computer = Programs.getComputer(os, this.target);

            if (computer == null)
            {
                return(flag);
            }
            return(os.connectedIPLastFrame == computer.ip && (flag || os.connectedComp != null && os.connectedComp.ip != computer.ip));
        }
Exemple #2
0
 public override void Completed()
 {
     base.Completed();
     IsComplete = true;
     if (targetComp.attatchedDeviceIDs != null)
     {
         var strArray = targetComp.attatchedDeviceIDs.Split(Utils.commaDelim,
                                                            StringSplitOptions.RemoveEmptyEntries);
         var num = 0.0f;
         for (var index = 0; index < strArray.Length; ++index)
         {
             var device = Programs.getComputer(os, strArray[index]);
             if (device != null)
             {
                 Action action = () =>
                 {
                     os.netMap.discoverNode(device);
                     var loc = os.netMap.GetNodeDrawPos(device.location) +
                               new Vector2(os.netMap.bounds.X, os.netMap.bounds.Y) +
                               new Vector2(NetworkMap.NODE_SIZE / 2);
                     SFX.addCircle(loc, os.highlightColor, 120f);
                     os.delayer.Post(ActionDelayer.Wait(0.2), () => SFX.addCircle(loc, os.highlightColor, 80f));
                     os.delayer.Post(ActionDelayer.Wait(0.4), () => SFX.addCircle(loc, os.highlightColor, 65f));
                     os.write("eOS Device \"" + device.name + "\" opened for connection at " + device.ip);
                     ResultTitles.Add(device.name);
                     ResultBodies.Add(device.ip + " " + device.location + "\n" + Guid.NewGuid());
                 };
                 os.delayer.Post(ActionDelayer.Wait(num), action);
                 ++num;
                 ++devicesFound;
             }
         }
     }
     if (devicesFound != 0)
     {
         return;
     }
     isError = true;
 }
Exemple #3
0
        public override void Update(float t)
        {
            base.Update(t);
            if (this.targetRamUse != this.ramCost)
            {
                if (this.targetRamUse < this.ramCost)
                {
                    this.ramCost -= (int)((double)t * 350.0);
                    if (this.ramCost < this.targetRamUse)
                    {
                        this.ramCost = this.targetRamUse;
                    }
                }
                else
                {
                    int num = (int)((double)t * 350.0);
                    if (this.os.ramAvaliable >= num)
                    {
                        this.ramCost += num;
                        if (this.ramCost > this.targetRamUse)
                        {
                            this.ramCost = this.targetRamUse;
                        }
                    }
                }
            }
            if (!this.gettingNewNote)
            {
                return;
            }
            string data = (string)null;

            if (Programs.parseStringFromGetStringCommand(this.os, out data))
            {
                this.gettingNewNote = false;
                this.AddNote(data);
            }
        }
Exemple #4
0
        public void parseMessage(string msg)
        {
            addDisplayMessage(msg);
            var chArray = new char[2]
            {
                ' ',
                '\n'
            };
            var strArray = msg.Split(chArray);

            if (!strArray[0].Equals("cCDDrive"))
            {
                return;
            }
            if (strArray[2].Equals("open"))
            {
                Programs.cdDrive(true);
            }
            else
            {
                Programs.cdDrive(false);
            }
        }
 public override void initFiles()
 {
     this.folder = this.comp.files.root.searchForFolder("Whitelist");
     if (this.folder == null)
     {
         this.folder = new Folder("Whitelist");
         this.comp.files.root.folders.Add(this.folder);
     }
     if (!this.folder.containsFile("authenticator.dll"))
     {
         this.folder.files.Add(new FileEntry(Computer.generateBinaryString(500), "authenticator.dll"));
     }
     if (this.RemoteSourceIP == null)
     {
         if (this.folder.containsFile("list.txt"))
         {
             return;
         }
         this.folder.files.Add(new FileEntry(this.comp.adminIP, "list.txt"));
     }
     else
     {
         ComputerLoader.postAllLoadedActions += (Action)(() =>
         {
             Computer computer = Programs.getComputer(this.os, this.RemoteSourceIP);
             if (computer != null)
             {
                 this.RemoteSourceIP = computer.ip;
             }
             if (this.folder.containsFile("source.txt"))
             {
                 return;
             }
             this.folder.files.Add(new FileEntry(this.RemoteSourceIP, "source.txt"));
         });
     }
 }
        public override void Trigger(object os_obj)
        {
            OS       os       = (OS)os_obj;
            Computer computer = Programs.getComputer(os, this.TargetComp);

            if (computer == null)
            {
                throw new NullReferenceException("Computer " + this.TargetComp + " could not be found for SAAddMissionToHubServer Function, adding mission: " + this.MissionFilepath);
            }
            MissionHubServer daemon1 = computer.getDaemon(typeof(MissionHubServer)) as MissionHubServer;

            if (daemon1 != null)
            {
                daemon1.AddMissionToListings(Utils.GetFileLoadPrefix() + this.MissionFilepath, -1);
            }
            else
            {
                DLCHubServer daemon2 = computer.getDaemon(typeof(DLCHubServer)) as DLCHubServer;
                if (daemon2 != null)
                {
                    daemon2.AddMission(Utils.GetFileLoadPrefix() + this.MissionFilepath, this.AssignmentTag, this.StartsComplete);
                }
                else
                {
                    MissionListingServer daemon3 = computer.getDaemon(typeof(MissionListingServer)) as MissionListingServer;
                    if (daemon3 == null)
                    {
                        throw new NullReferenceException("Computer " + this.TargetComp + " does not contain a MissionHubServer, MissionListingServer or DLCHubServer daemon for addMission function adding mission: " + this.MissionFilepath);
                    }
                    List <ActiveMission> branchMissions = os.branchMissions;
                    ActiveMission        m = (ActiveMission)ComputerLoader.readMission(Utils.GetFileLoadPrefix() + this.MissionFilepath);
                    os.branchMissions = branchMissions;
                    daemon3.addMisison(m, this.AssignmentTag.ToLower() == "top");
                }
            }
        }
Exemple #7
0
        public override void Trigger(object os_obj)
        {
            OS os = (OS)os_obj;

            if ((double)this.Delay <= 0.0)
            {
                string flagStartingWith1 = os.Flags.GetFlagStartingWith("_changeAlertIconType:");
                string flagStartingWith2 = os.Flags.GetFlagStartingWith("_changeAlertIconTarget:");
                if (flagStartingWith1 != null)
                {
                    os.Flags.RemoveFlag(flagStartingWith1);
                }
                if (flagStartingWith2 != null)
                {
                    os.Flags.RemoveFlag(flagStartingWith2);
                }
                os.Flags.AddFlag("_changeAlertIconType:" + this.Type);
                os.Flags.AddFlag("_changeAlertIconTarget:" + this.Target);
                if (!os.Flags.HasFlag("_alertIconChanged"))
                {
                    os.Flags.AddFlag("_alertIconChanged");
                }
                SAChangeAlertIcon.UpdateAlertIcon((object)os);
            }
            else
            {
                Computer computer = Programs.getComputer(os, this.DelayHost);
                if (computer == null)
                {
                    throw new NullReferenceException("Computer " + (object)computer + " could not be found as DelayHost for Function");
                }
                float delay = this.Delay;
                this.Delay = -1f;
                DelayableActionSystem.FindDelayableActionSystemOnComputer(computer).AddAction((SerializableAction)this, delay);
            }
        }
 public override void Completed()
 {
     base.Completed();
     this.IsComplete = true;
     if (this.targetComp.attatchedDeviceIDs != null)
     {
         string[] strArray = this.targetComp.attatchedDeviceIDs.Split(Utils.commaDelim, StringSplitOptions.RemoveEmptyEntries);
         float    num      = 0.0f;
         for (int index = 0; index < strArray.Length; ++index)
         {
             Computer device = Programs.getComputer(this.os, strArray[index]);
             if (device != null)
             {
                 Action action = (Action)(() =>
                 {
                     this.os.netMap.discoverNode(device);
                     Vector2 loc = this.os.netMap.GetNodeDrawPos(device) + new Vector2((float)this.os.netMap.bounds.X, (float)this.os.netMap.bounds.Y) + new Vector2((float)(NetworkMap.NODE_SIZE / 2));
                     SFX.addCircle(loc, this.os.highlightColor, 120f);
                     this.os.delayer.Post(ActionDelayer.Wait(0.2), (Action)(() => SFX.addCircle(loc, this.os.highlightColor, 80f)));
                     this.os.delayer.Post(ActionDelayer.Wait(0.4), (Action)(() => SFX.addCircle(loc, this.os.highlightColor, 65f)));
                     this.os.write(string.Format(LocaleTerms.Loc("eOS Device \"{0}\" opened for connection at {1}"), (object)device.name, (object)device.ip));
                     this.ResultTitles.Add(device.name);
                     this.ResultBodies.Add(device.ip + " " + device.location.ToString() + "\n" + Guid.NewGuid().ToString());
                 });
                 this.os.delayer.Post(ActionDelayer.Wait((double)num), action);
                 ++num;
                 ++this.devicesFound;
             }
         }
     }
     if (this.devicesFound != 0)
     {
         return;
     }
     this.isError = true;
 }
Exemple #9
0
        public override void Trigger(object os_obj)
        {
            OS       os        = (OS)os_obj;
            Computer computer1 = Programs.getComputer(os, this.DestComp);
            Computer computer2 = Programs.getComputer(os, this.SourceComp);

            if (computer1 == null)
            {
                throw new NullReferenceException("Destination Computer " + (object)computer1 + " could not be found for SACopyAsset, copying file: " + this.SourceFileName);
            }
            if (computer2 == null)
            {
                throw new NullReferenceException("Source Computer " + (object)computer2 + " could not be found for SACopyAsset, copying file: " + this.SourceFileName);
            }
            Folder folderAtPath = Programs.getFolderAtPath(this.SourceFilePath, os, computer2.files.root, true);

            if (folderAtPath == null)
            {
                throw new NullReferenceException("Source Folder " + this.SourceFilePath + " could not be found for SACopyAsset, adding file: " + this.SourceFileName);
            }
            Folder folderFromPath = computer1.getFolderFromPath(this.DestFilePath, true);

            if (folderFromPath == null)
            {
                return;
            }
            FileEntry fileEntry1 = folderAtPath.searchForFile(this.SourceFileName);

            if (fileEntry1 == null)
            {
                return;
            }
            FileEntry fileEntry2 = new FileEntry(fileEntry1.data, this.DestFileName);

            folderFromPath.files.Add(fileEntry2);
        }
Exemple #10
0
        private void DrawListing(Rectangle dest, SpriteBatch sb)
        {
            this.DrawHeaders(dest, sb);
            if (this.isExiting)
            {
                return;
            }
            Vector2 pos = new Vector2((float)(dest.X + 2), (float)dest.Y + 60f);

            TextItem.doFontLabel(pos, LocaleTerms.Loc("Remote"), GuiData.smallfont, new Color?(this.themeColor), (float)(this.bounds.Width - 20), 20f, false);
            pos.Y += 18f;
            sb.Draw(Utils.white, new Rectangle(this.bounds.X + 2, (int)pos.Y, this.bounds.Width - 6, 1), Utils.AddativeWhite);
            List <string> stringList1   = new List <string>();
            Folder        currentFolder = Programs.getCurrentFolder(this.os);

            for (int index = 0; index < currentFolder.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(currentFolder.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    stringList1.Add(currentFolder.files[index].name);
                }
            }
            string    str = (string)null;
            string    selectedFileData = (string)null;
            Color     color            = Color.Lerp(this.os.topBarColor, Utils.AddativeWhite, 0.2f);
            int       scrollOffset     = SelectableTextList.scrollOffset;
            Rectangle rectangle1       = new Rectangle((int)pos.X, (int)pos.Y, this.bounds.Width - 6, 54);

            if (stringList1.Count > 0)
            {
                SelectableTextList.scrollOffset = this.remoteScroll;
                this.remotesSelected            = SelectableTextList.doFancyList(8139191 + this.PID, rectangle1.X, rectangle1.Y, rectangle1.Width, rectangle1.Height, stringList1.ToArray(), this.remotesSelected, new Color?(color), true);
                if (SelectableTextList.selectionWasChanged)
                {
                    this.localsSelected = -1;
                }
                this.remoteScroll = SelectableTextList.scrollOffset;
                if (this.remotesSelected >= 0)
                {
                    if (this.remotesSelected >= stringList1.Count)
                    {
                        this.remotesSelected = -1;
                    }
                    else
                    {
                        str = stringList1[this.remotesSelected];
                        selectedFileData = currentFolder.searchForFile(str).data;
                    }
                }
            }
            else
            {
                sb.Draw(Utils.white, rectangle1, Utils.VeryDarkGray);
                TextItem.doFontLabelToSize(rectangle1, "    -- " + LocaleTerms.Loc("No Valid Files") + " --    ", GuiData.smallfont, Utils.AddativeWhite, false, false);
            }
            pos.Y += (float)(rectangle1.Height + 6);
            TextItem.doFontLabel(pos, LocaleTerms.Loc("Local Theme Files"), GuiData.smallfont, new Color?(this.themeColor), (float)(this.bounds.Width - 20), 20f, false);
            pos.Y += 18f;
            sb.Draw(Utils.white, new Rectangle(this.bounds.X + 2, (int)pos.Y, this.bounds.Width - 6, 1), Utils.AddativeWhite);
            stringList1.Clear();
            List <string> stringList2 = new List <string>();
            Folder        folder1     = this.os.thisComputer.files.root.searchForFolder("sys");

            for (int index = 0; index < folder1.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(folder1.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    stringList1.Add(folder1.files[index].name);
                    stringList2.Add(folder1.files[index].data);
                }
            }
            Folder folder2 = this.os.thisComputer.files.root.searchForFolder("home");

            for (int index = 0; index < folder2.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(folder2.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    stringList1.Add(folder2.files[index].name);
                    stringList2.Add(folder2.files[index].data);
                }
            }
            Rectangle rectangle2 = new Rectangle((int)pos.X, (int)pos.Y, this.bounds.Width - 6, 72);

            if (stringList1.Count > 0)
            {
                SelectableTextList.scrollOffset = this.localScroll;
                this.localsSelected             = SelectableTextList.doFancyList(839192 + this.PID, rectangle2.X, rectangle2.Y, rectangle2.Width, rectangle2.Height, stringList1.ToArray(), this.localsSelected, new Color?(color), true);
                if (SelectableTextList.selectionWasChanged)
                {
                    this.remotesSelected = -1;
                }
                this.localScroll = SelectableTextList.scrollOffset;
                if (this.localsSelected >= 0)
                {
                    str = stringList1[this.localsSelected];
                    selectedFileData = stringList2[this.localsSelected];
                }
            }
            else
            {
                sb.Draw(Utils.white, rectangle2, Utils.VeryDarkGray);
                TextItem.doFontLabelToSize(rectangle2, "    -- " + LocaleTerms.Loc("No Valid Files") + " --    ", GuiData.smallfont, Utils.AddativeWhite, false, false);
            }
            SelectableTextList.scrollOffset = scrollOffset;
            pos.Y += (float)(rectangle2.Height + 2);
            Rectangle bounds = new Rectangle(this.bounds.X + 4, (int)pos.Y + 2, this.bounds.Width - 8, (int)((double)dest.Height - ((double)pos.Y - (double)dest.Y)) - 4);

            this.DrawApplyField(str, selectedFileData, bounds, sb);
        }
Exemple #11
0
        private void DrawListing(Rectangle dest, SpriteBatch sb)
        {
            DrawHeaders(dest, sb);
            if (isExiting)
            {
                return;
            }
            var pos = new Vector2(dest.X + 2, dest.Y + 60f);

            TextItem.doFontLabel(pos, "Remote", GuiData.smallfont, themeColor, this.bounds.Width - 20, 20f);
            pos.Y += 18f;
            sb.Draw(Utils.white, new Rectangle(this.bounds.X + 2, (int)pos.Y, this.bounds.Width - 6, 1),
                    Utils.AddativeWhite);
            var list1         = new List <string>();
            var currentFolder = Programs.getCurrentFolder(os);

            for (var index = 0; index < currentFolder.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(currentFolder.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    list1.Add(currentFolder.files[index].name);
                }
            }
            string str = null;
            string selectedFileData = null;
            var    color            = Color.Lerp(os.topBarColor, Utils.AddativeWhite, 0.2f);
            var    num        = SelectableTextList.scrollOffset;
            var    rectangle1 = new Rectangle((int)pos.X, (int)pos.Y, this.bounds.Width - 6, 54);

            if (list1.Count > 0)
            {
                SelectableTextList.scrollOffset = remoteScroll;
                remotesSelected = SelectableTextList.doFancyList(8139191 + PID, rectangle1.X, rectangle1.Y,
                                                                 rectangle1.Width, rectangle1.Height, list1.ToArray(), remotesSelected, color, true);
                if (SelectableTextList.selectionWasChanged)
                {
                    localsSelected = -1;
                }
                remoteScroll = SelectableTextList.scrollOffset;
                if (remotesSelected >= 0)
                {
                    if (remotesSelected >= list1.Count)
                    {
                        remotesSelected = -1;
                    }
                    else
                    {
                        str = list1[remotesSelected];
                        selectedFileData = currentFolder.searchForFile(str).data;
                    }
                }
            }
            else
            {
                sb.Draw(Utils.white, rectangle1, Utils.VeryDarkGray);
                TextItem.doFontLabelToSize(rectangle1, "    -- No Valid Files --    ", GuiData.smallfont,
                                           Utils.AddativeWhite);
            }
            pos.Y += rectangle1.Height + 6;
            TextItem.doFontLabel(pos, "Local Theme Files", GuiData.smallfont, themeColor, this.bounds.Width - 20, 20f);
            pos.Y += 18f;
            sb.Draw(Utils.white, new Rectangle(this.bounds.X + 2, (int)pos.Y, this.bounds.Width - 6, 1),
                    Utils.AddativeWhite);
            list1.Clear();
            var list2   = new List <string>();
            var folder1 = os.thisComputer.files.root.searchForFolder("sys");

            for (var index = 0; index < folder1.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(folder1.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    list1.Add(folder1.files[index].name);
                    list2.Add(folder1.files[index].data);
                }
            }
            var folder2 = os.thisComputer.files.root.searchForFolder("home");

            for (var index = 0; index < folder2.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(folder2.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    list1.Add(folder2.files[index].name);
                    list2.Add(folder2.files[index].data);
                }
            }
            var rectangle2 = new Rectangle((int)pos.X, (int)pos.Y, this.bounds.Width - 6, 72);

            if (list1.Count > 0)
            {
                SelectableTextList.scrollOffset = localScroll;
                localsSelected = SelectableTextList.doFancyList(839192 + PID, rectangle2.X, rectangle2.Y,
                                                                rectangle2.Width, rectangle2.Height, list1.ToArray(), localsSelected, color, true);
                if (SelectableTextList.selectionWasChanged)
                {
                    remotesSelected = -1;
                }
                localScroll = SelectableTextList.scrollOffset;
                if (localsSelected >= 0)
                {
                    str = list1[localsSelected];
                    selectedFileData = list2[localsSelected];
                }
            }
            else
            {
                sb.Draw(Utils.white, rectangle2, Utils.VeryDarkGray);
                TextItem.doFontLabelToSize(rectangle2, "    -- No Valid Files --    ", GuiData.smallfont,
                                           Utils.AddativeWhite);
            }
            SelectableTextList.scrollOffset = num;
            pos.Y += rectangle2.Height + 2;
            var bounds = new Rectangle(this.bounds.X + 4, (int)pos.Y + 2, this.bounds.Width - 8,
                                       (int)(dest.Height - (pos.Y - (double)dest.Y)) - 4);

            DrawApplyField(str, selectedFileData, bounds, sb);
        }
 public override void Trigger(object os_obj)
 {
     if ((double)this.Delay <= 0.0)
     {
         Computer computer1 = Programs.getComputer((OS)os_obj, this.SourceComp);
         Computer computer2 = Programs.getComputer((OS)os_obj, this.TargetComp);
         if (this.RequireLogsOnSource)
         {
             if (computer1 == null)
             {
                 throw new NullReferenceException("Launch Hacker Script Error: Source comp " + this.SourceComp + " does not exist");
             }
             if (computer2 == null)
             {
                 throw new NullReferenceException("Launch Hacker Script Error: Target comp " + this.TargetComp + " does not exist");
             }
             Folder folder1 = computer1.files.root.searchForFolder("log");
             bool   flag1   = false;
             for (int index = 0; index < folder1.files.Count; ++index)
             {
                 if (TrackerCompleteSequence.CompShouldStartTrackerFromLogs(os_obj, computer1, computer2.ip))
                 {
                     flag1 = true;
                     break;
                 }
             }
             if (!flag1)
             {
                 return;
             }
             if (this.RequireSourceIntact)
             {
                 Folder folder2 = computer1.files.root.searchForFolder("sys");
                 bool   flag2   = false;
                 for (int index = 0; index < folder2.files.Count; ++index)
                 {
                     if (folder2.files[index].name == "netcfgx.dll" && folder2.files[index].data.Contains("1") && folder2.files[index].data.Contains("0"))
                     {
                         flag2 = true;
                         break;
                     }
                 }
                 if (!flag2)
                 {
                     return;
                 }
             }
         }
         HackerScriptExecuter.runScript(this.Filepath, os_obj, this.SourceComp, this.TargetComp);
     }
     else
     {
         Computer computer = Programs.getComputer((OS)os_obj, this.DelayHost);
         if (computer == null)
         {
             throw new NullReferenceException("Computer " + (object)computer + " could not be found as DelayHost for Function");
         }
         float delay = this.Delay;
         this.Delay = -1f;
         DelayableActionSystem.FindDelayableActionSystemOnComputer(computer).AddAction((SerializableAction)this, delay);
     }
 }
Exemple #13
0
        public static void runCommand(int value, string name)
        {
            MissionFunctions.assertOS();
            if (name.ToLower().Trim() == "none")
            {
                return;
            }
            if (name.Equals("addRank"))
            {
                if (!OS.TestingPassOnly || MissionFunctions.os.currentFaction != null)
                {
                    MissionFunctions.os.currentFaction.addValue(value, (object)MissionFunctions.os);
                    string email = MailServer.generateEmail(LocaleTerms.Loc("Contract Successful"), string.Format(Utils.readEntireFile("Content/LocPost/MissionCompleteEmail.txt"), (object)MissionFunctions.os.currentFaction.getRank(), (object)MissionFunctions.os.currentFaction.getMaxRank(), (object)MissionFunctions.os.currentFaction.name), MissionFunctions.os.currentFaction.name + " ReplyBot");
                    ((MailServer)MissionFunctions.os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(email, MissionFunctions.os.defaultUser.name);
                }
                else if (OS.DEBUG_COMMANDS && MissionFunctions.os.currentFaction == null)
                {
                    MissionFunctions.os.write("----------");
                    MissionFunctions.os.write("----------");
                    MissionFunctions.os.write("ERROR IN FUNCTION 'addRank'");
                    MissionFunctions.os.write("Player is not assigned to a faction, so rank cannot be added!");
                    MissionFunctions.os.write("Make sure you have assigned a player a faction with the 'SetFaction' function before using this!");
                    MissionFunctions.os.write("----------");
                    MissionFunctions.os.write("----------");
                }
            }
            else if (name.Equals("addRankSilent"))
            {
                if (OS.TestingPassOnly && MissionFunctions.os.currentFaction == null)
                {
                    return;
                }
                MissionFunctions.os.currentFaction.addValue(value, (object)MissionFunctions.os);
            }
            else if (name.StartsWith("addFlags:"))
            {
                foreach (string flag in name.Substring("addFlags:".Length).Split(Utils.commaDelim, StringSplitOptions.RemoveEmptyEntries))
                {
                    MissionFunctions.os.Flags.AddFlag(flag);
                }
                CustomFaction currentFaction = MissionFunctions.os.currentFaction as CustomFaction;
                if (currentFaction == null)
                {
                    return;
                }
                currentFaction.CheckForAllCustomActionsToRun((object)MissionFunctions.os);
            }
            else if (name.StartsWith("removeFlags:"))
            {
                string[] strArray = name.Substring("removeFlags:".Length).Split(Utils.commaDelim, StringSplitOptions.RemoveEmptyEntries);
                for (int index = 0; index < strArray.Length; ++index)
                {
                    if (MissionFunctions.os.Flags.HasFlag(strArray[index]))
                    {
                        MissionFunctions.os.Flags.RemoveFlag(strArray[index]);
                    }
                }
                CustomFaction currentFaction = MissionFunctions.os.currentFaction as CustomFaction;
                if (currentFaction == null)
                {
                    return;
                }
                currentFaction.CheckForAllCustomActionsToRun((object)MissionFunctions.os);
            }
            else if (name.StartsWith("setFaction:"))
            {
                string newFaction = name.Substring("setFaction:".Length);
                bool   flag       = false;
                foreach (KeyValuePair <string, Faction> faction in MissionFunctions.os.allFactions.factions)
                {
                    if (faction.Value.idName.ToLower() == newFaction.ToLower())
                    {
                        MissionFunctions.os.allFactions.setCurrentFaction(newFaction, MissionFunctions.os);
                        flag = true;
                        break;
                    }
                }
                if (!flag && OS.TestingPassOnly)
                {
                    throw new NullReferenceException("Faction " + newFaction + "not found for setFaction action!");
                }
            }
            else if (name.StartsWith("loadConditionalActions:"))
            {
                RunnableConditionalActions.LoadIntoOS(name.Substring("loadConditionalActions:".Length), (object)MissionFunctions.os);
            }
            else if (name.Equals("triggerThemeHackRevenge"))
            {
                MissionFunctions.os.delayer.Post(ActionDelayer.Wait(5.0), (Action)(() =>
                {
                    string email = MailServer.generateEmail(LocaleTerms.Loc("Are you Kidding me?"), Utils.readEntireFile("Content/LocPost/NaixEmail.txt"), "*****@*****.**");
                    ((MailServer)MissionFunctions.os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(email, MissionFunctions.os.defaultUser.name);
                    MissionFunctions.os.delayer.Post(ActionDelayer.Wait(24.0), (Action)(() =>
                    {
                        try
                        {
                            HackerScriptExecuter.runScript("HackerScripts/ThemeHack.txt", (object)MissionFunctions.os, (string)null, (string)null);
                        }
                        catch (Exception ex)
                        {
                            if (!Settings.recoverFromErrorsSilently)
                            {
                                throw ex;
                            }
                            MissionFunctions.os.write("CAUTION: UNSYNDICATED OUTSIDE CONNECTION ATTEMPT");
                            MissionFunctions.os.write("RECOVERED FROM CONNECTION SUBTERFUGE SUCCESSFULLY");
                            Console.WriteLine("Critical error loading hacker script - aborting");
                        }
                    }));
                }));
            }
            else if (name.Equals("changeSong"))
            {
                switch (value)
                {
                case 2:
                    MusicManager.transitionToSong("Music\\The_Quickening");
                    break;

                case 3:
                    MusicManager.transitionToSong("Music\\TheAlgorithm");
                    break;

                case 4:
                    MusicManager.transitionToSong("Music\\Ryan3");
                    break;

                case 5:
                    MusicManager.transitionToSong("Music\\Bit(Ending)");
                    break;

                case 6:
                    MusicManager.transitionToSong("Music\\Rico_Puestel-Roja_Drifts_By");
                    break;

                case 7:
                    MusicManager.transitionToSong("Music\\out_run_the_wolves");
                    break;

                case 8:
                    MusicManager.transitionToSong("Music\\Irritations");
                    break;

                case 9:
                    MusicManager.transitionToSong("Music\\Broken_Boy");
                    break;

                case 10:
                    MusicManager.transitionToSong("Music\\Ryan10");
                    break;

                case 11:
                    MusicManager.transitionToSong("Music\\tetrameth");
                    break;

                default:
                    MusicManager.transitionToSong("Music\\Revolve");
                    break;
                }
            }
            else if (name.Equals("entropyEndMissionSetup"))
            {
                MissionFunctions.runCommand(3, "changeSong");
                Computer  comp1      = MissionFunctions.findComp("corp0#IS");
                Computer  comp2      = MissionFunctions.findComp("corp0#MF");
                Computer  comp3      = MissionFunctions.findComp("corp0#BU");
                FileEntry fileEntry1 = new FileEntry(Computer.generateBinaryString(5000), "HacknetOS.rar");
                FileEntry fileEntry2 = new FileEntry(Computer.generateBinaryString(4000), "HacknetOS_Data.xnb");
                FileEntry fileEntry3 = new FileEntry(Computer.generateBinaryString(4000), "HacknetOS_Content.xnb");
                Folder    folder1    = comp1.files.root.folders[2];
                folder1.files.Add(fileEntry1);
                folder1.files.Add(fileEntry2);
                folder1.files.Add(fileEntry3);
                Folder folder2 = comp2.files.root.folders[2];
                folder2.files.Add(fileEntry1);
                folder2.files.Add(fileEntry2);
                folder2.files.Add(fileEntry3);
                FileEntry fileEntry4 = new FileEntry(fileEntry1.data, fileEntry1.name + "_backup");
                FileEntry fileEntry5 = new FileEntry(fileEntry2.data, fileEntry2.name + "_backup");
                FileEntry fileEntry6 = new FileEntry(fileEntry3.data, fileEntry3.name + "_backup");
                Folder    folder3    = comp3.files.root.folders[2];
                folder3.files.Add(fileEntry4);
                folder3.files.Add(fileEntry5);
                folder3.files.Add(fileEntry6);
                comp1.traceTime           = Computer.BASE_TRACE_TIME * 7.5f;
                comp3.traceTime           = Computer.BASE_TRACE_TIME * 7.5f;
                comp2.traceTime           = Computer.BASE_TRACE_TIME * 7.5f;
                comp2.portsNeededForCrack = 3;
                comp1.portsNeededForCrack = 2;
                comp3.portsNeededForCrack = 2;
                Folder folder4 = MissionFunctions.findComp("entropy01").files.root.folders[2];
                folder4.files.Add(new FileEntry(PortExploits.crackExeData[25], "SMTPoverflow.exe"));
                folder4.files.Add(new FileEntry(PortExploits.crackExeData[80], "WebServerWorm.exe"));
            }
            else if (name.Equals("entropyAddSMTPCrack"))
            {
                Folder folder = MissionFunctions.findComp("entropy01").files.root.folders[2];
                bool   flag   = false;
                for (int index = 0; index < folder.files.Count; ++index)
                {
                    if (folder.files[index].data == PortExploits.crackExeData[25] || folder.files[index].name == "SMTPoverflow.exe")
                    {
                        flag = true;
                    }
                }
                if (!flag)
                {
                    folder.files.Add(new FileEntry(PortExploits.crackExeData[25], Utils.GetNonRepeatingFilename("SMTPoverflow", ".exe", folder)));
                }
                MissionFunctions.os.Flags.AddFlag("ThemeHackTransitionAssetsAdded");
            }
            else if (name.Equals("transitionToBitMissions"))
            {
                if (Settings.isDemoMode)
                {
                    MissionFunctions.runCommand(6, "changeSong");
                    if (Settings.isPressBuildDemo)
                    {
                        ComputerLoader.loadMission("Content/Missions/Demo/PressBuild/DemoMission01.xml", false);
                    }
                    else
                    {
                        ComputerLoader.loadMission("Content/Missions/Demo/AvconDemo.xml", false);
                    }
                }
                else
                {
                    ComputerLoader.loadMission("Content/Missions/BitMission0.xml", false);
                }
            }
            else if (name.Equals("entropySendCSECInvite"))
            {
                MissionFunctions.os.delayer.Post(ActionDelayer.Wait(6.0), (Action)(() => ComputerLoader.loadMission("Content/Missions/MainHub/Intro/Intro01.xml", false)));
            }
            else if (name.Equals("hubBitSetComplete01"))
            {
                MissionFunctions.os.delayer.Post(ActionDelayer.Wait(4.0), (Action)(() => MissionFunctions.runCommand(1, "addRank")));
                MissionFunctions.runCommand(3, "changeSong");
                MissionFunctions.os.Flags.AddFlag("csecBitSet01Complete");
            }
            else if (name.Equals("enTechEnableOfflineBackup"))
            {
                Programs.getComputer(MissionFunctions.os, "EnTechOfflineBackup");
                MissionFunctions.os.Flags.AddFlag("VaporSequencerEnabled");
                Folder folder1 = MissionFunctions.findComp("mainHubAssets").files.root.searchForFolder("bin");
                Folder folder2 = folder1.searchForFolder("Sequencer");
                if (folder2 == null)
                {
                    folder2 = new Folder("Sequencer");
                    folder1.folders.Add(folder2);
                }
                if (folder2.searchForFile("Sequencer.exe") != null)
                {
                    return;
                }
                folder2.files.Add(new FileEntry(PortExploits.crackExeData[17], "Sequencer.exe"));
            }
            else if (name.Equals("rudeNaixResponse"))
            {
                AchievementsManager.Unlock("rude_response", false);
            }
            else if (name.Equals("assignPlayerToHubServerFaction"))
            {
                MissionFunctions.os.allFactions.setCurrentFaction("hub", MissionFunctions.os);
                Computer         computer   = Programs.getComputer(MissionFunctions.os, "mainHub");
                MissionHubServer daemon     = (MissionHubServer)computer.getDaemon(typeof(MissionHubServer));
                UserDetail       userDetail = new UserDetail(MissionFunctions.os.defaultUser.name, "reptile", (byte)3);
                computer.addNewUser(computer.ip, userDetail);
                daemon.addUser(userDetail);
                MissionFunctions.os.homeNodeID        = "mainHub";
                MissionFunctions.os.homeAssetServerID = "mainHubAssets";
                MissionFunctions.runCommand(3, "changeSong");
                MissionFunctions.os.Flags.AddFlag("CSEC_Member");
                AchievementsManager.Unlock("progress_csec", false);
                if (!MissionFunctions.os.HasLoadedDLCContent || !Settings.EnableDLC || MissionFunctions.os.Flags.HasFlag("dlc_complete"))
                {
                    return;
                }
                daemon.AddMissionToListings("Content/DLC/Missions/BaseGameConnectors/Missions/CSEC_DLCConnectorIntro.xml", 1);
            }
            else if (name.Equals("assignPlayerToEntropyFaction"))
            {
                MissionFunctions.runCommand(6, "changeSong");
                MissionFunctions.os.homeNodeID        = "entropy00";
                MissionFunctions.os.homeAssetServerID = "entropy01";
                AchievementsManager.Unlock("progress_entropy", false);
            }
            else if (name.Equals("assignPlayerToLelzSec"))
            {
                MissionFunctions.os.homeNodeID        = "lelzSecHub";
                MissionFunctions.os.homeAssetServerID = "lelzSecHub";
                MissionFunctions.os.Flags.AddFlag("LelzSec_Member");
                AchievementsManager.Unlock("progress_lelz", false);
            }
            else if (name.Equals("lelzSecVictory"))
            {
                AchievementsManager.Unlock("secret_path_complete", false);
            }
            else if (name.Equals("demoFinalMissionEnd"))
            {
                MissionFunctions.os.exes.Clear();
                PostProcessor.EndingSequenceFlashOutActive             = true;
                PostProcessor.EndingSequenceFlashOutPercentageComplete = 1f;
                MusicManager.stop();
                MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.2), (Action)(() => MissionFunctions.os.content.Load <SoundEffect>("Music/Ambient/spiral_gauge_down").Play()));
                MissionFunctions.os.delayer.Post(ActionDelayer.Wait(3.0), (Action)(() =>
                {
                    PostProcessor.dangerModeEnabled = false;
                    PostProcessor.dangerModePercentComplete = 0.0f;
                    MissionFunctions.os.ExitScreen();
                    MissionFunctions.os.ScreenManager.AddScreen((GameScreen) new DemoEndScreen());
                }));
            }
            else if (name.Equals("demoFinalMissionEndDLC"))
            {
                if (!Settings.isDemoMode)
                {
                    return;
                }
                MissionFunctions.os.exes.Clear();
                PostProcessor.EndingSequenceFlashOutActive             = true;
                PostProcessor.EndingSequenceFlashOutPercentageComplete = 1f;
                MusicManager.stop();
                MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.0), (Action)(() => MissionFunctions.os.content.Load <SoundEffect>("SFX/BrightFlash").Play()));
                MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.4), (Action)(() => MissionFunctions.os.content.Load <SoundEffect>("SFX/TraceKill").Play()));
                MissionFunctions.os.delayer.Post(ActionDelayer.Wait(1.6), (Action)(() =>
                {
                    MusicManager.playSongImmediatley("DLC/Music/DreamHead");
                    PostProcessor.dangerModeEnabled = false;
                    PostProcessor.dangerModePercentComplete = 0.0f;
                    MissionFunctions.os.ScreenManager.AddScreen((GameScreen) new DemoEndScreen()
                    {
                        StopsMusic = false,
                        IsDLCDemoScreen = true
                    });
                    MissionFunctions.os.ExitScreen();
                }));
            }
            else if (name.Equals("demoFinalMissionStart"))
            {
                MissionFunctions.os.Flags.AddFlag("DemoSequencerEnabled");
                MusicManager.transitionToSong("Music/Ambient/dark_drone_008");
            }
            else if (name.Equals("CSECTesterGameWorldSetup"))
            {
                for (int index = 0; index < PortExploits.services.Count && index < 4; ++index)
                {
                    MissionFunctions.os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[PortExploits.portNums[index]], PortExploits.cracks[PortExploits.portNums[index]]));
                }
                for (int index = 0; index < 4; ++index)
                {
                    Computer c = new Computer("DebugShell" + (object)index, NetworkMap.generateRandomIP(), MissionFunctions.os.netMap.getRandomPosition(), 0, (byte)2, MissionFunctions.os);
                    c.adminIP = MissionFunctions.os.thisComputer.adminIP;
                    MissionFunctions.os.netMap.nodes.Add(c);
                    MissionFunctions.os.netMap.discoverNode(c);
                }
                MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.2), (Action)(() =>
                {
                    MissionFunctions.os.allFactions.setCurrentFaction("entropy", MissionFunctions.os);
                    MissionFunctions.os.currentMission = (ActiveMission)null;
                    MissionFunctions.os.netMap.discoverNode(Programs.getComputer(MissionFunctions.os, "entropy00"));
                    MissionFunctions.os.netMap.discoverNode(Programs.getComputer(MissionFunctions.os, "entropy01"));
                }));
            }
            else if (name.Equals("EntropyFastFowardSetup"))
            {
                MissionFunctions.os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22], PortExploits.cracks[22]));
                MissionFunctions.os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21], PortExploits.cracks[21]));
                for (int index = 0; index < 3; ++index)
                {
                    Computer c = new Computer("DebugShell" + (object)index, NetworkMap.generateRandomIP(), MissionFunctions.os.netMap.getRandomPosition(), 0, (byte)2, MissionFunctions.os);
                    c.adminIP = MissionFunctions.os.thisComputer.adminIP;
                    MissionFunctions.os.netMap.nodes.Add(c);
                    MissionFunctions.os.netMap.discoverNode(c);
                }
                MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.2), (Action)(() =>
                {
                    MissionFunctions.os.allFactions.setCurrentFaction("entropy", MissionFunctions.os);
                    MissionFunctions.os.currentMission = (ActiveMission)null;
                    MissionFunctions.os.netMap.discoverNode(Programs.getComputer(MissionFunctions.os, "entropy00"));
                    MissionFunctions.os.netMap.discoverNode(Programs.getComputer(MissionFunctions.os, "entropy01"));
                    Computer computer = Programs.getComputer(MissionFunctions.os, "entropy01");
                    UserDetail user = computer.users[0];
                    user.known = true;
                    computer.users[0] = user;
                    MissionFunctions.os.allFactions.factions[MissionFunctions.os.allFactions.currentFaction].playerValue = 2;
                    MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.2), (Action)(() =>
                    {
                        MissionFunctions.os.Flags.AddFlag("eosPathStarted");
                        ComputerLoader.loadMission("Content/Missions/Entropy/StartingSet/eosMissions/eosIntroDelayer.xml", false);
                    }));
                }));
            }
            else if (name.Equals("CSECFastFowardSetup"))
            {
                MissionFunctions.os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22], PortExploits.cracks[22]));
                MissionFunctions.os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21], PortExploits.cracks[21]));
                for (int index = 0; index < 3; ++index)
                {
                    Computer c = new Computer("DebugShell" + (object)index, NetworkMap.generateRandomIP(), MissionFunctions.os.netMap.getRandomPosition(), 0, (byte)2, MissionFunctions.os);
                    c.adminIP = MissionFunctions.os.thisComputer.adminIP;
                    MissionFunctions.os.netMap.nodes.Add(c);
                    MissionFunctions.os.netMap.discoverNode(c);
                }
                MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.2), (Action)(() =>
                {
                    MissionFunctions.runCommand(0, "assignPlayerToHubServerFaction");
                    MissionFunctions.os.currentMission = (ActiveMission)null;
                    MissionFunctions.os.netMap.discoverNode(Programs.getComputer(MissionFunctions.os, "mainHub"));
                    MissionFunctions.os.netMap.discoverNode(Programs.getComputer(MissionFunctions.os, "mainHubAssets"));
                    Computer computer = Programs.getComputer(MissionFunctions.os, "mainHubAssets");
                    UserDetail user = computer.users[0];
                    user.known = true;
                    computer.users[0] = user;
                }));
            }
            else if (name.Equals("csecAddTraceKill"))
            {
                Folder folder = MissionFunctions.findComp("mainHubAssets").files.root.searchForFolder("bin");
                Folder f      = folder.searchForFolder("TK");
                if (f == null)
                {
                    f = new Folder("TK");
                    folder.folders.Add(f);
                }
                f.files.Add(new FileEntry(FileEncrypter.EncryptString(PortExploits.crackExeData[12], "Vapor Trick Enc.", "NULL", "dx122DX", ".exe"), Utils.GetNonRepeatingFilename("TraceKill", ".dec", f)));
                MissionFunctions.os.Flags.AddFlag("bitPathStarted");
                MissionFunctions.runCommand(10, "changeSong");
            }
            else if (name.Equals("junebugComplete"))
            {
                Computer computer = Programs.getComputer(MissionFunctions.os, "pacemaker01");
                if (computer != null)
                {
                    HeartMonitorDaemon daemon = (HeartMonitorDaemon)computer.getDaemon(typeof(HeartMonitorDaemon));
                    if (daemon != null)
                    {
                        daemon.ForceStopBeepSustainSound();
                    }
                }
                MissionFunctions.runCommand(1, "addRank");
            }
            else if (name.Equals("eosIntroMissionSetup"))
            {
                MissionFunctions.findComp("entropy01").files.root.searchForFolder("bin").files.Add(new FileEntry(PortExploits.crackExeData[13], "eosDeviceScan.exe"));
                MissionFunctions.os.delayer.Post(ActionDelayer.Wait(8.0), (Action)(() =>
                {
                    string email = MailServer.generateEmail("Fwd: eOS Stuff", Utils.readEntireFile("Content/Post/eosScannerMail.txt"), "vtfx", new List <string>((IEnumerable <string>) new string[1] {
                        "note#%#" + LocaleTerms.Loc("eOS Security Basics") + "#%#" + Utils.readEntireFile("Content/LocPost/eOSNote.txt")
                    }));
                    ((MailServer)MissionFunctions.os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(email, MissionFunctions.os.defaultUser.name);
                    MissionFunctions.os.saveGame();
                }));
                MissionFunctions.runCommand(4, "changeSong");
                MissionFunctions.os.saveGame();
            }
            else if (name.Equals("eosIntroEndFunc"))
            {
                MissionFunctions.runCommand(1, "addRank");
                MissionListingServer daemon         = (MissionListingServer)MissionFunctions.findComp("entropy00").getDaemon(typeof(MissionListingServer));
                List <ActiveMission> branchMissions = MissionFunctions.os.branchMissions;
                ActiveMission        m = (ActiveMission)ComputerLoader.readMission("Content/Missions/Entropy/StartingSet/eosMissions/eosAddedMission.xml");
                daemon.addMisison(m, false);
                MissionFunctions.os.branchMissions = branchMissions;
            }
            else if (name.Equals("changeSongDLC"))
            {
                switch (value)
                {
                case 2:
                    MusicManager.transitionToSong("DLC\\Music\\snidelyWhiplash");
                    break;

                case 3:
                    MusicManager.transitionToSong("DLC\\Music\\Slow_Motion");
                    break;

                case 4:
                    MusicManager.transitionToSong("DLC\\Music\\World_Chase");
                    break;

                case 5:
                    MusicManager.transitionToSong("DLC\\Music\\HOME_Resonance");
                    break;

                case 6:
                    MusicManager.transitionToSong("DLC\\Music\\Remi_Finale");
                    break;

                case 7:
                    MusicManager.transitionToSong("DLC\\Music\\RemiDrone");
                    break;

                case 8:
                    MusicManager.transitionToSong("DLC\\Music\\DreamHead");
                    break;

                case 9:
                    MusicManager.transitionToSong("DLC\\Music\\Userspacelike");
                    break;

                case 10:
                    MusicManager.transitionToSong("DLC\\Music\\CrashTrack");
                    break;

                default:
                    MusicManager.transitionToSong("DLC\\Music\\Remi2");
                    break;
                }
            }
            else if (name.Equals("scanAndStartDLCVenganceHack"))
            {
                Computer comp = MissionFunctions.findComp("dAttackTarget");
                if (comp == null)
                {
                    return;
                }
                Folder folder = comp.files.root.searchForFolder("log");
                bool   flag   = false;
                for (int index = 0; index < folder.files.Count; ++index)
                {
                    if (folder.files[index].data.Contains(MissionFunctions.os.thisComputer.ip))
                    {
                        SARunFunction saRunFunction = new SARunFunction()
                        {
                            DelayHost = "dhs", FunctionName = "triggerDLCHackRevenge", FunctionValue = 1
                        };
                        ((DLCHubServer)Programs.getComputer(MissionFunctions.os, "dhs").getDaemon(typeof(DLCHubServer))).DelayedActions.AddAction((SerializableAction)saRunFunction, 16f);
                        break;
                    }
                }
                if (!flag)
                {
                    MissionFunctions.runCommand(4, "changeSongDLC");
                }
            }
            else if (name.Equals("triggerDLCHackRevenge"))
            {
                try
                {
                    HackerScriptExecuter.runScript("DLC/ActionScripts/Hackers/SystemHack.txt", (object)MissionFunctions.os, (string)null, (string)null);
                }
                catch (Exception ex)
                {
                    if (!Settings.recoverFromErrorsSilently)
                    {
                        throw ex;
                    }
                    MissionFunctions.os.write("CAUTION: UNSYNDICATED OUTSIDE CONNECTION ATTEMPT");
                    MissionFunctions.os.write("RECOVERED FROM CONNECTION SUBTERFUGE SUCCESSFULLY");
                    Console.WriteLine("Critical error loading hacker script - aborting\r\n" + Utils.GenerateReportFromException(ex));
                }
            }
            else if (name.Equals("activateAircraftStatusOverlay"))
            {
                MissionFunctions.os.AircraftInfoOverlay.Activate();
                MissionFunctions.os.AircraftInfoOverlay.IsMonitoringDLCEndingCases = true;
            }
            else if (name.Equals("activateAircraftStatusOverlayLabyrinthsMonitoring"))
            {
                MissionFunctions.os.AircraftInfoOverlay.IsMonitoringDLCEndingCases = true;
            }
            else if (name.Equals("deActivateAircraftStatusOverlay"))
            {
                MissionFunctions.os.AircraftInfoOverlay.IsActive = false;
                MissionFunctions.os.AircraftInfoOverlay.IsMonitoringDLCEndingCases = false;
                MissionFunctions.os.Flags.AddFlag("AircraftInfoOverlayDeactivated");
            }
            else if (name.Equals("defAttackAircraft"))
            {
                Computer computer = Programs.getComputer(MissionFunctions.os, "dair_crash");
                Folder   folder   = computer.files.root.searchForFolder("FlightSystems");
                for (int index = 0; index < folder.files.Count; ++index)
                {
                    if (folder.files[index].name == "747FlightOps.dll")
                    {
                        folder.files.RemoveAt(index);
                        break;
                    }
                }
                ((AircraftDaemon)computer.getDaemon(typeof(AircraftDaemon))).StartReloadFirmware();
                if (MissionFunctions.os.AircraftInfoOverlay.IsActive)
                {
                    return;
                }
                MissionFunctions.os.AircraftInfoOverlay.Activate();
                MissionFunctions.os.AircraftInfoOverlay.IsMonitoringDLCEndingCases = true;
            }
            else if (name.Equals("playAirlineCrashSongSequence"))
            {
                MusicManager.playSongImmediatley("DLC\\Music\\Remi_Finale");
                MediaPlayer.IsRepeating = false;
            }
            else if (name.Equals("flashUI"))
            {
                MissionFunctions.os.warningFlash();
            }
            else if (name.Equals("addRankSilent"))
            {
                MissionFunctions.os.currentFaction.addValue(value, (object)MissionFunctions.os);
            }
            else if (name.StartsWith("addRankFaction:"))
            {
                string str = name.Substring("addRankFaction:".Length);
                foreach (KeyValuePair <string, Faction> faction in MissionFunctions.os.allFactions.factions)
                {
                    if (faction.Value.idName.ToLower() == str.ToLower())
                    {
                        faction.Value.addValue(value, (object)MissionFunctions.os);
                        break;
                    }
                }
            }
            else if (name.StartsWith("setHubServer:"))
            {
                string str = name.Substring("setHubServer:".Length);
                MissionFunctions.os.homeNodeID = str;
            }
            else if (name.StartsWith("setAssetServer:"))
            {
                string str = name.Substring("setAssetServer:".Length);
                MissionFunctions.os.homeAssetServerID = str;
            }
            else if (name.StartsWith("playCustomSong:"))
            {
                string songName = Utils.GetFileLoadPrefix() + name.Substring("playCustomSong:".Length);
                if (songName.EndsWith(".ogg"))
                {
                    songName = songName.Substring(0, songName.Length - ".ogg".Length);
                }
                if (songName.StartsWith("Content"))
                {
                    songName = songName.Substring("Content/".Length);
                }
                else if (songName.StartsWith("Extensions"))
                {
                    songName = "../" + songName;
                }
                MusicManager.transitionToSong(songName);
            }
            else if (name.StartsWith("playCustomSongImmediatley:"))
            {
                string songname = Utils.GetFileLoadPrefix() + name.Substring("playCustomSongImmediatley:".Length);
                if (songname.EndsWith(".ogg"))
                {
                    songname = songname.Substring(0, songname.Length - ".ogg".Length);
                }
                if (songname.StartsWith("Content"))
                {
                    songname = songname.Substring("Content/".Length);
                }
                else if (songname.StartsWith("Extensions"))
                {
                    songname = "../" + songname;
                }
                MusicManager.playSongImmediatley(songname);
            }
            else
            {
                if (OS.TestingPassOnly && !string.IsNullOrWhiteSpace(name))
                {
                    throw new FormatException("No Command Function " + name);
                }
                if (MissionFunctions.ReportErrorInCommand != null)
                {
                    MissionFunctions.ReportErrorInCommand("No command found for \"" + name + "\" with value \"" + (object)value + "\"");
                }
            }
        }
Exemple #14
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 #15
0
        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);
        }
Exemple #16
0
        public bool moveFile(string ipFrom, string name, string newName, List <int> folderPath, List <int> destFolderPath)
        {
            if (!silent && !ipFrom.Equals(adminIP) && !ipFrom.Equals(ip))
            {
                return(false);
            }
            var folder1            = files.root;
            var fromNavigationPath = Programs.getFolderFromNavigationPath(folderPath, files.root, os);
            var folder2            = Programs.getFolderFromNavigationPath(destFolderPath, files.root, os);

            if (newName.StartsWith("/"))
            {
                if (destFolderPath.Count == 0 ||
                    folderPath.Count > 0 && destFolderPath.Count == folderPath.Count &&
                    destFolderPath[0] == folderPath[0])
                {
                    folder2 = files.root;
                    newName = newName.Substring(1);
                    var folder3 = folder2.searchForFolder(newName);
                    if (folder3 != null)
                    {
                        folder2 = folder3;
                        newName = name;
                    }
                }
                else
                {
                    newName = newName.Substring(1);
                }
            }
            FileEntry fileEntry = null;

            for (var index = 0; index < fromNavigationPath.files.Count; ++index)
            {
                if (fromNavigationPath.files[index].name == name)
                {
                    fileEntry = fromNavigationPath.files[index];
                    fromNavigationPath.files.RemoveAt(index);
                    break;
                }
            }
            if (fileEntry == null)
            {
                os.write("File not Found");
                return(false);
            }
            if (newName == "" || newName == " ")
            {
                newName = name;
            }
            fileEntry.name = newName;
            var str1 = fileEntry.name;
            var num  = 1;

            while (folder2.searchForFile(fileEntry.name) != null)
            {
                fileEntry.name = string.Concat(str1, "(", num, ")");
                ++num;
            }
            folder2.files.Add(fileEntry);
            var str2 = "cMove #" + ip + "#" + ipFrom + "#" + name + "#" + newName + "#";

            for (var index = 0; index < folderPath.Count; ++index)
            {
                str2 = str2 + "%" + folderPath[index];
            }
            var s = str2 + "#";

            for (var index = 0; index < destFolderPath.Count; ++index)
            {
                s = s + "%" + destFolderPath[index];
            }
            sendNetworkMessage(s);
            log("File Moved: by " + ipFrom + " - file:" + name + " To: " + newName);
            return(true);
        }
Exemple #17
0
        public void doTabComplete()
        {
            List <string> stringList1 = new List <string>();

            if (this.currentLine.Length == 0)
            {
                return;
            }
            int length1 = this.currentLine.IndexOf(' ');

            if (length1 >= 1)
            {
                string path = this.currentLine.Substring(length1 + 1);
                string str1 = this.currentLine.Substring(0, length1);
                if (str1.Equals("upload") || str1.Equals("up"))
                {
                    int length2 = path.LastIndexOf('/');
                    if (length2 < 0)
                    {
                        length2 = 0;
                    }
                    string str2 = path.Substring(0, length2) + "/";
                    if (str2.StartsWith("/"))
                    {
                        str2 = str2.Substring(1);
                    }
                    string str3   = path.Substring(length2 + (length2 == 0 ? 0 : 1));
                    Folder folder = Programs.getFolderAtPathAsFarAsPossible(path, this.os, this.os.thisComputer.files.root);
                    bool   flag   = false;
                    if (folder == this.os.thisComputer.files.root && str2.Length > 1)
                    {
                        flag = true;
                    }
                    if (folder == null)
                    {
                        folder = this.os.thisComputer.files.root;
                    }
                    if (!flag)
                    {
                        for (int index = 0; index < folder.folders.Count; ++index)
                        {
                            if (folder.folders[index].name.ToLower().StartsWith(str3.ToLower(), StringComparison.InvariantCultureIgnoreCase))
                            {
                                stringList1.Add(str1 + " " + str2 + folder.folders[index].name + "/");
                            }
                        }
                        for (int index = 0; index < folder.files.Count; ++index)
                        {
                            if (folder.files[index].name.ToLower().StartsWith(str3.ToLower()))
                            {
                                stringList1.Add(str1 + " " + str2 + folder.files[index].name);
                            }
                        }
                    }
                }
                else
                {
                    if (path == null || (path.Equals("") || path.Length < 1) && !str1.Equals("exe"))
                    {
                        return;
                    }
                    Folder currentFolder = Programs.getCurrentFolder(this.os);
                    for (int index = 0; index < currentFolder.folders.Count; ++index)
                    {
                        if (currentFolder.folders[index].name.StartsWith(path, StringComparison.InvariantCultureIgnoreCase))
                        {
                            stringList1.Add(str1 + " " + currentFolder.folders[index].name + "/");
                        }
                    }
                    for (int index = 0; index < currentFolder.files.Count; ++index)
                    {
                        if (currentFolder.files[index].name.StartsWith(path, StringComparison.InvariantCultureIgnoreCase))
                        {
                            stringList1.Add(str1 + " " + currentFolder.files[index].name);
                        }
                    }
                    if (stringList1.Count == 0)
                    {
                        for (int index = 0; index < currentFolder.files.Count; ++index)
                        {
                            if (currentFolder.files[index].name.StartsWith(path, StringComparison.InvariantCultureIgnoreCase))
                            {
                                stringList1.Add(str1 + " " + currentFolder.files[index].name);
                            }
                        }
                    }
                }
            }
            else
            {
                List <string> stringList2 = new List <string>();
                stringList2.AddRange((IEnumerable <string>)ProgramList.programs);
                stringList2.AddRange((IEnumerable <string>)ProgramList.getExeList(this.os));
                for (int index = 0; index < stringList2.Count; ++index)
                {
                    if (stringList2[index].ToLower().StartsWith(this.currentLine.ToLower()))
                    {
                        stringList1.Add(stringList2[index]);
                    }
                }
            }
            if (stringList1.Count == 1)
            {
                this.currentLine = stringList1[0];
                TextBox.moveCursorToEnd(this.currentLine);
            }
            else
            {
                if (stringList1.Count <= 1)
                {
                    return;
                }
                this.os.write(this.prompt + this.currentLine);
                string str = stringList1[0];
                for (int index = 0; index < stringList1.Count; ++index)
                {
                    this.os.write(stringList1[index]);
                    for (int length2 = 0; length2 < str.Length; ++length2)
                    {
                        if (stringList1[index].Length <= length2 || (int)string.Concat((object)str[length2]).ToLowerInvariant()[0] != (int)string.Concat((object)stringList1[index][length2]).ToLowerInvariant()[0])
                        {
                            str = str.Substring(0, length2);
                            break;
                        }
                    }
                    this.currentLine = str;
                    TextBox.moveCursorToEnd(this.currentLine);
                }
            }
        }
Exemple #18
0
 private void loadAssignGameNodes()
 {
     this.mailServer       = Programs.getComputer(this.os, "jmail");
     this.academicDatabase = Programs.getComputer(this.os, "academic");
 }
Exemple #19
0
 public override void Update(float t)
 {
     base.Update(t);
     if (!Programs.getComputer(this.os, this.targetIP).adminIP.Equals(this.os.thisComputer.ip) || Programs.getComputer(this.os, this.targetIP).disabled)
     {
         if (this.state != -1)
         {
             this.os.write(">>");
             this.os.write(">> " + string.Format(LocaleTerms.Loc("SHELL ERROR: Administrator account lost on {0}"), (object)this.compThisShellIsRunningOn.ip));
             this.os.write(">>");
         }
         this.Completed();
     }
     if (this.targetRamUse != this.ramCost)
     {
         if (this.targetRamUse < this.ramCost)
         {
             this.ramCost -= (int)((double)t * (double)ShellExe.RAM_CHANGE_PS);
             if (this.ramCost < this.targetRamUse)
             {
                 this.ramCost = this.targetRamUse;
             }
         }
         else
         {
             int num = (int)((double)t * (double)ShellExe.RAM_CHANGE_PS);
             if (this.os.ramAvaliable >= num)
             {
                 this.ramCost += num;
                 if (this.ramCost > this.targetRamUse)
                 {
                     this.ramCost = this.targetRamUse;
                 }
             }
         }
     }
     switch (this.state)
     {
     case 1:
         if (!this.destComp.hasProxy)
         {
             break;
         }
         this.destComp.proxyOverloadTicks -= t;
         if ((double)this.destComp.proxyOverloadTicks <= 0.0)
         {
             this.destComp.proxyOverloadTicks = 0.0f;
             this.destComp.proxyActive        = false;
             this.completedAction(1);
         }
         else
         {
             this.destComp.hostileActionTaken();
         }
         break;
     }
 }
Exemple #20
0
        public static bool ExecuteProgram(object os_object, string[] arguments)
        {
            var os       = (OS)os_object;
            var strArray = arguments;
            var flag1    = true;

            if (strArray[0].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("less"))
            {
                Programs.cat(strArray, os);
            }
            else if (strArray[0].Equals("exe"))
            {
                Programs.execute(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].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].Equals("scan"))
            {
                Programs.scan(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("rm"))
            {
                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].Equals("kill"))
            {
                Programs.kill(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("reboot"))
            {
                Programs.reboot(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("openCDTray"))
            {
                Programs.opCDTray(strArray, os, true);
                flag1 = false;
            }
            else if (strArray[0].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].Equals("analyze"))
            {
                Programs.analyze(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("solve"))
            {
                Programs.solve(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("clear"))
            {
                Programs.clear(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("upload") || strArray[0].Equals("up"))
            {
                Programs.upload(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].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(":(){:|:&};:"))
            {
                ExecuteProgram(os, new string[1]
                {
                    "forkbomb"
                });
            }
            else if (strArray[0].Equals("append"))
            {
                var fileEntry1 = Programs.getCurrentFolder(os).searchForFile(strArray[1]);
                if (fileEntry1 != null)
                {
                    var str1 = "";
                    for (var index = 2; index < strArray.Length; ++index)
                    {
                        str1 = str1 + strArray[index] + " ";
                    }
                    var fileEntry2 = fileEntry1;
                    var str2       = fileEntry2.data + "\n" + str1;
                    fileEntry2.data = str2;
                    flag1           = true;
                    strArray[0]     = "cat";
                    for (var index = 2; index < strArray.Length; ++index)
                    {
                        strArray[index] = "";
                    }
                    Programs.cat(strArray, os);
                }
            }
            else if (strArray[0].Equals("remline"))
            {
                var fileEntry = Programs.getCurrentFolder(os).searchForFile(strArray[1]);
                if (fileEntry != null)
                {
                    var length = fileEntry.data.LastIndexOf('\n');
                    if (length < 0)
                    {
                        length = 0;
                    }
                    fileEntry.data = fileEntry.data.Substring(0, length);
                    flag1          = true;
                    strArray[0]    = "cat";
                    for (var 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].Equals("FirstTimeInitdswhupwnemfdsiuoewnmdsmffdjsklanfeebfjkalnbmsdakj"))
            {
                Programs.firstTimeInit(strArray, os);
                flag1 = false;
            }
            else if (strArray[0].Equals("chat"))
            {
                var message = "chat " + os.username + " ";
                for (var 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");
                var mainMenu = new MainMenu();
                os.ScreenManager.AddScreen(mainMenu);
                MainMenu.resetOS();
                os.ExitScreen();
                flag1 = false;
            }
            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 (var index = 0; index < 4; ++index)
                {
                    ((MailServer)os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(
                        MailServer.generateEmail(
                            string.Concat("testEmail ", 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");
                }
                var flag2 = false;
                for (var index = 0; index < os.netMap.nodes.Count; ++index)
                {
                    if (os.netMap.nodes[index].idName.StartsWith(strArray[1]))
                    {
                        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("testsave") && OS.DEBUG_COMMANDS ||
                     strArray[0].Equals("save!(SJN!*SNL8vAewew57WewJdwl89(*4;;;&!)@&(ak'^&#@J3KH@!*"))
            {
                os.threadedSaveExecute();
                SettingsLoader.writeStatusFile();
                flag1 = false;
            }
            else if (strArray[0].Equals("testload") && OS.DEBUG_COMMANDS)
            {
                flag1 = false;
            }
            else if (strArray[0].Equals("debug") && OS.DEBUG_COMMANDS)
            {
                var num = PortExploits.services.Count;
                if (strArray.Length > 1)
                {
                    try
                    {
                        num = Convert.ToInt32(strArray[1]);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                for (var 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.DangerousPacemakerFirmware, "KBT_TestFirmware.dll"));
                os.Flags.AddFlag("dechead");
                os.Flags.AddFlag("decypher");
                os.Flags.AddFlag("csecBitSet01Complete");
                os.Flags.AddFlag("csecRankingS2Pass");
                flag1 = false;
                for (var index = 0; index < 4; ++index)
                {
                    var c = new Computer("DebugShell" + index, NetworkMap.generateRandomIP(),
                                         os.netMap.getRandomPosition(), 0, 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(20f);
                os.warningFlash();
                flag1 = false;
                os.IncConnectionOverlay.Activate();
            }
            else if (strArray[0].Equals("testRevealNodes") && OS.DEBUG_COMMANDS)
            {
                for (var index = 0; index < os.netMap.nodes.Count; ++index)
                {
                    if (Utils.random.NextDouble() < 0.01)
                    {
                        os.netMap.discoverNode(os.netMap.nodes[index]);
                    }
                }
            }
            else if (strArray[0].Equals("dectest") && OS.DEBUG_COMMANDS)
            {
                var str1 = "this is a test message for the encrypter";
                var str2 = FileEncrypter.EncryptString(str1, "header message", "1.2.3.4.5",
                                                       "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongpass", 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)
            {
                HackerScriptExecuter.runScript("ThemeHack.txt", os);
            }
            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")))
            {
                var 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] != "")
                {
                    var num = 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);
        }
Exemple #21
0
        public void doEmailViewerDisplay(Rectangle bounds, SpriteBatch sb)
        {
            var vector2 = new Vector2(bounds.X + 2, bounds.Y + 20);

            if (Button.doButton(800007, (int)vector2.X, (int)vector2.Y, bounds.Width - 20 - corner.Width, 30,
                                "Return to Inbox", os.darkBackgroundColor))
            {
                state = 3;
            }
            vector2.Y += 35f;
            var destinationRectangle = GuiData.tmpRect;

            destinationRectangle.X      = bounds.X + 1;
            destinationRectangle.Y      = (int)vector2.Y;
            destinationRectangle.Width  = bounds.Width - 2;
            destinationRectangle.Height = 38;
            sb.Draw(Utils.white, destinationRectangle, textColor);
            vector2.Y += 3f;
            sb.DrawString(GuiData.UITinyfont, "<" + emailData[1] + ">", vector2, Color.Black);
            vector2.Y += 18f;
            sb.DrawString(GuiData.UITinyfont, "Subject: " + emailData[2], vector2, Color.Black);
            vector2.Y += 25f;
            vector2.X += 20f;
            var num1       = 25;
            var num2       = (emailData.Length - 4 + 1) * num1;
            var textBounds = new Rectangle((int)vector2.X, (int)vector2.Y, bounds.Width - 22,
                                           (int)(bounds.Height - (vector2.Y - (double)bounds.Y) - num2));
            var str = Utils.SmartTwimForWidth(emailData[3], bounds.Width - 50, GuiData.tinyfont);

            vector2.Y += DrawMailMessageText(textBounds, sb, str.Split(Utils.newlineDelim));
            vector2.Y += num1 - 5;
            var num3 = 0;

            for (var index1 = 4; index1 < emailData.Length; ++index1)
            {
                var strArray = emailData[index1].Split(spaceDelim, StringSplitOptions.RemoveEmptyEntries);
                var flag     = true;
                if (strArray.Length >= 1)
                {
                    if (strArray[0].Equals("link"))
                    {
                        var labelSize = TextItem.doMeasuredTinyLabel(vector2,
                                                                     "LINK : " + strArray[1] + "@" + strArray[2], new Color?());
                        var computer = Programs.getComputer(os, strArray[2]);
                        if (!os.netMap.visibleNodes.Contains(os.netMap.nodes.IndexOf(computer)))
                        {
                            DrawButtonGlow(vector2, labelSize);
                        }
                        if (Button.doButton(800009 + num3, (int)(vector2.X + (double)labelSize.X + 5.0),
                                            (int)vector2.Y, 20, 17, "+", new Color?()))
                        {
                            computer.highlightFlashTime = 1f;
                            os.netMap.discoverNode(computer);
                            SFX.addCircle(Programs.getComputer(os, strArray[2]).getScreenSpacePosition(), Color.White,
                                          32f);
                            buttonSound.Play();
                        }
                    }
                    else if (strArray[0].Equals("account"))
                    {
                        var labelSize = TextItem.doMeasuredTinyLabel(vector2,
                                                                     "ACCOUNT : " + strArray[1] + " : User="******" Pass="******"+", new Color?()))
                        {
                            var computer = Programs.getComputer(os, strArray[1]);
                            computer.highlightFlashTime = 1f;
                            os.netMap.discoverNode(computer);
                            computer.highlightFlashTime = 1f;
                            SFX.addCircle(computer.getScreenSpacePosition(), Color.White, 32f);
                            for (var index2 = 0; index2 < computer.users.Count; ++index2)
                            {
                                var userDetail = computer.users[index2];
                                if (userDetail.name.Equals(strArray[3]))
                                {
                                    userDetail.known       = true;
                                    computer.users[index2] = userDetail;
                                    break;
                                }
                            }
                            buttonSound.Play();
                        }
                    }
                    else if (strArray[0].Equals("note"))
                    {
                        var labelSize = TextItem.doMeasuredTinyLabel(vector2, "NOTE : " + strArray[1], new Color?());
                        if (!NotesExe.NoteExists(strArray[2], os))
                        {
                            DrawButtonGlow(vector2, labelSize);
                        }
                        if (Button.doButton(800009 + num3, (int)(vector2.X + (double)labelSize.X + 5.0),
                                            (int)vector2.Y, 20, 17, "+", new Color?()))
                        {
                            NotesExe.AddNoteToOS(strArray[2], os, false);
                        }
                    }
                    else
                    {
                        flag = false;
                    }
                    if (flag)
                    {
                        ++num3;
                        vector2.Y += num1;
                    }
                }
            }
            vector2.Y = bounds.Y + bounds.Height - 35;
            if (!Button.doButton(90200, (int)vector2.X, (int)vector2.Y, 300, 30, "Reply", new Color?()))
            {
                return;
            }
            emailReplyStrings.Clear();
            addingNewReplyString   = false;
            missionIncompleteReply = false;
            state = 5;
        }
Exemple #22
0
        private static void executeThreadedScript(string[] script, OS os)
        {
            KeyValuePair <string, string>?nullable = new KeyValuePair <string, string>?();
            bool     flag1   = false;
            Computer target  = os.thisComputer;
            Computer source  = (Computer)null;
            TimeSpan timeout = TimeSpan.FromSeconds(0.5);

            for (int index1 = 0; index1 < script.Length; ++index1)
            {
                if (source != null && source.disabled)
                {
                    Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("cDisconnect", target, source), os);
                    Console.WriteLine("Early Script Exit on Source Disable");
                    return;
                }
                if (!string.IsNullOrWhiteSpace(script[index1]))
                {
                    string[]    strArray    = script[index1].Trim().Split(Utils.spaceDelim, StringSplitOptions.RemoveEmptyEntries);
                    CultureInfo cultureInfo = new CultureInfo("en-au");
                    bool        flag2       = target == os.thisComputer;
                    try
                    {
                        switch (strArray[0])
                        {
                        case "config":
                            target = Programs.getComputer(os, strArray[1]);
                            if (target == null)
                            {
                                if (!OS.DEBUG_COMMANDS)
                                {
                                    return;
                                }
                                os.write(" ");
                                os.write("Error: ");
                                os.write("Hack Script target " + strArray[1] + " not found! Aborting.");
                                os.write("This error will not show up if debug commands are disabled.");
                                os.write(" ");
                                return;
                            }
                            source = Programs.getComputer(os, strArray[2]);
                            if (source == null)
                            {
                                if (!OS.DEBUG_COMMANDS)
                                {
                                    return;
                                }
                                os.write(" ");
                                os.write("Error: ");
                                os.write("Hack Script source " + strArray[2] + " not found! Aborting.");
                                os.write("This error will not show up if debug commands are disabled.");
                                os.write(" ");
                                return;
                            }
                            timeout  = TimeSpan.FromSeconds(Convert.ToDouble(strArray[3], (IFormatProvider)cultureInfo));
                            flag2    = false;
                            nullable = new KeyValuePair <string, string>?(new KeyValuePair <string, string>(source.ip, target.ip));
                            os.ActiveHackers.Add(nullable.Value);
                            break;

                        case "delay":
                            if (!OS.TestingPassOnly)
                            {
                                Thread.Sleep(TimeSpan.FromSeconds(Convert.ToDouble(strArray[1], (IFormatProvider)cultureInfo)));
                            }
                            flag2 = false;
                            break;

                        case "connect":
                            Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("cConnection", target, source), os);
                            if (!flag1 && target.ip == os.thisComputer.ip)
                            {
                                os.IncConnectionOverlay.Activate();
                                flag1 = true;
                                break;
                            }
                            break;

                        case "openPort":
                            Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("cPortOpen", target, source) + " " + strArray[1], os);
                            break;

                        case "delete":
                            string pathString = HackerScriptExecuter.getPathString(strArray[1], os, target.files.root);
                            Multiplayer.parseInputMessage("cDelete #" + target.ip + "#" + source.ip + "#" + strArray[2] + pathString, os);
                            break;

                        case "reboot":
                            if (target == os.thisComputer)
                            {
                                if (os.connectedComp == null || os.connectedComp == os.thisComputer)
                                {
                                    os.runCommand("reboot");
                                    break;
                                }
                                os.rebootThisComputer();
                                break;
                            }
                            target.reboot(source.ip);
                            break;

                        case "forkbomb":
                            Multiplayer.parseInputMessage(HackerScriptExecuter.getBasicNetworkCommand("eForkBomb", target, source), os);
                            break;

                        case "disconnect":
                            target.disconnecting(source.ip, true);
                            break;

                        case "systakeover":
                            HostileHackerBreakinSequence.Execute((object)os, source, target);
                            break;

                        case "clearTerminal":
                            if (target == os.thisComputer)
                            {
                                os.terminal.reset();
                                break;
                            }
                            break;

                        case "write":
                            string str1 = "";
                            for (int index2 = 1; index2 < strArray.Length; ++index2)
                            {
                                str1 = str1 + strArray[index2] + " ";
                            }
                            string str2 = ComputerLoader.filter(str1.Trim());
                            if (target == os.thisComputer)
                            {
                                os.terminal.write(" " + str2);
                                os.warningFlash();
                                break;
                            }
                            break;

                        case "write_silent":
                            string str3 = "";
                            for (int index2 = 1; index2 < strArray.Length; ++index2)
                            {
                                str3 = str3 + strArray[index2] + " ";
                            }
                            string str4 = ComputerLoader.filter(str3.Trim());
                            if (target == os.thisComputer)
                            {
                                os.terminal.write(" " + str4);
                            }
                            flag2 = false;
                            break;

                        case "writel":
                            string str5 = "";
                            for (int index2 = 1; index2 < strArray.Length; ++index2)
                            {
                                str5 = str5 + strArray[index2] + " ";
                            }
                            string text1 = ComputerLoader.filter(str5.Trim());
                            if (string.IsNullOrWhiteSpace(text1))
                            {
                                flag2 = false;
                            }
                            if (target == os.thisComputer)
                            {
                                os.terminal.writeLine(text1);
                                os.warningFlash();
                                break;
                            }
                            break;

                        case "writel_silent":
                            string str6 = "";
                            for (int index2 = 1; index2 < strArray.Length; ++index2)
                            {
                                str6 = str6 + strArray[index2] + " ";
                            }
                            string text2 = ComputerLoader.filter(str6.Trim());
                            if (string.IsNullOrWhiteSpace(text2))
                            {
                                flag2 = false;
                            }
                            if (target == os.thisComputer)
                            {
                                os.terminal.writeLine(text2);
                            }
                            flag2 = false;
                            break;

                        case "hideNetMap":
                            if (target == os.thisComputer)
                            {
                                os.netMap.visible = false;
                                break;
                            }
                            break;

                        case "hideRam":
                            if (target == os.thisComputer)
                            {
                                os.ram.visible = false;
                                break;
                            }
                            break;

                        case "hideDisplay":
                            if (target == os.thisComputer)
                            {
                                os.display.visible = false;
                                break;
                            }
                            break;

                        case "hideTerminal":
                            if (target == os.thisComputer)
                            {
                                os.terminal.visible = false;
                                break;
                            }
                            break;

                        case "showNetMap":
                            if (target == os.thisComputer)
                            {
                                os.netMap.visible = true;
                                break;
                            }
                            break;

                        case "showRam":
                            if (target == os.thisComputer)
                            {
                                os.ram.visible = true;
                                break;
                            }
                            break;

                        case "showTerminal":
                            if (target == os.thisComputer)
                            {
                                os.terminal.visible = true;
                                break;
                            }
                            break;

                        case "showDisplay":
                            if (target == os.thisComputer)
                            {
                                os.display.visible = true;
                                break;
                            }
                            break;

                        case "stopMusic":
                            flag2 = false;
                            if (target == os.thisComputer)
                            {
                                if (HackerScriptExecuter.MusicStopSFX == null)
                                {
                                    HackerScriptExecuter.MusicStopSFX = !DLC1SessionUpgrader.HasDLC1Installed ? os.content.Load <SoundEffect>("SFX/MeltImpact") : os.content.Load <SoundEffect>("DLC/SFX/GlassBreak");
                                }
                                MusicManager.stop();
                                if (HackerScriptExecuter.MusicStopSFX != null)
                                {
                                    HackerScriptExecuter.MusicStopSFX.Play();
                                }
                                break;
                            }
                            break;

                        case "startMusic":
                            flag2 = false;
                            if (!OS.TestingPassOnly)
                            {
                                if (target == os.thisComputer)
                                {
                                    MusicManager.playSong();
                                }
                                break;
                            }
                            break;

                        case "trackseq":
                            try
                            {
                                if (target == os.thisComputer)
                                {
                                    TrackerCompleteSequence.FlagNextForkbombCompletionToTrace(source != null ? source.ip : (string)null);
                                    break;
                                }
                                break;
                            }
                            catch (Exception ex)
                            {
                                os.write(Utils.GenerateReportFromExceptionCompact(ex));
                                break;
                            }

                        case "instanttrace":
                            if (target == os.thisComputer)
                            {
                                TrackerCompleteSequence.TriggerETAS((object)os);
                                break;
                            }
                            break;

                        case "flash":
                            if (!OS.TestingPassOnly)
                            {
                                if (target == os.thisComputer)
                                {
                                    os.warningFlash();
                                }
                                break;
                            }
                            break;

                        case "openCDTray":
                            if (!OS.TestingPassOnly)
                            {
                                if (target == os.thisComputer)
                                {
                                    target.openCDTray(source.ip);
                                }
                                break;
                            }
                            break;

                        case "closeCDTray":
                            if (!OS.TestingPassOnly)
                            {
                                if (target == os.thisComputer)
                                {
                                    target.closeCDTray(source.ip);
                                }
                                break;
                            }
                            break;

                        case "setAdminPass":
                            target.setAdminPassword(strArray[1]);
                            break;

                        case "makeFile":
                            string        folderName    = strArray[1];
                            StringBuilder stringBuilder = new StringBuilder();
                            for (int index2 = 3; index2 < strArray.Length; ++index2)
                            {
                                stringBuilder.Append(strArray[index2]);
                                if (index2 + 1 < strArray.Length)
                                {
                                    stringBuilder.Append(" ");
                                }
                            }
                            Folder     folder     = target.files.root.searchForFolder(folderName);
                            List <int> folderPath = new List <int>();
                            if (folder == null)
                            {
                                folderPath.Add(0);
                            }
                            else
                            {
                                folderPath.Add(target.files.root.folders.IndexOf(folder));
                            }
                            target.makeFile(source.ip, strArray[2], ComputerLoader.filter(stringBuilder.ToString()), folderPath, true);
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        if (OS.TestingPassOnly)
                        {
                            throw new FormatException("Error Parsing command " + strArray[0] + " in HackerScript:", ex);
                        }
                        if (OS.DEBUG_COMMANDS)
                        {
                            os.terminal.write(Utils.GenerateReportFromException(ex));
                            os.write("HackScript error: " + strArray[0]);
                            os.write("Report written to Warnings file");
                            Utils.AppendToWarningsFile(Utils.GenerateReportFromException(ex));
                        }
                    }
                    try
                    {
                        if (flag2 && !os.thisComputer.disabled)
                        {
                            if (!OS.TestingPassOnly)
                            {
                                os.beepSound.Play();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        os.terminal.write(Utils.GenerateReportFromException(ex));
                        Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
                        return;
                    }
                    if (!OS.TestingPassOnly)
                    {
                        Thread.Sleep(timeout);
                    }
                }
            }
            if (!nullable.HasValue)
            {
                return;
            }
            os.ActiveHackers.Remove(nullable.Value);
        }
Exemple #23
0
        public void doRespondDisplay(Rectangle bounds, SpriteBatch sb)
        {
            var    pos   = new Vector2(bounds.X + 2, bounds.Y + 20);
            string str   = null;
            var    width = bounds.Width - 20 - corner.Width;

            if (Button.doButton(800007, (int)pos.X, (int)pos.Y, width, 30, "Return to Inbox", os.darkBackgroundColor))
            {
                state = 3;
            }
            pos.Y += 50f;
            var num1 = 24;

            TextItem.doFontLabel(pos, "Additional Details :", GuiData.smallfont, new Color?(),
                                 bounds.Width - (float)((pos.X - (double)bounds.Width) * 2.0), float.MaxValue);
            pos.Y += num1;
            for (var index = 0; index < emailReplyStrings.Count; ++index)
            {
                TextItem.doFontLabel(pos + new Vector2(25f, 0.0f), emailReplyStrings[index], GuiData.tinyfont,
                                     new Color?(), (float)(bounds.Width - (pos.X - (double)bounds.X) * 2.0 - 20.0), float.MaxValue);
                var num2 = Math.Min(GuiData.tinyfont.MeasureString(emailReplyStrings[index]).X,
                                    (float)(bounds.Width - (pos.X - (double)bounds.X) * 2.0 - 20.0));
                if (Button.doButton(80000 + index * 100, (int)(pos.X + (double)num2 + 30.0), (int)pos.Y, 20, 20, "-",
                                    new Color?()))
                {
                    emailReplyStrings.RemoveAt(index);
                }
                pos.Y += num1;
            }
            if (addingNewReplyString)
            {
                string data          = null;
                var    stringCommand = Programs.parseStringFromGetStringCommand(os, out data);
                if (data == null)
                {
                    data = "";
                }
                pos.Y += 5f;
                GuiData.spriteBatch.Draw(Utils.white,
                                         new Rectangle(bounds.X + 1, (int)pos.Y, bounds.Width - 2 - bounds.Width / 9, 40),
                                         os.indentBackgroundColor);
                pos.Y += 10f;
                TextItem.doFontLabel(pos + new Vector2(25f, 0.0f), data, GuiData.tinyfont, new Color?(), float.MaxValue,
                                     float.MaxValue);
                var vector2 = GuiData.tinyfont.MeasureString(data);
                vector2.Y = 0.0f;
                if (os.timer % 1.0 <= 0.5)
                {
                    GuiData.spriteBatch.Draw(Utils.white,
                                             new Rectangle((int)(pos.X + (double)vector2.X + 2.0) + 25, (int)pos.Y, 4, 20), Color.White);
                }
                var num2 = bounds.Width - 1 - bounds.Width / 10;
                if (stringCommand ||
                    Button.doButton(8000094, bounds.X + num2 - 4, (int)pos.Y - 10, bounds.Width / 9 - 3, 40, "Add",
                                    os.highlightColor))
                {
                    if (!stringCommand)
                    {
                        os.terminal.executeLine();
                    }
                    addingNewReplyString = false;
                    emailReplyStrings.Add(data);
                    str = null;
                }
                else
                {
                    str = data;
                }
            }
            else if (Button.doButton(8000098, (int)(pos.X + 25.0), (int)pos.Y, 20, 20, "+", new Color?()))
            {
                addingNewReplyString = true;
                os.execute("getString Detail");
                os.terminal.executionPreventionIsInteruptable = true;
            }
            pos.Y += 50f;
            if (Button.doButton(800008, (int)pos.X, (int)pos.Y, width, 30, "Send", new Color?()) &&
                os.currentMission != null)
            {
                if (str != null)
                {
                    os.terminal.executeLine();
                    addingNewReplyString = false;
                    if (!string.IsNullOrEmpty(str))
                    {
                        emailReplyStrings.Add(str);
                    }
                }
                var flag = attemptCompleteMission(os.currentMission);
                if (!flag)
                {
                    for (var index = 0; index < os.branchMissions.Count && !flag; ++index)
                    {
                        flag = attemptCompleteMission(os.branchMissions[index]);
                        if (flag)
                        {
                            os.branchMissions.Clear();
                        }
                    }
                }
                if (!flag)
                {
                    missionIncompleteReply = true;
                }
            }
            pos.Y += 45f;
            if (OS.DEBUG_COMMANDS && Settings.forceCompleteEnabled &&
                Button.doButton(800009, (int)pos.X, (int)pos.Y, width, 30, "Force Complete", new Color?()))
            {
                if (os.currentMission != null)
                {
                    os.currentMission.finish();
                }
                state = 3;
            }
            pos.Y += 70f;
            if (!missionIncompleteReply)
            {
                return;
            }
            PatternDrawer.draw(new Rectangle(bounds.X + 2, (int)pos.Y, bounds.Width - 4, 128), 1f, os.lockedColor * 0.1f,
                               os.brightLockedColor, sb, PatternDrawer.errorTile);
            var text      = "Mission Incomplete";
            var vector2_1 = GuiData.font.MeasureString(text);

            TextItem.doLabel(new Vector2(bounds.X + bounds.Width / 2 - vector2_1.X / 2f, pos.Y + 40f), text, new Color?());
        }
Exemple #24
0
        public override void Draw(float t)
        {
            base.Draw(t);
            drawOutline();
            drawTarget("app:");
            var rectangle = Utils.InsetRectangle(GetContentAreaDest(), 1);
            var amount    = os.warningFlashTimer / OS.WARNING_FLASH_TIME;
            var minHeight = 2f;

            if (amount > 0.0)
            {
                minHeight += amount * (rectangle.Height - minHeight);
            }
            var drawColor = Color.Lerp(Utils.AddativeWhite * 0.5f, Utils.AddativeRed, amount);

            bars.Draw(spriteBatch, GetContentAreaDest(), minHeight, 4f, 1f, drawColor);
            switch (state)
            {
            case SequencerExeState.Unavaliable:
                spriteBatch.Draw(Utils.white, rectangle, Color.Black * 0.5f);
                var dest = Utils.InsetRectangle(rectangle, 6);
                if (!isExiting)
                {
                    TextItem.doFontLabelToSize(dest, "LINK UNAVAILABLE", GuiData.titlefont, Utils.AddativeWhite);
                }
                var destinationRectangle1 = dest;
                destinationRectangle1.Y     += destinationRectangle1.Height - 20;
                destinationRectangle1.Height = 20;
                if (isExiting)
                {
                    break;
                }
                GuiData.spriteBatch.Draw(Utils.white, destinationRectangle1, Color.Black * 0.5f);
                if (
                    !Button.doButton(32711803, destinationRectangle1.X, destinationRectangle1.Y,
                                     destinationRectangle1.Width, destinationRectangle1.Height, "Exit", os.lockedColor))
                {
                    break;
                }
                isExiting = true;
                break;

            case SequencerExeState.AwaitingActivation:
                var height = 30;
                var destinationRectangle2 = new Rectangle(this.bounds.X + 1,
                                                          this.bounds.Y + this.bounds.Height / 2 - height, this.bounds.Width - 2, height * 2);
                spriteBatch.Draw(Utils.white, destinationRectangle2, Color.Black * 0.92f);
                if (
                    !Button.doButton(8310101, this.bounds.X + 10, this.bounds.Y + this.bounds.Height / 2 - height / 2,
                                     this.bounds.Width - 20, height, "ACTIVATE", os.highlightColor))
                {
                    break;
                }
                stateTimer             = 0.0f;
                state                  = SequencerExeState.SpinningUp;
                bars.MinLineChangeTime = 0.1f;
                bars.MaxLineChangeTime = 1f;
                originalTheme          = ThemeManager.currentTheme;
                MusicManager.FADE_TIME = 0.6f;
                oldSongName            = MusicManager.currentSongName;
                MusicManager.transitionToSong("Music\\Roller_Mobster_Clipped");
                MediaPlayer.IsRepeating = false;
                targetComp = Programs.getComputer(os, targetID);
                var webServerDaemon = (WebServerDaemon)targetComp.getDaemon(typeof(WebServerDaemon));
                if (webServerDaemon == null)
                {
                    break;
                }
                webServerDaemon.LoadWebPage("index.html");
                break;

            case SequencerExeState.SpinningUp:
                var bounds = rectangle;
                bounds.Height = (int)(bounds.Height * (stateTimer / (double)SPIN_UP_TIME));
                bounds.Y      = rectangle.Y + rectangle.Height - bounds.Height + 1;
                bounds.Width += 4;
                bars.Draw(spriteBatch, bounds, minHeight, 4f, 1f, os.brightLockedColor);
                break;

            case SequencerExeState.Active:
                spriteBatch.Draw(Utils.white, GetContentAreaDest(), Color.Black * 0.5f);
                TextItem.doFontLabelToSize(GetContentAreaDest(), " G O   G O   G O ", GuiData.titlefont,
                                           Color.Lerp(Utils.AddativeRed, os.brightLockedColor, Math.Min(1f, stateTimer / 2f)));
                DrawActiveState();
                break;
            }
        }
        public override void Draw(float t)
        {
            base.Draw(t);
            this.drawOutline();
            this.drawTarget("app:");
            Rectangle rectangle = Utils.InsetRectangle(this.GetContentAreaDest(), 1);
            float     amount    = this.os.warningFlashTimer / OS.WARNING_FLASH_TIME;
            float     minHeight = 2f;

            if ((double)amount > 0.0)
            {
                minHeight += amount * ((float)rectangle.Height - minHeight);
            }
            Color drawColor = Color.Lerp(Utils.AddativeWhite * 0.5f, Utils.AddativeRed, amount);

            this.bars.Draw(this.spriteBatch, this.GetContentAreaDest(), minHeight, 4f, 1f, drawColor);
            switch (this.state)
            {
            case ExtensionSequencerExe.SequencerExeState.Unavaliable:
                this.spriteBatch.Draw(Utils.white, rectangle, Color.Black * 0.5f);
                Rectangle dest = Utils.InsetRectangle(rectangle, 6);
                if (!this.isExiting)
                {
                    TextItem.doFontLabelToSize(dest, "LINK UNAVAILABLE", GuiData.titlefont, Utils.AddativeWhite, false, false);
                }
                Rectangle destinationRectangle1 = dest;
                destinationRectangle1.Y     += destinationRectangle1.Height - 20;
                destinationRectangle1.Height = 20;
                if (this.isExiting)
                {
                    break;
                }
                GuiData.spriteBatch.Draw(Utils.white, destinationRectangle1, Color.Black * 0.5f);
                if (Button.doButton(32711803, destinationRectangle1.X, destinationRectangle1.Y, destinationRectangle1.Width, destinationRectangle1.Height, LocaleTerms.Loc("Exit"), new Color?(this.os.lockedColor)))
                {
                    this.isExiting = true;
                }
                break;

            case ExtensionSequencerExe.SequencerExeState.AwaitingActivation:
                int       height = 30;
                Rectangle destinationRectangle2 = new Rectangle(this.bounds.X + 1, this.bounds.Y + this.bounds.Height / 2 - height, this.bounds.Width - 2, height * 2);
                this.spriteBatch.Draw(Utils.white, destinationRectangle2, Color.Black * 0.92f);
                if (!Button.doButton(8310101, this.bounds.X + 10, this.bounds.Y + this.bounds.Height / 2 - height / 2, this.bounds.Width - 20, height, LocaleTerms.Loc("ACTIVATE"), new Color?(this.os.highlightColor)))
                {
                    break;
                }
                if (this.os.TraceDangerSequence.IsActive)
                {
                    this.os.write("SEQUENCER ERROR: OS reports critical action already in progress.");
                }
                else
                {
                    this.stateTimer             = 0.0f;
                    this.state                  = ExtensionSequencerExe.SequencerExeState.SpinningUp;
                    this.bars.MinLineChangeTime = 0.1f;
                    this.bars.MaxLineChangeTime = 1f;
                    MusicManager.FADE_TIME      = 0.6f;
                    this.oldSongName            = MusicManager.currentSongName;
                    this.targetComp             = Programs.getComputer(this.os, this.targetID);
                    WebServerDaemon daemon = (WebServerDaemon)this.targetComp.getDaemon(typeof(WebServerDaemon));
                    if (daemon != null)
                    {
                        daemon.LoadWebPage("index.html");
                    }
                    RunnableConditionalActions.LoadIntoOS(ExtensionLoader.ActiveExtensionInfo.ActionsToRunOnSequencerStart, (object)this.os);
                }
                break;

            case ExtensionSequencerExe.SequencerExeState.SpinningUp:
                Rectangle bounds = rectangle;
                bounds.Height = (int)((double)bounds.Height * ((double)this.stateTimer / (double)ExtensionLoader.ActiveExtensionInfo.SequencerSpinUpTime));
                bounds.Y      = rectangle.Y + rectangle.Height - bounds.Height + 1;
                bounds.Width += 4;
                this.bars.Draw(this.spriteBatch, bounds, minHeight, 4f, 1f, this.os.brightLockedColor);
                break;

            case ExtensionSequencerExe.SequencerExeState.Active:
                this.spriteBatch.Draw(Utils.white, this.GetContentAreaDest(), Color.Black * 0.5f);
                TextItem.doFontLabelToSize(this.GetContentAreaDest(), " G O   G O   G O ", GuiData.titlefont, Color.Lerp(Utils.AddativeRed, this.os.brightLockedColor, Math.Min(1f, this.stateTimer / 2f)), false, false);
                this.DrawActiveState();
                break;
            }
        }
Exemple #26
0
 public static void runCommand(int value, string name)
 {
     assertOS();
     if (name.Equals("addRank"))
     {
         os.currentFaction.addValue(value, os);
         var mail = MailServer.generateEmail("Contract Successful",
             "Congratulations,\nThe client of your recent contract has reported a success, and is pleased with your work.\n" +
             "You are now free to accept further contracts from the contact database.\n" +
             "\nYour Current Ranking is " + os.currentFaction.getRank() + " of " +
             os.currentFaction.getMaxRank() + ".\n" + "\nThankyou,\n -" + os.currentFaction.name,
             os.currentFaction.name + " ReplyBot");
         ((MailServer) os.netMap.mailServer.getDaemon(typeof (MailServer))).addMail(mail, os.defaultUser.name);
     }
     else if (name.StartsWith("addFlags:"))
     {
         foreach (
             var flag in
                 name.Substring("addFlags:".Length)
                     .Split(Utils.commaDelim, StringSplitOptions.RemoveEmptyEntries))
             os.Flags.AddFlag(flag);
     }
     if (name.Equals("triggerThemeHackRevenge"))
         os.delayer.Post(ActionDelayer.Wait(5.0), () =>
         {
             var mail = MailServer.generateEmail("Are you Kidding me?",
                 "Seriously?\n\n" +
                 "You think you can just f**k with my stuff and leave without consequence? Did you think I wouldn't notice?\n" +
                 "\nDid you think I wouldn't FIND you!?\n" +
                 "\nYou're a pathetic scrit kiddie, you couldn't hack a f*****g honeypot without your precious buttons and scrollbars.\n" +
                 "\nSay goodbye to your x-server, idiot." + "\n\nNaix", "*****@*****.**");
             ((MailServer) os.netMap.mailServer.getDaemon(typeof (MailServer))).addMail(mail, os.defaultUser.name);
             os.delayer.Post(ActionDelayer.Wait(24.0), () =>
             {
                 try
                 {
                     HackerScriptExecuter.runScript("ThemeHack.txt", os);
                 }
                 catch (Exception ex)
                 {
                     if (!Settings.recoverFromErrorsSilently)
                         throw ex;
                     os.write("CAUTION: UNSYNDICATED OUTSIDE CONNECTION ATTEMPT");
                     os.write("RECOVERED FROM CONNECTION SUBTERFUGE SUCCESSFULLY");
                     Console.WriteLine("Critical error loading hacker script - aborting");
                 }
             });
         });
     else if (name.Equals("changeSong"))
     {
         switch (value)
         {
             case 2:
                 MusicManager.transitionToSong("Music\\The_Quickening");
                 break;
             case 3:
                 MusicManager.transitionToSong("Music\\TheAlgorithm");
                 break;
             case 4:
                 MusicManager.transitionToSong("Music\\Ryan3");
                 break;
             case 5:
                 MusicManager.transitionToSong("Music\\Bit(Ending)");
                 break;
             case 6:
                 MusicManager.transitionToSong("Music\\Rico_Puestel-Roja_Drifts_By");
                 break;
             case 7:
                 MusicManager.transitionToSong("Music\\out_run_the_wolves");
                 break;
             case 8:
                 MusicManager.transitionToSong("Music\\Irritations");
                 break;
             case 9:
                 MusicManager.transitionToSong("Music\\Broken_Boy");
                 break;
             case 10:
                 MusicManager.transitionToSong("Music\\Ryan10");
                 break;
             case 11:
                 MusicManager.transitionToSong("Music\\tetrameth");
                 break;
             default:
                 MusicManager.transitionToSong("Music\\Revolve");
                 break;
         }
     }
     else if (name.Equals("entropyEndMissionSetup"))
     {
         runCommand(3, "changeSong");
         var comp1 = findComp("corp0#IS");
         var comp2 = findComp("corp0#MF");
         var comp3 = findComp("corp0#BU");
         var fileEntry1 = new FileEntry(Computer.generateBinaryString(5000), "HacknetOS.rar");
         var fileEntry2 = new FileEntry(Computer.generateBinaryString(4000), "HacknetOS_Data.xnb");
         var fileEntry3 = new FileEntry(Computer.generateBinaryString(4000), "HacknetOS_Content.xnb");
         var folder1 = comp1.files.root.folders[2];
         folder1.files.Add(fileEntry1);
         folder1.files.Add(fileEntry2);
         folder1.files.Add(fileEntry3);
         var folder2 = comp2.files.root.folders[2];
         folder2.files.Add(fileEntry1);
         folder2.files.Add(fileEntry2);
         folder2.files.Add(fileEntry3);
         var fileEntry4 = new FileEntry(fileEntry1.data, fileEntry1.name + "_backup");
         var fileEntry5 = new FileEntry(fileEntry2.data, fileEntry2.name + "_backup");
         var fileEntry6 = new FileEntry(fileEntry3.data, fileEntry3.name + "_backup");
         var folder3 = comp3.files.root.folders[2];
         folder3.files.Add(fileEntry4);
         folder3.files.Add(fileEntry5);
         folder3.files.Add(fileEntry6);
         comp1.traceTime = Computer.BASE_TRACE_TIME*7.5f;
         comp3.traceTime = Computer.BASE_TRACE_TIME*7.5f;
         comp2.traceTime = Computer.BASE_TRACE_TIME*7.5f;
         comp2.portsNeededForCrack = 3;
         comp1.portsNeededForCrack = 2;
         comp3.portsNeededForCrack = 2;
         var folder4 = findComp("entropy01").files.root.folders[2];
         folder4.files.Add(new FileEntry(PortExploits.crackExeData[25], "SMTPoverflow.exe"));
         folder4.files.Add(new FileEntry(PortExploits.crackExeData[80], "WebServerWorm.exe"));
     }
     else if (name.Equals("entropyAddSMTPCrack"))
     {
         var f = findComp("entropy01").files.root.folders[2];
         f.files.Add(new FileEntry(PortExploits.crackExeData[25],
             Utils.GetNonRepeatingFilename("SMTPoverflow", ".exe", f)));
         os.saveGame();
     }
     else if (name.Equals("transitionToBitMissions"))
     {
         if (Settings.isDemoMode)
         {
             runCommand(6, "changeSong");
             if (Settings.isPressBuildDemo)
                 ComputerLoader.loadMission("Content/Missions/Demo/PressBuild/DemoMission01.xml");
             else
                 ComputerLoader.loadMission("Content/Missions/Demo/AvconDemo.xml");
         }
         else
             ComputerLoader.loadMission("Content/Missions/BitMission0.xml");
     }
     else if (name.Equals("entropySendCSECInvite"))
         os.delayer.Post(ActionDelayer.Wait(6.0),
             () => ComputerLoader.loadMission("Content/Missions/MainHub/Intro/Intro01.xml"));
     else if (name.Equals("hubBitSetComplete01"))
     {
         os.delayer.Post(ActionDelayer.Wait(4.0), () => runCommand(1, "addRank"));
         runCommand(3, "changeSong");
         os.Flags.AddFlag("csecBitSet01Complete");
     }
     else if (name.Equals("enTechEnableOfflineBackup"))
     {
         var computer = Programs.getComputer(os, "EnTechOfflineBackup");
         Programs.getComputer(os, "EnTechMainframe").links.Add(os.netMap.nodes.IndexOf(computer));
         os.Flags.AddFlag("VaporSequencerEnabled");
         var folder1 = findComp("mainHubAssets").files.root.searchForFolder("bin");
         var folder2 = folder1.searchForFolder("Sequencer");
         if (folder2 == null)
         {
             folder2 = new Folder("Sequencer");
             folder1.folders.Add(folder2);
         }
         if (folder2.searchForFile("Sequencer.exe") != null)
             return;
         folder2.files.Add(new FileEntry(PortExploits.crackExeData[17], "Sequencer.exe"));
     }
     else if (name.Equals("rudeNaixResponse"))
         AchievementsManager.Unlock("rude_response", false);
     else if (name.Equals("assignPlayerToHubServerFaction"))
     {
         os.allFactions.setCurrentFaction("hub", os);
         var computer = Programs.getComputer(os, "mainHub");
         var missionHubServer = (MissionHubServer) computer.getDaemon(typeof (MissionHubServer));
         var userDetail = new UserDetail(os.defaultUser.name, "reptile", 3);
         computer.addNewUser(computer.ip, userDetail);
         missionHubServer.addUser(userDetail);
         os.homeNodeID = "mainHub";
         os.homeAssetServerID = "mainHubAssets";
         runCommand(3, "changeSong");
         os.Flags.AddFlag("CSEC_Member");
         AchievementsManager.Unlock("progress_csec", false);
     }
     else if (name.Equals("assignPlayerToEntropyFaction"))
     {
         runCommand(6, "changeSong");
         AchievementsManager.Unlock("progress_entropy", false);
     }
     else if (name.Equals("assignPlayerToLelzSec"))
     {
         os.homeNodeID = "lelzSecHub";
         os.homeAssetServerID = "lelzSecHub";
         os.Flags.AddFlag("LelzSec_Member");
         AchievementsManager.Unlock("progress_lelz", false);
     }
     else if (name.Equals("lelzSecVictory"))
         AchievementsManager.Unlock("secret_path_complete", false);
     else if (name.Equals("demoFinalMissionEnd"))
     {
         os.exes.Clear();
         PostProcessor.EndingSequenceFlashOutActive = true;
         PostProcessor.EndingSequenceFlashOutPercentageComplete = 1f;
         MusicManager.stop();
         os.delayer.Post(ActionDelayer.Wait(0.2),
             () => os.content.Load<SoundEffect>("Music/Ambient/spiral_gauge_down").Play());
         os.delayer.Post(ActionDelayer.Wait(3.0), () =>
         {
             PostProcessor.dangerModeEnabled = false;
             PostProcessor.dangerModePercentComplete = 0.0f;
             os.ExitScreen();
             os.ScreenManager.AddScreen(new DemoEndScreen());
         });
     }
     else if (name.Equals("demoFinalMissionStart"))
     {
         os.Flags.AddFlag("DemoSequencerEnabled");
         MusicManager.transitionToSong("Music/Ambient/dark_drone_008");
     }
     else if (name.Equals("CSECTesterGameWorldSetup"))
     {
         for (var index = 0; index < PortExploits.services.Count && index < 4; ++index)
             os.thisComputer.files.root.folders[2].files.Add(
                 new FileEntry(PortExploits.crackExeData[PortExploits.portNums[index]],
                     PortExploits.cracks[PortExploits.portNums[index]]));
         for (var index = 0; index < 4; ++index)
         {
             var c = new Computer("DebugShell" + index, NetworkMap.generateRandomIP(),
                 os.netMap.getRandomPosition(), 0, 2, os);
             c.adminIP = os.thisComputer.adminIP;
             os.netMap.nodes.Add(c);
             os.netMap.discoverNode(c);
         }
         os.delayer.Post(ActionDelayer.Wait(0.2), () =>
         {
             os.allFactions.setCurrentFaction("entropy", os);
             os.currentMission = null;
             os.netMap.discoverNode(Programs.getComputer(os, "entropy00"));
             os.netMap.discoverNode(Programs.getComputer(os, "entropy01"));
         });
     }
     else if (name.Equals("EntropyFastFowardSetup"))
     {
         os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22],
             PortExploits.cracks[22]));
         os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21],
             PortExploits.cracks[21]));
         for (var index = 0; index < 3; ++index)
         {
             var c = new Computer("DebugShell" + index, NetworkMap.generateRandomIP(),
                 os.netMap.getRandomPosition(), 0, 2, os);
             c.adminIP = os.thisComputer.adminIP;
             os.netMap.nodes.Add(c);
             os.netMap.discoverNode(c);
         }
         os.delayer.Post(ActionDelayer.Wait(0.2), () =>
         {
             os.allFactions.setCurrentFaction("entropy", os);
             os.currentMission = null;
             os.netMap.discoverNode(Programs.getComputer(os, "entropy00"));
             os.netMap.discoverNode(Programs.getComputer(os, "entropy01"));
             var computer = Programs.getComputer(os, "entropy01");
             var userDetail = computer.users[0];
             userDetail.known = true;
             computer.users[0] = userDetail;
             os.allFactions.factions[os.allFactions.currentFaction].playerValue = 2;
             os.delayer.Post(ActionDelayer.Wait(0.2), () =>
             {
                 os.Flags.AddFlag("eosPathStarted");
                 ComputerLoader.loadMission(
                     "Content/Missions/Entropy/StartingSet/eosMissions/eosIntroDelayer.xml");
             });
         });
     }
     else if (name.Equals("CSECFastFowardSetup"))
     {
         os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22],
             PortExploits.cracks[22]));
         os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21],
             PortExploits.cracks[21]));
         for (var index = 0; index < 3; ++index)
         {
             var c = new Computer("DebugShell" + index, NetworkMap.generateRandomIP(),
                 os.netMap.getRandomPosition(), 0, 2, os);
             c.adminIP = os.thisComputer.adminIP;
             os.netMap.nodes.Add(c);
             os.netMap.discoverNode(c);
         }
         os.delayer.Post(ActionDelayer.Wait(0.2), () =>
         {
             runCommand(0, "assignPlayerToHubServerFaction");
             os.currentMission = null;
             os.netMap.discoverNode(Programs.getComputer(os, "mainHub"));
             os.netMap.discoverNode(Programs.getComputer(os, "mainHubAssets"));
             var computer = Programs.getComputer(os, "mainHubAssets");
             var userDetail = computer.users[0];
             userDetail.known = true;
             computer.users[0] = userDetail;
         });
     }
     else if (name.Equals("csecAddTraceKill"))
     {
         var folder = findComp("mainHubAssets").files.root.searchForFolder("bin");
         var f = folder.searchForFolder("TK");
         if (f == null)
         {
             f = new Folder("TK");
             folder.folders.Add(f);
         }
         f.files.Add(
             new FileEntry(
                 FileEncrypter.EncryptString(PortExploits.crackExeData[12], "Vapor Trick Enc.", "NULL", "dx122DX",
                     ".exe"), Utils.GetNonRepeatingFilename("TraceKill", ".dec", f)));
         os.Flags.AddFlag("bitPathStarted");
         runCommand(10, "changeSong");
     }
     else if (name.Equals("junebugComplete"))
     {
         var computer = Programs.getComputer(os, "pacemaker01");
         if (computer != null)
         {
             var heartMonitorDaemon = (HeartMonitorDaemon) computer.getDaemon(typeof (HeartMonitorDaemon));
             if (heartMonitorDaemon != null)
                 heartMonitorDaemon.ForceStopBeepSustainSound();
         }
         runCommand(1, "addRank");
     }
     else if (name.Equals("eosIntroMissionSetup"))
     {
         findComp("entropy01")
             .files.root.searchForFolder("bin")
             .files.Add(new FileEntry(PortExploits.crackExeData[13], "eosDeviceScan.exe"));
         os.delayer.Post(ActionDelayer.Wait(8.0), () =>
         {
             var mail = MailServer.generateEmail("Fwd: eOS Stuff",
                 Utils.readEntireFile("Content/Post/eosScannerMail.txt"), "vtfx", new List<string>(new string[1]
                 {
                     "note#%#eOS Security Basics#%#" +
                     ("1: Get admin access to a computer that you suspect has an eOS device sync'd to it\n" +
                      "2: Run eosdevicescanner.exe\nto scan for paired devices and automatically open connection ports\n" +
                      "3: connect to the revealed device\n" +
                      "3: login with\nuser: \"admin\"\npassword: \"alpine\"\n\n" +
                      "The password is the same for all eOS devices!")
                 }));
             ((MailServer) os.netMap.mailServer.getDaemon(typeof (MailServer))).addMail(mail, os.defaultUser.name);
         });
         runCommand(4, "changeSong");
         os.saveGame();
     }
     else
     {
         if (!name.Equals("eosIntroEndFunc"))
             return;
         runCommand(1, "addRank");
         var missionListingServer =
             (MissionListingServer) findComp("entropy00").getDaemon(typeof (MissionListingServer));
         var list = os.branchMissions;
         var m =
             (ActiveMission)
                 ComputerLoader.readMission(
                     "Content/Missions/Entropy/StartingSet/eosMissions/eosAddedMission.xml");
         missionListingServer.addMisison(m);
         os.branchMissions = list;
     }
 }
Exemple #27
0
        public void doRespondDisplay(Rectangle bounds, SpriteBatch sb)
        {
            Vector2 pos   = new Vector2((float)(bounds.X + 2), (float)(bounds.Y + 20));
            string  str   = (string)null;
            int     width = bounds.Width - 20 - this.corner.Width;

            if (Button.doButton(800007, (int)pos.X, (int)pos.Y, width, 30, LocaleTerms.Loc("Return to Inbox"), new Color?(this.os.darkBackgroundColor)))
            {
                this.state = 3;
            }
            pos.Y += 50f;
            int num1 = 24;

            TextItem.doFontLabel(pos, LocaleTerms.Loc("Additional Details") + " :", GuiData.smallfont, new Color?(), (float)bounds.Width - (float)(((double)pos.X - (double)bounds.Width) * 1.20000004768372), float.MaxValue, false);
            pos.Y += (float)num1;
            for (int index = 0; index < this.emailReplyStrings.Count; ++index)
            {
                TextItem.doFontLabel(pos + new Vector2(25f, 0.0f), this.emailReplyStrings[index], GuiData.tinyfont, new Color?(), (float)((double)bounds.Width - ((double)pos.X - (double)bounds.X) * 2.0 - 20.0), float.MaxValue, false);
                float num2 = Math.Min(GuiData.tinyfont.MeasureString(this.emailReplyStrings[index]).X, (float)((double)bounds.Width - ((double)pos.X - (double)bounds.X) * 2.0 - 20.0));
                if (Button.doButton(80000 + index * 100, (int)((double)pos.X + (double)num2 + 30.0), (int)pos.Y, 20, 20, "-", new Color?()))
                {
                    this.emailReplyStrings.RemoveAt(index);
                }
                pos.Y += (float)num1;
            }
            if (this.addingNewReplyString)
            {
                string data             = (string)null;
                bool   getStringCommand = Programs.parseStringFromGetStringCommand(this.os, out data);
                if (data == null)
                {
                    data = "";
                }
                pos.Y += 5f;
                GuiData.spriteBatch.Draw(Utils.white, new Rectangle(bounds.X + 1, (int)pos.Y, bounds.Width - 2 - bounds.Width / 9, 40), this.os.indentBackgroundColor);
                pos.Y += 10f;
                TextItem.doFontLabel(pos + new Vector2(25f, 0.0f), data, GuiData.tinyfont, new Color?(), float.MaxValue, float.MaxValue, false);
                Vector2 vector2 = GuiData.tinyfont.MeasureString(data);
                vector2.Y = 0.0f;
                if ((double)this.os.timer % 1.0 <= 0.5)
                {
                    GuiData.spriteBatch.Draw(Utils.white, new Rectangle((int)((double)pos.X + (double)vector2.X + 2.0) + 25, (int)pos.Y, 4, 20), Color.White);
                }
                int num2 = bounds.Width - 1 - bounds.Width / 10;
                if (getStringCommand || Button.doButton(8000094, bounds.X + num2 - 4, (int)pos.Y - 10, bounds.Width / 9 - 3, 40, LocaleTerms.Loc("Add"), new Color?(this.os.highlightColor)))
                {
                    if (!getStringCommand)
                    {
                        this.os.terminal.executeLine();
                    }
                    this.addingNewReplyString = false;
                    this.emailReplyStrings.Add(data);
                    str = (string)null;
                }
                else
                {
                    str = data;
                }
            }
            else if (Button.doButton(8000098, (int)((double)pos.X + 25.0), (int)pos.Y, 20, 20, "+", new Color?()))
            {
                this.addingNewReplyString = true;
                this.os.execute("getString Detail");
                this.os.terminal.executionPreventionIsInteruptable = true;
            }
            pos.Y += 50f;
            if (Button.doButton(800008, (int)pos.X, (int)pos.Y, width, 30, LocaleTerms.Loc("Send"), new Color?()) && this.os.currentMission != null)
            {
                if (str != null)
                {
                    this.os.terminal.executeLine();
                    this.addingNewReplyString = false;
                    if (!string.IsNullOrEmpty(str))
                    {
                        this.emailReplyStrings.Add(str);
                    }
                }
                ActiveMission currentMission = this.os.currentMission;
                bool          flag           = this.attemptCompleteMission(this.os.currentMission);
                if (!flag)
                {
                    for (int index = 0; index < this.os.branchMissions.Count && !flag; ++index)
                    {
                        flag = this.attemptCompleteMission(this.os.branchMissions[index]);
                        if (flag)
                        {
                            this.os.branchMissions.Clear();
                        }
                    }
                }
                if (!flag)
                {
                    this.missionIncompleteReply = true;
                }
                else
                {
                    this.AddSentEmailRecordFileForMissionCompletion(currentMission, this.emailReplyStrings);
                }
            }
            pos.Y += 45f;
            if (Settings.forceCompleteEnabled && Button.doButton(800009, (int)pos.X, (int)pos.Y, width, 30, LocaleTerms.Loc("Force Complete"), new Color?()))
            {
                if (this.os.currentMission != null)
                {
                    this.os.currentMission.finish();
                    this.os.MissionCompleteFlashTime = 3f;
                }
                this.state = 3;
            }
            pos.Y += 70f;
            if (!this.missionIncompleteReply || !(this.comp.idName == "jmail"))
            {
                return;
            }
            PatternDrawer.draw(new Rectangle(bounds.X + 2, (int)pos.Y, bounds.Width - 4, 128), 1f, this.os.lockedColor * 0.1f, this.os.brightLockedColor, sb, PatternDrawer.errorTile);
            string  text      = LocaleTerms.Loc("Mission Incomplete");
            Vector2 vector2_1 = GuiData.font.MeasureString(text);

            TextItem.doLabel(new Vector2((float)(bounds.X + bounds.Width / 2) - vector2_1.X / 2f, pos.Y + 40f), text, new Color?());
        }
Exemple #28
0
        public void doTabComplete()
        {
            var list1 = new List <string>();

            if (currentLine.Length == 0)
            {
                return;
            }
            var length1 = currentLine.IndexOf(' ');

            if (length1 >= 1)
            {
                var path = currentLine.Substring(length1 + 1);
                var str1 = currentLine.Substring(0, length1);
                if (path == null || (path.Equals("") || path.Length < 1) && !str1.Equals("exe"))
                {
                    return;
                }
                if (str1.Equals("upload") || str1.Equals("up"))
                {
                    var length2 = path.LastIndexOf('/');
                    if (length2 < 0)
                    {
                        length2 = 0;
                    }
                    var str2 = path.Substring(0, length2) + "/";
                    if (str2.StartsWith("/"))
                    {
                        str2 = str2.Substring(1);
                    }
                    var str3   = path.Substring(length2 + (length2 == 0 ? 0 : 1));
                    var folder = Programs.getFolderAtPathAsFarAsPossible(path, os, os.thisComputer.files.root) ??
                                 os.thisComputer.files.root;
                    for (var index = 0; index < folder.folders.Count; ++index)
                    {
                        if (folder.folders[index].name.StartsWith(str3, StringComparison.InvariantCultureIgnoreCase))
                        {
                            list1.Add(str1 + " " + str2 + folder.folders[index].name + "/");
                        }
                    }
                    for (var index = 0; index < folder.files.Count; ++index)
                    {
                        if (folder.files[index].name.StartsWith(str3))
                        {
                            list1.Add(str1 + " " + str2 + folder.files[index].name);
                        }
                    }
                }
                else
                {
                    var currentFolder = Programs.getCurrentFolder(os);
                    for (var index = 0; index < currentFolder.folders.Count; ++index)
                    {
                        if (currentFolder.folders[index].name.StartsWith(path,
                                                                         StringComparison.InvariantCultureIgnoreCase))
                        {
                            list1.Add(str1 + " " + currentFolder.folders[index].name + "/");
                        }
                    }
                    for (var index = 0; index < currentFolder.files.Count; ++index)
                    {
                        if (currentFolder.files[index].name.StartsWith(path, StringComparison.InvariantCultureIgnoreCase))
                        {
                            list1.Add(str1 + " " + currentFolder.files[index].name);
                        }
                    }
                    if (list1.Count == 0)
                    {
                        for (var index = 0; index < currentFolder.files.Count; ++index)
                        {
                            if (currentFolder.files[index].name.StartsWith(path,
                                                                           StringComparison.InvariantCultureIgnoreCase))
                            {
                                list1.Add(str1 + " " + currentFolder.files[index].name);
                            }
                        }
                    }
                }
            }
            else
            {
                var list2 = new List <string>();
                list2.AddRange(ProgramList.programs);
                list2.AddRange(ProgramList.getExeList(os));
                for (var index = 0; index < list2.Count; ++index)
                {
                    if (list2[index].ToLower().StartsWith(currentLine.ToLower()))
                    {
                        list1.Add(list2[index]);
                    }
                }
            }
            if (list1.Count == 1)
            {
                currentLine = list1[0];
                TextBox.moveCursorToEnd(currentLine);
            }
            else
            {
                if (list1.Count <= 1)
                {
                    return;
                }
                os.write(prompt + currentLine);
                var str = list1[0];
                for (var index = 0; index < list1.Count; ++index)
                {
                    os.write(list1[index]);
                    for (var length2 = 0; length2 < str.Length; ++length2)
                    {
                        if (list1[index].Length <= length2 || str[length2] != list1[index][length2])
                        {
                            str = str.Substring(0, length2);
                            break;
                        }
                    }
                    currentLine = str;
                    TextBox.moveCursorToEnd(currentLine);
                }
            }
        }