/// <summary> /// Applies the xml changes to this instance. /// </summary> /// <returns></returns> public Boolean Run() { //Add them in a specific order foreach (XmlAdd mod in file.Add) { mod.Value = RenderConfigEngine.ReplaceEnvironmentVariables(mod.Value); LogUtilities.LogKeyValue("TYPE", "ADD", 27, MessageImportance.High, log); LogModificationDetails(mod.xpath, mod.attribute, mod.Value, string.Empty, log); Add(mod); } foreach (XmlUpdate mod in file.Update) { mod.Value = RenderConfigEngine.ReplaceEnvironmentVariables(mod.Value); LogUtilities.LogKeyValue("TYPE", "UPDATE", 27, MessageImportance.High, log); LogModificationDetails(mod.xpath, string.Empty, mod.Value, string.Empty, log); Update(mod); } foreach (XmlReplace mod in file.Replace) { //HACK: This is not pretty...anytime I use out I swear a puppy dies somewhere... mod.Value = RenderConfigEngine.ReplaceEnvironmentVariables(mod.Value); LogUtilities.LogKeyValue("TYPE", "REPLACE", 27, MessageImportance.High, log); LogModificationDetails(string.Empty, string.Empty, mod.Value, mod.regex, log); int count = 0; document.LoadXml(RenderConfigEngine.RegExParseAndReplace(out count, mod.regex, mod.Value, document.OuterXml.ToString())); LogUtilities.LogCount(count, log); } foreach (XmlDelete mod in file.Delete) { LogUtilities.LogKeyValue("TYPE", "DELETE", 27, MessageImportance.High, log); LogModificationDetails(mod.xpath, string.Empty, mod.Value, string.Empty, log); Delete(mod); } //TODO: Make sure that we stamp the renderconfig data if required if (config.StampRenderData) { XmlComment comment = document.CreateComment("Test Comment"); document.FirstChild.AppendChild(comment); } //HACK Why oh why are XmlWriterSettings and XmlReaderSettings SOOO SIMILAR, and yet.... XmlWriterSettings writerSettings = GetXmlWriterSettings(config.CleanOutput, document); using (XmlWriter writer = XmlWriter.Create(targetFile, writerSettings)) { document.Save(writer); } //HACK BAD returnCode = true; return(returnCode); }