diff --git a/projects/Infrastructure/Extensions/ByteExtensions.cs b/projects/Infrastructure/Extensions/ByteExtensions.cs index 6587faab..3546a5a9 100644 --- a/projects/Infrastructure/Extensions/ByteExtensions.cs +++ b/projects/Infrastructure/Extensions/ByteExtensions.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; +using System.Text; namespace Infrastructure.Extensions { @@ -56,7 +57,7 @@ namespace Infrastructure.Extensions var buffer = new byte[length]; bytes.Read(buffer); - return new string(buffer.Select(o => (char)o).ToArray()); + return Encoding.ASCII.GetString(buffer).Trim('\0'); } public static string ReadHexString(this Stream bytes, int length) @@ -68,7 +69,7 @@ namespace Infrastructure.Extensions var buffer = new byte[length]; bytes.Read(buffer); - return BitConverter.ToString(buffer).Replace("-", "", StringComparison.CurrentCulture).ToLower(CultureInfo.CurrentCulture); + return BitConverter.ToString(buffer.Reverse().ToArray()).Replace("-", ""); } public static string ReadHexStringDesc(this Stream bytes, int length) diff --git a/projects/IoTCenter/Views/Home/Device.cshtml b/projects/IoTCenter/Views/Home/Device.cshtml index 703f6276..770a9cbb 100644 --- a/projects/IoTCenter/Views/Home/Device.cshtml +++ b/projects/IoTCenter/Views/Home/Device.cshtml @@ -207,7 +207,6 @@