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
25using System.Collections.Generic;25using System.Collections.Generic;
26using System.ComponentModel;26using System.ComponentModel;
27using System.IO;27using System.IO;
28using System.Linq;
28using System.Runtime.Serialization;29using System.Runtime.Serialization;
29 30
30// ReSharper disable VirtualMemberCallInConstructor31// 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 // Fields47 // 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" property138 // 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 set140 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 {

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