/// <summary> /// Imports a registry XML file. /// </summary> /// <param name="path">Path to the registry XML file to import.</param> /// <param name="properties">Optional properties to replace during import.</param> internal void Import(string path, Dictionary <string, string> properties = null) { var settings = new XmlReaderSettings(); settings.CloseInput = true; settings.IgnoreComments = true; settings.IgnoreProcessingInstructions = true; settings.IgnoreWhitespace = true; settings.DtdProcessing = DtdProcessing.Prohibit; var absolutePath = System.IO.Path.Combine(Environment.CurrentDirectory, path); using (var reader = XmlReader.Create(absolutePath, settings)) { var importer = new RegistryXml(); if (null != properties) { // Overwrite or add whatever is there by default. foreach (var pair in properties) { importer.Properties[pair.Key] = pair.Value; } } importer.Import(reader); } }
/// <summary> /// Imports a registry XML file. /// </summary> /// <param name="path">Path to the registry XML file to import.</param> /// <param name="properties">Optional properties to replace during import.</param> internal void Import(string path, Dictionary<string, string> properties = null) { var settings = new XmlReaderSettings(); settings.CloseInput = true; settings.IgnoreComments = true; settings.IgnoreProcessingInstructions = true; settings.IgnoreWhitespace = true; settings.DtdProcessing = DtdProcessing.Prohibit; var absolutePath = System.IO.Path.Combine(Environment.CurrentDirectory, path); using (var reader = XmlReader.Create(absolutePath, settings)) { var importer = new RegistryXml(); if (null != properties) { // Overwrite or add whatever is there by default. foreach (var pair in properties) { importer.Properties[pair.Key] = pair.Value; } } importer.Import(reader); } }