Пример #1
0
        internal static DataDescriptor FromFileHeader(FileHeaderBase fileHeader)
        {
            DataDescriptor dataDescriptor1 = new DataDescriptor();

            dataDescriptor1.CompressedSize   = fileHeader.CompressedSize;
            dataDescriptor1.Crc              = fileHeader.Crc;
            dataDescriptor1.UncompressedSize = fileHeader.UncompressedSize;
            DataDescriptor  dataDescriptor2 = dataDescriptor1;
            Zip64ExtraField zip64ExtraField = (Zip64ExtraField)null;

            foreach (ExtraFieldBase extraField in fileHeader.ExtraFields)
            {
                zip64ExtraField = extraField as Zip64ExtraField;
                if (zip64ExtraField != null)
                {
                    break;
                }
            }
            if (zip64ExtraField != null)
            {
                dataDescriptor2.useZip64              = true;
                dataDescriptor2.CompressedSizeZip64   = !zip64ExtraField.CompressedSize.HasValue ? (ulong)fileHeader.CompressedSize : zip64ExtraField.CompressedSize.Value;
                dataDescriptor2.UncompressedSizeZip64 = !zip64ExtraField.OriginalSize.HasValue ? (ulong)fileHeader.UncompressedSize : zip64ExtraField.OriginalSize.Value;
            }
            return(dataDescriptor2);
        }
Пример #2
0
 internal void FromFileHeader(FileHeaderBase fileHeader)
 {
     this.CompressedSize    = fileHeader.CompressedSize;
     this.CompressionMethod = fileHeader.CompressionMethod;
     this.UncompressedSize  = fileHeader.UncompressedSize;
     this.Crc = fileHeader.Crc;
     if (fileHeader.ExtraFieldsData != null)
     {
         this.ExtraFieldsData = new byte[fileHeader.ExtraFieldsData.Length];
         Array.Copy((Array)fileHeader.ExtraFieldsData, (Array)this.ExtraFieldsData, fileHeader.ExtraFieldsData.Length);
         this.ExtraFields = new List <ExtraFieldBase>(ExtraFieldBase.GetExtraFields(this.GetHeaderInfo()));
     }
     if (fileHeader.FileName != null)
     {
         this.FileName = new byte[fileHeader.FileName.Length];
         Array.Copy((Array)fileHeader.FileName, (Array)this.FileName, fileHeader.FileName.Length);
     }
     this.FileTime = fileHeader.FileTime;
     this.GeneralPurposeBitFlag  = fileHeader.GeneralPurposeBitFlag;
     this.VersionNeededToExtract = fileHeader.VersionNeededToExtract;
 }
Пример #3
0
 internal LocalFileHeader(FileHeaderBase fileHeader)
 {
     this.FromFileHeader(fileHeader);
 }