private void SortAndBuildInternalStructures() { if (N0183Defns != null) { // Array.Sort(N0183Defns); // Now (re)build up a dictionary of the PGN indices, recording the *first* instance of each PGN N0183Dictionary.Clear(); for (int i = N0183Defns.Length - 1; i >= 0; i--) { string typeCode = N0183Defns[i].Code; if (typeCode.Length > 3) { _largeTypeCodes[typeCode] = i; } else { N0183Dictionary[typeCode] = i; } } // Finally we sort all the fields // foreach (N0183Defn p in N0183Defns) // { // p.SortFields(); // } } }
public N0183Defn GetN0183Defn(N0183Frame msg) { string headerText = msg.Header.HeaderText; int defnIndex; if (_largeTypeCodes.TryGetValue(headerText.Substring(1), out defnIndex)) { msg.Header = new N0183Header(headerText.Substring(0, 1), "", headerText.Substring(1)); return(N0183Defns[defnIndex]); } else { if (N0183Dictionary.TryGetValue(msg.Header.TypeCode, out defnIndex)) { return(N0183Defns[defnIndex]); } else { return(new UnknownN0183Defn()); } } }