mirror of https://github.com/qwqdanchun/DcRat.git
58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
using Server.Helper;
|
|
using Server.Helper.HexEditor;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using static Server.Helper.RegistrySeeker;
|
|
|
|
namespace Server.Forms
|
|
{
|
|
public partial class FormRegValueEditBinary : Form
|
|
{
|
|
private readonly RegValueData _value;
|
|
|
|
private const string INVALID_BINARY_ERROR = "The binary value was invalid and could not be converted correctly.";
|
|
public FormRegValueEditBinary(RegValueData value)
|
|
{
|
|
_value = value;
|
|
|
|
InitializeComponent();
|
|
|
|
this.valueNameTxtBox.Text = RegValueHelper.GetName(value.Name);
|
|
hexEditor.HexTable = value.Data;
|
|
}
|
|
|
|
private void okButton_Click(object sender, EventArgs e)
|
|
{
|
|
byte[] bytes = hexEditor.HexTable;
|
|
if (bytes != null)
|
|
{
|
|
try
|
|
{
|
|
_value.Data = bytes;
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Tag = _value;
|
|
}
|
|
catch
|
|
{
|
|
ShowWarning(INVALID_BINARY_ERROR, "Warning");
|
|
this.DialogResult = DialogResult.None;
|
|
}
|
|
}
|
|
|
|
this.Close();
|
|
}
|
|
|
|
private void ShowWarning(string msg, string caption)
|
|
{
|
|
MessageBox.Show(msg, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
}
|