protected override void GetItem(string path) { if (PathIsDrive(path)) { WriteItemObject(PSDriveInfo, path, true); } try { string parsedPath = ParsePath(path, false); ZipFileArchive.ZipFileInfo fileInfo = GetPathCaseInsensitive(parsedPath); ZipFileItem zi = new ZipFileItem(GetFileOrDirname(fileInfo.Name), fileInfo.LastModFileDateTime, fileInfo.FolderFlag ? "Directory" : "File"); WriteItemObject(zi, fixRootPath(fileInfo.Name).Replace("/", "\\"), fileInfo.FolderFlag); } catch { } try { string parsedPath = ParsePath(path, true); ZipFileArchive.ZipFileInfo fileInfo = GetPathCaseInsensitive(parsedPath); ZipFileItem zi = new ZipFileItem(GetFileOrDirname(fileInfo.Name), fileInfo.LastModFileDateTime, fileInfo.FolderFlag ? "Directory" : "File"); WriteItemObject(zi, fixRootPath(fileInfo.Name).Replace("/", "\\"), fileInfo.FolderFlag); } catch { } }
protected override void GetChildItems(string path, bool recurse) { path = ParsePath(path, true); foreach (ZipFileArchive.ZipFileInfo zipEntry in ZipDrive.Archive.Files) { if (!recurse && !ItemIsInDirectory(path, zipEntry.Name)) { continue; } if (path == "/" || zipEntry.Name.StartsWith(path, StringComparison.InvariantCultureIgnoreCase)) { string type = "File"; if (zipEntry.FolderFlag) { type = "Directory"; } ZipFileItem zi = new ZipFileItem(GetFileOrDirname(zipEntry.Name), zipEntry.LastModFileDateTime, type); WriteItemObject(zi, fixRootPath(zipEntry.Name).Replace("/", "\\"), zipEntry.FolderFlag); } } }