public void Deserialize(IPrimitiveReader reader, int version)
        {
            //IndexExists
            IndexExists = reader.ReadBoolean();

            //IndexSize
            IndexSize = reader.ReadInt32();

            //Metadata
            ushort len = reader.ReadUInt16();

            if (len > 0)
            {
                Metadata = reader.ReadBytes(len);
            }

            //ResultItemList
            int listCount = reader.ReadInt32();

            ResultItemList = new List <ResultItem>(listCount);
            if (listCount > 0)
            {
                ResultItem resultItem;
                for (int i = 0; i < listCount; i++)
                {
                    resultItem = new ResultItem();
                    resultItem.Deserialize(reader);
                    ResultItemList.Add(resultItem);
                }
            }

            //ExceptionInfo
            ExceptionInfo = reader.ReadString();

            //VirtualCount
            if (version >= 2)
            {
                VirtualCount = reader.ReadInt32();
            }

            //IndexCap
            if (version >= 3)
            {
                IndexCap = reader.ReadInt32();
            }

            if (version >= 4)
            {
                //MetadataPropertyCollection
                if (reader.ReadBoolean())
                {
                    MetadataPropertyCollection = new MetadataPropertyCollection();
                    Serializer.Deserialize(reader.BaseStream, MetadataPropertyCollection);
                }
            }
        }
        public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
        {
            //IndexExists
            indexExists = reader.ReadBoolean();

            //IndexSize
            indexSize = reader.ReadInt32();

            //Metadata
            ushort len = reader.ReadUInt16();

            if (len > 0)
            {
                metadata = reader.ReadBytes(len);
            }

            //FirstPageResultItemList
            int listCount = reader.ReadInt32();

            firstPageResultItemList = new List <ResultItem>(listCount);
            if (listCount > 0)
            {
                ResultItem resultItem;
                for (int i = 0; i < listCount; i++)
                {
                    resultItem = new ResultItem();
                    resultItem.Deserialize(reader);
                    firstPageResultItemList.Add(resultItem);
                }
            }

            //LastPageResultItemList
            listCount = reader.ReadInt32();
            lastPageResultItemList = new List <ResultItem>(listCount);
            if (listCount > 0)
            {
                ResultItem resultItem;
                for (int i = 0; i < listCount; i++)
                {
                    resultItem = new ResultItem();
                    resultItem.Deserialize(reader);
                    lastPageResultItemList.Add(resultItem);
                }
            }

            //ExceptionInfo
            exceptionInfo = reader.ReadString();

            //VirtualCount
            if (version >= 2)
            {
                virtualCount = reader.ReadInt32();
            }
        }
Example #3
0
 /// <summary>
 /// Deserialize the class data from a stream.
 /// </summary>
 /// <param name="reader">The <see cref="T:MySpace.Common.IO.IPrimitiveReader"/> that extracts used to extra data from a stream.</param>
 /// <param name="version">The value of <see cref="P:MySpace.Common.IVersionSerializable.CurrentVersion"/> that was written to the stream when it was originally serialized to a stream;
 /// the version of the <paramref name="reader"/> data.</param>
 public void Deserialize(IPrimitiveReader reader, int version)
 {
     using (reader.CreateRegion())
     {
         //OrderedBag
         ushort count = reader.ReadUInt16();
         if (count > 0)
         {
             ItemBag = new OrderedBag <ResultItem>(BaseComparer);
             ResultItem resultItem;
             for (int i = 0; i < count; i++)
             {
                 resultItem = new ResultItem();
                 resultItem.Deserialize(reader);
                 ItemBag.Add(resultItem);
             }
         }
     }
 }
		public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
		{
            //IndexExists
            indexExists = reader.ReadBoolean();

            //IndexSize
            indexSize = reader.ReadInt32();

            //Metadata
            ushort len = reader.ReadUInt16();
            if (len > 0)
            {
                metadata = reader.ReadBytes(len);
            }

            //ResultItemList
            int listCount = reader.ReadInt32();
            resultItemList = new List<ResultItem>(listCount);
            if (listCount > 0)
            {
                ResultItem resultItem;
                for (int i = 0; i < listCount; i++)
                {
                    resultItem = new ResultItem();
                    resultItem.Deserialize(reader);
                    resultItemList.Add(resultItem);
                }
            }

            //ExceptionInfo
            exceptionInfo = reader.ReadString();

            //VirtualCount
            if (version >= 2)
            {
                virtualCount = reader.ReadInt32();
            }
		}
        public override void Deserialize(IPrimitiveReader reader, int version)
        {
            //ResultItemList
            int listCount = reader.ReadInt32();
            ResultItemList = new List<ResultItem>(listCount);
            if (listCount > 0)
            {
                ResultItem resultItem;
                for (int i = 0; i < listCount; i++)
                {
                    resultItem = new ResultItem();
                    resultItem.Deserialize(reader);
                    ResultItemList.Add(resultItem);
                }
            }

            //IndexIdIndexHeaderMapping
            ushort count = reader.ReadUInt16();
            if (count > 0)
            {
                IndexIdIndexHeaderMapping = new Dictionary<byte[], IndexHeader>(count, new ByteArrayEqualityComparer());
                byte[] indexId;
                IndexHeader indexHeader;
                ushort len;

                for (ushort i = 0; i < count; i++)
                {
                    len = reader.ReadUInt16();
                    indexId = null;
                    if (len > 0)
                    {
                        indexId = reader.ReadBytes(len);
                    }
                    indexHeader = new IndexHeader();
                    Serializer.Deserialize(reader.BaseStream, indexHeader);

                    IndexIdIndexHeaderMapping.Add(indexId, indexHeader);
                }
            }

            //TotalCount
            TotalCount = reader.ReadInt32();

            //IsTagPrimarySort
            IsTagPrimarySort = reader.ReadBoolean();

            //SortFieldName
            SortFieldName = reader.ReadString();

            //SortOrderList
            count = reader.ReadUInt16();
            SortOrderList = new List<SortOrder>(count);
            SortOrder sortOrder;
            for (int i = 0; i < count; i++)
            {
                sortOrder = new SortOrder();
                sortOrder.Deserialize(reader);
                SortOrderList.Add(sortOrder);
            }

            //ExceptionInfo
            ExceptionInfo = reader.ReadString();

            //AdditionalAvailableItemCount
            AdditionalAvailableItemCount = reader.ReadInt32();
        }
Example #6
0
        public override void Deserialize(IPrimitiveReader reader, int version)
        {
            //ResultItemList
            int listCount = reader.ReadInt32();

            ResultItemList = new List <ResultItem>(listCount);
            if (listCount > 0)
            {
                ResultItem resultItem;
                for (int i = 0; i < listCount; i++)
                {
                    resultItem = new ResultItem();
                    resultItem.Deserialize(reader);
                    ResultItemList.Add(resultItem);
                }
            }

            //IndexIdIndexHeaderMapping
            ushort count = reader.ReadUInt16();
            ushort len;

            if (count > 0)
            {
                IndexIdIndexHeaderMapping = new Dictionary <byte[], IndexHeader>(count, new ByteArrayEqualityComparer());
                byte[]      indexId;
                IndexHeader indexHeader;

                for (ushort i = 0; i < count; i++)
                {
                    len     = reader.ReadUInt16();
                    indexId = null;
                    if (len > 0)
                    {
                        indexId = reader.ReadBytes(len);
                    }
                    indexHeader = new IndexHeader();
                    Serializer.Deserialize(reader.BaseStream, indexHeader);

                    IndexIdIndexHeaderMapping.Add(indexId, indexHeader);
                }
            }

            //TotalCount
            TotalCount = reader.ReadInt32();

            //IsTagPrimarySort
            IsTagPrimarySort = reader.ReadBoolean();

            //SortFieldName
            SortFieldName = reader.ReadString();

            //SortOrderList
            count         = reader.ReadUInt16();
            SortOrderList = new List <SortOrder>(count);
            SortOrder sortOrder;

            for (int i = 0; i < count; i++)
            {
                sortOrder = new SortOrder();
                sortOrder.Deserialize(reader);
                SortOrderList.Add(sortOrder);
            }

            //ExceptionInfo
            ExceptionInfo = reader.ReadString();

            //AdditionalAvailableItemCount
            AdditionalAvailableItemCount = reader.ReadInt32();

            //IndexCap
            if (version >= 2)
            {
                IndexCap = reader.ReadInt32();
            }

            if (version >= 3)
            {
                if (reader.ReadBoolean())
                {
                    GroupByResult = new GroupByResult(new BaseComparer(IsTagPrimarySort, SortFieldName, SortOrderList));
                    Serializer.Deserialize(reader.BaseStream, GroupByResult);
                }
            }
        }
Example #7
0
        public override void Deserialize(IPrimitiveReader reader, int version)
        {
            // set the object's current version to the server's object version
            if (version < CORRECT_SERVERSIDE_PAGING_LOGIC_VERSION)
            {
                this.currentVersion = version;
            }

            //ResultItemList
            int listCount = reader.ReadInt32();

            ResultItemList = new List <ResultItem>(listCount);
            if (listCount > 0)
            {
                ResultItem resultItem;
                for (int i = 0; i < listCount; i++)
                {
                    resultItem = new ResultItem();
                    resultItem.Deserialize(reader);
                    ResultItemList.Add(resultItem);
                }
            }

            //IndexIdIndexHeaderMapping
            ushort count = reader.ReadUInt16();

            if (count > 0)
            {
                IndexIdIndexHeaderMapping = new Dictionary <byte[], IndexHeader>(count, new ByteArrayEqualityComparer());
                byte[]      indexId;
                IndexHeader indexHeader;
                ushort      len;

                for (ushort i = 0; i < count; i++)
                {
                    len     = reader.ReadUInt16();
                    indexId = null;
                    if (len > 0)
                    {
                        indexId = reader.ReadBytes(len);
                    }
                    indexHeader = new IndexHeader();
                    Serializer.Deserialize(reader.BaseStream, indexHeader);

                    IndexIdIndexHeaderMapping.Add(indexId, indexHeader);
                }
            }

            //TotalCount
            TotalCount = reader.ReadInt32();

            //IsTagPrimarySort
            IsTagPrimarySort = reader.ReadBoolean();

            //SortFieldName
            SortFieldName = reader.ReadString();

            //SortOrderList
            count         = reader.ReadUInt16();
            SortOrderList = new List <SortOrder>(count);
            SortOrder sortOrder;

            for (int i = 0; i < count; i++)
            {
                sortOrder = new SortOrder();
                sortOrder.Deserialize(reader);
                SortOrderList.Add(sortOrder);
            }

            //ExceptionInfo
            ExceptionInfo = reader.ReadString();

            if (version >= 2)
            {
                //PageableItemCount
                AdditionalAvailableItemCount = reader.ReadInt32();
            }
        }