From 8dd4cc58ce111b671f4927b562c0317e8b9985b6 Mon Sep 17 00:00:00 2001 From: Thomas Wiedebusch Date: Thu, 14 Sep 2023 13:04:12 +0200 Subject: [PATCH] Merged from main common version 2.6.4 --- Common/Common.sln | 67 ---------------- Common/CommonConsole/CommonConsole.csproj | 6 -- .../CommonMessurementUnits/BitExtensions.cs | 78 +++++++++---------- ...s.csproj => CommonMeasurementUnits.csproj} | 4 +- Common/CommonMessurementUnits/Current.cs | 24 +++--- Common/CommonMessurementUnits/Flow.cs | 24 +++--- .../JsonConverters/CurrentConverter.cs | 17 ++-- .../JsonConverters/FlowConverter.cs | 17 ++-- .../JsonConverters/PressureConverter.cs | 17 ++-- .../JsonConverters/TemperatureConverter.cs | 17 ++-- .../JsonConverters/TimeConverter.cs | 17 ++-- .../JsonConverters/VolumeConverter.cs | 17 ++-- Common/CommonMessurementUnits/Pressure.cs | 24 +++--- .../Properties/AssemblyInfo.cs | 4 +- Common/CommonMessurementUnits/Temperature.cs | 18 ++--- Common/CommonMessurementUnits/Time.cs | 42 +++++----- Common/CommonMessurementUnits/Unit.cs | 40 +++++----- Common/CommonMessurementUnits/Volume.cs | 32 ++++---- .../GenesisCore/GenesisConfigReader.cs | 71 +++++++---------- .../Genesis/GenesisCore/GenesisMeter.cs | 4 +- .../Genesis/Registers/Json/AppSection.cs | 10 ++- .../Genesis/Registers/Json/Details.cs | 10 ++- .../Genesis/Registers/Json/FwVersion.cs | 8 +- .../Genesis/Registers/Json/Register.cs | 6 +- .../Genesis/Registers/Json/Status.cs | 10 ++- .../Genesis/Registers/Json/Value.cs | 10 ++- 26 files changed, 256 insertions(+), 338 deletions(-) rename Common/CommonMessurementUnits/{CommonMessurementUnits.csproj => CommonMeasurementUnits.csproj} (95%) diff --git a/Common/Common.sln b/Common/Common.sln index 4f5ae3eb..61d38cec 100644 --- a/Common/Common.sln +++ b/Common/Common.sln @@ -183,8 +183,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SIRTBroadcaster.Host", "SIR EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProduction", "LaaProduction\LaaProduction.csproj", "{FD30EB7A-7809-4E62-9374-791D31877D6D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonMessurementUnits", "CommonMessurementUnits\CommonMessurementUnits.csproj", "{17C15B79-9A9E-4079-8FE2-0E563F18CA01}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonConsole", "CommonConsole\CommonConsole.csproj", "{AFC428F5-0141-4A3F-BEF2-470A89D972F6}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "modbus_master_csharp", "modbus_master_csharp\modbus_master_csharp.csproj", "{F14940F8-3C86-4BB7-A915-B021E4B3052D}" @@ -4255,70 +4253,6 @@ Global {FD30EB7A-7809-4E62-9374-791D31877D6D}.XP32bit|x64.Build.0 = Release|Any CPU {FD30EB7A-7809-4E62-9374-791D31877D6D}.XP32bit|x86.ActiveCfg = Release|Any CPU {FD30EB7A-7809-4E62-9374-791D31877D6D}.XP32bit|x86.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}._MANUAL_CONTROL|Any CPU.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}._MANUAL_CONTROL|Any CPU.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}._MANUAL_CONTROL|Mixed Platforms.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}._MANUAL_CONTROL|Mixed Platforms.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}._MANUAL_CONTROL|x64.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}._MANUAL_CONTROL|x64.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}._MANUAL_CONTROL|x86.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}._MANUAL_CONTROL|x86.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.COM|Any CPU.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.COM|Any CPU.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.COM|Mixed Platforms.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.COM|Mixed Platforms.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.COM|x64.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.COM|x64.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.COM|x86.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.COM|x86.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Debug|Any CPU.Build.0 = Debug|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Debug|x64.ActiveCfg = Debug|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Debug|x64.Build.0 = Debug|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Debug|x86.ActiveCfg = Debug|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Debug|x86.Build.0 = Debug|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.GenesisDisplayTool_V01|Any CPU.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.GenesisDisplayTool_V01|Any CPU.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.GenesisDisplayTool_V01|Mixed Platforms.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.GenesisDisplayTool_V01|Mixed Platforms.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.GenesisDisplayTool_V01|x64.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.GenesisDisplayTool_V01|x64.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.GenesisDisplayTool_V01|x86.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.GenesisDisplayTool_V01|x86.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.PerformTest|Any CPU.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.PerformTest|Any CPU.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.PerformTest|Mixed Platforms.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.PerformTest|Mixed Platforms.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.PerformTest|x64.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.PerformTest|x64.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.PerformTest|x86.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.PerformTest|x86.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Release|Any CPU.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Release|Any CPU.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Release|x64.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Release|x64.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Release|x86.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.Release|x86.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.ReleaseTest|Any CPU.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.ReleaseTest|Any CPU.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.ReleaseTest|Mixed Platforms.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.ReleaseTest|Mixed Platforms.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.ReleaseTest|x64.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.ReleaseTest|x64.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.ReleaseTest|x86.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.ReleaseTest|x86.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.XP32bit|Any CPU.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.XP32bit|Any CPU.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.XP32bit|Mixed Platforms.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.XP32bit|Mixed Platforms.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.XP32bit|x64.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.XP32bit|x64.Build.0 = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.XP32bit|x86.ActiveCfg = Release|Any CPU - {17C15B79-9A9E-4079-8FE2-0E563F18CA01}.XP32bit|x86.Build.0 = Release|Any CPU {AFC428F5-0141-4A3F-BEF2-470A89D972F6}._MANUAL_CONTROL|Any CPU.ActiveCfg = Release|Any CPU {AFC428F5-0141-4A3F-BEF2-470A89D972F6}._MANUAL_CONTROL|Any CPU.Build.0 = Release|Any CPU {AFC428F5-0141-4A3F-BEF2-470A89D972F6}._MANUAL_CONTROL|Mixed Platforms.ActiveCfg = Release|Any CPU @@ -4530,7 +4464,6 @@ Global {AF973E0E-2B44-4F1A-B1E7-77C8B4F30579} = {99B23EE9-CE50-4924-A055-C39EFA038721} {A9D1A99D-6E55-4394-86AD-B5C53E9225EB} = {AF973E0E-2B44-4F1A-B1E7-77C8B4F30579} {FD30EB7A-7809-4E62-9374-791D31877D6D} = {696A94BE-7237-4AE2-9E36-6059DE519971} - {17C15B79-9A9E-4079-8FE2-0E563F18CA01} = {C17363DF-A043-4F25-8EBA-2B3B078227DC} {AFC428F5-0141-4A3F-BEF2-470A89D972F6} = {C17363DF-A043-4F25-8EBA-2B3B078227DC} {F14940F8-3C86-4BB7-A915-B021E4B3052D} = {B4F8545B-F379-42A5-BDE9-763FD7B79598} EndGlobalSection diff --git a/Common/CommonConsole/CommonConsole.csproj b/Common/CommonConsole/CommonConsole.csproj index ea0fa48c..381ae381 100644 --- a/Common/CommonConsole/CommonConsole.csproj +++ b/Common/CommonConsole/CommonConsole.csproj @@ -54,12 +54,6 @@ - - - {17C15B79-9A9E-4079-8FE2-0E563F18CA01} - CommonMessurementUnits - - \ No newline at end of file diff --git a/Common/CommonMessurementUnits/BitExtensions.cs b/Common/CommonMessurementUnits/BitExtensions.cs index 95506da0..e30bea52 100644 --- a/Common/CommonMessurementUnits/BitExtensions.cs +++ b/Common/CommonMessurementUnits/BitExtensions.cs @@ -1,75 +1,75 @@ -namespace CommonMessurementUnits -{ - using System; - using System.Linq; - using System.Text; +using System; +using System.Linq; +using System.Text; +namespace Xylem.Common.CommonCore.CommonMeasurementUnits +{ public static class BitExtensions { - public static byte[] GetBits(this byte[] bytes) + public static Byte[] GetBits(this Byte[] bytes) { if (bytes is null) { - return Array.Empty(); + return Array.Empty(); } var bytesCount = bytes.Length; var bitsCount = bytesCount * 8; - var bits = new byte[bitsCount]; + var bits = new Byte[bitsCount]; var bit = 0; foreach (var @byte in bytes) { - for (int b = 7; b >= 0; b--) + for (Int32 b = 7; b >= 0; b--) { - bits[bit++] = (byte)((@byte >> b) % 2); + bits[bit++] = (Byte)((@byte >> b) % 2); } } return bits; } - public static byte[] GetBytes(this byte value, int take = 1) - => BitConverter.GetBytes(value).Take(take); + public static Byte[] GetBytes(this Byte value, Int32 take = 1) + => Enumerable.Take(BitConverter.GetBytes(value), take); - public static byte[] GetBytes(this sbyte value, int take = 2) - => BitConverter.GetBytes(value).Take(take); + public static Byte[] GetBytes(this SByte value, Int32 take = 2) + => Enumerable.Take(BitConverter.GetBytes(value), take); - public static byte[] GetBytes(this short value, int take = 2) - => BitConverter.GetBytes(value).Take(2); + public static Byte[] GetBytes(this Int16 value, Int32 take = 2) + => Enumerable.Take(BitConverter.GetBytes(value), 2); - public static byte[] GetBytes(this ushort value, int take = 2) - => BitConverter.GetBytes(value).Take(2); + public static Byte[] GetBytes(this UInt16 value, Int32 take = 2) + => Enumerable.Take(BitConverter.GetBytes(value), 2); - public static byte[] GetBytes(this int value, int take = 4) - => BitConverter.GetBytes(value).Take(take); + public static Byte[] GetBytes(this Int32 value, Int32 take = 4) + => Enumerable.Take(BitConverter.GetBytes(value), take); - public static byte[] GetBytes(this uint value, int take = 4) - => BitConverter.GetBytes(value).Take(take); + public static Byte[] GetBytes(this UInt32 value, Int32 take = 4) + => Enumerable.Take(BitConverter.GetBytes(value), take); - public static byte[] GetBytes(this long value, int take = 8) - => BitConverter.GetBytes(value).Take(take); + public static Byte[] GetBytes(this Int64 value, Int32 take = 8) + => Enumerable.Take(BitConverter.GetBytes(value), take); - public static byte[] GetBytes(this ulong value, int take = 8) - => BitConverter.GetBytes(value).Take(take); + public static Byte[] GetBytes(this UInt64 value, Int32 take = 8) + => Enumerable.Take(BitConverter.GetBytes(value), take); - public static byte[] GetBytes(this double value) + public static Byte[] GetBytes(this Double value) => BitConverter.GetBytes(value); - public static byte[] GetBytes(this string value) + public static Byte[] GetBytes(this String value) => Encoding.ASCII.GetBytes(value); - public static byte[] Swap(this byte[] bytes) + public static Byte[] Swap(this Byte[] bytes) { if (bytes is null) { - return Array.Empty(); + return Array.Empty(); } var length = bytes.Length; - var swapped = new byte[length]; + var swapped = new Byte[length]; - for (int x = 0; x < length; x++) + for (Int32 x = 0; x < length; x++) { swapped[x] = bytes[length - x - 1]; } @@ -77,21 +77,21 @@ return swapped; } - public static byte[] Take(this byte[] bytesSRC, int count) + public static Byte[] Take(this Byte[] bytesSRC, Int32 count) { if (bytesSRC is null || count < 0) { - return Array.Empty(); + return Array.Empty(); } - var bytesDST = new byte[count]; + var bytesDST = new Byte[count]; Array.Copy(bytesSRC, 0, bytesDST, 0, count); return bytesDST; } - public static string ToHex(this byte[] value, string separator = " ") + public static String ToHex(this Byte[] value, String separator = " ") { if (value is null) { @@ -101,16 +101,16 @@ return BitConverter.ToString(value).Replace("-", separator); } - public static byte[] FromHex(this string value, string separator = " ") + public static Byte[] FromHex(this String value, String separator = " ") { if (string.IsNullOrWhiteSpace(value)) { - return Array.Empty(); + return Array.Empty(); } return value .Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries) - .Select(x => byte.TryParse(x, out byte b) ? b : default(byte)) + .Select(x => byte.TryParse(x, out Byte b) ? b : default(Byte)) .ToArray(); } } diff --git a/Common/CommonMessurementUnits/CommonMessurementUnits.csproj b/Common/CommonMessurementUnits/CommonMeasurementUnits.csproj similarity index 95% rename from Common/CommonMessurementUnits/CommonMessurementUnits.csproj rename to Common/CommonMessurementUnits/CommonMeasurementUnits.csproj index 402d8e2f..1bafe1fc 100644 --- a/Common/CommonMessurementUnits/CommonMessurementUnits.csproj +++ b/Common/CommonMessurementUnits/CommonMeasurementUnits.csproj @@ -7,8 +7,8 @@ {17C15B79-9A9E-4079-8FE2-0E563F18CA01} Library Properties - CommonMessurementUnits - CommonMessurementUnits + Xylem.Common.CommonCore.CommonMeasurementUnits + Xylem.Common.CommonCore.CommonMeasurementUnits v4.8.1 Stoyan Zlatev Sensus - a Xylem brand diff --git a/Common/CommonMessurementUnits/Current.cs b/Common/CommonMessurementUnits/Current.cs index 0be055aa..ff439371 100644 --- a/Common/CommonMessurementUnits/Current.cs +++ b/Common/CommonMessurementUnits/Current.cs @@ -1,28 +1,28 @@ -namespace CommonMessurementUnits +using System; +using Newtonsoft.Json; +using Xylem.Common.CommonCore.CommonMeasurementUnits.JsonConverters; + +namespace Xylem.Common.CommonCore.CommonMeasurementUnits { - using CommonMessurementUnits.JsonConverters; - - using Newtonsoft.Json; - [JsonConverter(typeof(CurrentConverter))] public class Current : Unit { - public double MiliampereHours + public Double MilliampereHours { - get => this.AmpereHours * MAInH; - set => this.AmpereHours = value / MAInH; + get => AmpereHours * MAInH; + set => AmpereHours = value / MAInH; } - public double AmpereHours + public Double AmpereHours { - get => this.value; + get => value; set => this.value = value; } - public static implicit operator Current(double x) + public static implicit operator Current(Double x) => new Current { value = x }; - public static implicit operator Current(double? x) + public static implicit operator Current(Double? x) => new Current { value = x ?? 0 }; } } diff --git a/Common/CommonMessurementUnits/Flow.cs b/Common/CommonMessurementUnits/Flow.cs index fc1d0ed0..cd41eb3e 100644 --- a/Common/CommonMessurementUnits/Flow.cs +++ b/Common/CommonMessurementUnits/Flow.cs @@ -1,28 +1,28 @@ -namespace CommonMessurementUnits +using System; +using Newtonsoft.Json; +using Xylem.Common.CommonCore.CommonMeasurementUnits.JsonConverters; + +namespace Xylem.Common.CommonCore.CommonMeasurementUnits { - using CommonMessurementUnits.JsonConverters; - - using Newtonsoft.Json; - [JsonConverter(typeof(FlowConverter))] public class Flow : Unit { - public double CubicMeterInHour + public Double CubicMeterInHour { - get => this.value; + get => value; set => this.value = value; } - public double LiterInMinute + public Double LiterInMinute { - get => this.CubicMeterInHour / MinInH * LInm3; - set => this.CubicMeterInHour = value * MinInH / LInm3; + get => CubicMeterInHour / MinInH * LInm3; + set => CubicMeterInHour = value * MinInH / LInm3; } - public static implicit operator Flow(double x) + public static implicit operator Flow(Double x) => new Flow { value = x }; - public static implicit operator Flow(double? x) + public static implicit operator Flow(Double? x) => new Flow { value = x ?? 0 }; } } diff --git a/Common/CommonMessurementUnits/JsonConverters/CurrentConverter.cs b/Common/CommonMessurementUnits/JsonConverters/CurrentConverter.cs index ba8f652a..933c3b90 100644 --- a/Common/CommonMessurementUnits/JsonConverters/CurrentConverter.cs +++ b/Common/CommonMessurementUnits/JsonConverters/CurrentConverter.cs @@ -1,19 +1,18 @@ -namespace CommonMessurementUnits.JsonConverters +using System; +using Newtonsoft.Json; + +namespace Xylem.Common.CommonCore.CommonMeasurementUnits.JsonConverters { - using Newtonsoft.Json; - - using System; - public class CurrentConverter : JsonConverter { - public override Current ReadJson(JsonReader reader, Type objectType, Current existingValue, bool hasExistingValue, JsonSerializer serializer) + public override Current ReadJson(JsonReader reader, Type objectType, Current existingValue, Boolean hasExistingValue, JsonSerializer serializer) { - while (reader.ValueType != typeof(double)) + while (reader.ValueType != typeof(Double)) { reader.Read(); } - if (reader.Value is double value) + if (reader.Value is Double value) { return value; } @@ -22,6 +21,6 @@ } public override void WriteJson(JsonWriter writer, Current value, JsonSerializer serializer) - => writer.WriteValue((double)value); + => writer.WriteValue((Double)value); } } diff --git a/Common/CommonMessurementUnits/JsonConverters/FlowConverter.cs b/Common/CommonMessurementUnits/JsonConverters/FlowConverter.cs index a3bfa449..e83d45cb 100644 --- a/Common/CommonMessurementUnits/JsonConverters/FlowConverter.cs +++ b/Common/CommonMessurementUnits/JsonConverters/FlowConverter.cs @@ -1,19 +1,18 @@ -namespace CommonMessurementUnits.JsonConverters +using System; +using Newtonsoft.Json; + +namespace Xylem.Common.CommonCore.CommonMeasurementUnits.JsonConverters { - using Newtonsoft.Json; - - using System; - public class FlowConverter : JsonConverter { - public override Flow ReadJson(JsonReader reader, Type objectType, Flow existingValue, bool hasExistingValue, JsonSerializer serializer) + public override Flow ReadJson(JsonReader reader, Type objectType, Flow existingValue, Boolean hasExistingValue, JsonSerializer serializer) { - while (reader.ValueType != typeof(double)) + while (reader.ValueType != typeof(Double)) { reader.Read(); } - if (reader.Value is double value) + if (reader.Value is Double value) { return value; } @@ -22,6 +21,6 @@ } public override void WriteJson(JsonWriter writer, Flow value, JsonSerializer serializer) - => writer.WriteValue((double)value); + => writer.WriteValue((Double)value); } } diff --git a/Common/CommonMessurementUnits/JsonConverters/PressureConverter.cs b/Common/CommonMessurementUnits/JsonConverters/PressureConverter.cs index ca8eee7b..107441a2 100644 --- a/Common/CommonMessurementUnits/JsonConverters/PressureConverter.cs +++ b/Common/CommonMessurementUnits/JsonConverters/PressureConverter.cs @@ -1,19 +1,18 @@ -namespace CommonMessurementUnits.JsonConverters +using System; +using Newtonsoft.Json; + +namespace Xylem.Common.CommonCore.CommonMeasurementUnits.JsonConverters { - using System; - - using Newtonsoft.Json; - public class PressureConverter : JsonConverter { - public override Pressure ReadJson(JsonReader reader, Type objectType, Pressure existingValue, bool hasExistingValue, JsonSerializer serializer) + public override Pressure ReadJson(JsonReader reader, Type objectType, Pressure existingValue, Boolean hasExistingValue, JsonSerializer serializer) { - while (reader.ValueType != typeof(double)) + while (reader.ValueType != typeof(Double)) { reader.Read(); } - if (reader.Value is double value) + if (reader.Value is Double value) { return value; } @@ -22,6 +21,6 @@ } public override void WriteJson(JsonWriter writer, Pressure value, JsonSerializer serializer) - => writer.WriteValue((double)value); + => writer.WriteValue((Double)value); } } diff --git a/Common/CommonMessurementUnits/JsonConverters/TemperatureConverter.cs b/Common/CommonMessurementUnits/JsonConverters/TemperatureConverter.cs index 2d8e9214..a33b9c50 100644 --- a/Common/CommonMessurementUnits/JsonConverters/TemperatureConverter.cs +++ b/Common/CommonMessurementUnits/JsonConverters/TemperatureConverter.cs @@ -1,19 +1,18 @@ -namespace CommonMessurementUnits.JsonConverters +using System; +using Newtonsoft.Json; + +namespace Xylem.Common.CommonCore.CommonMeasurementUnits.JsonConverters { - using Newtonsoft.Json; - - using System; - public class TemperatureConverter : JsonConverter { - public override Temperature ReadJson(JsonReader reader, Type objectType, Temperature existingValue, bool hasExistingValue, JsonSerializer serializer) + public override Temperature ReadJson(JsonReader reader, Type objectType, Temperature existingValue, Boolean hasExistingValue, JsonSerializer serializer) { - while (reader.ValueType != typeof(double)) + while (reader.ValueType != typeof(Double)) { reader.Read(); } - if (reader.Value is double value) + if (reader.Value is Double value) { return value; } @@ -22,6 +21,6 @@ } public override void WriteJson(JsonWriter writer, Temperature value, JsonSerializer serializer) - => writer.WriteValue((double)value); + => writer.WriteValue((Double)value); } } diff --git a/Common/CommonMessurementUnits/JsonConverters/TimeConverter.cs b/Common/CommonMessurementUnits/JsonConverters/TimeConverter.cs index b611a985..cc530001 100644 --- a/Common/CommonMessurementUnits/JsonConverters/TimeConverter.cs +++ b/Common/CommonMessurementUnits/JsonConverters/TimeConverter.cs @@ -1,19 +1,18 @@ -namespace CommonMessurementUnits.JsonConverters +using System; +using Newtonsoft.Json; + +namespace Xylem.Common.CommonCore.CommonMeasurementUnits.JsonConverters { - using System; - - using Newtonsoft.Json; - public class TimeConverter : JsonConverter