Update bot to remove lockfile on exit

This commit is contained in:
Zontreck 2020-06-20 20:44:46 -07:00
parent 43a87c6be0
commit f1c8372f8b

View file

@ -61,7 +61,7 @@ namespace Bot
MainConfiguration.Instance.Load(); MainConfiguration.Instance.Load();
MainConfiguration conf = MainConfiguration.Instance; MainConfiguration conf = MainConfiguration.Instance;
//MasterObjectCaches = ObjectCaches.Instance; //MasterObjectCaches = ObjectCaches.Instance;
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
if (args.Length == 2) if (args.Length == 2)
{ {
@ -594,6 +594,12 @@ namespace Bot
//System.Console.ReadKey(); //System.Console.ReadKey();
} }
private static void CurrentDomain_ProcessExit(object sender, EventArgs e)
{
// Exit the process
if (File.Exists("Bot.lockfile")) File.Delete("Bot.lockfile");
}
private static void onJoinGroupChat(object sender, GroupChatJoinedEventArgs e) private static void onJoinGroupChat(object sender, GroupChatJoinedEventArgs e)
{ {
if (e.Success) if (e.Success)