Example #1
0
        public void ButtonTestX()
        {
            var poke   = SwitchCommand.Click(SwitchButton.X);
            var expect = new byte[] { 0x63, 0x6C, 0x69, 0x63, 0x6B, 0x20, 0x58, 0x0D, 0x0A }; // "click X\r\n"

            poke.SequenceEqual(expect).Should().BeTrue();
        }
        private async Task ClickAsyncImpl(SwitchButton button)
        {
            var b = Globals.Bot;
            await b.Connection.SendAsync(SwitchCommand.Click(button, b.UseCRLF), CancellationToken.None).ConfigureAwait(false);

            await ReplyAsync($"{b.Connection.Name} has performed: {button}").ConfigureAwait(false);
        }
Example #3
0
        private async Task ClickAsyncImpl(SwitchButton b, BotSource <PokeBotConfig> bot)
        {
            if (!Enum.IsDefined(typeof(SwitchButton), b))
            {
                await ReplyAsync($"Unknown button value: {b}").ConfigureAwait(false);

                return;
            }

            await bot.Bot.Connection.SendAsync(SwitchCommand.Click(b), bot.Bot.Config.ConnectionType, CancellationToken.None).ConfigureAwait(false);

            await ReplyAsync($"{bot.Bot.Connection.Name} has performed: {b}").ConfigureAwait(false);
        }
Example #4
0
        public static void ReadItemDump(FakeItem item, uint offset, uint offsetItem)
        {
            FakeItem itemToWrite = item;
            sb.WriteBytes(itemToWrite.GetAsBytes5(), offset);

            sb.SendRawBytes(SwitchCommand.Click(SwitchButton.DRIGHT));

            Thread.Sleep(1500);

            sb.SendRawBytes(SwitchCommand.Click(SwitchButton.B));

            byte[] received = sb.ReadBytes(offsetItem, 4196);
            string txt = System.Text.Encoding.UTF8.GetString(received);

            Console.WriteLine(txt);
            Console.WriteLine("******************************************************************************************************************");
        }
Example #5
0
        private async Task ClickAsyncImpl(SwitchButton button, BotSource <PokeBotState> bot)
        {
            if (!Enum.IsDefined(typeof(SwitchButton), button))
            {
                await ReplyAsync($"Unknown button value: {button}").ConfigureAwait(false);

                return;
            }

            var b = bot.Bot;
            var crlf = b is SwitchRoutineExecutor <PokeBotState> {
                UseCRLF : true
            };
            await b.Connection.SendAsync(SwitchCommand.Click(button, crlf), CancellationToken.None).ConfigureAwait(false);

            await ReplyAsync($"{b.Connection.Name} has performed: {button}").ConfigureAwait(false);
        }