Files
PulsarK-main/Pulsar.Server/Forms/FrmRegValueEditBinary.cs
T
i2p 773d05f8f1
Pulsar .NET 9.0 Windows Release / build (push) Waiting to run
Mirror to Codeberg and Gitea / mirror (push) Waiting to run
initial commit
2026-08-27 10:57:58 -06:00

55 lines
1.5 KiB
C#

using Pulsar.Common.Models;
using Pulsar.Server.Forms.DarkMode;
using Pulsar.Server.Registry;
using System;
using System.Windows.Forms;
namespace Pulsar.Server.Forms
{
public partial class FrmRegValueEditBinary : Form
{
private readonly RegValueData _value;
private const string INVALID_BINARY_ERROR = "The binary value was invalid and could not be converted correctly.";
public FrmRegValueEditBinary(RegValueData value)
{
_value = value;
InitializeComponent();
DarkModeManager.ApplyDarkMode(this);
ScreenCaptureHider.ScreenCaptureHider.Apply(this.Handle);
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);
}
}
}