예제 #1
0
파일: EnvModel.cs 프로젝트: gemerson/EEdit
 public EnvVariable AddVariable(string variable)
 {
     EnvVariable newVar = new EnvVariable(variable, "", true);
     Variables[variable] = newVar;
     return newVar;
 }
예제 #2
0
파일: EnvEditor.cs 프로젝트: gemerson/EEdit
 private Color GetIndicatorColor(EnvVariable value)
 {
     return (value.Deleted) ? Color.Pink :
            (value.Added) ? Color.LightGreen :
            (value.Edited) ? Color.LightBlue :
            Color.White;
 }
예제 #3
0
파일: EnvModel.cs 프로젝트: gemerson/EEdit
        private void Load()
        {
            Variables.Clear();

            RegistryKey root = null;
            string location = null;

            switch (EnvTarget)
            {
                case EnvironmentVariableTarget.Machine:
                    root = Registry.LocalMachine;
                    location = LocalMachineEnvironmentLocation;
                    break;
                case EnvironmentVariableTarget.User:
                    root = Registry.CurrentUser;
                    location = CurrentUserEnvironmentLocation;
                    break;
                case EnvironmentVariableTarget.Process:
                    throw new NotSupportedException("Process environment variables will have no other effects.");
            }

            using (RegistryKey key = root.OpenSubKey(location))
            {
                foreach (string variable in key.GetValueNames())
                {
                    Variables[variable] = new EnvVariable(variable, key.GetValue(variable, "", RegistryValueOptions.DoNotExpandEnvironmentNames) as string, false);
                }
            }
        }