private void thirteenButton6_Click(object sender, EventArgs e) { if (thirteenTextBox1.Text == "") { MessageBox.Show("Pick a file first goofball."); } else { ConfuserProject proj = new ConfuserProject(); proj.PluginPaths.Add(Directory.GetCurrentDirectory() + "\\KoiVM.Confuser.exe"); proj.BaseDirectory = Path.GetDirectoryName(thirteenTextBox1.Text); proj.OutputDirectory = Path.Combine(Path.GetDirectoryName(thirteenTextBox1.Text) + @"\Confused"); //output directory //add a module to the project ProjectModule module = new ProjectModule(); //create a instance of ProjectModule module.Path = Path.GetFileName(thirteenTextBox1.Text); //sets the module name] proj.Add(module); //adds module to project Rule rule = new Rule("true", ProtectionPreset.None, false); //creates a Global Rule, with no preset and "true" patern, without inherit if (groupBox1.Enabled == true) { if (antiTamper.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("anti tamper", SettingItemAction.Add); rule.Add(protection); } if (antiDebug.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("anti debug", SettingItemAction.Add); rule.Add(protection); } if (calli.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("Calli Protection", SettingItemAction.Add); rule.Add(protection); } if (constants.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("constants", SettingItemAction.Add); rule.Add(protection); } if (controlFlow.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("ctrl flow", SettingItemAction.Add); rule.Add(protection); } if (invalidMetadat.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("invalid metadata", SettingItemAction.Add); rule.Add(protection); } if (renamer.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("rename", SettingItemAction.Add); rule.Add(protection); } if (refProxy.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("ref proxy", SettingItemAction.Add); rule.Add(protection); } if (mildRefProxy.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("Clean ref proxy", SettingItemAction.Add); rule.Add(protection); } if (moduleFlood.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("module flood", SettingItemAction.Add); rule.Add(protection); } if (fakeNative.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("Fake Native", SettingItemAction.Add); rule.Add(protection); } if (renameAssembly.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("Rename Module", SettingItemAction.Add); rule.Add(protection); } if (renameAssembly.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("Mutations", SettingItemAction.Add); rule.Add(protection); } if (local2field.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("local to field", SettingItemAction.Add); rule.Add(protection); } if (hideMethods.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("Hide Methods", SettingItemAction.Add); rule.Add(protection); } if (md5Checksum.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("MD5 Hash Check", SettingItemAction.Add); rule.Add(protection); } if (eraseHeaders.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("erase headers", SettingItemAction.Add); rule.Add(protection); } proj.PluginPaths.Clear(); } else if (fastVirt.Checked) { string[] array = { "MD5 Hash Check", "erase headers", "virt", "Rename Module" }; foreach (string a in array) { SettingItem <Protection> protection = new SettingItem <Protection>(a, SettingItemAction.Add); rule.Add(protection); } } else if (strongVirt.Checked) { string[] array = { "MD5 Hash Check", "erase headers", "virt", "constants", "Clean ref proxy", "Rename Module", "anti tamper" }; foreach (string a in array) { SettingItem <Protection> protection = new SettingItem <Protection>(a, SettingItemAction.Add); rule.Add(protection); } } proj.Rules.Add(rule); //add our Global rule to the project XmlDocument doc = proj.Save(); //convert our project to xml document doc.Save("temp.crproj"); //save the xml document as a file Process.Start("Confuser.CLI.exe", "-n temp.crproj").WaitForExit(); File.Delete("temp.crproj"); } }
/// <summary> /// Loads the project from specified XML document. /// </summary> /// <param name="doc">The XML document storing the project.</param> /// <exception cref="Confuser.Core.Project.ProjectValidationException"> /// The project XML contains schema errors. /// </exception> public void Load(XmlDocument doc) { doc.Schemas.Add(Schema); var exceptions = new List <XmlSchemaException>(); doc.Validate((sender, e) => { if (e.Severity != XmlSeverityType.Error) { return; } exceptions.Add(e.Exception); }); if (exceptions.Count > 0) { throw new ProjectValidationException(exceptions); } XmlElement docElem = doc.DocumentElement; OutputDirectory = docElem.Attributes["outputDir"].Value; BaseDirectory = docElem.Attributes["baseDir"].Value; if (docElem.Attributes["seed"] != null) { Seed = docElem.Attributes["seed"].Value.NullIfEmpty(); } else { Seed = null; } if (docElem.Attributes["debug"] != null) { Debug = bool.Parse(docElem.Attributes["debug"].Value); } else { Debug = false; } Packer = null; Clear(); ProbePaths.Clear(); PluginPaths.Clear(); Rules.Clear(); foreach (XmlElement i in docElem.ChildNodes.OfType <XmlElement>()) { if (i.Name == "rule") { var rule = new Rule(); rule.Load(i); Rules.Add(rule); } else if (i.Name == "packer") { Packer = new SettingItem <Packer>(); Packer.Load(i); } else if (i.Name == "probePath") { ProbePaths.Add(i.InnerText); } else if (i.Name == "plugin") { PluginPaths.Add(i.InnerText); } else { var asm = new ProjectModule(); asm.Load(i); Add(asm); } } }
private void ThirteenButton12_Click(object sender, EventArgs e) { if (textBox1.Text.Length < 2) { MessageBox.Show("Title of the projects need to be > than 2 letters."); } else { listBox1.Items.Add(textBox1.Text + ".rzyproj"); ConfuserProject proj = new ConfuserProject(); try { proj.BaseDirectory = Path.GetDirectoryName(thirteenTextBox1.Text); proj.OutputDirectory = Path.Combine(Path.GetDirectoryName(thirteenTextBox1.Text) + @"\RzyProtector"); } catch { } ProjectModule module = new ProjectModule(); module.Path = Path.GetFileName(thirteenTextBox1.Text); proj.Add(module); Rule rule = new Rule("true", ProtectionPreset.None, false); if (antivmcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("avm"), SettingItemAction.Add); rule.Add(protection); } if (antiildasmcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("ildasm"), SettingItemAction.Add); rule.Add(protection); } if (antide4dot.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("de4dot"), SettingItemAction.Add); rule.Add(protection); } if (antidnspy.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("dnspy"), SettingItemAction.Add); rule.Add(protection); } if (antitampercheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("tamper"), SettingItemAction.Add); rule.Add(protection); } if (antidumpcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("preventdump"), SettingItemAction.Add); rule.Add(protection); } if (antidebugcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("preventdebug"), SettingItemAction.Add); rule.Add(protection); } if (antimemoryeditcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("memory"), SettingItemAction.Add); rule.Add(protection); } if (antiwatermarkcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("watermark"), SettingItemAction.Add); rule.Add(protection); } if (callicheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("calliprot"), SettingItemAction.Add); rule.Add(protection); } if (constantscheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("const"), SettingItemAction.Add); rule.Add(protection); } if (ctrlflowcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("control flow"), SettingItemAction.Add); rule.Add(protection); } if (junkcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("addjunk"), SettingItemAction.Add); rule.Add(protection); } if (refproxycheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("proxy"), SettingItemAction.Add); rule.Add(protection); } if (resourcescheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("resources"), SettingItemAction.Add); rule.Add(protection); } if (erasecheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("erase"), SettingItemAction.Add); rule.Add(protection); } if (fakenativecheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("native"), SettingItemAction.Add); rule.Add(protection); } if (lcltofieldscheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("local to field"), SettingItemAction.Add); rule.Add(protection); } if (modulerenamercheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("modulerenamer"), SettingItemAction.Add); rule.Add(protection); } if (stackunderflowcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("stack"), SettingItemAction.Add); rule.Add(protection); } if (admincheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("forceadmin"), SettingItemAction.Add); rule.Add(protection); } if (hidemethodscheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("methodshide"), SettingItemAction.Add); rule.Add(protection); } if (invalidmetadatacheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("metadata"), SettingItemAction.Add); rule.Add(protection); } if (md5check.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("checksum"), SettingItemAction.Add); rule.Add(protection); } if (modulefloodcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("floodmodule"), SettingItemAction.Add); rule.Add(protection); } if (fakeobfuscatorcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("fakeobf"), SettingItemAction.Add); rule.Add(protection); } if (renamercheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("renamer"), SettingItemAction.Add); rule.Add(protection); } if (antifiddlercheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("preventfiddler"), SettingItemAction.Add); rule.Add(protection); } if (antihttpcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("preventhttp"), SettingItemAction.Add); rule.Add(protection); } if (processmonitorcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("processmonitor"), SettingItemAction.Add); rule.Add(protection); } proj.PluginPaths.Clear(); proj.Rules.Add(rule); XmlDocument doc = proj.Save(); doc.Save($"{Directory.GetCurrentDirectory()}\\Projects\\{textBox1.Text}.rzyproj"); } }
private void ThirteenButton4_Click(object sender, EventArgs e) { if (thirteenTextBox1.Text == "") { MessageBox.Show("You need to select a file to protect !", "RzyObfuscator"); } else { string path = Directory.GetCurrentDirectory() + "\\Configs\\CustomRenamer.rzy"; string dir = Path.GetDirectoryName(path); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } string path2 = Directory.GetCurrentDirectory() + "\\Configs\\CustomModule.rzy"; string dir2 = Path.GetDirectoryName(path2); if (!Directory.Exists(dir2)) { Directory.CreateDirectory(dir2); } ConfuserProject proj = new ConfuserProject(); proj.BaseDirectory = Path.GetDirectoryName(thirteenTextBox1.Text); proj.OutputDirectory = Path.Combine(Path.GetDirectoryName(thirteenTextBox1.Text) + @"\RzyProtector"); ProjectModule module = new ProjectModule(); module.Path = Path.GetFileName(thirteenTextBox1.Text); proj.Add(module); Rule rule = new Rule("true", ProtectionPreset.None, false); if (antivmcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("avm"), SettingItemAction.Add); rule.Add(protection); } if (antiildasmcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("ildasm"), SettingItemAction.Add); rule.Add(protection); } if (antide4dot.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("de4dot"), SettingItemAction.Add); rule.Add(protection); } if (antidnspy.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("dnspy"), SettingItemAction.Add); rule.Add(protection); } if (antitampercheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("tamper"), SettingItemAction.Add); rule.Add(protection); } if (antidumpcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("preventdump"), SettingItemAction.Add); rule.Add(protection); } if (antidebugcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("preventdebug"), SettingItemAction.Add); rule.Add(protection); } if (antimemoryeditcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("memory"), SettingItemAction.Add); rule.Add(protection); } if (antiwatermarkcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("watermark"), SettingItemAction.Add); rule.Add(protection); } if (callicheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("calliprot"), SettingItemAction.Add); rule.Add(protection); } if (constantscheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("const"), SettingItemAction.Add); rule.Add(protection); } if (ctrlflowcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("control flow"), SettingItemAction.Add); rule.Add(protection); } if (junkcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("addjunk"), SettingItemAction.Add); rule.Add(protection); } if (refproxycheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("proxy"), SettingItemAction.Add); rule.Add(protection); } if (resourcescheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("resources"), SettingItemAction.Add); rule.Add(protection); } if (erasecheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("erase"), SettingItemAction.Add); rule.Add(protection); } if (fakenativecheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("native"), SettingItemAction.Add); rule.Add(protection); } if (lcltofieldscheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("local to field"), SettingItemAction.Add); rule.Add(protection); } if (modulerenamercheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("modulerenamer"), SettingItemAction.Add); rule.Add(protection); } if (stackunderflowcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("stack"), SettingItemAction.Add); rule.Add(protection); } if (admincheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("forceadmin"), SettingItemAction.Add); rule.Add(protection); } if (hidemethodscheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("methodshide"), SettingItemAction.Add); rule.Add(protection); } if (invalidmetadatacheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("metadata"), SettingItemAction.Add); rule.Add(protection); } if (md5check.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("checksum"), SettingItemAction.Add); rule.Add(protection); } if (modulefloodcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("floodmodule"), SettingItemAction.Add); rule.Add(protection); } if (fakeobfuscatorcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("fakeobf"), SettingItemAction.Add); rule.Add(protection); } if (renamercheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("renamer"), SettingItemAction.Add); rule.Add(protection); } if (antifiddlercheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("preventfiddler"), SettingItemAction.Add); rule.Add(protection); } if (antihttpcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("preventhttp"), SettingItemAction.Add); rule.Add(protection); } if (processmonitorcheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>(TrinitySeal.Seal.Var("processmonitor"), SettingItemAction.Add); rule.Add(protection); } if (mutateconstantscheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("Mutate Constants", SettingItemAction.Add); rule.Add(protection); } if (weakcallicheck.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("Weak Calli", SettingItemAction.Add); rule.Add(protection); } //SettingItem<Protection> protectionR = new SettingItem<Protection>("Lite Calli", SettingItemAction.Add); //rule.Add(protectionR); proj.PluginPaths.Clear(); proj.Rules.Add(rule); XmlDocument doc = proj.Save(); doc.Save("temp.crproj"); Process.Start("RzyProtector.CLI.exe", "-n temp.crproj").WaitForExit(); File.Delete("temp.crproj"); } }
private void thirteenButton6_Click(object sender, EventArgs e) { if (thirteenTextBox1.Text == "") { MessageBox.Show("Pick a file first goofball."); } else { filelocation = thirteenTextBox1.Text; ConfuserProject project = new ConfuserProject(); //create a project project.BaseDirectory = Path.GetDirectoryName(filelocation); project.OutputDirectory = Path.Combine(Path.GetDirectoryName(filelocation) + @"\Confused"); //output directory //add a module to the project ProjectModule module = new ProjectModule(); //create a instance of ProjectModule module.Path = Path.GetFileName(filelocation); //sets the module name] project.Add(module); //adds module to project Rule rule = new Rule("true", ProtectionPreset.None, false); //creates a Global Rule, with no preset and "true" patern, without inherit if (antiTamper.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("anti tamper", SettingItemAction.Add); rule.Add(protection); } if (antiDebug.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("anti debug", SettingItemAction.Add); rule.Add(protection); } if (antiDump.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("anti dump", SettingItemAction.Add); rule.Add(protection); } if (calli.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("Calli Protection", SettingItemAction.Add); rule.Add(protection); } if (constants.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("constants", SettingItemAction.Add); rule.Add(protection); } if (controlFlow.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("ctrl flow", SettingItemAction.Add); rule.Add(protection); } if (invalidMetadat.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("invalid metadata", SettingItemAction.Add); rule.Add(protection); } if (renamer.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("rename", SettingItemAction.Add); rule.Add(protection); } if (refProxy.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("ref proxy", SettingItemAction.Add); rule.Add(protection); } if (mildRefProxy.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("Clean ref proxy", SettingItemAction.Add); rule.Add(protection); } if (moduleFlood.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("module flood", SettingItemAction.Add); rule.Add(protection); } if (fakeNative.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("Fake Native", SettingItemAction.Add); rule.Add(protection); } if (renameAssembly.Checked) { SettingItem <Protection> protection = new SettingItem <Protection>("Rename Module", SettingItemAction.Add); rule.Add(protection); } project.Rules.Add(rule); //add our Global rule to the project XmlDocument doc = project.Save(); //convert our project to xml document doc.Save("temp.crproj"); //save the xml document as a file Process.Start("Confuser.CLI.exe", "-n temp.crproj").WaitForExit(); File.Delete("temp.crproj"); label2.ForeColor = Color.LimeGreen; label2.Text = "Protection complete, check log tab!"; } }
public void Load(XmlDocument doc) { doc.Schemas.Add(Schema); List <Tuple <string, XmlSchemaException> > exceptions = new List <Tuple <string, XmlSchemaException> >(); doc.Validate((sender, e) => { if (e.Severity != XmlSeverityType.Error) { return; } exceptions.Add(new Tuple <string, XmlSchemaException>(e.Message, e.Exception)); }); if (exceptions.Count > 0) { throw new ProjectValidationException(exceptions); } XmlElement docElem = doc.DocumentElement; this.OutputPath = docElem.Attributes["outputDir"].Value; this.SNKeyPath = docElem.Attributes["snKey"].Value; if (docElem.Attributes["seed"] != null) { this.Seed = docElem.Attributes["seed"].Value; } else { this.Seed = null; } if (docElem.Attributes["debug"] != null) { this.Debug = bool.Parse(docElem.Attributes["debug"].Value); } else { this.Debug = false; } foreach (XmlElement i in docElem.ChildNodes.OfType <XmlElement>()) { if (i.Name == "plugin") { Plugins.Add(i.Attributes["path"].Value); } else if (i.Name == "rule") { Rule settings = new Rule(); settings.Load(i); Rules.Add(settings); } else if (i.Name == "packer") { Packer = new SettingItem <Packer>(); Packer.Load(i); } else { ProjectAssembly asm = new ProjectAssembly(); asm.Load(i); this.Add(asm); } } }
/// <summary> /// Loads the module description from XML element. /// </summary> /// <param name="elem">The serialized module description.</param> internal void Load(XmlElement elem) { Path = elem.Attributes["path"].Value; if (elem.Attributes["external"] != null) { IsExternal = bool.Parse(elem.Attributes["external"].Value); } else { IsExternal = false; } if (elem.Attributes["snKey"] != null) { SNKeyPath = elem.Attributes["snKey"].Value.NullIfEmpty(); } else { SNKeyPath = null; } if (elem.Attributes["snKeyPass"] != null) { SNKeyPassword = elem.Attributes["snKeyPass"].Value.NullIfEmpty(); } else { SNKeyPassword = null; } bool delaySig = false; if (elem.Attributes["snDelaySig"] != null) { bool.TryParse(elem.Attributes["snDelaySig"].Value, out delaySig); } SNDelaySig = delaySig; if (elem.Attributes["snPubKey"] != null) { SNPubKeyPath = elem.Attributes["snPubKey"].Value.NullIfEmpty(); } else { SNPubKeyPath = null; } if (elem.Attributes["snSigKey"] != null) { SNSigKeyPath = elem.Attributes["snSigKey"].Value.NullIfEmpty(); } else { SNSigKeyPath = null; } if (elem.Attributes["snSigKeyPass"] != null) { SNSigKeyPassword = elem.Attributes["snSigKeyPass"].Value.NullIfEmpty(); } else { SNSigKeyPassword = null; } if (elem.Attributes["snPubSigKey"] != null) { SNPubSigKeyPath = elem.Attributes["snPubSigKey"].Value.NullIfEmpty(); } else { SNPubSigKeyPath = null; } Rules.Clear(); foreach (XmlElement i in elem.ChildNodes.OfType <XmlElement>()) { var rule = new Rule(); rule.Load(i); Rules.Add(rule); } }