public static string GetNewValueName(Microsoft.Win32.RegistryKey key) { System.Collections.Generic.List <RegValue> values = RegistryExplorerr.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(Microsoft.Win32.RegistryKey key) { System.Collections.Generic.List <RegKey> subKeys = RegistryExplorerr.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); }