/// <summary> /// Создать парсер дефолтных настроек. /// </summary> public static ConfigSettingsParser CreateDefaultConfigSettingsParser() { var configSettingsPath = ChangeConfig.GetActualConfigSettingsPath(); if (string.IsNullOrEmpty(configSettingsPath) || !File.Exists(configSettingsPath)) { return(null); } var lastWriteTime = File.GetLastWriteTimeUtc(configSettingsPath); if (lastWriteTime == configSettingsLastWriteTime) { return(cachedConfigSettingsParser); } configSettingsLastWriteTime = lastWriteTime; try { cachedConfigSettingsParser = ChangeConfig.CreateConfigSettingsParser(configSettingsPath); } catch (Exception) { return(null); } return(cachedConfigSettingsParser); }
private static ReloadedConfigSettingsParser CreateParser(Action reloadHandler, Action <Exception> errorHandler, TimeSpan?waitBeforeReload) { var configSettingsPath = ChangeConfig.GetActualConfigSettingsPath(); return(new ReloadedConfigSettingsParser(configSettingsPath, reloadHandler, errorHandler, waitBeforeReload)); }