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


C# WinterBot.Shutdown方法代码示例

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


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

示例1: Kill

        public void Kill(WinterBot bot, TwitchUser user, string cmd, string value)
        {
            bot.WriteDiagnostic(DiagnosticFacility.Info, "Bot killed by streamer.");
            WinterBotSource.Log.Kill();

            bot.Shutdown();
        }
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:7,代码来源:BotControl.cs

示例2: Main

        static void Main(string[] args)
        {
            if (!Debugger.IsAttached)
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            Options options = new Options(GetIniFile(args));
            if (string.IsNullOrEmpty(options.Channel) || string.IsNullOrEmpty(options.Username) || string.IsNullOrEmpty(options.Password))
            {
                MessageBox.Show("You must first fill in a stream, user, and oauth password to use WinterBot.\n\nPlease follow the instructions here:\nhttps://github.com/DarkAutumn/WinterBot/wiki/Getting-Started", "WinterBot needs configuration!");
                Environment.Exit(1);
            }

            s_errorFile = options.DataDirectory;

            string thisExe = Assembly.GetExecutingAssembly().Location;
            var verInfo = FileVersionInfo.GetVersionInfo(thisExe);
            string version = string.Format("{0}.{1}", verInfo.ProductMajorPart, verInfo.FileMinorPart);

            Console.Title = "WinterBot: " + options.Channel;
            Console.WriteLine("Winterbot {0}", version);
            Console.WriteLine("Using data folder: {0}", GetDataFolder(options.DataDirectory));
            Console.WriteLine("Press Q to quit safely.");
            Console.WriteLine();

            WinterBot bot = new WinterBot(options, options.Channel, options.Username, options.Password);
            LoadPlugins(options, bot);

            bot.Connected += delegate(WinterBot b) { WriteLine("Connected to channel: {0}", options.Channel); };
            bot.MessageReceived += delegate(WinterBot b, TwitchUser user, string text) { s_messages++; };
            bot.ChatClear += delegate(WinterBot b, TwitchUser user) { WriteLine("Chat Clear: {0}", user.Name); };
            bot.UserBanned += delegate(WinterBot b, TwitchUser user) { WriteLine("Banned: {0}", user.Name); };
            bot.UserTimedOut += delegate(WinterBot b, TwitchUser user, int duration) { WriteLine("Timeout: {0} for {1} seconds", user.Name, duration); };
            bot.DiagnosticMessage += delegate(WinterBot b, DiagnosticFacility f, string msg) { WriteLine("Diagnostics: {0}", msg); };
            bot.Tick += bot_Tick;

            Thread t = new Thread(bot.Go);
            t.Start();

            Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) { bot.Shutdown(); Environment.Exit(0); };

            while (true)
            {
                ConsoleKeyInfo key = Console.ReadKey(true);
                if (key.Key == ConsoleKey.Q)
                {
                    bot.Shutdown();
                    Environment.Exit(0);
                }
            }
        }
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:50,代码来源:Program.cs


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