Change netcore

This commit is contained in:
BlubbFish 2019-12-01 17:53:11 +01:00
parent 9326ab8659
commit 3e79b425a5
4 changed files with 13 additions and 3 deletions

View File

@ -16,10 +16,15 @@ namespace BlubbFish.Utils.IoT.Bots {
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.SetupShutdown: Signalhandler Windows INT recieved."); Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.SetupShutdown: Signalhandler Windows INT recieved.");
this.RunningProcess = false; this.RunningProcess = false;
} }
#if NETCOREAPP
private void Default_Unloading(AssemblyLoadContext obj) { 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; this.RunningProcess = false;
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Shutdown.");
this.Dispose();
} }
#endif
protected void WaitForShutdown() { protected void WaitForShutdown() {
if(Type.GetType("Mono.Runtime") != null) { if(Type.GetType("Mono.Runtime") != null) {
@ -39,15 +44,18 @@ namespace BlubbFish.Utils.IoT.Bots {
}); });
this.sig_thread.Start(); this.sig_thread.Start();
#endif #endif
} else { } else {
#if NETCOREAPP
AssemblyLoadContext.Default.Unloading += this.Default_Unloading; 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.CancelKeyPress += new ConsoleCancelEventHandler(this.SetupShutdown);
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Signalhandler Windows attached."); Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Signalhandler Windows attached.");
} }
while(this.RunningProcess) { while(this.RunningProcess) {
Thread.Sleep(100); Thread.Sleep(100);
} }
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Shutdown.");
} }

View File

@ -65,6 +65,7 @@
<Compile Include="Webserver.cs" /> <Compile Include="Webserver.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="..\CHANGELOG.md" />
<Content Include="..\CONTRIBUTING.md" /> <Content Include="..\CONTRIBUTING.md" />
<Content Include="..\LICENSE" /> <Content Include="..\LICENSE" />
<Content Include="..\README.md" /> <Content Include="..\README.md" />

View File

@ -38,6 +38,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="../CHANGELOG.md" />
<Content Include="../CONTRIBUTING.md" /> <Content Include="../CONTRIBUTING.md" />
<Content Include="../LICENSE" /> <Content Include="../LICENSE" />
<Content Include="../README.md" /> <Content Include="../README.md" />

0
Changelog.md Normal file
View File