/// <summary> /// Adds a registry key value to the specified key value collection. /// </summary> /// <param name="collection">The collection which the value should be added.</param> /// <param name="value">The registry key value.</param> private static void AddValue(RegistryKeyValueCollection collection, RegistryKeyValue value) { if (collection == null) { throw new ArgumentNullException("collection"); } if (value == null) { throw new ArgumentNullException("value"); } if (string.IsNullOrEmpty(value.Name)) { throw new InvalidOperationException("One of the registry key values had no name specified."); } else if (collection.ContainsKey(value.Name)) { throw new InvalidOperationException("One of the registry key value names occured more than once for the same key: " + value.Name); } else { collection.Add(value.Name, value); } }
/// <summary> /// Adds a registry key value to the registry key using the specified name and value. /// </summary> /// <param name="name">The name of the value.</param> /// <param name="value">The data of the value.</param> /// <returns> /// The RegistryKeyValue object which was added. /// </returns> public RegistryKeyValue AddValue(string name, int value) { var keyValue = new RegistryKeyValue(name, value); this.AddValue(keyValue); return(keyValue); }
/// <summary> /// Adds a registry key value to the registry key using the specified name and value. /// </summary> /// <param name="name">The name of the value.</param> /// <param name="value">The data of the value.</param> /// <returns> /// The RegistryKeyValue object which was added. /// </returns> public RegistryKeyValue AddValue(string name, params byte[] value) { var keyValue = new RegistryKeyValue(name, value); this.AddValue(keyValue); return(keyValue); }
/// <summary> /// Adds a registry key value to this registry key. /// </summary> /// <param name="value">The RegistryKeyValue object to add.</param> public void AddValue(RegistryKeyValue value) { AddValue(this.Values, value); }
/// <summary> /// Adds a registry key value to the registry key using the specified name and value. /// </summary> /// <param name="name">The name of the value.</param> /// <param name="value">The data of the value.</param> /// <returns> /// The RegistryKeyValue object which was added. /// </returns> public RegistryKeyValue AddValue(string name, params byte[] value) { var keyValue = new RegistryKeyValue(name, value); this.AddValue(keyValue); return keyValue; }
/// <summary> /// Adds a registry key value to the registry key using the specified name and value. /// </summary> /// <param name="name">The name of the value.</param> /// <param name="value">The data of the value.</param> /// <returns> /// The RegistryKeyValue object which was added. /// </returns> public RegistryKeyValue AddValue(string name, int value) { var keyValue = new RegistryKeyValue(name, value); this.AddValue(keyValue); return keyValue; }