public int GetMaximumIconSize() { if (!m_maximumIconSize.HasValue) { // int is enough m_maximumIconSize = (int)config.GetLong(maximumIconSize, 128); } return(m_maximumIconSize.Value); }
/// <summary>An AceCustomConfig extension method that gets an enum.</summary> /// <typeparam name="T">Generic enum parameter.</typeparam> /// <param name="config">The AceCustomConfig instance to act on.</param> /// <param name="strID">The key identifier.</param> /// <param name="eDefault">The default value.</param> /// <returns>The enum value.</returns> public static T GetEnum<T>(this AceCustomConfig config, string strID, T eDefault) where T : struct, IConvertible { Contract.Requires(typeof(T).IsEnum); var value = config.GetLong(strID, -1); if (value == -1) { return eDefault; } return (T)(object)(int)value; }
private void UpgradeConfig() { const string deprecatedCfgAutoPrompt = "WindowsHello_AutoPrompt"; const string deprecatedCfgValidPeriod = "WindowsHello_ValidPeriod"; _customConfig.SetString(deprecatedCfgAutoPrompt, null); long validPeriod = _customConfig.GetLong(deprecatedCfgValidPeriod, -1); if (validPeriod != -1) { _customConfig.SetString(deprecatedCfgValidPeriod, null); validPeriod *= 1000; _customConfig.SetLong(CFG_VALID_PERIOD, validPeriod); } }
private void UpgradeConfig() { var currentVersion = GetType().Assembly.GetName().Version; var savedVersion = GetSavedSettingsPluginVersion(); if (savedVersion.Major < 2) { const string deprecatedCfgValidPeriod = "WindowsHello_ValidPeriod"; _customConfig.SetString(DEPRECATED_CFG_AUTO_PROMPT, null); long validPeriod = _customConfig.GetLong(deprecatedCfgValidPeriod, -1); if (validPeriod != -1) { _customConfig.SetString(deprecatedCfgValidPeriod, null); validPeriod *= 1000; _customConfig.SetLong(CFG_VALID_PERIOD, validPeriod); } } _customConfig.SetString(CFG_SAVED_SETTINGS_PLUGIN_VERSION, currentVersion.ToString()); }