private static List <IndexDataItem> DeserializeIndexDataItemList(IPrimitiveReader reader) { int listCount = reader.ReadInt32(); List <IndexDataItem> indexDataItemList = new List <IndexDataItem>(listCount); IndexDataItem indexDataItem; for (int i = 0; i < listCount; i++) { indexDataItem = new IndexDataItem(); indexDataItem.Deserialize(reader); indexDataItemList.Add(indexDataItem); } return(indexDataItemList); }
public void Deserialize(IPrimitiveReader reader, int version) { //IndexId ushort len = reader.ReadUInt16(); if (len > 0) { indexId = reader.ReadBytes(len); } //TargetIndexName targetIndexName = reader.ReadString(); //IndexTagMapping ushort count = reader.ReadUInt16(); indexTagMapping = new Dictionary<string, List<string>>(count); if (count > 0) { string indexName; ushort tagNameListCount; List<string> tagNameList; for (ushort i = 0; i < count; i++) { indexName = reader.ReadString(); tagNameListCount = reader.ReadUInt16(); tagNameList = new List<string>(); for (ushort j = 0; j < tagNameListCount; j++) { tagNameList.Add(reader.ReadString()); } indexTagMapping.Add(indexName, tagNameList); } } //AddList int listCount = reader.ReadInt32(); addList = new List<IndexDataItem>(listCount); IndexDataItem indexDataItem; for (int i = 0; i < listCount; i++) { indexDataItem = new IndexDataItem(); indexDataItem.Deserialize(reader); addList.Add(indexDataItem); } //DeleteList listCount = reader.ReadInt32(); deleteList = new List<IndexItem>(listCount); IndexItem indexItem; for (int i = 0; i < listCount; i++) { indexItem = new IndexItem(); indexItem.Deserialize(reader); deleteList.Add(indexItem); } //Metadata len = reader.ReadUInt16(); if (len > 0) { metadata = reader.ReadBytes(len); } //UpdateMetadata updateMetadata = reader.ReadBoolean(); //ReplaceFullIndex replaceFullIndex = reader.ReadBoolean(); if (version >= 2) { //PreserveData preserveData = reader.ReadBoolean(); } if(version >= 3) { //IndexVirtualCountMapping count = reader.ReadUInt16(); if (count > 0) { indexVirtualCountMapping = new Dictionary<string, int>(count); string indexName; int virtualCount; for (ushort i = 0; i < count; i++) { indexName = reader.ReadString(); virtualCount = reader.ReadInt32(); indexVirtualCountMapping.Add(indexName, virtualCount); } } } if (version >= 4) { //PrimaryId primaryId = reader.ReadInt32(); } }
public void Deserialize(IPrimitiveReader reader, int version) { //IndexId ushort len = reader.ReadUInt16(); if (len > 0) { indexId = reader.ReadBytes(len); } //TargetIndexName targetIndexName = reader.ReadString(); //IndexTagMapping ushort count = reader.ReadUInt16(); indexTagMapping = new Dictionary <string, List <string> >(count); if (count > 0) { string indexName; ushort tagNameListCount; List <string> tagNameList; for (ushort i = 0; i < count; i++) { indexName = reader.ReadString(); tagNameListCount = reader.ReadUInt16(); tagNameList = new List <string>(); for (ushort j = 0; j < tagNameListCount; j++) { tagNameList.Add(reader.ReadString()); } indexTagMapping.Add(indexName, tagNameList); } } //AddList int listCount = reader.ReadInt32(); addList = new List <IndexDataItem>(listCount); IndexDataItem indexDataItem; for (int i = 0; i < listCount; i++) { indexDataItem = new IndexDataItem(); indexDataItem.Deserialize(reader); addList.Add(indexDataItem); } //DeleteList listCount = reader.ReadInt32(); deleteList = new List <IndexItem>(listCount); IndexItem indexItem; for (int i = 0; i < listCount; i++) { indexItem = new IndexItem(); indexItem.Deserialize(reader); deleteList.Add(indexItem); } //Metadata len = reader.ReadUInt16(); if (len > 0) { metadata = reader.ReadBytes(len); } //UpdateMetadata updateMetadata = reader.ReadBoolean(); //ReplaceFullIndex replaceFullIndex = reader.ReadBoolean(); if (version >= 2) { //PreserveData preserveData = reader.ReadBoolean(); } if (version >= 3) { //IndexVirtualCountMapping count = reader.ReadUInt16(); if (count > 0) { indexVirtualCountMapping = new Dictionary <string, int>(count); string indexName; int virtualCount; for (ushort i = 0; i < count; i++) { indexName = reader.ReadString(); virtualCount = reader.ReadInt32(); indexVirtualCountMapping.Add(indexName, virtualCount); } } } if (version >= 4) { //PrimaryId primaryId = reader.ReadInt32(); } }