DateTimeToDosTime() private method

private DateTimeToDosTime ( System.DateTime _dt ) : uint
_dt System.DateTime
return uint
示例#1
0
        private void WriteCentralDirRecord(ZipStorer.ZipFileEntry zipFileEntry)
        {
            Encoding encoding = zipFileEntry.EncodeUTF8 ? Encoding.UTF8 : ZipStorer.defaultEncoding;

            byte[] bytes  = encoding.GetBytes(zipFileEntry.FilenameInZip);
            byte[] bytes2 = encoding.GetBytes(zipFileEntry.Comment);
            this.zipFileStream.Write(new byte[]
            {
                80,
                75,
                1,
                2,
                23,
                11,
                20,
                0
            }, 0, 8);
            this.zipFileStream.Write(BitConverter.GetBytes(zipFileEntry.EncodeUTF8 ? 2048 : 0), 0, 2);
            this.zipFileStream.Write(BitConverter.GetBytes((ushort)zipFileEntry.Method), 0, 2);
            this.zipFileStream.Write(BitConverter.GetBytes(ZipStorer.DateTimeToDosTime(zipFileEntry.ModifyTime)), 0, 4);
            this.zipFileStream.Write(BitConverter.GetBytes(zipFileEntry.Crc32), 0, 4);
            this.zipFileStream.Write(BitConverter.GetBytes(zipFileEntry.CompressedSize), 0, 4);
            this.zipFileStream.Write(BitConverter.GetBytes(zipFileEntry.FileSize), 0, 4);
            this.zipFileStream.Write(BitConverter.GetBytes((ushort)bytes.Length), 0, 2);
            this.zipFileStream.Write(BitConverter.GetBytes(0), 0, 2);
            this.zipFileStream.Write(BitConverter.GetBytes((ushort)bytes2.Length), 0, 2);
            this.zipFileStream.Write(BitConverter.GetBytes(0), 0, 2);
            this.zipFileStream.Write(BitConverter.GetBytes(0), 0, 2);
            this.zipFileStream.Write(BitConverter.GetBytes(0), 0, 2);
            this.zipFileStream.Write(BitConverter.GetBytes(33024), 0, 2);
            this.zipFileStream.Write(BitConverter.GetBytes(zipFileEntry.HeaderOffset), 0, 4);
            this.zipFileStream.Write(bytes, 0, bytes.Length);
            this.zipFileStream.Write(bytes2, 0, bytes2.Length);
        }
示例#2
0
        private void WriteLocalHeader(ref ZipStorer.ZipFileEntry zipFileEntry)
        {
            long     position = this.zipFileStream.Position;
            Encoding encoding = zipFileEntry.EncodeUTF8 ? Encoding.UTF8 : ZipStorer.defaultEncoding;

            byte[] bytes = encoding.GetBytes(zipFileEntry.FilenameInZip);
            this.zipFileStream.Write(new byte[]
            {
                80,
                75,
                3,
                4,
                20,
                0
            }, 0, 6);
            this.zipFileStream.Write(BitConverter.GetBytes(zipFileEntry.EncodeUTF8 ? 2048 : 0), 0, 2);
            this.zipFileStream.Write(BitConverter.GetBytes((ushort)zipFileEntry.Method), 0, 2);
            this.zipFileStream.Write(BitConverter.GetBytes(ZipStorer.DateTimeToDosTime(zipFileEntry.ModifyTime)), 0, 4);
            Stream arg_C2_0 = this.zipFileStream;

            byte[] buffer = new byte[12];
            arg_C2_0.Write(buffer, 0, 12);
            this.zipFileStream.Write(BitConverter.GetBytes((ushort)bytes.Length), 0, 2);
            this.zipFileStream.Write(BitConverter.GetBytes(0), 0, 2);
            this.zipFileStream.Write(bytes, 0, bytes.Length);
            zipFileEntry.HeaderSize = (uint)(this.zipFileStream.Position - position);
        }