当前位置: 首页>>代码示例>>C#>>正文


C# Bot.StartBot方法代码示例

本文整理汇总了C#中SteamBot.Bot.StartBot方法的典型用法代码示例。如果您正苦于以下问题:C# Bot.StartBot方法的具体用法?C# Bot.StartBot怎么用?C# Bot.StartBot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SteamBot.Bot的用法示例。


在下文中一共展示了Bot.StartBot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BotMode

        // This mode is to run a single Bot until it's terminated.
        private static void BotMode(int botIndex)
        {
            if (!File.Exists("settings.json"))
            {
                Console.WriteLine("No settings.json file found.");
                return;
            }

            Configuration configObject;
            try
            {
                configObject = Configuration.LoadConfiguration("settings.json");
            }
            catch (Newtonsoft.Json.JsonReaderException)
            {
                // handle basic json formatting screwups
                Console.WriteLine("settings.json file is corrupt or improperly formatted.");
                return;
            }

            if (botIndex >= configObject.Bots.Length)
            {
                Console.WriteLine("Invalid bot index.");
                return;
            }

            Bot b = new Bot(configObject.Bots[botIndex], configObject.ApiKey, BotManager.UserHandlerCreator, true, true);
            Console.Title = "Bot Manager";
            b.StartBot();

            string AuthSet = "auth";
            string ExecCommand = "exec";

            // this loop is needed to keep the botmode console alive.
            // instead of just sleeping, this loop will handle console input
            while (true)
            {
                string inputText = Console.ReadLine();

                if (String.IsNullOrEmpty(inputText))
                    continue;

                // Small parse for console input
                var c = inputText.Trim();

                var cs = c.Split(' ');

                if (cs.Length > 1)
                {
                    if (cs[0].Equals(AuthSet, StringComparison.CurrentCultureIgnoreCase))
                    {
                        b.AuthCode = cs[1].Trim();
                    }
                    else if (cs[0].Equals(ExecCommand, StringComparison.CurrentCultureIgnoreCase))
                    {
                        b.HandleBotCommand(c.Remove(0, cs[0].Length + 1));
                    }
                }
            }
        }
开发者ID:angrychisel,项目名称:SteamBot,代码行数:61,代码来源:Program.cs

示例2: SpawnBotThread

            private void SpawnBotThread(Configuration.BotInfo botConfig)
            {
                // the bot object itself is threaded so we just build it and start it.
                Bot b = new Bot(botConfig,
                                config.ApiKey,
                                UserHandlerCreator,
                                true);

                TheBot = b;
                TheBot.StartBot();
            }
开发者ID:ElPresidentePro,项目名称:CSGOShop-Steambot,代码行数:11,代码来源:BotManager.cs

示例3: BotMode

        // This mode is to run a single Bot until it's terminated.
        private static void BotMode(int botIndex)
        {
            if (!File.Exists("settings.json"))
            {
                Console.WriteLine("No settings.json file found.");
                return;
            }

            Configuration configObject;
            try
            {
                configObject = Configuration.LoadConfiguration("settings.json");
            }
            catch (Newtonsoft.Json.JsonReaderException)
            {
                // handle basic json formatting screwups
                Console.WriteLine("settings.json file is currupt or improperly formatted.");
                return;
            }

            if (configObject.Bots.Length > botIndex)
            {
                Bot b = new Bot(configObject.Bots[botIndex], configObject.ApiKey, BotManager.UserHandlerCreator, true, true);
                Console.Title = configObject.Bots[botIndex].DisplayName;
                b.StartBot(); // never returns from this.
            }

            // this loop is needed to keep the botmode console alive.
            // the sleep keeps the cpu usage low.
            while (true)
            {
                System.Threading.Thread.Sleep(1000);
            }
        }
开发者ID:Gamer007,项目名称:SteamBot,代码行数:35,代码来源:Program.cs

示例4: BotMode

        // This mode is to run a single Bot until it's terminated.
        private static void BotMode(int botIndex)
        {
            if (!File.Exists("settings.json"))
            {
                Console.WriteLine("No settings.json file found.");
                return;
            }

            Configuration configObject;
            try
            {
                configObject = Configuration.LoadConfiguration("settings.json");
            }
            catch (Newtonsoft.Json.JsonReaderException)
            {
                // handle basic json formatting screwups
                Console.WriteLine("settings.json file is currupt or improperly formatted.");
                return;
            }

            if (configObject.Bots.Length > botIndex)
            {
                Bot b = new Bot(configObject.Bots[botIndex], configObject.ApiKey, BotManager.UserHandlerCreator, true);
                Console.Title = configObject.Bots[botIndex].DisplayName;
                b.StartBot(); // never returns from this.
            }

            while (true)
            {
                // we need this in here so we can keep
                // the console alive so we can read the
                // steamguard code if need be.
            }
        }
开发者ID:Elementalrogue,项目名称:SteamBot,代码行数:35,代码来源:Program.cs


注:本文中的SteamBot.Bot.StartBot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。