Zway-Bot [v1.7.2] Add Logging to some Modules, fixing a bug in overtaker (now it not removes every time all events, so only the latest event are watched)

[Utils] Fixing a bug if more than one argument with params
This commit is contained in:
BlubbFish 2018-10-02 14:53:59 +00:00
parent 6366b35b33
commit e6437ba0c5
10 changed files with 16 additions and 13 deletions

View File

@ -37,6 +37,7 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
} }
protected void Reconnect() { protected void Reconnect() {
Console.WriteLine("BlubbFish.Utils.IoT.Bots.Moduls.Mqtt.Reconnect()");
this.Disconnect(); this.Disconnect();
this.Connect(); this.Connect();
} }

View File

@ -13,12 +13,13 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
#region Overtakerfunctions #region Overtakerfunctions
protected void ParseIni() { protected void ParseIni() {
this.RemoveLibraryUpdateHooks();
foreach (KeyValuePair<String, Dictionary<String, String>> item in this.config) { foreach (KeyValuePair<String, Dictionary<String, String>> item in this.config) {
if (item.Value.ContainsKey("from")) { if (item.Value.ContainsKey("from")) {
String from = item.Value["from"]; String from = item.Value["from"];
String[] source = from.Split(':'); String[] source = from.Split(':');
this.events.Add(source[0], item.Value); this.events.Add(source[0], item.Value);
this.LibraryUpdateHook(source[0]); this.AddLibraryUpdateHook(source[0]);
} }
} }
} }
@ -53,7 +54,9 @@ namespace BlubbFish.Utils.IoT.Bots.Moduls {
} }
} }
protected abstract void LibraryUpdateHook(String id); protected abstract void AddLibraryUpdateHook(String id);
protected abstract void RemoveLibraryUpdateHooks();
protected abstract void SetValueHook(String id, String prop, String value); protected abstract void SetValueHook(String id, String prop, String value);
#endregion #endregion

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Bot-Utils")] [assembly: AssemblyProduct("Bot-Utils")]
[assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyCopyright("Copyright © 2018 - 02.10.2018")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben: // indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.0")] [assembly: AssemblyVersion("1.0.2")]
[assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyFileVersion("1.0.2")]

Binary file not shown.

Binary file not shown.

View File

@ -38,7 +38,7 @@ namespace BlubbFish.Utils
public ArgTouple(String type) public ArgTouple(String type)
{ {
this.Type = type; this.Type = type;
this.Data = ""; this.Data = null;
} }
public String Type { get; private set; } public String Type { get; private set; }
public String Data { get; private set; } public String Data { get; private set; }
@ -100,7 +100,8 @@ namespace BlubbFish.Utils
if (this.args.Length > i + 1) { if (this.args.Length > i + 1) {
arg.SetData(this.args[++i]); arg.SetData(this.args[++i]);
} else { } else {
throw new ArgumentException(); Console.WriteLine(this.GetUsageList(""));
throw new ArgumentException("Argument: "+this.args[i]+" missing second argument.");
} }
} }
this.argList.Add(arg); this.argList.Add(arg);
@ -142,11 +143,9 @@ namespace BlubbFish.Utils
foreach (ArgTouple t in this.argList) { foreach (ArgTouple t in this.argList) {
if (t.Type == name && t.Data != null) { if (t.Type == name && t.Data != null) {
return t.Data; return t.Data;
} else {
throw new ArgumentNullException();
} }
} }
return null; throw new ArgumentNullException();
} }
public Boolean HasAllRequiredArguments() public Boolean HasAllRequiredArguments()

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Utils")] [assembly: AssemblyProduct("Utils")]
[assembly: AssemblyCopyright("Copyright © 2014 - 15.05.2018")] [assembly: AssemblyCopyright("Copyright © 2014 - 02.10.2018")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.2")] [assembly: AssemblyVersion("1.1.3")]
[assembly: AssemblyFileVersion("1.1.2")] [assembly: AssemblyFileVersion("1.1.3")]

Binary file not shown.