コード例 #1
0
 /// <summary>
 /// Unserialize zip 
 /// </summary>
 /// <param name="input">input stream</param>
 /// <returns>operation outcome</returns>
 public bool UnSerialize()
 {
     try
     {
         /// Start at the beginning of the EOF
         this.m_zipReader.Seek(-0x36, SeekOrigin.End);
         /// Get central directory info from the eof header
         CentralDirectoryRecordEOF eof = new CentralDirectoryRecordEOF();
         eof.UnSerialize(this.m_zipReader);
         this.m_lZipDirectory = new List<ZipFile>(eof.TotalCDirEntries);
         ///Seek to the beginning of the zip to read the preload local file header
         //this.m_zipReader.Seek(0, SeekOrigin.Begin);
         //LocalFileHeader preloadHdr = new LocalFileHeader();
         //preloadHdr.UnSerialize(this.m_zipReader);
         //m_preloadSection = new PreloadSection(new MemoryStream(preloadHdr.FileData));
         /// Read preload
         //Thread preloadWorker = new Thread(new ThreadStart(m_preloadSection.UnSerialize));
         //preloadWorker.Start();
         ///Parse Central Directory
         this.m_zipReader.Seek((int)eof.StartOfCDir, SeekOrigin.Begin);
         ZipFile file;
         CentralDirectoryEntry entry;
         for (int i = 1; i < eof.TotalCDirEntries; i++)
         {
             entry = new CentralDirectoryEntry(this.m_zipReader);
             file = new ZipFile(entry, i);
             this.m_lZipDirectory.Add(file);
         }
         GetGame();
         return true;
     }
     catch {  return false; }
 }