//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public Iso9660Handler(pspsharp.filesystems.umdiso.UmdIsoReader r) throws java.io.IOException public Iso9660Handler(UmdIsoReader r) : base(r, 0, 0) { sbyte[] sector; if (r.hasJolietExtension()) { sector = r.readSector(UmdIsoReader.startSectorJoliet); } else { sector = r.readSector(UmdIsoReader.startSector); } System.IO.MemoryStream byteStream = new System.IO.MemoryStream(sector); byteStream.skip(157); // reach rootDirTocHeader sbyte[] b = new sbyte[38]; byteStream.Read(b, 0, b.Length); Iso9660File rootDirEntry = new Iso9660File(b, b.Length, r.hasJolietExtension()); int rootLBA = rootDirEntry.LBA; long rootSize = rootDirEntry.Size; internalDir = new Iso9660Directory(r, rootLBA, rootSize); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public int getFileProperties(String filePath) throws java.io.IOException, java.io.FileNotFoundException public virtual int getFileProperties(string filePath) { if (filePath.Length == 0) { return(2); } Iso9660File info = getFileEntry(filePath); if (info == null) { throw new FileNotFoundException("File '" + filePath + "' not found."); } return(info.Properties); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private String getFileNameRecursive(int fileStartSector, String path, String[] files) throws java.io.FileNotFoundException, java.io.IOException private string getFileNameRecursive(int fileStartSector, string path, string[] files) { foreach (string file in files) { string filePath = path + "/" + file; Iso9660File info = null; if (path.Length == 0) { filePath = file; } else { info = getFileEntry(filePath); if (info != null) { if (info.LBA == fileStartSector) { return(info.FileName); } } } if ((info == null || isDirectory(info)) && !file.Equals(".") && !file.Equals("\x0001")) { try { string[] childFiles = listDirectory(filePath); string fileName = getFileNameRecursive(fileStartSector, filePath, childFiles); if (!string.ReferenceEquals(fileName, null)) { return(fileName); } } catch (FileNotFoundException) { // Continue } } } return(null); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public String[] listDirectory(String filePath) throws java.io.IOException, java.io.FileNotFoundException public virtual string[] listDirectory(string filePath) { Iso9660Directory dir = null; if (filePath.Length == 0) { dir = new Iso9660Handler(this); } else { Iso9660File info = getFileEntry(filePath); if (info != null && isDirectory(info)) { dir = new Iso9660Directory(this, info.LBA, info.Size); } } if (dir == null) { throw new FileNotFoundException("File '" + filePath + "' not found or not a directory."); } return(dir.FileList); }
public virtual bool isDirectory(Iso9660File file) { return((file.Properties & 2) == 2); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public UmdIsoFile getFile(String filePath) throws java.io.IOException, java.io.FileNotFoundException public virtual UmdIsoFile getFile(string filePath) { if (numSectors == 0) { throw new FileNotFoundException(filePath); } int fileStart; long fileLength; DateTime timestamp; string fileName = null; if (!string.ReferenceEquals(filePath, null) && filePath.StartsWith("sce_lbn", StringComparison.Ordinal)) { // // Direct sector access on UMD is using the following file name syntax: // sce_lbnSSSS_sizeLLLL // where SSSS is the index of the first sector (in hexadecimal) // LLLL is the Length in bytes (in hexadecimal) // The prefix "0x" before each hexadecimal value is optional. // // E.g. // disc0:/sce_lbn0x5fa0_size0x1428 // disc0:/sce_lbn7050_sizeee850 // // Remark: SSSS and LLLL can be followed by any non-hex characters. // These additional characters are simply ignored. // filePath = filePath.Substring(7); int sep = filePath.IndexOf("_size", StringComparison.Ordinal); fileStart = (int)Utilities.parseHexLong(filePath.Substring(0, sep), true); fileLength = Utilities.parseHexLong(filePath.Substring(sep + 5), true); timestamp = DateTime.Now; fileName = null; if (fileStart < 0 || fileStart >= numSectors) { throw new IOException("File '" + filePath + "': Invalid Start Sector"); } } else if (!string.ReferenceEquals(filePath, null) && filePath.Length == 0) { fileStart = 0; fileLength = ((long)numSectors) * sectorLength; timestamp = DateTime.Now; } else { Iso9660File info = getFileEntry(filePath); if (info != null && isDirectory(info)) { info = null; } if (info == null) { throw new FileNotFoundException("File '" + filePath + "' not found or not a file."); } fileStart = info.LBA; fileLength = info.Size; timestamp = info.Timestamp; fileName = info.FileName; } return(new UmdIsoFile(this, fileStart, fileLength, timestamp, fileName)); }