예제 #1
0
            public void WriteZipDataHeader(ref ZipDataHeader h, bool writeSizes)
            {
                h.Signature = Signature;
                h.NeedVer   = Version;
                h.CompType  = 0;
                h.FileTime  = Util.DateTimeToDosTime(this.DateTime);
                h.FileDate  = Util.DateTimeToDosDate(this.DateTime);
                h.Option    = 8;

                if (writeSizes == false)
                {
                    h.CompSize = h.UncompSize = 0;
                    h.Crc32    = 0;

                    if (this.Compress)
                    {
                        h.NeedVer  = VersionWithCompress;
                        h.CompType = 8;
                    }
                }
                else
                {
                    h.CompSize = h.UncompSize = (uint)this.Size;
                    if (this.Compress)
                    {
                        h.CompSize = (uint)this.CompressSize;
                        h.CompType = 8;
                    }
                    h.Crc32 = this.Crc32;
                }

                h.FileNameLen = (ushort)this.Encoding.GetByteCount(this.Name);
                h.ExtraLen    = 0;
            }