示例#1
0
文件: Manifest.cs 项目: gabilic/Oplan
            internal void Split(Manifest.ManifestBlock.CreateBlock createBlock)
            {
                int num = 2;

                Manifest.ManifestBlock[] subBlocks = new Manifest.ManifestBlock[num];
                for (int j = 0; j < num; j++)
                {
                    subBlocks[j] = createBlock();
                }
                List <Manifest.ManifestRecord> list = new List <Manifest.ManifestRecord>();
                Converter <Manifest.ManifestRecord, Manifest.ManifestRecord> converter = null;

                for (int i = 0; i < num; i++)
                {
                    int index = (int)((((double)i) / ((double)num)) * this.recordList.Count);
                    int num4  = (int)(((i + 1.0) / ((double)num)) * this.recordList.Count);
                    if (converter == null)
                    {
                        converter = mr => mr.ReplaceBlock(subBlocks[i]);
                    }
                    subBlocks[i].recordList = this.recordList.GetRange(index, num4 - index).ConvertAll <Manifest.ManifestRecord>(converter);
                    Manifest.ManifestRecord item = this.recordList[index].ReplaceIndirect(subBlocks[i].blockId);
                    list.Add(item);
                    subBlocks[i].SetDirty();
                }
                this.recordList = list;
                this.SetDirty();
            }
示例#2
0
文件: Manifest.cs 项目: gabilic/Oplan
        private Manifest.ManifestRecord Search(Manifest.StopHere stopHere)
        {
            ManifestBlock  rootBlock  = this.rootBlock;
            ManifestRecord tailRecord = ManifestRecord.TailRecord;

            while (true)
            {
                ManifestRecord record2 = null;
                bool           flag    = false;
                foreach (ManifestRecord record3 in new List <ManifestRecord>(rootBlock)
                {
                    tailRecord
                })
                {
                    if (stopHere(record3.path))
                    {
                        if ((record2 == null) || (record2.indirectManifestBlockId < 0))
                        {
                            return(record3);
                        }
                        rootBlock  = this.FetchBlock(record2.indirectManifestBlockId);
                        tailRecord = record3;
                        flag       = true;
                        break;
                    }
                    record2 = record3;
                }
                if (!flag)
                {
                    D.Assert(false, "Should have stopped inside loop.");
                }
            }
        }
示例#3
0
文件: Manifest.cs 项目: gabilic/Oplan
 private Manifest.ManifestBlock CreateBlock()
 {
     Manifest.ManifestBlock manifestBlock = new Manifest.ManifestBlock(new Manifest.TellManifestDirty(this.SetDirty), this.storageMethod, this.rootBlock.superBlock.nextUnassignedBlockId);
     this.rootBlock.superBlock.nextUnassignedBlockId++;
     D.Assert(!this.blockCache.ContainsKey(manifestBlock.blockId));
     this.blockCache[manifestBlock.blockId] = manifestBlock;
     return(manifestBlock);
 }
示例#4
0
文件: Manifest.cs 项目: gabilic/Oplan
 public ManifestRecord(Manifest.ManifestBlock block, string path, bool fileExists, long fileLength, int indirectManifestBlockId)
 {
     this._block      = block;
     this._path       = path;
     this._fileExists = fileExists;
     this._fileLength = fileLength;
     this._indirectManifestBlockId = indirectManifestBlockId;
     D.Assert(block == null || path != null);
 }
示例#5
0
文件: Manifest.cs 项目: gabilic/Oplan
 private Manifest.ManifestBlock FetchBlock(int blockId)
 {
     if (this.blockCache.ContainsKey(blockId))
     {
         return(this.blockCache[blockId]);
     }
     Manifest.ManifestBlock manifestBlock = new Manifest.ManifestBlock(new Manifest.TellManifestDirty(this.SetDirty), this.storageMethod, blockId);
     this.blockCache[blockId] = manifestBlock;
     return(manifestBlock);
 }
示例#6
0
文件: Manifest.cs 项目: gabilic/Oplan
            public ManifestRecord(MashupParseContext context, Manifest.ManifestBlock block)
            {
                this._block = block;
                XMLTagReader xMLTagReader = context.NewTagReader("ManifestRecord");

                this._path       = context.GetRequiredAttribute("Path");
                this._fileExists = context.GetRequiredAttributeBoolean("FileExists");
                this._fileLength = context.GetRequiredAttributeLong("FileLength");
                this._indirectManifestBlockId = context.GetRequiredAttributeInt("IndirectManifestBlockId");
                xMLTagReader.SkipAllSubTags();
            }
示例#7
0
文件: Manifest.cs 项目: gabilic/Oplan
 internal void Add(string path, long fileLength)
 {
     Manifest.ManifestRecord manifestRecord = this.FindFirstGreaterEqual(path);
     if (manifestRecord.path == path)
     {
         manifestRecord.fileExists = true;
         manifestRecord.fileLength = fileLength;
         return;
     }
     Manifest.ManifestBlock  manifestBlock = (manifestRecord.block == null) ? this.rootBlock : manifestRecord.block;
     Manifest.ManifestRecord newRecord     = new Manifest.ManifestRecord(manifestBlock, path, true, fileLength, -1);
     manifestBlock.Insert(newRecord, manifestRecord);
     if (manifestBlock.Count > this.rootBlock.superBlock.splitThreshold)
     {
         manifestBlock.Split(new Manifest.ManifestBlock.CreateBlock(this.CreateBlock));
     }
 }
示例#8
0
文件: Manifest.cs 项目: gabilic/Oplan
 public Manifest(RenderOutputMethod storageMethod)
 {
     this.storageMethod = storageMethod;
     this.rootBlock     = this.FetchBlock(0);
 }
示例#9
0
文件: Manifest.cs 项目: gabilic/Oplan
 internal Manifest.ManifestRecord ReplaceBlock(Manifest.ManifestBlock manifestBlock)
 {
     return(new Manifest.ManifestRecord(manifestBlock, this.path, this.fileExists, this.fileLength, this.indirectManifestBlockId));
 }