ICSharpCode.SharpZipLib.Zip.ZipFile.Dispose C# (CSharp) Метод

Dispose() публичный Метод

public Dispose ( ) : void
Результат void
        public void Dispose(){
            Dispose(true);
        }

Same methods

ZipFile::Dispose ( bool disposing ) : void

Usage Example

Пример #1
0
        /// <summary>
        /// Extracts the specified zip file stream.
        /// </summary>
        /// <param name="fileStream">The zip file stream.</param>
        /// <returns></returns>
        public bool Extract(Stream fileStream) {
            if (null==fileStream)
                return false;

            CleanFromTemp(false);

            NewTempPath();

            _isValid=true;

            ZipFile zipFile=null;

            try {
                zipFile=new ZipFile(fileStream);

                IEnumerator enumerator=zipFile.GetEnumerator();

                while (enumerator.MoveNext()) {
                    var entry=(ZipEntry)enumerator.Current;

                    ExtractZipEntry(zipFile, entry);
                }
            } catch (Exception ex) {
                _isValid=false;
                _exceptionMessage=ex.Message;

                CleanFromTemp(true);
                //true tells CleanFromTemp not to raise an IO Exception if this operation fails. If it did then the real error here would be masked
            } finally {
                fileStream.Dispose();

                if (null!=zipFile)
                    zipFile.Dispose();
            }

            return _isValid && CheckFolderTree();
        }