protected void PrepareBlock() { int CurrentBlock = (int)(Position / this.Cso.BlockSize); if (CurrentBlock != this.SelectedCurrentBlock) { this.SelectedCurrentBlock = CurrentBlock; this.SelectedCurrentBlockData = Cso.ReadBlockDecompressed((uint)CurrentBlock); } SelectedCurrentPositionInBlock = (int)(Position % this.Cso.BlockSize); }
public void ReadSectorDecompressedTest() { var Cso = new Cso(File.OpenRead("../../../TestInput/cube.cso")); var IsoBytes = File.ReadAllBytes("../../../TestInput/cube.iso"); int ExpectedNumberOfBlocks = 229; int ExpectedBlockSize = 2048; Assert.AreEqual(ExpectedNumberOfBlocks, Cso.NumberOfBlocks); Assert.AreEqual(ExpectedBlockSize, Cso.BlockSize); for (uint Block = 0; Block < ExpectedNumberOfBlocks; Block++) { var DecompressedBlockData = Cso.ReadBlockDecompressed(Block); CollectionAssert.AreEqual( IsoBytes.Skip((int)(ExpectedBlockSize * Block)).Take(ExpectedBlockSize).ToArray(), DecompressedBlockData ); } }