public static string TestEduSafeFileFlags(ScreenManager screenMan, out int errorsAdded) { int num = 0; string str = ""; Settings.EducationSafeBuild = true; Computer computer1 = (Computer)ComputerLoader.loadComputer("Content/Tests/TestComputer.xml", false, false); Settings.EducationSafeBuild = false; Computer computer2 = (Computer)ComputerLoader.loadComputer("Content/Tests/TestComputer.xml", false, false); Folder folder1 = computer1.files.root.searchForFolder("testfolder"); Folder folder2 = computer2.files.root.searchForFolder("testfolder"); if (folder1.containsFile("eduUnsafeFile.txt") || !folder1.containsFile("eduSafeFile.txt") || !folder1.containsFile("eduSafeExplicit.txt") || !folder1.containsFile("eduSafeOnlyFile.txt")) { ++num; str += "\nError in Education File Flags - EDU Safe version has invalid file set"; } if (!folder2.containsFile("eduUnsafeFile.txt") || !folder2.containsFile("eduSafeFile.txt") || !folder2.containsFile("eduSafeExplicit.txt") || folder2.containsFile("eduSafeOnlyFile.txt")) { ++num; str += "\nError in Education File Flags - EDU Unsafe version has invalid file set"; } errorsAdded = num; return(str); }
public static string TestMemoryInjectionOnLoadedComputer(ScreenManager screenMan, out int errorsAdded) { int num = 0; string str = ""; Computer computer = (Computer)ComputerLoader.loadComputer("Content/Tests/DLCTests/TestCompNoMemory.xml", false, false); if (computer.Memory != null) { ++num; str += "\r\nLoaded test comp for no memory does infact have memory somehow????\r\n"; } else { MemoryDumpInjector.InjectMemory("Content/Tests/DLCTests/InjectedMemory.xml", (object)computer); if (computer.Memory == null) { ++num; str += "\r\nInjecting memory into loaded comp failed!\r\n"; } else if (computer.Memory.DataBlocks.Count != 2) { ++num; str = str + "\r\nLoaded test comp reads in " + (object)computer.Memory.DataBlocks.Count + " data blocks in memory, instead of the expected 2"; } } errorsAdded = num; return(str); }
public List <Computer> generateGameNodes() { var list = new List <Computer>(); var computer1 = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/JMailServer.xml"); computer1.location = new Vector2(0.7f, 0.2f); mailServer = computer1; list.Add(computer1); var c1 = new Computer("boatmail.com", "65.55.72.183", new Vector2(0.6f, 0.9f), 4, 3, os); c1.idName = "boatmail"; c1.daemons.Add(new BoatMail(c1, "Boatmail", os)); c1.initDaemons(); list.Add(c1); var c2 = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/InternationalAcademicDatabase.xml"); var academicDatabaseDaemon = new AcademicDatabaseDaemon(c2, "Academic Databse", os); c2.daemons.Add(academicDatabaseDaemon); c2.initDaemons(); academicDatabaseDaemon.initFilesFromPeople(People.all); academicDatabase = c2; list.Add(c2); var computer2 = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/ContractHubAssetsComp.xml"); list.Add(computer2); var ch = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/ContractHubComp.xml"); os.delayer.Post(ActionDelayer.NextTick(), () => { ch.daemons.Add(new MissionHubServer(ch, "CSEC Contract Database", "CSEC", os)); ch.initDaemons(); }); list.Add(ch); computer2.location = ch.location + Corporation.getNearbyNodeOffset(ch.location, 1, 1, this); list.Add(new Computer("Cheater's Stash", "1337.1337.1337.1337", getRandomPosition(), 0, 2, os) { idName = "haxServer", files = { root = { files = { new FileEntry(PortExploits.crackExeData[PortExploits.portNums[0]], PortExploits.cracks[PortExploits.portNums[0]]), new FileEntry(PortExploits.crackExeData[PortExploits.portNums[1]], PortExploits.cracks[PortExploits.portNums[1]]), new FileEntry(PortExploits.crackExeData[PortExploits.portNums[2]], PortExploits.cracks[PortExploits.portNums[2]]), new FileEntry(PortExploits.crackExeData[PortExploits.portNums[3]], PortExploits.cracks[PortExploits.portNums[3]]) } } } }); return(list); }
public List <Computer> generateGameNodes() { List <Computer> computerList = new List <Computer>(); Computer computer1 = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/JMailServer.xml", false, false); computer1.location = new Vector2(0.7f, 0.2f); this.mailServer = computer1; computerList.Add(computer1); Computer c1 = new Computer("boatmail.com", "65.55.72.183", new Vector2(0.6f, 0.9f), 4, (byte)3, this.os); c1.idName = "boatmail"; c1.daemons.Add((Daemon) new BoatMail(c1, "Boatmail", this.os)); c1.initDaemons(); computerList.Add(c1); Computer c2 = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/InternationalAcademicDatabase.xml", false, false); AcademicDatabaseDaemon academicDatabaseDaemon = new AcademicDatabaseDaemon(c2, "Academic Database", this.os); c2.daemons.Add((Daemon)academicDatabaseDaemon); c2.initDaemons(); this.academicDatabase = c2; computerList.Add(c2); Computer computer2 = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/ContractHubAssetsComp.xml", false, false); computerList.Add(computer2); Computer ch = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/ContractHubComp.xml", false, false); this.os.delayer.Post(ActionDelayer.NextTick(), (Action)(() => { ch.daemons.Add((Daemon) new MissionHubServer(ch, "CSEC Contract Database", "CSEC", this.os)); ch.initDaemons(); })); computerList.Add(ch); computer2.location = ch.location + Corporation.getNearbyNodeOffset(ch.location, 1, 1, this, 0.0f, false); computerList.Add(new Computer("Cheater's Stash", "1337.1337.1337.1337", this.getRandomPosition(), 0, (byte)2, this.os) { idName = "haxServer", files = { root = { files = { new FileEntry(PortExploits.crackExeData[PortExploits.portNums[0]], PortExploits.cracks[PortExploits.portNums[0]]), new FileEntry(PortExploits.crackExeData[PortExploits.portNums[1]], PortExploits.cracks[PortExploits.portNums[1]]), new FileEntry(PortExploits.crackExeData[PortExploits.portNums[2]], PortExploits.cracks[PortExploits.portNums[2]]), new FileEntry(PortExploits.crackExeData[PortExploits.portNums[3]], PortExploits.cracks[PortExploits.portNums[3]]), this.GetProgramForNum(1433), this.GetProgramForNum(104), this.GetProgramForNum(9), this.GetProgramForNum(13), this.GetProgramForNum(10) } } } }); return(computerList); }
public static void ReloadExtensionNodes(object osobj) { OS os = (OS)osobj; ExtensionInfo activeExtensionInfo = ExtensionLoader.ActiveExtensionInfo; if (!Directory.Exists(activeExtensionInfo.FolderPath + "/Nodes")) { return; } Utils.ActOnAllFilesRevursivley(activeExtensionInfo.FolderPath + "/Nodes", (Action <string>)(filename => { if (!filename.EndsWith(".xml")) { return; } if (OS.TestingPassOnly) { try { Computer c = Computer.loadFromFile(filename); if (c != null) { ExtensionLoader.CheckAndAssignCoreServer(c, os); } } catch (Exception ex) { throw new FormatException(string.Format("COMPUTER LOAD ERROR:\nError loading computer \"{0}\"\nError: {1} - {2}", (object)filename, (object)ex.GetType().Name, (object)ex.Message), ex); } } else { Computer c = (Computer)ComputerLoader.loadComputer(filename, true, false); for (int index = 0; index < os.netMap.nodes.Count; ++index) { Computer node = os.netMap.nodes[index]; if (node.idName == c.idName) { c.location = node.location; c.adminIP = node.adminIP; c.ip = node.ip; c.highlightFlashTime = 1f; os.netMap.nodes[index] = c; break; } } if (c != null) { ExtensionLoader.CheckAndAssignCoreServer(c, os); } } })); }
public static string TestMemoryOnLoadedComputer(ScreenManager screenMan, out int errorsAdded) { int num = 0; string str1 = ""; Computer computer = (Computer)ComputerLoader.loadComputer("Content/Tests/DLCTests/TestComp1.xml", false, false); if (computer.Memory == null) { ++num; str1 += "\r\nLoaded test comp1 Does not correctly load in memory."; } if (computer.Memory.DataBlocks.Count != 3) { ++num; str1 = str1 + "\r\nLoaded test comp reads in " + (object)computer.Memory.DataBlocks.Count + " data blocks in memory, instead of the expected 3"; } if (computer.Memory.CommandsRun.Count != 1) { ++num; str1 = str1 + "\r\nLoaded test comp reads in " + (object)computer.Memory.CommandsRun.Count + " commands run in memory, instead of the expected 1"; } else if (computer.Memory.CommandsRun[0] != "connect 123.123.123.123") { ++num; str1 = str1 + "\r\nLoaded test comp reads in " + computer.Memory.CommandsRun[0] + " as command, instead of the expected value"; } string str2 = MemoryContents.GetMemoryFromEncodedFileString(computer.Memory.GetEncodedFileString()).TestEqualsWithErrorReport(computer.Memory); if (str2.Length > 0) { ++num; str1 = str1 + "\r\nErrors in Memory file serialization cycle!\r\n" + str2 + "\n\n"; } errorsAdded = num; return(str1); }
public static string TestCustomPortMappingOnLoadedComputer(ScreenManager screenMan, out int errorsAdded) { int num = 0; string str = ""; Computer computer = (Computer)ComputerLoader.loadComputer("Content/Tests/DLCTests/TestComp1.xml", false, false); if (computer.PortRemapping == null) { ++num; str += "\r\nLoaded test comp1 Does not correctly load in port remapping."; } if (computer.PortRemapping.Count != 4) { ++num; str = str + "\r\nLoaded test comp reads in " + (object)computer.PortRemapping.Count + " remaps, instead of the expected 4"; } if (computer.PortRemapping[22] != 1234 || computer.PortRemapping[21] != 99 || computer.PortRemapping[80] != 3 || computer.PortRemapping[1433] != 1432) { ++num; str += "\r\nLoaded test comp reads in incorrect port mapping."; } errorsAdded = num; return(str); }
public static Computer loadFromFile(string filename) { return((Computer)ComputerLoader.loadComputer(filename)); }
public static void FixSavesWithTerribleHacks(object osObj) { OS os = (OS)osObj; Computer computer1 = Programs.getComputer(os, "mainHubAssets"); if (computer1 != null) { Folder folder1 = computer1.files.root.searchForFolder("bin"); if (folder1 != null) { Folder folder2 = folder1.searchForFolder("Sequencer"); if (folder2 != null) { FileEntry fileEntry = folder2.searchForFile("Sequencer.exe"); if (fileEntry == null) { folder2.files.Add(new FileEntry(PortExploits.crackExeData[17], "Sequencer.exe")); } else { fileEntry.data = PortExploits.crackExeData[17]; } } } } Computer computer2 = Programs.getComputer(os, "pacemakerSW_BE"); if (computer2 != null) { Console.WriteLine("Searching for pacemaker comp"); Folder folder1 = computer2.files.root.searchForFolder("projects"); if (folder1 != null) { Console.WriteLine("Searching for pacemaker projects"); Folder folder2 = folder1.searchForFolder("KellisBT"); if (folder2 != null) { Folder folder3 = folder2.searchForFolder("Tests"); if (folder3 != null) { Console.WriteLine("Searching for pacemaker file"); FileEntry fileEntry = folder3.searchForFile("PacemakerFirmware_Cycle_Test.dll"); if (fileEntry == null) { folder3.files.Add(new FileEntry(PortExploits.DangerousPacemakerFirmware, "PacemakerFirmware_Cycle_Test.dll")); } else { fileEntry.data = PortExploits.DangerousPacemakerFirmware; } } } } } if (!os.HasLoadedDLCContent) { return; } List <Computer> computerList = new List <Computer>(); if (Programs.getComputer(os, "dPets_MF").links.Count == 0) { ComputerLoader.postAllLoadedActions = (Action)null; List <string> dlcList = BootLoadList.getDLCList(); for (int index = 0; index < dlcList.Count; ++index) { Computer computer3 = (Computer)ComputerLoader.loadComputer(dlcList[index], true, true); computerList.Add(computer3); } ComputerLoader.postAllLoadedActions(); } for (int index = 0; index < computerList.Count; ++index) { Programs.getComputer(os, computerList[index].idName).links = computerList[index].links; } Folder folder = Programs.getComputer(os, "dPets_MF").files.root.searchForFolder("Database"); bool flag = false; if (folder.files.Count > 0 && folder.files[0].data.Contains("DigiPet")) { for (int index = 0; index < folder.files.Count; ++index) { folder.files[index].data = folder.files[index].data.Replace("DigiPet", "Neopal"); if (folder.files[index].data.Contains("Minx")) { flag = true; } } if (flag) { ; } DLCHubServer daemon = (DLCHubServer)Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer)); daemon.navigatedTo(); if (daemon.ActiveMissions.Count == 0) { daemon.AddMission(os.currentMission, os.defaultUser.name, false); } } if (os.Flags.HasFlag("KaguyaTrialComplete") && !os.netMap.visibleNodes.Contains(os.netMap.nodes.IndexOf(Programs.getComputer(os, "dhs")))) { os.Flags.RemoveFlag("KaguyaTrialComplete"); } }