public static Dictionary <string, DefinitionBase> Parse(TextReader reader) { var parser = new XmlConfigParser(reader); parser.Parse(); return(parser.Definitions); }
public static Dictionary <string, DefinitionBase> Parse(Stream stream) { var parser = new XmlConfigParser(stream); parser.Parse(); return(parser.Definitions); }
public ObjectContainer(string xml) { if (string.IsNullOrWhiteSpace(xml)) { throw new ArgumentNullException(nameof(xml)); } try { Log.Debug("Parse config string and initialize container."); container = XmlConfigParser.Parse(xml); Log.Debug($"Container initialized successfully, total {container.Count} objects loaded."); } catch (Exception ex) { Log.Error($"Container initialized error: {ex.Message}.", ex); throw ex; } }
public ObjectContainer(FileInfo configFile) { if (!configFile.Exists) { throw new FileNotFoundException("File cannot be found.", configFile.FullName); } try { Log.Debug("Parse config file and initialize container."); using (Stream stream = configFile.OpenRead()) { container = XmlConfigParser.Parse(stream); } Log.Debug($"Container initialized successfully, total {container.Count} objects loaded."); } catch (Exception ex) { Log.Error($"Container initialized error: {ex.Message}.", ex); throw ex; } }