From ce730867349f7c1997703b970cb61a0340c1dd6d Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Mon, 25 Nov 2019 18:49:57 +0100 Subject: [PATCH] Add netcore and refactoring --- Iot-Interfaces.sln | 56 ++++++----- Iot-Interfaces/IMqtt.cs | 4 - Iot-Interfaces/ISenml.cs | 4 - Iot-Interfaces/Iot-Interfaces.csproj | 109 ++++++++++++---------- Iot-Interfaces/Iot-Interfaces_Core.csproj | 37 ++++++++ Iot-Interfaces/Language/Senml.cs | 40 +++----- Iot-Interfaces/Properties/AssemblyInfo.cs | 12 ++- Iot-Interfaces_Core.sln | 31 ++++++ 8 files changed, 180 insertions(+), 113 deletions(-) create mode 100644 Iot-Interfaces/Iot-Interfaces_Core.csproj create mode 100644 Iot-Interfaces_Core.sln diff --git a/Iot-Interfaces.sln b/Iot-Interfaces.sln index 7c34d6d..ad7042f 100644 --- a/Iot-Interfaces.sln +++ b/Iot-Interfaces.sln @@ -1,25 +1,31 @@ - -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}") = "Iot-Interfaces", "Iot-Interfaces\Iot-Interfaces.csproj", "{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {6B5D61A4-D0B6-4C5C-8C8D-76EBD5ED55CE} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29519.87 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Iot-Interfaces", "Iot-Interfaces\Iot-Interfaces.csproj", "{4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4DAADA29-C600-4CF3-8AD3-9C97C8D7F632}.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 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6B5D61A4-D0B6-4C5C-8C8D-76EBD5ED55CE} + EndGlobalSection +EndGlobal diff --git a/Iot-Interfaces/IMqtt.cs b/Iot-Interfaces/IMqtt.cs index 89de56f..828b634 100644 --- a/Iot-Interfaces/IMqtt.cs +++ b/Iot-Interfaces/IMqtt.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace BlubbFish.Utils.IoT.Interfaces { public interface IMqtt { diff --git a/Iot-Interfaces/ISenml.cs b/Iot-Interfaces/ISenml.cs index 6f9babd..7648c25 100644 --- a/Iot-Interfaces/ISenml.cs +++ b/Iot-Interfaces/ISenml.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace BlubbFish.Utils.IoT.Interfaces { public interface ISenml { diff --git a/Iot-Interfaces/Iot-Interfaces.csproj b/Iot-Interfaces/Iot-Interfaces.csproj index 47b3dfa..7eddc20 100644 --- a/Iot-Interfaces/Iot-Interfaces.csproj +++ b/Iot-Interfaces/Iot-Interfaces.csproj @@ -1,50 +1,61 @@ - - - - - Debug - AnyCPU - {4DAADA29-C600-4CF3-8AD3-9C97C8D7F632} - Library - Properties - BlubbFish.Utils.IoT.Interfaces - Iot-Interfaces - v4.7.1 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - + + + + + Debug + AnyCPU + {4DAADA29-C600-4CF3-8AD3-9C97C8D7F632} + Library + Properties + BlubbFish.Utils.IoT.Interfaces + Iot-Interfaces + v4.7.1 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + {fac8ce64-bf13-4ece-8097-aeb5dd060098} + Utils + + + \ No newline at end of file diff --git a/Iot-Interfaces/Iot-Interfaces_Core.csproj b/Iot-Interfaces/Iot-Interfaces_Core.csproj new file mode 100644 index 0000000..5801cbd --- /dev/null +++ b/Iot-Interfaces/Iot-Interfaces_Core.csproj @@ -0,0 +1,37 @@ + + + + netcoreapp3.0 + BlubbFish.Utils.IoT.Interfaces + Iot-Interfaces + Interfaces.IoT.Utils.BlubbFish + 1.0.0 + 1.0.0 + de-DE + Interfaces for IoT-Stuff + BlubbFish + BlubbFish + Copyright © BlubbFish 2018 - 02.05.2018 + LICENSE + http://git.blubbfish.net/vs_utils/Iot-Interfaces + http://git.blubbfish.net/vs_utils/Iot-Interfaces.git + git + + + + + + + + + + + + + + True + + + + + diff --git a/Iot-Interfaces/Language/Senml.cs b/Iot-Interfaces/Language/Senml.cs index e1801bd..ac7203f 100644 --- a/Iot-Interfaces/Language/Senml.cs +++ b/Iot-Interfaces/Language/Senml.cs @@ -1,14 +1,15 @@ using System; using System.ComponentModel; -using System.Reflection; +using System.Diagnostics.CodeAnalysis; namespace BlubbFish.Utils.IoT.Interfaces.Language { public abstract class Senml { - #pragma warning disable IDE1006 // Benennungsstile + [SuppressMessage("Microsoft.Design", "IDE1006", Justification = "Must be lowercase")] public String n { get; } + [SuppressMessage("Microsoft.Design", "IDE1006", Justification = "Must be lowercase")] public String u { get; } + [SuppressMessage("Microsoft.Design", "IDE1006", Justification = "Must be lowercase")] public Int32 t { get; } - #pragma warning restore IDE1006 // Benennungsstile public enum Units { [Description("%")] @@ -27,36 +28,21 @@ namespace BlubbFish.Utils.IoT.Interfaces.Language { public Senml(String name, Units unit) { this.n = name; - this.u = this.GetEnumDescription(unit); + this.u = Helper.GetEnumDescription(unit); this.t = 0; } - private String GetEnumDescription(Enum value) { - FieldInfo fi = value.GetType().GetField(value.ToString()); - - DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false); - - if (attributes != null && attributes.Length > 0) { - return attributes[0].Description; - } else { - return value.ToString(); - } - } } public class SenmlBool : Senml { - #pragma warning disable IDE1006 // Benennungsstile - public Boolean bv { get; } - #pragma warning restore IDE1006 // Benennungsstile - public SenmlBool(String name, Units unit, Boolean level) : base(name, unit) { - this.bv = level; - } + [SuppressMessage("Microsoft.Design", "IDE1006", Justification = "Must be lowercase")] + public Boolean bv { get; } + + public SenmlBool(String name, Units unit, Boolean level) : base(name, unit) => this.bv = level; } public class SenmlDouble : Senml { - #pragma warning disable IDE1006 // Benennungsstile - public Double v { get; } - #pragma warning restore IDE1006 // Benennungsstile - public SenmlDouble(String name, Units unit, Double level) : base(name, unit) { - this.v = level; - } + [SuppressMessage("Microsoft.Design", "IDE1006", Justification = "Must be lowercase")] + public Double v { get; } + + public SenmlDouble(String name, Units unit, Double level) : base(name, unit) => this.v = level; } } diff --git a/Iot-Interfaces/Properties/AssemblyInfo.cs b/Iot-Interfaces/Properties/AssemblyInfo.cs index a014b72..f3bf8e9 100644 --- a/Iot-Interfaces/Properties/AssemblyInfo.cs +++ b/Iot-Interfaces/Properties/AssemblyInfo.cs @@ -1,4 +1,6 @@ -using System.Reflection; +#if NETCOREAPP +#else +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -10,9 +12,10 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("BlubbFish")] [assembly: AssemblyProduct("Iot-Interfaces")] -[assembly: AssemblyCopyright("Copyright © 2018 - 02.05.2018")] +[assembly: AssemblyCopyright("Copyright © BlubbFish 2018 - 02.05.2018")] [assembly: AssemblyTrademark("BlubbFish")] [assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("de-DE")] // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von @@ -32,5 +35,6 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.0")] +[assembly: AssemblyFileVersion("1.0.0")] +#endif diff --git a/Iot-Interfaces_Core.sln b/Iot-Interfaces_Core.sln new file mode 100644 index 0000000..baa8738 --- /dev/null +++ b/Iot-Interfaces_Core.sln @@ -0,0 +1,31 @@ + +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}") = "Iot-Interfaces_Core", "Iot-Interfaces\Iot-Interfaces_Core.csproj", "{C673B8CF-FCAD-4FEF-9744-DB3E6E546C12}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils_Core", "..\Utils\Utils\Utils_Core.csproj", "{99709124-FAB4-479B-BB01-A34733FF4190}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C673B8CF-FCAD-4FEF-9744-DB3E6E546C12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C673B8CF-FCAD-4FEF-9744-DB3E6E546C12}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C673B8CF-FCAD-4FEF-9744-DB3E6E546C12}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C673B8CF-FCAD-4FEF-9744-DB3E6E546C12}.Release|Any CPU.Build.0 = Release|Any CPU + {99709124-FAB4-479B-BB01-A34733FF4190}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {99709124-FAB4-479B-BB01-A34733FF4190}.Debug|Any CPU.Build.0 = Debug|Any CPU + {99709124-FAB4-479B-BB01-A34733FF4190}.Release|Any CPU.ActiveCfg = Release|Any CPU + {99709124-FAB4-479B-BB01-A34733FF4190}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {81CC4108-C7A3-4B34-A0EE-7EC946F58C28} + EndGlobalSection +EndGlobal