/// <summary> /// Loads application configuration /// </summary> /// <exception cref="ConfigurationManagerLoadingException">Throws if an error occured during application cofiguration loading</exception> public void Load() { this.State = ConfigurationManagerState.NotLoaded; try { XDocument configDoc = XDocument.Load(ConfigPaths.ConfigUri); this.useDefaultRssUriCollection = Converter.ParseBoolean(configDoc.Root.Element(ConfigParamNames.UseDefaultRssUriCollection)?.Value, true); this.defaultRssUriCollection = new ReadOnlyCollection <string>(configDoc.Root.Descendants(ConfigParamNames.DefaultRssUri).Select(element => element.Value).ToArray()); this.verifyRssVersion = Converter.ParseBoolean(configDoc.Root.Element(ConfigParamNames.VerifyRssVersion)?.Value, false); } catch (Exception e) { this.State = ConfigurationManagerState.LoadingFailed; throw new ConfigurationManagerLoadingException("Error occured during application cofiguration loading.", e); } this.State = ConfigurationManagerState.Loaded; }
/// <summary> /// Resets configuration manager state to not loaded state /// </summary> public void Reset() => this.State = ConfigurationManagerState.NotLoaded;