public void SetLabel(int index, string value)
{
if (index < 0 || index >= LabelCount)
throw new IndexOutOfRangeException("Invalid label index specified. Note that there are " + LabelCount + " labels per digital available in " + DraftRevision + " of the IEC 61850-90-5 protocol");
if (value.Trim().Length > 16)
throw new OverflowException("Individual label length cannot exceed " + 16);
else
{
string current = Label.PadRight(MaximumLabelLength);
string left = "";
string right = "";
if (index > 0)
left = current.Substring(0, index * 16);
if (index < 15)
right = current.Substring((index + 1) * 16);
Label = left + value.GetValidLabel().PadRight(16) + right;
}
}