コード例 #1
0
ファイル: Main.cs プロジェクト: Nyaneymar/SysBot.NET
        private PokeBotConfig CreateNewBotConfig()
        {
            var type = (PokeRoutineType)WinFormsUtil.GetIndex(CB_Routine);
            var ip   = TB_IP.Text;
            var port = (int)NUD_Port.Value;

            var cfg = SwitchBotConfig.GetConfig <PokeBotConfig>(ip, port);

            cfg.NextRoutineType = type;
            return(cfg);
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: Splice-X/SpliceBot.NET
        private PokeBotConfig CreateNewBotConfig()
        {
            var type           = (PokeRoutineType)WinFormsUtil.GetIndex(CB_Routine);
            var ip             = TB_IP.Text;
            var port           = (int)NUD_Port.Value;
            var connectionType = (ConnectionType)WinFormsUtil.GetIndex(CB_ConnectionType);
            var addedIndexes   = Bots.Where(z => z.UsbPortIndex != string.Empty).Select(z => z.UsbPortIndex);
            var usbPortIndex   = SwitchConnectionUSB.GetUsbPortIndex(addedIndexes);

            var cfg = SwitchBotConfig.GetConfig <PokeBotConfig>(ip, port, connectionType, usbPortIndex);

            cfg.Initialize(type, connectionType);
            return(cfg);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: rigrassm/SporkBot.NET
        private static void CreateNewConfig(PokeTradeHubConfig hub)
        {
            List <PokeBotConfig> botList = new();
            var type           = PokeRoutineType.FlexTrade;
            var ip             = "192.168.1.1";
            var usbPortIndex   = "1";
            var port           = 6000;
            var connectionType = ConnectionType.USB;

            var bot = SwitchBotConfig.GetConfig <PokeBotConfig>(ip, port, connectionType, usbPortIndex);

            bot.Initialize(type, connectionType);
            botList.Add(bot);

            ProgramConfig cfg = new()
            {
                Bots = botList.ToArray(),
                Hub  = hub,
            };
            var lines = JsonConvert.SerializeObject(cfg);

            File.WriteAllText(ConfigFileName, lines);
        }