From 3e79b425a549f5fe6ed776374029c975c0ccc290 Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Sun, 1 Dec 2019 17:53:11 +0100 Subject: [PATCH] Change netcore --- Bot-Utils/ABot.cs | 14 +++++++++++--- Bot-Utils/Bot-Utils.csproj | 1 + Bot-Utils/Bot-Utils_Core.csproj | 1 + Changelog.md | 0 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 Changelog.md diff --git a/Bot-Utils/ABot.cs b/Bot-Utils/ABot.cs index 0a47e55..661ca64 100644 --- a/Bot-Utils/ABot.cs +++ b/Bot-Utils/ABot.cs @@ -16,10 +16,15 @@ namespace BlubbFish.Utils.IoT.Bots { Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.SetupShutdown: Signalhandler Windows INT recieved."); this.RunningProcess = false; } + + #if NETCOREAPP private void Default_Unloading(AssemblyLoadContext obj) { - Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.SetupShutdown: Signalhandler Windows INT recieved."); + Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.SetupShutdown: Signalhandler Windows NETCORE recieved."); this.RunningProcess = false; + Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Shutdown."); + this.Dispose(); } + #endif protected void WaitForShutdown() { if(Type.GetType("Mono.Runtime") != null) { @@ -39,15 +44,18 @@ namespace BlubbFish.Utils.IoT.Bots { }); this.sig_thread.Start(); #endif - } else { + } else { + #if NETCOREAPP AssemblyLoadContext.Default.Unloading += this.Default_Unloading; - Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Signalhandler Netcore attached."); + Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Signalhandler Netcore attached."); + #endif Console.CancelKeyPress += new ConsoleCancelEventHandler(this.SetupShutdown); Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Signalhandler Windows attached."); } while(this.RunningProcess) { Thread.Sleep(100); } + Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Shutdown."); } diff --git a/Bot-Utils/Bot-Utils.csproj b/Bot-Utils/Bot-Utils.csproj index c66700b..4417b30 100644 --- a/Bot-Utils/Bot-Utils.csproj +++ b/Bot-Utils/Bot-Utils.csproj @@ -65,6 +65,7 @@ + diff --git a/Bot-Utils/Bot-Utils_Core.csproj b/Bot-Utils/Bot-Utils_Core.csproj index 47330d5..0e3a40f 100644 --- a/Bot-Utils/Bot-Utils_Core.csproj +++ b/Bot-Utils/Bot-Utils_Core.csproj @@ -38,6 +38,7 @@ + diff --git a/Changelog.md b/Changelog.md new file mode 100644 index 0000000..e69de29