Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private byte[] readFile(String fileName) throws java.io.IOException
        private sbyte[] readFile(string fileName)
        {
            if (!hasFile(fileName))
            {
                return(null);
            }

            UmdIsoFile file   = getFile(fileName);
            int        Length = (int)file.Length();

            sbyte[] buffer = new sbyte[Length];
            int     read   = file.read(buffer);

            if (read < 0)
            {
                return(null);
            }

            // Read less than expected?
            if (read < Length)
            {
                // Shrink the buffer to the read size
                sbyte[] newBuffer = new sbyte[read];
                Array.Copy(buffer, 0, newBuffer, 0, read);
                buffer = newBuffer;
            }

            return(buffer);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private bool hasIsoHeader() throws java.io.IOException
        private bool hasIsoHeader()
        {
            if (numSectors <= 0)
            {
                return(false);
            }

            UmdIsoFile f = new UmdIsoFile(this, startSector, sectorLength, null, null);

            sbyte[] header = new sbyte[6];
            int     Length = f.read(header);

            f.Dispose();
            if (Length < header.Length)
            {
                return(false);
            }

            if (header[1] != (sbyte)'C' || header[2] != (sbyte)'D' || header[3] != (sbyte)'0' || header[4] != (sbyte)'0' || header[5] != (sbyte)'1')
            {
                return(false);
            }

            hasJolietExtension_Renamed = false;
            f      = new UmdIsoFile(this, startSectorJoliet, sectorLength, null, null);
            Length = f.read(header);
            f.Dispose();
            if (Length == header.Length)
            {
                if (header[0] == 2 && header[1] == (sbyte)'C' && header[2] == (sbyte)'D' && header[3] == (sbyte)'0' && header[4] == (sbyte)'0' && header[5] == (sbyte)'1')
                {
                    hasJolietExtension_Renamed = true;
                }
            }

            return(true);
        }