Example #1
0
 /// <summary>
 /// Disposing
 /// </summary>
 /// <param name="isDisposing">Is Disposing</param>
 protected virtual void Dispose( bool isDisposing )
 {
     if ( isDisposing )
     {
         xUnzip.Close ();
         xUnzip = null;
     }
 }
Example #2
0
        /// <summary>
        /// Constructor of Zip File System
        /// </summary>
        /// <param name="stream">ZIP stream</param>
        public ZipFileSystem( Stream stream )
        {
            xUnzip = new XUnzip ();
            xUnzip.Open ( stream );

            indexInfo = new Dictionary<string, int> ();

            List<string> files = new List<string> ();
            List<string> dirs = new List<string> ();
            int index = 0;
            foreach ( XUnzipFileInfo info in xUnzip.FileInfo )
            {
                indexInfo.Add ( info.FileName, index++ );
                files.Add ( info.FileName );
                string [] temp = info.FileName.Split ( '/' );
                if ( temp.Length == 1 )
                    temp = info.FileName.Split ( '\\' );
                temp [ temp.Length - 1 ] = "";
                string path = string.Join ( "/", temp );
                if ( dirs.Contains ( path ) )
                    continue;
                dirs.Add ( path );
            }
            filenameCache = files.ToArray ();
            dirnameCache = dirs.ToArray ();
        }