Compare commits

..

No commits in common. "master" and "v1.2.1" have entirely different histories.

21 changed files with 529 additions and 728 deletions

View File

@ -1,49 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bot-Utils", "Bot-Utils\Bot-Utils-4.7.1.csproj", "{BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "litjson_4.7.1", "..\..\Librarys\litjson\litjson\litjson_4.7.1.csproj", "{91A14CD2-2940-4500-8193-56D37EDDDBAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils-IoT\Utils-IoT\Utils-IoT-4.7.1.csproj", "{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils-4.7.1.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Posix", "..\..\Librarys\Mono.Posix\Mono.Posix\Mono.Posix.csproj", "{E2CA132E-E85C-40AD-BE94-B138AA68772B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Release|Any CPU.Build.0 = Release|Any CPU
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.Build.0 = Release|Any CPU
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.Build.0 = Release|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU
{E2CA132E-E85C-40AD-BE94-B138AA68772B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2CA132E-E85C-40AD-BE94-B138AA68772B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2CA132E-E85C-40AD-BE94-B138AA68772B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2CA132E-E85C-40AD-BE94-B138AA68772B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {99DB6F34-BD41-4AFF-82B7-E4B3EFDF56DC}
EndGlobalSection
EndGlobal

View File

@ -1,15 +1,17 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio 15
VisualStudioVersion = 16.0.29519.87 VisualStudioVersion = 15.0.28307.136
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot-Utils", "Bot-Utils\Bot-Utils.csproj", "{CB48457C-C567-42BC-9E5B-DAE5A3383108}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bot-Utils", "Bot-Utils\Bot-Utils.csproj", "{BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils-IoT", "..\Utils-IoT\Utils-IoT\Utils-IoT.csproj", "{86E9D6ED-EE31-4FE7-AEA6-555DBBAA69A4}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "litjson_4.7.1", "..\..\Librarys\litjson\litjson\litjson_4.7.1.csproj", "{91A14CD2-2940-4500-8193-56D37EDDDBAA}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils", "..\Utils\Utils\Utils.csproj", "{110EB1ED-1567-4A7E-B8B5-E46F421E0684}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils-IoT\Utils-IoT\Utils-IoT.csproj", "{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "litjson", "..\..\Librarys\litjson\litjson\litjson.csproj", "{A6EB1FF2-A3F1-4C97-8E7F-0F2CE4A8A820}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Posix", "..\..\Librarys\Mono.Posix\Mono.Posix\Mono.Posix.csproj", "{E2CA132E-E85C-40AD-BE94-B138AA68772B}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -17,27 +19,31 @@ Global
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CB48457C-C567-42BC-9E5B-DAE5A3383108}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB48457C-C567-42BC-9E5B-DAE5A3383108}.Debug|Any CPU.Build.0 = Debug|Any CPU {BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB48457C-C567-42BC-9E5B-DAE5A3383108}.Release|Any CPU.ActiveCfg = Release|Any CPU {BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB48457C-C567-42BC-9E5B-DAE5A3383108}.Release|Any CPU.Build.0 = Release|Any CPU {BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Release|Any CPU.Build.0 = Release|Any CPU
{86E9D6ED-EE31-4FE7-AEA6-555DBBAA69A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86E9D6ED-EE31-4FE7-AEA6-555DBBAA69A4}.Debug|Any CPU.Build.0 = Debug|Any CPU {91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86E9D6ED-EE31-4FE7-AEA6-555DBBAA69A4}.Release|Any CPU.ActiveCfg = Release|Any CPU {91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86E9D6ED-EE31-4FE7-AEA6-555DBBAA69A4}.Release|Any CPU.Build.0 = Release|Any CPU {91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.Build.0 = Release|Any CPU
{110EB1ED-1567-4A7E-B8B5-E46F421E0684}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{110EB1ED-1567-4A7E-B8B5-E46F421E0684}.Debug|Any CPU.Build.0 = Debug|Any CPU {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{110EB1ED-1567-4A7E-B8B5-E46F421E0684}.Release|Any CPU.ActiveCfg = Release|Any CPU {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{110EB1ED-1567-4A7E-B8B5-E46F421E0684}.Release|Any CPU.Build.0 = Release|Any CPU {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.Build.0 = Release|Any CPU
{A6EB1FF2-A3F1-4C97-8E7F-0F2CE4A8A820}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6EB1FF2-A3F1-4C97-8E7F-0F2CE4A8A820}.Debug|Any CPU.Build.0 = Debug|Any CPU {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6EB1FF2-A3F1-4C97-8E7F-0F2CE4A8A820}.Release|Any CPU.ActiveCfg = Release|Any CPU {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6EB1FF2-A3F1-4C97-8E7F-0F2CE4A8A820}.Release|Any CPU.Build.0 = Release|Any CPU {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU
{E2CA132E-E85C-40AD-BE94-B138AA68772B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2CA132E-E85C-40AD-BE94-B138AA68772B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2CA132E-E85C-40AD-BE94-B138AA68772B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2CA132E-E85C-40AD-BE94-B138AA68772B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0F0DF907-D03F-41A9-B0A2-CA229CC259EE} SolutionGuid = {99DB6F34-BD41-4AFF-82B7-E4B3EFDF56DC}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -1,58 +1,48 @@
using System; using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Loader;
using System.Threading; using System.Threading;
namespace BlubbFish.Utils.IoT.Bots { namespace BlubbFish.Utils.IoT.Bots {
public abstract class ABot { public abstract class ABot {
private Thread sig_thread;
private Boolean RunningProcess = true; private Boolean RunningProcess = true;
private readonly ProgramLogger logger = null;
public Boolean DebugLogging { protected ProgramLogger logger = new ProgramLogger();
get;
private void SetupShutdown(Object sender, ConsoleCancelEventArgs e) {
e.Cancel = true;
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.SetupShutdown: Signalhandler Windows INT recieved.");
this.RunningProcess = false;
} }
public ABot(String[] _, Boolean fileLogging, String configSearchPath) { protected void WaitForShutdown() {
InIReader.SetSearchPath(new List<String>() { "/etc/"+ configSearchPath, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\"+ configSearchPath }); if(Type.GetType("Mono.Runtime") != null) {
if(fileLogging) { this.sig_thread = new Thread(delegate () {
this.logger = new ProgramLogger(InIReader.GetInstance("settings").GetValue("logging", "path", Assembly.GetEntryAssembly().GetName().Name + ".log")); Mono.Unix.UnixSignal[] signals = new Mono.Unix.UnixSignal[] {
} new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM),
if(Boolean.TryParse(InIReader.GetInstance("settings").GetValue("logging", "debug", "true"), out Boolean debuglog)) { new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGINT)
this.DebugLogging = debuglog; };
} Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Signalhandler Mono attached.");
} while(true) {
Int32 i = Mono.Unix.UnixSignal.WaitAny(signals, -1);
private void ConsoleCancelEvent(Object sender, ConsoleCancelEventArgs e) { Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Signalhandler Mono INT recieved " + i + ".");
e.Cancel = true; this.RunningProcess = false;
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ConsoleCancelEvent()"); break;
this.RunningProcess = false; }
} });
this.sig_thread.Start();
#if NETCOREAPP } else {
private void Unloading(AssemblyLoadContext obj) => this.RunningProcess = false; Console.CancelKeyPress += new ConsoleCancelEventHandler(this.SetupShutdown);
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Signalhandler Windows attached.");
private void ProcessExit(Object sender, EventArgs e) => this.RunningProcess = false; }
#endif while(this.RunningProcess) {
Thread.Sleep(100);
protected void WaitForShutdown() { }
#if NETCOREAPP
AssemblyLoadContext.Default.Unloading += this.Unloading;
AppDomain.CurrentDomain.ProcessExit += this.ProcessExit;
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Attach Unloading and ProcessExit.");
#endif
Console.CancelKeyPress += new ConsoleCancelEventHandler(this.ConsoleCancelEvent);
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Attach ConsoleCancelEvent.");
while(this.RunningProcess) {
Thread.Sleep(100);
}
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.WaitForShutdown: Shutdown.");
} }
public virtual void Dispose() { public virtual void Dispose() {
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.Dispose: Shutdown."); if(this.sig_thread != null && this.sig_thread.IsAlive) {
this.RunningProcess = false; this.sig_thread.Abort();
this.logger?.Dispose(); }
} }
} }
} }

View File

@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using BlubbFish.Utils.IoT.Connector;
using BlubbFish.Utils.IoT.Events;
namespace BlubbFish.Utils.IoT.Bots {
public abstract class AWebserverDataBackend : AWebserver {
protected ABackend databackend;
protected AWebserverDataBackend(String[] args, Boolean fileLogging, String configSearchPath, ABackend backend, Dictionary<String, String> settings) : base(args, fileLogging, configSearchPath, settings) => this.databackend = backend;
protected void StartDataBackend() => this.databackend.MessageIncomming += this.Backend_MessageIncomming;
protected abstract void Backend_MessageIncomming(Object sender, BackendEvent e);
public override void Dispose() {
if(this.databackend != null) {
this.databackend.Dispose();
}
base.Dispose();
}
}
}

View File

@ -1,92 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BlubbFish.Utils.IoT.Bots</RootNamespace>
<AssemblyName>Bot-Utils</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ABot.cs" />
<Compile Include="Bot.cs" />
<Compile Include="Events\CronEvent.cs" />
<Compile Include="Events\ModulEventArgs.cs" />
<Compile Include="Events\SenmlEvent.cs" />
<Compile Include="Events\MqttEvent.cs" />
<Compile Include="Events\OvertakerEvent.cs" />
<Compile Include="Events\StatusPollingEvent.cs" />
<Compile Include="Interfaces\IForceLoad.cs" />
<Compile Include="Moduls\AModul.cs" />
<Compile Include="Moduls\CronJob.cs" />
<Compile Include="Moduls\Mqtt.cs" />
<Compile Include="Moduls\Overtaker.cs" />
<Compile Include="Moduls\Statuspolling.cs" />
<Compile Include="MultiSourceBot.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Webserver.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\CHANGELOG.md" />
<Content Include="..\CONTRIBUTING.md" />
<Content Include="..\LICENSE" />
<Content Include="..\README.md" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Librarys\litjson\litjson\litjson_4.7.1.csproj">
<Project>{91a14cd2-2940-4500-8193-56d37edddbaa}</Project>
<Name>litjson_4.7.1</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Librarys\Mono.Posix\Mono.Posix\Mono.Posix.csproj">
<Project>{e2ca132e-e85c-40ad-be94-b138aa68772b}</Project>
<Name>Mono.Posix</Name>
</ProjectReference>
<ProjectReference Include="..\..\Utils-IoT\Utils-IoT\Utils-IoT.csproj">
<Project>{b870e4d5-6806-4a0b-b233-8907eedc5afc}</Project>
<Name>Utils-IoT</Name>
</ProjectReference>
<ProjectReference Include="..\..\Utils\Utils\Utils.csproj">
<Project>{fac8ce64-bf13-4ece-8097-aeb5dd060098}</Project>
<Name>Utils</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,59 +1,86 @@
<Project Sdk="Microsoft.NET.Sdk"> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BlubbFish.Utils.IoT.Bots</RootNamespace> <RootNamespace>BlubbFish.Utils.IoT.Bots</RootNamespace>
<AssemblyName>Bot-Utils</AssemblyName> <AssemblyName>Bot-Utils</AssemblyName>
<PackageId>Bots.IoT.Utils.BlubbFish</PackageId> <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<Version>1.2.6</Version> <FileAlignment>512</FileAlignment>
<NeutralLanguage>de-DE</NeutralLanguage> <NuGetPackageImportStamp>
<Description>Bot-Utils are helpers for programming a bot</Description> </NuGetPackageImportStamp>
<Authors>BlubbFish</Authors> </PropertyGroup>
<Company>BlubbFish</Company> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Copyright>Copyright © BlubbFish 2018 - 25.01.2022</Copyright> <DebugSymbols>true</DebugSymbols>
<PackageLicenseFile>LICENSE</PackageLicenseFile> <DebugType>full</DebugType>
<PackageProjectUrl>http://git.blubbfish.net/vs_utils/Bot-Utils</PackageProjectUrl> <Optimize>false</Optimize>
<RepositoryUrl>http://git.blubbfish.net/vs_utils/Bot-Utils.git</RepositoryUrl> <OutputPath>bin\Debug\</OutputPath>
<RepositoryType>git</RepositoryType> <DefineConstants>DEBUG;TRACE</DefineConstants>
<PackageReleaseNotes> <ErrorReport>prompt</ErrorReport>
1.2.6 - 2022-01-25 - Makeing Logging easyier <WarningLevel>4</WarningLevel>
1.2.5 - 2022-01-20 - Better linux handling </PropertyGroup>
1.2.4 - 2022-01-18 - Config enabled module loading <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
1.2.3 - 2022-01-09 - Tiny Refactoring <DebugType>pdbonly</DebugType>
1.2.2 - 2021-08-22 - Going to netcore <Optimize>true</Optimize>
1.2.1 - 2019-08-30 - When using Dispose, kill also mqtt connection and other tiny fixes <OutputPath>bin\Release\</OutputPath>
1.2.0 - 2019-05-27 - Refactor Bot to ABot and refere MultiSourceBot <DefineConstants>TRACE</DefineConstants>
1.1.9 - 2019-04-21 - Modify Output of SendFileResponse <ErrorReport>prompt</ErrorReport>
1.1.8 - 2019-04-15 - Add logger to Webserver Class <WarningLevel>4</WarningLevel>
1.1.7 - 2019-04-14 - REQUEST_URL_HOST </PropertyGroup>
1.1.6 - 2019-04-03 - Refactoring and bugfixing <PropertyGroup>
1.1.5 - 2019-03-27 - add a function to send an object as json directly <StartupObject />
1.1.4 - 2019-03-13 - add Woff as Binary type
1.1.3 - 2019-03-10 - Variables parsing now as a String
1.1.2 - 2019-03-08 - Fixing bug for Contenttype
1.1.1 - 2019-02-17 - Update to local librarys
1.1.0 - 2019-02-14 - Remove Helper from Bot-Utils
</PackageReleaseNotes>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\Librarys\litjson\litjson\litjson.csproj" /> <Reference Include="System" />
<ProjectReference Include="..\..\Utils-IoT\Utils-IoT\Utils-IoT.csproj" /> <Reference Include="System.Core" />
<ProjectReference Include="..\..\Utils\Utils\Utils.csproj" /> <Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="../CHANGELOG.md" /> <Compile Include="ABot.cs" />
<Content Include="../CONTRIBUTING.md" /> <Compile Include="Bot.cs" />
<Content Include="../LICENSE" /> <Compile Include="Events\CronEvent.cs" />
<Content Include="../README.md" /> <Compile Include="Events\ModulEventArgs.cs" />
<Compile Include="Events\SenmlEvent.cs" />
<Compile Include="Events\MqttEvent.cs" />
<Compile Include="Events\OvertakerEvent.cs" />
<Compile Include="Events\StatusPollingEvent.cs" />
<Compile Include="Interfaces\IForceLoad.cs" />
<Compile Include="Moduls\AModul.cs" />
<Compile Include="Moduls\CronJob.cs" />
<Compile Include="Moduls\Mqtt.cs" />
<Compile Include="Moduls\Overtaker.cs" />
<Compile Include="Moduls\Statuspolling.cs" />
<Compile Include="MultiSourceBot.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Webserver.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\LICENSE"> <ProjectReference Include="..\..\..\Librarys\litjson\litjson\litjson_4.7.1.csproj">
<Pack>True</Pack> <Project>{91a14cd2-2940-4500-8193-56d37edddbaa}</Project>
<PackagePath></PackagePath> <Name>litjson_4.7.1</Name>
</None> </ProjectReference>
<ProjectReference Include="..\..\..\Librarys\Mono.Posix\Mono.Posix\Mono.Posix.csproj">
<Project>{e2ca132e-e85c-40ad-be94-b138aa68772b}</Project>
<Name>Mono.Posix</Name>
</ProjectReference>
<ProjectReference Include="..\..\Utils-IoT\Utils-IoT\Utils-IoT.csproj">
<Project>{b870e4d5-6806-4a0b-b233-8907eedc5afc}</Project>
<Name>Utils-IoT</Name>
</ProjectReference>
<ProjectReference Include="..\..\Utils\Utils\Utils.csproj">
<Project>{fac8ce64-bf13-4ece-8097-aeb5dd060098}</Project>
<Name>Utils</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -1,72 +1,60 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using BlubbFish.Utils.IoT.Bots.Events; using BlubbFish.Utils.IoT.Bots.Events;
using BlubbFish.Utils.IoT.Bots.Interfaces; using BlubbFish.Utils.IoT.Bots.Interfaces;
using BlubbFish.Utils.IoT.Bots.Moduls; using BlubbFish.Utils.IoT.Bots.Moduls;
namespace BlubbFish.Utils.IoT.Bots { namespace BlubbFish.Utils.IoT.Bots {
public abstract class Bot<T> : ABot { public abstract class Bot<T> : ABot {
protected readonly Dictionary<String, AModul<T>> moduls = new Dictionary<String, AModul<T>>(); protected readonly Dictionary<String, AModul<T>> moduls = new Dictionary<String, AModul<T>>();
public Bot(String[] args, Boolean fileLogging, String configSearchPath) : base(args, fileLogging, configSearchPath) { } protected void ModulDispose() {
foreach (KeyValuePair<String, AModul<T>> item in this.moduls) {
protected void ModulDispose() { item.Value.Dispose();
foreach (KeyValuePair<String, AModul<T>> item in this.moduls) { Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulDispose: Modul entladen: " + item.Key);
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulDispose: Entlade Modul: " + item.Key); }
item.Value.Dispose(); this.Dispose();
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulDispose: Modul entladen: " + item.Key); }
}
this.Dispose(); protected void ModulLoader(String @namespace, Object library) {
} Assembly asm = Assembly.GetEntryAssembly();
foreach (Type item in asm.GetTypes()) {
protected void ModulLoader(String @namespace, Object library) { if (item.Namespace == @namespace) {
Assembly asm = Assembly.GetEntryAssembly(); Type t = item;
foreach (Type item in asm.GetTypes()) { String name = t.Name;
if (item.Namespace == @namespace) { try {
Type t = item; if (InIReader.ConfigExist(name.ToLower())) {
String name = t.Name; Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulLoader: Load Modul " + name);
try { this.moduls.Add(name, (AModul<T>)t.GetConstructor(new Type[] { typeof(T), typeof(InIReader) }).Invoke(new Object[] { library, InIReader.GetInstance(name.ToLower()) }));
if (InIReader.ConfigExist(name.ToLower())) { Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulLoader: Loaded Modul " + name);
Dictionary<String, String> modulconfig = InIReader.GetInstance(name.ToLower()).GetSection("modul"); } else if (t.HasInterface(typeof(IForceLoad))) {
if(!(modulconfig.ContainsKey("enabled") && modulconfig["enabled"].ToLower() == "false")) { Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulLoader: Load Modul Forced " + name);
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulLoader: Load Modul " + name); this.moduls.Add(name, (AModul<T>)t.GetConstructor(new Type[] { typeof(T), typeof(InIReader) }).Invoke(new Object[] { library, null }));
this.moduls.Add(name, (AModul<T>)t.GetConstructor(new Type[] { typeof(T), typeof(InIReader) }).Invoke(new Object[] { library, InIReader.GetInstance(name.ToLower()) })); Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulLoader: Loaded Modul Forced " + name);
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulLoader: Loaded Modul " + name); }
continue; } catch(Exception e) {
} Helper.WriteError(e.InnerException.Message);
} }
if (t.HasInterface(typeof(IForceLoad))) { }
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulLoader: Forced Load Modul " + name); }
this.moduls.Add(name, (AModul<T>)t.GetConstructor(new Type[] { typeof(T), typeof(InIReader) }).Invoke(new Object[] { library, null })); }
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulLoader: Forced Loaded Modul " + name);
} protected void ModulInterconnect() {
} catch(Exception e) { foreach (KeyValuePair<String, AModul<T>> item in this.moduls) {
Helper.WriteError(e.InnerException.Message); item.Value.Interconnect(this.moduls);
} Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulInterconnect: Interconnect Module " + item.Key);
} }
} }
}
protected void ModulEvents() {
protected void ModulInterconnect() { foreach (KeyValuePair<String, AModul<T>> item in this.moduls) {
foreach (KeyValuePair<String, AModul<T>> item in this.moduls) { item.Value.EventLibSetter();
item.Value.Interconnect(this.moduls); item.Value.Update += this.ModulUpdate;
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulInterconnect: Interconnect Module " + item.Key); Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulEvents: Attach Event " + item.Key);
} }
} }
protected void ModulEvents() { protected void ModulUpdate(Object sender, ModulEventArgs e) => Console.WriteLine(e.ToString());
foreach (KeyValuePair<String, AModul<T>> item in this.moduls) { }
item.Value.EventLibSetter(); }
item.Value.Update += this.ModulUpdate;
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulEvents: Attach Event " + item.Key);
}
}
protected void ModulUpdate(Object sender, ModulEventArgs e) {
if(this.DebugLogging) {
Console.WriteLine(e.ToString());
}
}
}
}

View File

@ -14,6 +14,8 @@ namespace BlubbFish.Utils.IoT.Bots.Events {
public String Property { get; protected set; } public String Property { get; protected set; }
public String Value { get; protected set; } public String Value { get; protected set; }
public String Source { get; protected set; } public String Source { get; protected set; }
public override String ToString() => this.Source + ": " + this.Address + " set " + this.Property + " to " + this.Value; public override String ToString() {
return this.Source + ": " + this.Address + " set " + this.Property + " to " + this.Value;
}
} }
} }

View File

@ -9,6 +9,8 @@ namespace BlubbFish.Utils.IoT.Bots.Events {
this.Value = text; this.Value = text;
this.Source = "MQTT"; this.Source = "MQTT";
} }
public override String ToString() => this.Source + ": on " + this.Address + " set " + this.Value; public override String ToString() {
return this.Source + ": on " + this.Address + " set " + this.Value;
}
} }
} }

View File

@ -9,6 +9,8 @@ namespace BlubbFish.Utils.IoT.Bots.Events {
this.Value = text; this.Value = text;
this.Source = "Senml"; this.Source = "Senml";
} }
public override String ToString() => this.Source + ": on " + this.Address + " set " + this.Value; public override String ToString() {
return this.Source + ": on " + this.Address + " set " + this.Value;
}
} }
} }

View File

@ -11,6 +11,8 @@ namespace BlubbFish.Utils.IoT.Bots.Events {
this.Source = "POLLING"; this.Source = "POLLING";
} }
public override String ToString() => this.Source + ": " + this.Value + " on " + this.Address; public override String ToString() {
return this.Source + ": " + this.Value + " on " + this.Address;
}
} }
} }

View File

@ -39,7 +39,7 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
if (this.HasConfig && this.ConfigPublic) { if (this.HasConfig && this.ConfigPublic) {
Dictionary<String, Dictionary<String, String>> ret = new Dictionary<String, Dictionary<String, String>>(this.config); Dictionary<String, Dictionary<String, String>> ret = new Dictionary<String, Dictionary<String, String>>(this.config);
if (ret.ContainsKey("modul")) { if (ret.ContainsKey("modul")) {
_ = ret.Remove("modul"); ret.Remove("modul");
} }
return ret; return ret;
} }
@ -61,7 +61,7 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
public void SetConfig(Dictionary<String, Dictionary<String, String>> newconf) { public void SetConfig(Dictionary<String, Dictionary<String, String>> newconf) {
if (this.HasConfig && this.ConfigPublic) { if (this.HasConfig && this.ConfigPublic) {
if (newconf.ContainsKey("modul")) { if (newconf.ContainsKey("modul")) {
_ = newconf.Remove("modul"); newconf.Remove("modul");
} }
if (this.config.ContainsKey("modul")) { if (this.config.ContainsKey("modul")) {
newconf.Add("modul", this.config["modul"]); newconf.Add("modul", this.config["modul"]);

View File

@ -1,162 +1,172 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using BlubbFish.Utils.IoT.Bots.Interfaces;
using BlubbFish.Utils.IoT.Bots.Interfaces;
namespace BlubbFish.Utils.IoT.Bots.Moduls {
namespace BlubbFish.Utils.IoT.Bots.Moduls { public abstract class CronJob<T> : AModul<T>, IDisposable, IForceLoad {
public abstract class CronJob<T> : AModul<T>, IForceLoad { protected readonly List<Tuple<String, Action<Object>, Object>> internalCron = new List<Tuple<String, Action<Object>, Object>>();
protected readonly List<Tuple<String, Action<Object>, Object>> internalCron = new List<Tuple<String, Action<Object>, Object>>(); protected Thread thread;
protected Thread thread; protected DateTime crontime;
protected Boolean threadRunning = false;
protected DateTime crontime; protected readonly Dictionary<String, String> cron_named = new Dictionary<String, String> {
{ "@yearly", "0 0 1 1 *" },
protected readonly Dictionary<String, String> cron_named = new Dictionary<String, String> { { "@annually", "0 0 1 1 *" },
{ "@yearly", "0 0 1 1 *" }, { "@monthly", "0 0 1 * *" },
{ "@annually", "0 0 1 1 *" }, { "@weekly", "0 0 * * 0" },
{ "@monthly", "0 0 1 * *" }, { "@daily", "0 0 * * *" },
{ "@weekly", "0 0 * * 0" }, { "@hourly", "0 * * * *" }
{ "@daily", "0 0 * * *" }, };
{ "@hourly", "0 * * * *" }
}; #region Constructor
public CronJob(T lib, InIReader settings) : base(lib, settings) {
#region Constructor this.crontime = DateTime.Now;
public CronJob(T lib, InIReader settings) : base(lib, settings) { this.thread = new Thread(this.Runner);
this.crontime = DateTime.Now; this.thread.Start();
this.thread = new Thread(this.Runner); }
this.threadRunning = true; #endregion
this.thread.Start();
} #region Cronjobrunner
#endregion protected void Runner() {
Thread.Sleep(DateTime.Now.AddMinutes(1).AddSeconds(DateTime.Now.Second * (-1)).AddMilliseconds(DateTime.Now.Millisecond * (-1)) - DateTime.Now);
#region Cronjobrunner while (true) {
protected void Runner() { if (this.crontime.Minute != DateTime.Now.Minute) {
DateTime nextminute = DateTime.Now.AddMinutes(1).AddSeconds(DateTime.Now.Second * -1).AddMilliseconds(DateTime.Now.Millisecond * -1); this.crontime = DateTime.Now;
while(nextminute > DateTime.Now && this.threadRunning) { if (this.config.Count != 0) {
Thread.Sleep(100); foreach (KeyValuePair<String, Dictionary<String, String>> item in this.config) {
} if (item.Value.ContainsKey("cron") && item.Value.ContainsKey("set") && this.ParseCronString(item.Value["cron"])) {
while (this.threadRunning) { this.SetValues(item.Value["set"]);
if (this.crontime.Minute != DateTime.Now.Minute) { }
this.crontime = DateTime.Now; }
if (this.config.Count != 0) { }
foreach (KeyValuePair<String, Dictionary<String, String>> item in this.config) { foreach (Tuple<String, Action<Object>, Object> item in this.internalCron) {
if (item.Value.ContainsKey("cron") && item.Value.ContainsKey("set") && this.ParseCronString(item.Value["cron"])) { if (this.ParseCronString(item.Item1)) {
this.SetValues(item.Value["set"]); item.Item2?.Invoke(item.Item3);
} }
} }
} }
foreach (Tuple<String, Action<Object>, Object> item in this.internalCron) { Thread.Sleep(100);
if (this.ParseCronString(item.Item1)) { }
item.Item2?.Invoke(item.Item3); }
}
} protected abstract void SetValues(String value);
} #endregion
Thread.Sleep(100);
} #region CronFunctions
} protected Boolean ParseCronString(String cronstring) {
cronstring = cronstring.Trim();
protected abstract void SetValues(String value); if (this.cron_named.ContainsKey(cronstring)) {
#endregion cronstring = this.cron_named[cronstring];
}
#region CronFunctions String[] value = cronstring.Split(' ');
protected Boolean ParseCronString(String cronstring) { if (value.Length != 5) {
cronstring = cronstring.Trim(); return false;
if (this.cron_named.ContainsKey(cronstring)) { }
cronstring = this.cron_named[cronstring]; if (!this.CheckDateStr(this.crontime.ToString("mm"), value[0], "0-59")) {
} return false;
String[] value = cronstring.Split(' '); }
if (value.Length != 5) { if (!this.CheckDateStr(this.crontime.ToString("HH"), value[1], "0-23")) {
return false; return false;
} }
if (!this.CheckDateStr(this.crontime.ToString("mm"), value[0], "0-59")) { if (!this.CheckDateStr(this.crontime.ToString("MM"), value[3], "1-12")) {
return false; return false;
} }
if (!this.CheckDateStr(this.crontime.ToString("HH"), value[1], "0-23")) { if (value[2] != "*" && value[4] != "*") {
return false; if (!this.CheckDateStr(this.crontime.ToString("dd"), value[2], "1-31") && !this.CheckDateStr(((Int32)this.crontime.DayOfWeek).ToString(), value[4], "0-7")) {
} return false;
if (!this.CheckDateStr(this.crontime.ToString("MM"), value[3], "1-12")) { }
return false; } else {
} if (!this.CheckDateStr(this.crontime.ToString("dd"), value[2], "1-31")) {
if (value[2] != "*" && value[4] != "*") { return false;
if (!this.CheckDateStr(this.crontime.ToString("dd"), value[2], "1-31") && !this.CheckDateStr(((Int32)this.crontime.DayOfWeek).ToString(), value[4], "0-7")) { }
return false; if (!this.CheckDateStr(((Int32)this.crontime.DayOfWeek).ToString(), value[4], "0-7")) {
} return false;
} else { }
if (!this.CheckDateStr(this.crontime.ToString("dd"), value[2], "1-31")) { }
return false; return true;
} }
if (!this.CheckDateStr(((Int32)this.crontime.DayOfWeek).ToString(), value[4], "0-7")) { protected Boolean CheckDateStr(String date, String cron, String limit) {
return false; cron = cron.ToLower();
} for (Int32 i = 0; i <= 6; i++) {
} cron = cron.Replace(DateTime.Parse("2015-01-" + (4 + i) + "T00:00:00").ToString("ddd", CultureInfo.CreateSpecificCulture("en-US")), i.ToString());
return true; cron = cron.Replace(DateTime.Parse("2015-01-" + (4 + i) + "T00:00:00").ToString("dddd", CultureInfo.CreateSpecificCulture("en-US")), i.ToString());
} }
protected Boolean CheckDateStr(String date, String cron, String limit) { for (Int32 i = 1; i <= 12; i++) {
cron = cron.ToLower(); cron = cron.Replace(DateTime.Parse("2015-" + i + "-01T00:00:00").ToString("MMM", CultureInfo.CreateSpecificCulture("en-US")), i.ToString());
for (Int32 i = 0; i <= 6; i++) { cron = cron.Replace(DateTime.Parse("2015-" + i + "-01T00:00:00").ToString("MMMM", CultureInfo.CreateSpecificCulture("en-US")), i.ToString());
cron = cron.Replace(DateTime.Parse("2015-01-" + (4 + i) + "T00:00:00").ToString("ddd", CultureInfo.CreateSpecificCulture("en-US")), i.ToString()); }
cron = cron.Replace(DateTime.Parse("2015-01-" + (4 + i) + "T00:00:00").ToString("dddd", CultureInfo.CreateSpecificCulture("en-US")), i.ToString()); if (cron.Contains("*")) {
} cron = cron.Replace("*", limit);
for (Int32 i = 1; i <= 12; i++) { }
cron = cron.Replace(DateTime.Parse("2015-" + i + "-01T00:00:00").ToString("MMM", CultureInfo.CreateSpecificCulture("en-US")), i.ToString()); if (cron.Contains("-")) {
cron = cron.Replace(DateTime.Parse("2015-" + i + "-01T00:00:00").ToString("MMMM", CultureInfo.CreateSpecificCulture("en-US")), i.ToString()); MatchCollection m = new Regex("(\\d+)-(\\d+)").Matches(cron);
} foreach (Match p in m) {
if (cron.Contains("*")) { List<String> s = new List<String>();
cron = cron.Replace("*", limit); for (Int32 i = Math.Min(Int32.Parse(p.Groups[1].Value), Int32.Parse(p.Groups[2].Value)); i <= Math.Max(Int32.Parse(p.Groups[1].Value), Int32.Parse(p.Groups[2].Value)); i++) {
} s.Add(i.ToString());
if (cron.Contains("-")) { }
MatchCollection m = new Regex("(\\d+)-(\\d+)").Matches(cron); cron = cron.Replace(p.Groups[0].Value, String.Join(",", s));
foreach (Match p in m) { }
List<String> s = new List<String>(); }
for (Int32 i = Math.Min(Int32.Parse(p.Groups[1].Value), Int32.Parse(p.Groups[2].Value)); i <= Math.Max(Int32.Parse(p.Groups[1].Value), Int32.Parse(p.Groups[2].Value)); i++) { Int32 match = 0;
s.Add(i.ToString()); if (cron.Contains("/")) {
} Match m = new Regex("/(\\d+)").Match(cron);
cron = cron.Replace(p.Groups[0].Value, String.Join(",", s)); cron = cron.Replace(m.Groups[0].Value, "");
} match = Int32.Parse(m.Groups[1].Value);
} }
Int32 match = 0; Dictionary<Int32, String> ret = new Dictionary<Int32, String>();
if (cron.Contains("/")) { if (!cron.Contains(",")) {
Match m = new Regex("/(\\d+)").Match(cron); ret.Add(Int32.Parse(cron), "");
cron = cron.Replace(m.Groups[0].Value, ""); } else {
match = Int32.Parse(m.Groups[1].Value); foreach (String item in cron.Split(',')) {
} if (!ret.ContainsKey(Int32.Parse(item))) {
Dictionary<Int32, String> ret = new Dictionary<Int32, String>(); ret.Add(Int32.Parse(item), "");
if (!cron.Contains(",")) { }
ret.Add(Int32.Parse(cron), ""); }
} else { }
foreach (String item in cron.Split(',')) { if (match != 0) {
if (!ret.ContainsKey(Int32.Parse(item))) { Dictionary<Int32, String> r = new Dictionary<Int32, String>();
ret.Add(Int32.Parse(item), ""); foreach (KeyValuePair<Int32, String> item in ret) {
} if (item.Key % match == 0) {
} r.Add(item.Key, "");
} }
if (match != 0) { }
Dictionary<Int32, String> r = new Dictionary<Int32, String>(); ret = r;
foreach (KeyValuePair<Int32, String> item in ret) { }
if (item.Key % match == 0) { return ret.ContainsKey(Int32.Parse(date));
r.Add(item.Key, ""); }
} #endregion
}
ret = r; #region AModul
} public override void SetInterconnection(String cron, Action<Object> hook, Object data) {
return ret.ContainsKey(Int32.Parse(date)); this.internalCron.Add(new Tuple<String, Action<Object>, Object>(cron, hook, data));
} }
#endregion
protected override void UpdateConfig() { }
#region AModul #endregion
public override void SetInterconnection(String cron, Action<Object> hook, Object data) => this.internalCron.Add(new Tuple<String, Action<Object>, Object>(cron, hook, data));
#region IDisposable Support
protected override void UpdateConfig() { } private Boolean disposedValue = false;
public override void Dispose() { protected virtual void Dispose(Boolean disposing) {
this.threadRunning = false; if (!this.disposedValue) {
while(this.thread != null && this.thread.IsAlive) { if (disposing) {
Thread.Sleep(10); if (this.thread != null) {
} this.thread.Abort();
this.thread = null; while (this.thread.ThreadState == ThreadState.Running) { Thread.Sleep(100); }
} }
#endregion }
} this.thread = null;
} this.disposedValue = true;
}
}
public override void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
}
}

View File

@ -7,7 +7,7 @@ using BlubbFish.Utils.IoT.Events;
using LitJson; using LitJson;
namespace BlubbFish.Utils.IoT.Bots.Moduls { namespace BlubbFish.Utils.IoT.Bots.Moduls {
public abstract class Mqtt<T> : AModul<T> { public abstract class Mqtt<T> : AModul<T>, IDisposable {
protected ABackend mqtt; protected ABackend mqtt;
protected Dictionary<String, AModul<T>> modules; protected Dictionary<String, AModul<T>> modules;
@ -25,7 +25,13 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
} }
} }
protected void Connect() => this.mqtt = !this.config.ContainsKey("settings") ? throw new ArgumentException("Setting section [settings] is missing!") : ABackend.GetInstance(this.config["settings"], ABackend.BackendType.Data); protected void Connect() {
if(!this.config.ContainsKey("settings")) {
throw new ArgumentException("Setting section [settings] is missing!");
} else {
this.mqtt = ABackend.GetInstance(this.config["settings"], ABackend.BackendType.Data);
}
}
protected void Disconnect() => this.mqtt.Dispose(); protected void Disconnect() => this.mqtt.Dispose();
#endregion #endregion
@ -34,8 +40,6 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
public override void Interconnect(Dictionary<String, AModul<T>> moduls) => this.modules = moduls; public override void Interconnect(Dictionary<String, AModul<T>> moduls) => this.modules = moduls;
protected override void UpdateConfig() => this.Reconnect(); protected override void UpdateConfig() => this.Reconnect();
public override void Dispose() => this.Disconnect();
#endregion #endregion
protected Tuple<Boolean, MqttEvent> ChangeConfig(BackendEvent e, String topic) { protected Tuple<Boolean, MqttEvent> ChangeConfig(BackendEvent e, String topic) {
@ -76,5 +80,23 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
} }
return new Tuple<Boolean, MqttEvent>(false, null); return new Tuple<Boolean, MqttEvent>(false, null);
} }
#region IDisposable Support
private Boolean disposedValue = false;
protected void Dispose(Boolean disposing) {
if (!this.disposedValue) {
if (disposing) {
this.Disconnect();
}
this.disposedValue = true;
}
}
public override void Dispose() {
this.Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
} }
} }

View File

@ -2,11 +2,13 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace BlubbFish.Utils.IoT.Bots.Moduls { namespace BlubbFish.Utils.IoT.Bots.Moduls {
public abstract class Overtaker<T> : AModul<T> { public abstract class Overtaker<T> : AModul<T>, IDisposable {
protected readonly Dictionary<String, Dictionary<String, String>> events = new Dictionary<String, Dictionary<String, String>>(); protected readonly Dictionary<String, Dictionary<String, String>> events = new Dictionary<String, Dictionary<String, String>>();
#region Constructor #region Constructor
public Overtaker(T lib, InIReader settings) : base(lib, settings) => this.ParseIni(); public Overtaker(T lib, InIReader settings) : base(lib, settings) {
this.ParseIni();
}
#endregion #endregion
#region Overtakerfunctions #region Overtakerfunctions
@ -22,7 +24,7 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
} }
} }
protected void SetValues(Object sender, String _, Dictionary<String, String> dictionary) { protected void SetValues(Object sender, String name, Dictionary<String, String> dictionary) {
String from = dictionary["from"]; String from = dictionary["from"];
String[] source = from.Split(':'); String[] source = from.Split(':');
if (source.Length != 2) { if (source.Length != 2) {
@ -61,9 +63,26 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
#region AModul #region AModul
public override void Interconnect(Dictionary<String, AModul<T>> moduls) { } public override void Interconnect(Dictionary<String, AModul<T>> moduls) { }
protected override void UpdateConfig() => this.ParseIni(); protected override void UpdateConfig() {
public override void Dispose() { this.ParseIni();
} }
#endregion #endregion
#region IDisposable Support
private Boolean disposedValue = false;
protected virtual void Dispose(Boolean disposing) {
if (!this.disposedValue) {
if (disposing) {
}
this.disposedValue = true;
}
}
public override void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
} }
} }

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using BlubbFish.Utils.IoT.Bots.Interfaces; using BlubbFish.Utils.IoT.Bots.Interfaces;
namespace BlubbFish.Utils.IoT.Bots.Moduls { namespace BlubbFish.Utils.IoT.Bots.Moduls {
public abstract class Statuspolling<T> : AModul<T>, IForceLoad { public abstract class Statuspolling<T> : AModul<T>, IDisposable, IForceLoad {
#region Constructor #region Constructor
public Statuspolling(T lib, InIReader settings) : base(lib, settings) { } public Statuspolling(T lib, InIReader settings) : base(lib, settings) { }
@ -31,7 +31,22 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
} }
} }
protected override void UpdateConfig() { } protected override void UpdateConfig() { }
public override void Dispose() { #endregion
#region IDisposable Support
private Boolean disposedValue = false;
protected virtual void Dispose(Boolean disposing) {
if (!this.disposedValue) {
if (disposing) {
}
this.disposedValue = true;
}
}
public override void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
} }
#endregion #endregion
} }

View File

@ -1,6 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BlubbFish.Utils.IoT.Connector; using BlubbFish.Utils.IoT.Connector;
namespace BlubbFish.Utils.IoT.Bots { namespace BlubbFish.Utils.IoT.Bots {
@ -8,7 +10,7 @@ namespace BlubbFish.Utils.IoT.Bots {
protected Dictionary<String, ABackend> sources; protected Dictionary<String, ABackend> sources;
protected Dictionary<String, String> settings; protected Dictionary<String, String> settings;
protected MultiSourceBot(String[] args, Boolean fileLogging, String configSearchPath, Dictionary<String, ABackend> sources, Dictionary<String, String> settings) : base(args, fileLogging, configSearchPath) { protected MultiSourceBot(Dictionary<String, ABackend> sources, Dictionary<String, String> settings) {
this.sources = sources; this.sources = sources;
this.settings = settings; this.settings = settings;
} }

View File

@ -1,5 +1,4 @@
#if !NETCOREAPP using System.Reflection;
using System.Reflection;
using System.Resources; using System.Resources;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -11,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("BlubbFish")] [assembly: AssemblyCompany("BlubbFish")]
[assembly: AssemblyProduct("Bot-Utils")] [assembly: AssemblyProduct("Bot-Utils")]
[assembly: AssemblyCopyright("Copyright © BlubbFish 2018 - 30.08.2019")] [assembly: AssemblyCopyright("Copyright © 2018 - 30.08.2019")]
[assembly: AssemblyTrademark("© BlubbFish")] [assembly: AssemblyTrademark("© BlubbFish")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("de-DE")] [assembly: NeutralResourcesLanguage("de-DE")]
@ -36,7 +35,7 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.1")] [assembly: AssemblyVersion("1.2.1")]
[assembly: AssemblyFileVersion("1.2.1")] [assembly: AssemblyFileVersion("1.2.1")]
#endif
/* /*
* 1.1.0 Remove Helper from Bot-Utils * 1.1.0 Remove Helper from Bot-Utils
* 1.1.1 Update to local librarys * 1.1.1 Update to local librarys

View File

@ -5,16 +5,26 @@ using System.Net;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Web; using System.Web;
using BlubbFish.Utils.IoT.Connector;
using BlubbFish.Utils.IoT.Events;
using LitJson;
namespace BlubbFish.Utils.IoT.Bots { namespace BlubbFish.Utils.IoT.Bots {
public abstract class AWebserver : ABot { public abstract class Webserver : ABot
{
protected Dictionary<String, String> config; protected Dictionary<String, String> config;
protected static InIReader requests;
protected HttpListener httplistener; protected HttpListener httplistener;
protected ABackend databackend;
public AWebserver(String[] args, Boolean fileLogging, String configSearchPath, Dictionary<String, String> settings) : base(args, fileLogging, configSearchPath) => this.config = settings; public Webserver(ABackend backend, Dictionary<String, String> settings, InIReader requestslookup) {
this.config = settings;
requests = requestslookup;
this.databackend = backend;
}
protected void StartListen() { protected void StartListen() {
this.databackend.MessageIncomming += this.Backend_MessageIncomming;
this.httplistener = new HttpListener(); this.httplistener = new HttpListener();
this.httplistener.Prefixes.Add(this.config["prefix"]); this.httplistener.Prefixes.Add(this.config["prefix"]);
this.httplistener.Start(); this.httplistener.Start();
@ -22,10 +32,10 @@ namespace BlubbFish.Utils.IoT.Bots {
Console.WriteLine("Webserver is Running..."); Console.WriteLine("Webserver is Running...");
try { try {
while(this.httplistener.IsListening) { while(this.httplistener.IsListening) {
_ = ThreadPool.QueueUserWorkItem((state) => { ThreadPool.QueueUserWorkItem((state) => {
HttpListenerContext httplistenercontext = state as HttpListenerContext; HttpListenerContext httplistenercontext = state as HttpListenerContext;
try { try {
_ = this.SendWebserverResponse(httplistenercontext); this.SendWebserverResponse(httplistenercontext);
} catch { } finally { } catch { } finally {
httplistenercontext.Response.OutputStream.Close(); httplistenercontext.Response.OutputStream.Close();
} }
@ -35,67 +45,21 @@ namespace BlubbFish.Utils.IoT.Bots {
}); });
} }
public override void Dispose() { public static Boolean SendFileResponse(HttpListenerContext cont, String folder = "resources", Boolean printOutput = true) {
if(this.httplistener.IsListening) {
this.httplistener.Stop();
}
this.httplistener.Close();
base.Dispose();
}
protected abstract Boolean SendWebserverResponse(HttpListenerContext cont);
}
#region HttpListener* Extensions
public static class HttpListenerHelper {
private static InIReader requests;
public static Dictionary<String, String> GetPostParams(this HttpListenerRequest request) {
if(request.HttpMethod == "POST") {
if(request.HasEntityBody) {
StreamReader reader = new StreamReader(request.InputStream, request.ContentEncoding);
String rawData = reader.ReadToEnd();
request.InputStream.Close();
reader.Close();
Dictionary<String, String> ret = new Dictionary<String, String>();
foreach(String param in rawData.Split('&')) {
String[] kvPair = param.Split('=');
if(!ret.ContainsKey(kvPair[0])) {
ret.Add(kvPair[0], HttpUtility.UrlDecode(kvPair[1]));
}
}
return ret;
}
}
return new Dictionary<String, String>();
}
public static Boolean SendStringResponse(this HttpListenerContext cont, String obj) => cont.SendBinaryResponse(Encoding.UTF8.GetBytes(obj));
public static Boolean SendBinaryResponse(this HttpListenerContext cont, Byte[] buf) {
try {
cont.Response.ContentLength64 = buf.Length;
cont.Response.OutputStream.Write(buf, 0, buf.Length);
Console.WriteLine("200 - " + cont.Request.Url.PathAndQuery);
return true;
} catch(Exception e) {
Helper.WriteError("500 - " + e.Message + "\n\n" + e.StackTrace);
cont.Response.StatusCode = 500;
}
return false;
}
public static Boolean SendFileResponse(this HttpListenerContext cont, String folder = "resources", Boolean printOutput = true) {
String restr = cont.Request.Url.PathAndQuery; String restr = cont.Request.Url.PathAndQuery;
if(restr.StartsWith("/")) { if(restr.StartsWith("/")) {
restr = restr.IndexOf("?") != -1 ? restr[1..restr.IndexOf("?")] : restr[1..]; if(restr.IndexOf("?") != -1) {
restr = restr.Substring(1, restr.IndexOf("?") - 1);
} else {
restr = restr.Substring(1);
}
if(Directory.Exists(folder + "/" + restr)) { if(Directory.Exists(folder + "/" + restr)) {
restr += "/index.html"; restr += "/index.html";
} }
String end = restr.IndexOf('.') != -1 ? restr[(restr.IndexOf('.') + 1)..] : ""; String end = restr.IndexOf('.') != -1 ? restr.Substring(restr.IndexOf('.') + 1) : "";
if(File.Exists(folder + "/" + restr)) { if(File.Exists(folder + "/" + restr)) {
try { try {
if(end == "png" || end == "jpg" || end == "jpeg" || end == "ico" || end == "woff" || end == "mp4") { if(end == "png" || end == "jpg" || end == "jpeg" || end == "ico" || end == "woff") {
Byte[] output = File.ReadAllBytes(folder + "/" + restr); Byte[] output = File.ReadAllBytes(folder + "/" + restr);
switch(end) { switch(end) {
case "ico": case "ico":
@ -104,9 +68,6 @@ namespace BlubbFish.Utils.IoT.Bots {
case "woff": case "woff":
cont.Response.ContentType = "font/woff"; cont.Response.ContentType = "font/woff";
break; break;
case "mp4":
cont.Response.ContentType = "video/mpeg";
break;
} }
cont.Response.OutputStream.Write(output, 0, output.Length); cont.Response.OutputStream.Write(output, 0, output.Length);
if(printOutput) { if(printOutput) {
@ -115,13 +76,13 @@ namespace BlubbFish.Utils.IoT.Bots {
return true; return true;
} else { } else {
String file = File.ReadAllText(folder + "/" + restr); String file = File.ReadAllText(folder + "/" + restr);
if(requests != null && requests.GetSections(false).Contains(restr)) { if(requests.GetSections(false).Contains(restr)) {
Dictionary<String, String> vars = requests.GetSection(restr); Dictionary<String, String> vars = requests.GetSection(restr);
foreach(KeyValuePair<String, String> item in vars) { foreach(KeyValuePair<String, String> item in vars) {
file = file.Replace("\"{%" + item.Key.ToUpper() + "%}\"", item.Value); file = file.Replace("\"{%" + item.Key.ToUpper() + "%}\"", item.Value);
} }
} }
file = file.Replace("{%REQUEST_URL_HOST%}", cont.Request.Url.Host + ":" + cont.Request.Url.Port); file = file.Replace("{%REQUEST_URL_HOST%}", cont.Request.Url.Host+":"+cont.Request.Url.Port);
Byte[] buf = Encoding.UTF8.GetBytes(file); Byte[] buf = Encoding.UTF8.GetBytes(file);
cont.Response.ContentLength64 = buf.Length; cont.Response.ContentLength64 = buf.Length;
switch(end) { switch(end) {
@ -149,7 +110,50 @@ namespace BlubbFish.Utils.IoT.Bots {
return false; return false;
} }
public static void SetRequestsOverride(InIReader requestslookup) => requests = requestslookup; public static Boolean SendJsonResponse(Object data, HttpListenerContext cont) {
try {
Byte[] buf = Encoding.UTF8.GetBytes(JsonMapper.ToJson(data));
cont.Response.ContentLength64 = buf.Length;
cont.Response.OutputStream.Write(buf, 0, buf.Length);
Console.WriteLine("200 - " + cont.Request.Url.PathAndQuery);
return true;
} catch(Exception e) {
Helper.WriteError("500 - " + e.Message + "\n\n" + e.StackTrace);
cont.Response.StatusCode = 500;
}
return false;
}
public static Dictionary<String, String> GetPostParams(HttpListenerRequest req) {
if(req.HttpMethod == "POST") {
if(req.HasEntityBody) {
StreamReader reader = new StreamReader(req.InputStream, req.ContentEncoding);
String rawData = reader.ReadToEnd();
req.InputStream.Close();
reader.Close();
Dictionary<String, String> ret = new Dictionary<String, String>();
foreach(String param in rawData.Split('&')) {
String[] kvPair = param.Split('=');
if(!ret.ContainsKey(kvPair[0])) {
ret.Add(kvPair[0], HttpUtility.UrlDecode(kvPair[1]));
}
}
return ret;
}
}
return new Dictionary<String, String>();
}
public override void Dispose() {
this.httplistener.Stop();
this.httplistener.Close();
if(this.databackend != null) {
this.databackend.Dispose();
}
base.Dispose();
}
protected abstract void Backend_MessageIncomming(Object sender, BackendEvent e);
protected abstract Boolean SendWebserverResponse(HttpListenerContext cont);
} }
#endregion
} }

View File

@ -1,124 +0,0 @@
# Changelog
## 1.2.6 - 2022-01-25 - Makeing Logging easyier
### New Features
* Construct the Programm logger only if enabled
* Set Searchpath by default for a Bot
* Add an option that allows to debug logging (by default on)
### Bugfixes
### Changes
* Deconstruct Programmlogger
* Change all classes that extend ABot
* Module messages also uses debug logging flag
* Codingstyles
## 1.2.5 - 2022-01-20 - Better linux handling
### New Features
* Add ProcessExit Handler in ABot
* Add Output in ModulDispose
### Bugfixes
* Eleminate Hangs in Cronjob, when in startup phase it not blocks shutdown
### Changes
* Reweite ABot, remove Mono Code
* Codingstyle
## 1.2.4 - 2022-01-18 - Config enabled module loading
### New Features
* Modules can have an enabled=true|false in config, so that also enables or disables moduleloading.
### Bugfixes
### Changes
## 1.2.3 - 2022-01-09 - Tiny Refactoring
### New Features
### Bugfixes
### Changes
* Cleanup Changelog
* Tiny Refactorings
## 1.2.2 - 2021-08-22 - Going to netcore
### New Features
* Split Wbserver to AWebserver and AWebserverDataBackend
* Add mp4 as binary content
* make a mirror of this repo on github
### Bugfixes
### Changes
* change to c+ newer coding style
* mograde to c# netcore 3.1
## 1.2.1 - 2019-08-30 - When using Dispose, kill also mqtt connection and other tiny fixes
### New Features
* Add LICENSE, CONTRIBUTING.md and README.md
### Bugfixes
* When using Dispose, kill also mqtt connection
### Changes
* A bit more debugging
## 1.2.0 - 2019-05-27 - Refactor Bot to ABot and refere MultiSourceBot
### New Features
* Add MultiSourceBot*
* Refere MultiSourceBot, Webserver and Bot to it.
### Bugfixes
### Changes
* Refactor Bot to ABot
* Rewrite Mqtt module so that it not need to watch the connection.
## 1.1.9 - 2019-04-21 - Modify Output of SendFileResponse
### New Features
* Modify Output of SendFileResponse
### Bugfixes
### Changes
## 1.1.8 - 2019-04-15 - Add logger to Webserver Class
### New Features
* Add logger to Webserver Class
### Bugfixes
### Changes
## 1.1.7 - 2019-04-14 - REQUEST_URL_HOST
### New Features
### Bugfixes
### Changes
* Restrucutre loading, so that all is init and after the listener is started, REQUEST_URL_HOST gives now host and port
## 1.1.6 - 2019-04-03 - Refactoring and bugfixing
### New Features
* SendFileResponse with a parameter for the folder
* add function that parse post params
### Bugfixes
### Changes
## 1.1.5 - 2019-03-27 - add a function to send an object as json directly
### New Features
* add a function to send an object as json directly
### Bugfixes
### Changes
## 1.1.4 - 2019-03-13 - add Woff as Binary type
### New Features
* add Woff as Binary type
### Bugfixes
### Changes
## 1.1.3 - 2019-03-10 - Variables parsing now as a String
### New Features
### Bugfixes
### Changes
* Variables parsing now as a String
## 1.1.2 - 2019-03-08 - Fixing bug for Contenttype
### New Features
### Bugfixes
* Fixing bug for Contenttype
### Changes
## 1.1.1 - 2019-02-17 - Update to local librarys
### New Features
### Bugfixes
### Changes
* Update to local librarys
## 1.1.0 - 2019-02-14 - Remove Helper from Bot-Utils
### New Features
* Remove Helper from Bot-Utils
### Bugfixes
### Changes

View File

@ -1,12 +1,11 @@
# BlubbFish.Utils.IoT.Bots (Bot-Utils) # BlubbFish.Utils.IoT.Bots (Bot-Utils)
Library that makes it easier to create bots. Library that makes it easier to create bots.
Maybe you find this Repo on Github. This is a mirror from [here](https://git.blubbfish.net/vs_utils/Bot-Utils).
## Linking to ## Linking to
### Internal ### Internal
* BlubbFish.Utils ([Utils](http://git.blubbfish.net/vs_utils/Utils)) * BlubbFish.Utils ([Utils](http://git.blubbfish.net/vs_utils/Utils))
* BlubbFish.Utils.IoT ([Utils-IoT](http://git.blubbfish.net/vs_utils/Utils-IoT)) * BlubbFish.Utils.IoT ([Utils-IoT](http://git.blubbfish.net/vs_utils/Utils-IoT))
### External ### External
* litjson ([Used Fork](https://github.com/blubbfish/litjson), [Original](https://github.com/LitJSON/litjson)) * litjson
* Mono.Posix