Added support to handle the modification of binary registry values

This commit is contained in:
StingRaptor 2016-02-07 14:40:09 +01:00
parent b8616f97f8
commit 834ea5dbfb
2 changed files with 54 additions and 7 deletions

View File

@ -34,6 +34,7 @@
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.hexEditor = new xServer.Controls.HexEditor.HexEditor();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
@ -43,7 +44,7 @@
this.valueNameTxtBox.Location = new System.Drawing.Point(12, 31);
this.valueNameTxtBox.Name = "valueNameTxtBox";
this.valueNameTxtBox.ReadOnly = true;
this.valueNameTxtBox.Size = new System.Drawing.Size(301, 20);
this.valueNameTxtBox.Size = new System.Drawing.Size(341, 20);
this.valueNameTxtBox.TabIndex = 5;
//
// label1
@ -82,34 +83,54 @@
this.flowLayoutPanel1.Location = new System.Drawing.Point(12, 270);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.flowLayoutPanel1.Size = new System.Drawing.Size(301, 29);
this.flowLayoutPanel1.Size = new System.Drawing.Size(341, 29);
this.flowLayoutPanel1.TabIndex = 8;
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(223, 3);
this.cancelButton.Location = new System.Drawing.Point(263, 3);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 4;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(142, 3);
this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.okButton.Location = new System.Drawing.Point(182, 3);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 5;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// hexEditor
//
this.hexEditor.BackColor = System.Drawing.Color.White;
this.hexEditor.BorderColor = System.Drawing.Color.Empty;
this.hexEditor.Cursor = System.Windows.Forms.Cursors.IBeam;
this.hexEditor.EntityMargin = 8;
this.hexEditor.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.hexEditor.Location = new System.Drawing.Point(12, 71);
this.hexEditor.Margin = new System.Windows.Forms.Padding(0, 2, 3, 3);
this.hexEditor.Name = "hexEditor";
this.hexEditor.Size = new System.Drawing.Size(341, 196);
this.hexEditor.TabIndex = 9;
this.hexEditor.VScrollBarVisisble = true;
//
// FrmRegValueEditBinary
//
this.AcceptButton = this.cancelButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(325, 304);
this.CancelButton = this.okButton;
this.ClientSize = new System.Drawing.Size(365, 304);
this.Controls.Add(this.hexEditor);
this.Controls.Add(this.flowLayoutPanel1);
this.Controls.Add(this.label2);
this.Controls.Add(this.valueNameTxtBox);
@ -135,5 +156,6 @@
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private Controls.HexEditor.HexEditor hexEditor;
}
}

View File

@ -32,12 +32,37 @@ namespace xServer.Forms
if (value.Kind == Microsoft.Win32.RegistryValueKind.Binary)
{
//TODO Adding code for displaying binary data
hexEditor.HexTable = (byte[])value.Data;
}
}
private void FrmRegValueEditBinary_Load(object sender, EventArgs e)
{
hexEditor.Select();
hexEditor.Focus();
}
private void okButton_Click(object sender, EventArgs e)
{
try
{
if (hexEditor.HexTable != null)
{
if (_value.Kind == Microsoft.Win32.RegistryValueKind.Binary)
{
byte[] binaryValue = (hexEditor.HexTable);
object valueData = binaryValue;
new xServer.Core.Packets.ServerPackets.DoChangeRegistryValue(_keyPath, new RegValueData(_value.Name, _value.Kind, valueData)).Execute(_connectClient);
}
this.Close();
}
}
catch { }
}
private void cancelButton_Click(object sender, EventArgs e)
{
}