NHSE/NHSE.WinForms/Subforms/SysBot/USBBotController.cs
berichan e0e4dd508c
Added support for USB-botbase (#299)
Only for player item injection at this time; no sync / toggle between modes
2020-06-06 12:58:13 -07:00

54 lines
1.2 KiB
C#

using System;
using NHSE.Injection;
namespace NHSE.WinForms
{
public class USBBotController
{
public readonly USBBot Bot = new USBBot();
public bool Connect()
{
try
{
return Bot.Connect();
}
#pragma warning disable CA1031 // Do not catch general exception types
catch (Exception ex)
#pragma warning restore CA1031 // Do not catch general exception types
{
WinFormsUtil.Error(ex.Message);
return false;
}
}
public void Disconnect()
{
Bot.Disconnect();
}
//todo: this
//public uint GetDefaultOffset()
//{
// return Settings.Default.SysBotPouchOffset;
//}
//public void PopPrompt()
//{
//}
public void WriteBytes(byte[] data, uint offset)
{
Bot.WriteBytes(data, offset);
//SetOffset(offset);
}
public byte[] ReadBytes(uint offset, int length)
{
var result = Bot.ReadBytes(offset, length);
//SetOffset(offset);
return result;
}
}
}