Inheritance: ICompressedIso
Ejemplo n.º 1
0
        public void ReadTest()
        {
            var Cso = new Cso(File.OpenRead("../../../TestInput/cube.cso"));
            var IsoBytes = File.ReadAllBytes("../../../TestInput/cube.iso");
            var CsoStream = new CompressedIsoProxyStream(Cso);
            Assert.AreEqual(0x72800, CsoStream.Length);
            var Data = new byte[2048];
            var Data2 = new byte[3000];
            Assert.AreEqual(Data.Length, CsoStream.Read(Data, 0, Data.Length));
            Assert.AreEqual(Data.Length, CsoStream.Read(Data, 0, Data.Length));
            Assert.AreEqual(3000, CsoStream.Read(Data2, 0, 3000));

            CsoStream.Position = 0x72800 - Data.Length;
            Assert.AreEqual(Data.Length, CsoStream.Read(Data, 0, Data.Length));

            CsoStream.Position = 0x72800 - 10;
            Assert.AreEqual(10, CsoStream.Read(Data, 0, 10));

            CsoStream.Position = 0x72800 - 10;
            Assert.AreEqual(10, CsoStream.Read(Data, 0, 100));

            CollectionAssert.AreEqual(
                IsoBytes,
                CsoStream.ReadAll(true)
            );

            CsoStream.Position = 0x10 * 2048 - 100;
            CollectionAssert.AreEqual(
                IsoBytes.Slice(0x10 * 2048 - 100, 300),
                CsoStream.ReadBytes(300)
            );
        }
Ejemplo n.º 2
0
 public void IsoConstructorTest()
 {
     var CsoName = "../../../TestInput/test.cso";
     var Cso = new Cso(File.OpenRead(CsoName));
     var Iso = new IsoFile(new CompressedIsoProxyStream(Cso), CsoName);
     var ContentNode = Iso.Root.Locate("path/content.txt");
     var Lines = ContentNode.Open().ReadAllContentsAsString().Split('\n');
     foreach (var Line in Lines)
     {
         Iso.Root.Locate(Line);
     }
 }
Ejemplo n.º 3
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.ReadBlocksDecompressed(Block, 1)[0];
         CollectionAssert.AreEqual(
             IsoBytes.Skip((int)(ExpectedBlockSize * Block)).Take(ExpectedBlockSize).ToArray(),
             DecompressedBlockData.ToArray()
         );
     }
 }
Ejemplo n.º 4
0
 public CsoProxyStream(Cso Cso)
 {
     this.Cso = Cso;
 }