Unified · Split
| @@ -25,6 +25,7 @@ using System; · 24 unmodified lines | |||
| 25 | using System.Collections.Generic; | 25 | using System.Collections.Generic; |
| 26 | using System.ComponentModel; | 26 | using System.ComponentModel; |
| 27 | using System.IO; | 27 | using System.IO; |
| 28 | using System.Linq; | ||
| 28 | using System.Runtime.Serialization; | 29 | using System.Runtime.Serialization; |
| 29 | 30 | ||
| 30 | // ReSharper disable VirtualMemberCallInConstructor | 31 | // ReSharper disable VirtualMemberCallInConstructor |
| @@ -41,7 +42,7 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 10 unmodified lines | |||
| 41 | // Constants | 42 | // Constants |
| 42 | internal const int ConversionFactorLength = 4; | 43 | internal const int ConversionFactorLength = 4; |
| 43 | 44 | ||
| 44 | private const int BitLabelCount = sizeof(ushort) * 8; | 45 | private const int BitLabelCount = 16; |
| 45 | 46 | ||
| 46 | // Fields | 47 | // Fields |
| 47 | private byte[] m_labelImage; | 48 | private byte[] m_labelImage; |
| @@ -135,7 +136,7 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 87 unmodified lines | |||
| 135 | { | 136 | { |
| 136 | // We hide this from the editor just because this is a large combined string of all digital labels, | 137 | // We hide this from the editor just because this is a large combined string of all digital labels, |
| 137 | // and it will make more sense for consumers to use the "Labels" property | 138 | // and it will make more sense for consumers to use the "Labels" property |
| 138 | get => string.Join("|", Labels); | 139 | get => string.Join("|", Labels.Select(label => label.RemoveCharacter('|').GetValidLabel())); |
| 139 | set | 140 | set |
| 140 | { | 141 | { |
| 141 | if (string.IsNullOrEmpty(value)) | 142 | if (string.IsNullOrEmpty(value)) |
| @@ -147,7 +148,7 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 5 unmodified lines | |||
| 147 | string[] labels = value.Split('|'); | 148 | string[] labels = value.Split('|'); |
| 148 | 149 | ||
| 149 | for (int i = 0; i < BitLabelCount; i++) | 150 | for (int i = 0; i < BitLabelCount; i++) |
| 150 | Labels[i] = i < labels.Length ? labels[i] : ""; | 151 | Labels[i] = i < labels.Length ? labels[i].Trim() : ""; |
| 151 | 152 | ||
| 152 | using (MemoryStream stream = new MemoryStream()) | 153 | using (MemoryStream stream = new MemoryStream()) |
| 153 | { | 154 | { |