Ejemplo n.º 1
0
        /// <summary>
        /// Serialize/deserialize index.
        /// </summary>
        /// <param name="index"></param>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <returns></returns>
        private ITagsCollectionIndexReadonly SerializeDeserialize(ITagsCollectionIndex index, uint from, uint to)
        {
            MemoryStream stream = new MemoryStream();

            TagIndexSerializer.Serialize(stream, index, from, to);
            stream.Seek(0, SeekOrigin.Begin);

            return(TagIndexSerializer.Deserialize(stream));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Serialize/deserialize index.
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        private ITagsIndexReadonly SerializeDeserialize(ITagsIndex index)
        {
            MemoryStream stream = new MemoryStream();

            TagIndexSerializer.Serialize(stream, index);
            stream.Seek(0, SeekOrigin.Begin);

            return(TagIndexSerializer.Deserialize(stream));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Serialize/deserialize index.
        /// </summary>
        /// <param name="index"></param>
        /// <param name="position"></param>
        /// <returns></returns>
        private ITagsCollectionIndexReadonly SerializeDeserialize(ITagsCollectionIndex index, int position)
        {
            MemoryStream stream = new MemoryStream();

            stream.Seek(position, SeekOrigin.Begin);
            TagIndexSerializer.Serialize(stream, index);

            stream.Seek(position, SeekOrigin.Begin);
            return(TagIndexSerializer.Deserialize(stream));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Serialize/deserialize index.
        /// </summary>
        /// <param name="index"></param>
        /// <param name="position"></param>
        /// <returns></returns>
        private ITagsIndexReadonly SerializeDeserializeLimitedStream(ITagsIndex index, int position)
        {
            MemoryStream memoryStream = new MemoryStream();

            memoryStream.Seek(position, SeekOrigin.Begin);

            LimitedStream stream = new LimitedStream(memoryStream);

            TagIndexSerializer.Serialize(stream, index);
            stream.Seek(0, SeekOrigin.Begin);

            return(TagIndexSerializer.Deserialize(stream));
        }