protected override PSDriveInfo NewDrive(PSDriveInfo drive) { WriteWarning(""); WriteWarning(" This provider is still experimental and have not yet been fully tested!"); WriteWarning(""); WriteWarning(" Not implemented (will be): COPY, MOVE, RENAME, GETPARENTPATH, EXPANDPATH, CONVERTPATH"); WriteWarning(" Not implemented (will not be): MAKEPATH"); WriteWarning(" Limitation: The zip-file you are mounting must be in your current directory"); WriteWarning(""); try { ZipFileDriveInfo zipDriveInfo = new ZipFileDriveInfo(drive); zipDriveInfo.Archive = ZipFileArchive.OpenFromFile(drive.Root, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite, System.IO.FileShare.None, false); return(zipDriveInfo); } catch (Exception ex) { WriteError(new ErrorRecord(ex.InnerException, "100", ErrorCategory.DeviceError, null)); return(null); } }
public static ZipFileArchive OpenFromStream(Stream stream) { return(ZipFileArchive.OpenFromStream(stream, FileMode.OpenOrCreate, FileAccess.ReadWrite, false)); }
public static ZipFileArchive OpenFromFile(string path) { return(ZipFileArchive.OpenFromFile(path, FileMode.Open, FileAccess.Read, FileShare.Read, false)); }