History

GSF.PhasorProtocols: Added trimming for digital labels in CFG-3 frame

J. Ritchie Carroll committed 5 years ago

Commit 4d94eca1 parent 2d3bce61 file · +4 −3Browse files

Unified · Split

Source/Libraries/GSF.PhasorProtocols/IEEEC37_118/DigitalDefinition3.cs+4−3
@@ -25,6 +25,7 @@ using System; · 24 unmodified lines
2525 using System.Collections.Generic;
2626 using System.ComponentModel;
2727 using System.IO;
28+using System.Linq;
2829 using System.Runtime.Serialization;
2930
3031 // ReSharper disable VirtualMemberCallInConstructor
@@ -41,7 +42,7 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 10 unmodified lines
4142 // Constants
4243 internal const int ConversionFactorLength = 4;
4344
44− private const int BitLabelCount = sizeof(ushort) * 8;
45+ private const int BitLabelCount = 16;
4546
4647 // Fields
4748 private byte[] m_labelImage;
@@ -135,7 +136,7 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 87 unmodified lines
135136 {
136137 // We hide this from the editor just because this is a large combined string of all digital labels,
137138 // 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()));
139140 set
140141 {
141142 if (string.IsNullOrEmpty(value))
@@ -147,7 +148,7 @@ namespace GSF.PhasorProtocols.IEEEC37_118 · 5 unmodified lines
147148 string[] labels = value.Split('|');
148149
149150 for (int i = 0; i < BitLabelCount; i++)
150− Labels[i] = i < labels.Length ? labels[i] : "";
151+ Labels[i] = i < labels.Length ? labels[i].Trim() : "";
151152
152153 using (MemoryStream stream = new MemoryStream())
153154 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t