/// <summary> /// Method to open an existing storage from stream /// </summary> /// <param name="_stream">Already opened stream with zip contents</param> /// <param name="_access">File access mode for stream operations</param> /// <param name="_leaveOpen">true to leave the stream open after the ZipStorer object is disposed; otherwise, false (default).</param> /// <returns>A valid ZipStorer object</returns> public static ZipStorer Open(Stream _stream, FileAccess _access, bool _leaveOpen = false) { if (!_stream.CanSeek && _access != FileAccess.Read) { throw new InvalidOperationException("Stream cannot seek"); } ZipStorer zip = new ZipStorer(); //zip.FileName = _filename; zip.ZipFileStream = _stream; zip.Access = _access; zip.leaveOpen = _leaveOpen; if (zip.ReadFileInfo()) { return(zip); } throw new IOException(); }