[NF] Now sould dedect Strg+c on Linux

This commit is contained in:
2018-05-15 20:52:54 +00:00
parent 69030796f5
commit 852a096f1d
31 changed files with 49 additions and 17 deletions
+12
View File
@@ -11,6 +11,7 @@ namespace ZwayBot {
private readonly ZwayController zw;
private readonly Dictionary<String, AModul> moduls = new Dictionary<String, AModul>();
private Boolean RunningProcess = true;
private System.Threading.Thread sig_thread;
private readonly ProgramLogger logger = new ProgramLogger();
public Program(String[] args) {
@@ -42,6 +43,16 @@ namespace ZwayBot {
}
private void WaitForShutdown() {
this.sig_thread = new System.Threading.Thread(delegate() {
Mono.Unix.UnixSignal[] signals = new Mono.Unix.UnixSignal[] {
new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM),
new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGINT)
};
while (true) {
Int32 i = Mono.Unix.UnixSignal.WaitAny(signals, -1);
this.RunningProcess = false;
}
});
Console.CancelKeyPress += new ConsoleCancelEventHandler(this.SetupShutdown);
while (this.RunningProcess) {
System.Threading.Thread.Sleep(100);
@@ -59,6 +70,7 @@ namespace ZwayBot {
Console.WriteLine("Modul entladen: " + item.Key);
}
this.zw.Dispose();
this.sig_thread.Abort();
}
private void ModulEvents() {
+2 -2
View File
@@ -31,8 +31,8 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.2")]
[assembly: AssemblyFileVersion("1.4.2")]
[assembly: AssemblyVersion("1.4.3")]
[assembly: AssemblyFileVersion("1.4.3")]
[assembly: NeutralResourcesLanguage("de-DE")]
// “Internet Of Things” icon by By Michael Wohlwend, US, from thenounproject.com.
+11
View File
@@ -12,6 +12,8 @@
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -51,6 +53,7 @@
</ItemGroup>
<ItemGroup>
<None Include="dpkg\preinst" />
<None Include="dpkg\postinst" />
<Compile Include="Events.cs" />
<Compile Include="Interfaces\IForceLoad.cs" />
<Compile Include="Moduls\AModul.cs" />
@@ -150,6 +153,7 @@
<None Include="dpkg\make-deb.sh" />
<None Include="dpkg\prerm" />
<None Include="dpkg\zwaybot.service" />
<None Include="packages.config" />
<None Include="Resources\Icon.ico" />
<Content Include="Resources\icon.svg" />
</ItemGroup>
@@ -160,4 +164,11 @@
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Mono.Posix.5.4.0.201\build\net45\Mono.Posix.targets" Condition="Exists('..\packages\Mono.Posix.5.4.0.201\build\net45\Mono.Posix.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Mono.Posix.5.4.0.201\build\net45\Mono.Posix.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Mono.Posix.5.4.0.201\build\net45\Mono.Posix.targets'))" />
</Target>
</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
[modul]
[modul]
config=public
[cold]
@@ -1,4 +1,4 @@
[modul]
[modul]
config=private
[settings]
@@ -1,4 +1,4 @@
[names]
[names]
2-0-37=Kühlschrank Schalter
2-0-49-4=Kühlschrank Leistung
2-0-50-0=Kühlschrank Verbrauch [kWh]
@@ -1,4 +1,4 @@
[hot]
[hot]
from=7-0-67-1:Level
to=8-0-67-1:Level;9-0-67-1:Level
@@ -1,4 +1,4 @@
[modul]
[modul]
config=private
[settings]
@@ -1,4 +1,4 @@
[zway]
[zway]
server=localhost
user=admin
pass=pass
@@ -1,3 +1,3 @@
[temp]
[temp]
cron=30 * * * *
devices=7-0-49-1,8-0-49-1,9-0-49-1,10-0-49-1,11-0-49-1
Binary file not shown.
+1 -1
View File
@@ -1,4 +1,4 @@
[modul]
[modul]
config=public
[cold]
+1 -1
View File
@@ -1,4 +1,4 @@
[modul]
[modul]
config=private
[settings]
+1 -1
View File
@@ -1,4 +1,4 @@
[names]
[names]
2-0-37=Kühlschrank Schalter
2-0-49-4=Kühlschrank Leistung
2-0-50-0=Kühlschrank Verbrauch [kWh]
@@ -1,4 +1,4 @@
[hot]
[hot]
from=7-0-67-1:Level
to=8-0-67-1:Level;9-0-67-1:Level
+1 -1
View File
@@ -1,4 +1,4 @@
[modul]
[modul]
config=private
[settings]
@@ -1,4 +1,4 @@
[zway]
[zway]
server=localhost
user=admin
pass=pass
@@ -1,3 +1,3 @@
[temp]
[temp]
cron=30 * * * *
devices=7-0-49-1,8-0-49-1,9-0-49-1,10-0-49-1,11-0-49-1
+1
View File
@@ -18,6 +18,7 @@ mkdir -p $SYSTEMD
cp control $DEBIAN
cp preinst $DEBIAN
cp postinst $DEBIAN
cp prerm $DEBIAN
sed -i s/Version:\ x\.x-x/"Version: $VMAJOR.$VMINOR-$VBUILD"/ $DEBIAN/control
sed -i s/Architecture:\ any/"Architecture: $ARCHT"/ $DEBIAN/control
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
service zwaybot start
+2 -1
View File
@@ -1,4 +1,5 @@
#!/bin/sh
service zwaybot stop
adduser --system zwaybot
addgroup zwaybot
adduser --system --no-create-home --disabled-login --ingroup zwaybot zwaybot
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Mono.Posix" version="5.4.0.201" targetFramework="net471" />
</packages>