private DosTimeToDateTime ( uint _dt ) : System.DateTime | ||
_dt | uint | |
리턴 | System.DateTime |
public List <ZipStorer.ZipFileEntry> ReadCentralDirectory() { if (this.centralDirectoryImage == null) { throw new InvalidOperationException("Central directory currently does not exist"); } List <ZipStorer.ZipFileEntry> list = new List <ZipStorer.ZipFileEntry>(); ushort num2; ushort num3; ushort num4; for (int i = 0; i < this.centralDirectoryImage.Length; i += (int)(46 + num2 + num3 + num4)) { uint num = BitConverter.ToUInt32(this.centralDirectoryImage, i); if (num != 33639248u) { break; } bool flag = (BitConverter.ToUInt16(this.centralDirectoryImage, i + 8) & 2048) != 0; ushort method = BitConverter.ToUInt16(this.centralDirectoryImage, i + 10); uint dosTime = BitConverter.ToUInt32(this.centralDirectoryImage, i + 12); uint crc = BitConverter.ToUInt32(this.centralDirectoryImage, i + 16); uint compressedSize = BitConverter.ToUInt32(this.centralDirectoryImage, i + 20); uint fileSize = BitConverter.ToUInt32(this.centralDirectoryImage, i + 24); num2 = BitConverter.ToUInt16(this.centralDirectoryImage, i + 28); num3 = BitConverter.ToUInt16(this.centralDirectoryImage, i + 30); num4 = BitConverter.ToUInt16(this.centralDirectoryImage, i + 32); uint headerOffset = BitConverter.ToUInt32(this.centralDirectoryImage, i + 42); uint headerSize = (uint)(46 + num2 + num3 + num4); Encoding encoding = flag ? Encoding.UTF8 : ZipStorer.defaultEncoding; ZipStorer.ZipFileEntry item = default(ZipStorer.ZipFileEntry); item.Method = (ZipStorer.CompressionMethod)method; item.FilenameInZip = encoding.GetString(this.centralDirectoryImage, i + 46, (int)num2); item.FileOffset = this.GetFileOffset(headerOffset); item.FileSize = fileSize; item.CompressedSize = compressedSize; item.HeaderOffset = headerOffset; item.HeaderSize = headerSize; item.Crc32 = crc; item.ModifyTime = ZipStorer.DosTimeToDateTime(dosTime); if (num4 > 0) { item.Comment = encoding.GetString(this.centralDirectoryImage, i + 46 + (int)num2 + (int)num3, (int)num4); } list.Add(item); } return(list); }