示例#1
0
        /// <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);
            }
        }
示例#2
0
        /// <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);
        }
示例#3
0
        /// <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);
        }
示例#4
0
 /// <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);
 }
示例#5
0
        /// <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);
            }
        }
示例#6
0
        /// <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;
        }
示例#7
0
        /// <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;
        }
示例#8
0
 /// <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);
 }