Exemple #1
0
 public void CombineDerivedeReviewingIndexing(ReviewingIndexing ri)
 {
     for (int i = 0; i < ri.RecordList.Count; i++)
     {
         if (ri.RecordList[i].ID >= RecordIDNum)
         {
             RecordDict.Add(ri.RecordList[i].ID, ri.RecordList[i]);
         }
         else
         {
             RecordDict[ri.RecordList[i].ID] = ri.RecordList[i];
         }
     }
     RecordIDNum = ri.RecordIDNum;
 }
Exemple #2
0
        public void Read(string filePath)
        {
            if (string.IsNullOrEmpty(filePath))
            {
                throw new ArgumentNullException(nameof(filePath));
            }
            if (!File.Exists(filePath))
            {
                throw new Exception();
            }

            var data = File.ReadAllBytes(filePath);

            using (var ms = new MemoryStream(data))
            {
                using (var reader = new BinaryReader(ms, Encoding.ASCII, true))
                {
                    var startMagic      = reader.ReadBytes(4);
                    var blobVersion     = reader.ReadInt32();
                    var parserVersion   = reader.ReadInt32();
                    var recordsChecksum = reader.ReadInt32();
                    var flatOffset      = reader.ReadInt32();
                    var recordsOffset   = reader.ReadInt32();
                    var queriesOffset   = reader.ReadInt32();
                    var groupTagsOffset = reader.ReadInt32();

                    var counter       = reader.ReadInt32();
                    var flatIndexList = new Index[counter];
                    for (int i = 0; i < counter; i++)
                    {
                        var type = _types[reader.ReadUInt64()];

                        var isArray = type.StartsWith("array:");
                        if (isArray)
                        {
                            type = type.Substring("array:".Length);
                        }

                        flatIndexList[i] = new Index
                        {
                            Type    = type,
                            IsArray = isArray,
                            Size    = reader.ReadInt32()
                        };
                    }

                    foreach (var flatIndex in flatIndexList)
                    {
                        ReadFlatPair(reader, flatIndex);
                    }

                    counter = reader.ReadInt32();
                    for (int i = 0; i < counter; i++)
                    {
                        RecordDict.Add(GetName(reader.ReadUInt64()), reader.ReadUInt32());
                    }

                    counter = reader.ReadInt32();
                    for (int i = 0; i < counter; i++)
                    {
                        var tweakDBIDName = GetName(reader.ReadUInt64());
                        QueryDict.Add(tweakDBIDName, new List <string>());

                        var subCounter = reader.ReadInt32();
                        for (int j = 0; j < subCounter; j++)
                        {
                            QueryDict[tweakDBIDName].Add(GetName(reader.ReadUInt64()));
                        }
                    }

                    counter = reader.ReadInt32();
                    for (int i = 0; i < counter; i++)
                    {
                        GroupTagDict.Add(GetName(reader.ReadUInt64()), reader.ReadByte());
                    }
                }
            }
        }