コード例 #1
0
        /* ----------------------------------------------------------------- */
        ///
        /// ArchiveReader
        ///
        /// <summary>
        /// Initializes a new instance of the ArchiveReader class with
        /// the specified arguments.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private ArchiveReader(Format format, string src, PasswordQuery password, IO io)
        {
            if (format == Format.Unknown)
            {
                throw new UnknownFormatException();
            }

            var asr = new ArchiveStreamReader(io.OpenRead(src));

            _core     = new SevenZipLibrary();
            _password = password;
            _open     = new ArchiveOpenCallback(src, asr, io)
            {
                Password = _password
            };
            _archive = _core.GetInArchive(format);
            _archive.Open(asr, IntPtr.Zero, _open);

            IO     = io;
            Format = format;
            Source = src;
            Items  = new ReadOnlyArchiveList(_archive, src, _password, io);
        }
コード例 #2
0
        /* ----------------------------------------------------------------- */
        ///
        /// ArchiveReader
        ///
        /// <summary>
        /// Initializes a new instance of the ArchiveReader class with
        /// the specified arguments.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private ArchiveReader(Format format, string src, PasswordQuery query, IO io)
        {
            if (format == Format.Unknown)
            {
                throw new NotSupportedException();
            }

            var asr = new ArchiveStreamReader(io.OpenRead(src));

            _core     = new SevenZipLibrary();
            _query    = query;
            _callback = new ArchiveOpenCallback(src, asr, io)
            {
                Password = _query
            };
            _module = _core.GetInArchive(format);
            _module.Open(asr, IntPtr.Zero, _callback);

            IO     = io;
            Format = format;
            Source = src;
            Items  = new ReadOnlyArchiveList(_module, format, src, _query, io);
        }