public List <AdvancedRegistrySubKey> GetRegistrySubKeys(AdvancedRegistrySubKey baseRegistrySubKey, bool refresh) { ManualResetEvent manualResetEvent; if (!_subKeysRequests.ContainsKey(baseRegistrySubKey.Path) || refresh) { manualResetEvent = new ManualResetEvent(false); _subKeysRequests.Remove(baseRegistrySubKey.Path); _subKeysRequests.Add(baseRegistrySubKey.Path, manualResetEvent); var pathData = Encoding.UTF8.GetBytes(baseRegistrySubKey.RelativePath); ConnectionInfo.UnsafeSendCommand(this, 5 + pathData.Length, writer => { writer.Write((byte)RegistryCommunication.GetRegistrySubKeys); writer.Write((int)baseRegistrySubKey.RegistryHive); writer.Write(pathData); }); } else { manualResetEvent = _subKeysRequests[baseRegistrySubKey.Path]; } manualResetEvent.WaitOne(); var subKeys = _subKeysResults[baseRegistrySubKey.Path]; return(subKeys); }
public void DeleteValue(AdvancedRegistrySubKey registrySubKey, RegistryValue registryValue) { var package = new List <byte> { (byte)RegistryCommunication.DeleteValue }; package.AddRange(BitConverter.GetBytes((int)registrySubKey.RegistryHive)); var path = Encoding.UTF8.GetBytes(registrySubKey.RelativePath); package.AddRange(BitConverter.GetBytes(path.Length)); package.AddRange(path); package.AddRange(Encoding.UTF8.GetBytes(registryValue.Key)); ConnectionInfo.SendCommand(this, package.ToArray()); LogService.Send(string.Format((string)Application.Current.Resources["RemoveRegistryValue"], registryValue.Key, registryValue.ValueKind)); }
public void CreateValue(AdvancedRegistrySubKey registrySubKey, RegistryValue registryValue) { var package = new List <byte> { (byte)RegistryCommunication.CreateValue }; var serializer = new Serializer(new List <Type>(RegistryValue.RegistryValueTypes) { typeof(RegistryCreateValuePackage) }); package.AddRange(serializer.Serialize(new RegistryCreateValuePackage { Path = registrySubKey.RelativePath, RegistryHive = registrySubKey.RegistryHive, RegistryValue = registryValue })); ConnectionInfo.SendCommand(this, package.ToArray()); LogService.Send(string.Format((string)Application.Current.Resources["CreateValue"], registryValue.ValueKind, registryValue.Key, ConvertToString(registryValue.ValueObject).Truncate(10))); }