/// <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()
{
ZipFileStream = _stream,
Access = _access,
leaveOpen = _leaveOpen
};
if (zip.ReadFileInfo())
{
return(zip);
}
if (!_leaveOpen)
{
zip.Close();
}
throw new System.IO.InvalidDataException();
}