public RegistryEntryEditViewModel(RegistryValueInfo currentValueEditing) { if (currentValueEditing.Name != "") { ValueName = currentValueEditing.Name; //string fullPath = currentValueEditing.FullPath; KeyPath = currentValueEditing.Name; // fullPath.Substring(0, fullPath.Length - ValueName.Length); try { try { //Value = currentValueEditing.Value.ToString(); } catch (NotSupportedException) { // This key-type is not supported } ValueType = currentValueEditing.Type; } catch (KeyNotFoundException) { // Key not found } catch (UnauthorizedAccessException) { // no access } catch (ArgumentException e) { // On root notes... } } }
public RegistryEntryViewModel(string path, RegistryValueInfo regValue) { this.regValue = regValue; this.FullPath = path; this.elementName = regValue.Name; }
public static RegistryValueInfo[] GetValues(RegistryHive hive, string path) { ValueInfo[] ret = new ValueInfo[] { }; uint error = 0; try { if (!NativeRegistry.GetValues((global::Registry.RegistryHive)hive, path, out ret)) { error = NativeRegistry.GetError(); } } catch (Exception ex) { error = (uint)ex.HResult; } LastError = error; if (ret == null) { return new RegistryValueInfo[] { }; } RegistryValueInfo[] ret2 = new RegistryValueInfo[ret.Length]; for (int i = 0; i < ret.Length; i++) { ret2[i].Length = ret[i].Length; ret2[i].Name = ret[i].Name; ret2[i].Type = (RegistryType)ret[i].Type; } return ret2; }