Disconnect on window close

This commit is contained in:
Kurt
2020-05-06 14:11:53 -07:00
parent 20a16666ff
commit 39205c975e
2 changed files with 33 additions and 14 deletions

View File

@@ -36,6 +36,24 @@ private void B_Connect_Click(object sender, EventArgs e)
GB_Inject.Enabled = true;
}
private void SysBotUI_FormClosing(object sender, FormClosingEventArgs e)
{
TurnOffAuto();
if (!Bot.Bot.Connected)
return;
try
{
Bot.Bot.Disconnect();
}
#pragma warning disable CA1031 // Do not catch general exception types
catch (Exception ex)
#pragma warning restore CA1031 // Do not catch general exception types
{
Console.WriteLine(ex.Message);
}
}
private void B_WriteCurrent_Click(object sender, EventArgs e)
{
var offset = StringUtil.GetHexValue(RamOffset.Text);