ReadFileInfo() private method

private ReadFileInfo ( ) : bool
return bool
Ejemplo n.º 1
0
        /// <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();
        }
        /// <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");
            }

            var zip = new ZipStorer();

            //zip.FileName = _filename;
            zip._zipFileStream = stream;
            zip._access        = access;

            if (zip.ReadFileInfo())
            {
                return(zip);
            }

            throw new InvalidDataException();
        }
Ejemplo n.º 3
0
        /// <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();
            return(null); // TODO Unity had an issue with the above line so returning null
        }
Ejemplo n.º 4
0
        /// <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();
        }
Ejemplo n.º 5
0
        /// <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, Boolean _leaveOpen = false)
        {
            if (!_stream.CanSeek && _access != FileAccess.Read)
            {
                throw new InvalidOperationException("Stream cannot seek");
            }

            ZipStorer zip = new ZipStorer
            {
                ZipFileStream = _stream,
                Access        = _access,
                leaveOpen     = _leaveOpen
            };

            //zip.FileName = _filename;

            if (zip.ReadFileInfo())
            {
                return(zip);
            }

            throw new InvalidDataException();
        }
Ejemplo n.º 6
0
        /// <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();
        }
Ejemplo n.º 7
0
        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();
        }
Ejemplo n.º 8
0
        /// <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();
        }
Ejemplo n.º 9
0
        /// <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();
        }