示例#1
0
文件: SysBotUI.cs 项目: xenfye/NHSE
        private void ReadUSB_Click(object sender, EventArgs e)
        {
            if (!BotUSB.Connect())
            {
                return;
            }

            var offset = StringUtil.GetHexValue(RamOffsetUSB.Text);

            if (offset == 0)
            {
                WinFormsUtil.Error(MessageStrings.MsgInvalidHexValue);
                return;
            }

            InjectorUSB.SetWriteOffset(offset);

            try
            {
                var result = InjectorUSB.Read(true);
                if (result == InjectionResult.Success)
                {
                    return;
                }
                WinFormsUtil.Alert(result.ToString());
            }
#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);
            }

            BotUSB.Disconnect();
        }
示例#2
0
        private void B_ReadCurrent_Click(object sender, EventArgs e)
        {
            try
            {
                var result = Injector.Read(true);
                if (result != InjectionResult.Success)
                {
                    WinFormsUtil.Alert(result.ToString());
                }
            }
#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);
            }
        }
示例#3
0
文件: SysBotUI.cs 项目: yumf/NHSE
        public SysBotUI(AutoInjector injector, SysBotController c)
        {
            InitializeComponent();
            Bot      = c;
            Injector = injector;

            var offset = Bot.GetDefaultOffset();

            Injector.SetWriteOffset(offset);
            RamOffset.Text = offset.ToString("X8");

            TB_IP.Text   = Bot.IP;
            TB_Port.Text = Bot.Port;

            Bot.PopPrompt();

            TIM_Interval.Tick += (s, e) => injector.Read();
        }
示例#4
0
    public void ReadFromSource()
    {
        uint offset = sbc.GetDefaultOffset();

        injector.SetWriteOffset(offset);
        try
        {
            InjectionResult injectionResult = injector.Read(true);
            if (injectionResult != InjectionResult.Success)
            {
                Debug.Log(injectionResult.ToString());
            }
        }
        catch (Exception ex)
        {
            Debug.LogError(ex.Message);
            UISB.ConnectedText.text = (ex.Message);
            UISB.SetConnected(val: false);
        }
    }
示例#5
0
文件: SysBotUI.cs 项目: xenfye/NHSE
        public SysBotUI(AutoInjector injector, SysBotController c, AutoInjector injectorUSB, USBBotController b)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);
            Bot         = c;
            Injector    = injector;
            BotUSB      = b;
            InjectorUSB = injectorUSB;

            var offset = Bot.GetDefaultOffset();

            Injector.SetWriteOffset(offset);
            RamOffset.Text = offset.ToString("X8");

            TB_IP.Text   = Bot.IP;
            TB_Port.Text = Bot.Port;

            Bot.PopPrompt();

            TIM_Interval.Tick += (s, e) => injector.Read();
        }