Exemplo n.º 1
0
        // Override this to custom handle all offsets at once
        protected virtual string GetOffsetDescriptions()
        {
            StringBuilder sb = new StringBuilder();

            if (Offsets.Any())
            {
                // Write out each implemented offset's description
                foreach (Offset oSet in Offsets.Where(o => o.StartingIndex < Data.Length))
                {
                    // Get sectioned data
                    IEnumerable <Offset> nextOffsets = Offsets.Where(o => o.StartingIndex > oSet.StartingIndex);
                    int nextIndex = nextOffsets.Any() ? nextOffsets.Min(o => o.StartingIndex) : 0;
                    if (nextIndex == 0)
                    {
                        nextIndex = Data.Length;
                    }
                    int    bytesToTake   = nextIndex - oSet.StartingIndex;
                    byte[] sectionedData = GetSectionedData(oSet.StartingIndex, bytesToTake);

                    sb.Append(GetSingleOffsetDescription(oSet, sectionedData));
                }
            }
            else
            {
                sb.AppendLine($"Not yet implemented...{Environment.NewLine}Raw Data: {DataHex}");
            }

            return(sb.ToString());
        }