Dispose() public méthode

public Dispose ( ) : void
Résultat void
Exemple #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();
        }