Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void init(String umdFilename, bool doIsoBuffering) throws java.io.IOException, java.io.FileNotFoundException
        private void init(string umdFilename, bool doIsoBuffering)
        {
            isPBP = false;
            if (string.ReferenceEquals(umdFilename, null) && doIsoBuffering)
            {
                sectorDevice = null;
            }
            else
            {
                RandomAccessFile fileReader = new RandomAccessFile(umdFilename, "r");

                sbyte[] header = new sbyte[headerLength];
                fileReader.seek(0);
                fileReader.read(header);
                fileReader.seek(0);

                if (header[0] == (sbyte)'C' && header[1] == (sbyte)'I' && header[2] == (sbyte)'S' && header[3] == (sbyte)'O')
                {
                    sectorDevice = new CSOFileSectorDevice(fileReader, header);
                }
                else if (header[0] == 0 && header[1] == (sbyte)'P' && header[2] == (sbyte)'B' && header[3] == (sbyte)'P')
                {
                    sectorDevice = new PBPFileSectorDevice(fileReader);
                    isPBP        = true;
                }
                else
                {
                    sectorDevice = new ISOFileSectorDevice(fileReader);
                }
            }

            if (doIsoBuffering)
            {
                string tmp = Settings.Instance.TmpDirectory;
                sectorDevice = new BufferedFileSectorDevice(new RandomAccessFile(tmp + "umdbuffer.toc", "rw"), new RandomAccessFile(tmp + "umdbuffer.iso", "rw"), sectorDevice);
            }

            numSectors = sectorDevice.NumSectors;

            setBrowser();

            if (browser == null && !hasIsoHeader())
            {
                throw new IOException(string.Format("Unsupported file format or corrupted file '{0}'.", umdFilename));
            }
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void close() throws java.io.IOException
        public override void close()
        {
            base.close();

            if (sectorDevice != null)
            {
                sectorDevice.close();
                sectorDevice = null;
            }

            writeToc();

            tocFile.close();
            tocFile = null;

            toc = null;
        }
Exemplo n.º 3
0
        public MappingSectorDevice(ISectorDevice sectorDevice, File mappingFile)
        {
            this.sectorDevice = sectorDevice;
            this.mappingFile  = mappingFile;

            // Create a default empty mapping in case the mapping file cannot be read
            sectorMapping      = new int[0];
            sectorMappingDirty = true;

            try
            {
                readMappingFile();
            }
            catch (FileNotFoundException e)
            {
                Console.WriteLine("Mapping file not found, creating it", e);
            }
            catch (IOException e)
            {
                Console.WriteLine("Error reading mapping file", e);
            }
        }
Exemplo n.º 4
0
 public BufferedFileSectorDevice(RandomAccessFile tocFile, RandomAccessFile fileAccess, ISectorDevice sectorDevice) : base(fileAccess)
 {
     this.tocFile      = tocFile;
     this.sectorDevice = sectorDevice;
     readToc();
 }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public UmdIsoReader(ISectorDevice sectorDevice) throws java.io.IOException
        public UmdIsoReader(ISectorDevice sectorDevice)
        {
            this.sectorDevice = sectorDevice;
            numSectors        = sectorDevice.NumSectors;
            setBrowser();
        }