Пример #1
0
        public static bool TryGetDevice(FileType fileType, Stream stream, out VfsDevice device)
        {
            device = null;

            if (fileType == FileType.GZip)
            {
                device = new GZipArchiveDevice(stream);
            }
            else if (fileType == FileType.Iso9660)
            {
                device = new Iso9960Device(stream);
            }
            else if (fileType == FileType.Rar)
            {
                device = new RarArchiveDevice(stream);
            }
            else if (fileType == FileType.SevenZip)
            {
                device = new SevenZipArchiveDevice(stream);
            }
            else if (fileType == FileType.Tar)
            {
                device = new TarArchiveDevice(stream);
            }
            else if (fileType == FileType.Zip)
            {
                device = new ZipArchiveDevice(stream);
            }

            return(device != null);
        }
Пример #2
0
        static void Scan(string path)
        {
            Console.WriteLine(path);

            var isoDevice = new Iso9960Device(path);

            try
            {
                isoDevice.Initialize();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Failed to read ISO: {0}", ex.Message);
                return;
            }

            var stopwatch = Stopwatch.StartNew();

            new Scanner(isoDevice).Scan();
            stopwatch.Stop();

            Console.WriteLine("Finished in {0}.", stopwatch.Elapsed);
        }