示例#1
0
        public void Test()
        {
            for (int i = 0; i < _testFiles.Length; i++)
            {
                string  location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "ISO9660", _testFiles[i]);
                IFilter filter   = new ZZZNoFilter();
                filter.Open(location);
                IMediaImage image = new AaruFormat();
                Assert.AreEqual(true, image.Open(filter), $"{_testFiles[i]}: Open()");
                Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"{_testFiles[i]}: MediaType");
                Assert.AreEqual(_sectors[i], image.Info.Sectors, $"{_testFiles[i]}: Sectors");
                Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"{_testFiles[i]}: SectorSize");
                IFilesystem fs = new ISO9660();

                var wholePart = new Partition
                {
                    Name   = "Whole device",
                    Length = image.Info.Sectors,
                    Size   = image.Info.Sectors * image.Info.SectorSize
                };

                Assert.AreEqual(true, fs.Identify(image, wholePart), $"{_testFiles[i]}: Identify()");
                fs.GetInformation(image, wholePart, out _, null);
                Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, $"{_testFiles[i]}: Clusters");
                Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, $"{_testFiles[i]}: ClusterSize");
                Assert.AreEqual("ISO9660", fs.XmlFsType.Type, $"{_testFiles[i]}: Type");
                Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, $"{_testFiles[i]}: VolumeName");
                Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, $"{_testFiles[i]}: VolumeSerial");
                Assert.AreEqual(_sysid[i], fs.XmlFsType.SystemIdentifier, $"{_testFiles[i]}: SystemIdentifier");

                Assert.AreEqual(_appid[i], fs.XmlFsType.ApplicationIdentifier,
                                $"{_testFiles[i]}: ApplicationIdentifier");
            }
        }
示例#2
0
 public void Test()
 {
     for (int i = 0; i < testfiles.Length; i++)
     {
         string  location = Path.Combine(Consts.TestFilesRoot, "filesystems", "iso9660", testfiles[i]);
         IFilter filter   = new LZip();
         filter.Open(location);
         IMediaImage image = new ZZZRawImage();
         Assert.AreEqual(true, image.Open(filter), testfiles[i]);
         Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
         Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
         Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
         IFilesystem fs        = new ISO9660();
         Partition   wholePart = new Partition
         {
             Name   = "Whole device",
             Length = image.Info.Sectors,
             Size   = image.Info.Sectors * image.Info.SectorSize
         };
         Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]);
         fs.GetInformation(image, wholePart, out _, null);
         Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
         Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
         Assert.AreEqual("ISO9660", fs.XmlFsType.Type, testfiles[i]);
         Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
         Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]);
         Assert.AreEqual(sysid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]);
         Assert.AreEqual(appid[i], fs.XmlFsType.ApplicationIdentifier, testfiles[i]);
     }
 }
示例#3
0
        private static byte[] extractFileFromPartition(IOpticalMediaImage opticalImage, Partition partition, string fileName)
        {
            var iso = new ISO9660();

            try
            {
                //string information;
                //iso.GetInformation(opticalImage, partition, out information, Encoding.ASCII);

                var dict = new Dictionary <string, string>();
                iso.Mount(opticalImage, partition, Encoding.ASCII, dict, "normal");
                //System.Collections.Generic.List<string> strlist = null;
                //iso.ReadDir("/", out strlist);

                if (iso.Stat(fileName, out var stat) == Aaru.CommonTypes.Structs.Errno.NoError && stat.Length > 0)
                {
                    //file exists
                    var buff = new byte[stat.Length];
                    iso.Read(fileName, 0, stat.Length, ref buff);
                    return(buff);
                }
            }
            finally
            {
                iso.Unmount();
            }
            return(null);
        }