本文整理汇总了C#中System.IO.Compression.ZipStorer.ReadFileInfo方法的典型用法代码示例。如果您正苦于以下问题:C# ZipStorer.ReadFileInfo方法的具体用法?C# ZipStorer.ReadFileInfo怎么用?C# ZipStorer.ReadFileInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.Compression.ZipStorer
的用法示例。
在下文中一共展示了ZipStorer.ReadFileInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Open
/// <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>
/// <returns>A valid ZipStorer object</returns>
public static ZipStorer Open(Stream _stream, FileAccess _access)
{
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;
if (zip.ReadFileInfo())
return zip;
throw new System.IO.InvalidDataException();
}
示例2: Open
/// <summary>
/// Method to open an existing storage from stream
/// </summary>
/// <param name="stream">Already opened stream with zip contents</param>
/// <param name="fileFileAccess">File access mode for stream operations</param>
/// <returns>A valid ZipStorer object</returns>
public static ZipStorer Open( [NotNull] Stream stream, FileAccess fileFileAccess ) {
if( stream == null ) throw new ArgumentNullException( "stream" );
if( !stream.CanSeek && fileFileAccess != FileAccess.Read )
throw new InvalidOperationException( "Stream cannot seek" );
ZipStorer zip = new ZipStorer { zipFileStream = stream, access = fileFileAccess };
if( zip.ReadFileInfo() )
return zip;
throw new InvalidDataException();
}
示例3: Open
public static ZipStorer Open(Stream stream, FileAccess access)
{
if (!stream.CanSeek && access != FileAccess.Read)
{
throw new InvalidOperationException("Stream cannot seek");
}
ZipStorer zip = new ZipStorer();
zip.zipFileStream = stream;
zip.access = access;
if (zip.ReadFileInfo())
{
return zip;
}
throw new System.IO.InvalidDataException();
}
示例4: Open
/// <summary>
/// Method to open an existing storage
/// </summary>
/// <param name="_filename">Full path of Zip file to open</param>
/// <param name="_access">File access mode as used in FileStream constructor</param>
/// <returns></returns>
public static ZipStorer Open(string _filename, FileAccess _access)
{
ZipStorer zip = new ZipStorer();
zip.FileName = _filename;
zip.ZipFileStream = new FileStream(_filename, FileMode.Open, _access == FileAccess.Read ? FileAccess.Read : FileAccess.ReadWrite);
zip.Access = _access;
if (zip.ReadFileInfo())
return zip;
throw new System.IO.InvalidDataException();
}