public EnvVariable AddVariable(string variable) { EnvVariable newVar = new EnvVariable(variable, "", true); Variables[variable] = newVar; return newVar; }
private Color GetIndicatorColor(EnvVariable value) { return (value.Deleted) ? Color.Pink : (value.Added) ? Color.LightGreen : (value.Edited) ? Color.LightBlue : Color.White; }
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); } } }