/// <summary>
        /// General initialization function.
        /// </summary>
        /// <param name="stream">The stream to read the archive from.</param>
        private void Init(Stream stream)
        {
            ValidateStream(stream);
            bool isExecutable = false;

            if ((int)_format == -1)
            {
                _format = FileChecker.CheckSignature(stream, out _offset, out isExecutable);
            }
            PreserveDirectoryStructure = true;
            SevenZipLibraryManager.LoadLibrary(this, _format);
            try
            {
                _inStream   = new ArchiveEmulationStreamProxy(stream, _offset);
                _packedSize = stream.Length;
                _archive    = SevenZipLibraryManager.InArchive(_format, this);
            }
            catch (SevenZipLibraryException)
            {
                SevenZipLibraryManager.FreeLibrary(this, _format);
                throw;
            }
            if (isExecutable && _format != InArchiveFormat.PE)
            {
                if (!Check())
                {
                    CommonDispose();
                    _format = InArchiveFormat.PE;
                    try
                    {
                        _inStream   = new ArchiveEmulationStreamProxy(stream, _offset);
                        _packedSize = stream.Length;
                        _archive    = SevenZipLibraryManager.InArchive(_format, this);
                    }
                    catch (SevenZipLibraryException)
                    {
                        SevenZipLibraryManager.FreeLibrary(this, _format);
                        throw;
                    }
                }
            }
        }
        /// <summary>
        /// General initialization function.
        /// </summary>
        /// <param name="archiveFullName">The archive file name.</param>
        private void Init(string archiveFullName)
        {
            _fileName = archiveFullName;
            bool isExecutable = false;

            if ((int)_format == -1)
            {
                _format = FileChecker.CheckSignature(archiveFullName, out _offset, out isExecutable);
            }
            PreserveDirectoryStructure = true;
            SevenZipLibraryManager.LoadLibrary(this, _format);
            try
            {
                _archive = SevenZipLibraryManager.InArchive(_format, this);
            }
            catch (SevenZipLibraryException)
            {
                SevenZipLibraryManager.FreeLibrary(this, _format);
                throw;
            }
            if (isExecutable && _format != InArchiveFormat.PE)
            {
                if (!Check())
                {
                    CommonDispose();
                    _format = InArchiveFormat.PE;
                    SevenZipLibraryManager.LoadLibrary(this, _format);
                    try
                    {
                        _archive = SevenZipLibraryManager.InArchive(_format, this);
                    }
                    catch (SevenZipLibraryException)
                    {
                        SevenZipLibraryManager.FreeLibrary(this, _format);
                        throw;
                    }
                }
            }
        }