public void IndexHasEntry( [ValueSource("PackObjectIds")] string id, [ValueSource("PackObjectCrcs")] int crc, [ValueSource("PackObjectOffsets")] int offset ) { var file = Path.Combine(PacksPath, "pack-582fdcbadcd4640394f15127be4fb9e755876c51.idx"); var index = new PackIndex(file, 237); var entry = index.GetEntry(id); Assert.AreEqual(id, entry.Id); Assert.AreEqual(crc, entry.Crc); Assert.AreEqual(offset, entry.Offset); }
private void EnsureLoaded() { if (_loaded) return; using (var stream = File.OpenRead(this.Location)) { var reader = new BinaryReader(stream); var sig = reader.ReadBytes(4); if (!(sig[0] == 'P' && sig[1] == 'A' && sig[2] == 'C' && sig[3] == 'K')) { throw new InvalidOperationException("not a pack file"); } this._version = reader.ReadBigEndianInt32(); this._entryCount = reader.ReadBigEndianInt32(); this._index = new PackIndex(this.IndexLocation, this._entryCount); } this._loaded = true; }