public DictionaryWrappingIniFileSection( IINIFile iniFile, string section) { _iniFile = iniFile; _section = section; }
private void LoadFrom(IINIFile iniFile) { LoadSettingsFrom(iniFile); LoadSourcesFrom(iniFile); LoadBlacklistFrom(iniFile); LoadWhitelistFrom(iniFile); }
internal MergedIniFile( IINIFile iniFile, MergeStrategies mergeStrategy) { IniFile = iniFile; MergeStrategy = mergeStrategy; }
public static IEnumerable <string> EnumerateLayouts(this IINIFile config) { return(config.Sections .Where(s => s.StartsWith(Constants.Sections.APP_LAYOUT_PREFIX)) .Select(GetLayoutName) .Where(s => !s.IsNullOrEmpty()) .Distinct()); }
public Settings(IINIFile iniFile) { if (iniFile == null) { throw new ArgumentNullException(nameof(iniFile)); } LoadFrom(iniFile); }
public DeviceReenumerator( ILogger logger, IINIFile config, IConfigLocator configLocator) { _logger = logger; _config = config; _configLocator = configLocator; }
private void LoadRawLinesInto(List <string> target, IINIFile iniFile, string section) { if (!iniFile.HasSection(section)) { return; } var lines = iniFile[section].Keys.Select(k => GetFullLine(k, iniFile[section])); target.AddRange(lines); }
public LastLayoutUtility( IINIFile config, ILayoutRestorer layoutRestorer, IEventAggregator eventAggregator, ITrayIcon trayIcon ) { _config = config; _layoutRestorer = layoutRestorer; _trayIcon = trayIcon; eventAggregator .GetEvent <LayoutRestoredEvent>() .Subscribe(OnLayoutRestored); }
public static T GetSetting <T>( this IINIFile iniFile, string section, string setting, T defaultValue = default(T)) { if (!iniFile.HasSetting(section, setting)) { return(defaultValue); } var stringValue = iniFile[section][setting]; return(AttemptToConvert <T>(stringValue, defaultValue)); }
public LayoutSaver( IINIFile config, IUserInput userInput, ISectionNameHelper sectionNameHelper, IDesktopWindowUtil desktopWindowUtil, IEventAggregator eventAggregator, ICheckListDialogFactory dialogFactory ) { _config = config; _userInput = userInput; _sectionNameHelper = sectionNameHelper; _desktopWindowUtil = desktopWindowUtil; _eventAggregator = eventAggregator; _dialogFactory = dialogFactory; }
private void LoadSettingsFrom(IINIFile iniFile) { Func <string, string, string> getSetting = (key, defaultValue) => iniFile.GetValue(Constants.Sections.SETTINGS, key, defaultValue); RefreshIntervalInMinutes = getSetting( Constants.Keys.REFRESH_INTERVAL_IN_MINUTES, Constants.Defaults.ONE_DAY.ToString() ).AsInteger(); HostsFile = Environment.ExpandEnvironmentVariables(getSetting( Constants.Keys.HOSTS_FILE, Constants.Defaults.WINDOWS_HOSTS_FILE_LOCATION )); CacheFolder = getSetting(Constants.Keys.CACHE_FOLDER, DetermineDefaultCacheFolder()); var redirectIp = getSetting(Constants.Keys.REDIRECT_IP, Constants.Defaults.LOCALHOST); RedirectIp = IsValidIp(redirectIp) ? redirectIp : Constants.Defaults.LOCALHOST; }
public LayoutRestorer( IINIFile config, IApplicationRestarter applicationRestarter, ISectionNameHelper sectionNameHelper, IDesktopWindowUtil desktopWindowUtil, IEventAggregator eventAggregator, ITrayIcon trayIcon, IDeviceReenumerator deviceReenumerator ) { _config = config; _applicationRestarter = applicationRestarter; _sectionNameHelper = sectionNameHelper; _desktopWindowUtil = desktopWindowUtil; _eventAggregator = eventAggregator; _trayIcon = trayIcon; _deviceReenumerator = deviceReenumerator; }
private void LoadConfig(string name) { // config files will live in the user profile folder (eg C:\users\myprofile) var fullPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), name); // if the file exists, it will be loaded; if not, then the INIFile instance // will still know that when it's time to save, it should save back to that file _loadedConfig = new INIFile(fullPath); // load up the label, if we can ColorDisplay.Text = _loadedConfig.HasSetting("colors", "FavoriteColor") ? _loadedConfig["colors"]["FavoriteColor"] : "(no favorite color chosen yet for #1)"; ColorDisplay.ForeColor = TryDetermineColorFor(ColorDisplay.Text); // reset the selected color in the drop-down ColorList.SelectedIndex = -1; // signal to the user that a color may be selected by enabling the controls ColorList.Enabled = true; ChangeLabel.Enabled = true; }
private bool GeneratedFirstTimeConfig() { if (File.Exists(MyConfig)) { return(false); } var config = new INIFile(); config.AddSection(Sections.GENERAL); var general = config.GetSection(Sections.GENERAL); general[Settings.POLL] = "1"; general[Settings.BACKOFF] = "1,1,1,5,10"; general[Settings.RESET] = "30"; config.AddSection(Sections.SERVICES); config.Persist(MyConfig); _config = config; _configLastLoaded = Now; return(true); }
private void LoadConfig() { _config = new INIFile(MyConfig); _configLastLoaded = Now; }
private void LoadWhitelistFrom(IINIFile iniFile) { LoadRawLinesInto(_whitelist, iniFile, Constants.Sections.WHITELIST); }
private void CreateEmptySection( IINIFile iniFile, string sectionName) { iniFile.AddSection(sectionName); }
public ApplicationRestarter(IINIFile config) { _config = config; }
public SectionNameHelper(IINIFile config) { _config = config; }
private void LoadBlacklistFrom(IINIFile iniFile) { LoadRawLinesInto(_blacklist, iniFile, Constants.Sections.BLACKLIST); }
private void LoadSourcesFrom(IINIFile iniFile) { LoadRawLinesInto(_sources, iniFile, Constants.Sections.SOURCES); }
private ISettings Create(IINIFile iniFile) { return(new Implementations.Settings.Settings(iniFile)); }