diff --git a/Server/Forms/FrmRegistryEditor.Designer.cs b/Server/Forms/FrmRegistryEditor.Designer.cs
index ea0b782a..b17d11c0 100644
--- a/Server/Forms/FrmRegistryEditor.Designer.cs
+++ b/Server/Forms/FrmRegistryEditor.Designer.cs
@@ -34,7 +34,13 @@
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.tvRegistryDirectory = new System.Windows.Forms.TreeView();
this.imageRegistryDirectoryList = new System.Windows.Forms.ImageList(this.components);
+ this.lstRegistryKeys = new xServer.Controls.AeroListView();
+ this.hName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.hType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.hValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.imageRegistryKeyTypeList = new System.Windows.Forms.ImageList(this.components);
+ this.statusStrip = new System.Windows.Forms.StatusStrip();
+ this.selectedStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -43,13 +49,19 @@
this.modifyBinaryDataToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.newToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
+ this.keyToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
+ this.stringValueToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
+ this.binaryValueToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
+ this.dWORD32bitValueToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
+ this.qWORD64bitValueToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
+ this.multiStringValueToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
+ this.expandableStringValueToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.deleteToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.renameToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.refreshToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.statusStrip = new System.Windows.Forms.StatusStrip();
- this.selectedStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.tv_ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.keyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -79,25 +91,13 @@
this.qWORD64bitValueToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.multiStringValueToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.expandableStringValueToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.lstRegistryKeys = new xServer.Controls.AeroListView();
- this.hName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.hType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.hValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.keyToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
- this.stringValueToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
- this.binaryValueToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
- this.dWORD32bitValueToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
- this.qWORD64bitValueToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
- this.multiStringValueToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
- this.expandableStringValueToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
this.tableLayoutPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
- this.menuStrip1.SuspendLayout();
this.statusStrip.SuspendLayout();
+ this.menuStrip1.SuspendLayout();
this.tv_ContextMenuStrip.SuspendLayout();
this.selectedItem_ContextMenuStrip.SuspendLayout();
this.lst_ContextMenuStrip.SuspendLayout();
@@ -153,6 +153,7 @@
this.tvRegistryDirectory.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvRegistryDirectory_BeforeExpand);
this.tvRegistryDirectory.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvRegistryDirectory_BeforeSelect);
this.tvRegistryDirectory.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvRegistryDirectory_NodeMouseClick);
+ this.tvRegistryDirectory.KeyUp += new System.Windows.Forms.KeyEventHandler(this.tvRegistryDirectory_KeyUp);
//
// imageRegistryDirectoryList
//
@@ -160,6 +161,43 @@
this.imageRegistryDirectoryList.TransparentColor = System.Drawing.Color.Transparent;
this.imageRegistryDirectoryList.Images.SetKeyName(0, "folder.png");
//
+ // lstRegistryKeys
+ //
+ this.lstRegistryKeys.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.hName,
+ this.hType,
+ this.hValue});
+ this.lstRegistryKeys.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lstRegistryKeys.FullRowSelect = true;
+ this.lstRegistryKeys.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
+ this.lstRegistryKeys.HideSelection = false;
+ this.lstRegistryKeys.Location = new System.Drawing.Point(0, 0);
+ this.lstRegistryKeys.Name = "lstRegistryKeys";
+ this.lstRegistryKeys.Size = new System.Drawing.Size(818, 671);
+ this.lstRegistryKeys.SmallImageList = this.imageRegistryKeyTypeList;
+ this.lstRegistryKeys.TabIndex = 0;
+ this.lstRegistryKeys.UseCompatibleStateImageBehavior = false;
+ this.lstRegistryKeys.View = System.Windows.Forms.View.Details;
+ this.lstRegistryKeys.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.lstRegistryKeys_AfterLabelEdit);
+ this.lstRegistryKeys.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lstRegistryKeys_ItemSelectionChanged);
+ this.lstRegistryKeys.KeyUp += new System.Windows.Forms.KeyEventHandler(this.lstRegistryKeys_KeyUp);
+ this.lstRegistryKeys.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lstRegistryKeys_MouseClick);
+ //
+ // hName
+ //
+ this.hName.Text = "Name";
+ this.hName.Width = 203;
+ //
+ // hType
+ //
+ this.hType.Text = "Type";
+ this.hType.Width = 149;
+ //
+ // hValue
+ //
+ this.hValue.Text = "Value";
+ this.hValue.Width = 384;
+ //
// imageRegistryKeyTypeList
//
this.imageRegistryKeyTypeList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageRegistryKeyTypeList.ImageStream")));
@@ -167,6 +205,22 @@
this.imageRegistryKeyTypeList.Images.SetKeyName(0, "reg_string.png");
this.imageRegistryKeyTypeList.Images.SetKeyName(1, "reg_binary.png");
//
+ // statusStrip
+ //
+ this.statusStrip.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.selectedStripStatusLabel});
+ this.statusStrip.Location = new System.Drawing.Point(0, 702);
+ this.statusStrip.Name = "statusStrip";
+ this.statusStrip.Size = new System.Drawing.Size(1239, 22);
+ this.statusStrip.TabIndex = 1;
+ this.statusStrip.Text = "statusStrip";
+ //
+ // selectedStripStatusLabel
+ //
+ this.selectedStripStatusLabel.Name = "selectedStripStatusLabel";
+ this.selectedStripStatusLabel.Size = new System.Drawing.Size(0, 17);
+ //
// menuStrip1
//
this.menuStrip1.Dock = System.Windows.Forms.DockStyle.None;
@@ -176,7 +230,7 @@
this.viewToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
- this.menuStrip1.Size = new System.Drawing.Size(220, 24);
+ this.menuStrip1.Size = new System.Drawing.Size(128, 24);
this.menuStrip1.TabIndex = 2;
//
// fileToolStripMenuItem
@@ -190,7 +244,7 @@
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
- this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.exitToolStripMenuItem.Text = "Exit";
//
// editToolStripMenuItem
@@ -242,6 +296,60 @@
this.newToolStripMenuItem2.Size = new System.Drawing.Size(184, 22);
this.newToolStripMenuItem2.Text = "New";
//
+ // keyToolStripMenuItem2
+ //
+ this.keyToolStripMenuItem2.Name = "keyToolStripMenuItem2";
+ this.keyToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
+ this.keyToolStripMenuItem2.Text = "Key";
+ this.keyToolStripMenuItem2.Click += new System.EventHandler(this.createNewRegistryKey_Click);
+ //
+ // toolStripSeparator7
+ //
+ this.toolStripSeparator7.Name = "toolStripSeparator7";
+ this.toolStripSeparator7.Size = new System.Drawing.Size(196, 6);
+ //
+ // stringValueToolStripMenuItem2
+ //
+ this.stringValueToolStripMenuItem2.Name = "stringValueToolStripMenuItem2";
+ this.stringValueToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
+ this.stringValueToolStripMenuItem2.Text = "String Value";
+ this.stringValueToolStripMenuItem2.Click += new System.EventHandler(this.createStringRegistryValue_Click);
+ //
+ // binaryValueToolStripMenuItem2
+ //
+ this.binaryValueToolStripMenuItem2.Name = "binaryValueToolStripMenuItem2";
+ this.binaryValueToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
+ this.binaryValueToolStripMenuItem2.Text = "Binary Value";
+ this.binaryValueToolStripMenuItem2.Click += new System.EventHandler(this.createBinaryRegistryValue_Click);
+ //
+ // dWORD32bitValueToolStripMenuItem2
+ //
+ this.dWORD32bitValueToolStripMenuItem2.Name = "dWORD32bitValueToolStripMenuItem2";
+ this.dWORD32bitValueToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
+ this.dWORD32bitValueToolStripMenuItem2.Text = "DWORD (32-bit) Value";
+ this.dWORD32bitValueToolStripMenuItem2.Click += new System.EventHandler(this.createDwordRegistryValue_Click);
+ //
+ // qWORD64bitValueToolStripMenuItem2
+ //
+ this.qWORD64bitValueToolStripMenuItem2.Name = "qWORD64bitValueToolStripMenuItem2";
+ this.qWORD64bitValueToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
+ this.qWORD64bitValueToolStripMenuItem2.Text = "QWORD (64-bit) Value";
+ this.qWORD64bitValueToolStripMenuItem2.Click += new System.EventHandler(this.createQwordRegistryValue_Click);
+ //
+ // multiStringValueToolStripMenuItem2
+ //
+ this.multiStringValueToolStripMenuItem2.Name = "multiStringValueToolStripMenuItem2";
+ this.multiStringValueToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
+ this.multiStringValueToolStripMenuItem2.Text = "Multi-String Value";
+ this.multiStringValueToolStripMenuItem2.Click += new System.EventHandler(this.createMultiStringRegistryValue_Click);
+ //
+ // expandableStringValueToolStripMenuItem2
+ //
+ this.expandableStringValueToolStripMenuItem2.Name = "expandableStringValueToolStripMenuItem2";
+ this.expandableStringValueToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
+ this.expandableStringValueToolStripMenuItem2.Text = "Expandable String Value";
+ this.expandableStringValueToolStripMenuItem2.Click += new System.EventHandler(this.createExpandStringRegistryValue_Click);
+ //
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
@@ -279,22 +387,6 @@
this.refreshToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.refreshToolStripMenuItem.Text = "Refresh";
//
- // statusStrip
- //
- this.statusStrip.Dock = System.Windows.Forms.DockStyle.Fill;
- this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.selectedStripStatusLabel});
- this.statusStrip.Location = new System.Drawing.Point(0, 702);
- this.statusStrip.Name = "statusStrip";
- this.statusStrip.Size = new System.Drawing.Size(1239, 22);
- this.statusStrip.TabIndex = 1;
- this.statusStrip.Text = "statusStrip";
- //
- // selectedStripStatusLabel
- //
- this.selectedStripStatusLabel.Name = "selectedStripStatusLabel";
- this.selectedStripStatusLabel.Size = new System.Drawing.Size(0, 17);
- //
// tv_ContextMenuStrip
//
this.tv_ContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -516,97 +608,6 @@
this.expandableStringValueToolStripMenuItem1.Text = "Expandable String Value";
this.expandableStringValueToolStripMenuItem1.Click += new System.EventHandler(this.createExpandStringRegistryValue_Click);
//
- // lstRegistryKeys
- //
- this.lstRegistryKeys.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.hName,
- this.hType,
- this.hValue});
- this.lstRegistryKeys.Dock = System.Windows.Forms.DockStyle.Fill;
- this.lstRegistryKeys.FullRowSelect = true;
- this.lstRegistryKeys.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
- this.lstRegistryKeys.HideSelection = false;
- this.lstRegistryKeys.Location = new System.Drawing.Point(0, 0);
- this.lstRegistryKeys.Name = "lstRegistryKeys";
- this.lstRegistryKeys.Size = new System.Drawing.Size(818, 671);
- this.lstRegistryKeys.SmallImageList = this.imageRegistryKeyTypeList;
- this.lstRegistryKeys.TabIndex = 0;
- this.lstRegistryKeys.UseCompatibleStateImageBehavior = false;
- this.lstRegistryKeys.View = System.Windows.Forms.View.Details;
- this.lstRegistryKeys.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.lstRegistryKeys_AfterLabelEdit);
- this.lstRegistryKeys.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lstRegistryKeys_ItemSelectionChanged);
- this.lstRegistryKeys.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lstRegistryKeys_MouseClick);
- this.lstRegistryKeys.ListViewItemSorter = new xServer.Controls.RegistryValueListItemComparer();
- //
- // hName
- //
- this.hName.Text = "Name";
- this.hName.Width = 203;
- //
- // hType
- //
- this.hType.Text = "Type";
- this.hType.Width = 149;
- //
- // hValue
- //
- this.hValue.Text = "Value";
- this.hValue.Width = 384;
- //
- // keyToolStripMenuItem2
- //
- this.keyToolStripMenuItem2.Name = "keyToolStripMenuItem2";
- this.keyToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
- this.keyToolStripMenuItem2.Text = "Key";
- this.keyToolStripMenuItem2.Click += new System.EventHandler(this.createNewRegistryKey_Click);
- //
- // stringValueToolStripMenuItem2
- //
- this.stringValueToolStripMenuItem2.Name = "stringValueToolStripMenuItem2";
- this.stringValueToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
- this.stringValueToolStripMenuItem2.Text = "String Value";
- this.stringValueToolStripMenuItem2.Click += new System.EventHandler(this.createStringRegistryValue_Click);
- //
- // binaryValueToolStripMenuItem2
- //
- this.binaryValueToolStripMenuItem2.Name = "binaryValueToolStripMenuItem2";
- this.binaryValueToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
- this.binaryValueToolStripMenuItem2.Text = "Binary Value";
- this.binaryValueToolStripMenuItem2.Click += new System.EventHandler(this.createBinaryRegistryValue_Click);
- //
- // dWORD32bitValueToolStripMenuItem2
- //
- this.dWORD32bitValueToolStripMenuItem2.Name = "dWORD32bitValueToolStripMenuItem2";
- this.dWORD32bitValueToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
- this.dWORD32bitValueToolStripMenuItem2.Text = "DWORD (32-bit) Value";
- this.dWORD32bitValueToolStripMenuItem2.Click += new System.EventHandler(this.createDwordRegistryValue_Click);
- //
- // qWORD64bitValueToolStripMenuItem2
- //
- this.qWORD64bitValueToolStripMenuItem2.Name = "qWORD64bitValueToolStripMenuItem2";
- this.qWORD64bitValueToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
- this.qWORD64bitValueToolStripMenuItem2.Text = "QWORD (64-bit) Value";
- this.qWORD64bitValueToolStripMenuItem2.Click += new System.EventHandler(this.createQwordRegistryValue_Click);
- //
- // multiStringValueToolStripMenuItem2
- //
- this.multiStringValueToolStripMenuItem2.Name = "multiStringValueToolStripMenuItem2";
- this.multiStringValueToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
- this.multiStringValueToolStripMenuItem2.Text = "Multi-String Value";
- this.multiStringValueToolStripMenuItem2.Click += new System.EventHandler(this.createMultiStringRegistryValue_Click);
- //
- // expandableStringValueToolStripMenuItem2
- //
- this.expandableStringValueToolStripMenuItem2.Name = "expandableStringValueToolStripMenuItem2";
- this.expandableStringValueToolStripMenuItem2.Size = new System.Drawing.Size(199, 22);
- this.expandableStringValueToolStripMenuItem2.Text = "Expandable String Value";
- this.expandableStringValueToolStripMenuItem2.Click += new System.EventHandler(this.createExpandStringRegistryValue_Click);
- //
- // toolStripSeparator7
- //
- this.toolStripSeparator7.Name = "toolStripSeparator7";
- this.toolStripSeparator7.Size = new System.Drawing.Size(196, 6);
- //
// FrmRegistryEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -628,10 +629,10 @@
this.splitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
this.splitContainer.ResumeLayout(false);
- this.menuStrip1.ResumeLayout(false);
- this.menuStrip1.PerformLayout();
this.statusStrip.ResumeLayout(false);
this.statusStrip.PerformLayout();
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
this.tv_ContextMenuStrip.ResumeLayout(false);
this.selectedItem_ContextMenuStrip.ResumeLayout(false);
this.lst_ContextMenuStrip.ResumeLayout(false);
diff --git a/Server/Forms/FrmRegistryEditor.cs b/Server/Forms/FrmRegistryEditor.cs
index 6d078c11..b2fb9663 100644
--- a/Server/Forms/FrmRegistryEditor.cs
+++ b/Server/Forms/FrmRegistryEditor.cs
@@ -42,6 +42,9 @@ namespace xServer.Forms
// Signal client to retrive the root nodes (indicated by null)
new xServer.Core.Packets.ServerPackets.DoLoadRegistryKey(null).Execute(_connectClient);
+
+ // Set the ListSorter for the listView
+ this.lstRegistryKeys.ListViewItemSorter = new RegistryValueListItemComparer();
}
private void FrmRegistryEditor_FormClosing(object sender, FormClosingEventArgs e)
@@ -56,12 +59,9 @@ namespace xServer.Forms
private void AddRootKey(RegSeekerMatch match)
{
- tvRegistryDirectory.Invoke((MethodInvoker)delegate
- {
- TreeNode node = CreateNode(match.Key, match.Key, match.Data);
- node.Nodes.Add(new TreeNode());
- tvRegistryDirectory.Nodes.Add(node);
- });
+ TreeNode node = CreateNode(match.Key, match.Key, match.Data);
+ node.Nodes.Add(new TreeNode());
+ tvRegistryDirectory.Nodes.Add(node);
}
private TreeNode CreateNode(string key, string text, object tag)
@@ -78,38 +78,44 @@ namespace xServer.Forms
{
if (string.IsNullOrEmpty(rootName))
{
- // Root key
- foreach (var match in matches)
- {
- AddRootKey(match);
- }
-
tvRegistryDirectory.Invoke((MethodInvoker)delegate
{
+ tvRegistryDirectory.BeginUpdate();
+
+ foreach (var match in matches)
+ {
+ AddRootKey(match);
+ }
+
tvRegistryDirectory.SelectedNode = tvRegistryDirectory.Nodes[0];
+
+ tvRegistryDirectory.EndUpdate();
});
}
else
{
- TreeNode parent = GetParentTreeNode(rootName);
+ TreeNode parent = GetTreeNode(rootName);
if (parent != null)
{
tvRegistryDirectory.Invoke((MethodInvoker)delegate
{
+ tvRegistryDirectory.BeginUpdate();
+
foreach (var match in matches)
{
//This will execute in the form thread
TreeNode node = CreateNode(match.Key, match.Key, match.Data);
if (match.HasSubKeys)
- {
node.Nodes.Add(new TreeNode());
- }
+
parent.Nodes.Add(node);
}
+
parent.Expand();
+ tvRegistryDirectory.EndUpdate();
});
}
}
@@ -117,17 +123,16 @@ namespace xServer.Forms
public void AddKeyToTree(string rootKey, RegSeekerMatch match)
{
- TreeNode parent = GetParentTreeNode(rootKey);
+ TreeNode parent = GetTreeNode(rootKey);
tvRegistryDirectory.Invoke((MethodInvoker)delegate
{
//This will execute in the form thread
TreeNode node = CreateNode(match.Key, match.Key, match.Data);
if (match.HasSubKeys)
- {
node.Nodes.Add(new TreeNode());
- }
parent.Nodes.Add(node);
+
if (!parent.IsExpanded)
{
tvRegistryDirectory.SelectedNode = parent;
@@ -145,113 +150,90 @@ namespace xServer.Forms
public void RemoveKeyFromTree(string rootKey, string subKey)
{
- TreeNode parent = GetParentTreeNode(rootKey);
-
- //Error key does not exists
- if (!parent.Nodes.ContainsKey(subKey))
- return;
-
- tvRegistryDirectory.Invoke((MethodInvoker)delegate
- {
- parent.Nodes.RemoveByKey(subKey);
- });
+ TreeNode parent = GetTreeNode(rootKey);
+ //Make sure the key does exist
+ if (parent.Nodes.ContainsKey(subKey)) {
+ tvRegistryDirectory.Invoke((MethodInvoker)delegate
+ {
+ parent.Nodes.RemoveByKey(subKey);
+ });
+ }
}
public void RenameKeyFromTree(string rootKey, string oldName, string newName)
{
- TreeNode parent = GetParentTreeNode(rootKey);
+ TreeNode parent = GetTreeNode(rootKey);
- //Error the key does not exist
- if (!parent.Nodes.ContainsKey(oldName))
- return;
-
- int index = parent.Nodes.IndexOfKey(oldName);
-
- //Temp - Should not be neccesary (only need to confirm the add)
- tvRegistryDirectory.Invoke((MethodInvoker)delegate
+ //Make sure the key does exist
+ if (parent.Nodes.ContainsKey(oldName))
{
- parent.Nodes[index].Text = newName;
- parent.Nodes[index].Name = newName;
+ int index = parent.Nodes.IndexOfKey(oldName);
- //Make sure that the newly renamed node is selected
- tvRegistryDirectory.SelectedNode = null;
- tvRegistryDirectory.SelectedNode = parent.Nodes[index];
- });
+ //Temp - Should not be neccesary (only need to confirm the add)
+ tvRegistryDirectory.Invoke((MethodInvoker)delegate
+ {
+ parent.Nodes[index].Text = newName;
+ parent.Nodes[index].Name = newName;
+
+ //Make sure that the newly renamed node is selected
+ if (tvRegistryDirectory.SelectedNode == parent.Nodes[index])
+ tvRegistryDirectory.SelectedNode = null;
+
+ tvRegistryDirectory.SelectedNode = parent.Nodes[index];
+ });
+ }
}
///
- /// Using the RegSeekerMatch's name, obtain the parent TreeNode of the match, creating
- /// the TreeNodes if necessary.
+ /// Trys to find the desired TreeNode given the fullpath to it.
///
- /// The match from which we obtain the corresponding TreeNode from.
- /// Null if an invalid name is passed; The parent TreeNode for non-root matches; Returns
- /// itself if it is a root match.
- private TreeNode GetParentTreeNode(string rootName)
+ /// The fullpath to the TreeNode.
+ /// Null if an invalid name is passed; The TreeNode represented by the fullpath;
+ private TreeNode GetTreeNode(string path)
{
string[] nodePath = null;
- if (rootName.Contains("\\"))
+ if (path.Contains("\\"))
{
// It might not be a root node.
- nodePath = rootName.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
+ nodePath = path.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
- // Only one valid node. Probably malformed or a root node.
+ // Only one valid node. Probably malformed
if (nodePath.Length < 2)
- {
return null;
- }
}
else
{
//Is a root node
- nodePath = new string[] { rootName };
+ nodePath = new string[] { path };
}
// Keep track of the last node to reference for traversal.
TreeNode lastNode = null;
- // If the TreeView contains the first element in the node path, we
- // won't have to create it. Otherwise, create it then set the last node
- // to serve as our reference point.
if (tvRegistryDirectory.Nodes.ContainsKey(nodePath[0]))
{
lastNode = tvRegistryDirectory.Nodes[nodePath[0]];
}
else
{
- // This node does not exist in the TreeView. Create it then add it.
- lastNode = CreateNode(nodePath[0], nodePath[0], null);
- tvRegistryDirectory.Invoke((MethodInvoker)delegate
- {
- tvRegistryDirectory.Nodes.Add(lastNode);
- });
-
+ //Node is missing
+ return null;
}
- // Go through the rest of the node path (leave last one, is the one to add).
+ // Go through the rest of the node path.
for (int i = 1; i < nodePath.Length; i++)
{
- // If the last node does have this entry in the path, just set
- // the last node to the existing entry.
if (lastNode.Nodes.ContainsKey(nodePath[i]))
{
lastNode = lastNode.Nodes[nodePath[i]];
}
else
{
- // If the last node does not contain the next item in the path,
- // create the node and add it to the path.
- TreeNode newNode = CreateNode(nodePath[i], nodePath[i], null);
-
- tvRegistryDirectory.Invoke((MethodInvoker)delegate
- {
- lastNode.Nodes.Add(newNode);
- });
-
- lastNode = newNode;
+ //Node is missing
+ return null;
}
}
-
return lastNode;
}
@@ -274,23 +256,20 @@ namespace xServer.Forms
public void AddValueToList(string keyPath, RegValueData value)
{
- TreeNode key = GetParentTreeNode(keyPath);
+ TreeNode key = GetTreeNode(keyPath);
if (key != null )
{
lstRegistryKeys.Invoke((MethodInvoker)delegate
{
List ValuesFromNode = null;
- if (key.Tag != null) {
- if (key.Tag.GetType() == typeof(List))
- {
- ValuesFromNode = (List)key.Tag;
- ValuesFromNode.Add(value);
- }
- else { return; }
+ if (key.Tag != null && key.Tag.GetType() == typeof(List)) {
+ ValuesFromNode = (List)key.Tag;
+ ValuesFromNode.Add(value);
}
else
{
+ //The tag has a incorrect element or is missing data
ValuesFromNode = new List();
ValuesFromNode.Add(value);
key.Tag = ValuesFromNode;
@@ -319,21 +298,22 @@ namespace xServer.Forms
public void DeleteValueFromList(string keyPath, string valueName)
{
- TreeNode key = GetParentTreeNode(keyPath);
+ TreeNode key = GetTreeNode(keyPath);
if (key != null)
{
lstRegistryKeys.Invoke((MethodInvoker)delegate
{
List ValuesFromNode = null;
- if (key.Tag != null)
+ if (key.Tag != null && key.Tag.GetType() == typeof(List))
{
- if (key.Tag.GetType() == typeof(List))
- {
- ValuesFromNode = (List)key.Tag;
- ValuesFromNode.Remove(new RegValueData(valueName, null, null));
- }
- else { return; }
+ ValuesFromNode = (List)key.Tag;
+ ValuesFromNode.Remove(new RegValueData(valueName, null, null));
+ }
+ else
+ {
+ //Tag has incorrect element or is missing data
+ key.Tag = new List();
}
if (tvRegistryDirectory.SelectedNode == key)
@@ -351,35 +331,32 @@ namespace xServer.Forms
public void RenameValueFromList(string keyPath, string oldName, string newName)
{
- TreeNode key = GetParentTreeNode(keyPath);
+ TreeNode key = GetTreeNode(keyPath);
if (key != null)
{
lstRegistryKeys.Invoke((MethodInvoker)delegate
{
List ValuesFromNode = null;
- if (key.Tag != null)
+ //Can only rename if the value exists in the tag
+ if (key.Tag != null && key.Tag.GetType() == typeof(List))
{
- if (key.Tag.GetType() == typeof(List))
- {
- ValuesFromNode = (List)key.Tag;
- var value = ValuesFromNode.Find(item => item.Name == oldName);
- value.Name = newName;
- }
- else { return; }
- }
+ ValuesFromNode = (List)key.Tag;
+ var value = ValuesFromNode.Find(item => item.Name == oldName);
+ value.Name = newName;
- if (tvRegistryDirectory.SelectedNode == key)
- {
- var index = lstRegistryKeys.Items.IndexOfKey(oldName);
- RegistryValueLstItem valueItem = (RegistryValueLstItem)lstRegistryKeys.Items[index];
- valueItem.RegName = newName;
- valueItem.Name = newName;
- valueItem.Text = newName;
- }
- else
- {
- tvRegistryDirectory.SelectedNode = key;
+ if (tvRegistryDirectory.SelectedNode == key)
+ {
+ var index = lstRegistryKeys.Items.IndexOfKey(oldName);
+ RegistryValueLstItem valueItem = (RegistryValueLstItem)lstRegistryKeys.Items[index];
+ valueItem.RegName = newName;
+ valueItem.Name = newName;
+ valueItem.Text = newName;
+ }
+ else
+ {
+ tvRegistryDirectory.SelectedNode = key;
+ }
}
});
@@ -435,13 +412,14 @@ namespace xServer.Forms
//Prompt error
MessageBox.Show("Invalid label. \nA node with that label already exists.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
e.Node.BeginEdit();
- return;
}
- //Normal rename action
- //Perform Rename action
- new xServer.Core.Packets.ServerPackets.DoRenameRegistryKey(e.Node.Parent.FullPath, e.Node.Name, e.Label).Execute(_connectClient);
-
- tvRegistryDirectory.LabelEdit = false;
+ else
+ {
+ //Normal rename action
+ //Perform Rename action
+ new xServer.Core.Packets.ServerPackets.DoRenameRegistryKey(e.Node.Parent.FullPath, e.Node.Name, e.Label).Execute(_connectClient);
+ tvRegistryDirectory.LabelEdit = false;
+ }
}
else
{
@@ -460,18 +438,13 @@ namespace xServer.Forms
// If nothing is there (yet).
if (String.IsNullOrEmpty(parentNode.FirstNode.Name))
{
- try
- {
- tvRegistryDirectory.SuspendLayout();
- parentNode.Nodes.Clear();
+ tvRegistryDirectory.SuspendLayout();
+ parentNode.Nodes.Clear();
- // Send a packet to retrieve the data to use for the nodes.
- new xServer.Core.Packets.ServerPackets.DoLoadRegistryKey(parentNode.FullPath).Execute(_connectClient);
- }
- finally
- {
- tvRegistryDirectory.ResumeLayout();
- }
+ // Send a packet to retrieve the data to use for the nodes.
+ new xServer.Core.Packets.ServerPackets.DoLoadRegistryKey(parentNode.FullPath).Execute(_connectClient);
+
+ tvRegistryDirectory.ResumeLayout();
//Cancel expand
e.Cancel = true;
}
@@ -488,10 +461,7 @@ namespace xServer.Forms
}
/* Enable delete and rename if not root node */
- this.deleteToolStripMenuItem.Enabled = tvRegistryDirectory.SelectedNode.Parent != null;
- this.renameToolStripMenuItem.Enabled = tvRegistryDirectory.SelectedNode.Parent != null;
- this.deleteToolStripMenuItem2.Enabled = tvRegistryDirectory.SelectedNode.Parent != null;
- this.renameToolStripMenuItem2.Enabled = tvRegistryDirectory.SelectedNode.Parent != null;
+ setDeleteAndRename(tvRegistryDirectory.SelectedNode.Parent != null);
if (e.Button == MouseButtons.Right)
{
@@ -508,6 +478,26 @@ namespace xServer.Forms
}
}
+ private void tvRegistryDirectory_KeyUp(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Delete)
+ {
+ deleteRegistryKey_Click(this, e);
+ }
+ }
+
+ #endregion
+
+ #region ToolStrip Actions
+
+ public void setDeleteAndRename(bool enable)
+ {
+ this.deleteToolStripMenuItem.Enabled = enable;
+ this.renameToolStripMenuItem.Enabled = enable;
+ this.deleteToolStripMenuItem2.Enabled = enable;
+ this.renameToolStripMenuItem2.Enabled = enable;
+ }
+
#endregion
#region lstRegistryKeys action
@@ -570,6 +560,14 @@ namespace xServer.Forms
renameToolStripMenuItem1.Enabled = lstRegistryKeys.SelectedItems.Count == 1;
}
+ private void lstRegistryKeys_KeyUp(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Delete)
+ {
+ deleteRegistryValue_Click(this, e);
+ }
+ }
+
#endregion
#region ContextMenu
@@ -670,7 +668,7 @@ namespace xServer.Forms
{
if (tvRegistryDirectory.SelectedNode != null)
{
- //Request the creation of a new Registry value of type REG_QWORD
+ //Request the creation of a new Registry value of type REG_EXPAND_SZ
new xServer.Core.Packets.ServerPackets.DoCreateRegistryValue(tvRegistryDirectory.SelectedNode.FullPath, RegistryValueKind.ExpandString).Execute(_connectClient);
}
}
@@ -681,10 +679,9 @@ namespace xServer.Forms
private void deleteRegistryValue_Click(object sender, EventArgs e)
{
- if(tvRegistryDirectory.SelectedNode != null) {
-
+ if(tvRegistryDirectory.SelectedNode != null && lstRegistryKeys.SelectedItems.Count > 0) {
//Prompt user to confirm delete
- string msg = "Deleting certain registry values could cause system instability. Are you sure you want to permanently delete this value?";
+ string msg = "Deleting certain registry values could cause system instability. Are you sure you want to permanently delete " + (lstRegistryKeys.SelectedItems.Count == 1 ? "this value?": "these values?");
string caption = "Confirm Value Delete";
var answer = MessageBox.Show(msg, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
diff --git a/Server/Forms/FrmRegistryEditor.resx b/Server/Forms/FrmRegistryEditor.resx
index dfb21dee..f9496447 100644
--- a/Server/Forms/FrmRegistryEditor.resx
+++ b/Server/Forms/FrmRegistryEditor.resx
@@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADm
- BwAAAk1TRnQBSQFMAwEBAAFoAQIBaAECARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
+ BwAAAk1TRnQBSQFMAwEBAAFwAQIBcAECARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA
AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA
AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm
@@ -169,7 +169,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABk
- CQAAAk1TRnQBSQFMAgEBAgEAAYgBAQGIAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+ CQAAAk1TRnQBSQFMAgEBAgEAAZABAQGQAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA