當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。