From d1e8edc56d4493450a85fab23327f1d20af194fb Mon Sep 17 00:00:00 2001 From: StingRaptor Date: Thu, 21 Jan 2016 17:18:41 +0100 Subject: [PATCH] Allowed the data in the Registry values to be shown in the ListView. --- Server/Controls/RegistryValueLstItem.cs | 26 +++++++++++++ Server/Forms/FrmRegistryEditor.Designer.cs | 1 + Server/Forms/FrmRegistryEditor.cs | 44 ++++++++++++++++++++++ Server/Forms/FrmRegistryEditor.resx | 2 +- Server/Server.csproj | 1 + 5 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 Server/Controls/RegistryValueLstItem.cs diff --git a/Server/Controls/RegistryValueLstItem.cs b/Server/Controls/RegistryValueLstItem.cs new file mode 100644 index 00000000..a555a1dd --- /dev/null +++ b/Server/Controls/RegistryValueLstItem.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace xServer.Controls +{ + internal class RegistryValueLstItem : ListViewItem + { + + public string RegName { get; private set; } + public string Type { get; private set; } + public string Data { get; private set; } + + public RegistryValueLstItem(string name, string type, string data) : + base(name) + { + RegName = name; + this.SubItems.Add(type); + Type = type; + this.SubItems.Add(data); + Data = data; + } + } +} diff --git a/Server/Forms/FrmRegistryEditor.Designer.cs b/Server/Forms/FrmRegistryEditor.Designer.cs index 93001b11..05528539 100644 --- a/Server/Forms/FrmRegistryEditor.Designer.cs +++ b/Server/Forms/FrmRegistryEditor.Designer.cs @@ -93,6 +93,7 @@ private void InitializeComponent() this.tvRegistryDirectory.Size = new System.Drawing.Size(411, 664); this.tvRegistryDirectory.TabIndex = 0; this.tvRegistryDirectory.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvRegistryDirectory_BeforeExpand); + this.tvRegistryDirectory.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvRegistryDirectory_NodeMouseClick); // // statusStrip // diff --git a/Server/Forms/FrmRegistryEditor.cs b/Server/Forms/FrmRegistryEditor.cs index d3addd71..daaa68ae 100644 --- a/Server/Forms/FrmRegistryEditor.cs +++ b/Server/Forms/FrmRegistryEditor.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using xServer.Controls; using xServer.Core.Networking; using xServer.Core.Registry; @@ -196,6 +197,26 @@ private TreeNode GetParentTreeNode(string rootName) #endregion + #region ListView Helpfunctions + + public void PopulateLstRegistryKeys(List values) + { + lstRegistryKeys.Items.Clear(); + + // If the array is not null, we have usable data. + if (values != null && values.Count > 0) + { + foreach (var value in values) + { + // To-Do: Use a custom ListViewItem for a better style. (Maybe add the imageList to it?) + RegistryValueLstItem item = new RegistryValueLstItem(value.Name, value.Type, value.Data); + lstRegistryKeys.Items.Add(item); + } + } + } + + #endregion + #region tvRegistryDirectory Action private void tvRegistryDirectory_BeforeExpand(object sender, TreeViewCancelEventArgs e) @@ -226,6 +247,29 @@ private void tvRegistryDirectory_BeforeExpand(object sender, TreeViewCancelEvent } } + private void tvRegistryDirectory_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if ((e.Node.Tag != null)) + { + selectedStripStatusLabel.Text = e.Node.FullPath; + tvRegistryDirectory.SelectedNode = e.Node; + + List ValuesFromNode = null; + if (e.Node.Tag.GetType() == typeof(List)) + { + ValuesFromNode = (List)e.Node.Tag; + } + + PopulateLstRegistryKeys(ValuesFromNode); + } + else + { + // It is likely that the user clicked on either an empty direction or an invalid RegistryKey. + // Clear the ListView. + PopulateLstRegistryKeys(null); + } + } + #endregion } } diff --git a/Server/Forms/FrmRegistryEditor.resx b/Server/Forms/FrmRegistryEditor.resx index b282da8d..cc42e454 100644 --- a/Server/Forms/FrmRegistryEditor.resx +++ b/Server/Forms/FrmRegistryEditor.resx @@ -125,7 +125,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADm - BwAAAk1TRnQBSQFMAwEBAAFoAQABaAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA + BwAAAk1TRnQBSQFMAwEBAAFwAQABcAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm diff --git a/Server/Server.csproj b/Server/Server.csproj index edee0cc0..6cebf41b 100644 --- a/Server/Server.csproj +++ b/Server/Server.csproj @@ -75,6 +75,7 @@ Component +