Allowed the data in the Registry values to be shown in the ListView.

This commit is contained in:
StingRaptor 2016-01-21 17:18:41 +01:00
parent c15929371d
commit d1e8edc56d
5 changed files with 73 additions and 1 deletions

View File

@ -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;
}
}
}

View File

@ -93,6 +93,7 @@
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
//

View File

@ -6,6 +6,7 @@ using System.Drawing;
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 @@ namespace xServer.Forms
#endregion
#region ListView Helpfunctions
public void PopulateLstRegistryKeys(List<RegValueData> 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 @@ namespace xServer.Forms
}
}
private void tvRegistryDirectory_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
if ((e.Node.Tag != null))
{
selectedStripStatusLabel.Text = e.Node.FullPath;
tvRegistryDirectory.SelectedNode = e.Node;
List<RegValueData> ValuesFromNode = null;
if (e.Node.Tag.GetType() == typeof(List<RegValueData>))
{
ValuesFromNode = (List<RegValueData>)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
}
}

View File

@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADm
BwAAAk1TRnQBSQFMAwEBAAFoAQABaAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
BwAAAk1TRnQBSQFMAwEBAAFwAQABcAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA
AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA
AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm

View File

@ -75,6 +75,7 @@
<Compile Include="Controls\RapidPictureBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\RegistryValueLstItem.cs" />
<Compile Include="Core\Build\IconInjector.cs" />
<Compile Include="Core\Commands\RegistryHandler.cs" />
<Compile Include="Core\Data\AutostartItem.cs" />