/// <summary> /// Gets a named value stored within this key. /// </summary> /// <param name="name">The name of the value to retrieve.</param> /// <param name="defaultValue">The default value to return, if no existing value is stored.</param> /// <param name="options">Flags controlling how the value is processed before it's returned.</param> /// <returns>The value as a .NET object.</returns> /// <remarks>The mapping from registry type of .NET type is as follows: /// <list type="table"> /// <listheader> /// <term>Value Type</term> /// <term>.NET type</term> /// </listheader> /// <item> /// <description>String</description> /// <description>string</description> /// </item> /// <item> /// <description>ExpandString</description> /// <description>string</description> /// </item> /// <item> /// <description>Link</description> /// <description>string</description> /// </item> /// <item> /// <description>DWord</description> /// <description>uint</description> /// </item> /// <item> /// <description>DWordBigEndian</description> /// <description>uint</description> /// </item> /// <item> /// <description>MultiString</description> /// <description>string[]</description> /// </item> /// <item> /// <description>QWord</description> /// <description>ulong</description> /// </item> /// </list> /// </remarks> public object GetValue(string name, object defaultValue, Microsoft.Win32.RegistryValueOptions options) { RegistryValue regVal = GetRegistryValue(name); if (regVal != null) { if (regVal.DataType == RegistryValueType.ExpandString && (options & Microsoft.Win32.RegistryValueOptions.DoNotExpandEnvironmentNames) == 0) { return(Environment.ExpandEnvironmentVariables((string)regVal.Value)); } else { return(regVal.Value); } } return(defaultValue); }
/// <summary> /// 讀取指定註冊表 /// 擷取與指定名稱及擷取選項關聯的值。如果找不到名稱,則傳回您提供的預設值。 /// </summary> /// <param name="name">要擷取的值的名稱。這個字串不會區分大小寫</param> /// <param name="value">name 不存在時所傳回的值</param> /// <param name="options">其中一個列舉值,指定擷取之值的選擇性處理</param> /// <returns>與 name 關聯的值,根據指定的 options 處理,如果找不到 name,則為 defaultValue</returns> public Object RegistrykeyRead(String name, Object value, Microsoft.Win32.RegistryValueOptions options) { Object oo = null; try { Microsoft.Win32.RegistryKey regkey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(Registrykey); if (regkey == null) { return(oo); } oo = regkey.GetValue(name, value, options); regkey.Close(); } catch (Exception ex) { RegistryException = ex.Message; return(oo); } return(oo); }
public object GetValue(string name, object defaultValue, Microsoft.Win32.RegistryValueOptions options) { return(default(object)); }
public object?GetValue(string?name, object?defaultValue, Microsoft.Win32.RegistryValueOptions options) { throw null; }
public object GetValue(string name, object defaultValue, Microsoft.Win32.RegistryValueOptions options) { return(_regKey.GetValue(name, defaultValue, options)); }
public object GetValue(string name, object defaultValue, Microsoft.Win32.RegistryValueOptions options) => throw null;
public object GetValue(string name, [AllowNull] object defaultValue, Microsoft.Win32.RegistryValueOptions options) { return(inner.GetValue(name, defaultValue, options)); }