diff --git a/csharp/app/Backend/Backend.csproj b/csharp/App/Backend/Backend.csproj similarity index 67% rename from csharp/app/Backend/Backend.csproj rename to csharp/App/Backend/Backend.csproj index e6a136cb1..6be32dee4 100644 --- a/csharp/app/Backend/Backend.csproj +++ b/csharp/App/Backend/Backend.csproj @@ -1,12 +1,5 @@ - - - net6.0 - enable - enable - preview - Innovenergy.Backend - + @@ -28,17 +21,10 @@ - - - ..\..\..\..\..\..\.nuget\packages\awssdk.core\3.7.8.10\lib\netcoreapp3.1\AWSSDK.Core.dll - - - ..\..\..\..\..\.nuget\packages\sqlite-net-pcl\1.8.116\lib\netstandard2.0\SQLite-net.dll - - + - + diff --git a/csharp/app/Backend/Controllers/Controller.cs b/csharp/App/Backend/Controllers/Controller.cs similarity index 100% rename from csharp/app/Backend/Controllers/Controller.cs rename to csharp/App/Backend/Controllers/Controller.cs diff --git a/csharp/app/Backend/Controllers/Credentials.cs b/csharp/App/Backend/Controllers/Credentials.cs similarity index 100% rename from csharp/app/Backend/Controllers/Credentials.cs rename to csharp/App/Backend/Controllers/Credentials.cs diff --git a/csharp/app/Backend/Controllers/ReturnsAttribute.cs b/csharp/App/Backend/Controllers/ReturnsAttribute.cs similarity index 100% rename from csharp/app/Backend/Controllers/ReturnsAttribute.cs rename to csharp/App/Backend/Controllers/ReturnsAttribute.cs diff --git a/csharp/app/Backend/Database/Db.cs b/csharp/App/Backend/Database/Db.cs similarity index 100% rename from csharp/app/Backend/Database/Db.cs rename to csharp/App/Backend/Database/Db.cs diff --git a/csharp/app/Backend/Database/Fake.cs b/csharp/App/Backend/Database/Fake.cs similarity index 100% rename from csharp/app/Backend/Database/Fake.cs rename to csharp/App/Backend/Database/Fake.cs diff --git a/csharp/app/Backend/Database/Folder.cs b/csharp/App/Backend/Database/Folder.cs similarity index 100% rename from csharp/app/Backend/Database/Folder.cs rename to csharp/App/Backend/Database/Folder.cs diff --git a/csharp/app/Backend/Database/Installation.cs b/csharp/App/Backend/Database/Installation.cs similarity index 100% rename from csharp/app/Backend/Database/Installation.cs rename to csharp/App/Backend/Database/Installation.cs diff --git a/csharp/app/Backend/Database/User.cs b/csharp/App/Backend/Database/User.cs similarity index 100% rename from csharp/app/Backend/Database/User.cs rename to csharp/App/Backend/Database/User.cs diff --git a/csharp/app/Backend/Database/User2Folder.cs b/csharp/App/Backend/Database/User2Folder.cs similarity index 100% rename from csharp/app/Backend/Database/User2Folder.cs rename to csharp/App/Backend/Database/User2Folder.cs diff --git a/csharp/app/Backend/Database/User2Installation.cs b/csharp/App/Backend/Database/User2Installation.cs similarity index 100% rename from csharp/app/Backend/Database/User2Installation.cs rename to csharp/App/Backend/Database/User2Installation.cs diff --git a/csharp/app/Backend/FakeFolders.csv b/csharp/App/Backend/FakeFolders.csv similarity index 100% rename from csharp/app/Backend/FakeFolders.csv rename to csharp/App/Backend/FakeFolders.csv diff --git a/csharp/app/Backend/FakeInstallations.csv b/csharp/App/Backend/FakeInstallations.csv similarity index 100% rename from csharp/app/Backend/FakeInstallations.csv rename to csharp/App/Backend/FakeInstallations.csv diff --git a/csharp/app/Backend/FakePasswords.csv b/csharp/App/Backend/FakePasswords.csv similarity index 100% rename from csharp/app/Backend/FakePasswords.csv rename to csharp/App/Backend/FakePasswords.csv diff --git a/csharp/app/Backend/FakeUsers.csv b/csharp/App/Backend/FakeUsers.csv similarity index 100% rename from csharp/app/Backend/FakeUsers.csv rename to csharp/App/Backend/FakeUsers.csv diff --git a/csharp/app/Backend/HeaderFilter.cs b/csharp/App/Backend/HeaderFilter.cs similarity index 100% rename from csharp/app/Backend/HeaderFilter.cs rename to csharp/App/Backend/HeaderFilter.cs diff --git a/csharp/app/Backend/Model/Folder.cs b/csharp/App/Backend/Model/Folder.cs similarity index 100% rename from csharp/app/Backend/Model/Folder.cs rename to csharp/App/Backend/Model/Folder.cs diff --git a/csharp/app/Backend/Model/Installation.cs b/csharp/App/Backend/Model/Installation.cs similarity index 100% rename from csharp/app/Backend/Model/Installation.cs rename to csharp/App/Backend/Model/Installation.cs diff --git a/csharp/app/Backend/Model/Relations/Relation.cs b/csharp/App/Backend/Model/Relations/Relation.cs similarity index 100% rename from csharp/app/Backend/Model/Relations/Relation.cs rename to csharp/App/Backend/Model/Relations/Relation.cs diff --git a/csharp/app/Backend/Model/Relations/Session.cs b/csharp/App/Backend/Model/Relations/Session.cs similarity index 100% rename from csharp/app/Backend/Model/Relations/Session.cs rename to csharp/App/Backend/Model/Relations/Session.cs diff --git a/csharp/app/Backend/Model/Relations/User2Folder.cs b/csharp/App/Backend/Model/Relations/User2Folder.cs similarity index 100% rename from csharp/app/Backend/Model/Relations/User2Folder.cs rename to csharp/App/Backend/Model/Relations/User2Folder.cs diff --git a/csharp/app/Backend/Model/Relations/User2Installation.cs b/csharp/App/Backend/Model/Relations/User2Installation.cs similarity index 100% rename from csharp/app/Backend/Model/Relations/User2Installation.cs rename to csharp/App/Backend/Model/Relations/User2Installation.cs diff --git a/csharp/app/Backend/Model/TreeNode.Equality.cs b/csharp/App/Backend/Model/TreeNode.Equality.cs similarity index 100% rename from csharp/app/Backend/Model/TreeNode.Equality.cs rename to csharp/App/Backend/Model/TreeNode.Equality.cs diff --git a/csharp/app/Backend/Model/TreeNode.cs b/csharp/App/Backend/Model/TreeNode.cs similarity index 100% rename from csharp/app/Backend/Model/TreeNode.cs rename to csharp/App/Backend/Model/TreeNode.cs diff --git a/csharp/app/Backend/Model/User.cs b/csharp/App/Backend/Model/User.cs similarity index 100% rename from csharp/app/Backend/Model/User.cs rename to csharp/App/Backend/Model/User.cs diff --git a/csharp/app/Backend/Program.cs b/csharp/App/Backend/Program.cs similarity index 100% rename from csharp/app/Backend/Program.cs rename to csharp/App/Backend/Program.cs diff --git a/csharp/app/Backend/Properties/launchSettings.json b/csharp/App/Backend/Properties/launchSettings.json similarity index 100% rename from csharp/app/Backend/Properties/launchSettings.json rename to csharp/App/Backend/Properties/launchSettings.json diff --git a/csharp/app/Backend/Utils/Crypto.cs b/csharp/App/Backend/Utils/Crypto.cs similarity index 100% rename from csharp/app/Backend/Utils/Crypto.cs rename to csharp/App/Backend/Utils/Crypto.cs diff --git a/csharp/app/Backend/Utils/Result.cs b/csharp/App/Backend/Utils/Result.cs similarity index 100% rename from csharp/app/Backend/Utils/Result.cs rename to csharp/App/Backend/Utils/Result.cs diff --git a/csharp/App/Backend/db.sqlite b/csharp/App/Backend/db.sqlite new file mode 100644 index 000000000..982a3ab91 Binary files /dev/null and b/csharp/App/Backend/db.sqlite differ diff --git a/csharp/app/BmsTunnel/BatteryConnection.cs b/csharp/App/BmsTunnel/BatteryConnection.cs similarity index 97% rename from csharp/app/BmsTunnel/BatteryConnection.cs rename to csharp/App/BmsTunnel/BatteryConnection.cs index 1dd0378a6..28dd3ee8a 100644 --- a/csharp/app/BmsTunnel/BatteryConnection.cs +++ b/csharp/App/BmsTunnel/BatteryConnection.cs @@ -1,9 +1,9 @@ using CliWrap; using CliWrap.Buffered; using InnovEnergy.Lib.Utils; -using static InnovEnergy.BmsTunnel.CliPrograms; +using static InnovEnergy.App.BmsTunnel.CliPrograms; -namespace InnovEnergy.BmsTunnel; +namespace InnovEnergy.App.BmsTunnel; using Nodes = IReadOnlyList; diff --git a/csharp/app/BmsTunnel/BmsTunnel.cs b/csharp/App/BmsTunnel/BmsTunnel.cs similarity index 99% rename from csharp/app/BmsTunnel/BmsTunnel.cs rename to csharp/App/BmsTunnel/BmsTunnel.cs index 2af527047..85cefdf14 100644 --- a/csharp/app/BmsTunnel/BmsTunnel.cs +++ b/csharp/App/BmsTunnel/BmsTunnel.cs @@ -3,7 +3,7 @@ using System.Text; using CliWrap.Buffered; using InnovEnergy.Lib.Utils; -namespace InnovEnergy.BmsTunnel; +namespace InnovEnergy.App.BmsTunnel; public class BmsTunnel : IDisposable diff --git a/csharp/app/BmsTunnel/BmsTunnel.csproj b/csharp/App/BmsTunnel/BmsTunnel.csproj similarity index 53% rename from csharp/app/BmsTunnel/BmsTunnel.csproj rename to csharp/App/BmsTunnel/BmsTunnel.csproj index 6078a616a..0466a4173 100644 --- a/csharp/app/BmsTunnel/BmsTunnel.csproj +++ b/csharp/App/BmsTunnel/BmsTunnel.csproj @@ -1,9 +1,5 @@ - - - - InnovEnergy.BmsTunnel - + @@ -11,7 +7,7 @@ - + diff --git a/csharp/app/BmsTunnel/CliPrograms.cs b/csharp/App/BmsTunnel/CliPrograms.cs similarity index 91% rename from csharp/app/BmsTunnel/CliPrograms.cs rename to csharp/App/BmsTunnel/CliPrograms.cs index 98588b622..c27df92df 100644 --- a/csharp/app/BmsTunnel/CliPrograms.cs +++ b/csharp/App/BmsTunnel/CliPrograms.cs @@ -1,6 +1,6 @@ using CliWrap; -namespace InnovEnergy.BmsTunnel; +namespace InnovEnergy.App.BmsTunnel; public static class CliPrograms { diff --git a/csharp/app/BmsTunnel/Program.cs b/csharp/App/BmsTunnel/Program.cs similarity index 98% rename from csharp/app/BmsTunnel/Program.cs rename to csharp/App/BmsTunnel/Program.cs index 5f2d42de7..c3ce8f71e 100644 --- a/csharp/app/BmsTunnel/Program.cs +++ b/csharp/App/BmsTunnel/Program.cs @@ -5,7 +5,7 @@ using InnovEnergy.Lib.Utils; using static System.String; -namespace InnovEnergy.BmsTunnel; +namespace InnovEnergy.App.BmsTunnel; public static class Program { diff --git a/csharp/app/BmsTunnel/debug.sh b/csharp/App/BmsTunnel/debug.sh similarity index 100% rename from csharp/app/BmsTunnel/debug.sh rename to csharp/App/BmsTunnel/debug.sh diff --git a/csharp/app/BmsTunnel/parameters.txt b/csharp/App/BmsTunnel/parameters.txt similarity index 100% rename from csharp/app/BmsTunnel/parameters.txt rename to csharp/App/BmsTunnel/parameters.txt diff --git a/csharp/App/Collector/Collector.csproj b/csharp/App/Collector/Collector.csproj new file mode 100644 index 000000000..27b560c8d --- /dev/null +++ b/csharp/App/Collector/Collector.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/csharp/app/Collector/Collector.sln b/csharp/App/Collector/Collector.sln similarity index 100% rename from csharp/app/Collector/Collector.sln rename to csharp/App/Collector/Collector.sln diff --git a/csharp/app/Collector/src/BatteryDataParser.cs b/csharp/App/Collector/src/BatteryDataParser.cs similarity index 98% rename from csharp/app/Collector/src/BatteryDataParser.cs rename to csharp/App/Collector/src/BatteryDataParser.cs index 81c84313e..23e0c2bfb 100644 --- a/csharp/app/Collector/src/BatteryDataParser.cs +++ b/csharp/App/Collector/src/BatteryDataParser.cs @@ -1,14 +1,14 @@ using System.Net; using System.Text; -using InnovEnergy.Collector.Influx; -using InnovEnergy.Collector.Records; -using InnovEnergy.Collector.Utils; +using InnovEnergy.App.Collector.Influx; +using InnovEnergy.App.Collector.Records; +using InnovEnergy.App.Collector.Utils; using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Utils.Net; using Convert = System.Convert; -namespace InnovEnergy.Collector; +namespace InnovEnergy.App.Collector; using Data = IReadOnlyList; diff --git a/csharp/app/Collector/src/BatteryDataParserV4.cs b/csharp/App/Collector/src/BatteryDataParserV4.cs similarity index 98% rename from csharp/app/Collector/src/BatteryDataParserV4.cs rename to csharp/App/Collector/src/BatteryDataParserV4.cs index dc3064f0c..8d8ae5bd0 100644 --- a/csharp/app/Collector/src/BatteryDataParserV4.cs +++ b/csharp/App/Collector/src/BatteryDataParserV4.cs @@ -1,15 +1,15 @@ using System.Net; using System.Text; -using InnovEnergy.Collector.Influx; -using InnovEnergy.Collector.Records; -using InnovEnergy.Collector.Utils; +using InnovEnergy.App.Collector.Influx; +using InnovEnergy.App.Collector.Records; +using InnovEnergy.App.Collector.Utils; using InnovEnergy.Lib.Utils; using Convert = System.Convert; // NOT (YET) USED -namespace InnovEnergy.Collector; +namespace InnovEnergy.App.Collector; using Data = IReadOnlyList; diff --git a/csharp/app/Collector/src/Influx/FieldAttribute.cs b/csharp/App/Collector/src/Influx/FieldAttribute.cs similarity index 86% rename from csharp/app/Collector/src/Influx/FieldAttribute.cs rename to csharp/App/Collector/src/Influx/FieldAttribute.cs index 9f8438ac7..58dc3d0ba 100644 --- a/csharp/app/Collector/src/Influx/FieldAttribute.cs +++ b/csharp/App/Collector/src/Influx/FieldAttribute.cs @@ -2,7 +2,7 @@ using static System.AttributeTargets; #nullable disable -namespace InnovEnergy.Collector.Influx; +namespace InnovEnergy.App.Collector.Influx; [AttributeUsage(Property)] public class FieldAttribute : Attribute diff --git a/csharp/app/Collector/src/Influx/InfluxRecord.cs b/csharp/App/Collector/src/Influx/InfluxRecord.cs similarity index 93% rename from csharp/app/Collector/src/Influx/InfluxRecord.cs rename to csharp/App/Collector/src/Influx/InfluxRecord.cs index 4043f0837..6406ea876 100644 --- a/csharp/app/Collector/src/Influx/InfluxRecord.cs +++ b/csharp/App/Collector/src/Influx/InfluxRecord.cs @@ -1,10 +1,10 @@ using System.Text; -using InnovEnergy.Collector.Utils; +using InnovEnergy.App.Collector.Utils; using InnovEnergy.Lib.Utils; using static System.Globalization.CultureInfo; -using static InnovEnergy.Collector.Influx.LineProtocolSyntax; +using static InnovEnergy.App.Collector.Influx.LineProtocolSyntax; -namespace InnovEnergy.Collector.Influx; +namespace InnovEnergy.App.Collector.Influx; public static class InfluxRecord { diff --git a/csharp/app/Collector/src/Influx/LineProtocolSyntax.cs b/csharp/App/Collector/src/Influx/LineProtocolSyntax.cs similarity index 98% rename from csharp/app/Collector/src/Influx/LineProtocolSyntax.cs rename to csharp/App/Collector/src/Influx/LineProtocolSyntax.cs index 95b1a2bd6..2c55b3725 100644 --- a/csharp/app/Collector/src/Influx/LineProtocolSyntax.cs +++ b/csharp/App/Collector/src/Influx/LineProtocolSyntax.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; using static System.Globalization.CultureInfo; -namespace InnovEnergy.Collector.Influx; +namespace InnovEnergy.App.Collector.Influx; internal static class LineProtocolSyntax { diff --git a/csharp/app/Collector/src/Influx/TagAttribute.cs b/csharp/App/Collector/src/Influx/TagAttribute.cs similarity index 70% rename from csharp/app/Collector/src/Influx/TagAttribute.cs rename to csharp/App/Collector/src/Influx/TagAttribute.cs index 3db4ee3a1..db028d6a8 100644 --- a/csharp/app/Collector/src/Influx/TagAttribute.cs +++ b/csharp/App/Collector/src/Influx/TagAttribute.cs @@ -1,6 +1,6 @@ using static System.AttributeTargets; -namespace InnovEnergy.Collector.Influx; +namespace InnovEnergy.App.Collector.Influx; [AttributeUsage(Property)] public class TagAttribute : Attribute diff --git a/csharp/app/Collector/src/Program.cs b/csharp/App/Collector/src/Program.cs similarity index 97% rename from csharp/app/Collector/src/Program.cs rename to csharp/App/Collector/src/Program.cs index 01d02ce43..28b58dbcf 100644 --- a/csharp/app/Collector/src/Program.cs +++ b/csharp/App/Collector/src/Program.cs @@ -2,17 +2,17 @@ using System.Reactive.Concurrency; using System.Reactive.Linq; using System.Reactive.Subjects; -using InnovEnergy.Collector.Influx; -using InnovEnergy.Collector.Records; -using InnovEnergy.Lib.Utils; -using static System.Text.Encoding; -using static InnovEnergy.Lib.Utils.ExceptionHandling; using System.Text.Json; +using InnovEnergy.App.Collector.Influx; +using InnovEnergy.App.Collector.Records; +using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Utils.Net; using InnovEnergy.Lib.WebServer; +using static System.Text.Encoding; +using static InnovEnergy.Lib.Utils.ExceptionHandling; -namespace InnovEnergy.Collector; +namespace InnovEnergy.App.Collector; // TODO: net6 diff --git a/csharp/app/Collector/src/Records/Alarms.cs b/csharp/App/Collector/src/Records/Alarms.cs similarity index 95% rename from csharp/app/Collector/src/Records/Alarms.cs rename to csharp/App/Collector/src/Records/Alarms.cs index 959855519..793680e82 100644 --- a/csharp/app/Collector/src/Records/Alarms.cs +++ b/csharp/App/Collector/src/Records/Alarms.cs @@ -1,10 +1,10 @@ -using InnovEnergy.Collector.Influx; +using InnovEnergy.App.Collector.Influx; // ReSharper disable IdentifierTypo // ReSharper disable UnusedAutoPropertyAccessor.Global // ReSharper disable InconsistentNaming -namespace InnovEnergy.Collector.Records; +namespace InnovEnergy.App.Collector.Records; public class Alarms : BatteryRecord { diff --git a/csharp/App/Collector/src/Records/BatteryRecord.cs b/csharp/App/Collector/src/Records/BatteryRecord.cs new file mode 100644 index 000000000..49cfcc00c --- /dev/null +++ b/csharp/App/Collector/src/Records/BatteryRecord.cs @@ -0,0 +1,4 @@ +namespace InnovEnergy.App.Collector.Records; + +public abstract class BatteryRecord +{} \ No newline at end of file diff --git a/csharp/app/Collector/src/Records/BatteryStatus.cs b/csharp/App/Collector/src/Records/BatteryStatus.cs similarity index 93% rename from csharp/app/Collector/src/Records/BatteryStatus.cs rename to csharp/App/Collector/src/Records/BatteryStatus.cs index 25f2a6ab3..2816b7545 100644 --- a/csharp/app/Collector/src/Records/BatteryStatus.cs +++ b/csharp/App/Collector/src/Records/BatteryStatus.cs @@ -1,9 +1,9 @@ -using InnovEnergy.Collector.Influx; +using InnovEnergy.App.Collector.Influx; // ReSharper disable UnusedAutoPropertyAccessor.Global // ReSharper disable MemberCanBePrivate.Global -namespace InnovEnergy.Collector.Records; +namespace InnovEnergy.App.Collector.Records; public class BatteryStatus : BatteryRecord { diff --git a/csharp/app/Collector/src/Records/Error.cs b/csharp/App/Collector/src/Records/Error.cs similarity index 69% rename from csharp/app/Collector/src/Records/Error.cs rename to csharp/App/Collector/src/Records/Error.cs index 3d151af2e..9ffa399ef 100644 --- a/csharp/app/Collector/src/Records/Error.cs +++ b/csharp/App/Collector/src/Records/Error.cs @@ -1,8 +1,8 @@ -using InnovEnergy.Collector.Influx; +using InnovEnergy.App.Collector.Influx; // ReSharper disable UnusedAutoPropertyAccessor.Global -namespace InnovEnergy.Collector.Records; +namespace InnovEnergy.App.Collector.Records; public class Error : BatteryRecord { diff --git a/csharp/app/Collector/src/Records/InstallationStatus.cs b/csharp/App/Collector/src/Records/InstallationStatus.cs similarity index 97% rename from csharp/app/Collector/src/Records/InstallationStatus.cs rename to csharp/App/Collector/src/Records/InstallationStatus.cs index 99937ddb7..a93a4374c 100644 --- a/csharp/app/Collector/src/Records/InstallationStatus.cs +++ b/csharp/App/Collector/src/Records/InstallationStatus.cs @@ -1,6 +1,6 @@ -using InnovEnergy.Collector.Influx; +using InnovEnergy.App.Collector.Influx; -namespace InnovEnergy.Collector.Records; +namespace InnovEnergy.App.Collector.Records; public class InstallationStatus : BatteryRecord { diff --git a/csharp/app/Collector/src/Records/IoStatus.cs b/csharp/App/Collector/src/Records/IoStatus.cs similarity index 89% rename from csharp/app/Collector/src/Records/IoStatus.cs rename to csharp/App/Collector/src/Records/IoStatus.cs index 4d0791219..a9c2c7247 100644 --- a/csharp/app/Collector/src/Records/IoStatus.cs +++ b/csharp/App/Collector/src/Records/IoStatus.cs @@ -1,8 +1,8 @@ -using InnovEnergy.Collector.Influx; +using InnovEnergy.App.Collector.Influx; // ReSharper disable UnusedAutoPropertyAccessor.Global -namespace InnovEnergy.Collector.Records; +namespace InnovEnergy.App.Collector.Records; public class IoStatus : BatteryRecord { diff --git a/csharp/app/Collector/src/Records/Leds.cs b/csharp/App/Collector/src/Records/Leds.cs similarity index 86% rename from csharp/app/Collector/src/Records/Leds.cs rename to csharp/App/Collector/src/Records/Leds.cs index 39a7e97be..6dc3170cb 100644 --- a/csharp/app/Collector/src/Records/Leds.cs +++ b/csharp/App/Collector/src/Records/Leds.cs @@ -1,9 +1,9 @@ -using InnovEnergy.Collector.Influx; +using InnovEnergy.App.Collector.Influx; // ReSharper disable UnusedAutoPropertyAccessor.Global // ReSharper disable UnusedMember.Global -namespace InnovEnergy.Collector.Records; +namespace InnovEnergy.App.Collector.Records; public class Leds : BatteryRecord { diff --git a/csharp/app/Collector/src/Records/Temperatures.cs b/csharp/App/Collector/src/Records/Temperatures.cs similarity index 87% rename from csharp/app/Collector/src/Records/Temperatures.cs rename to csharp/App/Collector/src/Records/Temperatures.cs index 6b621084d..34d53a92e 100644 --- a/csharp/app/Collector/src/Records/Temperatures.cs +++ b/csharp/App/Collector/src/Records/Temperatures.cs @@ -1,7 +1,6 @@ -using InnovEnergy.Collector.Influx; +using InnovEnergy.App.Collector.Influx; - -namespace InnovEnergy.Collector.Records; +namespace InnovEnergy.App.Collector.Records; #pragma warning disable CS8618 diff --git a/csharp/app/Collector/src/Records/Warnings.cs b/csharp/App/Collector/src/Records/Warnings.cs similarity index 92% rename from csharp/app/Collector/src/Records/Warnings.cs rename to csharp/App/Collector/src/Records/Warnings.cs index c74aee213..3d5d2a176 100644 --- a/csharp/app/Collector/src/Records/Warnings.cs +++ b/csharp/App/Collector/src/Records/Warnings.cs @@ -1,7 +1,6 @@ -using InnovEnergy.Collector.Influx; +using InnovEnergy.App.Collector.Influx; - -namespace InnovEnergy.Collector.Records; +namespace InnovEnergy.App.Collector.Records; #pragma warning disable CS8618 diff --git a/csharp/app/Collector/src/Settings.cs b/csharp/App/Collector/src/Settings.cs similarity index 91% rename from csharp/app/Collector/src/Settings.cs rename to csharp/App/Collector/src/Settings.cs index 10502f536..7708dc819 100644 --- a/csharp/app/Collector/src/Settings.cs +++ b/csharp/App/Collector/src/Settings.cs @@ -1,6 +1,6 @@ using System.Net; -namespace InnovEnergy.Collector; +namespace InnovEnergy.App.Collector; public static class Settings { diff --git a/csharp/app/Collector/src/Utils/Extensions.cs b/csharp/App/Collector/src/Utils/Extensions.cs similarity index 95% rename from csharp/app/Collector/src/Utils/Extensions.cs rename to csharp/App/Collector/src/Utils/Extensions.cs index 3371ec718..9b79e4ab4 100644 --- a/csharp/app/Collector/src/Utils/Extensions.cs +++ b/csharp/App/Collector/src/Utils/Extensions.cs @@ -1,6 +1,6 @@ using System.Globalization; -namespace InnovEnergy.Collector.Utils; +namespace InnovEnergy.App.Collector.Utils; public static class Extensions { diff --git a/csharp/app/Collector/src/Utils/Log.cs b/csharp/App/Collector/src/Utils/Log.cs similarity index 94% rename from csharp/app/Collector/src/Utils/Log.cs rename to csharp/App/Collector/src/Utils/Log.cs index 316f41af3..8e32f0174 100644 --- a/csharp/app/Collector/src/Utils/Log.cs +++ b/csharp/App/Collector/src/Utils/Log.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Collector.Utils; +namespace InnovEnergy.App.Collector.Utils; internal static class Log { diff --git a/csharp/app/Collector/src/Utils/Property.cs b/csharp/App/Collector/src/Utils/Property.cs similarity index 97% rename from csharp/app/Collector/src/Utils/Property.cs rename to csharp/App/Collector/src/Utils/Property.cs index 89d0aa012..ccf4b45ac 100644 --- a/csharp/app/Collector/src/Utils/Property.cs +++ b/csharp/App/Collector/src/Utils/Property.cs @@ -1,7 +1,7 @@ using System.Reflection; using InnovEnergy.Lib.Utils; -namespace InnovEnergy.Collector.Utils; +namespace InnovEnergy.App.Collector.Utils; public readonly struct Property { diff --git a/csharp/app/Collector/src/Utils/ReadOnlyListExtensions.cs b/csharp/App/Collector/src/Utils/ReadOnlyListExtensions.cs similarity index 95% rename from csharp/app/Collector/src/Utils/ReadOnlyListExtensions.cs rename to csharp/App/Collector/src/Utils/ReadOnlyListExtensions.cs index ec53ff191..7c8d915b3 100644 --- a/csharp/app/Collector/src/Utils/ReadOnlyListExtensions.cs +++ b/csharp/App/Collector/src/Utils/ReadOnlyListExtensions.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Collector.Utils; +namespace InnovEnergy.App.Collector.Utils; public static class ReadOnlyListExtensions { diff --git a/csharp/app/Collector/src/Utils/Utils.cs b/csharp/App/Collector/src/Utils/Utils.cs similarity index 90% rename from csharp/app/Collector/src/Utils/Utils.cs rename to csharp/App/Collector/src/Utils/Utils.cs index fd47cc583..51c9d3fbb 100644 --- a/csharp/app/Collector/src/Utils/Utils.cs +++ b/csharp/App/Collector/src/Utils/Utils.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Collector.Utils; +namespace InnovEnergy.App.Collector.Utils; public static class Utils { diff --git a/csharp/app/EmuMeterDriver/Config.cs b/csharp/App/EmuMeterDriver/Config.cs similarity index 98% rename from csharp/app/EmuMeterDriver/Config.cs rename to csharp/App/EmuMeterDriver/Config.cs index e7bad3e06..ee0ad64db 100644 --- a/csharp/app/EmuMeterDriver/Config.cs +++ b/csharp/App/EmuMeterDriver/Config.cs @@ -1,7 +1,7 @@ using System.Reflection; using InnovEnergy.Lib.Victron.VeDBus; -namespace InnovEnergy.EmuMeter; +namespace InnovEnergy.App.EmuMeterDriver; public static class Config { diff --git a/csharp/app/EmuMeterDriver/EmuMeterDriver.cs b/csharp/App/EmuMeterDriver/EmuMeterDriver.cs similarity index 98% rename from csharp/app/EmuMeterDriver/EmuMeterDriver.cs rename to csharp/App/EmuMeterDriver/EmuMeterDriver.cs index 6e923678a..9c57f2c7a 100644 --- a/csharp/app/EmuMeterDriver/EmuMeterDriver.cs +++ b/csharp/App/EmuMeterDriver/EmuMeterDriver.cs @@ -5,8 +5,7 @@ using InnovEnergy.Lib.Protocols.Modbus.Clients; using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Victron.VeDBus; - -namespace InnovEnergy.EmuMeter; +namespace InnovEnergy.App.EmuMeterDriver; public static class EmuMeterDriver { diff --git a/csharp/App/EmuMeterDriver/EmuMeterDriver.csproj b/csharp/App/EmuMeterDriver/EmuMeterDriver.csproj new file mode 100644 index 000000000..b2f8696ed --- /dev/null +++ b/csharp/App/EmuMeterDriver/EmuMeterDriver.csproj @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/csharp/app/EmuMeterDriver/Nic.cs b/csharp/App/EmuMeterDriver/Nic.cs similarity index 98% rename from csharp/app/EmuMeterDriver/Nic.cs rename to csharp/App/EmuMeterDriver/Nic.cs index 9ddb9096e..0b81b0843 100644 --- a/csharp/app/EmuMeterDriver/Nic.cs +++ b/csharp/App/EmuMeterDriver/Nic.cs @@ -2,7 +2,7 @@ using System.Text.Json.Nodes; using CliWrap; using CliWrap.Buffered; -namespace InnovEnergy.EmuMeter; +namespace InnovEnergy.App.EmuMeterDriver; public readonly struct Nic { diff --git a/csharp/app/EmuMeterDriver/Program.cs b/csharp/App/EmuMeterDriver/Program.cs similarity index 96% rename from csharp/app/EmuMeterDriver/Program.cs rename to csharp/App/EmuMeterDriver/Program.cs index 8a8c70561..6ad63d04d 100644 --- a/csharp/app/EmuMeterDriver/Program.cs +++ b/csharp/App/EmuMeterDriver/Program.cs @@ -1,4 +1,4 @@ -using InnovEnergy.EmuMeter; +using InnovEnergy.App.EmuMeterDriver; using InnovEnergy.Lib.Protocols.DBus; using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Utils.Net; diff --git a/csharp/app/EmuMeterDriver/Signal.cs b/csharp/App/EmuMeterDriver/Signal.cs similarity index 90% rename from csharp/app/EmuMeterDriver/Signal.cs rename to csharp/App/EmuMeterDriver/Signal.cs index e606e2f53..ef375bb91 100644 --- a/csharp/app/EmuMeterDriver/Signal.cs +++ b/csharp/App/EmuMeterDriver/Signal.cs @@ -2,7 +2,7 @@ using InnovEnergy.Lib.Devices.EmuMeter; using InnovEnergy.Lib.Protocols.DBus.Protocol.DataTypes; using InnovEnergy.Lib.Victron.VeDBus; -namespace InnovEnergy.EmuMeter; +namespace InnovEnergy.App.EmuMeterDriver; public record Signal(Func Source, ObjectPath Path, String Format = "") { diff --git a/csharp/app/EmuMeterDriver/Utils.cs b/csharp/App/EmuMeterDriver/Utils.cs similarity index 95% rename from csharp/app/EmuMeterDriver/Utils.cs rename to csharp/App/EmuMeterDriver/Utils.cs index cab67bd3c..65f02de6a 100644 --- a/csharp/app/EmuMeterDriver/Utils.cs +++ b/csharp/App/EmuMeterDriver/Utils.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.EmuMeter; +namespace InnovEnergy.App.EmuMeterDriver; public static class Utils { diff --git a/csharp/app/EmuMeterDriver/debug.sh b/csharp/App/EmuMeterDriver/debug.sh similarity index 100% rename from csharp/app/EmuMeterDriver/debug.sh rename to csharp/App/EmuMeterDriver/debug.sh diff --git a/csharp/app/EmuMeterDriver/service/log/run b/csharp/App/EmuMeterDriver/service/log/run similarity index 100% rename from csharp/app/EmuMeterDriver/service/log/run rename to csharp/App/EmuMeterDriver/service/log/run diff --git a/csharp/app/EmuMeterDriver/service/run b/csharp/App/EmuMeterDriver/service/run similarity index 100% rename from csharp/app/EmuMeterDriver/service/run rename to csharp/App/EmuMeterDriver/service/run diff --git a/csharp/app/InnovEnergy.app.props b/csharp/App/InnovEnergy.App.props similarity index 91% rename from csharp/app/InnovEnergy.app.props rename to csharp/App/InnovEnergy.App.props index beb4a7a4a..38d62f4dc 100644 --- a/csharp/app/InnovEnergy.app.props +++ b/csharp/App/InnovEnergy.App.props @@ -11,7 +11,6 @@ true true true - @@ -20,6 +19,7 @@ Exe + InnovEnergy.App.$(AssemblyName) diff --git a/csharp/app/OpenVpnCertificatesServer/Files.cs b/csharp/App/OpenVpnCertificatesServer/Files.cs similarity index 90% rename from csharp/app/OpenVpnCertificatesServer/Files.cs rename to csharp/App/OpenVpnCertificatesServer/Files.cs index 35f78f44b..00fbf58d5 100644 --- a/csharp/app/OpenVpnCertificatesServer/Files.cs +++ b/csharp/App/OpenVpnCertificatesServer/Files.cs @@ -1,6 +1,4 @@ -namespace InnovEnergy.OpenVpnCertificatesServer; - -using System; +namespace InnovEnergy.App.OpenVpnCertificatesServer; public static class Files { diff --git a/csharp/app/OpenVpnCertificatesServer/Http.cs b/csharp/App/OpenVpnCertificatesServer/Http.cs similarity index 94% rename from csharp/app/OpenVpnCertificatesServer/Http.cs rename to csharp/App/OpenVpnCertificatesServer/Http.cs index 3f72fb5da..5442047ae 100644 --- a/csharp/app/OpenVpnCertificatesServer/Http.cs +++ b/csharp/App/OpenVpnCertificatesServer/Http.cs @@ -1,9 +1,8 @@ -namespace InnovEnergy.OpenVpnCertificatesServer; - -using System; using System.Net; using Flurl; +namespace InnovEnergy.App.OpenVpnCertificatesServer; + public static class Http { // TODO: use worker thread diff --git a/csharp/app/OpenVpnCertificatesServer/OpenVpnCertificatesServer.csproj b/csharp/App/OpenVpnCertificatesServer/OpenVpnCertificatesServer.csproj similarity index 53% rename from csharp/app/OpenVpnCertificatesServer/OpenVpnCertificatesServer.csproj rename to csharp/App/OpenVpnCertificatesServer/OpenVpnCertificatesServer.csproj index c2110f3cb..e44b0a11e 100644 --- a/csharp/app/OpenVpnCertificatesServer/OpenVpnCertificatesServer.csproj +++ b/csharp/App/OpenVpnCertificatesServer/OpenVpnCertificatesServer.csproj @@ -1,10 +1,6 @@ - + - - InnovEnergy.OpenVpnCertificatesServer - - @@ -12,8 +8,9 @@ - - + + + diff --git a/csharp/app/OpenVpnCertificatesServer/OpenVpnCertificatesServer.sln b/csharp/App/OpenVpnCertificatesServer/OpenVpnCertificatesServer.sln similarity index 100% rename from csharp/app/OpenVpnCertificatesServer/OpenVpnCertificatesServer.sln rename to csharp/App/OpenVpnCertificatesServer/OpenVpnCertificatesServer.sln diff --git a/csharp/app/OpenVpnCertificatesServer/PKI/CertificateAuthority.cs b/csharp/App/OpenVpnCertificatesServer/PKI/CertificateAuthority.cs similarity index 99% rename from csharp/app/OpenVpnCertificatesServer/PKI/CertificateAuthority.cs rename to csharp/App/OpenVpnCertificatesServer/PKI/CertificateAuthority.cs index ec35a7836..b782c8165 100644 --- a/csharp/app/OpenVpnCertificatesServer/PKI/CertificateAuthority.cs +++ b/csharp/App/OpenVpnCertificatesServer/PKI/CertificateAuthority.cs @@ -7,7 +7,7 @@ using Org.BouncyCastle.Math; using Org.BouncyCastle.Security; using Org.BouncyCastle.X509; -namespace InnovEnergy.OpenVpnCertificatesServer.PKI; +namespace InnovEnergy.App.OpenVpnCertificatesServer.PKI; public static class CertificateAuthority { diff --git a/csharp/app/OpenVpnCertificatesServer/PKI/Pem.cs b/csharp/App/OpenVpnCertificatesServer/PKI/Pem.cs similarity index 95% rename from csharp/app/OpenVpnCertificatesServer/PKI/Pem.cs rename to csharp/App/OpenVpnCertificatesServer/PKI/Pem.cs index 3698135ee..8015c4e71 100644 --- a/csharp/app/OpenVpnCertificatesServer/PKI/Pem.cs +++ b/csharp/App/OpenVpnCertificatesServer/PKI/Pem.cs @@ -1,6 +1,6 @@ using Org.BouncyCastle.OpenSsl; -namespace InnovEnergy.OpenVpnCertificatesServer.PKI; +namespace InnovEnergy.App.OpenVpnCertificatesServer.PKI; public static class Pem { diff --git a/csharp/app/OpenVpnCertificatesServer/PKI/PwdFinder.cs b/csharp/App/OpenVpnCertificatesServer/PKI/PwdFinder.cs similarity index 81% rename from csharp/app/OpenVpnCertificatesServer/PKI/PwdFinder.cs rename to csharp/App/OpenVpnCertificatesServer/PKI/PwdFinder.cs index 70d54fd51..3bbe9354a 100644 --- a/csharp/app/OpenVpnCertificatesServer/PKI/PwdFinder.cs +++ b/csharp/App/OpenVpnCertificatesServer/PKI/PwdFinder.cs @@ -1,6 +1,6 @@ using Org.BouncyCastle.OpenSsl; -namespace InnovEnergy.OpenVpnCertificatesServer.PKI; +namespace InnovEnergy.App.OpenVpnCertificatesServer.PKI; public class PwdFinder : IPasswordFinder { diff --git a/csharp/app/OpenVpnCertificatesServer/Program.cs b/csharp/App/OpenVpnCertificatesServer/Program.cs similarity index 97% rename from csharp/app/OpenVpnCertificatesServer/Program.cs rename to csharp/App/OpenVpnCertificatesServer/Program.cs index 3d765b2cd..c9bff3a03 100644 --- a/csharp/app/OpenVpnCertificatesServer/Program.cs +++ b/csharp/App/OpenVpnCertificatesServer/Program.cs @@ -1,15 +1,14 @@ -using InnovEnergy.Lib.Utils; -using InnovEnergy.Lib.Victron.VictronVRM; -using InnovEnergy.OpenVpnCertificatesServer.PKI; -using System.Diagnostics; +using System.Diagnostics; using System.Text; using Flurl; using ICSharpCode.SharpZipLib.Tar; +using InnovEnergy.App.OpenVpnCertificatesServer.PKI; +using InnovEnergy.Lib.Utils; +using InnovEnergy.Lib.Victron.VictronVRM; using Org.BouncyCastle.Crypto; +using static InnovEnergy.App.OpenVpnCertificatesServer.PKI.CertificateAuthority; -using static InnovEnergy.OpenVpnCertificatesServer.PKI.CertificateAuthority; - -namespace InnovEnergy.OpenVpnCertificatesServer; +namespace InnovEnergy.App.OpenVpnCertificatesServer; // dotnet publish OpenVpnCertificatesServer.csproj -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained true && scp bin/Release/net6.0/linux-x64/publish/OpenVpnCertificatesServer ig@salidomo.innovenergy.ch:~/get_cert/get_cert diff --git a/csharp/app/OpenVpnCertificatesServer/Utils.cs b/csharp/App/OpenVpnCertificatesServer/Utils.cs similarity index 95% rename from csharp/app/OpenVpnCertificatesServer/Utils.cs rename to csharp/App/OpenVpnCertificatesServer/Utils.cs index 9ed8734f7..aea6faf59 100644 --- a/csharp/app/OpenVpnCertificatesServer/Utils.cs +++ b/csharp/App/OpenVpnCertificatesServer/Utils.cs @@ -1,9 +1,8 @@ -namespace InnovEnergy.OpenVpnCertificatesServer; - -using System; using System.Text; using ICSharpCode.SharpZipLib.Tar; +namespace InnovEnergy.App.OpenVpnCertificatesServer; + public static class Utils { public static void WriteFile(this TarOutputStream tar, String fileName, Byte[] contents, Boolean executable = false) diff --git a/csharp/app/RemoteSupportConsole/Login.cs b/csharp/App/RemoteSupportConsole/Login.cs similarity index 77% rename from csharp/app/RemoteSupportConsole/Login.cs rename to csharp/App/RemoteSupportConsole/Login.cs index 901fd7175..7e3edbe35 100644 --- a/csharp/app/RemoteSupportConsole/Login.cs +++ b/csharp/App/RemoteSupportConsole/Login.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.RemoteSupportConsole; +namespace InnovEnergy.App.RemoteSupportConsole; public static class Login { diff --git a/csharp/app/RemoteSupportConsole/ObservablePipeSource.cs b/csharp/App/RemoteSupportConsole/ObservablePipeSource.cs similarity index 91% rename from csharp/app/RemoteSupportConsole/ObservablePipeSource.cs rename to csharp/App/RemoteSupportConsole/ObservablePipeSource.cs index 281ee75f4..a5e1af9d7 100644 --- a/csharp/app/RemoteSupportConsole/ObservablePipeSource.cs +++ b/csharp/App/RemoteSupportConsole/ObservablePipeSource.cs @@ -2,7 +2,7 @@ using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using CliWrap; -namespace InnovEnergy.RemoteSupportConsole; +namespace InnovEnergy.App.RemoteSupportConsole; public static class ObservablePipeSource { diff --git a/csharp/app/RemoteSupportConsole/Program.cs b/csharp/App/RemoteSupportConsole/Program.cs similarity index 99% rename from csharp/app/RemoteSupportConsole/Program.cs rename to csharp/App/RemoteSupportConsole/Program.cs index bd21d71d0..7ce5cbdcd 100644 --- a/csharp/app/RemoteSupportConsole/Program.cs +++ b/csharp/App/RemoteSupportConsole/Program.cs @@ -4,7 +4,7 @@ using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Victron.VictronVRM; using static System.Globalization.CompareOptions; -namespace InnovEnergy.RemoteSupportConsole; +namespace InnovEnergy.App.RemoteSupportConsole; // dotnet publish -c release -r ubuntu-x64 // dotnet publish RemoteSupportConsole.csproj -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained true diff --git a/csharp/app/RemoteSupportConsole/RemoteSupportConsole.csproj b/csharp/App/RemoteSupportConsole/RemoteSupportConsole.csproj similarity index 56% rename from csharp/app/RemoteSupportConsole/RemoteSupportConsole.csproj rename to csharp/App/RemoteSupportConsole/RemoteSupportConsole.csproj index 3a4a4aaa3..c00eed4bb 100644 --- a/csharp/app/RemoteSupportConsole/RemoteSupportConsole.csproj +++ b/csharp/App/RemoteSupportConsole/RemoteSupportConsole.csproj @@ -1,13 +1,9 @@ - - - - InnovEnergy.RemoteSupportConsole - + - - + + diff --git a/csharp/app/RemoteSupportConsole/RemoteSupportConsole.csproj.DotSettings b/csharp/App/RemoteSupportConsole/RemoteSupportConsole.csproj.DotSettings similarity index 100% rename from csharp/app/RemoteSupportConsole/RemoteSupportConsole.csproj.DotSettings rename to csharp/App/RemoteSupportConsole/RemoteSupportConsole.csproj.DotSettings diff --git a/csharp/app/RemoteSupportConsole/Ssh.cs b/csharp/App/RemoteSupportConsole/Ssh.cs similarity index 96% rename from csharp/app/RemoteSupportConsole/Ssh.cs rename to csharp/App/RemoteSupportConsole/Ssh.cs index 55502ecb7..d9acc9662 100644 --- a/csharp/app/RemoteSupportConsole/Ssh.cs +++ b/csharp/App/RemoteSupportConsole/Ssh.cs @@ -1,7 +1,7 @@ using CliWrap; using InnovEnergy.Lib.Utils; -namespace InnovEnergy.RemoteSupportConsole; +namespace InnovEnergy.App.RemoteSupportConsole; public static class Ssh { diff --git a/csharp/app/RemoteSupportConsole/VpnConnection.cs b/csharp/App/RemoteSupportConsole/VpnConnection.cs similarity index 94% rename from csharp/app/RemoteSupportConsole/VpnConnection.cs rename to csharp/App/RemoteSupportConsole/VpnConnection.cs index 29f52b40c..b2442eea1 100644 --- a/csharp/app/RemoteSupportConsole/VpnConnection.cs +++ b/csharp/App/RemoteSupportConsole/VpnConnection.cs @@ -2,7 +2,7 @@ using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Victron.VictronVRM; using static System.ConsoleColor; -namespace InnovEnergy.RemoteSupportConsole; +namespace InnovEnergy.App.RemoteSupportConsole; public static class VpnConnection { diff --git a/csharp/app/RemoteSupportConsole/VpnInfo.cs b/csharp/App/RemoteSupportConsole/VpnInfo.cs similarity index 95% rename from csharp/app/RemoteSupportConsole/VpnInfo.cs rename to csharp/App/RemoteSupportConsole/VpnInfo.cs index d7f39fbbc..0137a3b50 100644 --- a/csharp/app/RemoteSupportConsole/VpnInfo.cs +++ b/csharp/App/RemoteSupportConsole/VpnInfo.cs @@ -2,7 +2,7 @@ using Flurl; using Flurl.Http; using InnovEnergy.Lib.Utils; -namespace InnovEnergy.RemoteSupportConsole; +namespace InnovEnergy.App.RemoteSupportConsole; public static class VpnInfo { diff --git a/csharp/app/RemoteSupportConsole/VrmConnection.cs b/csharp/App/RemoteSupportConsole/VrmConnection.cs similarity index 98% rename from csharp/app/RemoteSupportConsole/VrmConnection.cs rename to csharp/App/RemoteSupportConsole/VrmConnection.cs index 52515a025..03dd1e252 100644 --- a/csharp/app/RemoteSupportConsole/VrmConnection.cs +++ b/csharp/App/RemoteSupportConsole/VrmConnection.cs @@ -7,7 +7,7 @@ using InnovEnergy.Lib.Victron.VictronVRM; using static System.ConsoleColor; using static System.StringSplitOptions; -namespace InnovEnergy.RemoteSupportConsole; +namespace InnovEnergy.App.RemoteSupportConsole; public static class VrmConnection { diff --git a/csharp/app/RemoteSupportConsole/VrmInfo.cs b/csharp/App/RemoteSupportConsole/VrmInfo.cs similarity index 96% rename from csharp/app/RemoteSupportConsole/VrmInfo.cs rename to csharp/App/RemoteSupportConsole/VrmInfo.cs index 9b37d00fc..32568ae23 100644 --- a/csharp/app/RemoteSupportConsole/VrmInfo.cs +++ b/csharp/App/RemoteSupportConsole/VrmInfo.cs @@ -3,7 +3,7 @@ using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Victron.VictronVRM; using static System.ConsoleColor; -namespace InnovEnergy.RemoteSupportConsole; +namespace InnovEnergy.App.RemoteSupportConsole; public static class VrmInfo diff --git a/csharp/app/RemoteSupportConsole/VrmProxy.cs b/csharp/App/RemoteSupportConsole/VrmProxy.cs similarity index 77% rename from csharp/app/RemoteSupportConsole/VrmProxy.cs rename to csharp/App/RemoteSupportConsole/VrmProxy.cs index cc00370c5..c629c5476 100644 --- a/csharp/app/RemoteSupportConsole/VrmProxy.cs +++ b/csharp/App/RemoteSupportConsole/VrmProxy.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.RemoteSupportConsole; +namespace InnovEnergy.App.RemoteSupportConsole; public readonly record struct VrmProxy(IDisposable Connection, String User, String Host, String Port) : IDisposable { diff --git a/csharp/App/SaliMax/SaliMax.csproj b/csharp/App/SaliMax/SaliMax.csproj new file mode 100644 index 000000000..c647ee0d5 --- /dev/null +++ b/csharp/App/SaliMax/SaliMax.csproj @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/app/SaliMax/run (BeagleBone Meiringen).sh b/csharp/App/SaliMax/run (BeagleBone Meiringen).sh similarity index 100% rename from csharp/app/SaliMax/run (BeagleBone Meiringen).sh rename to csharp/App/SaliMax/run (BeagleBone Meiringen).sh diff --git a/csharp/app/SaliMax/src/AsciiArt.cs b/csharp/App/SaliMax/src/AsciiArt.cs similarity index 98% rename from csharp/app/SaliMax/src/AsciiArt.cs rename to csharp/App/SaliMax/src/AsciiArt.cs index c8ffc4596..7485a1363 100644 --- a/csharp/app/SaliMax/src/AsciiArt.cs +++ b/csharp/App/SaliMax/src/AsciiArt.cs @@ -1,6 +1,6 @@ using InnovEnergy.Lib.Utils; -namespace InnovEnergy.SaliMax; +namespace InnovEnergy.App.SaliMax; public static class AsciiArt { diff --git a/csharp/app/SaliMax/src/BusPort.cs b/csharp/App/SaliMax/src/BusPort.cs similarity index 66% rename from csharp/app/SaliMax/src/BusPort.cs rename to csharp/App/SaliMax/src/BusPort.cs index 20fc1c9a6..e8cbd649b 100644 --- a/csharp/app/SaliMax/src/BusPort.cs +++ b/csharp/App/SaliMax/src/BusPort.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.SaliMax; +namespace InnovEnergy.App.SaliMax; public enum BusPort { diff --git a/csharp/app/SaliMax/src/Controller/AvgBatteriesStatus.cs b/csharp/App/SaliMax/src/Controller/AvgBatteriesStatus.cs similarity index 98% rename from csharp/app/SaliMax/src/Controller/AvgBatteriesStatus.cs rename to csharp/App/SaliMax/src/Controller/AvgBatteriesStatus.cs index 7b90a6640..b62316d85 100644 --- a/csharp/app/SaliMax/src/Controller/AvgBatteriesStatus.cs +++ b/csharp/App/SaliMax/src/Controller/AvgBatteriesStatus.cs @@ -1,6 +1,6 @@ using InnovEnergy.Lib.Devices.Battery48TL; -namespace InnovEnergy.SaliMax.Controller; +namespace InnovEnergy.App.SaliMax.Controller; public class AvgBatteriesStatus { diff --git a/csharp/app/SaliMax/src/Controller/Control.cs b/csharp/App/SaliMax/src/Controller/Control.cs similarity index 94% rename from csharp/app/SaliMax/src/Controller/Control.cs rename to csharp/App/SaliMax/src/Controller/Control.cs index 144e2b166..08589edb5 100644 --- a/csharp/app/SaliMax/src/Controller/Control.cs +++ b/csharp/App/SaliMax/src/Controller/Control.cs @@ -1,6 +1,4 @@ -using static InnovEnergy.SaliMax.SystemConfig.SalimaxConfig; - -namespace InnovEnergy.SaliMax.Controller; +namespace InnovEnergy.App.SaliMax.Controller; public static class Control { diff --git a/csharp/app/SaliMax/src/Controller/ControlRecord.cs b/csharp/App/SaliMax/src/Controller/ControlRecord.cs similarity index 78% rename from csharp/app/SaliMax/src/Controller/ControlRecord.cs rename to csharp/App/SaliMax/src/Controller/ControlRecord.cs index c00373efb..ce7e4fc8f 100644 --- a/csharp/app/SaliMax/src/Controller/ControlRecord.cs +++ b/csharp/App/SaliMax/src/Controller/ControlRecord.cs @@ -1,9 +1,9 @@ +using InnovEnergy.App.SaliMax.SaliMaxRelays; +using InnovEnergy.App.SaliMax.SystemConfig; using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc; using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc; -using InnovEnergy.SaliMax.SaliMaxRelays; -using InnovEnergy.SaliMax.SystemConfig; -namespace InnovEnergy.SaliMax.Controller; +namespace InnovEnergy.App.SaliMax.Controller; public class ControlRecord { diff --git a/csharp/app/SaliMax/src/Controller/ControlTarget.cs b/csharp/App/SaliMax/src/Controller/ControlTarget.cs similarity index 76% rename from csharp/app/SaliMax/src/Controller/ControlTarget.cs rename to csharp/App/SaliMax/src/Controller/ControlTarget.cs index d08fa47ab..1e279f8d3 100644 --- a/csharp/app/SaliMax/src/Controller/ControlTarget.cs +++ b/csharp/App/SaliMax/src/Controller/ControlTarget.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.SaliMax.Controller; +namespace InnovEnergy.App.SaliMax.Controller; public enum ControlTarget // TODO to delete { diff --git a/csharp/app/SaliMax/src/Controller/Controller.cs b/csharp/App/SaliMax/src/Controller/Controller.cs similarity index 98% rename from csharp/app/SaliMax/src/Controller/Controller.cs rename to csharp/App/SaliMax/src/Controller/Controller.cs index e578c5b2d..cadb47477 100644 --- a/csharp/app/SaliMax/src/Controller/Controller.cs +++ b/csharp/App/SaliMax/src/Controller/Controller.cs @@ -1,14 +1,14 @@ +using InnovEnergy.App.SaliMax.SaliMaxRelays; +using InnovEnergy.App.SaliMax.SystemConfig; using InnovEnergy.Lib.Devices.Trumpf.TruConvert; using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc; using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc; +using InnovEnergy.Lib.Time.Unix; using InnovEnergy.Lib.Utils; -using InnovEnergy.SaliMax.SaliMaxRelays; -using InnovEnergy.SaliMax.SystemConfig; -using InnovEnergy.Time.Unix; -using static InnovEnergy.SaliMax.SaliMaxRelays.RelayState; +using static InnovEnergy.App.SaliMax.SaliMaxRelays.RelayState; -namespace InnovEnergy.SaliMax.Controller; +namespace InnovEnergy.App.SaliMax.Controller; public static class Controller { diff --git a/csharp/app/SaliMax/src/Controller/SaliMaxState.cs b/csharp/App/SaliMax/src/Controller/SaliMaxState.cs similarity index 84% rename from csharp/app/SaliMax/src/Controller/SaliMaxState.cs rename to csharp/App/SaliMax/src/Controller/SaliMaxState.cs index cd81b24b5..be7470fae 100644 --- a/csharp/app/SaliMax/src/Controller/SaliMaxState.cs +++ b/csharp/App/SaliMax/src/Controller/SaliMaxState.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.SaliMax.Controller; +namespace InnovEnergy.App.SaliMax.Controller; public struct SaliMaxState { diff --git a/csharp/app/SaliMax/src/Controller/State.cs b/csharp/App/SaliMax/src/Controller/State.cs similarity index 92% rename from csharp/app/SaliMax/src/Controller/State.cs rename to csharp/App/SaliMax/src/Controller/State.cs index a8ad8d11b..7634d1d66 100644 --- a/csharp/app/SaliMax/src/Controller/State.cs +++ b/csharp/App/SaliMax/src/Controller/State.cs @@ -1,5 +1,5 @@ -namespace InnovEnergy.SaliMax.Controller; +namespace InnovEnergy.App.SaliMax.Controller; public enum State : Int16 { diff --git a/csharp/app/SaliMax/src/Controller/StateConfig.cs b/csharp/App/SaliMax/src/Controller/StateConfig.cs similarity index 79% rename from csharp/app/SaliMax/src/Controller/StateConfig.cs rename to csharp/App/SaliMax/src/Controller/StateConfig.cs index be40aafc0..ce356d311 100644 --- a/csharp/app/SaliMax/src/Controller/StateConfig.cs +++ b/csharp/App/SaliMax/src/Controller/StateConfig.cs @@ -1,5 +1,5 @@ -namespace InnovEnergy.SaliMax.Controller; +namespace InnovEnergy.App.SaliMax.Controller; public static class StateConfig { diff --git a/csharp/app/SaliMax/src/Controller/StatusRecord.cs b/csharp/App/SaliMax/src/Controller/StatusRecord.cs similarity index 84% rename from csharp/app/SaliMax/src/Controller/StatusRecord.cs rename to csharp/App/SaliMax/src/Controller/StatusRecord.cs index 0969b841b..53de658b8 100644 --- a/csharp/app/SaliMax/src/Controller/StatusRecord.cs +++ b/csharp/App/SaliMax/src/Controller/StatusRecord.cs @@ -1,12 +1,12 @@ -using InnovEnergy.Lib.Devices.Ampt; +using InnovEnergy.App.SaliMax.SaliMaxRelays; +using InnovEnergy.App.SaliMax.SystemConfig; +using InnovEnergy.Lib.Devices.AMPT; using InnovEnergy.Lib.Devices.Battery48TL; using InnovEnergy.Lib.Devices.EmuMeter; using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc; using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc; -using InnovEnergy.SaliMax.SaliMaxRelays; -using InnovEnergy.SaliMax.SystemConfig; -namespace InnovEnergy.SaliMax.Controller; +namespace InnovEnergy.App.SaliMax.Controller; public record StatusRecord { diff --git a/csharp/app/SaliMax/src/Log/Ampt.cs b/csharp/App/SaliMax/src/Log/Ampt.cs similarity index 90% rename from csharp/app/SaliMax/src/Log/Ampt.cs rename to csharp/App/SaliMax/src/Log/Ampt.cs index 1a63b9eab..efaa6e388 100644 --- a/csharp/app/SaliMax/src/Log/Ampt.cs +++ b/csharp/App/SaliMax/src/Log/Ampt.cs @@ -1,8 +1,8 @@ using System.Text.Json.Nodes; -using InnovEnergy.Lib.Devices.Ampt; +using InnovEnergy.Lib.Devices.AMPT; using InnovEnergy.Lib.StatusApi; -namespace InnovEnergy.SaliMax.Log; +namespace InnovEnergy.App.SaliMax.Log; public static class Ampt { diff --git a/csharp/app/SaliMax/src/Log/Battery48Tl.cs b/csharp/App/SaliMax/src/Log/Battery48Tl.cs similarity index 95% rename from csharp/app/SaliMax/src/Log/Battery48Tl.cs rename to csharp/App/SaliMax/src/Log/Battery48Tl.cs index db755c78d..f2c85bcbf 100644 --- a/csharp/app/SaliMax/src/Log/Battery48Tl.cs +++ b/csharp/App/SaliMax/src/Log/Battery48Tl.cs @@ -2,7 +2,7 @@ using System.Text.Json.Nodes; using InnovEnergy.Lib.Devices.Battery48TL; using InnovEnergy.Lib.StatusApi; -namespace InnovEnergy.SaliMax.Log; +namespace InnovEnergy.App.SaliMax.Log; public static class Battery48Tl { diff --git a/csharp/app/SaliMax/src/Log/EmuMeter.cs b/csharp/App/SaliMax/src/Log/EmuMeter.cs similarity index 94% rename from csharp/app/SaliMax/src/Log/EmuMeter.cs rename to csharp/App/SaliMax/src/Log/EmuMeter.cs index 8b61199cf..bb5dbbf29 100644 --- a/csharp/app/SaliMax/src/Log/EmuMeter.cs +++ b/csharp/App/SaliMax/src/Log/EmuMeter.cs @@ -3,9 +3,9 @@ using InnovEnergy.Lib.Devices.EmuMeter; using InnovEnergy.Lib.StatusApi; using InnovEnergy.Lib.Utils; using static DecimalMath.DecimalEx; -using static InnovEnergy.SaliMax.Log.JsonUtil; +using static InnovEnergy.App.SaliMax.Log.JsonUtil; -namespace InnovEnergy.SaliMax.Log; +namespace InnovEnergy.App.SaliMax.Log; public static class EmuMeter { diff --git a/csharp/app/SaliMax/src/Log/JsonUtil.cs b/csharp/App/SaliMax/src/Log/JsonUtil.cs similarity index 98% rename from csharp/app/SaliMax/src/Log/JsonUtil.cs rename to csharp/App/SaliMax/src/Log/JsonUtil.cs index 3201cb9b5..e82f2af01 100644 --- a/csharp/app/SaliMax/src/Log/JsonUtil.cs +++ b/csharp/App/SaliMax/src/Log/JsonUtil.cs @@ -1,7 +1,7 @@ using System.Text.Json.Nodes; using InnovEnergy.Lib.StatusApi; -namespace InnovEnergy.SaliMax.Log; +namespace InnovEnergy.App.SaliMax.Log; public static class JsonUtil { diff --git a/csharp/app/SaliMax/src/Log/Salimax.cs b/csharp/App/SaliMax/src/Log/Salimax.cs similarity index 96% rename from csharp/app/SaliMax/src/Log/Salimax.cs rename to csharp/App/SaliMax/src/Log/Salimax.cs index 76bd25648..09a7de12f 100644 --- a/csharp/app/SaliMax/src/Log/Salimax.cs +++ b/csharp/App/SaliMax/src/Log/Salimax.cs @@ -1,9 +1,9 @@ using System.Text.Json.Nodes; +using InnovEnergy.App.SaliMax.Controller; using InnovEnergy.Lib.StatusApi; -using InnovEnergy.SaliMax.Controller; -using InnovEnergy.Time.Unix; +using InnovEnergy.Lib.Time.Unix; -namespace InnovEnergy.SaliMax.Log; +namespace InnovEnergy.App.SaliMax.Log; public static class Salimax { diff --git a/csharp/app/SaliMax/src/Log/TruConvertAc.cs b/csharp/App/SaliMax/src/Log/TruConvertAc.cs similarity index 96% rename from csharp/app/SaliMax/src/Log/TruConvertAc.cs rename to csharp/App/SaliMax/src/Log/TruConvertAc.cs index eeb56ea4c..af49cbc66 100644 --- a/csharp/app/SaliMax/src/Log/TruConvertAc.cs +++ b/csharp/App/SaliMax/src/Log/TruConvertAc.cs @@ -2,9 +2,9 @@ using System.Text.Json.Nodes; using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc; using InnovEnergy.Lib.Utils; using static DecimalMath.DecimalEx; -using static InnovEnergy.SaliMax.Log.JsonUtil; +using static InnovEnergy.App.SaliMax.Log.JsonUtil; -namespace InnovEnergy.SaliMax.Log; +namespace InnovEnergy.App.SaliMax.Log; public static class TruConvertAc { diff --git a/csharp/app/SaliMax/src/Log/TruConvertDc.cs b/csharp/App/SaliMax/src/Log/TruConvertDc.cs similarity index 89% rename from csharp/app/SaliMax/src/Log/TruConvertDc.cs rename to csharp/App/SaliMax/src/Log/TruConvertDc.cs index 09e39d1f2..34c23942b 100644 --- a/csharp/app/SaliMax/src/Log/TruConvertDc.cs +++ b/csharp/App/SaliMax/src/Log/TruConvertDc.cs @@ -1,8 +1,8 @@ using System.Text.Json.Nodes; using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc; -using static InnovEnergy.SaliMax.Log.JsonUtil; +using static InnovEnergy.App.SaliMax.Log.JsonUtil; -namespace InnovEnergy.SaliMax.Log; +namespace InnovEnergy.App.SaliMax.Log; using JO = JsonObject; diff --git a/csharp/app/SaliMax/src/Program.cs b/csharp/App/SaliMax/src/Program.cs similarity index 96% rename from csharp/app/SaliMax/src/Program.cs rename to csharp/App/SaliMax/src/Program.cs index 0734b5b6f..229e3f0b8 100644 --- a/csharp/app/SaliMax/src/Program.cs +++ b/csharp/App/SaliMax/src/Program.cs @@ -1,27 +1,23 @@ - - - using System.Diagnostics; using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; using Flurl.Http; +using InnovEnergy.App.SaliMax.Controller; +using InnovEnergy.App.SaliMax.Log; +using InnovEnergy.App.SaliMax.SaliMaxRelays; +using InnovEnergy.App.SaliMax.SystemConfig; +using InnovEnergy.Lib.Devices.AMPT; +using InnovEnergy.Lib.Devices.Battery48TL; using InnovEnergy.Lib.Devices.EmuMeter; using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc; using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc; -using InnovEnergy.Lib.Devices.Ampt; -using InnovEnergy.Lib.Devices.Battery48TL; -using InnovEnergy.SaliMax.Controller; -using InnovEnergy.SaliMax.Log; -using InnovEnergy.SaliMax.SaliMaxRelays; -using InnovEnergy.SaliMax.SystemConfig; -using InnovEnergy.Time.Unix; - +using InnovEnergy.Lib.Time.Unix; #pragma warning disable IL2026 -namespace InnovEnergy.SaliMax; +namespace InnovEnergy.App.SaliMax; internal static class Program { diff --git a/csharp/app/SaliMax/src/S3Config.cs b/csharp/App/SaliMax/src/S3Config.cs similarity index 98% rename from csharp/app/SaliMax/src/S3Config.cs rename to csharp/App/SaliMax/src/S3Config.cs index 92238fb96..2e04acd81 100644 --- a/csharp/app/SaliMax/src/S3Config.cs +++ b/csharp/App/SaliMax/src/S3Config.cs @@ -5,7 +5,7 @@ using InnovEnergy.Lib.Utils; using static System.Text.Encoding; using Convert = System.Convert; -namespace InnovEnergy.SaliMax; +namespace InnovEnergy.App.SaliMax; public record S3Config { diff --git a/csharp/app/SaliMax/src/SaliMaxRelays/RelayMapBoolean.cs b/csharp/App/SaliMax/src/SaliMaxRelays/RelayMapBoolean.cs similarity index 53% rename from csharp/app/SaliMax/src/SaliMaxRelays/RelayMapBoolean.cs rename to csharp/App/SaliMax/src/SaliMaxRelays/RelayMapBoolean.cs index c1408c2ff..bafd76793 100644 --- a/csharp/app/SaliMax/src/SaliMaxRelays/RelayMapBoolean.cs +++ b/csharp/App/SaliMax/src/SaliMaxRelays/RelayMapBoolean.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.SaliMax.SaliMaxRelays; +namespace InnovEnergy.App.SaliMax.SaliMaxRelays; public enum RelayState { diff --git a/csharp/app/SaliMax/src/SaliMaxRelays/SaliMaxRelaysDevice.cs b/csharp/App/SaliMax/src/SaliMaxRelays/SaliMaxRelaysDevice.cs similarity index 95% rename from csharp/app/SaliMax/src/SaliMaxRelays/SaliMaxRelaysDevice.cs rename to csharp/App/SaliMax/src/SaliMaxRelays/SaliMaxRelaysDevice.cs index 5fb1b8a69..4b5db1e06 100644 --- a/csharp/app/SaliMax/src/SaliMaxRelays/SaliMaxRelaysDevice.cs +++ b/csharp/App/SaliMax/src/SaliMaxRelays/SaliMaxRelaysDevice.cs @@ -1,7 +1,7 @@ using InnovEnergy.Lib.Devices.Adam6060; using InnovEnergy.Lib.Utils; -namespace InnovEnergy.SaliMax.SaliMaxRelays; +namespace InnovEnergy.App.SaliMax.SaliMaxRelays; public class SaliMaxRelaysDevice { diff --git a/csharp/app/SaliMax/src/SaliMaxRelays/SaliMaxRelaysStatus.cs b/csharp/App/SaliMax/src/SaliMaxRelays/SaliMaxRelaysStatus.cs similarity index 86% rename from csharp/app/SaliMax/src/SaliMaxRelays/SaliMaxRelaysStatus.cs rename to csharp/App/SaliMax/src/SaliMaxRelays/SaliMaxRelaysStatus.cs index 64c08b992..915896d54 100644 --- a/csharp/app/SaliMax/src/SaliMaxRelays/SaliMaxRelaysStatus.cs +++ b/csharp/App/SaliMax/src/SaliMaxRelays/SaliMaxRelaysStatus.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.SaliMax.SaliMaxRelays; +namespace InnovEnergy.App.SaliMax.SaliMaxRelays; public record SaliMaxRelayStatus { diff --git a/csharp/app/SaliMax/src/SystemConfig/Config.cs b/csharp/App/SaliMax/src/SystemConfig/Config.cs similarity index 73% rename from csharp/app/SaliMax/src/SystemConfig/Config.cs rename to csharp/App/SaliMax/src/SystemConfig/Config.cs index c11f7d6f7..73e42897a 100644 --- a/csharp/app/SaliMax/src/SystemConfig/Config.cs +++ b/csharp/App/SaliMax/src/SystemConfig/Config.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.SaliMax.SystemConfig; +namespace InnovEnergy.App.SaliMax.SystemConfig; public static class Config { diff --git a/csharp/app/SaliMax/src/SystemConfig/Defaults.cs b/csharp/App/SaliMax/src/SystemConfig/Defaults.cs similarity index 99% rename from csharp/app/SaliMax/src/SystemConfig/Defaults.cs rename to csharp/App/SaliMax/src/SystemConfig/Defaults.cs index 6b11b6ad1..1fcb95d25 100644 --- a/csharp/app/SaliMax/src/SystemConfig/Defaults.cs +++ b/csharp/App/SaliMax/src/SystemConfig/Defaults.cs @@ -1,7 +1,7 @@ using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc; using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc; -namespace InnovEnergy.SaliMax.SystemConfig; +namespace InnovEnergy.App.SaliMax.SystemConfig; public static class Defaults { diff --git a/csharp/app/SaliMax/src/SystemConfig/SalimaxConfig.cs b/csharp/App/SaliMax/src/SystemConfig/SalimaxConfig.cs similarity index 96% rename from csharp/app/SaliMax/src/SystemConfig/SalimaxConfig.cs rename to csharp/App/SaliMax/src/SystemConfig/SalimaxConfig.cs index 79d01fdd5..2170783e3 100644 --- a/csharp/app/SaliMax/src/SystemConfig/SalimaxConfig.cs +++ b/csharp/App/SaliMax/src/SystemConfig/SalimaxConfig.cs @@ -1,9 +1,9 @@ using System.Text.Json; +using InnovEnergy.Lib.Time.Unix; using InnovEnergy.Lib.Utils; -using InnovEnergy.Time.Unix; using static System.Text.Json.JsonSerializer; -namespace InnovEnergy.SaliMax.SystemConfig; +namespace InnovEnergy.App.SaliMax.SystemConfig; // shut up trim warnings #pragma warning disable IL2026 diff --git a/csharp/app/SaliMax/src/Topology.cs b/csharp/App/SaliMax/src/Topology.cs similarity index 98% rename from csharp/app/SaliMax/src/Topology.cs rename to csharp/App/SaliMax/src/Topology.cs index ab8a26ee9..f9db2b68b 100644 --- a/csharp/app/SaliMax/src/Topology.cs +++ b/csharp/App/SaliMax/src/Topology.cs @@ -1,10 +1,10 @@ -#undef BatteriesAllowed +#undef BatteriesAllowed +using InnovEnergy.App.SaliMax.Controller; +using InnovEnergy.App.SaliMax.Log; using InnovEnergy.Lib.Utils; -using InnovEnergy.SaliMax.Controller; -using InnovEnergy.SaliMax.Log; -namespace InnovEnergy.SaliMax; +namespace InnovEnergy.App.SaliMax; public static class Topology { diff --git a/csharp/app/SaliMax/src/Utils.cs b/csharp/App/SaliMax/src/Utils.cs similarity index 83% rename from csharp/app/SaliMax/src/Utils.cs rename to csharp/App/SaliMax/src/Utils.cs index 337502413..4104b5384 100644 --- a/csharp/app/SaliMax/src/Utils.cs +++ b/csharp/App/SaliMax/src/Utils.cs @@ -1,6 +1,6 @@ using InnovEnergy.Lib.Utils; -namespace InnovEnergy.SaliMax; +namespace InnovEnergy.App.SaliMax; public static class Utils { diff --git a/csharp/app/SaliMax/tunnels.html b/csharp/App/SaliMax/tunnels.html similarity index 100% rename from csharp/app/SaliMax/tunnels.html rename to csharp/App/SaliMax/tunnels.html diff --git a/csharp/app/SaliMax/tunnels.sh b/csharp/App/SaliMax/tunnels.sh similarity index 100% rename from csharp/app/SaliMax/tunnels.sh rename to csharp/App/SaliMax/tunnels.sh diff --git a/csharp/InnovEnergy.props b/csharp/InnovEnergy.props index 57ac5931e..5a4943931 100644 --- a/csharp/InnovEnergy.props +++ b/csharp/InnovEnergy.props @@ -3,13 +3,14 @@ InnovEnergy enable - default + preview true - InnovEnergy enable net6.0 true false + $(Company).$(MSBuildProjectDirectory.Replace($(SolutionDir), "").Replace("src/", "").Replace("/",".")) + $(Company) Team diff --git a/csharp/InnovEnergy.sln b/csharp/InnovEnergy.sln index 69f33a105..8d368b9cb 100644 --- a/csharp/InnovEnergy.sln +++ b/csharp/InnovEnergy.sln @@ -1,32 +1,28 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Collector", "app/Collector/Collector.csproj", "{E3A5F3A3-72A5-47CC-85C6-2D8E962A0EC1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Collector", "App/Collector/Collector.csproj", "{E3A5F3A3-72A5-47CC-85C6-2D8E962A0EC1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenVpnCertificatesServer", "app/OpenVpnCertificatesServer/OpenVpnCertificatesServer.csproj", "{CF4834CB-91B7-4172-AC13-ECDA8613CD17}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenVpnCertificatesServer", "App/OpenVpnCertificatesServer/OpenVpnCertificatesServer.csproj", "{CF4834CB-91B7-4172-AC13-ECDA8613CD17}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteSupportConsole", "app/RemoteSupportConsole/RemoteSupportConsole.csproj", "{B1268C03-66EB-4486-8BFC-B439225D9D54}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteSupportConsole", "App/RemoteSupportConsole/RemoteSupportConsole.csproj", "{B1268C03-66EB-4486-8BFC-B439225D9D54}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SysTools", "lib/SysTools/SysTools.csproj", "{4A67D79F-F0C9-4BBC-9601-D5948E6C05D3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SysTools", "Lib/SysTools/SysTools.csproj", "{4A67D79F-F0C9-4BBC-9601-D5948E6C05D3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServer", "lib/WebServer/WebServer.csproj", "{B2627B9F-41DF-44F7-A0D1-CA71FF4A007A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServer", "Lib/WebServer/WebServer.csproj", "{B2627B9F-41DF-44F7-A0D1-CA71FF4A007A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Time", "lib/Time/Time.csproj", "{442A8366-C177-48FE-84A7-BDF6470A09FF}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Time", "Lib/Time/Time.csproj", "{442A8366-C177-48FE-84A7-BDF6470A09FF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmuMeterDriver", "app/EmuMeterDriver/EmuMeterDriver.csproj", "{F65F33B0-3522-4008-8D1E-47EF8E4C7AC7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmuMeterDriver", "App/EmuMeterDriver/EmuMeterDriver.csproj", "{F65F33B0-3522-4008-8D1E-47EF8E4C7AC7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BmsTunnel", "app/BmsTunnel/BmsTunnel.csproj", "{40B45363-BE34-420B-8F87-775EE6EE3513}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BmsTunnel", "App/BmsTunnel/BmsTunnel.csproj", "{40B45363-BE34-420B-8F87-775EE6EE3513}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "app", "app", "{145597B4-3E30-45E6-9F72-4DD43194539A}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "App", "App", "{145597B4-3E30-45E6-9F72-4DD43194539A}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "S3", "lib/S3/S3.csproj", "{C3639841-13F4-4F24-99C6-7D965593BF89}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaliMax", "App/SaliMax/SaliMax.csproj", "{25073794-D859-4824-9984-194C7E928496}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "deprecated", "deprecated", "{46DE03C4-52D1-47AA-8E60-8BB15361D723}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaliMax", "app/SaliMax/SaliMax.csproj", "{25073794-D859-4824-9984-194C7E928496}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StatusApi", "lib/StatusApi/StatusApi.csproj", "{9D17E78C-8A70-43DB-A619-DC12D20D023D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StatusApi", "Lib/StatusApi/StatusApi.csproj", "{9D17E78C-8A70-43DB-A619-DC12D20D023D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Devices", "Devices", "{4931A385-24DC-4E78-BFF4-356F8D6D5183}" EndProject @@ -36,37 +32,47 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Victron", "Victron", "{BD8C EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Trumpf", "Trumpf", "{DDDBEFD0-5DEA-4C7C-A9F2-FDB4636CF092}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TruConvert", "lib/Devices/Trumpf/TruConvert/TruConvert.csproj", "{EF46CF7B-823E-4CB7-966F-EDDC144C7954}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TruConvert", "Lib/Devices/Trumpf/TruConvert/TruConvert.csproj", "{EF46CF7B-823E-4CB7-966F-EDDC144C7954}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TruConvertAc", "lib/Devices/Trumpf/TruConvertAc/TruConvertAc.csproj", "{1F4B445E-459E-44CD-813E-6D725EBB81E8}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TruConvertAc", "Lib/Devices/Trumpf/TruConvertAc/TruConvertAc.csproj", "{1F4B445E-459E-44CD-813E-6D725EBB81E8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TruConvertDc", "lib/Devices/Trumpf/TruConvertDc/TruConvertDc.csproj", "{F6F29829-C31A-4994-A698-E441BEA631C6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TruConvertDc", "Lib/Devices/Trumpf/TruConvertDc/TruConvertDc.csproj", "{F6F29829-C31A-4994-A698-E441BEA631C6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DBus", "lib/Protocols/DBus/DBus.csproj", "{8C3C620A-087D-4DD6-B493-A47FC643F8DC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DBus", "Lib/Protocols/DBus/DBus.csproj", "{8C3C620A-087D-4DD6-B493-A47FC643F8DC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Modbus", "lib/Protocols/Modbus/Modbus.csproj", "{E4AE6A33-0DEB-48EB-9D57-C0C7C63FC267}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Modbus", "Lib/Protocols/Modbus/Modbus.csproj", "{E4AE6A33-0DEB-48EB-9D57-C0C7C63FC267}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VeDBus", "lib/Victron/VeDBus/VeDBus.csproj", "{50B26E29-1B99-4D07-BCA5-359CD550BBAA}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VeDBus", "Lib/Victron/VeDBus/VeDBus.csproj", "{50B26E29-1B99-4D07-BCA5-359CD550BBAA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VictronVRM", "lib/Victron/VictronVRM/VictronVRM.csproj", "{FE05DF69-B5C7-4C2E-8FB9-7776441A7622}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VictronVRM", "Lib/Victron/VictronVRM/VictronVRM.csproj", "{FE05DF69-B5C7-4C2E-8FB9-7776441A7622}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ampt", "lib/Devices/AMPT/Ampt.csproj", "{77AF3A64-2878-4150-BCD0-F16530783165}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ampt", "Lib/Devices/AMPT/Ampt.csproj", "{77AF3A64-2878-4150-BCD0-F16530783165}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Battery48TL", "lib/Devices/Battery48TL/Battery48TL.csproj", "{1C3F443A-B339-4B08-80E6-8A84817FFEC9}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Battery48TL", "Lib/Devices/Battery48TL/Battery48TL.csproj", "{1C3F443A-B339-4B08-80E6-8A84817FFEC9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmuMeter", "lib/Devices/EmuMeter/EmuMeter.csproj", "{152A4168-F612-493C-BBEA-8EB26E6E2D34}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmuMeter", "Lib/Devices/EmuMeter/EmuMeter.csproj", "{152A4168-F612-493C-BBEA-8EB26E6E2D34}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "lib/Utils/Utils.csproj", "{89A3E29C-4E57-47FE-A800-12AC68418264}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "Lib/Utils/Utils.csproj", "{89A3E29C-4E57-47FE-A800-12AC68418264}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adam6060", "lib/Devices/Adam6060/Adam6060.csproj", "{4AFDB799-E6A4-4DCA-8B6D-8C0F98398461}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adam6060", "Lib/Devices/Adam6060/Adam6060.csproj", "{4AFDB799-E6A4-4DCA-8B6D-8C0F98398461}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Channels", "lib/Channels/Channels.csproj", "{AF7E8DCA-8D48-498E-AB3D-208061B244DC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Channels", "Lib/Channels/Channels.csproj", "{AF7E8DCA-8D48-498E-AB3D-208061B244DC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Backend", "app/Backend/Backend.csproj", "{A56F58C2-B265-435B-A985-53B4D6F49B1A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Backend", "App/Backend/Backend.csproj", "{A56F58C2-B265-435B-A985-53B4D6F49B1A}" EndProject EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Units", "lib/Units/Units.csproj", "{C04FB6DA-23C6-46BB-9B21-8F4FBA32FFF7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Units", "Lib\Units\Units.csproj", "{C04FB6DA-23C6-46BB-9B21-8F4FBA32FFF7}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Meta", "Meta", "{AED84693-C389-44C9-B2C0-ACB560189CF2}" + ProjectSection(SolutionItems) = preProject + InnovEnergy.props = InnovEnergy.props + App\InnovEnergy.App.props = App\InnovEnergy.App.props + Lib\InnovEnergy.Lib.props = Lib\InnovEnergy.Lib.props + InnovEnergy.sln.DotSettings = InnovEnergy.sln.DotSettings + ..\.gitignore = ..\.gitignore + EndProjectSection +EndProject + Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -106,10 +112,6 @@ Global {40B45363-BE34-420B-8F87-775EE6EE3513}.Debug|Any CPU.Build.0 = Debug|Any CPU {40B45363-BE34-420B-8F87-775EE6EE3513}.Release|Any CPU.ActiveCfg = Release|Any CPU {40B45363-BE34-420B-8F87-775EE6EE3513}.Release|Any CPU.Build.0 = Release|Any CPU - {C3639841-13F4-4F24-99C6-7D965593BF89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C3639841-13F4-4F24-99C6-7D965593BF89}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C3639841-13F4-4F24-99C6-7D965593BF89}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C3639841-13F4-4F24-99C6-7D965593BF89}.Release|Any CPU.Build.0 = Release|Any CPU {25073794-D859-4824-9984-194C7E928496}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {25073794-D859-4824-9984-194C7E928496}.Debug|Any CPU.Build.0 = Debug|Any CPU {25073794-D859-4824-9984-194C7E928496}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -187,11 +189,8 @@ Global {B2627B9F-41DF-44F7-A0D1-CA71FF4A007A} = {AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854} {F65F33B0-3522-4008-8D1E-47EF8E4C7AC7} = {145597B4-3E30-45E6-9F72-4DD43194539A} {E3A5F3A3-72A5-47CC-85C6-2D8E962A0EC1} = {145597B4-3E30-45E6-9F72-4DD43194539A} - {46DE03C4-52D1-47AA-8E60-8BB15361D723} = {AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854} - {4A67D79F-F0C9-4BBC-9601-D5948E6C05D3} = {46DE03C4-52D1-47AA-8E60-8BB15361D723} {25073794-D859-4824-9984-194C7E928496} = {145597B4-3E30-45E6-9F72-4DD43194539A} {9D17E78C-8A70-43DB-A619-DC12D20D023D} = {AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854} - {C3639841-13F4-4F24-99C6-7D965593BF89} = {46DE03C4-52D1-47AA-8E60-8BB15361D723} {4931A385-24DC-4E78-BFF4-356F8D6D5183} = {AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854} {794FD07C-93E9-4803-982E-1CA261504AB5} = {AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854} {BD8CBC5C-0B9E-48A3-BC4E-725E3FAB2348} = {AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854} @@ -211,5 +210,6 @@ Global {AF7E8DCA-8D48-498E-AB3D-208061B244DC} = {AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854} {A56F58C2-B265-435B-A985-53B4D6F49B1A} = {145597B4-3E30-45E6-9F72-4DD43194539A} {C04FB6DA-23C6-46BB-9B21-8F4FBA32FFF7} = {AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854} + {4A67D79F-F0C9-4BBC-9601-D5948E6C05D3} = {AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854} EndGlobalSection EndGlobal diff --git a/csharp/InnovEnergy.sln.DotSettings b/csharp/InnovEnergy.sln.DotSettings index b1ba507d9..f48e450b2 100644 --- a/csharp/InnovEnergy.sln.DotSettings +++ b/csharp/InnovEnergy.sln.DotSettings @@ -1,6 +1,8 @@  - False + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + False + True True True @@ -33,4 +35,6 @@ True True True - True \ No newline at end of file + True + + \ No newline at end of file diff --git a/csharp/Lib/Channels/Channels.csproj b/csharp/Lib/Channels/Channels.csproj new file mode 100644 index 000000000..9eb898d4e --- /dev/null +++ b/csharp/Lib/Channels/Channels.csproj @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/csharp/lib/Channels/CloseAfter.cs b/csharp/Lib/Channels/CloseAfter.cs similarity index 100% rename from csharp/lib/Channels/CloseAfter.cs rename to csharp/Lib/Channels/CloseAfter.cs diff --git a/csharp/lib/Channels/Connection.cs b/csharp/Lib/Channels/Connection.cs similarity index 100% rename from csharp/lib/Channels/Connection.cs rename to csharp/Lib/Channels/Connection.cs diff --git a/csharp/lib/Channels/Framed/Channel.cs b/csharp/Lib/Channels/Framed/Channel.cs similarity index 100% rename from csharp/lib/Channels/Framed/Channel.cs rename to csharp/Lib/Channels/Framed/Channel.cs diff --git a/csharp/lib/Channels/Stages/Channel.cs b/csharp/Lib/Channels/Stages/Channel.cs similarity index 100% rename from csharp/lib/Channels/Stages/Channel.cs rename to csharp/Lib/Channels/Stages/Channel.cs diff --git a/csharp/lib/Channels/Stages/ConnectedChannel.cs b/csharp/Lib/Channels/Stages/ConnectedChannel.cs similarity index 100% rename from csharp/lib/Channels/Stages/ConnectedChannel.cs rename to csharp/Lib/Channels/Stages/ConnectedChannel.cs diff --git a/csharp/lib/Channels/Stages/Stage.cs b/csharp/Lib/Channels/Stages/Stage.cs similarity index 100% rename from csharp/lib/Channels/Stages/Stage.cs rename to csharp/Lib/Channels/Stages/Stage.cs diff --git a/csharp/lib/Channels/V2/Bak/Connections/Connection.cs b/csharp/Lib/Channels/V2/Bak/Connections/Connection.cs similarity index 90% rename from csharp/lib/Channels/V2/Bak/Connections/Connection.cs rename to csharp/Lib/Channels/V2/Bak/Connections/Connection.cs index 82d0b9f67..ecd18b168 100644 --- a/csharp/lib/Channels/V2/Bak/Connections/Connection.cs +++ b/csharp/Lib/Channels/V2/Bak/Connections/Connection.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Lib.Channels.V2.Connections; +namespace InnovEnergy.Lib.Channels.V2.Bak.Connections; public abstract class Connection : IConnection where C : IDisposable { diff --git a/csharp/lib/Channels/V2/Bak/Connections/Connections.cs b/csharp/Lib/Channels/V2/Bak/Connections/Connections.cs similarity index 95% rename from csharp/lib/Channels/V2/Bak/Connections/Connections.cs rename to csharp/Lib/Channels/V2/Bak/Connections/Connections.cs index 1af0c31a1..12e2f7207 100644 --- a/csharp/lib/Channels/V2/Bak/Connections/Connections.cs +++ b/csharp/Lib/Channels/V2/Bak/Connections/Connections.cs @@ -1,6 +1,6 @@ using System.Net.Sockets; -namespace InnovEnergy.Lib.Channels.V2.Connections; +namespace InnovEnergy.Lib.Channels.V2.Bak.Connections; public class TcpClientConnection : Connection { diff --git a/csharp/lib/Channels/V2/Bak/Connections/Extensions.cs b/csharp/Lib/Channels/V2/Bak/Connections/Extensions.cs similarity index 83% rename from csharp/lib/Channels/V2/Bak/Connections/Extensions.cs rename to csharp/Lib/Channels/V2/Bak/Connections/Extensions.cs index 1dd40eb78..d681564ce 100644 --- a/csharp/lib/Channels/V2/Bak/Connections/Extensions.cs +++ b/csharp/Lib/Channels/V2/Bak/Connections/Extensions.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Lib.Channels.V2.Connections; +namespace InnovEnergy.Lib.Channels.V2.Bak.Connections; public static class Connection { diff --git a/csharp/lib/Channels/V2/Bak/Connections/IConnection.cs b/csharp/Lib/Channels/V2/Bak/Connections/IConnection.cs similarity index 76% rename from csharp/lib/Channels/V2/Bak/Connections/IConnection.cs rename to csharp/Lib/Channels/V2/Bak/Connections/IConnection.cs index 8490accec..7463f3132 100644 --- a/csharp/lib/Channels/V2/Bak/Connections/IConnection.cs +++ b/csharp/Lib/Channels/V2/Bak/Connections/IConnection.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Lib.Channels.V2.Connections; +namespace InnovEnergy.Lib.Channels.V2.Bak.Connections; public interface IConnection { diff --git a/csharp/lib/Channels/V2/Bak/GenericChannel.cs b/csharp/Lib/Channels/V2/Bak/GenericChannel.cs similarity index 95% rename from csharp/lib/Channels/V2/Bak/GenericChannel.cs rename to csharp/Lib/Channels/V2/Bak/GenericChannel.cs index 6cad9ba22..151bc8aea 100644 --- a/csharp/lib/Channels/V2/Bak/GenericChannel.cs +++ b/csharp/Lib/Channels/V2/Bak/GenericChannel.cs @@ -1,6 +1,6 @@ -using InnovEnergy.Lib.Channels.V2.Connections; +using InnovEnergy.Lib.Channels.V2.Bak.Connections; -namespace InnovEnergy.Lib.Channels.V2; +namespace InnovEnergy.Lib.Channels.V2.Bak; public abstract class GenericChannel2 : IChannel, IConnection { diff --git a/csharp/lib/Channels/V2/Bak/StreamChannel.cs b/csharp/Lib/Channels/V2/Bak/StreamChannel.cs similarity index 100% rename from csharp/lib/Channels/V2/Bak/StreamChannel.cs rename to csharp/Lib/Channels/V2/Bak/StreamChannel.cs diff --git a/csharp/lib/Channels/V2/CommandChannel.cs b/csharp/Lib/Channels/V2/CommandChannel.cs similarity index 100% rename from csharp/lib/Channels/V2/CommandChannel.cs rename to csharp/Lib/Channels/V2/CommandChannel.cs diff --git a/csharp/lib/Channels/V2/IChannel.cs b/csharp/Lib/Channels/V2/IChannel.cs similarity index 100% rename from csharp/lib/Channels/V2/IChannel.cs rename to csharp/Lib/Channels/V2/IChannel.cs diff --git a/csharp/lib/Channels/V2/Pipes/AsyncPipeSource.cs b/csharp/Lib/Channels/V2/Pipes/AsyncPipeSource.cs similarity index 100% rename from csharp/lib/Channels/V2/Pipes/AsyncPipeSource.cs rename to csharp/Lib/Channels/V2/Pipes/AsyncPipeSource.cs diff --git a/csharp/lib/Channels/V2/Pipes/AsyncPipeTarget.cs b/csharp/Lib/Channels/V2/Pipes/AsyncPipeTarget.cs similarity index 100% rename from csharp/lib/Channels/V2/Pipes/AsyncPipeTarget.cs rename to csharp/Lib/Channels/V2/Pipes/AsyncPipeTarget.cs diff --git a/csharp/lib/Channels/V2/Pipes/ChannelPipeSource.cs b/csharp/Lib/Channels/V2/Pipes/ChannelPipeSource.cs similarity index 100% rename from csharp/lib/Channels/V2/Pipes/ChannelPipeSource.cs rename to csharp/Lib/Channels/V2/Pipes/ChannelPipeSource.cs diff --git a/csharp/lib/Channels/V2/Pipes/ChannelPipeTarget.cs b/csharp/Lib/Channels/V2/Pipes/ChannelPipeTarget.cs similarity index 100% rename from csharp/lib/Channels/V2/Pipes/ChannelPipeTarget.cs rename to csharp/Lib/Channels/V2/Pipes/ChannelPipeTarget.cs diff --git a/csharp/lib/Channels/V2/Stage.cs b/csharp/Lib/Channels/V2/Stage.cs similarity index 100% rename from csharp/lib/Channels/V2/Stage.cs rename to csharp/Lib/Channels/V2/Stage.cs diff --git a/csharp/lib/Channels/V2/StreamChannel.cs b/csharp/Lib/Channels/V2/StreamChannel.cs similarity index 100% rename from csharp/lib/Channels/V2/StreamChannel.cs rename to csharp/Lib/Channels/V2/StreamChannel.cs diff --git a/csharp/lib/Channels/V2/TcpChannel.cs b/csharp/Lib/Channels/V2/TcpChannel.cs similarity index 100% rename from csharp/lib/Channels/V2/TcpChannel.cs rename to csharp/Lib/Channels/V2/TcpChannel.cs diff --git a/csharp/lib/Devices/AMPT/Ampt.csproj b/csharp/Lib/Devices/AMPT/Ampt.csproj similarity index 59% rename from csharp/lib/Devices/AMPT/Ampt.csproj rename to csharp/Lib/Devices/AMPT/Ampt.csproj index 5f3e41475..ea8cbf21c 100644 --- a/csharp/lib/Devices/AMPT/Ampt.csproj +++ b/csharp/Lib/Devices/AMPT/Ampt.csproj @@ -1,11 +1,5 @@ - - - - InnovEnergy.Lib.Devices.Ampt - InnovEnergy.Lib.Devices.Ampt - - + diff --git a/csharp/lib/Devices/AMPT/AmptCommunicationUnit.cs b/csharp/Lib/Devices/AMPT/AmptCommunicationUnit.cs similarity index 99% rename from csharp/lib/Devices/AMPT/AmptCommunicationUnit.cs rename to csharp/Lib/Devices/AMPT/AmptCommunicationUnit.cs index 239502762..e701c8463 100644 --- a/csharp/lib/Devices/AMPT/AmptCommunicationUnit.cs +++ b/csharp/Lib/Devices/AMPT/AmptCommunicationUnit.cs @@ -3,7 +3,7 @@ using InnovEnergy.Lib.Protocols.Modbus.Clients; using InnovEnergy.Lib.Protocols.Modbus.Connections; using InnovEnergy.Lib.StatusApi.Connections; -namespace InnovEnergy.Lib.Devices.Ampt; +namespace InnovEnergy.Lib.Devices.AMPT; public class AmptCommunicationUnit { diff --git a/csharp/lib/Devices/AMPT/AmptDeviceStatus.cs b/csharp/Lib/Devices/AMPT/AmptDeviceStatus.cs similarity index 93% rename from csharp/lib/Devices/AMPT/AmptDeviceStatus.cs rename to csharp/Lib/Devices/AMPT/AmptDeviceStatus.cs index 00d9e352f..371395e46 100644 --- a/csharp/lib/Devices/AMPT/AmptDeviceStatus.cs +++ b/csharp/Lib/Devices/AMPT/AmptDeviceStatus.cs @@ -1,7 +1,7 @@ using InnovEnergy.Lib.StatusApi.Connections; using InnovEnergy.Lib.StatusApi.Devices; -namespace InnovEnergy.Lib.Devices.Ampt; +namespace InnovEnergy.Lib.Devices.AMPT; public record AmptDeviceStatus ( diff --git a/csharp/lib/Devices/AMPT/AmptStatus.cs b/csharp/Lib/Devices/AMPT/AmptStatus.cs similarity index 90% rename from csharp/lib/Devices/AMPT/AmptStatus.cs rename to csharp/Lib/Devices/AMPT/AmptStatus.cs index 48ce01d2f..45ff33662 100644 --- a/csharp/lib/Devices/AMPT/AmptStatus.cs +++ b/csharp/Lib/Devices/AMPT/AmptStatus.cs @@ -1,7 +1,4 @@ -using InnovEnergy.Lib.StatusApi.Connections; -using InnovEnergy.Lib.StatusApi.Devices; - -namespace InnovEnergy.Lib.Devices.Ampt; +namespace InnovEnergy.Lib.Devices.AMPT; public record AmptStatus ( diff --git a/csharp/lib/Devices/AMPT/AmptStringStatus.cs b/csharp/Lib/Devices/AMPT/AmptStringStatus.cs similarity index 77% rename from csharp/lib/Devices/AMPT/AmptStringStatus.cs rename to csharp/Lib/Devices/AMPT/AmptStringStatus.cs index e8776950f..bd3b2c5e0 100644 --- a/csharp/lib/Devices/AMPT/AmptStringStatus.cs +++ b/csharp/Lib/Devices/AMPT/AmptStringStatus.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Lib.Devices.Ampt; +namespace InnovEnergy.Lib.Devices.AMPT; public record AmptStringStatus { diff --git a/csharp/Lib/Devices/Adam6060/Adam6060.csproj b/csharp/Lib/Devices/Adam6060/Adam6060.csproj new file mode 100644 index 000000000..1a36e43e1 --- /dev/null +++ b/csharp/Lib/Devices/Adam6060/Adam6060.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/csharp/lib/Devices/Adam6060/Adam6060Control.cs b/csharp/Lib/Devices/Adam6060/Adam6060Control.cs similarity index 100% rename from csharp/lib/Devices/Adam6060/Adam6060Control.cs rename to csharp/Lib/Devices/Adam6060/Adam6060Control.cs diff --git a/csharp/lib/Devices/Adam6060/Adam6060Device.cs b/csharp/Lib/Devices/Adam6060/Adam6060Device.cs similarity index 100% rename from csharp/lib/Devices/Adam6060/Adam6060Device.cs rename to csharp/Lib/Devices/Adam6060/Adam6060Device.cs diff --git a/csharp/lib/Devices/Adam6060/Adam6060Status.cs b/csharp/Lib/Devices/Adam6060/Adam6060Status.cs similarity index 100% rename from csharp/lib/Devices/Adam6060/Adam6060Status.cs rename to csharp/Lib/Devices/Adam6060/Adam6060Status.cs diff --git a/csharp/lib/Devices/Battery48TL/Battery48TL.csproj b/csharp/Lib/Devices/Battery48TL/Battery48TL.csproj similarity index 54% rename from csharp/lib/Devices/Battery48TL/Battery48TL.csproj rename to csharp/Lib/Devices/Battery48TL/Battery48TL.csproj index 51feacfe1..ce3b83de6 100644 --- a/csharp/lib/Devices/Battery48TL/Battery48TL.csproj +++ b/csharp/Lib/Devices/Battery48TL/Battery48TL.csproj @@ -1,10 +1,5 @@ - - - - InnovEnergy.Lib.Devices.Battery48TL - InnovEnergy.Lib.Devices.Battery48TL - + diff --git a/csharp/lib/Devices/Battery48TL/Battery48TLDevice.cs b/csharp/Lib/Devices/Battery48TL/Battery48TLDevice.cs similarity index 100% rename from csharp/lib/Devices/Battery48TL/Battery48TLDevice.cs rename to csharp/Lib/Devices/Battery48TL/Battery48TLDevice.cs diff --git a/csharp/lib/Devices/Battery48TL/Battery48TLStatusRecord.cs b/csharp/Lib/Devices/Battery48TL/Battery48TLStatusRecord.cs similarity index 100% rename from csharp/lib/Devices/Battery48TL/Battery48TLStatusRecord.cs rename to csharp/Lib/Devices/Battery48TL/Battery48TLStatusRecord.cs diff --git a/csharp/lib/Devices/Battery48TL/BatteryDataParser.cs b/csharp/Lib/Devices/Battery48TL/BatteryDataParser.cs similarity index 100% rename from csharp/lib/Devices/Battery48TL/BatteryDataParser.cs rename to csharp/Lib/Devices/Battery48TL/BatteryDataParser.cs diff --git a/csharp/lib/Devices/Battery48TL/Constants.cs b/csharp/Lib/Devices/Battery48TL/Constants.cs similarity index 100% rename from csharp/lib/Devices/Battery48TL/Constants.cs rename to csharp/Lib/Devices/Battery48TL/Constants.cs diff --git a/csharp/lib/Devices/Battery48TL/LedColor.cs b/csharp/Lib/Devices/Battery48TL/LedColor.cs similarity index 100% rename from csharp/lib/Devices/Battery48TL/LedColor.cs rename to csharp/Lib/Devices/Battery48TL/LedColor.cs diff --git a/csharp/lib/Devices/Battery48TL/LedState.cs b/csharp/Lib/Devices/Battery48TL/LedState.cs similarity index 100% rename from csharp/lib/Devices/Battery48TL/LedState.cs rename to csharp/Lib/Devices/Battery48TL/LedState.cs diff --git a/csharp/lib/Devices/EmuMeter/Conversions.cs b/csharp/Lib/Devices/EmuMeter/Conversions.cs similarity index 100% rename from csharp/lib/Devices/EmuMeter/Conversions.cs rename to csharp/Lib/Devices/EmuMeter/Conversions.cs diff --git a/csharp/lib/Devices/EmuMeter/EmuMeter.csproj b/csharp/Lib/Devices/EmuMeter/EmuMeter.csproj similarity index 55% rename from csharp/lib/Devices/EmuMeter/EmuMeter.csproj rename to csharp/Lib/Devices/EmuMeter/EmuMeter.csproj index c05adbe6b..ce3b83de6 100644 --- a/csharp/lib/Devices/EmuMeter/EmuMeter.csproj +++ b/csharp/Lib/Devices/EmuMeter/EmuMeter.csproj @@ -1,10 +1,5 @@ - - - - InnovEnergy.Lib.Devices.EmuMeter - InnovEnergy.Lib.Devices.EmuMeter - + diff --git a/csharp/lib/Devices/EmuMeter/EmuMeterDevice.cs b/csharp/Lib/Devices/EmuMeter/EmuMeterDevice.cs similarity index 100% rename from csharp/lib/Devices/EmuMeter/EmuMeterDevice.cs rename to csharp/Lib/Devices/EmuMeter/EmuMeterDevice.cs diff --git a/csharp/lib/Devices/EmuMeter/EmuMeterStatus.cs b/csharp/Lib/Devices/EmuMeter/EmuMeterStatus.cs similarity index 100% rename from csharp/lib/Devices/EmuMeter/EmuMeterStatus.cs rename to csharp/Lib/Devices/EmuMeter/EmuMeterStatus.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvert/AlarmState.cs b/csharp/Lib/Devices/Trumpf/TruConvert/AlarmState.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvert/AlarmState.cs rename to csharp/Lib/Devices/Trumpf/TruConvert/AlarmState.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvert/MainState.cs b/csharp/Lib/Devices/Trumpf/TruConvert/MainState.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvert/MainState.cs rename to csharp/Lib/Devices/Trumpf/TruConvert/MainState.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvert/Slave.cs b/csharp/Lib/Devices/Trumpf/TruConvert/Slave.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvert/Slave.cs rename to csharp/Lib/Devices/Trumpf/TruConvert/Slave.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvert/SystemConfig.cs b/csharp/Lib/Devices/Trumpf/TruConvert/SystemConfig.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvert/SystemConfig.cs rename to csharp/Lib/Devices/Trumpf/TruConvert/SystemConfig.cs diff --git a/csharp/Lib/Devices/Trumpf/TruConvert/TruConvert.csproj b/csharp/Lib/Devices/Trumpf/TruConvert/TruConvert.csproj new file mode 100644 index 000000000..ca3eb7a2a --- /dev/null +++ b/csharp/Lib/Devices/Trumpf/TruConvert/TruConvert.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/csharp/lib/Devices/Trumpf/TruConvert/Utils.cs b/csharp/Lib/Devices/Trumpf/TruConvert/Utils.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvert/Utils.cs rename to csharp/Lib/Devices/Trumpf/TruConvert/Utils.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvertAc/AcControlRegisters.cs b/csharp/Lib/Devices/Trumpf/TruConvertAc/AcControlRegisters.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvertAc/AcControlRegisters.cs rename to csharp/Lib/Devices/Trumpf/TruConvertAc/AcControlRegisters.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvertAc/AcEnums.cs b/csharp/Lib/Devices/Trumpf/TruConvertAc/AcEnums.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvertAc/AcEnums.cs rename to csharp/Lib/Devices/Trumpf/TruConvertAc/AcEnums.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvertAc/AlarmMessage.cs b/csharp/Lib/Devices/Trumpf/TruConvertAc/AlarmMessage.cs similarity index 99% rename from csharp/lib/Devices/Trumpf/TruConvertAc/AlarmMessage.cs rename to csharp/Lib/Devices/Trumpf/TruConvertAc/AlarmMessage.cs index aceada544..df5535008 100644 --- a/csharp/lib/Devices/Trumpf/TruConvertAc/AlarmMessage.cs +++ b/csharp/Lib/Devices/Trumpf/TruConvertAc/AlarmMessage.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace InnovEnergy.Lib.Devices.Trumpf.TruConvert; +namespace InnovEnergy.Lib.Devices.Trumpf.TruConvertAc; [SuppressMessage("ReSharper", "IdentifierTypo")] [SuppressMessage("ReSharper", "UnusedMember.Global")] diff --git a/csharp/lib/Devices/Trumpf/TruConvertAc/TruConvertAc.csproj b/csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAc.csproj similarity index 50% rename from csharp/lib/Devices/Trumpf/TruConvertAc/TruConvertAc.csproj rename to csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAc.csproj index 31669d385..3a70b12a0 100644 --- a/csharp/lib/Devices/Trumpf/TruConvertAc/TruConvertAc.csproj +++ b/csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAc.csproj @@ -1,11 +1,7 @@ - + - - InnovEnergy.Lib.Devices.Trumpf.TruConvertAc - InnovEnergy.Lib.Devices.Trumpf.TruConvertAc - latest - + diff --git a/csharp/lib/Devices/Trumpf/TruConvertAc/TruConvertAcControl.cs b/csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAcControl.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvertAc/TruConvertAcControl.cs rename to csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAcControl.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvertAc/TruConvertAcDevice.cs b/csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAcDevice.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvertAc/TruConvertAcDevice.cs rename to csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAcDevice.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvertAc/TruConvertAcStatus.cs b/csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAcStatus.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvertAc/TruConvertAcStatus.cs rename to csharp/Lib/Devices/Trumpf/TruConvertAc/TruConvertAcStatus.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvertAc/WarningMessage.cs b/csharp/Lib/Devices/Trumpf/TruConvertAc/WarningMessage.cs similarity index 96% rename from csharp/lib/Devices/Trumpf/TruConvertAc/WarningMessage.cs rename to csharp/Lib/Devices/Trumpf/TruConvertAc/WarningMessage.cs index 45a5538de..2fb74b947 100644 --- a/csharp/lib/Devices/Trumpf/TruConvertAc/WarningMessage.cs +++ b/csharp/Lib/Devices/Trumpf/TruConvertAc/WarningMessage.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace InnovEnergy.Lib.Devices.Trumpf.TruConvert; +namespace InnovEnergy.Lib.Devices.Trumpf.TruConvertAc; [SuppressMessage("ReSharper", "IdentifierTypo")] [SuppressMessage("ReSharper", "UnusedMember.Global")] diff --git a/csharp/lib/Devices/Trumpf/TruConvertDc/AlarmMessage.cs b/csharp/Lib/Devices/Trumpf/TruConvertDc/AlarmMessage.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvertDc/AlarmMessage.cs rename to csharp/Lib/Devices/Trumpf/TruConvertDc/AlarmMessage.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvertDc/DcControlRegisters.cs b/csharp/Lib/Devices/Trumpf/TruConvertDc/DcControlRegisters.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvertDc/DcControlRegisters.cs rename to csharp/Lib/Devices/Trumpf/TruConvertDc/DcControlRegisters.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvertDc/DcEnums.cs b/csharp/Lib/Devices/Trumpf/TruConvertDc/DcEnums.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvertDc/DcEnums.cs rename to csharp/Lib/Devices/Trumpf/TruConvertDc/DcEnums.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvertDc/TruConvertDc.csproj b/csharp/Lib/Devices/Trumpf/TruConvertDc/TruConvertDc.csproj similarity index 50% rename from csharp/lib/Devices/Trumpf/TruConvertDc/TruConvertDc.csproj rename to csharp/Lib/Devices/Trumpf/TruConvertDc/TruConvertDc.csproj index c2acc0062..1628a2b19 100644 --- a/csharp/lib/Devices/Trumpf/TruConvertDc/TruConvertDc.csproj +++ b/csharp/Lib/Devices/Trumpf/TruConvertDc/TruConvertDc.csproj @@ -1,11 +1,5 @@ - - - - InnovEnergy.Lib.Devices.Trumpf.TruConvertDc - InnovEnergy.Lib.Devices.Trumpf.TruConvertDc - latest - + diff --git a/csharp/lib/Devices/Trumpf/TruConvertDc/TruConvertDcControl.cs b/csharp/Lib/Devices/Trumpf/TruConvertDc/TruConvertDcControl.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvertDc/TruConvertDcControl.cs rename to csharp/Lib/Devices/Trumpf/TruConvertDc/TruConvertDcControl.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvertDc/TruConvertDcDevice.cs b/csharp/Lib/Devices/Trumpf/TruConvertDc/TruConvertDcDevice.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvertDc/TruConvertDcDevice.cs rename to csharp/Lib/Devices/Trumpf/TruConvertDc/TruConvertDcDevice.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvertDc/TruConvertDcStatus.cs b/csharp/Lib/Devices/Trumpf/TruConvertDc/TruConvertDcStatus.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvertDc/TruConvertDcStatus.cs rename to csharp/Lib/Devices/Trumpf/TruConvertDc/TruConvertDcStatus.cs diff --git a/csharp/lib/Devices/Trumpf/TruConvertDc/WarningMessage.cs b/csharp/Lib/Devices/Trumpf/TruConvertDc/WarningMessage.cs similarity index 100% rename from csharp/lib/Devices/Trumpf/TruConvertDc/WarningMessage.cs rename to csharp/Lib/Devices/Trumpf/TruConvertDc/WarningMessage.cs diff --git a/csharp/lib/InnovEnergy.lib.props b/csharp/Lib/InnovEnergy.Lib.props similarity index 75% rename from csharp/lib/InnovEnergy.lib.props rename to csharp/Lib/InnovEnergy.Lib.props index 0e1ca7736..de75048b8 100644 --- a/csharp/lib/InnovEnergy.lib.props +++ b/csharp/Lib/InnovEnergy.Lib.props @@ -4,6 +4,7 @@ Library + $(RootNamespace) diff --git a/csharp/lib/Protocols/DBus/Bus.cs b/csharp/Lib/Protocols/DBus/Bus.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Bus.cs rename to csharp/Lib/Protocols/DBus/Bus.cs diff --git a/csharp/lib/Protocols/DBus/DBus.csproj b/csharp/Lib/Protocols/DBus/DBus.csproj similarity index 70% rename from csharp/lib/Protocols/DBus/DBus.csproj rename to csharp/Lib/Protocols/DBus/DBus.csproj index 7f74a94ad..01a9e0400 100644 --- a/csharp/lib/Protocols/DBus/DBus.csproj +++ b/csharp/Lib/Protocols/DBus/DBus.csproj @@ -1,11 +1,9 @@ - + DBus Library true - InnovEnergy.Lib.Protocols.DBus - InnovEnergy.Lib.Protocols.DBus diff --git a/csharp/lib/Protocols/DBus/DBusConnection.cs b/csharp/Lib/Protocols/DBus/DBusConnection.cs similarity index 100% rename from csharp/lib/Protocols/DBus/DBusConnection.cs rename to csharp/Lib/Protocols/DBus/DBusConnection.cs diff --git a/csharp/lib/Protocols/DBus/DBusMessageStream.cs b/csharp/Lib/Protocols/DBus/DBusMessageStream.cs similarity index 100% rename from csharp/lib/Protocols/DBus/DBusMessageStream.cs rename to csharp/Lib/Protocols/DBus/DBusMessageStream.cs diff --git a/csharp/lib/Protocols/DBus/DBusService.cs b/csharp/Lib/Protocols/DBus/DBusService.cs similarity index 100% rename from csharp/lib/Protocols/DBus/DBusService.cs rename to csharp/Lib/Protocols/DBus/DBusService.cs diff --git a/csharp/lib/Protocols/DBus/Daemon/DBusDaemonApi.cs b/csharp/Lib/Protocols/DBus/Daemon/DBusDaemonApi.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Daemon/DBusDaemonApi.cs rename to csharp/Lib/Protocols/DBus/Daemon/DBusDaemonApi.cs diff --git a/csharp/lib/Protocols/DBus/Daemon/DBusDaemonConnection.Resolver.cs b/csharp/Lib/Protocols/DBus/Daemon/DBusDaemonConnection.Resolver.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Daemon/DBusDaemonConnection.Resolver.cs rename to csharp/Lib/Protocols/DBus/Daemon/DBusDaemonConnection.Resolver.cs diff --git a/csharp/lib/Protocols/DBus/Daemon/DBusDaemonConnection.cs b/csharp/Lib/Protocols/DBus/Daemon/DBusDaemonConnection.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Daemon/DBusDaemonConnection.cs rename to csharp/Lib/Protocols/DBus/Daemon/DBusDaemonConnection.cs diff --git a/csharp/lib/Protocols/DBus/Daemon/MatchRule.cs b/csharp/Lib/Protocols/DBus/Daemon/MatchRule.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Daemon/MatchRule.cs rename to csharp/Lib/Protocols/DBus/Daemon/MatchRule.cs diff --git a/csharp/lib/Protocols/DBus/Daemon/ObservableDictionary.cs b/csharp/Lib/Protocols/DBus/Daemon/ObservableDictionary.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Daemon/ObservableDictionary.cs rename to csharp/Lib/Protocols/DBus/Daemon/ObservableDictionary.cs diff --git a/csharp/lib/Protocols/DBus/Daemon/ReleaseNameReply.cs b/csharp/Lib/Protocols/DBus/Daemon/ReleaseNameReply.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Daemon/ReleaseNameReply.cs rename to csharp/Lib/Protocols/DBus/Daemon/ReleaseNameReply.cs diff --git a/csharp/lib/Protocols/DBus/Daemon/RequestNameOptions.cs b/csharp/Lib/Protocols/DBus/Daemon/RequestNameOptions.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Daemon/RequestNameOptions.cs rename to csharp/Lib/Protocols/DBus/Daemon/RequestNameOptions.cs diff --git a/csharp/lib/Protocols/DBus/Daemon/RequestNameReply.cs b/csharp/Lib/Protocols/DBus/Daemon/RequestNameReply.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Daemon/RequestNameReply.cs rename to csharp/Lib/Protocols/DBus/Daemon/RequestNameReply.cs diff --git a/csharp/lib/Protocols/DBus/Env.cs b/csharp/Lib/Protocols/DBus/Env.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Env.cs rename to csharp/Lib/Protocols/DBus/Env.cs diff --git a/csharp/lib/Protocols/DBus/Interop.cs b/csharp/Lib/Protocols/DBus/Interop.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Interop.cs rename to csharp/Lib/Protocols/DBus/Interop.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Convert/StringToSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Convert/StringToSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Convert/StringToSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Convert/StringToSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Convert/TypeToSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Convert/TypeToSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Convert/TypeToSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Convert/TypeToSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/ObjectPath.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/ObjectPath.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/ObjectPath.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/ObjectPath.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Signature.Equality.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Signature.Equality.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Signature.Equality.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Signature.Equality.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Signature.Terminals.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Signature.Terminals.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Signature.Terminals.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Signature.Terminals.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Signature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Signature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Signature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Signature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ArraySignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ArraySignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ArraySignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ArraySignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/BasicTypeSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/BasicTypeSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/BasicTypeSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/BasicTypeSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/BooleanSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/BooleanSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/BooleanSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/BooleanSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ByteSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ByteSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ByteSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ByteSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/CompositeSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/CompositeSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/CompositeSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/CompositeSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ContainerTypeSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ContainerTypeSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ContainerTypeSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ContainerTypeSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/DictionarySignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/DictionarySignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/DictionarySignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/DictionarySignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/DoubleSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/DoubleSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/DoubleSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/DoubleSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/EmptySignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/EmptySignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/EmptySignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/EmptySignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/FixedTypeSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/FixedTypeSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/FixedTypeSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/FixedTypeSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/Int16Signature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/Int16Signature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/Int16Signature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/Int16Signature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/Int32Signature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/Int32Signature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/Int32Signature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/Int32Signature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/Int64Signature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/Int64Signature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/Int64Signature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/Int64Signature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ObjectPathSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ObjectPathSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ObjectPathSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/ObjectPathSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/SignatureTypeSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/SignatureTypeSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/SignatureTypeSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/SignatureTypeSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/StringLikeTypeSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/StringLikeTypeSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/StringLikeTypeSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/StringLikeTypeSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/StringSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/StringSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/StringSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/StringSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/StructSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/StructSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/StructSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/StructSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/UInt16Signature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/UInt16Signature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/UInt16Signature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/UInt16Signature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/UInt32Signature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/UInt32Signature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/UInt32Signature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/UInt32Signature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/UInt64Signature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/UInt64Signature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/UInt64Signature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/UInt64Signature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/VariantSignature.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/VariantSignature.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/VariantSignature.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Signatures/Specialized/VariantSignature.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/DataTypes/Variant.cs b/csharp/Lib/Protocols/DBus/Protocol/DataTypes/Variant.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/DataTypes/Variant.cs rename to csharp/Lib/Protocols/DBus/Protocol/DataTypes/Variant.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/Header/Endian.cs b/csharp/Lib/Protocols/DBus/Protocol/Header/Endian.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/Header/Endian.cs rename to csharp/Lib/Protocols/DBus/Protocol/Header/Endian.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/Header/FieldCode.cs b/csharp/Lib/Protocols/DBus/Protocol/Header/FieldCode.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/Header/FieldCode.cs rename to csharp/Lib/Protocols/DBus/Protocol/Header/FieldCode.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/Header/HeaderExtensions.cs b/csharp/Lib/Protocols/DBus/Protocol/Header/HeaderExtensions.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/Header/HeaderExtensions.cs rename to csharp/Lib/Protocols/DBus/Protocol/Header/HeaderExtensions.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/Header/HeaderFlags.cs b/csharp/Lib/Protocols/DBus/Protocol/Header/HeaderFlags.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/Header/HeaderFlags.cs rename to csharp/Lib/Protocols/DBus/Protocol/Header/HeaderFlags.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/Header/MessageType.cs b/csharp/Lib/Protocols/DBus/Protocol/Header/MessageType.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/Header/MessageType.cs rename to csharp/Lib/Protocols/DBus/Protocol/Header/MessageType.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/Message.cs b/csharp/Lib/Protocols/DBus/Protocol/Message.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/Message.cs rename to csharp/Lib/Protocols/DBus/Protocol/Message.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/Replies.cs b/csharp/Lib/Protocols/DBus/Protocol/Replies.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/Replies.cs rename to csharp/Lib/Protocols/DBus/Protocol/Replies.cs diff --git a/csharp/lib/Protocols/DBus/Protocol/SerialSource.cs b/csharp/Lib/Protocols/DBus/Protocol/SerialSource.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Protocol/SerialSource.cs rename to csharp/Lib/Protocols/DBus/Protocol/SerialSource.cs diff --git a/csharp/lib/Protocols/DBus/Transport/AuthenticationMethod.cs b/csharp/Lib/Protocols/DBus/Transport/AuthenticationMethod.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Transport/AuthenticationMethod.cs rename to csharp/Lib/Protocols/DBus/Transport/AuthenticationMethod.cs diff --git a/csharp/lib/Protocols/DBus/Transport/BufferedSocketReader.cs b/csharp/Lib/Protocols/DBus/Transport/BufferedSocketReader.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Transport/BufferedSocketReader.cs rename to csharp/Lib/Protocols/DBus/Transport/BufferedSocketReader.cs diff --git a/csharp/lib/Protocols/DBus/Transport/DBusBufferReader.cs b/csharp/Lib/Protocols/DBus/Transport/DBusBufferReader.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Transport/DBusBufferReader.cs rename to csharp/Lib/Protocols/DBus/Transport/DBusBufferReader.cs diff --git a/csharp/lib/Protocols/DBus/Transport/DBusBufferWriter.cs b/csharp/Lib/Protocols/DBus/Transport/DBusBufferWriter.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Transport/DBusBufferWriter.cs rename to csharp/Lib/Protocols/DBus/Transport/DBusBufferWriter.cs diff --git a/csharp/lib/Protocols/DBus/Transport/DBusSocket.cs b/csharp/Lib/Protocols/DBus/Transport/DBusSocket.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Transport/DBusSocket.cs rename to csharp/Lib/Protocols/DBus/Transport/DBusSocket.cs diff --git a/csharp/lib/Protocols/DBus/Utils/DisposableStack.cs b/csharp/Lib/Protocols/DBus/Utils/DisposableStack.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Utils/DisposableStack.cs rename to csharp/Lib/Protocols/DBus/Utils/DisposableStack.cs diff --git a/csharp/lib/Protocols/DBus/Utils/Extensions.cs b/csharp/Lib/Protocols/DBus/Utils/Extensions.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Utils/Extensions.cs rename to csharp/Lib/Protocols/DBus/Utils/Extensions.cs diff --git a/csharp/lib/Protocols/DBus/Utils/HexView.cs b/csharp/Lib/Protocols/DBus/Utils/HexView.cs similarity index 100% rename from csharp/lib/Protocols/DBus/Utils/HexView.cs rename to csharp/Lib/Protocols/DBus/Utils/HexView.cs diff --git a/csharp/lib/Protocols/DBus/WireFormat/DBusMeasureWriter.cs b/csharp/Lib/Protocols/DBus/WireFormat/DBusMeasureWriter.cs similarity index 100% rename from csharp/lib/Protocols/DBus/WireFormat/DBusMeasureWriter.cs rename to csharp/Lib/Protocols/DBus/WireFormat/DBusMeasureWriter.cs diff --git a/csharp/lib/Protocols/DBus/WireFormat/DBusReader.cs b/csharp/Lib/Protocols/DBus/WireFormat/DBusReader.cs similarity index 100% rename from csharp/lib/Protocols/DBus/WireFormat/DBusReader.cs rename to csharp/Lib/Protocols/DBus/WireFormat/DBusReader.cs diff --git a/csharp/lib/Protocols/DBus/WireFormat/DBusSocketReader.cs b/csharp/Lib/Protocols/DBus/WireFormat/DBusSocketReader.cs similarity index 100% rename from csharp/lib/Protocols/DBus/WireFormat/DBusSocketReader.cs rename to csharp/Lib/Protocols/DBus/WireFormat/DBusSocketReader.cs diff --git a/csharp/lib/Protocols/DBus/WireFormat/DBusWriter.cs b/csharp/Lib/Protocols/DBus/WireFormat/DBusWriter.cs similarity index 100% rename from csharp/lib/Protocols/DBus/WireFormat/DBusWriter.cs rename to csharp/Lib/Protocols/DBus/WireFormat/DBusWriter.cs diff --git a/csharp/lib/Protocols/Modbus/Clients/ModbusClient.cs b/csharp/Lib/Protocols/Modbus/Clients/ModbusClient.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Clients/ModbusClient.cs rename to csharp/Lib/Protocols/Modbus/Clients/ModbusClient.cs diff --git a/csharp/lib/Protocols/Modbus/Clients/ModbusRtuClient.cs b/csharp/Lib/Protocols/Modbus/Clients/ModbusRtuClient.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Clients/ModbusRtuClient.cs rename to csharp/Lib/Protocols/Modbus/Clients/ModbusRtuClient.cs diff --git a/csharp/lib/Protocols/Modbus/Clients/ModbusTcpClient.cs b/csharp/Lib/Protocols/Modbus/Clients/ModbusTcpClient.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Clients/ModbusTcpClient.cs rename to csharp/Lib/Protocols/Modbus/Clients/ModbusTcpClient.cs diff --git a/csharp/lib/Protocols/Modbus/Connections/ModbusConnection.cs b/csharp/Lib/Protocols/Modbus/Connections/ModbusConnection.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Connections/ModbusConnection.cs rename to csharp/Lib/Protocols/Modbus/Connections/ModbusConnection.cs diff --git a/csharp/lib/Protocols/Modbus/Connections/ModbusSerialConnection.cs b/csharp/Lib/Protocols/Modbus/Connections/ModbusSerialConnection.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Connections/ModbusSerialConnection.cs rename to csharp/Lib/Protocols/Modbus/Connections/ModbusSerialConnection.cs diff --git a/csharp/lib/Protocols/Modbus/Connections/ModbusTcpConnection.cs b/csharp/Lib/Protocols/Modbus/Connections/ModbusTcpConnection.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Connections/ModbusTcpConnection.cs rename to csharp/Lib/Protocols/Modbus/Connections/ModbusTcpConnection.cs diff --git a/csharp/lib/Protocols/Modbus/Conversions/Endianness.cs b/csharp/Lib/Protocols/Modbus/Conversions/Endianness.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Conversions/Endianness.cs rename to csharp/Lib/Protocols/Modbus/Conversions/Endianness.cs diff --git a/csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.Bit.cs b/csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.Bit.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.Bit.cs rename to csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.Bit.cs diff --git a/csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.Boolean.cs b/csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.Boolean.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.Boolean.cs rename to csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.Boolean.cs diff --git a/csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.Bytes.cs b/csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.Bytes.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.Bytes.cs rename to csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.Bytes.cs diff --git a/csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.Int16.cs b/csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.Int16.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.Int16.cs rename to csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.Int16.cs diff --git a/csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.Int32.cs b/csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.Int32.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.Int32.cs rename to csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.Int32.cs diff --git a/csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.Single.cs b/csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.Single.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.Single.cs rename to csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.Single.cs diff --git a/csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.String.cs b/csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.String.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.String.cs rename to csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.String.cs diff --git a/csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.UInt16.cs b/csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.UInt16.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.UInt16.cs rename to csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.UInt16.cs diff --git a/csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.UInt32.cs b/csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.UInt32.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.UInt32.cs rename to csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.UInt32.cs diff --git a/csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.cs b/csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Conversions/ModbusRegisters.cs rename to csharp/Lib/Protocols/Modbus/Conversions/ModbusRegisters.cs diff --git a/csharp/lib/Protocols/Modbus/Modbus.csproj b/csharp/Lib/Protocols/Modbus/Modbus.csproj similarity index 51% rename from csharp/lib/Protocols/Modbus/Modbus.csproj rename to csharp/Lib/Protocols/Modbus/Modbus.csproj index ec6eb7bf8..460195f09 100644 --- a/csharp/lib/Protocols/Modbus/Modbus.csproj +++ b/csharp/Lib/Protocols/Modbus/Modbus.csproj @@ -1,10 +1,5 @@ - - - - InnovEnergy.Lib.Protocols.Modbus - InnovEnergy.Lib.Protocols.Modbus - + diff --git a/csharp/lib/Protocols/Modbus/Protocol/ExceptionCode.cs b/csharp/Lib/Protocols/Modbus/Protocol/ExceptionCode.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/ExceptionCode.cs rename to csharp/Lib/Protocols/Modbus/Protocol/ExceptionCode.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Exceptions.cs b/csharp/Lib/Protocols/Modbus/Protocol/Exceptions.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Exceptions.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Exceptions.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/Accessors.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/Accessors.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/Accessors.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/Accessors.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/MbAddress.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/MbAddress.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/MbAddress.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/MbAddress.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/MbBits.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/MbBits.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/MbBits.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/MbBits.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/MbByte.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/MbByte.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/MbByte.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/MbByte.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/MbByte{T}.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/MbByte{T}.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/MbByte{T}.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/MbByte{T}.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/MbWord.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/MbWord.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/MbWord.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/MbWord.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/MbWords.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/MbWords.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Accessors/MbWords.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Accessors/MbWords.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Commands/ReadDiscreteInputsCommandFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Commands/ReadDiscreteInputsCommandFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Commands/ReadDiscreteInputsCommandFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Commands/ReadDiscreteInputsCommandFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Commands/ReadHoldingRegistersCommandFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Commands/ReadHoldingRegistersCommandFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Commands/ReadHoldingRegistersCommandFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Commands/ReadHoldingRegistersCommandFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Commands/ReadInputRegistersCommandFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Commands/ReadInputRegistersCommandFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Commands/ReadInputRegistersCommandFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Commands/ReadInputRegistersCommandFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Commands/ReadWriteRegistersCommandFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Commands/ReadWriteRegistersCommandFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Commands/ReadWriteRegistersCommandFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Commands/ReadWriteRegistersCommandFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Commands/WriteCoilsCommandFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Commands/WriteCoilsCommandFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Commands/WriteCoilsCommandFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Commands/WriteCoilsCommandFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Commands/WriteRegistersCommandFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Commands/WriteRegistersCommandFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Commands/WriteRegistersCommandFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Commands/WriteRegistersCommandFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Constants.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Constants.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Constants.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Constants.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/ModbusFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/ModbusFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/ModbusFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/ModbusFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/ErrorResponseFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/ErrorResponseFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/ErrorResponseFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/ErrorResponseFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/ReadDiscreteInputResponseFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/ReadDiscreteInputResponseFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/ReadDiscreteInputResponseFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/ReadDiscreteInputResponseFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/ReadHoldingRegistersResponseFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/ReadHoldingRegistersResponseFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/ReadHoldingRegistersResponseFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/ReadHoldingRegistersResponseFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/ReadInputRegistersResponseFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/ReadInputRegistersResponseFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/ReadInputRegistersResponseFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/ReadInputRegistersResponseFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/ReadWriteRegistersCommandFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/ReadWriteRegistersCommandFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/ReadWriteRegistersCommandFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/ReadWriteRegistersCommandFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/WriteCoilsResponseFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/WriteCoilsResponseFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/WriteCoilsResponseFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/WriteCoilsResponseFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/WriteRegistersResponseFrame.cs b/csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/WriteRegistersResponseFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/Frames/Replies/WriteRegistersResponseFrame.cs rename to csharp/Lib/Protocols/Modbus/Protocol/Frames/Replies/WriteRegistersResponseFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Protocol/FunctionCode.cs b/csharp/Lib/Protocols/Modbus/Protocol/FunctionCode.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Protocol/FunctionCode.cs rename to csharp/Lib/Protocols/Modbus/Protocol/FunctionCode.cs diff --git a/csharp/lib/Protocols/Modbus/Tcp/MbapHeader.cs b/csharp/Lib/Protocols/Modbus/Tcp/MbapHeader.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Tcp/MbapHeader.cs rename to csharp/Lib/Protocols/Modbus/Tcp/MbapHeader.cs diff --git a/csharp/lib/Protocols/Modbus/Tcp/ModbusTcpFrame.cs b/csharp/Lib/Protocols/Modbus/Tcp/ModbusTcpFrame.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Tcp/ModbusTcpFrame.cs rename to csharp/Lib/Protocols/Modbus/Tcp/ModbusTcpFrame.cs diff --git a/csharp/lib/Protocols/Modbus/Util/ArraySegmentExtensions.cs b/csharp/Lib/Protocols/Modbus/Util/ArraySegmentExtensions.cs similarity index 100% rename from csharp/lib/Protocols/Modbus/Util/ArraySegmentExtensions.cs rename to csharp/Lib/Protocols/Modbus/Util/ArraySegmentExtensions.cs diff --git a/csharp/Lib/StatusApi/BatteryStatus.cs b/csharp/Lib/StatusApi/BatteryStatus.cs new file mode 100644 index 000000000..0b033b420 --- /dev/null +++ b/csharp/Lib/StatusApi/BatteryStatus.cs @@ -0,0 +1,7 @@ +using InnovEnergy.Lib.StatusApi.Connections; +using InnovEnergy.Lib.Units.Composite; + +namespace InnovEnergy.Lib.StatusApi; + +public abstract record BatteryStatus(DcPhase Dc) : DeviceStatus, IDcConnection; + \ No newline at end of file diff --git a/csharp/Lib/StatusApi/Connections/IAc1Connection.cs b/csharp/Lib/StatusApi/Connections/IAc1Connection.cs new file mode 100644 index 000000000..d90b57938 --- /dev/null +++ b/csharp/Lib/StatusApi/Connections/IAc1Connection.cs @@ -0,0 +1,8 @@ +using InnovEnergy.Lib.Units.Composite; + +namespace InnovEnergy.Lib.StatusApi.Connections; + +public interface IAc1Connection +{ + Ac1Phase Ac { get; } +} \ No newline at end of file diff --git a/csharp/Lib/StatusApi/Connections/IAc3Connection.cs b/csharp/Lib/StatusApi/Connections/IAc3Connection.cs new file mode 100644 index 000000000..231982cf0 --- /dev/null +++ b/csharp/Lib/StatusApi/Connections/IAc3Connection.cs @@ -0,0 +1,8 @@ +using InnovEnergy.Lib.Units.Composite; + +namespace InnovEnergy.Lib.StatusApi.Connections; + +public interface IAc3Connection +{ + Ac1Phase Ac3 { get; } +} \ No newline at end of file diff --git a/csharp/Lib/StatusApi/Connections/IDcConnection.cs b/csharp/Lib/StatusApi/Connections/IDcConnection.cs new file mode 100644 index 000000000..6074a6750 --- /dev/null +++ b/csharp/Lib/StatusApi/Connections/IDcConnection.cs @@ -0,0 +1,9 @@ +using InnovEnergy.Lib.Units.Composite; + +namespace InnovEnergy.Lib.StatusApi.Connections; + + +public interface IDcConnection +{ + DcPhase Dc { get; } +} \ No newline at end of file diff --git a/csharp/Lib/StatusApi/Connections/IPvConnection.cs b/csharp/Lib/StatusApi/Connections/IPvConnection.cs new file mode 100644 index 000000000..a117f2d17 --- /dev/null +++ b/csharp/Lib/StatusApi/Connections/IPvConnection.cs @@ -0,0 +1,8 @@ +using InnovEnergy.Lib.Units.Composite; + +namespace InnovEnergy.Lib.StatusApi.Connections; + +public interface IPvConnection +{ + IReadOnlyList Strings { get; } +} \ No newline at end of file diff --git a/csharp/Lib/StatusApi/DcDcConverterStatus.cs b/csharp/Lib/StatusApi/DcDcConverterStatus.cs new file mode 100644 index 000000000..cdda395d9 --- /dev/null +++ b/csharp/Lib/StatusApi/DcDcConverterStatus.cs @@ -0,0 +1,8 @@ +using InnovEnergy.Lib.Units.Composite; + +namespace InnovEnergy.Lib.StatusApi; + +public abstract record DcDcConverterStatus(DcPhase Left, DcPhase Right) : DeviceStatus; + + + \ No newline at end of file diff --git a/csharp/Lib/StatusApi/DeviceStatus.cs b/csharp/Lib/StatusApi/DeviceStatus.cs new file mode 100644 index 000000000..6cdc1ef3f --- /dev/null +++ b/csharp/Lib/StatusApi/DeviceStatus.cs @@ -0,0 +1,12 @@ +using InnovEnergy.Lib.Utils; + +namespace InnovEnergy.Lib.StatusApi; + +public abstract record DeviceStatus +{ + public String DeviceType => GetType() + .Generate(t => t.BaseType!) + .First(t => t.IsAbstract) + .Name + .Replace("Status", ""); +} \ No newline at end of file diff --git a/csharp/Lib/StatusApi/MpptStatus.cs b/csharp/Lib/StatusApi/MpptStatus.cs new file mode 100644 index 000000000..bec31ddec --- /dev/null +++ b/csharp/Lib/StatusApi/MpptStatus.cs @@ -0,0 +1,8 @@ +using InnovEnergy.Lib.StatusApi.Connections; +using InnovEnergy.Lib.Units.Composite; + +namespace InnovEnergy.Lib.StatusApi; + +public record MpptStatus(DcPhase Dc, IReadOnlyList Strings) : IDcConnection, IPvConnection; + + \ No newline at end of file diff --git a/csharp/Lib/StatusApi/PowerMeterStatus.cs b/csharp/Lib/StatusApi/PowerMeterStatus.cs new file mode 100644 index 000000000..41038f4dc --- /dev/null +++ b/csharp/Lib/StatusApi/PowerMeterStatus.cs @@ -0,0 +1,6 @@ +using InnovEnergy.Lib.StatusApi.Connections; +using InnovEnergy.Lib.Units.Composite; + +namespace InnovEnergy.Lib.StatusApi; + +public abstract record PowerMeterStatus(Ac1Phase Ac3) : DeviceStatus, IAc3Connection; \ No newline at end of file diff --git a/csharp/Lib/StatusApi/SinglePhaseInverterStatus.cs b/csharp/Lib/StatusApi/SinglePhaseInverterStatus.cs new file mode 100644 index 000000000..9e1e2c8ba --- /dev/null +++ b/csharp/Lib/StatusApi/SinglePhaseInverterStatus.cs @@ -0,0 +1,9 @@ +using InnovEnergy.Lib.StatusApi.Connections; +using InnovEnergy.Lib.Units.Composite; + +namespace InnovEnergy.Lib.StatusApi; + +public abstract record SinglePhaseInverterStatus(Ac1Phase Ac, DcPhase Dc) : + DeviceStatus, + IAc1Connection, + IDcConnection; diff --git a/csharp/Lib/StatusApi/SinglePhasePvInverterStatus.cs b/csharp/Lib/StatusApi/SinglePhasePvInverterStatus.cs new file mode 100644 index 000000000..51c113fce --- /dev/null +++ b/csharp/Lib/StatusApi/SinglePhasePvInverterStatus.cs @@ -0,0 +1,9 @@ +using InnovEnergy.Lib.StatusApi.Connections; +using InnovEnergy.Lib.Units.Composite; + +namespace InnovEnergy.Lib.StatusApi; + +public abstract record SinglePhasePvInverterStatus(Ac1Phase Ac, IReadOnlyList Strings) : + DeviceStatus, + IAc1Connection, + IPvConnection; diff --git a/csharp/Lib/StatusApi/StatusApi.csproj b/csharp/Lib/StatusApi/StatusApi.csproj new file mode 100644 index 000000000..88fda982e --- /dev/null +++ b/csharp/Lib/StatusApi/StatusApi.csproj @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/csharp/Lib/StatusApi/ThreePhaseInverterStatus.cs b/csharp/Lib/StatusApi/ThreePhaseInverterStatus.cs new file mode 100644 index 000000000..8c2fc424f --- /dev/null +++ b/csharp/Lib/StatusApi/ThreePhaseInverterStatus.cs @@ -0,0 +1,10 @@ +using InnovEnergy.Lib.StatusApi.Connections; +using InnovEnergy.Lib.Units.Composite; + +namespace InnovEnergy.Lib.StatusApi; + +public abstract record ThreePhaseInverterStatus(Ac1Phase Ac3, DcPhase Dc) : + DeviceStatus, + IAc3Connection, + IDcConnection; + \ No newline at end of file diff --git a/csharp/Lib/StatusApi/ThreePhasePvInverterStatus.cs b/csharp/Lib/StatusApi/ThreePhasePvInverterStatus.cs new file mode 100644 index 000000000..c09471d4b --- /dev/null +++ b/csharp/Lib/StatusApi/ThreePhasePvInverterStatus.cs @@ -0,0 +1,9 @@ +using InnovEnergy.Lib.StatusApi.Connections; +using InnovEnergy.Lib.Units.Composite; + +namespace InnovEnergy.Lib.StatusApi; + +public abstract record ThreePhasePvInverterStatus(Ac1Phase Ac3, IReadOnlyList Strings) : + DeviceStatus, + IAc3Connection, + IPvConnection; diff --git a/csharp/lib/StatusApi/Utils.cs b/csharp/Lib/StatusApi/Utils.cs similarity index 100% rename from csharp/lib/StatusApi/Utils.cs rename to csharp/Lib/StatusApi/Utils.cs diff --git a/csharp/lib/SysTools/Edges/RemoteCommandToProcess.cs b/csharp/Lib/SysTools/Edges/RemoteCommandToProcess.cs similarity index 92% rename from csharp/lib/SysTools/Edges/RemoteCommandToProcess.cs rename to csharp/Lib/SysTools/Edges/RemoteCommandToProcess.cs index 71453ab3d..984594e11 100644 --- a/csharp/lib/SysTools/Edges/RemoteCommandToProcess.cs +++ b/csharp/Lib/SysTools/Edges/RemoteCommandToProcess.cs @@ -1,7 +1,7 @@ -using InnovEnergy.SysTools.Process; -using InnovEnergy.SysTools.Remote; +using InnovEnergy.Lib.SysTools.Process; +using InnovEnergy.Lib.SysTools.Remote; -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; public static class RemoteCommandToProcess { diff --git a/csharp/lib/SysTools/Edges/RemotePathToRemoteCommand.cs b/csharp/Lib/SysTools/Edges/RemotePathToRemoteCommand.cs similarity index 94% rename from csharp/lib/SysTools/Edges/RemotePathToRemoteCommand.cs rename to csharp/Lib/SysTools/Edges/RemotePathToRemoteCommand.cs index 112623032..5e882d473 100644 --- a/csharp/lib/SysTools/Edges/RemotePathToRemoteCommand.cs +++ b/csharp/Lib/SysTools/Edges/RemotePathToRemoteCommand.cs @@ -1,6 +1,6 @@ -using InnovEnergy.SysTools.Remote; +using InnovEnergy.Lib.SysTools.Remote; -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; public static class RemotePathToRemoteCommand { diff --git a/csharp/lib/SysTools/Edges/SshHostToRemoteCommand.cs b/csharp/Lib/SysTools/Edges/SshHostToRemoteCommand.cs similarity index 68% rename from csharp/lib/SysTools/Edges/SshHostToRemoteCommand.cs rename to csharp/Lib/SysTools/Edges/SshHostToRemoteCommand.cs index 9dd56a042..c9cfba220 100644 --- a/csharp/lib/SysTools/Edges/SshHostToRemoteCommand.cs +++ b/csharp/Lib/SysTools/Edges/SshHostToRemoteCommand.cs @@ -1,6 +1,6 @@ -using InnovEnergy.SysTools.Remote; +using InnovEnergy.Lib.SysTools.Remote; -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; public static class SshHostToRemoteCommand { diff --git a/csharp/lib/SysTools/Edges/SshHostToRemotePath.cs b/csharp/Lib/SysTools/Edges/SshHostToRemotePath.cs similarity index 67% rename from csharp/lib/SysTools/Edges/SshHostToRemotePath.cs rename to csharp/Lib/SysTools/Edges/SshHostToRemotePath.cs index 3d7c75156..4833861b6 100644 --- a/csharp/lib/SysTools/Edges/SshHostToRemotePath.cs +++ b/csharp/Lib/SysTools/Edges/SshHostToRemotePath.cs @@ -1,6 +1,6 @@ -using InnovEnergy.SysTools.Remote; +using InnovEnergy.Lib.SysTools.Remote; -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; public static class SshHostToRemotePath { diff --git a/csharp/lib/SysTools/Edges/StringToCommand.cs b/csharp/Lib/SysTools/Edges/StringToCommand.cs similarity index 65% rename from csharp/lib/SysTools/Edges/StringToCommand.cs rename to csharp/Lib/SysTools/Edges/StringToCommand.cs index f905db3d8..62c595f75 100644 --- a/csharp/lib/SysTools/Edges/StringToCommand.cs +++ b/csharp/Lib/SysTools/Edges/StringToCommand.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; public static class StringToCommand { @@ -7,50 +7,50 @@ public static class StringToCommand public static SysCommand Opt1(this String cmd, String option) { return cmd - .ToCommand() - .Opt1(option); + .ToCommand() + .Opt1(option); } public static SysCommand Opt1(this String cmd, String option, Object value, String separator = " ") { return cmd - .ToCommand() - .Opt1(option, value, separator); + .ToCommand() + .Opt1(option, value, separator); } public static SysCommand Opt2(this String cmd, String option) { return cmd - .ToCommand() - .Opt2(option); + .ToCommand() + .Opt2(option); } public static SysCommand Opt2(this String cmd, String option, Object value, String separator = "=") { return cmd - .ToCommand() - .Opt2(option, value, separator); + .ToCommand() + .Opt2(option, value, separator); } public static SysCommand Opt(this String cmd, String option) { return cmd - .ToCommand() - .Opt(option); + .ToCommand() + .Opt(option); } public static SysCommand Opt(this String cmd, String option, Object value) { return cmd - .ToCommand() - .Opt(option, value); + .ToCommand() + .Opt(option, value); } public static SysCommand Arg(this String cmd, Object argument) { return cmd - .ToCommand() - .Arg(argument); + .ToCommand() + .Arg(argument); } } \ No newline at end of file diff --git a/csharp/lib/SysTools/Edges/StringToProcess.cs b/csharp/Lib/SysTools/Edges/StringToProcess.cs similarity index 89% rename from csharp/lib/SysTools/Edges/StringToProcess.cs rename to csharp/Lib/SysTools/Edges/StringToProcess.cs index 6a4229ef6..e8d3c4d63 100644 --- a/csharp/lib/SysTools/Edges/StringToProcess.cs +++ b/csharp/Lib/SysTools/Edges/StringToProcess.cs @@ -1,6 +1,6 @@ -using InnovEnergy.SysTools.Process; +using InnovEnergy.Lib.SysTools.Process; -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; using Env = Dictionary; diff --git a/csharp/lib/SysTools/Edges/StringToRemotePath.cs b/csharp/Lib/SysTools/Edges/StringToRemotePath.cs similarity index 62% rename from csharp/lib/SysTools/Edges/StringToRemotePath.cs rename to csharp/Lib/SysTools/Edges/StringToRemotePath.cs index 5fd37b695..9a32e16b1 100644 --- a/csharp/lib/SysTools/Edges/StringToRemotePath.cs +++ b/csharp/Lib/SysTools/Edges/StringToRemotePath.cs @@ -1,6 +1,6 @@ -using InnovEnergy.SysTools.Remote; +using InnovEnergy.Lib.SysTools.Remote; -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; public static class StringToRemotePath { diff --git a/csharp/lib/SysTools/Edges/StringToSysPath.cs b/csharp/Lib/SysTools/Edges/StringToSysPath.cs similarity index 72% rename from csharp/lib/SysTools/Edges/StringToSysPath.cs rename to csharp/Lib/SysTools/Edges/StringToSysPath.cs index 4e31e2836..bf7a93615 100644 --- a/csharp/lib/SysTools/Edges/StringToSysPath.cs +++ b/csharp/Lib/SysTools/Edges/StringToSysPath.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; public static class StringToSysPath { diff --git a/csharp/lib/SysTools/Edges/SysCommandToProcess.cs b/csharp/Lib/SysTools/Edges/SysCommandToProcess.cs similarity index 96% rename from csharp/lib/SysTools/Edges/SysCommandToProcess.cs rename to csharp/Lib/SysTools/Edges/SysCommandToProcess.cs index ceee12ebe..b8b142b6f 100644 --- a/csharp/lib/SysTools/Edges/SysCommandToProcess.cs +++ b/csharp/Lib/SysTools/Edges/SysCommandToProcess.cs @@ -1,9 +1,9 @@ using System.Diagnostics; using System.Reactive.Linq; using System.Text; -using InnovEnergy.SysTools.Process; +using InnovEnergy.Lib.SysTools.Process; -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; public static class SysCommandToProcess { diff --git a/csharp/lib/SysTools/Edges/SysCommandToRemoteCommand.cs b/csharp/Lib/SysTools/Edges/SysCommandToRemoteCommand.cs similarity index 73% rename from csharp/lib/SysTools/Edges/SysCommandToRemoteCommand.cs rename to csharp/Lib/SysTools/Edges/SysCommandToRemoteCommand.cs index acb42b570..faa77d432 100644 --- a/csharp/lib/SysTools/Edges/SysCommandToRemoteCommand.cs +++ b/csharp/Lib/SysTools/Edges/SysCommandToRemoteCommand.cs @@ -1,6 +1,6 @@ -using InnovEnergy.SysTools.Remote; +using InnovEnergy.Lib.SysTools.Remote; -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; public static class SysCommandToRemoteCommand { diff --git a/csharp/lib/SysTools/Edges/SysPathToProcess.cs b/csharp/Lib/SysTools/Edges/SysPathToProcess.cs similarity index 89% rename from csharp/lib/SysTools/Edges/SysPathToProcess.cs rename to csharp/Lib/SysTools/Edges/SysPathToProcess.cs index be8fe9904..60a030fe8 100644 --- a/csharp/lib/SysTools/Edges/SysPathToProcess.cs +++ b/csharp/Lib/SysTools/Edges/SysPathToProcess.cs @@ -1,6 +1,6 @@ -using InnovEnergy.SysTools.Process; +using InnovEnergy.Lib.SysTools.Process; -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; public static class SysPathToProcess { diff --git a/csharp/lib/SysTools/Edges/SysPathToRemotePath.cs b/csharp/Lib/SysTools/Edges/SysPathToRemotePath.cs similarity index 66% rename from csharp/lib/SysTools/Edges/SysPathToRemotePath.cs rename to csharp/Lib/SysTools/Edges/SysPathToRemotePath.cs index aebf6eade..410f6bb7e 100644 --- a/csharp/lib/SysTools/Edges/SysPathToRemotePath.cs +++ b/csharp/Lib/SysTools/Edges/SysPathToRemotePath.cs @@ -1,6 +1,6 @@ -using InnovEnergy.SysTools.Remote; +using InnovEnergy.Lib.SysTools.Remote; -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; public static class SysPathToRemotePath { diff --git a/csharp/lib/SysTools/Edges/SysPathToSysCommand.cs b/csharp/Lib/SysTools/Edges/SysPathToSysCommand.cs similarity index 96% rename from csharp/lib/SysTools/Edges/SysPathToSysCommand.cs rename to csharp/Lib/SysTools/Edges/SysPathToSysCommand.cs index 647778e9d..9f27e68ff 100644 --- a/csharp/lib/SysTools/Edges/SysPathToSysCommand.cs +++ b/csharp/Lib/SysTools/Edges/SysPathToSysCommand.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.SysTools.Edges; +namespace InnovEnergy.Lib.SysTools.Edges; public static class SysPathToSysCommand { diff --git a/csharp/lib/SysTools/FileIo.cs b/csharp/Lib/SysTools/FileIo.cs similarity index 74% rename from csharp/lib/SysTools/FileIo.cs rename to csharp/Lib/SysTools/FileIo.cs index 1df5a0adf..bec888e56 100644 --- a/csharp/lib/SysTools/FileIo.cs +++ b/csharp/Lib/SysTools/FileIo.cs @@ -1,8 +1,9 @@ using System.Text; -using InnovEnergy.SysTools.Utils; +using InnovEnergy.Lib.Utils; -namespace InnovEnergy.SysTools; +namespace InnovEnergy.Lib.SysTools; +[Obsolete("Needs rework before use")] public static class FileIo { public static Boolean Exists (this SysPath path) => path.FileExists() || path.DirectoryExists(); @@ -14,12 +15,12 @@ public static class FileIo public static IEnumerable Directories(this SysPath sysPath) => Directory - .GetDirectories(sysPath) - .Select(SysPath.FromString); + .GetDirectories(sysPath) + .Select(SysPath.FromString); public static IEnumerable Files(this SysPath sysPath) => Directory - .GetFiles(sysPath) - .Select(SysPath.FromString); + .GetFiles(sysPath) + .Select(SysPath.FromString); public static SysPath CreateDirectory(this SysPath path) @@ -91,10 +92,10 @@ public static class FileIo SysPath Target(SysPath path) => targetDir.Append(path.RelativeTo(sourceDir)); - Utils.Utils.Traverse(sourceDir, Directories) - .Do(d => Target(d).CreateDirectory()) - .SelectMany(Files) - .ForEach(f => f.CopyFileTo(Target(f))); + sourceDir.Traverse(Directories) + .Do(d => Target(d).CreateDirectory()) + .SelectMany(Files) + .ForEach(f => f.CopyFileTo(Target(f))); return sourceDir; } @@ -115,14 +116,14 @@ public static class FileIo public static IEnumerable DescendantDirectories(this SysPath path) { - return Utils.Utils.Traverse(path, Directories); + return path.Traverse(Directories); } public static IEnumerable DescendantFiles(this SysPath path) { return path - .DescendantDirectories() - .SelectMany(Files); + .DescendantDirectories() + .SelectMany(Files); } public static IEnumerable Descendants(this SysPath path) @@ -140,13 +141,11 @@ public static class FileIo { var buf = new Byte[4096]; - using (var fs = File.OpenRead(path)) - { - var n = fs.Read(buf, 0, buf.Length); + using var fs = File.OpenRead(path); + var n = fs.Read(buf, 0, buf.Length); - foreach (var b in buf.Take(Math.Max(0, n))) - yield return b; - } + foreach (var b in buf.Take(Math.Max(0, n))) + yield return b; } @@ -154,29 +153,29 @@ public static class FileIo public static IEnumerable ReadLines(this SysPath path, Encoding encoding) { - using (var sr = new StreamReader(path, encoding)) - while (true) - { - var str = sr.ReadLine(); - if (str == null) - yield break; + using var sr = new StreamReader(path, encoding); + while (true) + { + var str = sr.ReadLine(); + if (str == null) + yield break; - yield return str; - } + yield return str; + } } public static String ReadText(this SysPath path) => path.ReadText(Encoding.UTF8); public static String ReadText(this SysPath path, Encoding encoding) { - using (var sr = new StreamReader(path, encoding)) - return sr.ReadToEnd(); + using var sr = new StreamReader(path, encoding); + return sr.ReadToEnd(); } public static SysPath WriteText(this SysPath filePath, String text) { - using (var sw = new StreamWriter(filePath, append: false)) - sw.Write(text); + using var sw = new StreamWriter(filePath, append: false); + sw.Write(text); return filePath; } @@ -189,17 +188,17 @@ public static class FileIo public static SysPath WriteLines(this SysPath filePath, IEnumerable lines) { - using (var sw = new StreamWriter(filePath, append: false)) - foreach (var line in lines) - sw.WriteLine(line); + using var sw = new StreamWriter(filePath, append: false); + foreach (var line in lines) + sw.WriteLine(line); return filePath; } public static SysPath AppendText(this SysPath filePath, String text) { - using (var sw = new StreamWriter(filePath, append: true)) - sw.Write(text); + using var sw = new StreamWriter(filePath, append: true); + sw.Write(text); return filePath; } @@ -212,9 +211,9 @@ public static class FileIo public static SysPath AppendLines(this SysPath filePath, IEnumerable lines) { - using (var sw = new StreamWriter(filePath, append: true)) - foreach (var line in lines) - sw.WriteLine(line); + using var sw = new StreamWriter(filePath, append: true); + foreach (var line in lines) + sw.WriteLine(line); return filePath; } diff --git a/csharp/lib/SysTools/Process/AsyncProcess.cs b/csharp/Lib/SysTools/Process/AsyncProcess.cs similarity index 97% rename from csharp/lib/SysTools/Process/AsyncProcess.cs rename to csharp/Lib/SysTools/Process/AsyncProcess.cs index c8c0f3262..ee0137482 100644 --- a/csharp/lib/SysTools/Process/AsyncProcess.cs +++ b/csharp/Lib/SysTools/Process/AsyncProcess.cs @@ -2,13 +2,14 @@ using System.Diagnostics; using System.Reactive.Concurrency; using System.Reactive.Linq; using System.Reactive.Subjects; -using InnovEnergy.SysTools.Utils; +using InnovEnergy.Lib.SysTools.Utils; using static System.ConsoleColor; -namespace InnovEnergy.SysTools.Process; +namespace InnovEnergy.Lib.SysTools.Process; using Env = Dictionary; +[Obsolete("Use CliWrap instead")] public class AsyncProcess { private readonly Subject _StandardIn; diff --git a/csharp/lib/SysTools/Process/ProcessResult.cs b/csharp/Lib/SysTools/Process/ProcessResult.cs similarity index 92% rename from csharp/lib/SysTools/Process/ProcessResult.cs rename to csharp/Lib/SysTools/Process/ProcessResult.cs index bf9f3a52a..e8af589b3 100644 --- a/csharp/lib/SysTools/Process/ProcessResult.cs +++ b/csharp/Lib/SysTools/Process/ProcessResult.cs @@ -1,7 +1,8 @@ -using InnovEnergy.SysTools.Utils; +using InnovEnergy.Lib.SysTools.Utils; -namespace InnovEnergy.SysTools.Process; +namespace InnovEnergy.Lib.SysTools.Process; +[Obsolete("Use CliWrap instead")] public readonly struct ProcessResult { public ProcessResult(Int32 exitCode, diff --git a/csharp/lib/SysTools/Process/SyncProcess.cs b/csharp/Lib/SysTools/Process/SyncProcess.cs similarity index 98% rename from csharp/lib/SysTools/Process/SyncProcess.cs rename to csharp/Lib/SysTools/Process/SyncProcess.cs index 89b23073e..7d47f447f 100644 --- a/csharp/lib/SysTools/Process/SyncProcess.cs +++ b/csharp/Lib/SysTools/Process/SyncProcess.cs @@ -1,13 +1,13 @@ using System.Diagnostics; using System.Text.RegularExpressions; -using InnovEnergy.SysTools.Utils; +using InnovEnergy.Lib.SysTools.Utils; using static System.ConsoleColor; -namespace InnovEnergy.SysTools.Process; +namespace InnovEnergy.Lib.SysTools.Process; using Env = Dictionary; - +[Obsolete("Use CliWrap instead")] public class SyncProcess { public SysCommand Command { get; } diff --git a/csharp/lib/SysTools/Remote/RemoteCommand.cs b/csharp/Lib/SysTools/Remote/RemoteCommand.cs similarity index 96% rename from csharp/lib/SysTools/Remote/RemoteCommand.cs rename to csharp/Lib/SysTools/Remote/RemoteCommand.cs index 75d1febf5..fa80d2671 100644 --- a/csharp/lib/SysTools/Remote/RemoteCommand.cs +++ b/csharp/Lib/SysTools/Remote/RemoteCommand.cs @@ -1,7 +1,8 @@ -using InnovEnergy.SysTools.Utils; +using InnovEnergy.Lib.SysTools.Utils; -namespace InnovEnergy.SysTools.Remote; +namespace InnovEnergy.Lib.SysTools.Remote; +[Obsolete("Use CliWrap instead")] public readonly struct RemoteCommand { public SshHost Host { get; } diff --git a/csharp/lib/SysTools/Remote/RemoteFileIo.cs b/csharp/Lib/SysTools/Remote/RemoteFileIo.cs similarity index 97% rename from csharp/lib/SysTools/Remote/RemoteFileIo.cs rename to csharp/Lib/SysTools/Remote/RemoteFileIo.cs index 1ecdf6868..e317d7227 100644 --- a/csharp/lib/SysTools/Remote/RemoteFileIo.cs +++ b/csharp/Lib/SysTools/Remote/RemoteFileIo.cs @@ -1,8 +1,9 @@ -using InnovEnergy.SysTools.Edges; -using InnovEnergy.SysTools.Utils; +using InnovEnergy.Lib.SysTools.Edges; +using InnovEnergy.Lib.SysTools.Utils; -namespace InnovEnergy.SysTools.Remote; +namespace InnovEnergy.Lib.SysTools.Remote; +[Obsolete("Needs rework before use")] public static class RemoteFileIo { diff --git a/csharp/lib/SysTools/Remote/RemotePath.cs b/csharp/Lib/SysTools/Remote/RemotePath.cs similarity index 97% rename from csharp/lib/SysTools/Remote/RemotePath.cs rename to csharp/Lib/SysTools/Remote/RemotePath.cs index e8a048bdd..dcb75adb3 100644 --- a/csharp/lib/SysTools/Remote/RemotePath.cs +++ b/csharp/Lib/SysTools/Remote/RemotePath.cs @@ -1,5 +1,6 @@ -namespace InnovEnergy.SysTools.Remote; +namespace InnovEnergy.Lib.SysTools.Remote; +[Obsolete] public readonly struct RemotePath { public SysPath Path { get; } diff --git a/csharp/lib/SysTools/Remote/SshHost.cs b/csharp/Lib/SysTools/Remote/SshHost.cs similarity index 94% rename from csharp/lib/SysTools/Remote/SshHost.cs rename to csharp/Lib/SysTools/Remote/SshHost.cs index 7f7187302..a957f2887 100644 --- a/csharp/lib/SysTools/Remote/SshHost.cs +++ b/csharp/Lib/SysTools/Remote/SshHost.cs @@ -1,8 +1,9 @@ -using InnovEnergy.SysTools.Edges; -using InnovEnergy.SysTools.Utils; +using InnovEnergy.Lib.SysTools.Edges; +using InnovEnergy.Lib.SysTools.Utils; -namespace InnovEnergy.SysTools.Remote; +namespace InnovEnergy.Lib.SysTools.Remote; +[Obsolete("Needs rework before use")] public readonly struct SshHost { public const Int32 DefaultPort = 22; diff --git a/csharp/lib/SysTools/SysCommand.cs b/csharp/Lib/SysTools/SysCommand.cs similarity index 96% rename from csharp/lib/SysTools/SysCommand.cs rename to csharp/Lib/SysTools/SysCommand.cs index da3826e83..50237a5d8 100644 --- a/csharp/lib/SysTools/SysCommand.cs +++ b/csharp/Lib/SysTools/SysCommand.cs @@ -1,7 +1,8 @@ -using InnovEnergy.SysTools.Utils; +using InnovEnergy.Lib.SysTools.Utils; -namespace InnovEnergy.SysTools; +namespace InnovEnergy.Lib.SysTools; +[Obsolete("Use CliWrap instead")] public readonly struct SysCommand { public SysPath Path { get; } diff --git a/csharp/lib/SysTools/SysDirs.cs b/csharp/Lib/SysTools/SysDirs.cs similarity index 95% rename from csharp/lib/SysTools/SysDirs.cs rename to csharp/Lib/SysTools/SysDirs.cs index afec2e014..c65d4e7b7 100644 --- a/csharp/lib/SysTools/SysDirs.cs +++ b/csharp/Lib/SysTools/SysDirs.cs @@ -1,8 +1,9 @@ using static System.Environment; using static System.Environment.SpecialFolder; -namespace InnovEnergy.SysTools; +namespace InnovEnergy.Lib.SysTools; +[Obsolete] public static class SysDirs { diff --git a/csharp/lib/SysTools/SysPath.cs b/csharp/Lib/SysTools/SysPath.cs similarity index 97% rename from csharp/lib/SysTools/SysPath.cs rename to csharp/Lib/SysTools/SysPath.cs index 42bd090e0..b5ff40c36 100644 --- a/csharp/lib/SysTools/SysPath.cs +++ b/csharp/Lib/SysTools/SysPath.cs @@ -1,10 +1,11 @@ using System.Text; -using InnovEnergy.SysTools.Remote; -using InnovEnergy.SysTools.Utils; +using InnovEnergy.Lib.SysTools.Remote; +using InnovEnergy.Lib.SysTools.Utils; using static System.IO.Path; -namespace InnovEnergy.SysTools; +namespace InnovEnergy.Lib.SysTools; +[Obsolete("Needs rework before use")] public readonly struct SysPath { private readonly String _Path; diff --git a/csharp/Lib/SysTools/SysTools.csproj b/csharp/Lib/SysTools/SysTools.csproj new file mode 100644 index 000000000..629608dc6 --- /dev/null +++ b/csharp/Lib/SysTools/SysTools.csproj @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/csharp/lib/SysTools/Utils/ConsoleUtils.cs b/csharp/Lib/SysTools/Utils/ConsoleUtils.cs similarity index 97% rename from csharp/lib/SysTools/Utils/ConsoleUtils.cs rename to csharp/Lib/SysTools/Utils/ConsoleUtils.cs index f1d418b3b..5c58ef3b4 100644 --- a/csharp/lib/SysTools/Utils/ConsoleUtils.cs +++ b/csharp/Lib/SysTools/Utils/ConsoleUtils.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.SysTools.Utils; +namespace InnovEnergy.Lib.SysTools.Utils; internal static class ConsoleUtils { diff --git a/csharp/lib/SysTools/Utils/EnumerableUtils.cs b/csharp/Lib/SysTools/Utils/EnumerableUtils.cs similarity index 68% rename from csharp/lib/SysTools/Utils/EnumerableUtils.cs rename to csharp/Lib/SysTools/Utils/EnumerableUtils.cs index e0e6338dc..9f02caacf 100644 --- a/csharp/lib/SysTools/Utils/EnumerableUtils.cs +++ b/csharp/Lib/SysTools/Utils/EnumerableUtils.cs @@ -1,18 +1,16 @@ -namespace InnovEnergy.SysTools.Utils; +namespace InnovEnergy.Lib.SysTools.Utils; internal static class EnumerableUtils { public static IEnumerable Pad(this IEnumerable src, Int32 length, T padding) { - using (var enumerator = src.GetEnumerator()) - { - while (enumerator.MoveNext() && length-- > 0) - yield return enumerator.Current; + using var enumerator = src.GetEnumerator(); + while (enumerator.MoveNext() && length-- > 0) + yield return enumerator.Current; - while (length-- > 0) - yield return padding; - } + while (length-- > 0) + yield return padding; } public static Dictionary> IndexColumn(this IEnumerable> src, UInt16 index) @@ -33,10 +31,10 @@ internal static class EnumerableUtils public static IEnumerable<(TLeft left, TRight right)> Zip(IEnumerable left, IEnumerable right) { - using (var l = left.GetEnumerator()) - using (var r = right.GetEnumerator()) - while (l.MoveNext() && r.MoveNext()) - yield return (l.Current, r.Current); + using var l = left.GetEnumerator(); + using var r = right.GetEnumerator(); + while (l.MoveNext() && r.MoveNext()) + yield return (l.Current, r.Current); } public static IEnumerator Enumerator(this T t) @@ -57,20 +55,6 @@ internal static class EnumerableUtils action(e); } - public static IEnumerable Do(this IEnumerable enumerable, Action action) - { - return enumerable.Select(e => - { - action(e); - return e; - }); - } - - public static void ForEach(this IEnumerable enumerable, Func func) - { - foreach (var e in enumerable) - func(e); - } public static IEnumerable WhereNot(this IEnumerable enumerable, Func predicate) diff --git a/csharp/lib/SysTools/Utils/StringUtils.cs b/csharp/Lib/SysTools/Utils/StringUtils.cs similarity index 99% rename from csharp/lib/SysTools/Utils/StringUtils.cs rename to csharp/Lib/SysTools/Utils/StringUtils.cs index c67f724c7..c6a6ef12c 100644 --- a/csharp/lib/SysTools/Utils/StringUtils.cs +++ b/csharp/Lib/SysTools/Utils/StringUtils.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.SysTools.Utils; +namespace InnovEnergy.Lib.SysTools.Utils; internal static class StringUtils { diff --git a/csharp/Lib/SysTools/Utils/Utils.cs b/csharp/Lib/SysTools/Utils/Utils.cs new file mode 100644 index 000000000..026c63e8c --- /dev/null +++ b/csharp/Lib/SysTools/Utils/Utils.cs @@ -0,0 +1,37 @@ +namespace InnovEnergy.Lib.SysTools.Utils; + +public static class Utils +{ + + private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + + public static DateTime FromUnixTime(UInt64 unixTime) + { + return Epoch.AddSeconds(unixTime); + } + + public static R ValueOrDefault(this Dictionary dict, T key) + { + return ValueOrDefault(dict, key, default); + } + + public static R ValueOrDefault(this Dictionary dict, T key, R defaultValue) + { + return dict.TryGetValue(key, out var value) ? value : defaultValue; + } + + public static void CopyFilesRecursively(String source, String target) + { + CopyFilesRecursively(new DirectoryInfo(source), new DirectoryInfo(target)); + } + + public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) + { + foreach (var file in source.GetFiles()) + file.CopyTo(Path.Combine(target.FullName, file.Name)); + + foreach (var dir in source.GetDirectories()) + CopyFilesRecursively(dir, target.CreateSubdirectory(dir.Name)); + } + +} \ No newline at end of file diff --git a/csharp/Lib/Time/Time.csproj b/csharp/Lib/Time/Time.csproj new file mode 100644 index 000000000..e971a1f7d --- /dev/null +++ b/csharp/Lib/Time/Time.csproj @@ -0,0 +1,3 @@ + + + diff --git a/csharp/lib/Time/Unix/UnixTime.Compare.cs b/csharp/Lib/Time/Unix/UnixTime.Compare.cs similarity index 87% rename from csharp/lib/Time/Unix/UnixTime.Compare.cs rename to csharp/Lib/Time/Unix/UnixTime.Compare.cs index ca91d5ce2..044ef1a32 100644 --- a/csharp/lib/Time/Unix/UnixTime.Compare.cs +++ b/csharp/Lib/Time/Unix/UnixTime.Compare.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Time.Unix; +namespace InnovEnergy.Lib.Time.Unix; public readonly partial struct UnixTime : IComparable, IEquatable { diff --git a/csharp/lib/Time/Unix/UnixTime.Constructors.cs b/csharp/Lib/Time/Unix/UnixTime.Constructors.cs similarity index 94% rename from csharp/lib/Time/Unix/UnixTime.Constructors.cs rename to csharp/Lib/Time/Unix/UnixTime.Constructors.cs index ba26db8f3..5d963e488 100644 --- a/csharp/lib/Time/Unix/UnixTime.Constructors.cs +++ b/csharp/Lib/Time/Unix/UnixTime.Constructors.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Time.Unix; +namespace InnovEnergy.Lib.Time.Unix; public readonly partial struct UnixTime { diff --git a/csharp/lib/Time/Unix/UnixTime.Converters.cs b/csharp/Lib/Time/Unix/UnixTime.Converters.cs similarity index 77% rename from csharp/lib/Time/Unix/UnixTime.Converters.cs rename to csharp/Lib/Time/Unix/UnixTime.Converters.cs index d8495f092..0d5d17aeb 100644 --- a/csharp/lib/Time/Unix/UnixTime.Converters.cs +++ b/csharp/Lib/Time/Unix/UnixTime.Converters.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Time.Unix; +namespace InnovEnergy.Lib.Time.Unix; public readonly partial struct UnixTime { diff --git a/csharp/lib/Time/Unix/UnixTime.Operators.cs b/csharp/Lib/Time/Unix/UnixTime.Operators.cs similarity index 96% rename from csharp/lib/Time/Unix/UnixTime.Operators.cs rename to csharp/Lib/Time/Unix/UnixTime.Operators.cs index 850ccbfe3..7aeb71b69 100644 --- a/csharp/lib/Time/Unix/UnixTime.Operators.cs +++ b/csharp/Lib/Time/Unix/UnixTime.Operators.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Time.Unix; +namespace InnovEnergy.Lib.Time.Unix; public readonly partial struct UnixTime { diff --git a/csharp/lib/Time/Unix/UnixTime.Overrides.cs b/csharp/Lib/Time/Unix/UnixTime.Overrides.cs similarity index 88% rename from csharp/lib/Time/Unix/UnixTime.Overrides.cs rename to csharp/Lib/Time/Unix/UnixTime.Overrides.cs index 66621de8e..c2ba77a5e 100644 --- a/csharp/lib/Time/Unix/UnixTime.Overrides.cs +++ b/csharp/Lib/Time/Unix/UnixTime.Overrides.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Time.Unix; +namespace InnovEnergy.Lib.Time.Unix; public readonly partial struct UnixTime { diff --git a/csharp/lib/Time/Unix/UnixTime.cs b/csharp/Lib/Time/Unix/UnixTime.cs similarity index 87% rename from csharp/lib/Time/Unix/UnixTime.cs rename to csharp/Lib/Time/Unix/UnixTime.cs index b441c0c5f..f771fd01d 100644 --- a/csharp/lib/Time/Unix/UnixTime.cs +++ b/csharp/Lib/Time/Unix/UnixTime.cs @@ -2,7 +2,7 @@ // ReSharper disable ArrangeStaticMemberQualifier -namespace InnovEnergy.Time.Unix; +namespace InnovEnergy.Lib.Time.Unix; public readonly partial struct UnixTime { diff --git a/csharp/lib/Time/Unix/UnixTimeDelta.Compare.cs b/csharp/Lib/Time/Unix/UnixTimeDelta.Compare.cs similarity index 88% rename from csharp/lib/Time/Unix/UnixTimeDelta.Compare.cs rename to csharp/Lib/Time/Unix/UnixTimeDelta.Compare.cs index aac266c70..72f59f82e 100644 --- a/csharp/lib/Time/Unix/UnixTimeDelta.Compare.cs +++ b/csharp/Lib/Time/Unix/UnixTimeDelta.Compare.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Time.Unix; +namespace InnovEnergy.Lib.Time.Unix; public readonly partial struct UnixTimeSpan : IComparable, IEquatable { diff --git a/csharp/lib/Time/Unix/UnixTimeDelta.Constructors.cs b/csharp/Lib/Time/Unix/UnixTimeDelta.Constructors.cs similarity index 96% rename from csharp/lib/Time/Unix/UnixTimeDelta.Constructors.cs rename to csharp/Lib/Time/Unix/UnixTimeDelta.Constructors.cs index 7811fb4d6..c1fa4f877 100644 --- a/csharp/lib/Time/Unix/UnixTimeDelta.Constructors.cs +++ b/csharp/Lib/Time/Unix/UnixTimeDelta.Constructors.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Time.Unix; +namespace InnovEnergy.Lib.Time.Unix; public readonly partial struct UnixTimeSpan { diff --git a/csharp/lib/Time/Unix/UnixTimeDelta.Operators.cs b/csharp/Lib/Time/Unix/UnixTimeDelta.Operators.cs similarity index 98% rename from csharp/lib/Time/Unix/UnixTimeDelta.Operators.cs rename to csharp/Lib/Time/Unix/UnixTimeDelta.Operators.cs index d373ccde1..dc2805e2d 100644 --- a/csharp/lib/Time/Unix/UnixTimeDelta.Operators.cs +++ b/csharp/Lib/Time/Unix/UnixTimeDelta.Operators.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Time.Unix; +namespace InnovEnergy.Lib.Time.Unix; public readonly partial struct UnixTimeSpan { diff --git a/csharp/lib/Time/Unix/UnixTimeDelta.Overrides.cs b/csharp/Lib/Time/Unix/UnixTimeDelta.Overrides.cs similarity index 96% rename from csharp/lib/Time/Unix/UnixTimeDelta.Overrides.cs rename to csharp/Lib/Time/Unix/UnixTimeDelta.Overrides.cs index 0c000fab9..9552fbbe3 100644 --- a/csharp/lib/Time/Unix/UnixTimeDelta.Overrides.cs +++ b/csharp/Lib/Time/Unix/UnixTimeDelta.Overrides.cs @@ -1,6 +1,6 @@ using System.Text; -namespace InnovEnergy.Time.Unix; +namespace InnovEnergy.Lib.Time.Unix; public readonly partial struct UnixTimeSpan { diff --git a/csharp/lib/Time/Unix/UnixTimeDeltaExtensions.cs b/csharp/Lib/Time/Unix/UnixTimeDeltaExtensions.cs similarity index 95% rename from csharp/lib/Time/Unix/UnixTimeDeltaExtensions.cs rename to csharp/Lib/Time/Unix/UnixTimeDeltaExtensions.cs index c51928b98..fd98e3487 100644 --- a/csharp/lib/Time/Unix/UnixTimeDeltaExtensions.cs +++ b/csharp/Lib/Time/Unix/UnixTimeDeltaExtensions.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Time.Unix; +namespace InnovEnergy.Lib.Time.Unix; public static class UnixTimeDeltaExtensions { diff --git a/csharp/lib/Time/Unix/UnixTimeSpan.cs b/csharp/Lib/Time/Unix/UnixTimeSpan.cs similarity index 81% rename from csharp/lib/Time/Unix/UnixTimeSpan.cs rename to csharp/Lib/Time/Unix/UnixTimeSpan.cs index cb54ae279..d525deaba 100644 --- a/csharp/lib/Time/Unix/UnixTimeSpan.cs +++ b/csharp/Lib/Time/Unix/UnixTimeSpan.cs @@ -1,4 +1,4 @@ -namespace InnovEnergy.Time.Unix; +namespace InnovEnergy.Lib.Time.Unix; public readonly partial struct UnixTimeSpan { diff --git a/csharp/Lib/Units/Angle.cs b/csharp/Lib/Units/Angle.cs new file mode 100644 index 000000000..b8972c826 --- /dev/null +++ b/csharp/Lib/Units/Angle.cs @@ -0,0 +1,25 @@ +using DecimalMath; +using InnovEnergy.Lib.Units.Generator; +using InnovEnergy.Lib.Utils; + +namespace InnovEnergy.Lib.Units; + +[Sum] +public readonly partial struct Angle +{ + public static String Unit => "rad"; + public static String Symbol => "∠"; + + public static readonly Angle Pi = new Angle(DecimalEx.Pi); + + + public Angle(Decimal value) + { + var modulo = value.Modulo(DecimalEx.TwoPi); + + Value = modulo > DecimalEx.Pi + ? modulo - DecimalEx.TwoPi + : modulo; + } + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Angle.generated.cs b/csharp/Lib/Units/Angle.generated.cs new file mode 100644 index 000000000..ad576594a --- /dev/null +++ b/csharp/Lib/Units/Angle.generated.cs @@ -0,0 +1,78 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. +#define Sum + +using static System.Math; + +namespace InnovEnergy.Lib.Units; + +using T = Angle; + +public readonly partial struct Angle +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + #if Sum + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + #elif Mean + + public static T operator +(T left, T right) => new T((left.Value + right.Value)/2m); + + #elif Equal + + public static T operator +(T left, T right) + { + var d = Max(Abs(left.Value), Abs(right.Value)); + + if (d != 0m) + return new T(0m); + + var relativeError = Abs(left.Value - right.Value) / d; + + const Decimal maxRelativeError = 0.05m; + + if (relativeError > maxRelativeError) + throw new Exception($"{nameof(left)} and {nameof(right)} must be approximately equal.\n" + + $"Difference > {maxRelativeError * 100}% detected\n" + + $"{nameof(left)} : {left}\n" + + $"{nameof(right)}: {right}"); + + return new T((left.Value + right.Value) / 2m); + } + #endif + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} diff --git a/csharp/Lib/Units/ApparentPower.cs b/csharp/Lib/Units/ApparentPower.cs new file mode 100644 index 000000000..8c92385de --- /dev/null +++ b/csharp/Lib/Units/ApparentPower.cs @@ -0,0 +1,16 @@ +using InnovEnergy.Lib.Units.Generator; + +namespace InnovEnergy.Lib.Units; + +[Sum] +public readonly partial struct ApparentPower +{ + public static String Unit => "VA"; + public static String Symbol => "S"; + + public ApparentPower(Decimal value) + { + if (value < 0) throw new ArgumentException("Apparent power cannot be negative", nameof(value)); + Value = value; + } +} \ No newline at end of file diff --git a/csharp/Lib/Units/ApparentPower.generated.cs b/csharp/Lib/Units/ApparentPower.generated.cs new file mode 100644 index 000000000..cfa6174ed --- /dev/null +++ b/csharp/Lib/Units/ApparentPower.generated.cs @@ -0,0 +1,78 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. +#define Sum + +using static System.Math; + +namespace InnovEnergy.Lib.Units; + +using T = ApparentPower; + +public readonly partial struct ApparentPower +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + #if Sum + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + #elif Mean + + public static T operator +(T left, T right) => new T((left.Value + right.Value)/2m); + + #elif Equal + + public static T operator +(T left, T right) + { + var d = Max(Abs(left.Value), Abs(right.Value)); + + if (d != 0m) + return new T(0m); + + var relativeError = Abs(left.Value - right.Value) / d; + + const Decimal maxRelativeError = 0.05m; + + if (relativeError > maxRelativeError) + throw new Exception($"{nameof(left)} and {nameof(right)} must be approximately equal.\n" + + $"Difference > {maxRelativeError * 100}% detected\n" + + $"{nameof(left)} : {left}\n" + + $"{nameof(right)}: {right}"); + + return new T((left.Value + right.Value) / 2m); + } + #endif + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} diff --git a/csharp/Lib/Units/Composite/Ac1Phase.cs b/csharp/Lib/Units/Composite/Ac1Phase.cs new file mode 100644 index 000000000..e48807866 --- /dev/null +++ b/csharp/Lib/Units/Composite/Ac1Phase.cs @@ -0,0 +1,26 @@ +using System.Diagnostics.CodeAnalysis; + +namespace InnovEnergy.Lib.Units.Composite; + +public record Ac1Phase +( + Voltage Voltage, + Current Current, + Angle Phi, + Frequency Frequency +) + : AcPhase(Voltage, Current, Phi) +{ + + [SuppressMessage("ReSharper", "RedundantCast")] + public static Ac1Phase operator +(Ac1Phase left, Ac1Phase right) + { + var f = (left.Frequency + right.Frequency) / 2m; // TODO: check that l & r approximately equal + var acPhase = (AcPhase)left + (AcPhase)right; + return new Ac1Phase(acPhase.Voltage, acPhase.Current, acPhase.Phi, f); + } + +} + + + diff --git a/csharp/Lib/Units/Composite/Ac3Phase.cs b/csharp/Lib/Units/Composite/Ac3Phase.cs new file mode 100644 index 000000000..a5788e452 --- /dev/null +++ b/csharp/Lib/Units/Composite/Ac3Phase.cs @@ -0,0 +1,25 @@ +using static DecimalMath.DecimalEx; + +namespace InnovEnergy.Lib.Units.Composite; + +public record Ac3Phase(AcPhase L1, AcPhase L2, AcPhase L3, Frequency Frequency) +{ + public ApparentPower ApparentPower => L1.ApparentPower + L2.ApparentPower + L3.ApparentPower; + public ReactivePower ReactivePower => L1.ReactivePower + L2.ReactivePower + L3.ReactivePower; + public Power ActivePower => L1.ActivePower + L2.ActivePower + L3.ActivePower; + + public Angle Phi => ATan2(ReactivePower, ActivePower); + + + public static Ac3Phase operator +(Ac3Phase left, Ac3Phase right) + { + var f = (left.Frequency + right.Frequency) / 2m; // TODO: check that l & r approximately equal + + var l1 = left.L1 + right.L1; + var l2 = left.L2 + right.L2; + var l3 = left.L3 + right.L3; + + return new Ac3Phase(l1, l2, l3, f); + } + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Composite/AcPhase.cs b/csharp/Lib/Units/Composite/AcPhase.cs new file mode 100644 index 000000000..70cd952b2 --- /dev/null +++ b/csharp/Lib/Units/Composite/AcPhase.cs @@ -0,0 +1,54 @@ +using static DecimalMath.DecimalEx; + +namespace InnovEnergy.Lib.Units.Composite; + + +public record AcPhase : Phase +{ + public AcPhase(Voltage voltage, Current current, Angle phi) : base(voltage, current) + { + if (voltage < 0) throw new ArgumentException("RMS value cannot be negative", nameof(voltage)); + if (current < 0) throw new ArgumentException("RMS value cannot be negative", nameof(current)); + + Phi = phi; + } + + public Angle Phi { get; } + + public ApparentPower ApparentPower => Voltage.Value * Current.Value ; + public Power ActivePower => ApparentPower.Value * PowerFactor; + public ReactivePower ReactivePower => ApparentPower.Value * Sin(Phi); + public Decimal PowerFactor => Cos(Phi); + + + public static AcPhase operator +(AcPhase left, AcPhase right) + { + // the Voltages of two phases are expected to be in phase and equal + + var v = (left.Voltage + right.Voltage) / 2m; // TODO: check that l & r approximately equal + + // currents (RMS) can be different and out of phase + // https://www.johndcook.com/blog/2020/08/17/adding-phase-shifted-sine-waves/ + + // IF + // left(t) = ILeft sin(ωt) + // right(t) = IRight sin(ωt + φ). + // sum(t) = left(t) + right(t) = ISum sin(ωt + ψ). + // THEN + + // ψ = arctan( IRight * sin(φ) / (ILeft + IRight cos(φ)) ). + // C = IRight * sin(φ) / sin(ψ). + + // in this calc left(t) has zero phase shift. + // we can shift both waves by -left.Phi, so + // φ := right.phi - left.phi + + + var phi = right.Phi - left.Phi; + + var phiSum = ATan2(right.Current * Sin(phi), left.Current + right.Current * Cos(phi)); + var iSum = right.Current * Sin(phi) / Sin(phiSum); + + return new AcPhase(v, iSum, phiSum); + } +} \ No newline at end of file diff --git a/csharp/Lib/Units/Composite/DcPhase.cs b/csharp/Lib/Units/Composite/DcPhase.cs new file mode 100644 index 000000000..af6d1049a --- /dev/null +++ b/csharp/Lib/Units/Composite/DcPhase.cs @@ -0,0 +1,15 @@ +namespace InnovEnergy.Lib.Units.Composite; + +public record DcPhase(Voltage Voltage, Current Current) : Phase(Voltage, Current) +{ + public Power Power => Current * Voltage; + + public static DcPhase operator +(DcPhase left, DcPhase right) + { + var v = (left.Voltage + right.Voltage) / 2m; + var i = left.Current + right.Current; + + return new DcPhase(v, i); + } + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Composite/Phase.cs b/csharp/Lib/Units/Composite/Phase.cs new file mode 100644 index 000000000..45a3ef86d --- /dev/null +++ b/csharp/Lib/Units/Composite/Phase.cs @@ -0,0 +1,7 @@ +namespace InnovEnergy.Lib.Units.Composite; + +public abstract record Phase +( + Voltage Voltage, + Current Current +); \ No newline at end of file diff --git a/csharp/Lib/Units/Current.cs b/csharp/Lib/Units/Current.cs new file mode 100644 index 000000000..b3c36ee34 --- /dev/null +++ b/csharp/Lib/Units/Current.cs @@ -0,0 +1,20 @@ +using InnovEnergy.Lib.Units.Generator; + +namespace InnovEnergy.Lib.Units; + + +[Sum] +public readonly partial struct Current +{ + public static String Unit => "A"; + public static String Symbol => "I"; + + public Current(Decimal value) => Value = value; + + // P=UI + public static Power operator *(Current current, Voltage voltage) => new Power(current.Value * voltage.Value); + + // U=RI + public static Voltage operator *(Current current, Resistance resistance) => new Voltage(resistance.Value* current.Value); + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Current.generated.cs b/csharp/Lib/Units/Current.generated.cs new file mode 100644 index 000000000..cda7eeadf --- /dev/null +++ b/csharp/Lib/Units/Current.generated.cs @@ -0,0 +1,78 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. +#define Sum + +using static System.Math; + +namespace InnovEnergy.Lib.Units; + +using T = Current; + +public readonly partial struct Current +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + #if Sum + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + #elif Mean + + public static T operator +(T left, T right) => new T((left.Value + right.Value)/2m); + + #elif Equal + + public static T operator +(T left, T right) + { + var d = Max(Abs(left.Value), Abs(right.Value)); + + if (d != 0m) + return new T(0m); + + var relativeError = Abs(left.Value - right.Value) / d; + + const Decimal maxRelativeError = 0.05m; + + if (relativeError > maxRelativeError) + throw new Exception($"{nameof(left)} and {nameof(right)} must be approximately equal.\n" + + $"Difference > {maxRelativeError * 100}% detected\n" + + $"{nameof(left)} : {left}\n" + + $"{nameof(right)}: {right}"); + + return new T((left.Value + right.Value) / 2m); + } + #endif + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} diff --git a/csharp/Lib/Units/Frequency.cs b/csharp/Lib/Units/Frequency.cs new file mode 100644 index 000000000..3041325c2 --- /dev/null +++ b/csharp/Lib/Units/Frequency.cs @@ -0,0 +1,18 @@ +using InnovEnergy.Lib.Units.Generator; + +namespace InnovEnergy.Lib.Units; + +[Equal] +public readonly partial struct Frequency +{ + public static String Unit => "Hz"; + public static String Symbol => "f"; + + public Frequency(Decimal value) + { + if (value < 0) + throw new ArgumentException(nameof(Frequency) + " cannot be negative", nameof(value)); + + Value = value; + } +} \ No newline at end of file diff --git a/csharp/Lib/Units/Frequency.generated.cs b/csharp/Lib/Units/Frequency.generated.cs new file mode 100644 index 000000000..015d67536 --- /dev/null +++ b/csharp/Lib/Units/Frequency.generated.cs @@ -0,0 +1,78 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. +#define Equal + +using static System.Math; + +namespace InnovEnergy.Lib.Units; + +using T = Frequency; + +public readonly partial struct Frequency +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + #if Sum + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + #elif Mean + + public static T operator +(T left, T right) => new T((left.Value + right.Value)/2m); + + #elif Equal + + public static T operator +(T left, T right) + { + var d = Max(Abs(left.Value), Abs(right.Value)); + + if (d != 0m) + return new T(0m); + + var relativeError = Abs(left.Value - right.Value) / d; + + const Decimal maxRelativeError = 0.05m; + + if (relativeError > maxRelativeError) + throw new Exception($"{nameof(left)} and {nameof(right)} must be approximately equal.\n" + + $"Difference > {maxRelativeError * 100}% detected\n" + + $"{nameof(left)} : {left}\n" + + $"{nameof(right)}: {right}"); + + return new T((left.Value + right.Value) / 2m); + } + #endif + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} diff --git a/csharp/Lib/Units/Generator/EqualAttribute.cs b/csharp/Lib/Units/Generator/EqualAttribute.cs new file mode 100644 index 000000000..c0131044a --- /dev/null +++ b/csharp/Lib/Units/Generator/EqualAttribute.cs @@ -0,0 +1,5 @@ +namespace InnovEnergy.Lib.Units.Generator; + +[AttributeUsage(AttributeTargets.Struct)] +internal class EqualAttribute: Attribute +{} \ No newline at end of file diff --git a/csharp/Lib/Units/Generator/MeanAttribute.cs b/csharp/Lib/Units/Generator/MeanAttribute.cs new file mode 100644 index 000000000..161da8b0e --- /dev/null +++ b/csharp/Lib/Units/Generator/MeanAttribute.cs @@ -0,0 +1,5 @@ +namespace InnovEnergy.Lib.Units.Generator; + +[AttributeUsage(AttributeTargets.Struct)] +internal class MeanAttribute: Attribute +{} \ No newline at end of file diff --git a/csharp/Lib/Units/Generator/SumAttribute.cs b/csharp/Lib/Units/Generator/SumAttribute.cs new file mode 100644 index 000000000..c4af9a156 --- /dev/null +++ b/csharp/Lib/Units/Generator/SumAttribute.cs @@ -0,0 +1,5 @@ +namespace InnovEnergy.Lib.Units.Generator; + +[AttributeUsage(AttributeTargets.Struct)] +internal class SumAttribute: Attribute +{} \ No newline at end of file diff --git a/csharp/Lib/Units/Generator/Template.txt b/csharp/Lib/Units/Generator/Template.txt new file mode 100644 index 000000000..c656f51df --- /dev/null +++ b/csharp/Lib/Units/Generator/Template.txt @@ -0,0 +1,78 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. +#define Type + +using static System.Math; + +namespace InnovEnergy.Lib.Units; + +using T = Template; + +public readonly partial struct Template +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + #if Sum + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + #elif Mean + + public static T operator +(T left, T right) => new T((left.Value + right.Value)/2m); + + #elif Equal + + public static T operator +(T left, T right) + { + var d = Max(Abs(left.Value), Abs(right.Value)); + + if (d != 0m) + return new T(0m); + + var relativeError = Abs(left.Value - right.Value) / d; + + const Decimal maxRelativeError = 0.05m; + + if (relativeError > maxRelativeError) + throw new Exception($"{nameof(left)} and {nameof(right)} must be approximately equal.\n" + + $"Difference > {maxRelativeError * 100}% detected\n" + + $"{nameof(left)} : {left}\n" + + $"{nameof(right)}: {right}"); + + return new T((left.Value + right.Value) / 2m); + } + #endif + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} diff --git a/csharp/Lib/Units/Generator/generate.sh b/csharp/Lib/Units/Generator/generate.sh new file mode 100755 index 000000000..625f32f89 --- /dev/null +++ b/csharp/Lib/Units/Generator/generate.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + + +scriptDir=$( dirname -- "$0"; ) +cd "$scriptDir/.." || exit + +for match in $(grep -e '\[Sum\]\|\[Equal\]\|\[Mean\]' -o *.cs | tr -d '[]') +do + path="${match%:*}" + type="${match#*:}" + file=$(basename -- "$path") + class="${file%.*}" + echo "generating $file" + sed "s/Template/$class/g; s/Type/$type/" "./Generator/Template.txt" > "./$class.generated.cs" +done \ No newline at end of file diff --git a/csharp/lib/Units/Json/CurrentConverter.cs b/csharp/Lib/Units/Json/CurrentConverter.cs similarity index 92% rename from csharp/lib/Units/Json/CurrentConverter.cs rename to csharp/Lib/Units/Json/CurrentConverter.cs index 93733110f..b89ec4a90 100644 --- a/csharp/lib/Units/Json/CurrentConverter.cs +++ b/csharp/Lib/Units/Json/CurrentConverter.cs @@ -1,7 +1,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace InnovEnergy.Units.Json; +namespace InnovEnergy.Lib.Units.Json; public class CurrentConverter : JsonConverter { diff --git a/csharp/lib/Units/Json/PowerConverter.cs b/csharp/Lib/Units/Json/PowerConverter.cs similarity index 91% rename from csharp/lib/Units/Json/PowerConverter.cs rename to csharp/Lib/Units/Json/PowerConverter.cs index 037252da4..766f3636c 100644 --- a/csharp/lib/Units/Json/PowerConverter.cs +++ b/csharp/Lib/Units/Json/PowerConverter.cs @@ -1,7 +1,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace InnovEnergy.Units.Json; +namespace InnovEnergy.Lib.Units.Json; public class PowerConverter : JsonConverter { diff --git a/csharp/lib/Units/Json/ResistanceConverter.cs b/csharp/Lib/Units/Json/ResistanceConverter.cs similarity index 92% rename from csharp/lib/Units/Json/ResistanceConverter.cs rename to csharp/Lib/Units/Json/ResistanceConverter.cs index 022daff8c..67ec28a13 100644 --- a/csharp/lib/Units/Json/ResistanceConverter.cs +++ b/csharp/Lib/Units/Json/ResistanceConverter.cs @@ -1,7 +1,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace InnovEnergy.Units.Json; +namespace InnovEnergy.Lib.Units.Json; public class ResistanceConverter : JsonConverter { diff --git a/csharp/lib/Units/Json/VoltageConverter.cs b/csharp/Lib/Units/Json/VoltageConverter.cs similarity index 92% rename from csharp/lib/Units/Json/VoltageConverter.cs rename to csharp/Lib/Units/Json/VoltageConverter.cs index 62922c1d7..290c6f38b 100644 --- a/csharp/lib/Units/Json/VoltageConverter.cs +++ b/csharp/Lib/Units/Json/VoltageConverter.cs @@ -1,7 +1,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace InnovEnergy.Units.Json; +namespace InnovEnergy.Lib.Units.Json; public class VoltageConverter : JsonConverter { diff --git a/csharp/Lib/Units/Power.cs b/csharp/Lib/Units/Power.cs new file mode 100644 index 000000000..eaedbf7f2 --- /dev/null +++ b/csharp/Lib/Units/Power.cs @@ -0,0 +1,19 @@ + +using InnovEnergy.Lib.Units.Generator; + +namespace InnovEnergy.Lib.Units; + +[Sum] +public readonly partial struct Power +{ + public static String Unit => "W"; + public static String Symbol => "P"; + + public Power(Decimal value) => Value = value; + + + // P=UI + public static Voltage operator /(Power power, Current current) => new Voltage(power.Value / current.Value); + public static Current operator /(Power power, Voltage voltage) => new Current(power.Value / voltage.Value); + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Power.generated.cs b/csharp/Lib/Units/Power.generated.cs new file mode 100644 index 000000000..c26ad26fd --- /dev/null +++ b/csharp/Lib/Units/Power.generated.cs @@ -0,0 +1,78 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. +#define Sum + +using static System.Math; + +namespace InnovEnergy.Lib.Units; + +using T = Power; + +public readonly partial struct Power +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + #if Sum + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + #elif Mean + + public static T operator +(T left, T right) => new T((left.Value + right.Value)/2m); + + #elif Equal + + public static T operator +(T left, T right) + { + var d = Max(Abs(left.Value), Abs(right.Value)); + + if (d != 0m) + return new T(0m); + + var relativeError = Abs(left.Value - right.Value) / d; + + const Decimal maxRelativeError = 0.05m; + + if (relativeError > maxRelativeError) + throw new Exception($"{nameof(left)} and {nameof(right)} must be approximately equal.\n" + + $"Difference > {maxRelativeError * 100}% detected\n" + + $"{nameof(left)} : {left}\n" + + $"{nameof(right)}: {right}"); + + return new T((left.Value + right.Value) / 2m); + } + #endif + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} diff --git a/csharp/Lib/Units/ReactivePower.cs b/csharp/Lib/Units/ReactivePower.cs new file mode 100644 index 000000000..30d7641b9 --- /dev/null +++ b/csharp/Lib/Units/ReactivePower.cs @@ -0,0 +1,13 @@ + +using InnovEnergy.Lib.Units.Generator; + +namespace InnovEnergy.Lib.Units; + +[Sum] +public readonly partial struct ReactivePower +{ + public static String Unit => "var"; + public static String Symbol => "Q"; + + public ReactivePower(Decimal value) => Value = value; +} \ No newline at end of file diff --git a/csharp/Lib/Units/ReactivePower.generated.cs b/csharp/Lib/Units/ReactivePower.generated.cs new file mode 100644 index 000000000..9b8def505 --- /dev/null +++ b/csharp/Lib/Units/ReactivePower.generated.cs @@ -0,0 +1,78 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. +#define Sum + +using static System.Math; + +namespace InnovEnergy.Lib.Units; + +using T = ReactivePower; + +public readonly partial struct ReactivePower +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + #if Sum + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + #elif Mean + + public static T operator +(T left, T right) => new T((left.Value + right.Value)/2m); + + #elif Equal + + public static T operator +(T left, T right) + { + var d = Max(Abs(left.Value), Abs(right.Value)); + + if (d != 0m) + return new T(0m); + + var relativeError = Abs(left.Value - right.Value) / d; + + const Decimal maxRelativeError = 0.05m; + + if (relativeError > maxRelativeError) + throw new Exception($"{nameof(left)} and {nameof(right)} must be approximately equal.\n" + + $"Difference > {maxRelativeError * 100}% detected\n" + + $"{nameof(left)} : {left}\n" + + $"{nameof(right)}: {right}"); + + return new T((left.Value + right.Value) / 2m); + } + #endif + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} diff --git a/csharp/Lib/Units/Resistance.cs b/csharp/Lib/Units/Resistance.cs new file mode 100644 index 000000000..ce426e229 --- /dev/null +++ b/csharp/Lib/Units/Resistance.cs @@ -0,0 +1,17 @@ +using InnovEnergy.Lib.Units.Generator; + +namespace InnovEnergy.Lib.Units; + +[Sum] +public readonly partial struct Resistance +{ + public static String Unit => "Ω"; + public static String Symbol => "R"; + + + public Resistance(Decimal value) => Value = value; + + // U=RI + public static Voltage operator *(Resistance resistance, Current current) => new Voltage(resistance.Value * current.Value); + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Resistance.generated.cs b/csharp/Lib/Units/Resistance.generated.cs new file mode 100644 index 000000000..5be7685b6 --- /dev/null +++ b/csharp/Lib/Units/Resistance.generated.cs @@ -0,0 +1,78 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. +#define Sum + +using static System.Math; + +namespace InnovEnergy.Lib.Units; + +using T = Resistance; + +public readonly partial struct Resistance +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + #if Sum + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + #elif Mean + + public static T operator +(T left, T right) => new T((left.Value + right.Value)/2m); + + #elif Equal + + public static T operator +(T left, T right) + { + var d = Max(Abs(left.Value), Abs(right.Value)); + + if (d != 0m) + return new T(0m); + + var relativeError = Abs(left.Value - right.Value) / d; + + const Decimal maxRelativeError = 0.05m; + + if (relativeError > maxRelativeError) + throw new Exception($"{nameof(left)} and {nameof(right)} must be approximately equal.\n" + + $"Difference > {maxRelativeError * 100}% detected\n" + + $"{nameof(left)} : {left}\n" + + $"{nameof(right)}: {right}"); + + return new T((left.Value + right.Value) / 2m); + } + #endif + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} diff --git a/csharp/Lib/Units/State.cs b/csharp/Lib/Units/State.cs new file mode 100644 index 000000000..752a5751d --- /dev/null +++ b/csharp/Lib/Units/State.cs @@ -0,0 +1,18 @@ +namespace InnovEnergy.Lib.Units; + +public readonly struct State +{ + public IReadOnlyList Values { get; } + + public State(IReadOnlyList values) => Values = values; + + public State(params String[] values) : this((IReadOnlyList)values){} + public State(params State[] states) : this(states.SelectMany(s => s.Values).ToList()){} + + public State(Enum e) : this(e.ToString()){} + + public static implicit operator State(Enum e) => new State(e); + public static implicit operator State(String s) => new State(s); + + public static State operator +(State left, State right) => new State(left, right); +} \ No newline at end of file diff --git a/csharp/Lib/Units/Temperature.cs b/csharp/Lib/Units/Temperature.cs new file mode 100644 index 000000000..dc2d7e5ad --- /dev/null +++ b/csharp/Lib/Units/Temperature.cs @@ -0,0 +1,16 @@ +using InnovEnergy.Lib.Units.Generator; + +namespace InnovEnergy.Lib.Units; + +using T=Temperature; + +[Mean] +public readonly partial struct Temperature +{ + public static String Unit => "°C"; + public static String Symbol => "T"; + + public Temperature(Decimal value) => Value = value; + + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Temperature.generated.cs b/csharp/Lib/Units/Temperature.generated.cs new file mode 100644 index 000000000..edc3fdbfa --- /dev/null +++ b/csharp/Lib/Units/Temperature.generated.cs @@ -0,0 +1,78 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. +#define Mean + +using static System.Math; + +namespace InnovEnergy.Lib.Units; + +using T = Temperature; + +public readonly partial struct Temperature +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + #if Sum + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + #elif Mean + + public static T operator +(T left, T right) => new T((left.Value + right.Value)/2m); + + #elif Equal + + public static T operator +(T left, T right) + { + var d = Max(Abs(left.Value), Abs(right.Value)); + + if (d != 0m) + return new T(0m); + + var relativeError = Abs(left.Value - right.Value) / d; + + const Decimal maxRelativeError = 0.05m; + + if (relativeError > maxRelativeError) + throw new Exception($"{nameof(left)} and {nameof(right)} must be approximately equal.\n" + + $"Difference > {maxRelativeError * 100}% detected\n" + + $"{nameof(left)} : {left}\n" + + $"{nameof(right)}: {right}"); + + return new T((left.Value + right.Value) / 2m); + } + #endif + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} diff --git a/csharp/Lib/Units/Units.cs b/csharp/Lib/Units/Units.cs new file mode 100644 index 000000000..de1b246ad --- /dev/null +++ b/csharp/Lib/Units/Units.cs @@ -0,0 +1,27 @@ +using System.Text.Json.Serialization; +using InnovEnergy.Lib.Units.Json; + +namespace InnovEnergy.Lib.Units; + +public static class Units +{ + public static Current A (this Decimal value) => new Current(value); + public static Voltage V (this Decimal value) => new Voltage(value); + public static Power W (this Decimal value) => new Power(value); + public static ReactivePower Var (this Decimal value) => new ReactivePower(value); + public static ApparentPower Va (this Decimal value) => new ApparentPower(value); + public static Resistance Ohm (this Decimal value) => new Resistance(value); + public static Frequency Hz (this Decimal value) => new Frequency(value); + public static Angle Rad (this Decimal value) => new Angle(value); + public static Temperature Celsius(this Decimal value) => new Temperature(value); + + public static readonly IReadOnlyList JsonConverters = new JsonConverter[] + { + new CurrentConverter(), + new VoltageConverter(), + new PowerConverter(), + new ResistanceConverter(), + + // TODO + }; +} \ No newline at end of file diff --git a/csharp/Lib/Units/Units.csproj b/csharp/Lib/Units/Units.csproj new file mode 100644 index 000000000..4cedc809f --- /dev/null +++ b/csharp/Lib/Units/Units.csproj @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/csharp/Lib/Units/Voltage.cs b/csharp/Lib/Units/Voltage.cs new file mode 100644 index 000000000..2c65129e4 --- /dev/null +++ b/csharp/Lib/Units/Voltage.cs @@ -0,0 +1,19 @@ +using InnovEnergy.Lib.Units.Generator; + +namespace InnovEnergy.Lib.Units; + +[Equal] +public readonly partial struct Voltage +{ + public static String Unit => "V"; + public static String Symbol => "U"; + + public Voltage(Decimal value) => Value = value; + + + // U=RI + public static Current operator /(Voltage voltage, Resistance resistance) => new Current(voltage.Value / resistance.Value); + + // P=UI + public static Power operator *(Voltage voltage, Current current) => new Power(current.Value * voltage.Value); +} \ No newline at end of file diff --git a/csharp/Lib/Units/Voltage.generated.cs b/csharp/Lib/Units/Voltage.generated.cs new file mode 100644 index 000000000..07dc88d06 --- /dev/null +++ b/csharp/Lib/Units/Voltage.generated.cs @@ -0,0 +1,78 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. +#define Equal + +using static System.Math; + +namespace InnovEnergy.Lib.Units; + +using T = Voltage; + +public readonly partial struct Voltage +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + #if Sum + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + #elif Mean + + public static T operator +(T left, T right) => new T((left.Value + right.Value)/2m); + + #elif Equal + + public static T operator +(T left, T right) + { + var d = Max(Abs(left.Value), Abs(right.Value)); + + if (d != 0m) + return new T(0m); + + var relativeError = Abs(left.Value - right.Value) / d; + + const Decimal maxRelativeError = 0.05m; + + if (relativeError > maxRelativeError) + throw new Exception($"{nameof(left)} and {nameof(right)} must be approximately equal.\n" + + $"Difference > {maxRelativeError * 100}% detected\n" + + $"{nameof(left)} : {left}\n" + + $"{nameof(right)}: {right}"); + + return new T((left.Value + right.Value) / 2m); + } + #endif + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} diff --git a/csharp/lib/Utils/ArrayExtensions.cs b/csharp/Lib/Utils/ArrayExtensions.cs similarity index 100% rename from csharp/lib/Utils/ArrayExtensions.cs rename to csharp/Lib/Utils/ArrayExtensions.cs diff --git a/csharp/lib/Utils/AsyncDelegates.cs b/csharp/Lib/Utils/AsyncDelegates.cs similarity index 100% rename from csharp/lib/Utils/AsyncDelegates.cs rename to csharp/Lib/Utils/AsyncDelegates.cs diff --git a/csharp/lib/Utils/AsyncEnumerableEx.cs b/csharp/Lib/Utils/AsyncEnumerableEx.cs similarity index 100% rename from csharp/lib/Utils/AsyncEnumerableEx.cs rename to csharp/Lib/Utils/AsyncEnumerableEx.cs diff --git a/csharp/lib/Utils/AutoComplete.cs b/csharp/Lib/Utils/AutoComplete.cs similarity index 100% rename from csharp/lib/Utils/AutoComplete.cs rename to csharp/Lib/Utils/AutoComplete.cs diff --git a/csharp/lib/Utils/CliCommandUtils.cs b/csharp/Lib/Utils/CliCommandUtils.cs similarity index 100% rename from csharp/lib/Utils/CliCommandUtils.cs rename to csharp/Lib/Utils/CliCommandUtils.cs diff --git a/csharp/lib/Utils/ConsoleUtils.cs b/csharp/Lib/Utils/ConsoleUtils.cs similarity index 100% rename from csharp/lib/Utils/ConsoleUtils.cs rename to csharp/Lib/Utils/ConsoleUtils.cs diff --git a/csharp/lib/Utils/DecimalUtils.cs b/csharp/Lib/Utils/DecimalUtils.cs similarity index 100% rename from csharp/lib/Utils/DecimalUtils.cs rename to csharp/Lib/Utils/DecimalUtils.cs diff --git a/csharp/lib/Utils/DictObservables.cs b/csharp/Lib/Utils/DictObservables.cs similarity index 100% rename from csharp/lib/Utils/DictObservables.cs rename to csharp/Lib/Utils/DictObservables.cs diff --git a/csharp/lib/Utils/Disposable.cs b/csharp/Lib/Utils/Disposable.cs similarity index 100% rename from csharp/lib/Utils/Disposable.cs rename to csharp/Lib/Utils/Disposable.cs diff --git a/csharp/lib/Utils/EnumerableUtils.cs b/csharp/Lib/Utils/EnumerableUtils.cs similarity index 100% rename from csharp/lib/Utils/EnumerableUtils.cs rename to csharp/Lib/Utils/EnumerableUtils.cs diff --git a/csharp/lib/Utils/ExceptionHandling.cs b/csharp/Lib/Utils/ExceptionHandling.cs similarity index 100% rename from csharp/lib/Utils/ExceptionHandling.cs rename to csharp/Lib/Utils/ExceptionHandling.cs diff --git a/csharp/lib/Utils/FileSystem.cs b/csharp/Lib/Utils/FileSystem.cs similarity index 100% rename from csharp/lib/Utils/FileSystem.cs rename to csharp/Lib/Utils/FileSystem.cs diff --git a/csharp/lib/Utils/JsonNodeAccessors.cs b/csharp/Lib/Utils/JsonNodeAccessors.cs similarity index 100% rename from csharp/lib/Utils/JsonNodeAccessors.cs rename to csharp/Lib/Utils/JsonNodeAccessors.cs diff --git a/csharp/lib/Utils/Maybe.cs b/csharp/Lib/Utils/Maybe.cs similarity index 100% rename from csharp/lib/Utils/Maybe.cs rename to csharp/Lib/Utils/Maybe.cs diff --git a/csharp/lib/Utils/Net/NetUtils.cs b/csharp/Lib/Utils/Net/NetUtils.cs similarity index 100% rename from csharp/lib/Utils/Net/NetUtils.cs rename to csharp/Lib/Utils/Net/NetUtils.cs diff --git a/csharp/lib/Utils/Net/PingExtensions.cs b/csharp/Lib/Utils/Net/PingExtensions.cs similarity index 100% rename from csharp/lib/Utils/Net/PingExtensions.cs rename to csharp/Lib/Utils/Net/PingExtensions.cs diff --git a/csharp/lib/Utils/Net/UdpExtensions.cs b/csharp/Lib/Utils/Net/UdpExtensions.cs similarity index 100% rename from csharp/lib/Utils/Net/UdpExtensions.cs rename to csharp/Lib/Utils/Net/UdpExtensions.cs diff --git a/csharp/lib/Utils/None.cs b/csharp/Lib/Utils/None.cs similarity index 100% rename from csharp/lib/Utils/None.cs rename to csharp/Lib/Utils/None.cs diff --git a/csharp/lib/Utils/NullableUtils.cs b/csharp/Lib/Utils/NullableUtils.cs similarity index 100% rename from csharp/lib/Utils/NullableUtils.cs rename to csharp/Lib/Utils/NullableUtils.cs diff --git a/csharp/lib/Utils/ObservableExceptionHandling.cs b/csharp/Lib/Utils/ObservableExceptionHandling.cs similarity index 100% rename from csharp/lib/Utils/ObservableExceptionHandling.cs rename to csharp/Lib/Utils/ObservableExceptionHandling.cs diff --git a/csharp/lib/Utils/ObservableUtils.cs b/csharp/Lib/Utils/ObservableUtils.cs similarity index 100% rename from csharp/lib/Utils/ObservableUtils.cs rename to csharp/Lib/Utils/ObservableUtils.cs diff --git a/csharp/lib/Utils/PointFree.cs b/csharp/Lib/Utils/PointFree.cs similarity index 100% rename from csharp/lib/Utils/PointFree.cs rename to csharp/Lib/Utils/PointFree.cs diff --git a/csharp/lib/Utils/SshHost.cs b/csharp/Lib/Utils/SshHost.cs similarity index 100% rename from csharp/lib/Utils/SshHost.cs rename to csharp/Lib/Utils/SshHost.cs diff --git a/csharp/lib/Utils/StreamExtensions.cs b/csharp/Lib/Utils/StreamExtensions.cs similarity index 100% rename from csharp/lib/Utils/StreamExtensions.cs rename to csharp/Lib/Utils/StreamExtensions.cs diff --git a/csharp/lib/Utils/StringUtils.cs b/csharp/Lib/Utils/StringUtils.cs similarity index 100% rename from csharp/lib/Utils/StringUtils.cs rename to csharp/Lib/Utils/StringUtils.cs diff --git a/csharp/lib/Utils/TaskUtils.cs b/csharp/Lib/Utils/TaskUtils.cs similarity index 100% rename from csharp/lib/Utils/TaskUtils.cs rename to csharp/Lib/Utils/TaskUtils.cs diff --git a/csharp/lib/Utils/TextBlock.cs b/csharp/Lib/Utils/TextBlock.cs similarity index 100% rename from csharp/lib/Utils/TextBlock.cs rename to csharp/Lib/Utils/TextBlock.cs diff --git a/csharp/lib/Utils/Try/Operators.async.cs b/csharp/Lib/Utils/Try/Operators.async.cs similarity index 100% rename from csharp/lib/Utils/Try/Operators.async.cs rename to csharp/Lib/Utils/Try/Operators.async.cs diff --git a/csharp/lib/Utils/Try/Operators.sync.cs b/csharp/Lib/Utils/Try/Operators.sync.cs similarity index 100% rename from csharp/lib/Utils/Try/Operators.sync.cs rename to csharp/Lib/Utils/Try/Operators.sync.cs diff --git a/csharp/lib/Utils/Try/Policy.cs b/csharp/Lib/Utils/Try/Policy.cs similarity index 100% rename from csharp/lib/Utils/Try/Policy.cs rename to csharp/Lib/Utils/Try/Policy.cs diff --git a/csharp/lib/Utils/Try/TryAsync.async.cs b/csharp/Lib/Utils/Try/TryAsync.async.cs similarity index 100% rename from csharp/lib/Utils/Try/TryAsync.async.cs rename to csharp/Lib/Utils/Try/TryAsync.async.cs diff --git a/csharp/lib/Utils/Try/TryAsync.cs b/csharp/Lib/Utils/Try/TryAsync.cs similarity index 100% rename from csharp/lib/Utils/Try/TryAsync.cs rename to csharp/Lib/Utils/Try/TryAsync.cs diff --git a/csharp/lib/Utils/Try/TryAsync.sync.cs b/csharp/Lib/Utils/Try/TryAsync.sync.cs similarity index 100% rename from csharp/lib/Utils/Try/TryAsync.sync.cs rename to csharp/Lib/Utils/Try/TryAsync.sync.cs diff --git a/csharp/lib/Utils/Try/TrySync.async.cs b/csharp/Lib/Utils/Try/TrySync.async.cs similarity index 100% rename from csharp/lib/Utils/Try/TrySync.async.cs rename to csharp/Lib/Utils/Try/TrySync.async.cs diff --git a/csharp/lib/Utils/Try/TrySync.cs b/csharp/Lib/Utils/Try/TrySync.cs similarity index 100% rename from csharp/lib/Utils/Try/TrySync.cs rename to csharp/Lib/Utils/Try/TrySync.cs diff --git a/csharp/lib/Utils/Try/TrySync.sync.cs b/csharp/Lib/Utils/Try/TrySync.sync.cs similarity index 100% rename from csharp/lib/Utils/Try/TrySync.sync.cs rename to csharp/Lib/Utils/Try/TrySync.sync.cs diff --git a/csharp/lib/Utils/Utils.cs b/csharp/Lib/Utils/Utils.cs similarity index 96% rename from csharp/lib/Utils/Utils.cs rename to csharp/Lib/Utils/Utils.cs index b07ab7111..690d6abaa 100644 --- a/csharp/lib/Utils/Utils.cs +++ b/csharp/Lib/Utils/Utils.cs @@ -76,8 +76,17 @@ public static class Utils var res = index % length; return res >= 0 - ? res - : res + length; + ? res + : res + length; + } + + public static Decimal Modulo(this Decimal dividend, Decimal divisor) + { + var res = dividend % divisor; + + return res >= 0 + ? res + : res + divisor; } public static IEnumerable Traverse(this T root, Func> getChildren) diff --git a/csharp/lib/Utils/Utils.csproj b/csharp/Lib/Utils/Utils.csproj similarity index 74% rename from csharp/lib/Utils/Utils.csproj rename to csharp/Lib/Utils/Utils.csproj index 0ddcddea5..59af027d7 100644 --- a/csharp/lib/Utils/Utils.csproj +++ b/csharp/Lib/Utils/Utils.csproj @@ -1,8 +1,8 @@ - + - InnovEnergy.Lib.Utils + diff --git a/csharp/lib/Utils/Utils.sln b/csharp/Lib/Utils/Utils.sln similarity index 100% rename from csharp/lib/Utils/Utils.sln rename to csharp/Lib/Utils/Utils.sln diff --git a/csharp/lib/Utils/ValueTupleUtils.cs b/csharp/Lib/Utils/ValueTupleUtils.cs similarity index 100% rename from csharp/lib/Utils/ValueTupleUtils.cs rename to csharp/Lib/Utils/ValueTupleUtils.cs diff --git a/csharp/lib/Victron/VeDBus/Program.cs b/csharp/Lib/Victron/VeDBus/Program.cs similarity index 100% rename from csharp/lib/Victron/VeDBus/Program.cs rename to csharp/Lib/Victron/VeDBus/Program.cs diff --git a/csharp/lib/Victron/VeDBus/VeDBus.cs b/csharp/Lib/Victron/VeDBus/VeDBus.cs similarity index 100% rename from csharp/lib/Victron/VeDBus/VeDBus.cs rename to csharp/Lib/Victron/VeDBus/VeDBus.cs diff --git a/csharp/lib/Victron/VeDBus/VeDBus.csproj b/csharp/Lib/Victron/VeDBus/VeDBus.csproj similarity index 76% rename from csharp/lib/Victron/VeDBus/VeDBus.csproj rename to csharp/Lib/Victron/VeDBus/VeDBus.csproj index 939a409a2..fe0000124 100644 --- a/csharp/lib/Victron/VeDBus/VeDBus.csproj +++ b/csharp/Lib/Victron/VeDBus/VeDBus.csproj @@ -1,9 +1,9 @@ - + - InnovEnergy.Lib.Victron.VeDBus + latest diff --git a/csharp/lib/Victron/VeDBus/VeDBusApi.cs b/csharp/Lib/Victron/VeDBus/VeDBusApi.cs similarity index 100% rename from csharp/lib/Victron/VeDBus/VeDBusApi.cs rename to csharp/Lib/Victron/VeDBus/VeDBusApi.cs diff --git a/csharp/lib/Victron/VeDBus/VeDbusService.cs b/csharp/Lib/Victron/VeDBus/VeDbusService.cs similarity index 100% rename from csharp/lib/Victron/VeDBus/VeDbusService.cs rename to csharp/Lib/Victron/VeDBus/VeDbusService.cs diff --git a/csharp/lib/Victron/VeDBus/VeProperties.Dbus.cs b/csharp/Lib/Victron/VeDBus/VeProperties.Dbus.cs similarity index 100% rename from csharp/lib/Victron/VeDBus/VeProperties.Dbus.cs rename to csharp/Lib/Victron/VeDBus/VeProperties.Dbus.cs diff --git a/csharp/lib/Victron/VeDBus/VeProperties.cs b/csharp/Lib/Victron/VeDBus/VeProperties.cs similarity index 100% rename from csharp/lib/Victron/VeDBus/VeProperties.cs rename to csharp/Lib/Victron/VeDBus/VeProperties.cs diff --git a/csharp/lib/Victron/VeDBus/VeProperty.cs b/csharp/Lib/Victron/VeDBus/VeProperty.cs similarity index 100% rename from csharp/lib/Victron/VeDBus/VeProperty.cs rename to csharp/Lib/Victron/VeDBus/VeProperty.cs diff --git a/csharp/lib/Victron/VictronVRM/Detail.cs b/csharp/Lib/Victron/VictronVRM/Detail.cs similarity index 100% rename from csharp/lib/Victron/VictronVRM/Detail.cs rename to csharp/Lib/Victron/VictronVRM/Detail.cs diff --git a/csharp/lib/Victron/VictronVRM/Details.cs b/csharp/Lib/Victron/VictronVRM/Details.cs similarity index 100% rename from csharp/lib/Victron/VictronVRM/Details.cs rename to csharp/Lib/Victron/VictronVRM/Details.cs diff --git a/csharp/lib/Victron/VictronVRM/Device.cs b/csharp/Lib/Victron/VictronVRM/Device.cs similarity index 100% rename from csharp/lib/Victron/VictronVRM/Device.cs rename to csharp/Lib/Victron/VictronVRM/Device.cs diff --git a/csharp/lib/Victron/VictronVRM/FlurlExtensions.cs b/csharp/Lib/Victron/VictronVRM/FlurlExtensions.cs similarity index 100% rename from csharp/lib/Victron/VictronVRM/FlurlExtensions.cs rename to csharp/Lib/Victron/VictronVRM/FlurlExtensions.cs diff --git a/csharp/lib/Victron/VictronVRM/Installation.Settings.cs b/csharp/Lib/Victron/VictronVRM/Installation.Settings.cs similarity index 100% rename from csharp/lib/Victron/VictronVRM/Installation.Settings.cs rename to csharp/Lib/Victron/VictronVRM/Installation.Settings.cs diff --git a/csharp/lib/Victron/VictronVRM/Installation.Tags.cs b/csharp/Lib/Victron/VictronVRM/Installation.Tags.cs similarity index 100% rename from csharp/lib/Victron/VictronVRM/Installation.Tags.cs rename to csharp/Lib/Victron/VictronVRM/Installation.Tags.cs diff --git a/csharp/lib/Victron/VictronVRM/Installation.cs b/csharp/Lib/Victron/VictronVRM/Installation.cs similarity index 98% rename from csharp/lib/Victron/VictronVRM/Installation.cs rename to csharp/Lib/Victron/VictronVRM/Installation.cs index ba479b0f6..aa233e275 100644 --- a/csharp/lib/Victron/VictronVRM/Installation.cs +++ b/csharp/Lib/Victron/VictronVRM/Installation.cs @@ -1,6 +1,6 @@ using System.Text.Json.Nodes; +using InnovEnergy.Lib.Time.Unix; using InnovEnergy.Lib.Utils; -using InnovEnergy.Time.Unix; // ReSharper disable StringLiteralTypo diff --git a/csharp/lib/Victron/VictronVRM/Reply.cs b/csharp/Lib/Victron/VictronVRM/Reply.cs similarity index 100% rename from csharp/lib/Victron/VictronVRM/Reply.cs rename to csharp/Lib/Victron/VictronVRM/Reply.cs diff --git a/csharp/lib/Victron/VictronVRM/Requests.cs b/csharp/Lib/Victron/VictronVRM/Requests.cs similarity index 100% rename from csharp/lib/Victron/VictronVRM/Requests.cs rename to csharp/Lib/Victron/VictronVRM/Requests.cs diff --git a/csharp/lib/Victron/VictronVRM/Settings.cs b/csharp/Lib/Victron/VictronVRM/Settings.cs similarity index 100% rename from csharp/lib/Victron/VictronVRM/Settings.cs rename to csharp/Lib/Victron/VictronVRM/Settings.cs diff --git a/csharp/lib/Victron/VictronVRM/VictronVRM.csproj b/csharp/Lib/Victron/VictronVRM/VictronVRM.csproj similarity index 83% rename from csharp/lib/Victron/VictronVRM/VictronVRM.csproj rename to csharp/Lib/Victron/VictronVRM/VictronVRM.csproj index d8fe8e6dd..f37c8f354 100644 --- a/csharp/lib/Victron/VictronVRM/VictronVRM.csproj +++ b/csharp/Lib/Victron/VictronVRM/VictronVRM.csproj @@ -1,13 +1,13 @@ - + full - InnovEnergy.Lib.Victron.VictronVRM + latest diff --git a/csharp/lib/Victron/VictronVRM/VrmAccount.cs b/csharp/Lib/Victron/VictronVRM/VrmAccount.cs similarity index 100% rename from csharp/lib/Victron/VictronVRM/VrmAccount.cs rename to csharp/Lib/Victron/VictronVRM/VrmAccount.cs diff --git a/csharp/lib/WebServer/ContentType.cs b/csharp/Lib/WebServer/ContentType.cs similarity index 100% rename from csharp/lib/WebServer/ContentType.cs rename to csharp/Lib/WebServer/ContentType.cs diff --git a/csharp/lib/WebServer/Default.cs b/csharp/Lib/WebServer/Default.cs similarity index 100% rename from csharp/lib/WebServer/Default.cs rename to csharp/Lib/WebServer/Default.cs diff --git a/csharp/lib/WebServer/HttpExtensions.cs b/csharp/Lib/WebServer/HttpExtensions.cs similarity index 100% rename from csharp/lib/WebServer/HttpExtensions.cs rename to csharp/Lib/WebServer/HttpExtensions.cs diff --git a/csharp/lib/WebServer/HttpHeader.cs b/csharp/Lib/WebServer/HttpHeader.cs similarity index 100% rename from csharp/lib/WebServer/HttpHeader.cs rename to csharp/Lib/WebServer/HttpHeader.cs diff --git a/csharp/lib/WebServer/HttpMethod.cs b/csharp/Lib/WebServer/HttpMethod.cs similarity index 100% rename from csharp/lib/WebServer/HttpMethod.cs rename to csharp/Lib/WebServer/HttpMethod.cs diff --git a/csharp/lib/WebServer/HttpRequest.cs b/csharp/Lib/WebServer/HttpRequest.cs similarity index 100% rename from csharp/lib/WebServer/HttpRequest.cs rename to csharp/Lib/WebServer/HttpRequest.cs diff --git a/csharp/lib/WebServer/HttpResponse.cs b/csharp/Lib/WebServer/HttpResponse.cs similarity index 100% rename from csharp/lib/WebServer/HttpResponse.cs rename to csharp/Lib/WebServer/HttpResponse.cs diff --git a/csharp/lib/WebServer/WebServer.cs b/csharp/Lib/WebServer/WebServer.cs similarity index 100% rename from csharp/lib/WebServer/WebServer.cs rename to csharp/Lib/WebServer/WebServer.cs diff --git a/csharp/lib/WebServer/WebServer.csproj b/csharp/Lib/WebServer/WebServer.csproj similarity index 67% rename from csharp/lib/WebServer/WebServer.csproj rename to csharp/Lib/WebServer/WebServer.csproj index e879bb272..00c76841c 100644 --- a/csharp/lib/WebServer/WebServer.csproj +++ b/csharp/Lib/WebServer/WebServer.csproj @@ -1,9 +1,9 @@ - + - InnovEnergy.Lib.WebServer + @@ -13,7 +13,7 @@ - + diff --git a/csharp/lib/Wireformat/WireFormat.csproj.DotSettings b/csharp/Lib/Wireformat/WireFormat.csproj.DotSettings similarity index 100% rename from csharp/lib/Wireformat/WireFormat.csproj.DotSettings rename to csharp/Lib/Wireformat/WireFormat.csproj.DotSettings diff --git a/csharp/lib/Wireformat/build_proto.sh b/csharp/Lib/Wireformat/build_proto.sh similarity index 100% rename from csharp/lib/Wireformat/build_proto.sh rename to csharp/Lib/Wireformat/build_proto.sh diff --git a/csharp/lib/Wireformat/package-lock.json b/csharp/Lib/Wireformat/package-lock.json similarity index 100% rename from csharp/lib/Wireformat/package-lock.json rename to csharp/Lib/Wireformat/package-lock.json diff --git a/csharp/lib/Wireformat/package.json b/csharp/Lib/Wireformat/package.json similarity index 100% rename from csharp/lib/Wireformat/package.json rename to csharp/Lib/Wireformat/package.json diff --git a/csharp/lib/Wireformat/proto/Payload.proto b/csharp/Lib/Wireformat/proto/Payload.proto similarity index 100% rename from csharp/lib/Wireformat/proto/Payload.proto rename to csharp/Lib/Wireformat/proto/Payload.proto diff --git a/csharp/lib/Wireformat/proto/VictronV1/BatteryStatus48TL.proto b/csharp/Lib/Wireformat/proto/VictronV1/BatteryStatus48TL.proto similarity index 100% rename from csharp/lib/Wireformat/proto/VictronV1/BatteryStatus48TL.proto rename to csharp/Lib/Wireformat/proto/VictronV1/BatteryStatus48TL.proto diff --git a/csharp/lib/Wireformat/proto/VictronV1/Device.proto b/csharp/Lib/Wireformat/proto/VictronV1/Device.proto similarity index 100% rename from csharp/lib/Wireformat/proto/VictronV1/Device.proto rename to csharp/Lib/Wireformat/proto/VictronV1/Device.proto diff --git a/csharp/lib/Wireformat/proto/VictronV1/VictronTopologyV1.proto b/csharp/Lib/Wireformat/proto/VictronV1/VictronTopologyV1.proto similarity index 100% rename from csharp/lib/Wireformat/proto/VictronV1/VictronTopologyV1.proto rename to csharp/Lib/Wireformat/proto/VictronV1/VictronTopologyV1.proto diff --git a/csharp/app/Backend/db.sqlite b/csharp/app/Backend/db.sqlite deleted file mode 100644 index fc3ad2ed8..000000000 Binary files a/csharp/app/Backend/db.sqlite and /dev/null differ diff --git a/csharp/app/Collector/Collector.csproj b/csharp/app/Collector/Collector.csproj deleted file mode 100644 index 9bbb60eb9..000000000 --- a/csharp/app/Collector/Collector.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - - InnovEnergy.Collector - - - - - - - - - - - - diff --git a/csharp/app/Collector/src/Records/BatteryRecord.cs b/csharp/app/Collector/src/Records/BatteryRecord.cs deleted file mode 100644 index a244d1a77..000000000 --- a/csharp/app/Collector/src/Records/BatteryRecord.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace InnovEnergy.Collector.Records; - -public abstract class BatteryRecord -{} \ No newline at end of file diff --git a/csharp/app/EmuMeterDriver/EmuMeterDriver.csproj b/csharp/app/EmuMeterDriver/EmuMeterDriver.csproj deleted file mode 100644 index 9132521ae..000000000 --- a/csharp/app/EmuMeterDriver/EmuMeterDriver.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - - InnovEnergy.EmuMeter - - - - - - - - - - - - - - - diff --git a/csharp/app/SaliMax/SaliMax.csproj b/csharp/app/SaliMax/SaliMax.csproj deleted file mode 100644 index 0893e2a24..000000000 --- a/csharp/app/SaliMax/SaliMax.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - - InnovEnergy.SaliMax - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/csharp/lib/Channels/Channels.csproj b/csharp/lib/Channels/Channels.csproj deleted file mode 100644 index ad3b1fed5..000000000 --- a/csharp/lib/Channels/Channels.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - InnovEnergy.Lib.Channels - - - - - - - diff --git a/csharp/lib/Devices/Adam6060/Adam6060.csproj b/csharp/lib/Devices/Adam6060/Adam6060.csproj deleted file mode 100644 index f4fcbcbb6..000000000 --- a/csharp/lib/Devices/Adam6060/Adam6060.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - - InnovEnergy.Lib.Devices.Adam6060 - InnovEnergy.Lib.Devices.Adam6060 - - - - - - - - - - - - - diff --git a/csharp/lib/Devices/Trumpf/TruConvert/TruConvert.csproj b/csharp/lib/Devices/Trumpf/TruConvert/TruConvert.csproj deleted file mode 100644 index 0f5571422..000000000 --- a/csharp/lib/Devices/Trumpf/TruConvert/TruConvert.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - - InnovEnergy.Lib.Devices.Trumpf.TruConvert - InnovEnergy.Lib.Devices.Trumpf.TruConvert - latest - - - - - - - - diff --git a/csharp/lib/S3/DataRec.cs b/csharp/lib/S3/DataRec.cs deleted file mode 100644 index f0d9b2e30..000000000 --- a/csharp/lib/S3/DataRec.cs +++ /dev/null @@ -1,11 +0,0 @@ -using InnovEnergy.S3.Records.Fields; - -namespace InnovEnergy.S3; - -public record DataRec -{ - [Unit("V")] public Double Voltage { get; init; } - [Unit("A")] public Double Current { get; init; } - public Boolean Error { get; init; } - public String State { get; init; } -} \ No newline at end of file diff --git a/csharp/lib/S3/Drivers/Internal/Delegates/ReadRecord.cs b/csharp/lib/S3/Drivers/Internal/Delegates/ReadRecord.cs deleted file mode 100644 index 82c56cda8..000000000 --- a/csharp/lib/S3/Drivers/Internal/Delegates/ReadRecord.cs +++ /dev/null @@ -1,6 +0,0 @@ -using InnovEnergy.S3.Metadata; -using InnovEnergy.S3.Records.Specialized; - -namespace InnovEnergy.S3.Drivers.Internal.Delegates; - -public delegate Task ReadRecord(AggregationLevel level, UInt32 index); \ No newline at end of file diff --git a/csharp/lib/S3/Drivers/Internal/Delegates/WriteRecord.cs b/csharp/lib/S3/Drivers/Internal/Delegates/WriteRecord.cs deleted file mode 100644 index 3c06195ab..000000000 --- a/csharp/lib/S3/Drivers/Internal/Delegates/WriteRecord.cs +++ /dev/null @@ -1,6 +0,0 @@ -using InnovEnergy.S3.Metadata; -using InnovEnergy.S3.Records.Specialized; - -namespace InnovEnergy.S3.Drivers.Internal.Delegates; - -public delegate Task WriteRecord(TimeStampedRecord record, AggregationLevel level, UInt32 index); \ No newline at end of file diff --git a/csharp/lib/S3/Drivers/Internal/Reader.cs b/csharp/lib/S3/Drivers/Internal/Reader.cs deleted file mode 100644 index eccfc84c4..000000000 --- a/csharp/lib/S3/Drivers/Internal/Reader.cs +++ /dev/null @@ -1,50 +0,0 @@ -using InnovEnergy.S3.Drivers.Internal.Delegates; -using InnovEnergy.S3.Metadata; -using InnovEnergy.S3.Records.Specialized; -using InnovEnergy.Time.Unix; -using InnovEnergy.Lib.Utils; - -namespace InnovEnergy.S3.Drivers.Internal; - -public partial class Reader -{ - public IReadOnlyList AggregationLevels { get; } - public UnixTimeSpan SamplePeriod => AggregationLevels[0].SamplePeriod; - - private readonly ReadRecord _ReadRecord; - - internal Reader(IReadOnlyList levels, ReadRecord readRecord) - { - _ReadRecord = readRecord; - AggregationLevels = InitLevels(levels); - } - - public Task ReadRecord(AggregationLevel level, UInt32 index) - { - return _ReadRecord(level, index); - } - - private static IReadOnlyList InitLevels(IReadOnlyList levels) - { - if (!levels.Any()) - throw new ArgumentOutOfRangeException(nameof(levels)); - - levels = levels - .OrderBy(l => l.SamplePeriod.Ticks) - .ToReadOnlyList(levels.Count); - - var pairwise = levels - .Select(l => l.SamplePeriod) - .Pairwise() - .ToReadOnlyList(levels.Count - 1); - - var greater = pairwise.Any(ls => ls.right <= ls.left); - var multiple = pairwise.Any(ls => ls.right % ls.left != 0 ); - var retention = levels .Any(l => l.RetentionPeriod % l.SamplePeriod != 0); - - if (greater || multiple || retention) - throw new ArgumentException(nameof(levels)); // TODO: error messages - - return levels; - } -} \ No newline at end of file diff --git a/csharp/lib/S3/Drivers/Internal/Reader.public.cs b/csharp/lib/S3/Drivers/Internal/Reader.public.cs deleted file mode 100644 index 622571c83..000000000 --- a/csharp/lib/S3/Drivers/Internal/Reader.public.cs +++ /dev/null @@ -1,37 +0,0 @@ -using InnovEnergy.S3.Metadata; -using InnovEnergy.S3.Records.Specialized; -using InnovEnergy.Time.Unix; -using InnovEnergy.Lib.Utils; - -namespace InnovEnergy.S3.Drivers.Internal; - -public partial class Reader -{ - public Task> ReadRecords(UnixTime from, UnixTime to, Int32 minNumber) - { - var maxDt = (to - from) / minNumber; - return ReadRecords(from, to, maxDt); - } - - public async Task> ReadRecords(UnixTime from, UnixTime to, UnixTimeSpan maxDt) - { - if (maxDt < SamplePeriod) - maxDt = SamplePeriod; - - var level = AggregationLevels.LastOrDefault(l => l.SamplePeriod <= maxDt) ?? AggregationLevels[^1]; - - return await level - .RangeExclusive(from, to) - .Select(t => ReadRecord(level, t)) - .WhenAll(); - } - - public async Task ReadRecord(AggregationLevel level, UnixTime time) - { - var tsRecord = await ReadRecord(level, level.GetRetentionIndex(time)); - - return tsRecord.TimeStamp == time - ? tsRecord - : TimeStampedRecord.Empty(time); - } -} \ No newline at end of file diff --git a/csharp/lib/S3/Drivers/Internal/Util/Aggregator.cs b/csharp/lib/S3/Drivers/Internal/Util/Aggregator.cs deleted file mode 100644 index de1721858..000000000 --- a/csharp/lib/S3/Drivers/Internal/Util/Aggregator.cs +++ /dev/null @@ -1,60 +0,0 @@ -using InnovEnergy.S3.Metadata; -using InnovEnergy.S3.Records; -using InnovEnergy.S3.Records.Operations; -using InnovEnergy.Lib.Utils; - -namespace InnovEnergy.S3.Drivers.Internal.Util; - -public class Aggregator -{ - public AggregationLevel AggregationLevel { get; } - - private Record[] Buffer { get; } - private UInt32 Index { get; set; } - - public Aggregator(AggregationLevel thisLevel, - AggregationLevel levelBelow, - IEnumerable initialRecords) - { - var ratio = thisLevel.SamplePeriod / levelBelow.SamplePeriod; - - AggregationLevel = thisLevel; - - Index = 0; - Buffer = new Record[ratio]; - - Clear(); - - foreach (var record in initialRecords) - Aggregate(record); - } - - public Record? Aggregate(Record r) - { - Buffer[Index++] = r; - - return IsFull - ? ForceAggregation() - : null; - } - - public Record? ForceAggregation() - { - if (IsEmpty) - return null; // nothing to aggregate - - var aggregated = Buffer.Aggregate(); - Clear(); - return aggregated; - } - - private void Clear() - { - Buffer.Fill(Record.Empty); - Index = 0; - } - - private Boolean IsFull => Index == Buffer.Length; - private Boolean IsEmpty => Index == 0; - -} \ No newline at end of file diff --git a/csharp/lib/S3/Drivers/Internal/Util/Sampler.cs b/csharp/lib/S3/Drivers/Internal/Util/Sampler.cs deleted file mode 100644 index e8b136265..000000000 --- a/csharp/lib/S3/Drivers/Internal/Util/Sampler.cs +++ /dev/null @@ -1,43 +0,0 @@ -using InnovEnergy.S3.Metadata; -using InnovEnergy.S3.Records; -using InnovEnergy.S3.Records.Specialized; -using InnovEnergy.Time.Unix; - -namespace InnovEnergy.S3.Drivers.Internal.Util; - -internal class Sampler -{ - public Record CurrentRecord { get; set; } - public UnixTime CurrentTimeStamp { get; set; } - public AggregationLevel AggregationLevel { get; } - - private UnixTimeSpan SamplePeriod => AggregationLevel.SamplePeriod; - - public Sampler(AggregationLevel aggregationLevel, Record record, UnixTime currentTime) - { - AggregationLevel = aggregationLevel; - CurrentRecord = record; - CurrentTimeStamp = aggregationLevel.GetPeriodStartTime(currentTime); - } - - - // TODO: repeat/max age - public IEnumerable Sample(Record record, UnixTime timeStamp) - { - timeStamp = AggregationLevel.GetPeriodStartTime(timeStamp); - - if (timeStamp < CurrentTimeStamp) - yield break; //throw new IndexOutOfRangeException(nameof(index)); // TODO: log - - if (timeStamp > CurrentTimeStamp) - yield return new AggregatedRecord(CurrentRecord, AggregationLevel, CurrentTimeStamp); - - for (var t = CurrentTimeStamp + SamplePeriod; t < timeStamp; t += SamplePeriod) - yield return new AggregatedRecord(Record.Empty, AggregationLevel, t); - - CurrentTimeStamp = timeStamp; - CurrentRecord = record; - } - - -} \ No newline at end of file diff --git a/csharp/lib/S3/Drivers/Internal/Writer.cs b/csharp/lib/S3/Drivers/Internal/Writer.cs deleted file mode 100644 index e9ee15700..000000000 --- a/csharp/lib/S3/Drivers/Internal/Writer.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System.Diagnostics; -using InnovEnergy.S3.Drivers.Internal.Delegates; -using InnovEnergy.S3.Drivers.Internal.Util; -using InnovEnergy.S3.Metadata; -using InnovEnergy.S3.Records; -using InnovEnergy.S3.Records.Specialized; -using InnovEnergy.Time.Unix; -using InnovEnergy.Lib.Utils; - -namespace InnovEnergy.S3.Drivers.Internal; - -using AggregationLevels = IReadOnlyList; -using Aggregators = IReadOnlyList; - -public partial class Writer : Reader, IDisposable -{ - private Sampler Sampler { get; } - private Aggregators Aggregators { get; } - - private readonly WriteRecord _WriteRecord; - - internal Writer(UnixTime startTime, - AggregationLevels levels, - ReadRecord readRecord, - WriteRecord writeRecord) : base(levels, readRecord) - { - _WriteRecord = writeRecord; - startTime = AggregationLevels.First().GetPeriodStartTime(startTime); - Sampler = InitializeSampler(startTime); - Aggregators = InitializeAggregators(startTime); - } - - private IReadOnlyList InitializeAggregators(UnixTime startTime) - { - return AggregationLevels - .Pairwise() - .SelectTuple((lo, hi) => InitializeAggregator(lo, hi, startTime)) - .ToReadOnlyList(AggregationLevels.Count - 1); - } - - private Aggregator InitializeAggregator(AggregationLevel lo, - AggregationLevel hi, - UnixTime currentTime) - { - // This was a REAL brainfuck to get right - - var loStartTime = lo.GetPeriodStartTime(currentTime); - var hiStartTime = hi.GetPeriodStartTime(currentTime); - - Debug.Assert(hiStartTime <= loStartTime); - - var initialRecords = lo - .RangeExclusive(hiStartTime, loStartTime) - .Select(t => ReadRecord(lo, t)) - .WhenAll() - .Result - .Select(r => r.Record); - - return new Aggregator(hi, lo, initialRecords); - } - - private Sampler InitializeSampler(UnixTime startTime) - { - var samplerLevel = AggregationLevels.First(); - var initialRecord = ReadRecord(samplerLevel, startTime).Result.Record; - - return new Sampler(samplerLevel, initialRecord, startTime); - } - - private IEnumerable Aggregate(Record record, UnixTime timeStamp) - { - return Sampler - .Sample(record, timeStamp) - .SelectMany(Aggregate); - } - - private IEnumerable Aggregate(AggregatedRecord r) - { - yield return r; - - var record = r.Record; - - foreach (var a in Aggregators) - { - record = a.Aggregate(record); - if (record is null) break; - - var timeStamp = a.AggregationLevel.GetPeriodStartTime(r.TimeStamp); - yield return new AggregatedRecord(record, a.AggregationLevel, timeStamp); - } - } - - private Task WriteRecord(AggregatedRecord rec) - { - var tsr = rec.ToTimeStamped(); - var level = rec.AggregationLevel; - var index = level.GetRetentionIndex(rec.TimeStamp); - - return _WriteRecord(tsr, level, index); - } - - void IDisposable.Dispose() - { - DisposeAsync().Wait(); - } - - private async Task DisposeAsync() - { - // feed the sampler an empty "next" record, so it writes and aggregates the current one. - await WriteRecord(Record.Empty, Sampler.CurrentTimeStamp + SamplePeriod); - - foreach (var a in Aggregators) - { - // force and write incomplete aggregation for each level - - var agg = a.ForceAggregation(); - if (agg is null) - continue; - - var lev = a.AggregationLevel; - var ts = lev.GetPeriodStartTime(Sampler.CurrentTimeStamp); - var tsr = agg!.TimeStamped(ts); - var idx = lev.GetRetentionIndex(ts); - - await _WriteRecord(tsr, lev, idx); - } - } - -} \ No newline at end of file diff --git a/csharp/lib/S3/Drivers/Internal/Writer.public.cs b/csharp/lib/S3/Drivers/Internal/Writer.public.cs deleted file mode 100644 index 4d5ee131e..000000000 --- a/csharp/lib/S3/Drivers/Internal/Writer.public.cs +++ /dev/null @@ -1,26 +0,0 @@ -using InnovEnergy.S3.Records; -using InnovEnergy.S3.Records.Specialized; -using InnovEnergy.Time.Unix; -using InnovEnergy.Lib.Utils; - -namespace InnovEnergy.S3.Drivers.Internal; - -public partial class Writer -{ - public Task WriteRecord(Record record) - { - return WriteRecord(record, UnixTime.Now); - } - - public Task WriteRecord(TimeStampedRecord tsr) - { - return WriteRecord(tsr.Record, tsr.TimeStamp); - } - - public Task WriteRecord(Record record, UnixTime time) - { - return Aggregate(record, time) - .Select(WriteRecord) - .WhenAll(); - } -} \ No newline at end of file diff --git a/csharp/lib/S3/Drivers/MemoryDriver.cs b/csharp/lib/S3/Drivers/MemoryDriver.cs deleted file mode 100644 index 31f3e998a..000000000 --- a/csharp/lib/S3/Drivers/MemoryDriver.cs +++ /dev/null @@ -1,57 +0,0 @@ -using InnovEnergy.S3.Drivers.Internal; -using InnovEnergy.S3.Drivers.Internal.Delegates; -using InnovEnergy.S3.Metadata; -using InnovEnergy.S3.Records.Specialized; -using InnovEnergy.Time.Unix; - -namespace InnovEnergy.S3.Drivers; - -using Levels = IReadOnlyList; -using Memory = Dictionary; - -public class MemoryDriver : Writer -{ - - public MemoryDriver(Levels levels, UnixTime startTime, Memory memory) : - base( - startTime, - levels, - ReadRecord(memory), - WriteRecord(memory) - ) - { - } - - private static String GetKey(AggregationLevel level, UInt32 index) - { - return $"{level}/{index}"; - } - - private static ReadRecord ReadRecord(Memory memory) - { - Task Read(AggregationLevel level, UInt32 index) - { - var key = GetKey(level, index); - - var result = memory.TryGetValue(key, out var tsRecord) - ? tsRecord - : TimeStampedRecord.Empty(); - - return Task.FromResult(result); - } - - return Read; - } - - private static WriteRecord WriteRecord(Memory memory) - { - Task Write(TimeStampedRecord record, AggregationLevel level, UInt32 index) - { - var key = GetKey(level, index); - memory[key] = record; - return Task.CompletedTask; - } - - return Write; - } -} \ No newline at end of file diff --git a/csharp/lib/S3/Drivers/S3Config.cs b/csharp/lib/S3/Drivers/S3Config.cs deleted file mode 100644 index 4b4d60d18..000000000 --- a/csharp/lib/S3/Drivers/S3Config.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System.Security.Cryptography; -using Flurl; -using Flurl.Http; -using InnovEnergy.Lib.Utils; -using static System.Text.Encoding; -using Convert = System.Convert; - -namespace InnovEnergy.S3.Drivers; - -public record S3Config -{ - public String Bucket { get; init; } = ""; - public String Region { get; init; } = ""; - public String Provider { get; init; } = ""; - public String Key { get; init; } = ""; - public String Secret { get; init; } = ""; - public String ContentType { get; init; } = ""; - - public String Host => $"{Bucket}.{Region}.{Provider}"; - public String Url => $"https://{Host}"; - - public IFlurlRequest CreatePutRequest(String s3Path) => CreateRequest("PUT", s3Path); - public IFlurlRequest CreateGetRequest(String s3Path) => CreateRequest("GET", s3Path); - - private IFlurlRequest CreateRequest(String method, String s3Path) - { - var date = DateTime.UtcNow.ToString("r"); - var auth = CreateAuthorization(method, s3Path, date); - - return Url - .AppendPathSegment(s3Path) - .WithHeader("Host", Host) - .WithHeader("Date", date) - .WithHeader("Authorization", auth) - .AllowAnyHttpStatus(); - } - - private String CreateAuthorization(String method, - String s3Path, - String date) - { - return CreateAuthorization - ( - method : method, - bucket : Bucket, - s3Path : s3Path, - date : date, - s3Key : Key, - s3Secret : Secret, - contentType: ContentType - ); - } - - - - private static String CreateAuthorization(String method, - String bucket, - String s3Path, - String date, - String s3Key, - String s3Secret, - String contentType = "", - String md5Hash = "") - { - // StringToSign = HTTP-Verb + "\n" + - // Content-MD5 + "\n" + - // Content-Type + "\n" + - // Date + "\n" + - // CanonicalizedAmzHeaders + - // CanonicalizedResource; - - var payload = $"{method}\n{md5Hash}\n{contentType}\n{date}\n/{bucket.Trim('/')}/{s3Path.Trim('/')}"; - using var hmacSha1 = new HMACSHA1(UTF8.GetBytes(s3Secret)); - - var signature = UTF8 - .GetBytes(payload) - .Apply(hmacSha1.ComputeHash) - .Apply(Convert.ToBase64String); - - return $"AWS {s3Key}:{signature}"; - } - -} \ No newline at end of file diff --git a/csharp/lib/S3/Drivers/S3Driver.cs b/csharp/lib/S3/Drivers/S3Driver.cs deleted file mode 100644 index 91a4ada47..000000000 --- a/csharp/lib/S3/Drivers/S3Driver.cs +++ /dev/null @@ -1,84 +0,0 @@ -using Flurl.Http; -using InnovEnergy.S3.Drivers.Internal; -using InnovEnergy.S3.Drivers.Internal.Delegates; -using InnovEnergy.S3.Metadata; -using InnovEnergy.S3.Records.Serialization; -using InnovEnergy.S3.Records.Specialized; -using InnovEnergy.Time.Unix; - -namespace InnovEnergy.S3.Drivers; - -using Levels = IReadOnlyList; -using Memory = Dictionary; - - -public class S3Driver : Writer -{ - - public S3Driver(Levels levels, UnixTime startTime, S3Config config) : - base( - startTime, - levels, - ReadRecord(config), - WriteRecord(config) - ) - { - } - - private static String GetS3Path(AggregationLevel level, UInt32 index) - { - return $"/{level}/{index}"; - } - - private static ReadRecord ReadRecord(S3Config config) - { - async Task Read(AggregationLevel level, UInt32 index) - { - var s3Path = GetS3Path(level, index); - var request = config.CreateGetRequest(s3Path); - var response = await request.GetAsync(); - - if (response.StatusCode != 200) - { - Console.WriteLine("ERROR: Get " + s3Path); - var error = await response.GetStringAsync(); - Console.WriteLine(error); - return TimeStampedRecord.Empty(); - } - - var payload = await response.GetBytesAsync(); - - Console.WriteLine("GET " + s3Path); - return Parser.ParseTimeStampedRecord(payload); - } - - return Read; - } - - private static WriteRecord WriteRecord(S3Config config) - { - async Task Write(TimeStampedRecord record, AggregationLevel level, UInt32 index) - { - var payload = record.Serialize().ToArray(); - var s3Path = GetS3Path(level, index); - var request = config.CreatePutRequest(s3Path); - var response = await request.PutAsync(new ByteArrayContent(payload)); - - if (response.StatusCode == 200) - { - //Console.WriteLine("PUT " + s3Path); - } - else - { - Console.WriteLine("ERROR: PUT"); - var error = await response.GetStringAsync(); - Console.WriteLine(error); - } - } - - return Write; - } - - - -} \ No newline at end of file diff --git a/csharp/lib/S3/Metadata/AggregationLevel.cs b/csharp/lib/S3/Metadata/AggregationLevel.cs deleted file mode 100644 index 895ca3306..000000000 --- a/csharp/lib/S3/Metadata/AggregationLevel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using InnovEnergy.Time.Unix; - -namespace InnovEnergy.S3.Metadata; - -public record AggregationLevel -{ - public UnixTimeSpan RetentionPeriod { get; } - public UnixTimeSpan SamplePeriod { get; } - public UInt32 RetentionBufferSize { get; } - - public AggregationLevel(UnixTimeSpan samplePeriod, UnixTimeSpan retentionPeriod) - { - SamplePeriod = samplePeriod; - RetentionPeriod = retentionPeriod; - RetentionBufferSize = retentionPeriod / samplePeriod; - } - - public IEnumerable RangeExclusive(UnixTime from, UnixTime to) - { - if (from > to) - throw new ArgumentOutOfRangeException(nameof(to)); - - for (var t = GetPeriodStartTime(from); t < to; t += SamplePeriod) - yield return t; - } - - - // TODO: - public IEnumerable RangeInclusive(UnixTime from, UnixTime to) - { - if (from >= to) - throw new ArgumentOutOfRangeException(nameof(to)); - - from = GetPeriodStartTime(from); - to = GetPeriodStartTime(to) + SamplePeriod; - - for (var t = GetPeriodStartTime(from); t < to; t += SamplePeriod) - yield return t; - } - - public UInt32 GetRetentionIndex(UnixTime t) - { - return t / SamplePeriod % RetentionBufferSize; - } - - public UnixTime GetPeriodStartTime(UnixTime t) - { - return UnixTime.Epoch + t / SamplePeriod * SamplePeriod; // integer division! - } - - public override String ToString() => SamplePeriod.ToString(); -} \ No newline at end of file diff --git a/csharp/lib/S3/Metadata/FieldType.cs b/csharp/lib/S3/Metadata/FieldType.cs deleted file mode 100644 index aa4093858..000000000 --- a/csharp/lib/S3/Metadata/FieldType.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace InnovEnergy.S3.Metadata; - -public enum FieldType -{ - Number, - Text, - Boolean, -} \ No newline at end of file diff --git a/csharp/lib/S3/Program.cs b/csharp/lib/S3/Program.cs deleted file mode 100644 index 91fd538c8..000000000 --- a/csharp/lib/S3/Program.cs +++ /dev/null @@ -1,209 +0,0 @@ -using System.Reactive.Concurrency; -using System.Reactive.Linq; -using System.Reactive.Subjects; -using InnovEnergy.S3.Metadata; -using InnovEnergy.Time.Unix; -using InnovEnergy.Lib.Utils; -using static InnovEnergy.Time.Unix.UnixTimeSpan; - -namespace InnovEnergy.S3; - -public enum MyEnum -{ - Foo = 0x01, - Bar = 0x02, - Baz = 0x04 -} - - -public record Test(Double X, Double Y, Double Z); - - - - -public static class Program -{ - private static readonly Random Rng = new Random(0); - - - - - - - public static void Main(String[] args) - { - - // var x = Observable - // .Range(0, 22) - // .Select(i=> new Dictionary - // { - // {"i", i}, - // {"i*2", i * 2}, - // {"i/2", i / 2}, - // }) - // .DictObserve(o => Observable.Where(o, i=> i < 10)); - // - // x.Subscribe(ints => Console.WriteLine(String.Join(Environment.NewLine,ints) + "\n") ); - - - var src = Observable - .Interval(TimeSpan.FromSeconds(1)) - .BufferBy(i => i / 5) - .Subscribe(b => - { - var values = b.Select(e => e.ToString()).Aggregate("", (x, y) => $"{x}\n{y}"); - var average = b.Average(); - var msg = $"{values}\nAverage: {average}"; - - Console.WriteLine(msg); - }); - - - - Console.ReadLine(); - // var t = new Test(12, 2, 1); - // - // foreach (var m in typeof(Test).GetMembers().OfType()) - // { - // var parameters = m - // .GetParameters() - // .Select(p => $"{p.ParameterType.Name} {p.Name}") - // .Aggregate("", (a, b) => a + ", " + b) - // .TrimStart(", ".ToCharArray()); - // - // Console.WriteLine($"{m.ReturnType.Name} {m.Name}({parameters})"); - // } - - - return; - - var s = new Subject(); - - Observable.Interval(TimeSpan.FromSeconds(2), TaskPoolScheduler.Default) - .WithLatestFrom(s, (_, x) => x) - .Subscribe(Console.WriteLine); - - while (true) - { - var k = Console.ReadKey(true); - s.OnNext(k.KeyChar.ToString()); - } - - - - - var levels = new [] - { - new AggregationLevel( 2.Seconds(), 54.Weeks()), - new AggregationLevel(10.Seconds(), 54.Weeks()), - new AggregationLevel( 1.Minutes(), 54.Weeks()), - new AggregationLevel( 5.Minutes(), 540.Weeks()), - new AggregationLevel(15.Minutes(), 540.Weeks()), - new AggregationLevel( 1.Hours() , 540.Weeks()), - new AggregationLevel( 6.Hours() , 540.Weeks()), - new AggregationLevel( 1.Days() , 540.Weeks()), - new AggregationLevel( 1.Weeks() , Forever) - }; - - var resolution = 2.Seconds(); - - for (int i = 0; i < 10; i++) - { - var startTime = UnixTime.Epoch + Rng.Next(0, 2.Weeks().Ticks.ConvertTo()).Seconds(); - var split = Rng.Next(2, 1000); - - //Test(startTime, resolution, levels, split); - } - - - Console.WriteLine("Done"); - } - - // private static void Test(UnixTime startTime, UnixTimeSpan resolution, AggregationLevel[] aggregationLevels, Int32 split) - // { - // var times = Enumerable - // .Range(0, 2.Weeks().Ticks.ConvertTo()) - // .Select(t => startTime + t * resolution) - // .ToReadOnlyList(); - // - // var records = times - // //.Where(_ => Rng.NextDouble() > .25) // "loose" 1 in 4 - // .Select(t => ( - // record: new Record - // ( - // // new NumberField("Current", t.Ticks / 2, "A"), - // new SubRecord("Sub1", new Record(new NumberField("Current1", t.Ticks / 4, "A"))), - // new SubRecord("Sub2", new Record(new NumberField("Current2", t.Ticks / 8, "A"))) - // ), - // time: t + Rng.NextDouble().Apply(Math.Round).ConvertTo().Seconds() // add noise - // )) - // .ToList(); - // - // - // var allMemory = new Dictionary(); - // using (var driverAll = new MemoryDriver(aggregationLevels, startTime, allMemory)) - // { - // foreach (var record in records) - // driverAll.WriteRecord(record.record, record.time); - // } - // - // var list = allMemory.Where(kv => kv.Key.StartsWith("1w")).ToList(); - // - // var splitMemory = new Dictionary(); - // using (var driver1 = new MemoryDriver(aggregationLevels, startTime, splitMemory)) - // { - // foreach (var record in records.Take(split)) - // driver1.WriteRecord(record.record, record.time); - // } - // - // using (var driver2 = new MemoryDriver(aggregationLevels, records.ElementAt(split-1).time, splitMemory)) - // { - // foreach (var record in records.Skip(split-1)) - // driver2.WriteRecord(record.record, record.time); - // } - // - // - // - // var zip = Enumerable.Zip( - // allMemory.OrderBy(kv => kv.Key), - // splitMemory.OrderBy(kv => kv.Key) - // ); - // - // foreach (var (l, r) in zip) - // { - // var nl = l.Value.Record.Fields.OfType().FirstOrDefault()?.Value; - // var nr = r.Value.Record.Fields.OfType().FirstOrDefault()?.Value; - // - // if (l.Key != r.Key) - // { - // Console.WriteLine($"{l.Key} <=> {r.Key}"); - // break; - // } - // - // if (nl != nr) - // { - // Console.WriteLine($"{l.Value.TimeStamp.ToUtcDateTime()}: {nl} <=> {nr}"); - // } - // } - // } - - - public static String CreateRandomState() - { - var r = Rng.NextDouble() * 100; - - return r switch - { - >= 90 => "Heating", - >= 10 => "SelfConsumption", - _ => "CalibrationCharge" - }; - } - - - - - - - -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Fields/Field.cs b/csharp/lib/S3/Records/Fields/Field.cs deleted file mode 100644 index 6831a6957..000000000 --- a/csharp/lib/S3/Records/Fields/Field.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace InnovEnergy.S3.Records.Fields; - -public abstract record Field; \ No newline at end of file diff --git a/csharp/lib/S3/Records/Fields/NumberField.cs b/csharp/lib/S3/Records/Fields/NumberField.cs deleted file mode 100644 index dca272106..000000000 --- a/csharp/lib/S3/Records/Fields/NumberField.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace InnovEnergy.S3.Records.Fields; - -public record NumberField : Field -{ - public Double Value { get; } - public Double Min { get; } - public Double Max { get; } - public String Unit { get; } - - public NumberField(Double value, Double min, Double max, String unit = "") - { - Value = value; - Min = min; - Max = max; - Unit = unit; - } - - public NumberField(Double value, String unit = "") : this(value, value, value, unit) - { - } - - public NumberField(Boolean value) : this(value?100:0, "%") - { - } -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Fields/TextField.cs b/csharp/lib/S3/Records/Fields/TextField.cs deleted file mode 100644 index 561d50772..000000000 --- a/csharp/lib/S3/Records/Fields/TextField.cs +++ /dev/null @@ -1,38 +0,0 @@ -using InnovEnergy.Lib.Utils; - -namespace InnovEnergy.S3.Records.Fields; - -public record TextField : Field -{ - public IReadOnlyList Frequencies { get; } - - public TextField(IReadOnlyList frequencies) - { - Frequencies = frequencies; - } - - public TextField(params TextFrequency[] frequencies) : this((IReadOnlyList)frequencies) - { - } - - public TextField(String text) : this(new TextFrequency(text)) - { - } - - public TextField(Enum enumValue) : this(GetEnumFlagsAsFrequencies(enumValue)) - { - } - - private static IReadOnlyList GetEnumFlagsAsFrequencies(Enum enumValue) - { - return enumValue - .ToString() - .Split(',') // debug view is '|' separated, toString() uses ',' !! - .Select(v => v.Trim()) - .Where(v => !v.IsInteger()) // filter "unknown" enum flags - .Select(f => new TextFrequency(f)) - .ToReadOnlyList(); - } - - -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Fields/TextFrequency.cs b/csharp/lib/S3/Records/Fields/TextFrequency.cs deleted file mode 100644 index 39631a4c1..000000000 --- a/csharp/lib/S3/Records/Fields/TextFrequency.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace InnovEnergy.S3.Records.Fields; - -public record TextFrequency -{ - public TextFrequency(String text, Double percent = 100) - { - Text = text; - Percent = percent; - } - - public String Text { get; } - public Double Percent { get; } -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Fields/UnitAttribute.cs b/csharp/lib/S3/Records/Fields/UnitAttribute.cs deleted file mode 100644 index af47ca5b7..000000000 --- a/csharp/lib/S3/Records/Fields/UnitAttribute.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace InnovEnergy.S3.Records.Fields; - -[AttributeUsage(AttributeTargets.Property)] -public sealed class UnitAttribute : Attribute -{ - private readonly String _Unit; - - public UnitAttribute(String unit) - { - _Unit = unit; - } - - public override String ToString() => _Unit; - - public static implicit operator String(UnitAttribute a) => a.ToString(); -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Fields/WithUnit.cs b/csharp/lib/S3/Records/Fields/WithUnit.cs deleted file mode 100644 index 26dcdc9ad..000000000 --- a/csharp/lib/S3/Records/Fields/WithUnit.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace InnovEnergy.S3.Records.Fields; - -public readonly struct WithUnit -{ - public String Unit { get; } - public Double Value { get; } - - public WithUnit(Double value, String unit) - { - Unit = unit; - Value = value; - } - - public override String ToString() => Unit; -} - -public static class UnitExtensions -{ - public static WithUnit Unit(this Double number, String unit) => new WithUnit(number, unit); - public static WithUnit Unit(this Single number, String unit) => new WithUnit(number, unit); - public static WithUnit Unit(this Half number, String unit) => new WithUnit((Double) number, unit); - public static WithUnit Unit(this SByte number, String unit) => new WithUnit(number, unit); - public static WithUnit Unit(this Byte number, String unit) => new WithUnit(number, unit); - public static WithUnit Unit(this Int16 number, String unit) => new WithUnit(number, unit); - public static WithUnit Unit(this UInt16 number, String unit) => new WithUnit(number, unit); - public static WithUnit Unit(this Int32 number, String unit) => new WithUnit(number, unit); - public static WithUnit Unit(this UInt32 number, String unit) => new WithUnit(number, unit); - public static WithUnit Unit(this Int64 number, String unit) => new WithUnit(number, unit); - public static WithUnit Unit(this UInt64 number, String unit) => new WithUnit(number, unit); -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Operations/Aggregation.cs b/csharp/lib/S3/Records/Operations/Aggregation.cs deleted file mode 100644 index b13ddd651..000000000 --- a/csharp/lib/S3/Records/Operations/Aggregation.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System.Diagnostics.CodeAnalysis; -using InnovEnergy.S3.Records.Fields; -using InnovEnergy.Lib.Utils; - -namespace InnovEnergy.S3.Records.Operations; - -// ReSharper disable ArgumentsStyleOther -using NamedField = KeyValuePair; - -public static class Aggregation -{ - - [SuppressMessage("ReSharper", "PossibleMultipleEnumeration")] - public static Record Aggregate(this IReadOnlyList records) - { - var availability = records.Sum(r => r.Availability) / records.Count; - - if (availability == 0) - return Record.Empty; - - var numbers = records.GetColumns().Select(AggregateNumbers); - var texts = records.GetColumns() .Select(AggregateTexts); - var subRecords = records.GetColumns() .Select(AggregateRecords); - - var aggregated = numbers.Concat(texts).Concat(subRecords); - - var fields = new Dictionary(aggregated); - - return new Record - ( - fields, - availability - ); - } - - private static IEnumerable<(String name, F field)> GetFields(this IEnumerable records) where F : Field - { - foreach (var record in records) - foreach (var (name, field) in record.Fields) - if (field is F f) - yield return (name, f); - } - - private static ILookup GetColumns(this IEnumerable records) where F : Field - { - return records - .GetFields() - .ToLookup(nf => nf.name, nf => nf.field); - } - - - private static KeyValuePair AggregateTexts(IGrouping column) - { - var textFrequencies = column - .SelectMany(s => s.Frequencies) - .GroupBy(f => f.Text, f => f.Percent) - .Select(g => new TextFrequency(text: g.Key, percent: g.Sum() / g.Count())) - .OrderBy(f => f.Text) - .ToReadOnlyList(); - - return new (column.Key, new TextField(textFrequencies)); - } - - private static KeyValuePair AggregateNumbers(IGrouping column) - { - var aggregated = new NumberField - ( - min: column.Min(f => f.Min), - max: column.Max(f => f.Max), - value: column.Average(f => f.Value), - unit: column.First().Unit - ); - - return new (column.Key, aggregated); - } - - private static KeyValuePair AggregateRecords(IGrouping column) - { - var aggregate = column.ToReadOnlyList().Apply(Aggregate); - - return new(column.Key, aggregate); - } -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Operations/Conversion.cs b/csharp/lib/S3/Records/Operations/Conversion.cs deleted file mode 100644 index 489d9648f..000000000 --- a/csharp/lib/S3/Records/Operations/Conversion.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Reflection; -using InnovEnergy.S3.Records.Fields; -using InnovEnergy.Lib.Utils; -using static System.Reflection.BindingFlags; - -namespace InnovEnergy.S3.Records.Operations; - -public static class Conversion -{ - public static Record ToRecord(this Object t) - { - var fields = t.GetType() - .Apply(GetProperties) - .ToDictionary(p => p.Name, PropertyToField); - - return new Record(fields); - - Field PropertyToField(PropertyInfo p) => p.GetValue(t) switch - { - Double d => new NumberField(d, Unit(p)), - Boolean b => new NumberField(b), - Enum e => new TextField(e), - String s => new TextField(s), // ReSharper disable once PatternAlwaysOfType - Object o => ToRecord(o), - _ => throw new ArgumentException() - }; - } - - private static String Unit(MemberInfo member) - { - return member - .GetCustomAttributes() - .OfType() - .FirstOrDefault()? - .ToString() - ?? ""; - } - - private static IEnumerable GetProperties() => typeof(T).GetProperties(Instance | Public); - - private static IEnumerable GetProperties(Type t) => t.GetProperties(Instance | Public); - - - - -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Record.cs b/csharp/lib/S3/Records/Record.cs deleted file mode 100644 index 050151c07..000000000 --- a/csharp/lib/S3/Records/Record.cs +++ /dev/null @@ -1,59 +0,0 @@ -using InnovEnergy.S3.Records.Fields; -using InnovEnergy.S3.Records.Specialized; -using InnovEnergy.Time.Unix; - -namespace InnovEnergy.S3.Records; - -public record Record : Field -{ - public static Record Empty { get; } = new Record(new Dictionary(), 0); - - public IReadOnlyDictionary Fields { get; } - public Double Availability { get; } - - public Boolean IsEmpty => Fields.Count == 0; - - - public Record(IReadOnlyDictionary fields, Double availability = 1.0) - { - Fields = fields; - Availability = availability; - } - - public F GetField(String name) where F : Field - { - return (F) Fields[name]; - } - - public TimeStampedRecord TimeStamped(UnixTime unixTime) => new TimeStampedRecord(this, unixTime); - - - public static Record ParseDict(Dictionary dict, Double availability = 1.0) - { - var fields = dict.ToDictionary(kv => kv.Key, kv => ParseField(kv.Value)); - return new Record(fields, availability); - } - - private static Field ParseField(Object value) => - value switch - { - WithUnit v => new NumberField(v.Value, v.Unit), - Enum v => new TextField(v), - String v => new TextField(v), - Double v => new NumberField(v), - Field v => v, - Single v => new NumberField(v), - SByte v => new NumberField(v), - Byte v => new NumberField(v), - Int16 v => new NumberField(v), - UInt16 v => new NumberField(v), - Int32 v => new NumberField(v), - UInt32 v => new NumberField(v), - Int64 v => new NumberField(v), - UInt64 v => new NumberField(v), - Half v => new NumberField((Double)v), - _ => throw new ArgumentOutOfRangeException(nameof(value)) - }; - - -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Serialization/FieldTag.cs b/csharp/lib/S3/Records/Serialization/FieldTag.cs deleted file mode 100644 index 19d486da5..000000000 --- a/csharp/lib/S3/Records/Serialization/FieldTag.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace InnovEnergy.S3.Records.Serialization; - -public enum FieldTag : Byte -{ - NumberField = 0, - TextField = 1, - RecordField = 2, -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Serialization/Parser.cs b/csharp/lib/S3/Records/Serialization/Parser.cs deleted file mode 100644 index 694b9bc26..000000000 --- a/csharp/lib/S3/Records/Serialization/Parser.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System.Text; -using InnovEnergy.S3.Records.Fields; -using InnovEnergy.S3.Records.Specialized; -using InnovEnergy.Time.Unix; -using InnovEnergy.Lib.Utils; - -namespace InnovEnergy.S3.Records.Serialization; - -public class Parser -{ - private Int32 Position { get; set; } - private Byte[] Data { get; } - - private Parser(Byte[] data, Int32 position = 0) - { - Data = data; - Position = position; - } - - public Boolean IsPastEnd => Position >= Data.Length; - - public static TimeStampedRecord ParseTimeStampedRecord(Byte[] data) - { - var parser = new Parser(data); - - var timeStamp = parser.ParseUnixTime(); - var record = parser.ParseRecord(); - - return new TimeStampedRecord(record, timeStamp); - } - - - private UnixTime ParseUnixTime() - { - var span = new ReadOnlySpan(Data, Position, sizeof(UInt32)); - var ticks = BitConverter.ToUInt32(span); - - Position += span.Length; - - return UnixTime.FromTicks(ticks); - } - - private Single ParseFloat() - { - var span = new ReadOnlySpan(Data, Position, sizeof(Single)); - Position += span.Length; - return BitConverter.ToSingle(span); - } - - private String ParseString() - { - var len = GetByte(); - var span = new ReadOnlySpan(Data, Position, len); - - Position += span.Length; - - return Encoding.UTF8.GetString(span); - } - - private NumberField ParseNumberField() - { - var value = ParseFloat(); - var min = ParseFloat(); - var max = ParseFloat(); - var unit = ParseString(); - - return new NumberField(value, min, max, unit); - } - - private TextFrequency ParseTextFrequency() - { - var txt = ParseString(); - var frq = ParseFloat(); - - return new TextFrequency(txt, frq); - } - - private Record ParseRecord() - { - var availability = ParseFloat(); - var fields = ParseFields(); - - return new Record(fields, availability); - } - - private IReadOnlyDictionary ParseFields() - { - var len = GetByte(); - - var fields = Enumerable - .Range(0, len) - .Select(_ => ParseNamedField()); - - return new Dictionary(fields); - } - - private Field ParseField() - { - var tag = ParseFieldTag(); - - return tag switch - { - FieldTag.NumberField => ParseNumberField(), - FieldTag.TextField => ParseTextField(), - FieldTag.RecordField => ParseRecord(), - _ => throw new ArgumentOutOfRangeException(nameof(FieldTag)) - }; - } - - private KeyValuePair ParseNamedField() - { - var name = ParseString(); - var field = ParseField(); - - return new KeyValuePair(name, field); - } - - - private TextField ParseTextField() - { - var len = GetByte(); - - var fqs = Enumerable - .Range(0, len) - .Select(_ => ParseTextFrequency()) - .ToReadOnlyList(len); - - return new TextField(fqs); - } - - private Byte GetByte() => Data[Position++]; - - private FieldTag ParseFieldTag() => (FieldTag) GetByte(); -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Serialization/Serializer.cs b/csharp/lib/S3/Records/Serialization/Serializer.cs deleted file mode 100644 index 888132fbf..000000000 --- a/csharp/lib/S3/Records/Serialization/Serializer.cs +++ /dev/null @@ -1,121 +0,0 @@ -using InnovEnergy.S3.Records.Fields; -using InnovEnergy.S3.Records.Specialized; -using InnovEnergy.Time.Unix; -using InnovEnergy.Lib.Utils; -using static System.Text.Encoding; - -namespace InnovEnergy.S3.Records.Serialization; - -public static class Serializer -{ - public static IEnumerable Serialize(this TimeStampedRecord tsr) - { - if (!BitConverter.IsLittleEndian) - throw new ArgumentException(nameof(BitConverter)); - - var timeStamp = tsr.TimeStamp.Serialize(); - var record = tsr.Record.Serialize(); - return timeStamp.Concat(record); - } - - private static IEnumerable Serialize(this UnixTime t) - { - return BitConverter.GetBytes(t.Ticks); - } - - private static IEnumerable Serialize(this Record r) - { - var availability = r.Availability.Serialize(); - var fields = r.Fields.Serialize(); - - return availability.Concat(fields); - } - - private static IEnumerable Serialize(this IReadOnlyDictionary fields) - { - var len = fields.GetLength(); - - return fields - .SelectMany(Serialize) - .Prepend(len); - } - - private static IEnumerable Serialize(this KeyValuePair kv) - { - var name = kv.Key.Serialize(); - var field = kv.Value.Serialize(); - - return name.Concat(field); - } - - - public static IEnumerable Serialize(this Field f) - { - return f switch - { - NumberField nf => Serialize(nf).PrependTag(FieldTag.NumberField), - TextField tf => Serialize(tf).PrependTag(FieldTag.TextField), - Record r => Serialize(r).PrependTag(FieldTag.RecordField), - _ => throw new ArgumentException(nameof(f)) - }; - } - - public static IEnumerable Serialize(NumberField nf) - { - var value = nf.Value.Serialize(); - var min = nf.Min .Serialize(); - var max = nf.Max .Serialize(); - var unit = nf.Unit .Serialize(); - - return value - .Concat(min) - .Concat(max) - .Concat(unit); - } - - public static IEnumerable Serialize(this TextField tf) - { - var len = tf.Frequencies.GetLength(); - return tf - .Frequencies - .SelectMany(Serialize) - .Prepend(len); - } - - public static IEnumerable Serialize(this TextFrequency tf) - { - var txt = tf.Text.Serialize(); - var frq = tf.Percent.Serialize(); - - return txt.Concat(frq); - } - - public static IEnumerable Serialize(this Double d) - { - return BitConverter.GetBytes((Single) d); // use float to save space - } - - - public static IEnumerable Serialize(this String s) - { - return UTF8 - .GetBytes(s) - .Apply(PrependLength); - } - - private static IEnumerable PrependTag(this IEnumerable data, FieldTag fieldTag) - { - return data.Prepend((Byte) fieldTag); - } - - private static IEnumerable PrependLength(IReadOnlyCollection data) - { - var len = (Byte) data.Count; - return data.Prepend(len); - } - - private static Byte GetLength(this IReadOnlyCollection data) - { - return (Byte) data.Count; - } -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Specialized/AggregatedRecord.cs b/csharp/lib/S3/Records/Specialized/AggregatedRecord.cs deleted file mode 100644 index f8340d63d..000000000 --- a/csharp/lib/S3/Records/Specialized/AggregatedRecord.cs +++ /dev/null @@ -1,23 +0,0 @@ -using InnovEnergy.S3.Metadata; -using InnovEnergy.Time.Unix; - -namespace InnovEnergy.S3.Records.Specialized; - -public readonly struct AggregatedRecord -{ - public UnixTime TimeStamp { get; } - public Record Record { get; } - public AggregationLevel AggregationLevel { get; } - - public AggregatedRecord(Record record, AggregationLevel level, UnixTime timeStamp) - { - AggregationLevel = level; - TimeStamp = timeStamp; - Record = record; - } - - public TimeStampedRecord ToTimeStamped() - { - return new TimeStampedRecord(Record, TimeStamp); - } -} \ No newline at end of file diff --git a/csharp/lib/S3/Records/Specialized/TimeStampedRecord.cs b/csharp/lib/S3/Records/Specialized/TimeStampedRecord.cs deleted file mode 100644 index 28060830a..000000000 --- a/csharp/lib/S3/Records/Specialized/TimeStampedRecord.cs +++ /dev/null @@ -1,27 +0,0 @@ -using InnovEnergy.Time.Unix; - -namespace InnovEnergy.S3.Records.Specialized; - -public readonly struct TimeStampedRecord -{ - public UnixTime TimeStamp { get; } - public Record Record { get; } - - public TimeStampedRecord(Record record, UnixTime timeStamp) - { - Record = record; - TimeStamp = timeStamp; - } - - public Boolean IsEmpty => Record.IsEmpty; - - public static TimeStampedRecord Empty() - { - return Empty(UnixTime.Epoch); - } - - public static TimeStampedRecord Empty(UnixTime timeStamp) - { - return new TimeStampedRecord(Record.Empty, timeStamp); - } -} \ No newline at end of file diff --git a/csharp/lib/S3/S3.csproj b/csharp/lib/S3/S3.csproj deleted file mode 100644 index c68d60ec8..000000000 --- a/csharp/lib/S3/S3.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - InnovEnergy.S3 - latest - - - - - - - - - - - - - - - diff --git a/csharp/lib/S3/Serialization/JsonConverters.cs b/csharp/lib/S3/Serialization/JsonConverters.cs deleted file mode 100644 index aa2de6bb2..000000000 --- a/csharp/lib/S3/Serialization/JsonConverters.cs +++ /dev/null @@ -1,167 +0,0 @@ -// using System; -// using System.Text.Json; -// using System.Text.Json.Serialization; -// using InnovEnergy.S3.Records; -// using InnovEnergy.S3.Records.Fields; -// -// namespace InnovEnergy.S3.Serialization -// { -// public class SubClassConverterFactory : JsonConverterFactory -// { -// public override Boolean CanConvert(Type t) -// { -// return t.IsAbstract && t.IsClass; -// } -// -// public override JsonConverter CreateConverter(Type type, JsonSerializerOptions options) -// { -// var converterType = typeof(SubClassConverter<>).MakeGenericType(type); -// return (JsonConverter) Activator.CreateInstance(converterType)!; -// } -// -// public class SubClassConverter : JsonConverter -// { -// public override Boolean CanConvert(Type type) -// { -// return type == typeof(T); -// } -// -// public override T Read(ref Utf8JsonReader r, Type t, JsonSerializerOptions o) -// { -// throw new NotImplementedException(); -// } -// -// public override void Write(Utf8JsonWriter writer, T obj, JsonSerializerOptions options) -// { -// JsonSerializer.Serialize(writer, obj, obj!.GetType()); -// } -// } -// } -// -// public class DataRecordConverter : JsonConverter -// { -// public override Boolean CanConvert(Type type) -// { -// return typeof(Record).IsAssignableFrom(type); -// } -// -// public override Record Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) -// { -// throw new NotImplementedException(); -// } -// -// public override void Write(Utf8JsonWriter writer, Record @record, JsonSerializerOptions options) -// { -// writer.WriteStartObject(); -// -// foreach (var field in record.Fields) -// { -// writer.WritePropertyName(field.Name); -// -// if (field is NumberField an) -// { -// writer.WriteStartObject(); -// writer.WriteNumber("Min", an.Min); -// writer.WriteNumber("Max", an.Max); -// writer.WriteNumber("Mean", an.Value); -// writer.WriteEndObject(); -// } -// else if (field is TextField at) -// { -// writer.WriteStartObject(); -// foreach (var f in at.Frequencies) -// { -// writer.WriteNumber(f.Text, f.Percent); -// } -// writer.WriteEndObject(); -// } -// else if (field is BooleanField ab) -// { -// writer.WriteStartObject(); -// writer.WriteNumber("PercentTrue", ab.PercentTrue); -// writer.WriteEndObject(); -// } -// else -// throw new NotSupportedException(); -// } -// -// writer.WriteNumber("Time", record.TimeStamp.Ticks); -// writer.WriteNumber("Availability", record.Availability); -// -// writer.WriteEndObject(); -// } -// } -// -// // public class AggregatedRecordConverter : JsonConverter -// // { -// // public override Boolean CanConvert(Type type) -// // { -// // return typeof(AggregatedRecord).IsAssignableFrom(type); -// // } -// // -// // public override AggregatedRecord Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => throw new NotImplementedException(); -// // -// // public override void Write(Utf8JsonWriter writer, AggregatedRecord dataRecord, JsonSerializerOptions options) -// // { -// // writer.WriteStartObject(); -// // -// // foreach (var field in dataRecord.Fields) -// // { -// // if (field is AggregatedNumber n) -// // { -// // writer.WritePropertyName(n.Name); -// // writer.WriteStartObject(); -// // writer.WritePropertyName("Mean"); -// // writer.WriteNumberValue(n.Mean); -// // -// // writer.WritePropertyName("Min"); -// // writer.WriteNumberValue(n.Min); -// // -// // writer.WritePropertyName("Max"); -// // writer.WriteNumberValue(n.Max); -// // -// // writer.WriteEndObject(); -// // } -// // else if (field is AggregatedText t) -// // { -// // writer.WritePropertyName(t.Name); -// // JsonSerializer.Serialize(writer, t); -// // } -// // else if (field is AggregatedBoolean b) -// // { -// // writer.WritePropertyName(b.Name); -// // JsonSerializer.Serialize(writer, b); -// // } -// // -// // else throw new NotSupportedException(); -// // } -// // -// // writer.WriteEndObject(); -// // } -// // -// // -// // -// // -// // } -// -// // public class TextFrequencyConverter : JsonConverter -// // { -// // public override Boolean CanConvert(Type type) -// // { -// // return typeof(TextFrequency).IsAssignableFrom(type); -// // } -// // -// // public override TextFrequency Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => throw new NotImplementedException(); -// // -// // public override void Write(Utf8JsonWriter writer, TextFrequency textFrequency, JsonSerializerOptions options) -// // { -// // writer.WriteStartObject(); -// // writer.WritePropertyName(textFrequency.Text); -// // writer.WriteNumberValue(textFrequency.Percent); -// // writer.WriteEndObject(); -// // } -// // } -// -// -// -// } \ No newline at end of file diff --git a/csharp/lib/StatusApi/Connections/DcConnection.cs b/csharp/lib/StatusApi/Connections/DcConnection.cs deleted file mode 100644 index cac41968d..000000000 --- a/csharp/lib/StatusApi/Connections/DcConnection.cs +++ /dev/null @@ -1,8 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Phases; -namespace InnovEnergy.Lib.StatusApi.Connections; - - -public record DcConnection(Decimal Voltage, Decimal Current) : Phase(Voltage, Current) -{ - public Decimal Power => (Current * Voltage).Round3(); -} \ No newline at end of file diff --git a/csharp/lib/StatusApi/Connections/SinglePhaseAcConnection.cs b/csharp/lib/StatusApi/Connections/SinglePhaseAcConnection.cs deleted file mode 100644 index 6b8c57b2d..000000000 --- a/csharp/lib/StatusApi/Connections/SinglePhaseAcConnection.cs +++ /dev/null @@ -1,12 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Phases; - -namespace InnovEnergy.Lib.StatusApi.Connections; - -public record SinglePhaseAcConnection -( - Decimal Voltage, - Decimal Current, - Decimal Phi, - Decimal Frequency -); - //: AcPhase(Voltage, Current, Phi); \ No newline at end of file diff --git a/csharp/lib/StatusApi/Connections/ThreePhaseAcConnection.cs b/csharp/lib/StatusApi/Connections/ThreePhaseAcConnection.cs deleted file mode 100644 index f029b2fc4..000000000 --- a/csharp/lib/StatusApi/Connections/ThreePhaseAcConnection.cs +++ /dev/null @@ -1,10 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Phases; - -namespace InnovEnergy.Lib.StatusApi.Connections; - -public record ThreePhaseAcConnection(AcPhase L1, AcPhase L2, AcPhase L3, Decimal Frequency) -{ - public Decimal ApparentPower => L1.ApparentPower + L2.ApparentPower + L3.ApparentPower; - public Decimal ReactivePower => L1.ReactivePower + L2.ReactivePower + L3.ReactivePower; - public Decimal ActivePower => L1.ActivePower + L2.ActivePower + L3.ActivePower; -} \ No newline at end of file diff --git a/csharp/lib/StatusApi/DeviceType.cs b/csharp/lib/StatusApi/DeviceType.cs deleted file mode 100644 index 47b391875..000000000 --- a/csharp/lib/StatusApi/DeviceType.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace InnovEnergy.Lib.StatusApi; - -/// SIGN CONVENTION -/// -/// Voltages have to be measured/indicated so that they are guaranteed to be never negative. -/// In the case of AC this is accomplished by using the RMS measurement. -/// The sign convention of the current (and hence power, since voltage defined to be never negative) -/// depends on the type of the device. -/// If the device can only produce (e.g. PV) or only consume (e.g. Loads), -/// then the current has to be 0 or positive. -/// If the device is a prosumer (e.g. inverter, battery, grid...) -/// then a positive sign denotes current (power) flow away from the grid (to the "right") -/// and a negative sign denotes current (power) flow towards the grid (to the "left") - - - - -/// the currently known DeviceTypes, to be serialized as string in JSON -public enum DeviceType -{ - None, - PvOnAcIn , - PvOnAcOut , - PvOnDc , - Load , - CriticalLoad, - Battery , - Grid , - Inverter , - AcInToAcOut , - DcDc , - DcLoad , - Losses -} \ No newline at end of file diff --git a/csharp/lib/StatusApi/Devices/Battery.cs b/csharp/lib/StatusApi/Devices/Battery.cs deleted file mode 100644 index 3b8b1d476..000000000 --- a/csharp/lib/StatusApi/Devices/Battery.cs +++ /dev/null @@ -1,12 +0,0 @@ - -using InnovEnergy.Lib.StatusApi.Connections; - -namespace InnovEnergy.Lib.StatusApi.Devices; - -public abstract record Battery - ( - DcConnection Dc, - Decimal Soc, - Decimal Temperature - ) - : DcDevice(Dc); \ No newline at end of file diff --git a/csharp/lib/StatusApi/Devices/DcDcConverter.cs b/csharp/lib/StatusApi/Devices/DcDcConverter.cs deleted file mode 100644 index dd754d1f1..000000000 --- a/csharp/lib/StatusApi/Devices/DcDcConverter.cs +++ /dev/null @@ -1,10 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Connections; - -namespace InnovEnergy.Lib.StatusApi.Devices; - -public abstract record DcDcConverter -( - DcConnection Left, - DcConnection Right -) - : Device; \ No newline at end of file diff --git a/csharp/lib/StatusApi/Devices/DcDevice.cs b/csharp/lib/StatusApi/Devices/DcDevice.cs deleted file mode 100644 index 280086f26..000000000 --- a/csharp/lib/StatusApi/Devices/DcDevice.cs +++ /dev/null @@ -1,5 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Connections; - -namespace InnovEnergy.Lib.StatusApi.Devices; - -public abstract record DcDevice(DcConnection Dc) : Device; \ No newline at end of file diff --git a/csharp/lib/StatusApi/Devices/Device.cs b/csharp/lib/StatusApi/Devices/Device.cs deleted file mode 100644 index 879e03326..000000000 --- a/csharp/lib/StatusApi/Devices/Device.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace InnovEnergy.Lib.StatusApi.Devices; - -public abstract record Device -{ - public String DeviceType - { - get - { - var t = GetType(); - - while (!t!.IsAbstract) - t = t.BaseType; - - return t.Name; - } - } -} \ No newline at end of file diff --git a/csharp/lib/StatusApi/Devices/GridMeter.cs b/csharp/lib/StatusApi/Devices/GridMeter.cs deleted file mode 100644 index 32223244b..000000000 --- a/csharp/lib/StatusApi/Devices/GridMeter.cs +++ /dev/null @@ -1,5 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Connections; - -namespace InnovEnergy.Lib.StatusApi.Devices; - -public abstract record GridMeter(ThreePhaseAcConnection Ac) : ThreePhaseAcDevice(Ac); \ No newline at end of file diff --git a/csharp/lib/StatusApi/Devices/IPvCoupledDevice.cs b/csharp/lib/StatusApi/Devices/IPvCoupledDevice.cs deleted file mode 100644 index 53281d8ce..000000000 --- a/csharp/lib/StatusApi/Devices/IPvCoupledDevice.cs +++ /dev/null @@ -1,8 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Connections; - -namespace InnovEnergy.Lib.StatusApi.Devices; - -public interface IPvCoupledDevice -{ - IReadOnlyList Strings { get; } -} \ No newline at end of file diff --git a/csharp/lib/StatusApi/Devices/Mppt.cs b/csharp/lib/StatusApi/Devices/Mppt.cs deleted file mode 100644 index 2e9630d22..000000000 --- a/csharp/lib/StatusApi/Devices/Mppt.cs +++ /dev/null @@ -1,10 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Connections; - -namespace InnovEnergy.Lib.StatusApi.Devices; - -public abstract record Mppt - ( - DcConnection Dc, - IReadOnlyList Strings - ) - : DcDevice(Dc), IPvCoupledDevice; \ No newline at end of file diff --git a/csharp/lib/StatusApi/Devices/SinglePhaseAcDevice.cs b/csharp/lib/StatusApi/Devices/SinglePhaseAcDevice.cs deleted file mode 100644 index 4e259e05a..000000000 --- a/csharp/lib/StatusApi/Devices/SinglePhaseAcDevice.cs +++ /dev/null @@ -1,6 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Connections; - -namespace InnovEnergy.Lib.StatusApi.Devices; - - -public abstract record SinglePhaseAcDevice(SinglePhaseAcConnection Ac) : Device; \ No newline at end of file diff --git a/csharp/lib/StatusApi/Devices/SinglePhaseInverter.cs b/csharp/lib/StatusApi/Devices/SinglePhaseInverter.cs deleted file mode 100644 index d63747161..000000000 --- a/csharp/lib/StatusApi/Devices/SinglePhaseInverter.cs +++ /dev/null @@ -1,7 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Connections; - -namespace InnovEnergy.Lib.StatusApi.Devices; - -public abstract record SinglePhaseInverter(SinglePhaseAcConnection Ac, DcConnection Dc); - - diff --git a/csharp/lib/StatusApi/Devices/SinglePhasePvInverter.cs b/csharp/lib/StatusApi/Devices/SinglePhasePvInverter.cs deleted file mode 100644 index bf0a65c50..000000000 --- a/csharp/lib/StatusApi/Devices/SinglePhasePvInverter.cs +++ /dev/null @@ -1,10 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Connections; - -namespace InnovEnergy.Lib.StatusApi.Devices; - -public abstract record SinglePhasePvInverter - ( - SinglePhaseAcConnection Ac, - IReadOnlyList Strings - ) - : SinglePhaseAcDevice(Ac), IPvCoupledDevice; \ No newline at end of file diff --git a/csharp/lib/StatusApi/Devices/ThreePhaseAcDevice.cs b/csharp/lib/StatusApi/Devices/ThreePhaseAcDevice.cs deleted file mode 100644 index 340218e09..000000000 --- a/csharp/lib/StatusApi/Devices/ThreePhaseAcDevice.cs +++ /dev/null @@ -1,5 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Connections; - -namespace InnovEnergy.Lib.StatusApi.Devices; - -public abstract record ThreePhaseAcDevice(ThreePhaseAcConnection Ac) : Device; \ No newline at end of file diff --git a/csharp/lib/StatusApi/Devices/ThreePhaseInverter.cs b/csharp/lib/StatusApi/Devices/ThreePhaseInverter.cs deleted file mode 100644 index 895a9edf2..000000000 --- a/csharp/lib/StatusApi/Devices/ThreePhaseInverter.cs +++ /dev/null @@ -1,12 +0,0 @@ - - -using InnovEnergy.Lib.StatusApi.Connections; - -namespace InnovEnergy.Lib.StatusApi.Devices; - -public abstract record ThreePhaseInverter - ( - ThreePhaseAcConnection Ac, - DcConnection Dc - ) - : Device; \ No newline at end of file diff --git a/csharp/lib/StatusApi/Devices/ThreePhasePvInverter.cs b/csharp/lib/StatusApi/Devices/ThreePhasePvInverter.cs deleted file mode 100644 index ad07f5202..000000000 --- a/csharp/lib/StatusApi/Devices/ThreePhasePvInverter.cs +++ /dev/null @@ -1,10 +0,0 @@ -using InnovEnergy.Lib.StatusApi.Connections; - -namespace InnovEnergy.Lib.StatusApi.Devices; - -public abstract record ThreePhasePvInverter - ( - ThreePhaseAcConnection Ac, - IReadOnlyList Strings - ) - : ThreePhaseAcDevice(Ac), IPvCoupledDevice; \ No newline at end of file diff --git a/csharp/lib/StatusApi/Phases/AcPhase.cs b/csharp/lib/StatusApi/Phases/AcPhase.cs deleted file mode 100644 index 068e19393..000000000 --- a/csharp/lib/StatusApi/Phases/AcPhase.cs +++ /dev/null @@ -1,35 +0,0 @@ -using static DecimalMath.DecimalEx; - -namespace InnovEnergy.Lib.StatusApi.Phases; - - -public record AcPhase(Decimal Voltage, Decimal Current, Decimal Phi) - : Phase(Voltage, Current) -{ - - public Decimal ApparentPower => Voltage * Current; - public Decimal ActivePower => ApparentPower * PowerFactor; - public Decimal ReactivePower => ApparentPower * Sin(Phi); - public Decimal PowerFactor => Cos(Phi); - - public static AcPhase FromActiveReactive - ( - Decimal activePower, - Decimal reactivePower, - Decimal voltage, - Decimal current - ) - { - var phi = ATan2(reactivePower, activePower); - - return new AcPhase - ( - Voltage: voltage, - Current: current, - Phi: phi - ); - - } - - -} \ No newline at end of file diff --git a/csharp/lib/StatusApi/Phases/Phase.cs b/csharp/lib/StatusApi/Phases/Phase.cs deleted file mode 100644 index 236d6cf77..000000000 --- a/csharp/lib/StatusApi/Phases/Phase.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace InnovEnergy.Lib.StatusApi.Phases; - -/// A phase must have at least a known Voltage and Current. -/// For DC this is already enough. -/// For AC the values have to be in RMS (not amplitude or P2P) -/// Power can be inferred, P = UI - -public abstract record Phase - ( - Decimal Voltage, - Decimal Current - ); \ No newline at end of file diff --git a/csharp/lib/StatusApi/StatusApi.csproj b/csharp/lib/StatusApi/StatusApi.csproj deleted file mode 100644 index 96f7a934f..000000000 --- a/csharp/lib/StatusApi/StatusApi.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - - InnovEnergy.Lib.StatusApi - InnovEnergy.Lib.StatusApi - - - - - - - - - - - - - diff --git a/csharp/lib/SysTools/SysTools.csproj b/csharp/lib/SysTools/SysTools.csproj deleted file mode 100644 index 506350df6..000000000 --- a/csharp/lib/SysTools/SysTools.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - - Library - - - - full - - - - InnovEnergy.SysTools - - - - - - - diff --git a/csharp/lib/SysTools/Utils/Utils.cs b/csharp/lib/SysTools/Utils/Utils.cs deleted file mode 100644 index 6129cc8df..000000000 --- a/csharp/lib/SysTools/Utils/Utils.cs +++ /dev/null @@ -1,87 +0,0 @@ -namespace InnovEnergy.SysTools.Utils; - -public static class Utils -{ - public static IEnumerable Traverse(T root, Func> getChildren) - { - var stack = new Stack>(); - var it = root.Enumerator(); - it.MoveNext(); - - while (true) - { - //////// going down //////// - - while (true) - { - var cit = getChildren(it.Current).GetEnumerator(); - - if (cit.MoveNext()) // node has children, must be a branch - { - yield return it.Current; - - stack.Push(it); - it = cit; - } - else // no children, hence a leaf - { - var node = it.Current; - - yield return node; - - if (!it.MoveNext()) - break; // no more siblings: goto parent - } - } - - //////// going up //////// - - while (true) - { - it.Dispose(); - if (stack.Count == 0) yield break; // we got to the bottom of the stack, were done - - it = stack.Pop(); - - if (it.MoveNext()) - break; - } - } - - - } - - - private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); - - public static DateTime FromUnixTime(UInt64 unixTime) - { - return Epoch.AddSeconds(unixTime); - } - - - public static R ValueOrDefault(this Dictionary dict, T key) - { - return ValueOrDefault(dict, key, default); - } - - public static R ValueOrDefault(this Dictionary dict, T key, R defaultValue) - { - return dict.TryGetValue(key, out var value) ? value : defaultValue; - } - - public static void CopyFilesRecursively(String source, String target) - { - CopyFilesRecursively(new DirectoryInfo(source), new DirectoryInfo(target)); - } - - public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) - { - foreach (var file in source.GetFiles()) - file.CopyTo(Path.Combine(target.FullName, file.Name)); - - foreach (var dir in source.GetDirectories()) - CopyFilesRecursively(dir, target.CreateSubdirectory(dir.Name)); - } - -} \ No newline at end of file diff --git a/csharp/lib/Time/Time.csproj b/csharp/lib/Time/Time.csproj deleted file mode 100644 index 5b0b36b7e..000000000 --- a/csharp/lib/Time/Time.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - - Library - InnovEnergy.Time - - - diff --git a/csharp/lib/Units/Current.cs b/csharp/lib/Units/Current.cs deleted file mode 100644 index e313271b8..000000000 --- a/csharp/lib/Units/Current.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace InnovEnergy.Units; - -public readonly struct Current -{ - public static String Unit => "A"; - public static String Symbol => "I"; - - public Decimal Value { get; } - - public Current(Decimal value) => Value = value; - - public override String ToString() => Value + Unit; - - - // parallel - public static Current operator |(Current left, Current right) => new Current(left.Value + right.Value); - - // scalar multiplication - public static Current operator *(Decimal scalar , Current current) => new Current(scalar * current.Value); - public static Current operator *(Current current, Decimal scalar) => new Current(scalar * current.Value); - public static Current operator *(Int32 scalar , Current current) => new Current(scalar * current.Value); - public static Current operator *(Current current, Int32 scalar) => new Current(scalar * current.Value); - public static Current operator /(Current current, Decimal scalar) => new Current(current.Value / scalar); - public static Current operator /(Current current, Int32 scalar) => new Current(current.Value / scalar); - - // P=UI - public static Power operator *(Current current, Voltage voltage) => new Power(current.Value * voltage.Value); - - // U=RI - public static Voltage operator *(Current current, Resistance resistance) => new Voltage(resistance.Value* current.Value); - - - -} \ No newline at end of file diff --git a/csharp/lib/Units/Json/Converters.cs b/csharp/lib/Units/Json/Converters.cs deleted file mode 100644 index 81406754f..000000000 --- a/csharp/lib/Units/Json/Converters.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.Json.Serialization; -using InnovEnergy.Units.Json; - -// ReSharper disable once CheckNamespace -namespace InnovEnergy.Units; - -public static partial class Units -{ - public static IReadOnlyList JsonConverters = new JsonConverter[] - { - new CurrentConverter(), - new VoltageConverter(), - new PowerConverter(), - new ResistanceConverter() - }; -} \ No newline at end of file diff --git a/csharp/lib/Units/Power.cs b/csharp/lib/Units/Power.cs deleted file mode 100644 index d6e88bccc..000000000 --- a/csharp/lib/Units/Power.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace InnovEnergy.Units; - -public readonly struct Power -{ - public static String Unit => "W"; - public static String Symbol => "P"; - - public Decimal Value { get; } - - public Power(Decimal value) => Value = value; - - public override String ToString() => Value + Unit; - - - // parallel - public static Power operator |(Power left, Power right) => new Power(left.Value + right.Value); - // series - public static Power operator +(Power left, Power right) => new Power(left.Value + right.Value); - - // scalar multiplication - public static Power operator *(Decimal scalar, Power power ) => new Power(scalar * power.Value); - public static Power operator *(Power power , Decimal scalar) => new Power(scalar * power.Value); - public static Power operator *(Int32 scalar, Power power ) => new Power(scalar * power.Value); - public static Power operator *(Power power , Int32 scalar) => new Power(scalar * power.Value); - public static Power operator /(Power power , Decimal scalar) => new Power(power.Value / scalar); - public static Power operator /(Power power , Int32 scalar) => new Power(power.Value / scalar); - - // P=UI - public static Voltage operator /(Power power, Current current) => new Voltage(power.Value / current.Value); - public static Current operator /(Power power, Voltage voltage) => new Current(power.Value / voltage.Value); -} \ No newline at end of file diff --git a/csharp/lib/Units/Resistance.cs b/csharp/lib/Units/Resistance.cs deleted file mode 100644 index ae551e019..000000000 --- a/csharp/lib/Units/Resistance.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace InnovEnergy.Units; - -public readonly struct Resistance -{ - public static String Unit => "Ω"; - public static String Symbol => "R"; - - public Decimal Value { get; } - - public Resistance(Decimal value) => Value = value; - - public override String ToString() => Value + Unit; - - // series - public static Resistance operator +(Resistance left, Resistance right) => new Resistance(left.Value + right.Value); - // parallel - public static Resistance operator |(Resistance left, Resistance right) => new Resistance(1m / (1m / left.Value + 1m / right.Value)); - - // scalar multiplication - public static Resistance operator *(Decimal scalar , Resistance resistance) => new Resistance(scalar * resistance.Value); - public static Resistance operator *(Resistance resistance, Decimal scalar ) => new Resistance(scalar * resistance.Value); - public static Resistance operator *(Int32 scalar , Resistance resistance) => new Resistance(scalar * resistance.Value); - public static Resistance operator *(Resistance resistance, Int32 scalar ) => new Resistance(scalar * resistance.Value); - public static Resistance operator /(Resistance resistance, Decimal scalar ) => new Resistance(resistance.Value / scalar); - public static Resistance operator /(Resistance resistance, Int32 scalar ) => new Resistance(resistance.Value / scalar); - - - // U=RI - public static Voltage operator *(Resistance resistance, Current current) => new Voltage(resistance.Value* current.Value); - - - - // public static Voltage operator /(Power power, Current current) => new Voltage(power.Value / current.Value); - // public static Current operator /(Power power, Voltage voltage) => new Current(power.Value / voltage.Value); -} \ No newline at end of file diff --git a/csharp/lib/Units/Units.cs b/csharp/lib/Units/Units.cs deleted file mode 100644 index ced38eb03..000000000 --- a/csharp/lib/Units/Units.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace InnovEnergy.Units; - -public static partial class Units -{ - public static Current A (this Decimal value) => new Current(value); - public static Voltage V (this Decimal value) => new Voltage(value); - public static Power W (this Decimal value) => new Power(value); - public static Resistance Ohm(this Decimal value) => new Resistance(value); -} \ No newline at end of file diff --git a/csharp/lib/Units/Units.csproj b/csharp/lib/Units/Units.csproj deleted file mode 100644 index 090825d42..000000000 --- a/csharp/lib/Units/Units.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - - Library - InnovEnergy.Units - - - diff --git a/csharp/lib/Units/Voltage.cs b/csharp/lib/Units/Voltage.cs deleted file mode 100644 index ae39f9a0d..000000000 --- a/csharp/lib/Units/Voltage.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace InnovEnergy.Units; - -public readonly struct Voltage -{ - public static String Unit => "V"; - public static String Symbol => "U"; - - public Decimal Value { get; } - - public Voltage(Decimal value) => Value = value; - - public override String ToString() => Value + Unit; - - - // series - public static Voltage operator +(Voltage left, Voltage right) => new Voltage(left.Value + right.Value); - - public static Voltage operator *(Decimal scalar , Voltage voltage) => new Voltage(scalar * voltage.Value); - public static Voltage operator *(Voltage voltage, Decimal scalar) => new Voltage(scalar * voltage.Value); - public static Voltage operator *(Int32 scalar , Voltage voltage) => new Voltage(scalar * voltage.Value); - public static Voltage operator *(Voltage voltage, Int32 scalar) => new Voltage(scalar * voltage.Value); - - public static Voltage operator /(Voltage voltage, Decimal scalar) => new Voltage(voltage.Value / scalar); - public static Voltage operator /(Voltage voltage, Int32 scalar) => new Voltage(voltage.Value / scalar); - - - // U=RI - public static Current operator /(Voltage voltage, Resistance resistance) => new Current(voltage.Value / resistance.Value); - - // P=UI - public static Power operator *(Voltage voltage, Current current) => new Power(current.Value * voltage.Value); -} \ No newline at end of file diff --git a/csharp/lib/Utils/Units.cs b/csharp/lib/Utils/Units.cs deleted file mode 100644 index db95bfcbb..000000000 --- a/csharp/lib/Utils/Units.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace InnovEnergy.Lib.Utils; - -public static class Units -{ - public static String Unit(this Object v, String unit) => $"{v} {unit}"; - - public static String V(this Object v) => v.Unit("V"); - public static String W(this Object v) => v.Unit("W"); - public static String A(this Object v) => v.Unit("A"); - - public static String Degrees(this Object v) => v.Unit("°"); - public static String Celsius(this Object v) => v.Unit("°C"); - public static String Percent(this Object v) => v.Unit("%"); - -} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 7ff72816a..000000000 --- a/package-lock.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "new", - "lockfileVersion": 2, - "requires": true, - "packages": {} -}