/// ----------------------------------------------------------------------------- /// <summary> /// The UpdateConfigs method processes the source file and updates the various config /// files /// </summary> /// <history> /// [cnurse] 08/03/2007 created /// </history> /// ----------------------------------------------------------------------------- public void UpdateConfigs() { var nodes = SourceConfig.SelectNodes("/configuration/nodes"); if (nodes != null) { foreach (XmlNode configNode in nodes) { Debug.Assert(configNode.Attributes != null, "configNode.Attributes != null"); //Attempt to load TargetFile property from configFile Atribute TargetFileName = configNode.Attributes["configfile"].Value; string targetProductName = ""; if (configNode.Attributes["productName"] != null) { targetProductName = configNode.Attributes["productName"].Value; } bool isAppliedToProduct; TargetConfig = Config.Load(TargetFileName); if (String.IsNullOrEmpty(targetProductName) || targetProductName == "All") { isAppliedToProduct = true; } else { isAppliedToProduct = DotNetNukeContext.Current.Application.ApplyToProduct(targetProductName); } //The nodes definition is not correct so skip changes if (TargetConfig != null && isAppliedToProduct) { ProcessNodes(configNode.SelectNodes("node"), true); } } } }
/// ----------------------------------------------------------------------------- /// <summary> /// The UpdateConfig method processes the source file and updates the Target /// Config Xml Document. /// </summary> /// <param name="target">An Xml Document represent the Target Xml File</param> /// <history> /// [cnurse] 08/04/2007 created /// </history> /// ----------------------------------------------------------------------------- public void UpdateConfig(XmlDocument target) { TargetConfig = target; if (TargetConfig != null) { ProcessNodes(SourceConfig.SelectNodes("/configuration/nodes/node"), false); } }
/// ----------------------------------------------------------------------------- /// <summary> /// The UpdateConfig method processes the source file and updates the Target /// Config file. /// </summary> /// <param name="target">An Xml Document represent the Target Xml File</param> /// <param name="fileName">The fileName for the Target Xml File - relative to the webroot</param> /// <history> /// [cnurse] 08/04/2007 created /// </history> /// ----------------------------------------------------------------------------- public void UpdateConfig(XmlDocument target, string fileName) { TargetFileName = fileName; TargetConfig = target; if (TargetConfig != null) { ProcessNodes(SourceConfig.SelectNodes("/configuration/nodes/node"), true); } }
/// ----------------------------------------------------------------------------- /// <summary> /// The UpdateConfig method processes the source file and updates the Target /// Config Xml Document. /// </summary> /// <param name="target">An Xml Document represent the Target Xml File</param> /// ----------------------------------------------------------------------------- public void UpdateConfig(XmlDocument target) { var changedAnyNodes = false; TargetConfig = target; if (TargetConfig != null) { changedAnyNodes = ProcessNodes(SourceConfig.SelectNodes("/configuration/nodes/node"), false); } ConfigUpdateChangedNodes = changedAnyNodes; }
public void UpdateConfigs() { foreach (XmlNode configNode in SourceConfig.SelectNodes("/configuration/nodes")) { _TargetFileName = configNode.Attributes["configfile"].Value; TargetConfig = Config.Load(TargetFileName); if (TargetConfig != null) { ProcessNodes(configNode.SelectNodes("node"), true); } } }
public void UpdateConfigs(bool autoSave) { var changedAnyNodes = false; var nodes = SourceConfig.SelectNodes("/configuration/nodes"); if (nodes != null) { foreach (XmlNode configNode in nodes) { Debug.Assert(configNode.Attributes != null, "configNode.Attributes != null"); //Attempt to load TargetFile property from configFile Atribute TargetFileName = configNode.Attributes["configfile"].Value; string targetProductName = ""; if (configNode.Attributes["productName"] != null) { targetProductName = configNode.Attributes["productName"].Value; } bool isAppliedToProduct; if (!File.Exists(Globals.ApplicationMapPath + "\\" + TargetFileName)) { DnnInstallLogger.InstallLogInfo($"Target File {TargetFileName} doesn't exist, ignore the merge process"); return; } TargetConfig = Config.Load(TargetFileName); if (String.IsNullOrEmpty(targetProductName) || targetProductName == "All") { isAppliedToProduct = true; } else { isAppliedToProduct = DotNetNukeContext.Current.Application.ApplyToProduct(targetProductName); } //The nodes definition is not correct so skip changes if (TargetConfig != null && isAppliedToProduct) { var changedNodes = ProcessNodes(configNode.SelectNodes("node"), autoSave); changedAnyNodes = changedAnyNodes || changedNodes; if (!autoSave && changedNodes) { PendingDocuments.Add(TargetFileName, TargetConfig); } } } } ConfigUpdateChangedNodes = changedAnyNodes; }