示例#1
0
        public override void ParseData()
        {
            // Parse triplets automatically if they exist
            Offset tripsOffset = Offsets.FirstOrDefault(o => o.DataType == Lookups.DataTypes.TRIPS);

            if (tripsOffset != null)
            {
                // If the triplets are in repeating groups, parse group by group
                if (IsRepeatingGroup)
                {
                    int numLengthBytes = Offsets[1].StartingIndex;
                    int curIndex       = 0;
                    while (curIndex < Data.Length)
                    {
                        int rgLength = numLengthBytes == 1 ? GetNumericValueFromData <byte>(curIndex, numLengthBytes)
                            : GetNumericValueFromData <ushort>(curIndex, numLengthBytes);
                        int    tripletLength  = rgLength - numLengthBytes;
                        byte[] curTripletData = new byte[tripletLength];
                        Array.ConstrainedCopy(Data, curIndex + numLengthBytes, curTripletData, 0, tripletLength);

                        // Append this group of triplets
                        Triplets = Triplets.Concat(Triplet.GetAllTriplets(curTripletData)).ToList();

                        curIndex += rgLength;
                    }
                }
                else
                {
                    Triplets = Triplet.GetAllTriplets(Data.Skip(tripsOffset.StartingIndex).ToArray());
                }
            }
        }