Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 /* ----------------------------------------------------------------- */
 ///
 /// ArchiveWriter
 ///
 /// <summary>
 /// Initializes a new instance of the ArchiveWriter class with the
 /// specified arguments.
 /// </summary>
 ///
 /// <param name="format">Archive format.</param>
 /// <param name="io">I/O handler.</param>
 ///
 /* ----------------------------------------------------------------- */
 public ArchiveWriter(Format format, IO io)
 {
     _core  = new SevenZipLibrary();
     Format = format;
     IO     = io;
 }