Add netcore and refactoring
This commit is contained in:
parent
8fecb22620
commit
a13e03a808
@ -64,6 +64,11 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Webserver.cs" />
|
<Compile Include="Webserver.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="..\CONTRIBUTING.md" />
|
||||||
|
<Content Include="..\LICENSE" />
|
||||||
|
<Content Include="..\README.md" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\Librarys\litjson\litjson\litjson_4.7.1.csproj">
|
<ProjectReference Include="..\..\..\Librarys\litjson\litjson\litjson_4.7.1.csproj">
|
||||||
<Project>{91a14cd2-2940-4500-8193-56d37edddbaa}</Project>
|
<Project>{91a14cd2-2940-4500-8193-56d37edddbaa}</Project>
|
||||||
|
52
Bot-Utils/Bot-Utils_Core.csproj
Normal file
52
Bot-Utils/Bot-Utils_Core.csproj
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
<RootNamespace>BlubbFish.Utils.IoT.Bots</RootNamespace>
|
||||||
|
<AssemblyName>Bot-Utils</AssemblyName>
|
||||||
|
<PackageId>Bots.IoT.Utils.BlubbFish</PackageId>
|
||||||
|
<Version>1.2.1</Version>
|
||||||
|
<AssemblyVersion>1.2.1</AssemblyVersion>
|
||||||
|
<FileVersion>1.2.1</FileVersion>
|
||||||
|
<NeutralLanguage>de-DE</NeutralLanguage>
|
||||||
|
<Description>Bot-Utils are helpers for programming a bot</Description>
|
||||||
|
<Authors>BlubbFish</Authors>
|
||||||
|
<Company>BlubbFish</Company>
|
||||||
|
<Copyright>Copyright © BlubbFish 2018 - 30.08.2019</Copyright>
|
||||||
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
|
<PackageProjectUrl>http://git.blubbfish.net/vs_utils/Bot-Utils</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>http://git.blubbfish.net/vs_utils/Bot-Utils.git</RepositoryUrl>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<PackageReleaseNotes>1.2.1 When using Dispose, kill also mqtt connection and other tiny fixes
|
||||||
|
1.2.0 Refactor Bot to ABot and refere MultiSourceBot, Webserver and Bot to it. Add MultiSourceBot. Rewrite Mqtt module so that it not need to watch the connection.
|
||||||
|
1.1.9 Modify Output of SendFileResponse
|
||||||
|
1.1.8 Add logger to Webserver Class
|
||||||
|
1.1.7 Restrucutre loading, so that all is init and after the listener is started, REQUEST_URL_HOST gives now host and port
|
||||||
|
1.1.6 rename functions and make SendFileResponse with a parameter for the folder (default resources), also put returntype boolean, add function that parse post params, if path is a dictionary try to load index.html
|
||||||
|
1.1.5 add a function to send an object as json directly
|
||||||
|
1.1.4 add Woff as Binary type
|
||||||
|
1.1.3 Variables parsing now as a String
|
||||||
|
1.1.2 Fixing bug for Contenttype
|
||||||
|
1.1.1 Update to local librarys
|
||||||
|
1.1.0 Remove Helper from Bot-Utils</PackageReleaseNotes>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\Librarys\litjson\litjson\litjson_Core.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Utils-IoT\Utils-IoT\Utils-IoT_Core.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Utils\Utils\Utils_Core.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="../CONTRIBUTING.md" />
|
||||||
|
<Content Include="../LICENSE" />
|
||||||
|
<Content Include="../README.md" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\LICENSE">
|
||||||
|
<Pack>True</Pack>
|
||||||
|
<PackagePath></PackagePath>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -14,8 +14,6 @@ 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() {
|
public override String ToString() => this.Source + ": " + this.Address + " set " + this.Property + " to " + this.Value;
|
||||||
return this.Source + ": " + this.Address + " set " + this.Property + " to " + this.Value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@ namespace BlubbFish.Utils.IoT.Bots.Events {
|
|||||||
this.Value = text;
|
this.Value = text;
|
||||||
this.Source = "MQTT";
|
this.Source = "MQTT";
|
||||||
}
|
}
|
||||||
public override String ToString() {
|
public override String ToString() => this.Source + ": on " + this.Address + " set " + this.Value;
|
||||||
return this.Source + ": on " + this.Address + " set " + this.Value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@ namespace BlubbFish.Utils.IoT.Bots.Events {
|
|||||||
this.Value = text;
|
this.Value = text;
|
||||||
this.Source = "Senml";
|
this.Source = "Senml";
|
||||||
}
|
}
|
||||||
public override String ToString() {
|
public override String ToString() => this.Source + ": on " + this.Address + " set " + this.Value;
|
||||||
return this.Source + ": on " + this.Address + " set " + this.Value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,6 @@ namespace BlubbFish.Utils.IoT.Bots.Events {
|
|||||||
this.Source = "POLLING";
|
this.Source = "POLLING";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override String ToString() {
|
public override String ToString() => this.Source + ": " + this.Value + " on " + this.Address;
|
||||||
return this.Source + ": " + this.Value + " on " + this.Address;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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"]);
|
||||||
|
@ -30,7 +30,7 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
|
|||||||
|
|
||||||
#region Cronjobrunner
|
#region Cronjobrunner
|
||||||
protected void Runner() {
|
protected void Runner() {
|
||||||
Thread.Sleep(DateTime.Now.AddMinutes(1).AddSeconds(DateTime.Now.Second * (-1)).AddMilliseconds(DateTime.Now.Millisecond * (-1)) - DateTime.Now);
|
Thread.Sleep(DateTime.Now.AddMinutes(1).AddSeconds(DateTime.Now.Second * -1).AddMilliseconds(DateTime.Now.Millisecond * -1) - DateTime.Now);
|
||||||
while (true) {
|
while (true) {
|
||||||
if (this.crontime.Minute != DateTime.Now.Minute) {
|
if (this.crontime.Minute != DateTime.Now.Minute) {
|
||||||
this.crontime = DateTime.Now;
|
this.crontime = DateTime.Now;
|
||||||
@ -140,9 +140,7 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region AModul
|
#region AModul
|
||||||
public override void SetInterconnection(String cron, Action<Object> hook, Object data) {
|
public override void SetInterconnection(String cron, Action<Object> hook, Object data) => this.internalCron.Add(new Tuple<String, Action<Object>, Object>(cron, hook, data));
|
||||||
this.internalCron.Add(new Tuple<String, Action<Object>, Object>(cron, hook, data));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void UpdateConfig() { }
|
protected override void UpdateConfig() { }
|
||||||
#endregion
|
#endregion
|
||||||
@ -164,7 +162,7 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose() {
|
public override void Dispose() {
|
||||||
Dispose(true);
|
this.Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -6,9 +6,7 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
|
|||||||
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) {
|
public Overtaker(T lib, InIReader settings) : base(lib, settings) => this.ParseIni();
|
||||||
this.ParseIni();
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Overtakerfunctions
|
#region Overtakerfunctions
|
||||||
@ -63,9 +61,7 @@ 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() {
|
protected override void UpdateConfig() => this.ParseIni();
|
||||||
this.ParseIni();
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IDisposable Support
|
#region IDisposable Support
|
||||||
@ -80,7 +76,7 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose() {
|
public override void Dispose() {
|
||||||
Dispose(true);
|
this.Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -45,7 +45,7 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose() {
|
public override void Dispose() {
|
||||||
Dispose(true);
|
this.Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using System.Reflection;
|
#if NETCOREAPP
|
||||||
|
#else
|
||||||
|
using System.Reflection;
|
||||||
using System.Resources;
|
using System.Resources;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
@ -10,7 +12,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 © 2018 - 30.08.2019")]
|
[assembly: AssemblyCopyright("Copyright © BlubbFish 2018 - 30.08.2019")]
|
||||||
[assembly: AssemblyTrademark("© BlubbFish")]
|
[assembly: AssemblyTrademark("© BlubbFish")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("de-DE")]
|
[assembly: NeutralResourcesLanguage("de-DE")]
|
||||||
@ -51,3 +53,4 @@ using System.Runtime.InteropServices;
|
|||||||
* 1.2.0 Refactor Bot to ABot and refere MultiSourceBot, Webserver and Bot to it. Add MultiSourceBot. Rewrite Mqtt module so that it not need to watch the connection.
|
* 1.2.0 Refactor Bot to ABot and refere MultiSourceBot, Webserver and Bot to it. Add MultiSourceBot. Rewrite Mqtt module so that it not need to watch the connection.
|
||||||
* 1.2.1 When using Dispose, kill also mqtt connection and other tiny fixes
|
* 1.2.1 When using Dispose, kill also mqtt connection and other tiny fixes
|
||||||
*/
|
*/
|
||||||
|
#endif
|
@ -48,7 +48,7 @@ namespace BlubbFish.Utils.IoT.Bots {
|
|||||||
public static Boolean SendFileResponse(HttpListenerContext cont, String folder = "resources", Boolean printOutput = true) {
|
public static Boolean SendFileResponse(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.Substring(1, restr.IndexOf("?") - 1) : restr.Substring(1);
|
restr = restr.IndexOf("?") != -1 ? restr[1..restr.IndexOf("?")] : restr.Substring(1);
|
||||||
if(Directory.Exists(folder + "/" + restr)) {
|
if(Directory.Exists(folder + "/" + restr)) {
|
||||||
restr += "/index.html";
|
restr += "/index.html";
|
||||||
}
|
}
|
||||||
|
43
Bot-Utils_Core.sln
Normal file
43
Bot-Utils_Core.sln
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.29519.87
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot-Utils_Core", "Bot-Utils\Bot-Utils_Core.csproj", "{CB48457C-C567-42BC-9E5B-DAE5A3383108}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils-IoT_Core", "..\Utils-IoT\Utils-IoT\Utils-IoT_Core.csproj", "{86E9D6ED-EE31-4FE7-AEA6-555DBBAA69A4}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils_Core", "..\Utils\Utils\Utils_Core.csproj", "{110EB1ED-1567-4A7E-B8B5-E46F421E0684}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "litjson_Core", "..\..\Librarys\litjson\litjson\litjson_Core.csproj", "{A6EB1FF2-A3F1-4C97-8E7F-0F2CE4A8A820}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{CB48457C-C567-42BC-9E5B-DAE5A3383108}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{CB48457C-C567-42BC-9E5B-DAE5A3383108}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{CB48457C-C567-42BC-9E5B-DAE5A3383108}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{CB48457C-C567-42BC-9E5B-DAE5A3383108}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{86E9D6ED-EE31-4FE7-AEA6-555DBBAA69A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{86E9D6ED-EE31-4FE7-AEA6-555DBBAA69A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{86E9D6ED-EE31-4FE7-AEA6-555DBBAA69A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{86E9D6ED-EE31-4FE7-AEA6-555DBBAA69A4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{110EB1ED-1567-4A7E-B8B5-E46F421E0684}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{110EB1ED-1567-4A7E-B8B5-E46F421E0684}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{110EB1ED-1567-4A7E-B8B5-E46F421E0684}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{110EB1ED-1567-4A7E-B8B5-E46F421E0684}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A6EB1FF2-A3F1-4C97-8E7F-0F2CE4A8A820}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A6EB1FF2-A3F1-4C97-8E7F-0F2CE4A8A820}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A6EB1FF2-A3F1-4C97-8E7F-0F2CE4A8A820}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A6EB1FF2-A3F1-4C97-8E7F-0F2CE4A8A820}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {0F0DF907-D03F-41A9-B0A2-CA229CC259EE}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
Loading…
Reference in New Issue
Block a user