diff --git a/Utils-IoT/Connector/ABackend.cs b/Utils-IoT/Connector/ABackend.cs index 8d51596..d0f899c 100644 --- a/Utils-IoT/Connector/ABackend.cs +++ b/Utils-IoT/Connector/ABackend.cs @@ -22,18 +22,20 @@ namespace BlubbFish.Utils.IoT.Connector { if (settings.Count == 0) { return null; } - String object_sensor = "BlubbFish.Utils.IoT.Connector." + ty.ToString() + "." + settings["type"].ToUpperLower() + ", " + "Connector" + ty.ToString() + settings["type"].ToUpperLower(); - Type t; + String object_sensor = "BlubbFish.Utils.IoT.Connector." + ty.ToString() + "." + settings["type"].ToUpperLower() + ", " + "Connector" + ty.ToString() + settings["type"].ToUpperLower(); try { - t = Type.GetType(object_sensor, true); + Type t = Type.GetType(object_sensor, true); + return (ABackend)t.GetConstructor(new Type[] { typeof(Dictionary) }).Invoke(new Object[] { settings }); } catch (TypeLoadException) { Console.Error.WriteLine("Configuration: " + settings["type"] + " is not a " + ty.ToString() + "Backend"); return null; } catch (System.IO.FileNotFoundException) { Console.Error.WriteLine("Driver " + object_sensor + " could not load!"); return null; + } catch (Exception e) { + Console.Error.WriteLine("Something bad Happend while Loading Connectior: "+e.Message); } - return (ABackend)t.GetConstructor(new Type[] { typeof(Dictionary) }).Invoke(new Object[] { settings }); + return null; } protected void NotifyClientIncomming(BackendEvent value) => this.MessageIncomming?.Invoke(this, value); diff --git a/Utils-IoT/Properties/AssemblyInfo.cs b/Utils-IoT/Properties/AssemblyInfo.cs index ec6bc4e..3410baf 100644 --- a/Utils-IoT/Properties/AssemblyInfo.cs +++ b/Utils-IoT/Properties/AssemblyInfo.cs @@ -1,12 +1,11 @@ -using System.Reflection; +#if !NETCOREAPP +using System.Reflection; using System.Resources; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, -// die einer Assembly zugeordnet sind. -#if NETCOREAPP -#else +// die einer Assembly zugeordnet sind. [assembly: AssemblyTitle("Utils-IoT")] [assembly: AssemblyDescription("Provides classes for iot development")] [assembly: AssemblyConfiguration("")]