2017-06-23 19:31:47 +00:00
|
|
|
|
using System;
|
2017-10-21 20:13:50 +00:00
|
|
|
|
using System.Text.RegularExpressions;
|
2017-06-23 19:31:47 +00:00
|
|
|
|
|
|
|
|
|
namespace Noikoio.RegexBot
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Program entry point. Sets up handling of certain events and does initial
|
|
|
|
|
/// configuration loading before starting the Discord client.
|
|
|
|
|
/// </summary>
|
|
|
|
|
class Program
|
|
|
|
|
{
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
2017-07-26 22:36:59 +00:00
|
|
|
|
RegexBot rb = new RegexBot();
|
2017-06-23 19:31:47 +00:00
|
|
|
|
|
|
|
|
|
Console.CancelKeyPress += rb.Console_CancelKeyPress;
|
2017-10-21 20:13:50 +00:00
|
|
|
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
2017-06-23 19:31:47 +00:00
|
|
|
|
|
|
|
|
|
rb.Start().GetAwaiter().GetResult();
|
|
|
|
|
}
|
2017-10-21 20:13:50 +00:00
|
|
|
|
|
|
|
|
|
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var l = Logger.GetLogger("Runtime");
|
|
|
|
|
string[] lines = Regex.Split(e.ExceptionObject.ToString(), "\r\n|\r|\n");
|
|
|
|
|
foreach (string line in lines)
|
|
|
|
|
{
|
|
|
|
|
l(line).Wait();
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-23 19:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|