示例#1
0
        private void LoadIndexInfo(Byte[] indexData, bool needBackUpIndex)
        {
            if (indexData.Length > 0)
            {
                if (needBackUpIndex)
                {
                    BackupIndexInfo(indexData);
                }
                indexData = DESCrypto.Decrypt(indexData, m_number);//解密索引数据
            }

            m_deletedIndexes.Clear();
            m_fileIndexes.Clear();
            var index = 0;

            while (index < indexData.Length)
            {
                var info = IndexInfo.Decode(indexData, ref index);
                if (info.Deleted)
                {
                    m_deletedIndexes.Add(info);
                }
                else
                {
                    m_fileIndexes[info.Id.PathNormalize()] = info;
                }
            }

            m_memoryStream.Position = m_packageInfo.IndexOffset;//重置回文件信息结尾处
        }
示例#2
0
        private void LoadIndexInfo(byte[] indexData, bool needBackUpIndex)
        {
            if (indexData.Length > 0)
            {
                if (needBackUpIndex)
                {
                    this.BackupIndexInfo(indexData);
                }
                indexData = DESCrypto.Decrypt(indexData, this.m_number);
            }
            this.m_deletedIndexes.Clear();
            this.m_fileIndexes.Clear();
            int offset = 0;

            while (offset < indexData.Length)
            {
                IndexInfo item = IndexInfo.Decode(indexData, ref offset);
                if (item.Deleted)
                {
                    this.m_deletedIndexes.Add(item);
                }
                else
                {
                    this.m_fileIndexes[item.Id.PathNormalize()] = item;
                }
            }
            this.m_fileStream.Position = this.m_packageInfo.IndexOffset;
        }