//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 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); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private pspsharp.filesystems.umdiso.iso9660.Iso9660File getFileEntry(String filePath) throws java.io.IOException, java.io.FileNotFoundException private Iso9660File getFileEntry(string filePath) { Iso9660File info; info = fileCache[filePath]; if (info != null) { return(info); } int parentDirectoryIndex = filePath.LastIndexOf('/'); if (parentDirectoryIndex >= 0) { string parentDirectory = filePath.Substring(0, parentDirectoryIndex); Iso9660Directory dir = dirCache[parentDirectory]; if (dir != null) { int index = dir.getFileIndex(filePath.Substring(parentDirectoryIndex + 1)); info = dir.getEntryByIndex(index); if (info != null) { fileCache[filePath] = info; return(info); } } } Iso9660Directory dir = new Iso9660Handler(this); string[] path = filePath.Split("[\\/]", true); // First convert the path to a canonical path by removing all the // occurrences of "." and "..". int pathLength = path.Length; for (int i = 0; i < pathLength;) { if (path[i].Equals(".")) { // Remove "." pathLength = removePath(path, i, pathLength); } else if (path[i].Equals("..")) { // Remove ".." and its parent pathLength = removePath(path, i, pathLength); pathLength = removePath(path, i - 1, pathLength); } else { i++; } } // walk through the canonical path for (int i = 0; i < pathLength;) { int index = dir.getFileIndex(path[i]); info = dir.getEntryByIndex(index); if (isDirectory(info)) { dir = new Iso9660Directory(this, info.LBA, info.Size); StringBuilder dirPath = new StringBuilder(path[0]); for (int j = 1; j <= i; j++) { dirPath.Append("/").Append(path[j]); } dirCache[dirPath.ToString()] = dir; } i++; } if (info != null) { fileCache[filePath] = info; } return(info); }