本文整理汇总了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();
}
示例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);
}
}
}