示例#1
0
        /// <summary>
        /// Deletes a value in Windows Registry.
        /// </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 where the value you want to delete exists. Example: SOFTWARE\ConDep</param>
        /// <param name="valueName">Name of the value you want to delete.</param>
        /// <returns></returns>
        public static IOfferWindowsRegistryOperations DeleteValue(this IOfferWindowsRegistryOperations reg, WindowsRegistryRoot root, string key, string valueName)
        {
            var op         = new DeleteWindowsRegistryValueOperation(root, key, valueName);
            var regBuilder = reg as WindowsRegistryBuilder;

            OperationExecutor.Execute((RemoteBuilder)reg, op);
            return(reg);
        }
示例#2
0
        /// <summary>
        /// Creates or updates a Windows Registry value.
        /// </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 containing the value you want to create or update. Example: SOFTWARE\ConDep</param>
        /// <param name="valueName">Name of the registry value</param>
        /// <param name="valueData">The data value you want to set</param>
        /// <param name="valueKind">The data type to use when storing values in the registry</param>
        /// <returns></returns>
        public static IOfferWindowsRegistryOperations SetValue(this IOfferWindowsRegistryOperations reg, WindowsRegistryRoot root, string key, string valueName, string valueData, RegistryValueKind valueKind)
        {
            var op         = new SetWindowsRegistryValueOperation(root, key, valueName, valueData, valueKind);
            var regBuilder = reg as WindowsRegistryBuilder;

            OperationExecutor.Execute((RemoteBuilder)reg, op);
            return(reg);
        }
示例#3
0
        /// <summary>
        /// Deletes a value in Windows Registry.
        /// </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 where the value you want to delete exists. Example: SOFTWARE\ConDep</param>
        /// <param name="valueName">Name of the value you want to delete.</param>
        /// <returns></returns>
        public static IOfferWindowsRegistryOperations DeleteValue(this IOfferWindowsRegistryOperations reg, WindowsRegistryRoot root, string key, string valueName)
        {
            var op         = new DeleteWindowsRegistryValueOperation(root, key, valueName);
            var regBuilder = reg as WindowsRegistryBuilder;

            Configure.Operation(regBuilder.RemoteConfigurationBuilder, op);
            return(reg);
        }
示例#4
0
        /// <summary>
        /// Creates or updates a Windows Registry value.
        /// </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 containing the value you want to create or update. Example: SOFTWARE\ConDep</param>
        /// <param name="valueName">Name of the registry value</param>
        /// <param name="valueData">The data value you want to set</param>
        /// <param name="valueKind">The data type to use when storing values in the registry</param>
        /// <returns></returns>
        public static IOfferWindowsRegistryOperations SetValue(this IOfferWindowsRegistryOperations reg, WindowsRegistryRoot root, string key, string valueName, string valueData, RegistryValueKind valueKind)
        {
            var op         = new SetWindowsRegistryValueOperation(root, key, valueName, valueData, valueKind);
            var regBuilder = reg as WindowsRegistryBuilder;

            Configure.Operation(regBuilder.RemoteConfigurationBuilder, op);
            return(reg);
        }
示例#5
0
        /// <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;

            OperationExecutor.Execute((RemoteBuilder)reg, op);
            return(reg);
        }
示例#6
0
 /// <summary>
 /// Creates a Windows Registry key 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="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, Action <IOfferWindowsRegistryOptions> options = null)
 {
     return(CreateKey(reg, root, key, "", options));
 }