public void Write(ITreeWriter writer)
        {
            writer.WriteStartObject();

            writer.WritePropertyName(nameof(List));
            writer.WriteList(List);

            writer.WritePropertyName(nameof(StringDictionary));
            writer.WriteDictionary(StringDictionary);

            writer.WritePropertyName(nameof(IntDictionary));
            writer.WriteDictionary(IntDictionary);

            writer.WriteEndObject();
        }
Exemplo n.º 2
0
        public void Write(ITreeWriter writer)
        {
            // Merge changed small values under cutoff into SmallValueArray
            Trim();

            writer.WriteStartObject();

            if (_smallValueArray?.Length > 0)
            {
                // If there are any non-empty values, write the text and end positions
                writer.WriteBlockArray(Names.ValueEnd, _valueEndInPage);
                writer.WriteBlockArray(Names.SmallValues, _smallValueArray);

                // If there is more than one page, write page starts
                int pages = (Count / PageRowCount) + 1;
                if (pages > 1)
                {
                    writer.WriteBlockArray(Names.PageStart, _pageStartInChapter);
                }
            }
            else if (Count > 0)
            {
                // If there is no text but a non-zero count, we must preserve the count
                writer.Write(Names.Count, Count);
            }

            // If there are any large values, write them
            if (_largeValueDictionary?.Count > 0)
            {
                writer.WritePropertyName(Names.LargeValues);
                writer.WriteDictionary(_largeValueDictionary);
            }

            writer.WriteEndObject();
        }