Exemplo n.º 1
0
        /// <summary>
        /// Setups the registry path.
        /// </summary>
        /// <param name="rootPath">The root path.</param>
        /// <param name="regKeyName">Name of the registry key.</param>
        /// <param name="defaultValue">The default value.</param>
        /// <param name="environmentVariableKey">The environment variable key.</param>
        /// <returns></returns>
        protected string SetupRegistryPath(string rootPath, string regKeyName, string defaultValue,
                                           string environmentVariableKey = null)
        {
            string result;

            if (!RegistryTools.ExistsCurrentUserRoot(rootPath))
            {
                RegistryTools.CreateCurrentUserRoot(rootPath);
            }

            var keyValue = RegistryTools.GetValueCurrentUserRoot(rootPath, regKeyName);

            if (keyValue == null)
            {
                RegistryTools.SetValueCurrentUserRoot(rootPath, regKeyName, defaultValue);
                result = defaultValue;
            }
            else
            {
                result = keyValue.ToString();
            }
            if (!string.IsNullOrEmpty(environmentVariableKey))
            {
                EnvironmentVariables.Add(environmentVariableKey, result);
            }
            return(result);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Sets the provider up
 /// </summary>
 public virtual void Setup()
 {
     if (!RegistryTools.ExistsCurrentUserRoot(RegistryRootPath))
     {
         RegistryTools.CreateCurrentUserRoot(RegistryRootPath);
     }
     SetupApplicationLocation();
     SetupProfile();
 }