示例#1
0
        private static void LoadFromXml(XElement element)
        {
            if (element.Name == "configuration")
            {
                LogHistory = LoadElementValue(element.Element("logHistory"), 100);
                LogHistory = LogHistory > 0 ? LogHistory : 1;

                RefreshTime = LoadElementValue(element.Element("refreshTime"), 30);
                RefreshTime = RefreshTime > 0 ? RefreshTime : 1;

                // Load Servers first so log sources can find them when loading
                _servers = new List<Server>();
                var servers = element.Element("servers");
                if (servers != null)
                {
                    foreach (var cfgServer in servers.Elements("server"))
                    {
                        var server = new Server();
                        server.LoadFromXml(cfgServer);
                        _servers.Add(server);
                    }
                }

                _logSources = new LogSourceRoot();
                _logSources.LoadFromXml(element.Element("logSources"));
            }
        }