Beispiel #1
0
        public void Finish()
        {
            long posStart = fifo.TotalWriteSize;

            foreach (File f in this.fileList)
            {
                ZipDirHeader d = new ZipDirHeader();
                d.Signature = 0x02014B50;                // ZipPacker.Signature;
                d.MadeVer   = Version;
                ZipDataHeader dh = new ZipDataHeader();
                f.WriteZipDataHeader(ref dh, true);
                if (f.Compress)
                {
                    dh.CompType = 8;
                    dh.CompSize = (uint)f.CompressSize;
                    dh.NeedVer  = ZipPacker.VersionWithCompress;
                }
                d.NeedVer     = dh.NeedVer;
                d.Option      = dh.Option;
                d.CompType    = dh.CompType;
                d.FileTime    = dh.FileTime;
                d.FileDate    = dh.FileDate;
                d.Crc32       = dh.Crc32;
                d.CompSize    = dh.CompSize;
                d.UncompSize  = dh.UncompSize;
                d.FileNameLen = dh.FileNameLen;
                d.ExtraLen    = dh.ExtraLen;
                d.CommentLen  = 0;
                d.DiskNum     = 0;
                d.InAttr      = 0;
                d.OutAttr     = (ushort)f.Attributes;
                d.HeaderPos   = f.HeaderPos;

                fifo.Write(Util.StructToByte(d));
                fifo.Write(this.Encoding.GetBytes(f.Name));
            }
            long posEnd = fifo.TotalWriteSize;

            ZipEndHeader e = new ZipEndHeader();

            e.Signature    = ZipPacker.SignatureEnd;
            e.DiskNum      = e.StartDiskNum = 0;
            e.DiskDirEntry = e.DirEntry = (ushort)this.fileList.Count;
            e.DirSize      = (uint)(posEnd - posStart);
            e.StartPos     = (uint)posStart;
            e.CommentLen   = 0;
            fifo.Write(Util.StructToByte(e));
        }
Beispiel #2
0
        public void Finish()
        {
            long posStart = fifo.TotalWriteSize;
            foreach (File f in this.fileList)
            {
                ZipDirHeader d = new ZipDirHeader();
                d.Signature = 0x02014B50;// ZipPacker.Signature;
                d.MadeVer = Version;
                ZipDataHeader dh = new ZipDataHeader();
                f.WriteZipDataHeader(ref dh, true);
                if (f.Compress)
                {
                    dh.CompType = 8;
                    dh.CompSize = (uint)f.CompressSize;
                    dh.NeedVer = ZipPacker.VersionWithCompress;
                }
                d.NeedVer = dh.NeedVer;
                d.Option = dh.Option;
                d.CompType = dh.CompType;
                d.FileTime = dh.FileTime;
                d.FileDate = dh.FileDate;
                d.Crc32 = dh.Crc32;
                d.CompSize = dh.CompSize;
                d.UncompSize = dh.UncompSize;
                d.FileNameLen = dh.FileNameLen;
                d.ExtraLen = dh.ExtraLen;
                d.CommentLen = 0;
                d.DiskNum = 0;
                d.InAttr = 0;
                d.OutAttr = (ushort)f.Attributes;
                d.HeaderPos = f.HeaderPos;

                fifo.Write(Util.StructToByte(d));
                fifo.Write(this.Encoding.GetBytes(f.Name));
            }
            long posEnd = fifo.TotalWriteSize;

            ZipEndHeader e = new ZipEndHeader();
            e.Signature = ZipPacker.SignatureEnd;
            e.DiskNum = e.StartDiskNum = 0;
            e.DiskDirEntry = e.DirEntry = (ushort)this.fileList.Count;
            e.DirSize = (uint)(posEnd - posStart);
            e.StartPos = (uint)posStart;
            e.CommentLen = 0;
            fifo.Write(Util.StructToByte(e));
        }