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 Computer load(XmlReader reader, OS os) { while (reader.Name != "computer") { reader.Read(); } reader.MoveToAttribute("name"); var compName = reader.ReadContentAsString(); reader.MoveToAttribute("ip"); var compIP = reader.ReadContentAsString(); reader.MoveToAttribute("type"); var compType = (byte)reader.ReadContentAsInt(); reader.MoveToAttribute("spec"); var str1 = reader.ReadContentAsString(); reader.MoveToAttribute("id"); var str2 = reader.ReadContentAsString(); string str3 = null; if (reader.MoveToAttribute("devices")) { str3 = reader.ReadContentAsString(); } string str4 = null; if (reader.MoveToAttribute("icon")) { str4 = reader.ReadContentAsString(); } while (reader.Name != "location") { reader.Read(); } reader.MoveToAttribute("x"); var x = reader.ReadContentAsFloat(); reader.MoveToAttribute("y"); var y = reader.ReadContentAsFloat(); while (reader.Name != "security") { reader.Read(); } reader.MoveToAttribute("level"); var seclevel = reader.ReadContentAsInt(); reader.MoveToAttribute("traceTime"); var num1 = reader.ReadContentAsFloat(); reader.MoveToAttribute("portsToCrack"); var num2 = reader.ReadContentAsInt(); reader.MoveToAttribute("adminIP"); var str5 = reader.ReadContentAsString(); var time = -1f; if (reader.MoveToAttribute("proxyTime")) { time = reader.ReadContentAsFloat(); } while (reader.Name != "admin") { reader.Read(); } reader.MoveToAttribute("type"); var str6 = reader.ReadContentAsString(); reader.MoveToAttribute("resetPass"); var flag1 = reader.ReadContentAsBoolean(); reader.MoveToAttribute("isSuper"); var flag2 = reader.ReadContentAsBoolean(); Administrator administrator = null; switch (str6) { case "fast": administrator = new FastBasicAdministrator(); break; case "basic": administrator = new BasicAdministrator(); break; } if (administrator != null) { administrator.ResetsPassword = flag1; } if (administrator != null) { administrator.IsSuper = flag2; } while (reader.Name != "links") { reader.Read(); } var strArray = reader.ReadElementContentAsString().Split(); Firewall firewall = null; while (reader.Name != "portsOpen" && reader.Name != "firewall") { reader.Read(); } if (reader.Name == "firewall") { firewall = Firewall.load(reader); } while (reader.Name != "portsOpen") { reader.Read(); } var portsList = reader.ReadElementContentAsString(); var computer = new Computer(compName, compIP, new Vector2(x, y), seclevel, compType, os); computer.firewall = firewall; computer.admin = administrator; if (time > 0.0) { computer.addProxy(time); } else { computer.hasProxy = false; computer.proxyActive = false; } while (reader.Name != "users") { reader.Read(); } computer.users.Clear(); while (!(reader.Name == "users") || reader.NodeType != XmlNodeType.EndElement) { if (reader.Name == "user") { var userDetail = UserDetail.loadUserDetail(reader); if (userDetail.name.ToLower() == "admin") { computer.adminPass = userDetail.pass; } computer.users.Add(userDetail); } reader.Read(); } while (reader.Name != "daemons") { reader.Read(); } reader.Read(); while (!(reader.Name == "daemons") || reader.NodeType != XmlNodeType.EndElement) { if (reader.Name == "MailServer") { reader.MoveToAttribute("name"); var name = reader.ReadContentAsString(); var mailServer = new MailServer(computer, name, os); computer.daemons.Add(mailServer); if (reader.MoveToAttribute("color")) { var newThemeColor = Utils.convertStringToColor(reader.ReadContentAsString()); mailServer.setThemeColor(newThemeColor); } } else if (reader.Name == "MissionListingServer") { reader.MoveToAttribute("name"); var serviceName = reader.ReadContentAsString(); reader.MoveToAttribute("group"); var group = reader.ReadContentAsString(); reader.MoveToAttribute("public"); var _isPublic = reader.ReadContentAsString().ToLower().Equals("true"); reader.MoveToAttribute("assign"); var _isAssigner = reader.ReadContentAsString().ToLower().Equals("true"); var missionListingServer = new MissionListingServer(computer, serviceName, group, os, _isPublic, _isAssigner); computer.daemons.Add(missionListingServer); } else if (reader.Name == "AddEmailServer") { reader.MoveToAttribute("name"); var serviceName = reader.ReadContentAsString(); var addEmailDaemon = new AddEmailDaemon(computer, serviceName, os); computer.daemons.Add(addEmailDaemon); } else if (reader.Name == "MessageBoard") { reader.MoveToAttribute("name"); var str7 = reader.ReadContentAsString(); var messageBoardDaemon = new MessageBoardDaemon(computer, os); messageBoardDaemon.name = str7; computer.daemons.Add(messageBoardDaemon); } else if (reader.Name == "WebServer") { reader.MoveToAttribute("name"); var serviceName = reader.ReadContentAsString(); reader.MoveToAttribute("url"); var pageFileLocation = reader.ReadContentAsString(); var webServerDaemon = new WebServerDaemon(computer, serviceName, os, pageFileLocation); computer.daemons.Add(webServerDaemon); } else if (reader.Name == "OnlineWebServer") { reader.MoveToAttribute("name"); var serviceName = reader.ReadContentAsString(); reader.MoveToAttribute("url"); var url = reader.ReadContentAsString(); var onlineWebServerDaemon = new OnlineWebServerDaemon(computer, serviceName, os); onlineWebServerDaemon.setURL(url); computer.daemons.Add(onlineWebServerDaemon); } else if (reader.Name == "AcademicDatabse") { reader.MoveToAttribute("name"); var serviceName = reader.ReadContentAsString(); var academicDatabaseDaemon = new AcademicDatabaseDaemon(computer, serviceName, os); computer.daemons.Add(academicDatabaseDaemon); } else if (reader.Name == "MissionHubServer") { var missionHubServer = new MissionHubServer(computer, "unknown", "unknown", os); computer.daemons.Add(missionHubServer); } else if (reader.Name == "DeathRowDatabase") { var rowDatabaseDaemon = new DeathRowDatabaseDaemon(computer, "Death Row Database", os); computer.daemons.Add(rowDatabaseDaemon); } else if (reader.Name == "MedicalDatabase") { var medicalDatabaseDaemon = new MedicalDatabaseDaemon(computer, os); computer.daemons.Add(medicalDatabaseDaemon); } else if (reader.Name == "HeartMonitor") { var str7 = "UNKNOWN"; if (reader.MoveToAttribute("patient")) { str7 = reader.ReadContentAsString(); } computer.daemons.Add(new HeartMonitorDaemon(computer, os) { PatientID = str7 }); } else if (reader.Name.Equals("PointClicker")) { var pointClickerDaemon = new PointClickerDaemon(computer, "Point Clicker!", os); computer.daemons.Add(pointClickerDaemon); } else if (reader.Name.Equals("ispSystem")) { var ispDaemon = new ISPDaemon(computer, os); computer.daemons.Add(ispDaemon); } else if (reader.Name.Equals("porthackheart")) { var porthackHeartDaemon = new PorthackHeartDaemon(computer, os); computer.daemons.Add(porthackHeartDaemon); } else if (reader.Name.Equals("SongChangerDaemon")) { var songChangerDaemon = new SongChangerDaemon(computer, os); computer.daemons.Add(songChangerDaemon); } else if (reader.Name == "UploadServerDaemon") { string str7; var input = str7 = ""; var foldername = str7; var serviceName = str7; if (reader.MoveToAttribute("name")) { serviceName = reader.ReadContentAsString(); } if (reader.MoveToAttribute("foldername")) { foldername = reader.ReadContentAsString(); } if (reader.MoveToAttribute("color")) { input = reader.ReadContentAsString(); } var needsAuthentication = false; if (reader.MoveToAttribute("needsAuh")) { needsAuthentication = reader.ReadContentAsBoolean(); } var themeColor = Color.White; if (input != "") { themeColor = Utils.convertStringToColor(input); } var uploadServerDaemon = new UploadServerDaemon(computer, serviceName, themeColor, os, foldername, needsAuthentication); computer.daemons.Add(uploadServerDaemon); } reader.Read(); } computer.files = FileSystem.load(reader); computer.traceTime = num1; computer.portsNeededForCrack = num2; computer.adminIP = str5; computer.idName = str2; computer.icon = str4; computer.attatchedDeviceIDs = str3; for (var index = 0; index < strArray.Length; ++index) { if (strArray[index] != "") { computer.links.Add(Convert.ToInt32(strArray[index])); } } if (portsList.Length > 0) { ComputerLoader.loadPortsIntoComputer(portsList, computer); } if (str1 == "mail") { os.netMap.mailServer = computer; } else if (str1 == "player") { os.thisComputer = computer; } return(computer); }
public static Computer load(XmlReader reader, OS os) { while (reader.Name != "computer") reader.Read(); reader.MoveToAttribute("name"); var compName = reader.ReadContentAsString(); reader.MoveToAttribute("ip"); var compIP = reader.ReadContentAsString(); reader.MoveToAttribute("type"); var compType = (byte) reader.ReadContentAsInt(); reader.MoveToAttribute("spec"); var str1 = reader.ReadContentAsString(); reader.MoveToAttribute("id"); var str2 = reader.ReadContentAsString(); string str3 = null; if (reader.MoveToAttribute("devices")) str3 = reader.ReadContentAsString(); string str4 = null; if (reader.MoveToAttribute("icon")) str4 = reader.ReadContentAsString(); while (reader.Name != "location") reader.Read(); reader.MoveToAttribute("x"); var x = reader.ReadContentAsFloat(); reader.MoveToAttribute("y"); var y = reader.ReadContentAsFloat(); while (reader.Name != "security") reader.Read(); reader.MoveToAttribute("level"); var seclevel = reader.ReadContentAsInt(); reader.MoveToAttribute("traceTime"); var num1 = reader.ReadContentAsFloat(); reader.MoveToAttribute("portsToCrack"); var num2 = reader.ReadContentAsInt(); reader.MoveToAttribute("adminIP"); var str5 = reader.ReadContentAsString(); var time = -1f; if (reader.MoveToAttribute("proxyTime")) time = reader.ReadContentAsFloat(); while (reader.Name != "admin") reader.Read(); reader.MoveToAttribute("type"); var str6 = reader.ReadContentAsString(); reader.MoveToAttribute("resetPass"); var flag1 = reader.ReadContentAsBoolean(); reader.MoveToAttribute("isSuper"); var flag2 = reader.ReadContentAsBoolean(); Administrator administrator = null; switch (str6) { case "fast": administrator = new FastBasicAdministrator(); break; case "basic": administrator = new BasicAdministrator(); break; } if (administrator != null) administrator.ResetsPassword = flag1; if (administrator != null) administrator.IsSuper = flag2; while (reader.Name != "links") reader.Read(); var strArray = reader.ReadElementContentAsString().Split(); Firewall firewall = null; while (reader.Name != "portsOpen" && reader.Name != "firewall") reader.Read(); if (reader.Name == "firewall") firewall = Firewall.load(reader); while (reader.Name != "portsOpen") reader.Read(); var portsList = reader.ReadElementContentAsString(); var computer = new Computer(compName, compIP, new Vector2(x, y), seclevel, compType, os); computer.firewall = firewall; computer.admin = administrator; if (time > 0.0) { computer.addProxy(time); } else { computer.hasProxy = false; computer.proxyActive = false; } while (reader.Name != "users") reader.Read(); computer.users.Clear(); while (!(reader.Name == "users") || reader.NodeType != XmlNodeType.EndElement) { if (reader.Name == "user") { var userDetail = UserDetail.loadUserDetail(reader); if (userDetail.name.ToLower() == "admin") computer.adminPass = userDetail.pass; computer.users.Add(userDetail); } reader.Read(); } while (reader.Name != "daemons") reader.Read(); reader.Read(); while (!(reader.Name == "daemons") || reader.NodeType != XmlNodeType.EndElement) { if (reader.Name == "MailServer") { reader.MoveToAttribute("name"); var name = reader.ReadContentAsString(); var mailServer = new MailServer(computer, name, os); computer.daemons.Add(mailServer); if (reader.MoveToAttribute("color")) { var newThemeColor = Utils.convertStringToColor(reader.ReadContentAsString()); mailServer.setThemeColor(newThemeColor); } } else if (reader.Name == "MissionListingServer") { reader.MoveToAttribute("name"); var serviceName = reader.ReadContentAsString(); reader.MoveToAttribute("group"); var group = reader.ReadContentAsString(); reader.MoveToAttribute("public"); var _isPublic = reader.ReadContentAsString().ToLower().Equals("true"); reader.MoveToAttribute("assign"); var _isAssigner = reader.ReadContentAsString().ToLower().Equals("true"); var missionListingServer = new MissionListingServer(computer, serviceName, group, os, _isPublic, _isAssigner); computer.daemons.Add(missionListingServer); } else if (reader.Name == "AddEmailServer") { reader.MoveToAttribute("name"); var serviceName = reader.ReadContentAsString(); var addEmailDaemon = new AddEmailDaemon(computer, serviceName, os); computer.daemons.Add(addEmailDaemon); } else if (reader.Name == "MessageBoard") { reader.MoveToAttribute("name"); var str7 = reader.ReadContentAsString(); var messageBoardDaemon = new MessageBoardDaemon(computer, os); messageBoardDaemon.name = str7; computer.daemons.Add(messageBoardDaemon); } else if (reader.Name == "WebServer") { reader.MoveToAttribute("name"); var serviceName = reader.ReadContentAsString(); reader.MoveToAttribute("url"); var pageFileLocation = reader.ReadContentAsString(); var webServerDaemon = new WebServerDaemon(computer, serviceName, os, pageFileLocation); computer.daemons.Add(webServerDaemon); } else if (reader.Name == "OnlineWebServer") { reader.MoveToAttribute("name"); var serviceName = reader.ReadContentAsString(); reader.MoveToAttribute("url"); var url = reader.ReadContentAsString(); var onlineWebServerDaemon = new OnlineWebServerDaemon(computer, serviceName, os); onlineWebServerDaemon.setURL(url); computer.daemons.Add(onlineWebServerDaemon); } else if (reader.Name == "AcademicDatabse") { reader.MoveToAttribute("name"); var serviceName = reader.ReadContentAsString(); var academicDatabaseDaemon = new AcademicDatabaseDaemon(computer, serviceName, os); computer.daemons.Add(academicDatabaseDaemon); } else if (reader.Name == "MissionHubServer") { var missionHubServer = new MissionHubServer(computer, "unknown", "unknown", os); computer.daemons.Add(missionHubServer); } else if (reader.Name == "DeathRowDatabase") { var rowDatabaseDaemon = new DeathRowDatabaseDaemon(computer, "Death Row Database", os); computer.daemons.Add(rowDatabaseDaemon); } else if (reader.Name == "MedicalDatabase") { var medicalDatabaseDaemon = new MedicalDatabaseDaemon(computer, os); computer.daemons.Add(medicalDatabaseDaemon); } else if (reader.Name == "HeartMonitor") { var str7 = "UNKNOWN"; if (reader.MoveToAttribute("patient")) str7 = reader.ReadContentAsString(); computer.daemons.Add(new HeartMonitorDaemon(computer, os) { PatientID = str7 }); } else if (reader.Name.Equals("PointClicker")) { var pointClickerDaemon = new PointClickerDaemon(computer, "Point Clicker!", os); computer.daemons.Add(pointClickerDaemon); } else if (reader.Name.Equals("ispSystem")) { var ispDaemon = new ISPDaemon(computer, os); computer.daemons.Add(ispDaemon); } else if (reader.Name.Equals("porthackheart")) { var porthackHeartDaemon = new PorthackHeartDaemon(computer, os); computer.daemons.Add(porthackHeartDaemon); } else if (reader.Name.Equals("SongChangerDaemon")) { var songChangerDaemon = new SongChangerDaemon(computer, os); computer.daemons.Add(songChangerDaemon); } else if (reader.Name == "UploadServerDaemon") { string str7; var input = str7 = ""; var foldername = str7; var serviceName = str7; if (reader.MoveToAttribute("name")) serviceName = reader.ReadContentAsString(); if (reader.MoveToAttribute("foldername")) foldername = reader.ReadContentAsString(); if (reader.MoveToAttribute("color")) input = reader.ReadContentAsString(); var needsAuthentication = false; if (reader.MoveToAttribute("needsAuh")) needsAuthentication = reader.ReadContentAsBoolean(); var themeColor = Color.White; if (input != "") themeColor = Utils.convertStringToColor(input); var uploadServerDaemon = new UploadServerDaemon(computer, serviceName, themeColor, os, foldername, needsAuthentication); computer.daemons.Add(uploadServerDaemon); } reader.Read(); } computer.files = FileSystem.load(reader); computer.traceTime = num1; computer.portsNeededForCrack = num2; computer.adminIP = str5; computer.idName = str2; computer.icon = str4; computer.attatchedDeviceIDs = str3; for (var index = 0; index < strArray.Length; ++index) { if (strArray[index] != "") computer.links.Add(Convert.ToInt32(strArray[index])); } if (portsList.Length > 0) ComputerLoader.loadPortsIntoComputer(portsList, computer); if (str1 == "mail") os.netMap.mailServer = computer; else if (str1 == "player") os.thisComputer = computer; return computer; }
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; }