Esempio n. 1
0
        public void RemoveMissionFromListings(string missionFilename)
        {
            List <ActiveMission> branchMissions = this.os.branchMissions;
            ActiveMission        activeMission  = (ActiveMission)ComputerLoader.readMission(Utils.GetFileLoadPrefix() + missionFilename);
            string key = (string)null;

            foreach (KeyValuePair <string, ActiveMission> listingMission in this.listingMissions)
            {
                if (listingMission.Value.reloadGoalsSourceFile == activeMission.reloadGoalsSourceFile)
                {
                    key = listingMission.Key;
                    break;
                }
            }
            if (key != null)
            {
                this.listingMissions.Remove(key);
                for (int index = 0; index < this.listingsFolder.files.Count; ++index)
                {
                    if (this.listingsFolder.files[index].name.Contains("#" + key))
                    {
                        this.listingsFolder.files.RemoveAt(index);
                        --index;
                    }
                }
            }
            this.os.branchMissions = branchMissions;
        }
Esempio n. 2
0
        public override void loadInit()
        {
            base.loadInit();
            this.root                 = this.comp.files.root.searchForFolder("MsgBoard");
            this.missionFolder        = this.root.searchForFolder("listings");
            this.closedMissionsFolder = this.root.searchForFolder("closed");
            if (this.closedMissionsFolder == null)
            {
                this.closedMissionsFolder = new Folder("closed");
                this.root.folders.Add(this.closedMissionsFolder);
            }
            int num;

            if (!this.missionAssigner)
            {
                for (int index = 0; index < this.missionFolder.files.Count; ++index)
                {
                    try
                    {
                        string str  = this.missionFolder.files[index].name.Replace("_", " ");
                        string data = this.missionFolder.files[index].data;
                        this.missions.Add(new ActiveMission((List <MisisonGoal>)null, (string)null, new MailServer.EMailData())
                        {
                            postingTitle = str,
                            postingBody  = data
                        });
                    }
                    catch (Exception ex)
                    {
                        num = 0 + 1;
                    }
                }
            }
            else
            {
                List <ActiveMission> branchMissions = this.os.branchMissions;
                for (int index = 0; index < this.missionFolder.files.Count; ++index)
                {
                    try
                    {
                        string data = this.missionFolder.files[index].data;
                        int    contractRegistryNumber = 0;
                        this.os.branchMissions.Clear();
                        ActiveMission        activeMission     = (ActiveMission)MissionSerializer.restoreMissionFromFile(data, out contractRegistryNumber);
                        List <ActiveMission> activeMissionList = new List <ActiveMission>();
                        activeMissionList.AddRange((IEnumerable <ActiveMission>) this.os.branchMissions.ToArray());
                        this.branchMissions.Add(activeMissionList);
                        this.missions.Add(activeMission);
                    }
                    catch (Exception ex)
                    {
                        num = 0 + 1;
                    }
                }
                this.os.branchMissions = branchMissions;
            }
        }
Esempio n. 3
0
        public static object generate(int secutiryLevel)
        {
            int type = 0;

            if (secutiryLevel <= 3)
            {
                type = 0;
            }
            else
            {
                type = 0;
                if (Utils.flipCoin())
                {
                    type = 1;
                }
            }
            int    index    = (int)((double)(MissionGenerator.MissionLists[type].Count - 1) * Utils.random.NextDouble() + 0.5);
            string filename = MissionGenerator.MissionLists[type][index];

            MissionGenerator.customKeysWereSet     = false;
            MissionGenerationParser.Client         = NameGenerator.generateName();
            MissionGenerationParser.Other          = "Unknown";
            MissionGenerationParser.Target         = NameGenerator.generateName();
            ComputerLoader.MissionPreLoadComplete += (Action)(() =>
            {
                Computer computer1 = (Computer)MissionGenerator.generateComputer(secutiryLevel, MissionGenerationParser.Target);
                Computer computer2;
                switch (type)
                {
                case 1:
                    computer2 = MissionGenerator.addWebsiteChangeRequirements(computer1, OS.currentInstance);
                    break;

                default:
                    computer2 = MissionGenerator.addFileDeletionRequirements(computer1, OS.currentInstance);
                    break;
                }
                computer2.idName = "Gen" + (object)MissionGenerator.generationCount;
                MissionGenerationParser.Comp = computer2.idName;
                OS.currentInstance.netMap.nodes.Add(computer2);
            });
            ActiveMission activeMission = (ActiveMission)ComputerLoader.readMission(filename);

            ComputerLoader.MissionPreLoadComplete = (Action)null;
            activeMission.wasAutoGenerated        = true;
            activeMission.genTarget     = MissionGenerationParser.Comp;
            activeMission.genPath       = MissionGenerationParser.Path;
            activeMission.genFile       = MissionGenerationParser.File;
            activeMission.client        = MissionGenerationParser.Client;
            activeMission.genTargetName = MissionGenerationParser.Target;
            activeMission.genOther      = MissionGenerationParser.Other;
            ++MissionGenerator.generationCount;
            return((object)activeMission);
        }
Esempio n. 4
0
 private bool attemptCompleteMission(ActiveMission mission)
 {
     if (!mission.isComplete(this.emailReplyStrings) || !mission.ShouldIgnoreSenderVerification && !(mission.email.sender == this.emailData[1]))
     {
         return(false);
     }
     mission.finish();
     this.state = 3;
     this.os.MissionCompleteFlashTime = 3f;
     return(true);
 }
        public void addMisison(ActiveMission m)
        {
            var dataEntry = m.postingBody;

            if (missionAssigner)
            {
                dataEntry = MissionSerializer.generateMissionFile(m, 0, groupName);
            }
            missionFolder.files.Add(new FileEntry(dataEntry, m.postingTitle));
            missions.Add(m);
            branchMissions.Add(os.branchMissions);
        }
Esempio n. 6
0
        private void doContractPreviewScreen(Rectangle bounds, SpriteBatch sb)
        {
            string stringForContractFile = this.getIDStringForContractFile(this.listingsFolder.files[this.selectedElementIndex]);

            if (!this.listingMissions.ContainsKey(stringForContractFile))
            {
                return;
            }
            ActiveMission listingMission = this.listingMissions[stringForContractFile];
            Vector2       vector2        = new Vector2((float)(bounds.X + 20), (float)(bounds.Y + 20));

            TextItem.doFontLabel(vector2 + new Vector2((float)this.getTransitionOffset(0), 0.0f), "CONTRACT:" + stringForContractFile, GuiData.titlefont, new Color?(), (float)(bounds.Width / 2), 40f, false);
            vector2.Y += 40f;
            TextItem.doFontLabel(vector2 + new Vector2((float)this.getTransitionOffset(1), 0.0f), listingMission.postingTitle.Replace("#", ""), GuiData.font, new Color?(), (float)(bounds.Width - 30), float.MaxValue, false);
            vector2.Y += 30f;
            string        str           = DisplayModule.cleanSplitForWidth(listingMission.postingBody, bounds.Width - 110);
            StringBuilder stringBuilder = new StringBuilder();
            int           num1          = (int)((double)(((float)bounds.Width - 20f) / GuiData.smallfont.MeasureString("-").X) / 2.0);

            for (int index = 1; index < num1 - 5; ++index)
            {
                stringBuilder.Append("-");
            }
            string text = str.Replace("###", stringBuilder.ToString());

            if (LocaleActivator.ActiveLocaleIsCJK())
            {
                text       = Utils.SuperSmartTwimForWidth(listingMission.postingBody, bounds.Width - 110, GuiData.smallfont);
                vector2.Y += 20f;
            }
            TextItem.doFontLabel(vector2 + new Vector2((float)this.getTransitionOffset(2), 0.0f), text, GuiData.smallfont, new Color?(), (float)(bounds.Width - 20), float.MaxValue, false);
            int num2 = Math.Max(135, bounds.Height / 6);

            if (Button.doButton(2171618, bounds.X + 20 + this.getTransitionOffset(3), bounds.Y + bounds.Height - num2, bounds.Width / 5, 30, LocaleTerms.Loc("Back"), new Color?()))
            {
                this.state            = MissionHubServer.HubState.Listing;
                this.screenTransition = 1f;
            }
            if (this.os.currentMission == null)
            {
                if (Button.doButton(2171615, bounds.X + 20 + this.getTransitionOffset(4), bounds.Y + bounds.Height - num2 - 40, bounds.Width / 5, 30, LocaleTerms.Loc("Accept"), new Color?(this.os.highlightColor)))
                {
                    this.acceptMission(listingMission, this.selectedElementIndex, stringForContractFile);
                    this.state            = MissionHubServer.HubState.Listing;
                    this.screenTransition = 1f;
                }
            }
            else
            {
                TextItem.doFontLabelToSize(new Rectangle(bounds.X + 20 + this.getTransitionOffset(4), bounds.Y + bounds.Height - num2 - 40, bounds.Width / 2, 30), LocaleTerms.Loc("Abort current contract to accept new ones."), GuiData.smallfont, Color.White, false, false);
            }
        }
Esempio n. 7
0
        private void acceptMission(ActiveMission mission, int index, string id)
        {
            this.os.currentMission = mission;
            ActiveMission activeMission = (ActiveMission)ComputerLoader.readMission(mission.reloadGoalsSourceFile);

            mission.sendEmail(this.os);
            mission.ActivateSuppressedStartFunctionIfPresent();
            FileEntry file = this.listingsFolder.files[index];

            this.listingsFolder.files.RemoveAt(index);
            this.listingArchivesFolder.files.Add(new FileEntry("Contract Archive:\nAccepted : " + DateTime.Now.ToString() + "\nUser : "******"\nActive Since : " + this.activeUserLoginTime.ToString() + "\n\n" + file.data, "Contract#" + id + "Archive"));
            this.listingMissions.Remove(id);
        }
Esempio n. 8
0
        private void addMission(ActiveMission mission, bool insertAtTop = false)
        {
            contractRegistryNumber += Utils.getRandomByte() + 1;
            listingMissions.Add(string.Concat(contractRegistryNumber), mission);
            var fileEntry = new FileEntry(
                MissionSerializer.generateMissionFile(mission, contractRegistryNumber, "CSEC"),
                "Contract#" + contractRegistryNumber);

            if (insertAtTop)
            {
                listingsFolder.files.Insert(0, fileEntry);
            }
            else
            {
                listingsFolder.files.Add(fileEntry);
            }
        }
Esempio n. 9
0
        private void addMission(ActiveMission mission, bool insertAtTop = false, bool preventRegistryNumberChange = false, int desiredInsertionIndex = -1)
        {
            if (insertAtTop && desiredInsertionIndex <= -1)
            {
                desiredInsertionIndex = 0;
            }
            this.contractRegistryNumber += (int)Utils.getRandomByte() + 1;
            this.listingMissions.Add(string.Concat((object)this.contractRegistryNumber), mission);
            FileEntry fileEntry = new FileEntry(MissionSerializer.generateMissionFile((object)mission, this.contractRegistryNumber, "CSEC", (string)null), "Contract#" + (object)this.contractRegistryNumber);

            if (desiredInsertionIndex < this.listingsFolder.files.Count && (insertAtTop || desiredInsertionIndex >= 0))
            {
                this.listingsFolder.files.Insert(desiredInsertionIndex, fileEntry);
            }
            else
            {
                this.listingsFolder.files.Add(fileEntry);
            }
        }
Esempio n. 10
0
        public void addMisison(ActiveMission m, bool injectToTop = false)
        {
            string dataEntry = m.postingBody;

            if (this.missionAssigner)
            {
                dataEntry = MissionSerializer.generateMissionFile((object)m, 0, this.groupName, (string)null);
            }
            FileEntry fileEntry = new FileEntry(dataEntry, m.postingTitle);

            if (injectToTop)
            {
                this.missionFolder.files.Insert(0, fileEntry);
                this.missions.Insert(0, m);
                this.branchMissions.Insert(0, this.os.branchMissions);
            }
            else
            {
                this.missionFolder.files.Add(fileEntry);
                this.missions.Add(m);
                this.branchMissions.Add(this.os.branchMissions);
            }
        }
Esempio n. 11
0
 private void StartAssignment()
 {
     if (!this.AllAssignmentsComplete)
     {
         if (this.IsOnAssignment1)
         {
             this.PhaseTitle    = "74.125.23.121";
             this.PhaseSubtitle = LocaleTerms.Loc("Download Tools") + "\n" + LocaleTerms.Loc("Delete System Files");
         }
         else
         {
             this.PhaseTitle    = "216.239.32.181";
             this.PhaseSubtitle = LocaleTerms.Loc("Adapt") + "\n" + LocaleTerms.Loc("Advance");
         }
         this.State           = this.IsOnAssignment1 ? DLCIntroExe.IntroState.OnMission1 : DLCIntroExe.IntroState.OnMission2;
         this.TimeInThisState = 0.0f;
         this.LoadedMission   = (ActiveMission)ComputerLoader.readMission(this.IsOnAssignment1 ? this.assignment1MissionPath : this.assignment2MissionPath);
     }
     else
     {
         this.CompleteExecution();
     }
 }
Esempio n. 12
0
 private void AddSentEmailRecordFileForMissionCompletion(ActiveMission mission, List <string> additionalDetails)
 {
     try
     {
         Folder folder = this.userFolder.searchForFolder("sent");
         string body   = mission.email.subject + " completed.";
         if (additionalDetails != null && additionalDetails.Count > 0)
         {
             body += "\nRequested Details:\n";
             for (int index = 0; index < additionalDetails.Count; ++index)
             {
                 body = body + additionalDetails[index] + "\n";
             }
         }
         string    email     = MailServer.generateEmail(mission.email.subject + " : Complete", body, this.user.name + "@" + this.comp.name);
         string    subject   = MailServer.getSubject(email);
         FileEntry fileEntry = new FileEntry(email, subject);
         folder.files.Add(fileEntry);
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 13
0
        private void doListingScreen(Rectangle bounds, SpriteBatch sb)
        {
            bool drawShadow = TextItem.DrawShadow;

            TextItem.DrawShadow = false;
            Rectangle rectangle1 = this.doListingScreenBackground(bounds, sb);
            Rectangle rectangle2 = new Rectangle(bounds.X + 10, rectangle1.Y, bounds.Width / 2, 30);
            int       height     = 36;

            for (int index = this.missionListPageNumber * this.missionListDisplayed; index < this.listingsFolder.files.Count && rectangle2.Y + height < rectangle1.Y + rectangle1.Height; ++index)
            {
                string stringForContractFile = this.getIDStringForContractFile(this.listingsFolder.files[index]);
                if (this.listingMissions.ContainsKey(stringForContractFile))
                {
                    ActiveMission listingMission = this.listingMissions[stringForContractFile];
                    if (listingMission == null)
                    {
                        Console.WriteLine("Mission: " + stringForContractFile + " is null! There is an error in one of your mission files preventing draw");
                    }
                    else
                    {
                        this.drawMissionEntry(new Rectangle(bounds.X + 1, rectangle2.Y, bounds.Width - 2, height), sb, listingMission, index);
                        rectangle2.Y += height;
                    }
                }
            }
            int num = 0;

            rectangle2 = new Rectangle(bounds.X + 10, rectangle1.Y, bounds.Width / 2, 30);
            while (rectangle2.Y + height < rectangle1.Y + rectangle1.Height)
            {
                rectangle2.Y += height;
                ++num;
            }
            this.missionListDisplayed = num;
            TextItem.DrawShadow       = drawShadow;
        }
Esempio n. 14
0
        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");
                }
            }
        }
Esempio n. 15
0
 private void drawMissionEntry(Rectangle bounds, SpriteBatch sb, ActiveMission mission, int index)
 {
     var flag1 = false;
     if (mission.postingAcceptFlagRequirements != null)
     {
         for (var index1 = 0; index1 < mission.postingAcceptFlagRequirements.Length; ++index1)
         {
             if (!os.Flags.HasFlag(mission.postingAcceptFlagRequirements[index1]))
                 flag1 = true;
         }
     }
     var myID = index*139284 + 984275 + index;
     var flag2 = Button.outlineOnly;
     var flag3 = Button.drawingOutline;
     Button.outlineOnly = true;
     Button.drawingOutline = false;
     if (GuiData.active == myID)
         sb.Draw(Utils.white, bounds, Color.Black);
     else if (GuiData.hot == myID)
     {
         sb.Draw(Utils.white, bounds, themeColor*0.12f);
     }
     else
     {
         var color = index%2 == 0 ? themeColorLine : themeColorBackground;
         if (flag1)
             color = Color.Lerp(color, Color.Gray, 0.25f);
         sb.Draw(Utils.white, bounds, color);
     }
     if (flag1)
     {
         var destinationRectangle = bounds;
         destinationRectangle.Height -= 6;
         destinationRectangle.Y += 3;
         destinationRectangle.X += bounds.Width - bounds.Height - 6;
         destinationRectangle.Width = destinationRectangle.Height;
         sb.Draw(lockIcon, destinationRectangle, Color.White*0.2f);
     }
     if (!flag1 && Button.doButton(myID, bounds.X, bounds.Y, bounds.Width, bounds.Height, "", Color.Transparent))
     {
         selectedElementIndex = index;
         state = HubState.ContractPreview;
         screenTransition = 1f;
     }
     var text1 = mission.postingTitle ?? "";
     TextItem.doFontLabel(new Vector2(bounds.X + 1 + getTransitionOffset(index), bounds.Y + 3), text1,
         GuiData.smallfont, Color.White, bounds.Width, float.MaxValue);
     var text2 = "Target: " + mission.target + " -- Client: " + mission.client + " -- Key: " +
                 mission.generationKeys;
     TextItem.doFontLabel(new Vector2(bounds.X + 1, bounds.Y + bounds.Height - 16), text2, GuiData.detailfont,
         Color.White*0.3f, bounds.Width, 13f);
     bounds.Y += bounds.Height - 1;
     bounds.Height = 1;
     sb.Draw(Utils.white, bounds, themeColor*0.2f);
     Button.outlineOnly = flag2;
     Button.drawingOutline = flag3;
 }
Esempio n. 16
0
 public void loadSaveFile()
 {
     var saveReadStream = SaveFileManager.GetSaveReadStream(SaveGameUserName);
     if (saveReadStream == null)
         return;
     var xmlReader = XmlReader.Create(saveReadStream);
     loadTitleSaveData(xmlReader);
     Flags.Load(xmlReader);
     netMap.load(xmlReader);
     currentMission = (ActiveMission) ActiveMission.load(xmlReader);
     if (currentMission != null && !(currentMission.reloadGoalsSourceFile == "Missions/BitMissionIntro.xml"))
     {
         var activeMission = (ActiveMission) ComputerLoader.readMission(currentMission.reloadGoalsSourceFile);
     }
     Console.WriteLine(branchMissions.Count);
     allFactions = AllFactions.loadFromSave(xmlReader);
     loadOtherSaveData(xmlReader);
     WillLoadSave = false;
     saveReadStream.Flush();
     saveReadStream.Close();
 }
Esempio n. 17
0
 public void setMission(object missionToAdd)
 {
     mission = (ActiveMission)missionToAdd;
 }
Esempio n. 18
0
 public void setMission(object missionToAdd)
 {
     mission = (ActiveMission) missionToAdd;
 }
Esempio n. 19
0
 public void loadMissionNodes()
 {
     if (multiplayer)
         return;
     if (Settings.IsInAdventureMode)
     {
         var adventureList = BootLoadList.getAdventureList();
         for (var index = 0; index < adventureList.Count; ++index)
             Computer.loadFromFile(adventureList[index]);
         if (ComputerLoader.postAllLoadedActions != null)
             ComputerLoader.postAllLoadedActions();
         var computer = Programs.getComputer(this, "advStartPoint");
         if (computer != null)
             netMap.discoverNode(computer);
     }
     else
     {
         var list = BootLoadList.getList();
         for (var index = 0; index < list.Count; ++index)
         {
             try
             {
                 Computer.loadFromFile(list[index]);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex);
                 Console.WriteLine(ex.StackTrace);
                 throw ex;
             }
         }
         if (ComputerLoader.postAllLoadedActions != null)
             ComputerLoader.postAllLoadedActions();
         if (Settings.isDemoMode)
         {
             var demoList = BootLoadList.getDemoList();
             for (var index = 0; index < demoList.Count; ++index)
                 Computer.loadFromFile(demoList[index]);
         }
     }
     if (!initShowsTutorial && !Settings.IsInAdventureMode)
     {
         if (Settings.isSpecialTestBuild)
             ComputerLoader.loadMission("Content/Missions/Misc/TesterCSECIntroMission.xml");
         else
             ComputerLoader.loadMission("Content/Missions/BitMissionIntro.xml");
     }
     else
     {
         if (Settings.IsInAdventureMode)
             return;
         currentMission = (ActiveMission) ComputerLoader.readMission("Content/Missions/BitMissionIntro.xml");
     }
 }
Esempio n. 20
0
 public void loadMultiplayerMission()
 {
     currentMission = (ActiveMission) ComputerLoader.readMission("Content/Missions/MultiplayerMission.xml");
 }
Esempio n. 21
0
 private bool attemptCompleteMission(ActiveMission mission)
 {
     if (!mission.isComplete(emailReplyStrings) ||
         !mission.ShouldIgnoreSenderVerification && !(mission.email.sender == emailData[1]))
         return false;
     mission.finish();
     state = 3;
     return true;
 }
Esempio n. 22
0
 public static object load(XmlReader reader)
 {
     while (reader.Name != "mission")
         reader.Read();
     reader.MoveToAttribute("next");
     var next = reader.ReadContentAsString();
     reader.MoveToAttribute("goals");
     var filename = reader.ReadContentAsString();
     if (reader.MoveToAttribute("genTarget"))
     {
         var str1 = reader.ReadContentAsString();
         reader.MoveToAttribute("genFile");
         var str2 = reader.ReadContentAsString();
         reader.MoveToAttribute("genPath");
         var str3 = reader.ReadContentAsString();
         reader.MoveToAttribute("genTargetName");
         var str4 = reader.ReadContentAsString();
         reader.MoveToAttribute("genOther");
         var str5 = reader.ReadContentAsString();
         MissionGenerationParser.Comp = str1;
         MissionGenerationParser.File = str2;
         MissionGenerationParser.Path = str3;
         MissionGenerationParser.Target = str4;
         MissionGenerationParser.Other = str5;
     }
     reader.MoveToAttribute("activeChack");
     reader.ReadContentAsString().ToLower().Equals("true");
     if (next == "NULL_MISSION")
         return null;
     if (!filename.StartsWith("Content"))
         filename = "Content/" + filename;
     var _goals = new List<MisisonGoal>();
     var activeMission1 = new ActiveMission(new List<MisisonGoal>(), "NONE",
         new MailServer.EMailData("Unknown", "Unknown", "Unknown", new List<string>()));
     try
     {
         activeMission1 = (ActiveMission) ComputerLoader.readMission(filename);
         _goals = activeMission1.goals;
     }
     catch (Exception ex)
     {
         Utils.SendRealWorldEmail("Mission Load Error", "*****@*****.**",
             "Hacknet " + MainMenu.OSVersion + "\r\n" + Utils.GenerateReportFromException(ex));
     }
     var sendr = "ERRORBOT";
     var subj = "ERROR";
     var bod = "ERROR :: MAIL LOAD FAILED";
     while (reader.Name != "email" && reader.Name != "endFunc")
         reader.Read();
     if (reader.Name.Equals("email"))
     {
         if (reader.MoveToAttribute("sender"))
             sendr = reader.ReadContentAsString();
         if (reader.MoveToAttribute("subject"))
             subj = reader.ReadContentAsString();
         var num = (int) reader.MoveToContent();
         bod = reader.ReadElementContentAsString();
     }
     var _email = new MailServer.EMailData(sendr, bod, subj, activeMission1.email.attachments);
     var activeMission2 = new ActiveMission(_goals, next, _email);
     activeMission2.activeCheck = activeMission1.activeCheck;
     activeMission2.reloadGoalsSourceFile = filename;
     while (reader.Name != "endFunc")
         reader.Read();
     reader.MoveToAttribute("val");
     var num1 = reader.ReadContentAsInt();
     reader.MoveToAttribute("name");
     var str6 = reader.ReadContentAsString();
     activeMission2.endFunctionName = str6;
     activeMission2.endFunctionValue = num1;
     while (reader.Name != "posting")
         reader.Read();
     reader.MoveToAttribute("title");
     var str7 = reader.ReadContentAsString();
     var num2 = (int) reader.MoveToContent();
     var str8 = Folder.deFilter(reader.ReadElementContentAsString());
     activeMission2.postingTitle = str7;
     activeMission2.postingBody = str8;
     return activeMission2;
 }
Esempio n. 23
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            base.draw(bounds, sb);
            PatternDrawer.draw(new Rectangle(bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2), 0.28f, Color.Transparent, this.themeColor * 0.1f, sb, PatternDrawer.thinStripe);
            this.drawTopBar(bounds, sb);
            if (!this.hasSysfile())
            {
                if (Button.doButton(800003, bounds.X + 10, bounds.Y + this.topBar.Height + 10, 300, 30, LocaleTerms.Loc("Exit"), new Color?(this.themeColor)))
                {
                    this.os.display.command = "connect";
                }
                PatternDrawer.draw(new Rectangle(bounds.X + 1, bounds.Y + 1 + 64, bounds.Width - 2, bounds.Height - 2 - 64), 1f, Color.Transparent, this.os.lockedColor, sb, PatternDrawer.errorTile);
                int num1 = bounds.X + 20;
                int num2 = bounds.Y + bounds.Height / 2 - 20;
                TextItem.doLabel(new Vector2((float)num1, (float)num2), LocaleTerms.Loc("CRITICAL ERROR"), new Color?());
                int num3 = num2 + 40;
                TextItem.doSmallLabel(new Vector2((float)num1, (float)num3), "ERROR #4040408 - NULL_SYSFILE\nUnhandled Exception - IOException@L 2217 :R 28\nSystem Files Corrupted and/or Destroyed\nContact the System Administrator", new Color?());
            }
            else
            {
                switch (this.state)
                {
                case 0:
                    if (Button.doButton(800003, bounds.X + 10, bounds.Y + this.topBar.Height + 10, 300, 30, LocaleTerms.Loc("Exit"), new Color?(this.themeColor)))
                    {
                        this.os.display.command = "connect";
                    }
                    sb.Draw(this.logo, new Rectangle(bounds.X + 30, bounds.Y + 115, 128, 128), Color.White);
                    string text1 = string.IsNullOrWhiteSpace(this.listingTitle) ? string.Format(LocaleTerms.Loc("{0} Group"), (object)this.groupName) + "\n" + LocaleTerms.Loc("Message Board") : this.listingTitle;
                    TextItem.doFontLabel(new Vector2((float)(bounds.X + 40 + 128), (float)(bounds.Y + 115)), text1, GuiData.font, new Color?(), (float)(bounds.Width - 40), 60f, false);
                    if (!Button.doButton(800004, bounds.X + 30, bounds.Y + bounds.Height / 2, 300, 40, LocaleTerms.Loc("Login"), new Color?(this.themeColor)))
                    {
                        break;
                    }
                    this.startLogin();
                    this.state = 3;
                    break;

                case 1:
                    if (Button.doButton(800003, bounds.X + 10, bounds.Y + this.topBar.Height + 10, 300, 30, LocaleTerms.Loc("Exit"), new Color?(this.themeColor)))
                    {
                        this.os.display.command = "connect";
                    }
                    int num4 = bounds.X + 10;
                    int num5 = bounds.Y + this.topBar.Height + 50;
                    this.logoRect.X = num4;
                    this.logoRect.Y = num5;
                    sb.Draw(this.logo, this.logoRect, Color.White);
                    int x = num4 + (this.logoRect.Width + 5);
                    TextItem.doLabel(new Vector2((float)x, (float)num5), this.listingTitle, new Color?());
                    int y = num5 + 40;
                    for (int index = 0; index < this.missions.Count; ++index)
                    {
                        if (this.hasListingFile(this.missions[index].postingTitle))
                        {
                            Rectangle rectangle = new Rectangle(x, y, (int)((double)bounds.Width * 0.800000011920929), 30);
                            rectangle        = Utils.InsetRectangle(rectangle, 1);
                            rectangle.X     += 12;
                            rectangle.Width -= 12;
                            if (this.missions[index].postingTitle.StartsWith("#"))
                            {
                                PatternDrawer.draw(rectangle, 1f, Color.Black * 1f, Color.DarkRed * 0.3f, sb, PatternDrawer.warningStripe);
                            }
                            if (Button.doButton(87654 + index, x, y, (int)((double)bounds.Width * 0.800000011920929), 30, this.missions[index].postingTitle, new Color?()))
                            {
                                this.state       = 2;
                                this.targetIndex = index;
                            }
                            y += 35;
                        }
                    }
                    break;

                case 2:
                    if (Button.doButton(800003, bounds.X + 10, bounds.Y + this.topBar.Height + 10, 300, 30, LocaleTerms.Loc("Back"), new Color?(this.themeColor)))
                    {
                        this.state = 1;
                    }
                    int       num6 = 60;
                    int       num7 = 84;
                    Rectangle destinationRectangle = new Rectangle(bounds.X + 30, bounds.Y + this.topBar.Height + num6, num7, num7);
                    sb.Draw(this.logo, destinationRectangle, this.themeColor);
                    int num8 = num6 + 30;
                    TextItem.doFontLabel(new Vector2((float)(bounds.X + 34 + num7), (float)(bounds.Y + this.topBar.Height + num8)), this.missions[this.targetIndex].postingTitle, GuiData.font, new Color?(), (float)(bounds.Width - (36 + num7 + 6)), 40f, false);
                    int num9 = num8 + 40;
                    PatternDrawer.draw(new Rectangle(destinationRectangle.X + destinationRectangle.Width + 2, bounds.Y + this.topBar.Height + num9 - 8, bounds.Width - (destinationRectangle.X - bounds.X + destinationRectangle.Width + 10), PatternDrawer.warningStripe.Height / 2), 1f, Color.Transparent, this.themeColor, sb, PatternDrawer.warningStripe);
                    int    num10 = num9 + 36;
                    string text2 = Utils.SuperSmartTwimForWidth(this.missions[this.targetIndex].postingBody, bounds.Width - 60, GuiData.tinyfont);
                    if (this.TextRegion == null)
                    {
                        this.TextRegion = new ScrollableTextRegion(sb.GraphicsDevice);
                    }
                    this.TextRegion.Draw(new Rectangle(bounds.X + 30, bounds.Y + this.topBar.Height + num10, bounds.Width - 50, bounds.Height - num10 - this.topBar.Height - 10), text2, sb);
                    bool flag = this.os.currentFaction != null && this.os.currentFaction.idName.ToLower() == this.groupName.ToLower();
                    if (this.missionAssigner && this.os.currentMission == null && flag && Button.doButton(800005, bounds.X + bounds.Width / 2 - 10, bounds.Y + bounds.Height - 35, bounds.Width / 2, 30, LocaleTerms.Loc("Accept"), new Color?(this.os.highlightColor)))
                    {
                        this.os.currentMission = this.missions[this.targetIndex];
                        ActiveMission activeMission = (ActiveMission)ComputerLoader.readMission(this.missions[this.targetIndex].reloadGoalsSourceFile);
                        this.missions[this.targetIndex].sendEmail(this.os);
                        this.missions[this.targetIndex].ActivateSuppressedStartFunctionIfPresent();
                        this.removeMission(this.targetIndex);
                        this.state = 1;
                        break;
                    }
                    if (this.missionAssigner && this.os.currentMission != null)
                    {
                        if (this.os.currentMission.wasAutoGenerated && Button.doButton(8000105, bounds.X + 6, bounds.Y + bounds.Height - 29, 210, 25, LocaleTerms.Loc("Abandon Current Contract"), new Color?(this.os.lockedColor)))
                        {
                            this.os.currentMission = (ActiveMission)null;
                            this.os.currentFaction.contractAbbandoned((object)this.os);
                        }
                        TextItem.doFontLabel(new Vector2((float)(bounds.X + 10), (float)(bounds.Y + bounds.Height - 52)), LocaleTerms.Loc("Mission Unavailable") + " : " + (flag ? LocaleTerms.Loc("Complete Existing Contracts") : LocaleTerms.Loc("User ID Assigned to Different Faction") + " "), GuiData.smallfont, new Color?(), (float)(bounds.Width - 20), 30f, false);
                        break;
                    }
                    if (!this.missionAssigner || flag)
                    {
                        break;
                    }
                    TextItem.doFontLabel(new Vector2((float)(bounds.X + 10), (float)(bounds.Y + bounds.Height - 52)), LocaleTerms.Loc("Mission Unavailable") + " : " + LocaleTerms.Loc("User ID Assigned to Different Faction") + " ", GuiData.smallfont, new Color?(), (float)(bounds.Width - 20), 30f, false);
                    break;

                case 3:
                    this.doLoginDisplay(bounds, sb);
                    break;
                }
            }
        }
Esempio n. 24
0
        private void drawMissionEntry(Rectangle bounds, SpriteBatch sb, ActiveMission mission, int index)
        {
            bool flag = false;

            if (mission.postingAcceptFlagRequirements != null)
            {
                for (int index1 = 0; index1 < mission.postingAcceptFlagRequirements.Length; ++index1)
                {
                    if (!this.os.Flags.HasFlag(mission.postingAcceptFlagRequirements[index1]))
                    {
                        flag = true;
                    }
                }
            }
            if (this.os.currentFaction != null && this.os.currentFaction.playerValue < mission.requiredRank)
            {
                flag = true;
            }
            int  myID           = index * 139284 + 984275 + index;
            bool outlineOnly    = Button.outlineOnly;
            bool drawingOutline = Button.drawingOutline;

            Button.outlineOnly    = true;
            Button.drawingOutline = false;
            if (GuiData.active == myID)
            {
                sb.Draw(Utils.white, bounds, Color.Black);
            }
            else if (GuiData.hot == myID)
            {
                sb.Draw(Utils.white, bounds, this.themeColor * 0.12f);
            }
            else
            {
                Color color = index % 2 == 0 ? this.themeColorLine : this.themeColorBackground;
                if (flag)
                {
                    color = Color.Lerp(color, Color.Gray, 0.25f);
                }
                sb.Draw(Utils.white, bounds, color);
            }
            if (mission.postingTitle.StartsWith("#"))
            {
                PatternDrawer.draw(bounds, 1f, Color.Transparent, Color.Black * 0.6f, sb);
            }
            if (flag)
            {
                Rectangle destinationRectangle = bounds;
                destinationRectangle.Height -= 6;
                destinationRectangle.Y      += 3;
                destinationRectangle.X      += bounds.Width - bounds.Height - 6;
                destinationRectangle.Width   = destinationRectangle.Height;
                sb.Draw(this.lockIcon, destinationRectangle, Color.White * 0.2f);
            }
            if (!flag && Button.doButton(myID, bounds.X, bounds.Y, bounds.Width, bounds.Height, "", new Color?(Color.Transparent)))
            {
                this.selectedElementIndex = index;
                this.state            = MissionHubServer.HubState.ContractPreview;
                this.screenTransition = 1f;
            }
            string text1 = mission.postingTitle.Replace("#", "") ?? "";

            TextItem.doFontLabel(new Vector2((float)(bounds.X + 1 + this.getTransitionOffset(index)), (float)(bounds.Y + 3)), text1, GuiData.smallfont, new Color?(Color.White), (float)bounds.Width, float.MaxValue, false);
            string text2 = "Target: " + mission.target + " -- Client: " + mission.client + " -- Key: " + (object)mission.generationKeys;

            TextItem.doFontLabel(new Vector2((float)(bounds.X + 1), (float)(bounds.Y + bounds.Height - 16)), text2, GuiData.detailfont, new Color?(Color.White * 0.3f), (float)bounds.Width, 13f, false);
            bounds.Y     += bounds.Height - 1;
            bounds.Height = 1;
            sb.Draw(Utils.white, bounds, this.themeColor * 0.2f);
            Button.outlineOnly    = outlineOnly;
            Button.drawingOutline = drawingOutline;
        }
Esempio n. 25
0
 private void acceptMission(ActiveMission mission, int index, string id)
 {
     os.currentMission = mission;
     var activeMission = (ActiveMission) ComputerLoader.readMission(mission.reloadGoalsSourceFile);
     mission.sendEmail(os);
     mission.ActivateSuppressedStartFunctionIfPresent();
     var fileEntry = listingsFolder.files[index];
     listingsFolder.files.RemoveAt(index);
     listingArchivesFolder.files.Add(
         new FileEntry(
             "Contract Archive:\nAccepted : " + DateTime.Now + "\nUser : "******"\nActive Since : " +
             activeUserLoginTime + "\n\n" + fileEntry.data, "Contract#" + id + "Archive"));
 }
Esempio n. 26
0
 public void addMisison(ActiveMission m)
 {
     var dataEntry = m.postingBody;
     if (missionAssigner)
         dataEntry = MissionSerializer.generateMissionFile(m, 0, groupName);
     missionFolder.files.Add(new FileEntry(dataEntry, m.postingTitle));
     missions.Add(m);
     branchMissions.Add(os.branchMissions);
 }
Esempio n. 27
0
 private void addMission(ActiveMission mission, bool insertAtTop = false)
 {
     contractRegistryNumber += Utils.getRandomByte() + 1;
     listingMissions.Add(string.Concat(contractRegistryNumber), mission);
     var fileEntry = new FileEntry(
         MissionSerializer.generateMissionFile(mission, contractRegistryNumber, "CSEC"),
         "Contract#" + contractRegistryNumber);
     if (insertAtTop)
         listingsFolder.files.Insert(0, fileEntry);
     else
         listingsFolder.files.Add(fileEntry);
 }
Esempio n. 28
0
        private void drawMissionEntry(Rectangle bounds, SpriteBatch sb, ActiveMission mission, int index)
        {
            var flag1 = false;

            if (mission.postingAcceptFlagRequirements != null)
            {
                for (var index1 = 0; index1 < mission.postingAcceptFlagRequirements.Length; ++index1)
                {
                    if (!os.Flags.HasFlag(mission.postingAcceptFlagRequirements[index1]))
                    {
                        flag1 = true;
                    }
                }
            }
            var myID  = index * 139284 + 984275 + index;
            var flag2 = Button.outlineOnly;
            var flag3 = Button.drawingOutline;

            Button.outlineOnly    = true;
            Button.drawingOutline = false;
            if (GuiData.active == myID)
            {
                sb.Draw(Utils.white, bounds, Color.Black);
            }
            else if (GuiData.hot == myID)
            {
                sb.Draw(Utils.white, bounds, themeColor * 0.12f);
            }
            else
            {
                var color = index % 2 == 0 ? themeColorLine : themeColorBackground;
                if (flag1)
                {
                    color = Color.Lerp(color, Color.Gray, 0.25f);
                }
                sb.Draw(Utils.white, bounds, color);
            }
            if (flag1)
            {
                var destinationRectangle = bounds;
                destinationRectangle.Height -= 6;
                destinationRectangle.Y      += 3;
                destinationRectangle.X      += bounds.Width - bounds.Height - 6;
                destinationRectangle.Width   = destinationRectangle.Height;
                sb.Draw(lockIcon, destinationRectangle, Color.White * 0.2f);
            }
            if (!flag1 && Button.doButton(myID, bounds.X, bounds.Y, bounds.Width, bounds.Height, "", Color.Transparent))
            {
                selectedElementIndex = index;
                state            = HubState.ContractPreview;
                screenTransition = 1f;
            }
            var text1 = mission.postingTitle ?? "";

            TextItem.doFontLabel(new Vector2(bounds.X + 1 + getTransitionOffset(index), bounds.Y + 3), text1,
                                 GuiData.smallfont, Color.White, bounds.Width, float.MaxValue);
            var text2 = "Target: " + mission.target + " -- Client: " + mission.client + " -- Key: " +
                        mission.generationKeys;

            TextItem.doFontLabel(new Vector2(bounds.X + 1, bounds.Y + bounds.Height - 16), text2, GuiData.detailfont,
                                 Color.White * 0.3f, bounds.Width, 13f);
            bounds.Y     += bounds.Height - 1;
            bounds.Height = 1;
            sb.Draw(Utils.white, bounds, themeColor * 0.2f);
            Button.outlineOnly    = flag2;
            Button.drawingOutline = flag3;
        }
Esempio n. 29
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?());
        }
Esempio n. 30
0
        public static object load(XmlReader reader)
        {
            while (reader.Name != "mission")
            {
                reader.Read();
            }
            reader.MoveToAttribute("next");
            string next = reader.ReadContentAsString();

            reader.MoveToAttribute("goals");
            string filename = reader.ReadContentAsString();

            if (reader.MoveToAttribute("genTarget"))
            {
                string str1 = reader.ReadContentAsString();
                reader.MoveToAttribute("genFile");
                string str2 = reader.ReadContentAsString();
                reader.MoveToAttribute("genPath");
                string str3 = reader.ReadContentAsString();
                reader.MoveToAttribute("genTargetName");
                string str4 = reader.ReadContentAsString();
                reader.MoveToAttribute("genOther");
                string str5 = reader.ReadContentAsString();
                MissionGenerationParser.Comp   = str1;
                MissionGenerationParser.File   = str2;
                MissionGenerationParser.Path   = str3;
                MissionGenerationParser.Target = str4;
                MissionGenerationParser.Other  = str5;
            }
            reader.MoveToAttribute("activeChack");
            int num1 = 0;

            if (reader.MoveToAttribute("reqRank"))
            {
                num1 = reader.ReadContentAsInt();
            }
            bool flag = reader.ReadContentAsString().ToLower().Equals("true");

            if (next == "NULL_MISSION")
            {
                return((object)null);
            }
            if (!Settings.IsInExtensionMode && !filename.StartsWith("Content"))
            {
                filename = "Content/" + filename;
            }
            List <MisisonGoal> _goals         = new List <MisisonGoal>();
            ActiveMission      activeMission1 = new ActiveMission(new List <MisisonGoal>(), "NONE", new MailServer.EMailData("Unknown", "Unknown", "Unknown", new List <string>()));

            try
            {
                activeMission1 = (ActiveMission)ComputerLoader.readMission(filename);
                _goals         = activeMission1.goals;
                flag           = flag || activeMission1.activeCheck;
            }
            catch (Exception ex)
            {
                Utils.SendRealWorldEmail("Mission Load Error", "*****@*****.**", "Hacknet " + MainMenu.OSVersion + "\r\n" + Utils.GenerateReportFromException(ex));
            }
            string sendr = "ERRORBOT";
            string subj  = "ERROR";
            string bod   = "ERROR :: MAIL LOAD FAILED";

            while (reader.Name != "email" && reader.Name != "endFunc")
            {
                reader.Read();
            }
            if (reader.Name.Equals("email"))
            {
                if (reader.MoveToAttribute("sender"))
                {
                    sendr = Folder.deFilter(reader.ReadContentAsString());
                }
                if (reader.MoveToAttribute("subject"))
                {
                    subj = Folder.deFilter(reader.ReadContentAsString());
                }
                int content = (int)reader.MoveToContent();
                bod = Folder.deFilter(reader.ReadElementContentAsString());
            }
            MailServer.EMailData _email         = new MailServer.EMailData(sendr, bod, subj, activeMission1.email.attachments);
            ActiveMission        activeMission2 = new ActiveMission(_goals, next, _email);

            activeMission2.activeCheck           = flag;
            activeMission2.reloadGoalsSourceFile = filename;
            activeMission2.requiredRank          = num1;
            while (reader.Name != "endFunc")
            {
                reader.Read();
            }
            reader.MoveToAttribute("val");
            int num2 = reader.ReadContentAsInt();

            reader.MoveToAttribute("name");
            string str6 = reader.ReadContentAsString();

            activeMission2.endFunctionName  = str6;
            activeMission2.endFunctionValue = num2;
            while (reader.Name != "posting")
            {
                reader.Read();
            }
            reader.MoveToAttribute("title");
            string str7     = Folder.deFilter(reader.ReadContentAsString());
            int    content1 = (int)reader.MoveToContent();
            string str8     = Folder.deFilter(reader.ReadElementContentAsString());

            activeMission2.postingTitle = str7;
            activeMission2.postingBody  = str8;
            return((object)activeMission2);
        }
Esempio n. 31
0
 public static object readMission(string filename)
 {
     var xmlReader = XmlReader.Create(TitleContainer.OpenStream(filename));
     var _goals = new List<MisisonGoal>();
     var val1 = 0;
     var name1 = "";
     var name2 = "";
     var val2 = 0;
     var flag1 = false;
     var flag2 = false;
     while (xmlReader.Name != "mission")
         xmlReader.Read();
     if (xmlReader.MoveToAttribute("activeCheck"))
         flag1 = xmlReader.ReadContentAsBoolean();
     if (xmlReader.MoveToAttribute("shouldIgnoreSenderVerification"))
         flag2 = xmlReader.ReadContentAsBoolean();
     while (xmlReader.Name != "goals" && xmlReader.Name != "generationKeys")
         xmlReader.Read();
     if (xmlReader.Name == "generationKeys")
     {
         var keys = new Dictionary<string, string>();
         while (xmlReader.MoveToNextAttribute())
         {
             var name3 = xmlReader.Name;
             var str = xmlReader.Value;
             keys.Add(name3, str);
         }
         var num = (int) xmlReader.MoveToContent();
         var str1 = xmlReader.ReadElementContentAsString();
         if (str1 != null & str1.Length >= 1)
             keys.Add("Data", str1);
         MissionGenerator.setMissionGenerationKeys(keys);
         while (xmlReader.Name != "goals")
             xmlReader.Read();
     }
     xmlReader.Read();
     if (MissionPreLoadComplete != null)
         MissionPreLoadComplete();
     while (xmlReader.Name != "goals")
     {
         if (xmlReader.Name.Equals("goal"))
         {
             var str1 = "UNKNOWN";
             if (xmlReader.MoveToAttribute("type"))
                 str1 = xmlReader.ReadContentAsString();
             if (str1.ToLower().Equals("filedeletion"))
             {
                 string str2;
                 var path = str2 = "";
                 var filename1 = str2;
                 var target = str2;
                 if (xmlReader.MoveToAttribute("target"))
                     target = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("file"))
                     filename1 = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("path"))
                     path = filter(xmlReader.ReadContentAsString());
                 var fileDeletionMission = new FileDeletionMission(path, filename1, findComp(target).ip, os);
                 _goals.Add(fileDeletionMission);
             }
             else if (str1.ToLower().Equals("filedownload"))
             {
                 string str2;
                 var path = str2 = "";
                 var filename1 = str2;
                 var target = str2;
                 if (xmlReader.MoveToAttribute("target"))
                     target = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("file"))
                     filename1 = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("path"))
                     path = filter(xmlReader.ReadContentAsString());
                 var fileDownloadMission = new FileDownloadMission(path, filename1, findComp(target).ip, os);
                 _goals.Add(fileDownloadMission);
             }
             else if (str1.ToLower().Equals("filechange"))
             {
                 string str2;
                 var targetKeyword = str2 = "";
                 var path = str2;
                 var filename1 = str2;
                 var target = str2;
                 if (xmlReader.MoveToAttribute("target"))
                     target = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("file"))
                     filename1 = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("path"))
                     path = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("keyword"))
                     targetKeyword = filter(xmlReader.ReadContentAsString());
                 var isRemoval = false;
                 if (xmlReader.MoveToAttribute("removal"))
                     isRemoval = xmlReader.ReadContentAsBoolean();
                 var fileChangeMission = new FileChangeMission(path, filename1, findComp(target).ip,
                     targetKeyword, os, isRemoval);
                 _goals.Add(fileChangeMission);
             }
             else if (str1.ToLower().Equals("getadmin"))
             {
                 var target = "";
                 if (xmlReader.MoveToAttribute("target"))
                     target = filter(xmlReader.ReadContentAsString());
                 var getAdminMission = new GetAdminMission(findComp(target).ip, os);
                 _goals.Add(getAdminMission);
             }
             else if (str1.ToLower().Equals("getstring"))
             {
                 var targetData = "";
                 if (xmlReader.MoveToAttribute("target"))
                     targetData = filter(xmlReader.ReadContentAsString());
                 var getStringMission = new GetStringMission(targetData);
                 _goals.Add(getStringMission);
             }
             else if (str1.ToLower().Equals("delay"))
             {
                 var time = 1f;
                 if (xmlReader.MoveToAttribute("time"))
                     time = xmlReader.ReadContentAsFloat();
                 var delayMission = new DelayMission(time);
                 _goals.Add(delayMission);
             }
             else if (str1.ToLower().Equals("hasflag"))
             {
                 var targetFlagName = "";
                 if (xmlReader.MoveToAttribute("target"))
                     targetFlagName = filter(xmlReader.ReadContentAsString());
                 var checkFlagSetMission = new CheckFlagSetMission(targetFlagName, os);
                 _goals.Add(checkFlagSetMission);
             }
             if (str1.ToLower().Equals("fileupload"))
             {
                 var needsDecrypt = false;
                 string str2;
                 var decryptPass = str2 = "";
                 var destToUploadToPath = str2;
                 var computerToUploadToIP = str2;
                 var path = str2;
                 var filename1 = str2;
                 var computerWithFileIP = str2;
                 if (xmlReader.MoveToAttribute("target"))
                     computerWithFileIP = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("file"))
                     filename1 = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("path"))
                     path = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("destTarget"))
                     computerToUploadToIP = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("destPath"))
                     destToUploadToPath = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("decryptPass"))
                     decryptPass = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("decrypt"))
                     needsDecrypt = xmlReader.ReadContentAsBoolean();
                 var fileUploadMission = new FileUploadMission(path, filename1, computerWithFileIP,
                     computerToUploadToIP, destToUploadToPath, os, needsDecrypt, decryptPass);
                 _goals.Add(fileUploadMission);
             }
             if (str1.ToLower().Equals("adddegree"))
             {
                 string str2;
                 var degreeName = str2 = "";
                 var uniName = str2;
                 var targetName = str2;
                 var desiredGPA = -1f;
                 if (xmlReader.MoveToAttribute("owner"))
                     targetName = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("degree"))
                     degreeName = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("uni"))
                     uniName = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("gpa"))
                     desiredGPA = xmlReader.ReadContentAsFloat();
                 var addDegreeMission = new AddDegreeMission(targetName, degreeName, uniName, desiredGPA, os);
                 _goals.Add(addDegreeMission);
             }
             if (str1.ToLower().Equals("wipedegrees"))
             {
                 var targetName = "";
                 if (xmlReader.MoveToAttribute("owner"))
                     targetName = filter(xmlReader.ReadContentAsString());
                 var wipeDegreesMission = new WipeDegreesMission(targetName, os);
                 _goals.Add(wipeDegreesMission);
             }
             if (str1.ToLower().Equals("removeDeathRowRecord".ToLower()))
             {
                 var firstName = "UNKNOWN";
                 var lastName = "UNKNOWN";
                 if (xmlReader.MoveToAttribute("name"))
                 {
                     var strArray = filter(xmlReader.ReadContentAsString()).Split(' ');
                     firstName = strArray[0];
                     lastName = strArray[1];
                 }
                 if (xmlReader.MoveToAttribute("fname"))
                     firstName = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("lname"))
                     lastName = filter(xmlReader.ReadContentAsString());
                 var recordRemovalMission = new DeathRowRecordRemovalMission(firstName, lastName, os);
                 _goals.Add(recordRemovalMission);
             }
             if (str1.ToLower().Equals("modifyDeathRowRecord".ToLower()))
             {
                 var firstName = "UNKNOWN";
                 var lastName = "UNKNOWN";
                 if (xmlReader.MoveToAttribute("name"))
                 {
                     var strArray = filter(xmlReader.ReadContentAsString()).Split(' ');
                     firstName = strArray[0];
                     lastName = strArray[1];
                 }
                 if (xmlReader.MoveToAttribute("fname"))
                     firstName = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("lname"))
                     lastName = filter(xmlReader.ReadContentAsString());
                 var num = (int) xmlReader.MoveToContent();
                 var lastWords = xmlReader.ReadElementContentAsString();
                 var recordModifyMission = new DeathRowRecordModifyMission(firstName, lastName, lastWords, os);
                 _goals.Add(recordModifyMission);
             }
             else if (str1.ToLower().Equals("sendemail"))
             {
                 string proposedEmailSubject;
                 var mailRecipient = proposedEmailSubject = "";
                 var mailServerID = "jmail";
                 if (xmlReader.MoveToAttribute("mailServer"))
                     mailServerID = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("recipient"))
                     mailRecipient = filter(xmlReader.ReadContentAsString());
                 if (xmlReader.MoveToAttribute("subject"))
                     proposedEmailSubject = filter(xmlReader.ReadContentAsString());
                 var sendEmailMission = new SendEmailMission(mailServerID, mailRecipient, proposedEmailSubject,
                     os);
                 _goals.Add(sendEmailMission);
             }
         }
         xmlReader.Read();
     }
     while (xmlReader.Name != "nextMission" && xmlReader.Name != "missionEnd" && xmlReader.Name != "missionStart")
         xmlReader.Read();
     if (xmlReader.Name.Equals("missionStart"))
     {
         var num1 = 1;
         var flag3 = false;
         if (xmlReader.MoveToAttribute("val"))
             num1 = xmlReader.ReadContentAsInt();
         if (xmlReader.MoveToAttribute("suppress"))
             flag3 = xmlReader.ReadContentAsBoolean();
         var num2 = (int) xmlReader.MoveToContent();
         var name3 = xmlReader.ReadElementContentAsString();
         if (flag3)
         {
             name2 = name3;
             val2 = num1;
         }
         else
             MissionFunctions.runCommand(num1, name3);
         xmlReader.Read();
     }
     if (xmlReader.Name.Equals("missionEnd"))
     {
         var num1 = 1;
         if (xmlReader.MoveToAttribute("val"))
             num1 = xmlReader.ReadContentAsInt();
         var num2 = (int) xmlReader.MoveToContent();
         name1 = xmlReader.ReadElementContentAsString();
         val1 = num1;
     }
     var flag4 = true;
     while (!xmlReader.Name.Equals("nextMission"))
         xmlReader.Read();
     if (xmlReader.MoveToAttribute("IsSilent"))
         flag4 = xmlReader.ReadContentAsString().ToLower().Equals("false");
     var num3 = (int) xmlReader.MoveToContent();
     var next = xmlReader.ReadElementContentAsString();
     if (os.branchMissions != null)
         os.branchMissions.Clear();
     while (xmlReader.Name != "posting" && xmlReader.Name != "email")
     {
         if (xmlReader.Name.Equals("branchMissions"))
         {
             xmlReader.Read();
             var list = new List<ActiveMission>();
             while (!xmlReader.Name.Equals("branchMissions") || xmlReader.IsStartElement())
             {
                 if (xmlReader.Name == "branch")
                 {
                     var num1 = (int) xmlReader.MoveToContent();
                     var str = xmlReader.ReadElementContentAsString();
                     list.Add((ActiveMission) readMission("Content/Missions/" + str));
                 }
                 xmlReader.Read();
             }
             os.branchMissions = list;
         }
         xmlReader.Read();
     }
     int num4;
     var num5 = num4 = 0;
     string str3;
     var str4 = str3 = "UNKNOWN";
     var str5 = str3;
     var s1 = str3;
     var str6 = str3;
     string str7 = null;
     while (xmlReader.Name != "posting" && xmlReader.Name != "email")
         xmlReader.Read();
     if (xmlReader.Name.Equals("posting"))
     {
         if (xmlReader.MoveToAttribute("title"))
             s1 = xmlReader.ReadContentAsString();
         if (xmlReader.MoveToAttribute("reqs"))
             str7 = xmlReader.ReadContentAsString();
         if (xmlReader.MoveToAttribute("requiredRank"))
             num5 = xmlReader.ReadContentAsInt();
         if (xmlReader.MoveToAttribute("difficulty"))
             num4 = xmlReader.ReadContentAsInt();
         if (xmlReader.MoveToAttribute("client"))
             str5 = xmlReader.ReadContentAsString();
         if (xmlReader.MoveToAttribute("target"))
             str4 = xmlReader.ReadContentAsString();
         var num1 = (int) xmlReader.MoveToContent();
         var s2 = xmlReader.ReadElementContentAsString();
         s1 = filter(s1);
         str6 = filter(s2);
     }
     while (xmlReader.Name != "email")
         xmlReader.Read();
     while (xmlReader.Name != "sender")
         xmlReader.Read();
     var s3 = xmlReader.ReadElementContentAsString();
     while (xmlReader.Name != "subject")
         xmlReader.Read();
     var s4 = xmlReader.ReadElementContentAsString();
     while (xmlReader.Name != "body")
         xmlReader.Read();
     var s5 = xmlReader.ReadElementContentAsString();
     s5.Trim();
     var bod = filter(s5);
     var subj = filter(s4);
     var sendr = filter(s3);
     while (xmlReader.Name != "attachments")
         xmlReader.Read();
     xmlReader.Read();
     var _attachments = new List<string>();
     while (xmlReader.Name != "attachments")
     {
         if (xmlReader.Name.Equals("link"))
         {
             var str1 = "";
             if (xmlReader.MoveToAttribute("comp"))
                 str1 = filter(xmlReader.ReadContentAsString());
             Computer computer = null;
             for (var index = 0; index < os.netMap.nodes.Count; ++index)
             {
                 if (os.netMap.nodes[index].idName.Equals(str1))
                     computer = os.netMap.nodes[index];
             }
             if (computer != null)
                 _attachments.Add("link#%#" + computer.name + "#%#" + computer.ip);
         }
         if (xmlReader.Name.Equals("account"))
         {
             var str1 = "";
             if (xmlReader.MoveToAttribute("comp"))
                 str1 = filter(xmlReader.ReadContentAsString());
             Computer computer = null;
             for (var index = 0; index < os.netMap.nodes.Count; ++index)
             {
                 if (os.netMap.nodes[index].idName.Equals(str1))
                     computer = os.netMap.nodes[index];
             }
             string s2;
             var s6 = s2 = "UNKNOWN";
             if (xmlReader.MoveToAttribute("user"))
                 s6 = xmlReader.ReadContentAsString();
             if (xmlReader.MoveToAttribute("pass"))
                 s2 = xmlReader.ReadContentAsString();
             var str2 = filter(s6);
             var str8 = filter(s2);
             if (computer != null)
                 _attachments.Add("account#%#" + computer.name + "#%#" + computer.ip + "#%#" + str2 + "#%#" +
                                  str8);
         }
         if (xmlReader.Name.Equals("note"))
         {
             var str1 = "Data";
             if (xmlReader.MoveToAttribute("title"))
                 str1 = filter(xmlReader.ReadContentAsString());
             var num1 = (int) xmlReader.MoveToContent();
             var str2 = xmlReader.ReadElementContentAsString();
             _attachments.Add("note#%#" + str1 + "#%#" + str2);
         }
         xmlReader.Read();
     }
     var _email = new MailServer.EMailData(sendr, bod, subj, _attachments);
     var activeMission = new ActiveMission(_goals, next, _email);
     activeMission.activeCheck = flag1;
     activeMission.ShouldIgnoreSenderVerification = flag2;
     activeMission.postingBody = str6;
     activeMission.postingTitle = s1;
     activeMission.requiredRank = num5;
     activeMission.difficulty = num4;
     activeMission.client = str5;
     activeMission.target = str4;
     activeMission.reloadGoalsSourceFile = filename;
     if (str7 != null)
         activeMission.postingAcceptFlagRequirements = str7.Split(Utils.commaDelim,
             StringSplitOptions.RemoveEmptyEntries);
     activeMission.willSendEmail = flag4;
     if (!name1.Equals(""))
         activeMission.addEndFunction(val1, name1);
     if (!name2.Equals(""))
         activeMission.addStartFunction(val2, name2);
     return activeMission;
 }
Esempio n. 32
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 + "\"");
                }
            }
        }