public static string GetNewValueName(RegistryKey key) { List <RegValue> values = RegExplorer.GetValues(key); bool found = false; int suffix = 0; string title = String.Empty; while (!found) { suffix++; title = "New Value #" + suffix; found = !values.Exists(val => val.Name == title); } return(title); }
public static string GetNewKeyName(RegistryKey key) { List <RegKey> subKeys = RegExplorer.GetSubKeys(key); bool found = false; int suffix = 0; string title = String.Empty; while (!found) { suffix++; title = "New Key #" + suffix; found = !subKeys.Exists(subKey => subKey.Name == title); } return(title); }