2 Commits
Author SHA1 Message Date
BlubbFish 628db8db10 [1.2.4] Config enabled module loading 2022-01-18 22:00:43 +01:00
BlubbFish 55425d2afa [1.2.3] Tiny Refactoring 2022-01-09 11:21:35 +01:00
5 changed files with 83 additions and 45 deletions
+19 -17
View File
@@ -5,31 +5,33 @@
<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> <PackageId>Bots.IoT.Utils.BlubbFish</PackageId>
<Version>1.2.2</Version> <Version>1.2.4</Version>
<AssemblyVersion>1.2.2</AssemblyVersion>
<FileVersion>1.2.2</FileVersion>
<NeutralLanguage>de-DE</NeutralLanguage> <NeutralLanguage>de-DE</NeutralLanguage>
<Description>Bot-Utils are helpers for programming a bot</Description> <Description>Bot-Utils are helpers for programming a bot</Description>
<Authors>BlubbFish</Authors> <Authors>BlubbFish</Authors>
<Company>BlubbFish</Company> <Company>BlubbFish</Company>
<Copyright>Copyright © BlubbFish 2018 - 22.08.2021</Copyright> <Copyright>Copyright © BlubbFish 2018 - 18.01.2022</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile> <PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>http://git.blubbfish.net/vs_utils/Bot-Utils</PackageProjectUrl> <PackageProjectUrl>http://git.blubbfish.net/vs_utils/Bot-Utils</PackageProjectUrl>
<RepositoryUrl>http://git.blubbfish.net/vs_utils/Bot-Utils.git</RepositoryUrl> <RepositoryUrl>http://git.blubbfish.net/vs_utils/Bot-Utils.git</RepositoryUrl>
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<PackageReleaseNotes>1.2.2 Going to netcore <PackageReleaseNotes>
1.2.1 When using Dispose, kill also mqtt connection and other tiny fixes 1.2.4 - 2022-01-18 - Config enabled module loading
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.3 - 2022-01-09 - Tiny Refactoring
1.1.9 Modify Output of SendFileResponse 1.2.2 - 2021-08-22 - Going to netcore
1.1.8 Add logger to Webserver Class 1.2.1 - 2019-08-30 - When using Dispose, kill also mqtt connection and other tiny fixes
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.2.0 - 2019-05-27 - Refactor Bot to ABot and refere MultiSourceBot
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.9 - 2019-04-21 - Modify Output of SendFileResponse
1.1.5 add a function to send an object as json directly 1.1.8 - 2019-04-15 - Add logger to Webserver Class
1.1.4 add Woff as Binary type 1.1.7 - 2019-04-14 - REQUEST_URL_HOST
1.1.3 Variables parsing now as a String 1.1.6 - 2019-04-03 - Refactoring and bugfixing
1.1.2 Fixing bug for Contenttype 1.1.5 - 2019-03-27 - add a function to send an object as json directly
1.1.1 Update to local librarys 1.1.4 - 2019-03-13 - add Woff as Binary type
1.1.0 Remove Helper from Bot-Utils</PackageReleaseNotes> 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>
+8 -3
View File
@@ -25,13 +25,18 @@ namespace BlubbFish.Utils.IoT.Bots {
String name = t.Name; String name = t.Name;
try { try {
if (InIReader.ConfigExist(name.ToLower())) { if (InIReader.ConfigExist(name.ToLower())) {
Dictionary<String, String> modulconfig = InIReader.GetInstance(name.ToLower()).GetSection("modul");
if(!(modulconfig.ContainsKey("enabled") && modulconfig["enabled"].ToLower() == "false")) {
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulLoader: Load Modul " + 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, InIReader.GetInstance(name.ToLower()) })); 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 " + name); Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulLoader: Loaded Modul " + name);
} else if (t.HasInterface(typeof(IForceLoad))) { continue;
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulLoader: Load Modul Forced " + name); }
}
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 })); 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: Loaded Modul Forced " + name); Console.WriteLine("BlubbFish.Utils.IoT.Bots.Bot.ModulLoader: Forced Loaded Modul " + name);
} }
} catch(Exception e) { } catch(Exception e) {
Helper.WriteError(e.InnerException.Message); Helper.WriteError(e.InnerException.Message);
+1 -7
View File
@@ -25,13 +25,7 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
} }
} }
protected void Connect() { 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);
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
+1 -1
View File
@@ -22,7 +22,7 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
} }
} }
protected void SetValues(Object sender, String name, Dictionary<String, String> dictionary) { protected void SetValues(Object sender, String _, 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) {
+50 -13
View File
@@ -1,13 +1,29 @@
## 1.2.2 - Going to netcore # Changelog
## 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 ### New Features
* Split Wbserver to AWebserver and AWebserverDataBackend * Split Wbserver to AWebserver and AWebserverDataBackend
* Add mp4 as binary content * Add mp4 as binary content
* make a mirror of this repo on github * make a mirror of this repo on github
### Bugfixes
### Changes ### Changes
* change to c+ newer coding style * change to c+ newer coding style
* mograde to c# netcore 3.1 * mograde to c# netcore 3.1
## 1.2.1 ## 1.2.1 - 2019-08-30 - When using Dispose, kill also mqtt connection and other tiny fixes
### New Features ### New Features
* Add LICENSE, CONTRIBUTING.md and README.md * Add LICENSE, CONTRIBUTING.md and README.md
### Bugfixes ### Bugfixes
@@ -15,51 +31,72 @@
### Changes ### Changes
* A bit more debugging * A bit more debugging
## 1.2.0 ## 1.2.0 - 2019-05-27 - Refactor Bot to ABot and refere MultiSourceBot
### New Features ### New Features
* Add MultiSourceBot* * Add MultiSourceBot*
* Refere MultiSourceBot, Webserver and Bot to it. * Refere MultiSourceBot, Webserver and Bot to it.
### Bugfixes
### Changes ### Changes
* Refactor Bot to ABot * Refactor Bot to ABot
* Rewrite Mqtt module so that it not need to watch the connection. * Rewrite Mqtt module so that it not need to watch the connection.
## 1.1.9 ## 1.1.9 - 2019-04-21 - Modify Output of SendFileResponse
### New Features ### New Features
* Modify Output of SendFileResponse * Modify Output of SendFileResponse
### Bugfixes
### Changes
## 1.1.8 ## 1.1.8 - 2019-04-15 - Add logger to Webserver Class
### New Features ### New Features
* Add logger to Webserver Class * Add logger to Webserver Class
### Bugfixes
### Changes
## 1.1.7 ## 1.1.7 - 2019-04-14 - REQUEST_URL_HOST
### New Features
### Bugfixes
### Changes ### Changes
* Restrucutre loading, so that all is init and after the listener is started, REQUEST_URL_HOST gives now host and port * Restrucutre loading, so that all is init and after the listener is started, REQUEST_URL_HOST gives now host and port
## 1.1.6 ## 1.1.6 - 2019-04-03 - Refactoring and bugfixing
### New Features ### New Features
* SendFileResponse with a parameter for the folder * SendFileResponse with a parameter for the folder
* add function that parse post params * add function that parse post params
### Bugfixes
### Changes
## 1.1.5 ## 1.1.5 - 2019-03-27 - add a function to send an object as json directly
### New Features ### New Features
* add a function to send an object as json directly * add a function to send an object as json directly
### Bugfixes
### Changes
## 1.1.4 ## 1.1.4 - 2019-03-13 - add Woff as Binary type
### New Features ### New Features
* add Woff as Binary type * add Woff as Binary type
### Bugfixes
### Changes
## 1.1.3 ## 1.1.3 - 2019-03-10 - Variables parsing now as a String
### New Features
### Bugfixes
### Changes ### Changes
* Variables parsing now as a String * Variables parsing now as a String
## 1.1.2 ## 1.1.2 - 2019-03-08 - Fixing bug for Contenttype
### New Features
### Bugfixes ### Bugfixes
* Fixing bug for Contenttype * Fixing bug for Contenttype
### Changes
## 1.1.1 ## 1.1.1 - 2019-02-17 - Update to local librarys
### New Features
### Bugfixes
### Changes ### Changes
* Update to local librarys * Update to local librarys
## 1.1.0 ## 1.1.0 - 2019-02-14 - Remove Helper from Bot-Utils
### New Features ### New Features
* Remove Helper from Bot-Utils * Remove Helper from Bot-Utils
### Bugfixes
### Changes