public IOfferWindowsRegistrySubKeyOperations Add(string keyName, string defaultValue, Action<IOfferWindowsRegistryOptions> options = null) { var optBuilder = new WindowsRegistryOptionsBuilder(); if (options != null) { options(optBuilder); } var valuesBuilder = optBuilder.Values as WindowsRegistryValueBuilder; var keysBuilder = optBuilder.SubKeys as WindowsRegistrySubKeyBuilder; _subKeys.Add(new WindowsRegistrySubKey(keyName, "", valuesBuilder.Values, keysBuilder.Keys)); return this; }
public IOfferWindowsRegistrySubKeyOperations Add(string keyName, string defaultValue, Action <IOfferWindowsRegistryOptions> options = null) { var optBuilder = new WindowsRegistryOptionsBuilder(); if (options != null) { options(optBuilder); } var valuesBuilder = optBuilder.Values as WindowsRegistryValueBuilder; var keysBuilder = optBuilder.SubKeys as WindowsRegistrySubKeyBuilder; _subKeys.Add(new WindowsRegistrySubKey(keyName, "", valuesBuilder.Values, keysBuilder.Keys)); return(this); }
/// <summary> /// Creates a Windows Registry key with default value and optional values and sub keys. /// </summary> /// <param name="reg"></param> /// <param name="root">The Windows Registry hive to use. See <see cref="WindowsRegistryRoot"/> for available options. Example: WindowsRegistryRoot.HKEY_LOCAL_MACHINE</param> /// <param name="key">Name of the key to create. Example: SOFTWARE\ConDep</param> /// <param name="defaultValue">The default value of the key</param> /// <param name="options">Additional options for setting Windows Registry values and sub keys.</param> /// <returns></returns> public static IOfferWindowsRegistryOperations CreateKey(this IOfferWindowsRegistryOperations reg, WindowsRegistryRoot root, string key, string defaultValue, Action<IOfferWindowsRegistryOptions> options = null) { var optBuilder = new WindowsRegistryOptionsBuilder(); if (options != null) { options(optBuilder); } var valuesBuilder = optBuilder.Values as WindowsRegistryValueBuilder; var keysBuilder = optBuilder.SubKeys as WindowsRegistrySubKeyBuilder; var op = new CreateWindowsRegistryKeyOperation(root, key, defaultValue, valuesBuilder.Values, keysBuilder.Keys); var regBuilder = reg as WindowsRegistryBuilder; Configure.Operation(regBuilder.RemoteConfigurationBuilder, op); return reg; }