コード例 #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);
        }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public UmdIsoFile duplicate() throws java.io.IOException
        public virtual UmdIsoFile duplicate()
        {
            UmdIsoFile umdIsoFile = new UmdIsoFile(internalReader, startSectorNumber, maxOffset, timestamp, name);

            umdIsoFile.seek(currentOffset);

            return(umdIsoFile);
        }
コード例 #3
0
        public virtual bool hasFile(string filePath)
        {
            try
            {
                UmdIsoFile umdIsoFile = getFile(filePath);
                if (umdIsoFile != null)
                {
                    umdIsoFile.Dispose();
                    return(true);
                }
            }
            catch (FileNotFoundException)
            {
            }
            catch (IOException)
            {
            }

            return(false);
        }
コード例 #4
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);
        }