当前位置: 首页>>代码示例>>C#>>正文


C# ZipStorer.ReadFileInfo方法代码示例

本文整理汇总了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();
        }
开发者ID:aswartzbaugh,项目名称:biketour,代码行数:21,代码来源:ZipStorer.cs

示例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();
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:18,代码来源:ZipStorer.cs

示例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();
        }
开发者ID:Rameshnathan,项目名称:selenium,代码行数:18,代码来源:ZipStorer.cs

示例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();
        }
开发者ID:mikoskinen,项目名称:SubtitleProvider,代码行数:18,代码来源:ZipStorer.cs


注:本文中的System.IO.Compression.ZipStorer.ReadFileInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。