public AddDegreeMission(string targetName, string degreeName, string uniName, float desiredGPA, OS _os) { AddDegreeMission addDegreeMission = this; this.ownerName = targetName; this.degreeName = degreeName; this.uniName = uniName; this.desiredGPA = desiredGPA; Action init = (Action)null; init = (Action)(() => { if (_os.netMap.academicDatabase == null) { _os.delayer.Post(ActionDelayer.NextTick(), init); } else { closure_0.database = (AcademicDatabaseDaemon)_os.netMap.academicDatabase.getDaemon(typeof(AcademicDatabaseDaemon)); } }); init(); }
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; }