NHSE/NHSE.WinForms/Subforms/SysBot/SysBotRAMEdit.cs
Kurt e6f45d1805 Fix terrain brush popup
Closes #729
1. Dark mode now applied correctly (was previously lacking)
2. Fixed terrain brush action (brush active is higher priority than drag, fix tile fetch)
3. Fixed writing of Building/structure labels; apply after Terrain
4. Single terrain brush form allowed, center to Field Editor on launch

Somewhat related: fix Show() load for non-ShowDialog() forms to center to parent.
2026-01-30 22:55:26 -06:00

64 lines
1.4 KiB
C#

using System;
using System.Windows.Forms;
using NHSE.Core;
using NHSE.Injection;
namespace NHSE.WinForms;
public partial class SysBotRAMEdit : Form
{
private readonly SysBotController Bot;
public SysBotRAMEdit(InjectionType type)
{
InitializeComponent();
this.TranslateInterface(GameInfo.CurrentLanguage);
Bot = new SysBotController(type);
RamOffset.Text = Bot.GetDefaultOffset().ToString("X8");
TB_IP.Text = Bot.IP;
TB_Port.Text = Bot.Port;
Bot.PopPrompt();
}
protected override void OnLoad(EventArgs e)
{
CenterToParent();
base.OnLoad(e);
}
private void B_Connect_Click(object sender, EventArgs e)
{
if (!Bot.Connect(TB_IP.Text, TB_Port.Text))
return;
GB_Inject.Enabled = true;
}
private void SysBotRAMEdit_FormClosing(object sender, FormClosingEventArgs e)
{
if (!Bot.Bot.Connected)
return;
try
{
Bot.Bot.Disconnect();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
private void B_Edit_Click(object sender, EventArgs e)
{
var offset = StringUtil.GetHexValue(RamOffset.Text);
if (offset == 0)
{
WinFormsUtil.Error(MessageStrings.MsgInvalidHexValue);
return;
}
var length = (int)NUD_Offset.Value;
Bot.HexEdit(offset, length);
}
}