Exemple #1
0
        public IContent Splice(int offset)
        {
            var right = new ContentJson(_content.GetRange(offset, _content.Count - offset));

            _content.RemoveRange(offset, _content.Count - offset);
            return(right);
        }
Exemple #2
0
        public static IContent ReadItemContent(IUpdateDecoder decoder, byte info)
        {
            switch (info & Bits.Bits5)
            {
            case 0:     // GC
                throw new Exception("GC is not ItemContent");

            case 1:     // Deleted
                return(ContentDeleted.Read(decoder));

            case 2:     // JSON
                return(ContentJson.Read(decoder));

            case 3:     // Binary
                return(ContentBinary.Read(decoder));

            case 4:     // String
                return(ContentString.Read(decoder));

            case 5:     // Embed
                return(ContentEmbed.Read(decoder));

            case 6:     // Format
                return(ContentFormat.Read(decoder));

            case 7:     // Type
                return(ContentType.Read(decoder));

            case 8:     // Any
                return(ContentAny.Read(decoder));

            case 9:     // Doc
                return(ContentDoc.Read(decoder));

            default:
                throw new InvalidOperationException($"Content type not recognized: {info}");
            }
        }