private static void ReadConfiguration(string path, LogAdministrator logAdministrator) { var xmlSerializer = new XmlSerializer(typeof(Configurations)); Configurations fileConfigurations; using (var streamReader = new StreamReader(path)) { fileConfigurations = xmlSerializer.Deserialize(streamReader) as Configurations; } logAdministrator.SetLogLevel(fileConfigurations.LogLevel); foreach (var config in fileConfigurations.Destinations) { var parameterDictionary = config.Parameters .ToDictionary(parameter => parameter.Name, parameter => parameter.Value); logAdministrator.SetDestinationConfiguration(config.Name, parameterDictionary); if (!string.IsNullOrWhiteSpace(config.CollectMiddleware?.Name)) { logAdministrator.SetCollectMiddleware(config.Name, config.CollectMiddleware?.Name); } if (config.Middlewares != null) { var names = config.Middlewares .Select(m => m.Name) .Where(m => !string.IsNullOrWhiteSpace(m)); logAdministrator.SetMiddlewareNames(config.Name, names); } } }