Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void readSector(int sectorNumber, byte[] buffer, int offset) throws java.io.IOException
        public override void readSector(int sectorNumber, sbyte[] buffer, int offset)
        {
            int?bufferedSectorNumber = toc[sectorNumber];

            if (bufferedSectorNumber != null)
            {
                fileAccess.seek(((long)ISectorDevice_Fields.sectorLength) * bufferedSectorNumber.Value);
                fileAccess.read(buffer, offset, ISectorDevice_Fields.sectorLength);
                return;
            }

            if (sectorDevice == null)
            {
                Console.WriteLine(string.Format("Reading outside the UMD buffer file (sector=0x{0:X})", sectorNumber));
                Arrays.Fill(buffer, offset, offset + ISectorDevice_Fields.sectorLength, (sbyte)0);
            }
            else
            {
                sectorDevice.readSector(sectorNumber, buffer, offset);
                fileAccess.seek(((long)ISectorDevice_Fields.sectorLength) * nextFreeBufferedSectorNumber);
                fileAccess.write(buffer, offset, ISectorDevice_Fields.sectorLength);
                toc[sectorNumber] = nextFreeBufferedSectorNumber;

                nextFreeBufferedSectorNumber++;
                tocDirty = true;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Read one sector into a byte array
        /// </summary>
        /// <param name="sectorNumber"> - the sector number to be read </param>
        /// <param name="buffer"> - the byte array where to write </param>
        /// <param name="offset"> - offset into the byte array where to start writing </param>
        /// <exception cref="IOException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void readSector(int sectorNumber, byte[] buffer, int offset) throws java.io.IOException
        public virtual void readSector(int sectorNumber, sbyte[] buffer, int offset)
        {
            if (sectorNumber < 0 || sectorNumber >= numSectors)
            {
                Arrays.Fill(buffer, offset, offset + sectorLength, (sbyte)0);
                Emulator.Console.WriteLine(string.Format("Sector number {0:D} out of ISO (numSectors={1:D})", sectorNumber, numSectors));
                return;
            }

            sectorDevice.readSector(sectorNumber, buffer, offset);
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void readSector(int sectorNumber, byte[] buffer, int offset) throws java.io.IOException
        public virtual void readSector(int sectorNumber, sbyte[] buffer, int offset)
        {
            int mappedSectorNumber = mapSector(sectorNumber);

            if (mappedSectorNumber >= 0)
            {
                sectorDevice.readSector(mappedSectorNumber, buffer, offset);
            }
            else
            {
                Arrays.Fill(buffer, offset, offset + ISectorDevice_Fields.sectorLength, (sbyte)0);
            }
        }