예제 #1
0
        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);
        }
예제 #2
0
        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
                    );
            }
        }