Ejemplo n.º 1
0
 public DiskArchiveStorage(ZipFile file, FileUpdateMode updateMode) : base(updateMode)
 {
     if (file.Name == null)
     {
         throw new ZipException("Cant handle non file archives");
     }
     this.fileName_ = file.Name;
 }
Ejemplo n.º 2
0
 public TestStatus(ZipFile file)
 {
     this.file_ = file;
 }
Ejemplo n.º 3
0
 private void ModifyEntry(ZipFile workFile, ZipUpdate update)
 {
     workFile.WriteLocalEntryHeader(update);
     long position = workFile.baseStream_.Position;
     if (update.Entry.IsFile && (update.Filename != null))
     {
         using (Stream stream = workFile.GetOutputStream(update.OutEntry))
         {
             using (Stream stream2 = this.GetInputStream(update.Entry))
             {
                 this.CopyBytes(update, stream, stream2, stream2.Length, true);
             }
         }
     }
     long num2 = workFile.baseStream_.Position;
     update.Entry.CompressedSize = num2 - position;
 }
Ejemplo n.º 4
0
 public DiskArchiveStorage(ZipFile file) : this(file, FileUpdateMode.Safe)
 {
 }
Ejemplo n.º 5
0
 private void CopyEntryDirect(ZipFile workFile, ZipUpdate update, ref long destinationPosition)
 {
     bool flag = false;
     if (update.Entry.Offset == destinationPosition)
     {
         flag = true;
     }
     if (!flag)
     {
         this.baseStream_.Position = destinationPosition;
         workFile.WriteLocalEntryHeader(update);
         destinationPosition = this.baseStream_.Position;
     }
     long sourcePosition = 0L;
     long offset = update.Entry.Offset + 0x1aL;
     this.baseStream_.Seek(offset, SeekOrigin.Begin);
     uint num3 = this.ReadLEUshort();
     uint num4 = this.ReadLEUshort();
     sourcePosition = (this.baseStream_.Position + num3) + num4;
     if (flag)
     {
         if (update.OffsetBasedSize != -1L)
         {
             destinationPosition += update.OffsetBasedSize;
         }
         else
         {
             destinationPosition += (((sourcePosition - offset) + 0x1aL) + update.Entry.CompressedSize) + this.GetDescriptorSize(update);
         }
     }
     else
     {
         if (update.Entry.CompressedSize > 0L)
         {
             this.CopyEntryDataDirect(update, this.baseStream_, false, ref destinationPosition, ref sourcePosition);
         }
         this.CopyDescriptorBytesDirect(update, this.baseStream_, ref destinationPosition, sourcePosition);
     }
 }
Ejemplo n.º 6
0
 private void CopyEntry(ZipFile workFile, ZipUpdate update)
 {
     workFile.WriteLocalEntryHeader(update);
     if (update.Entry.CompressedSize > 0L)
     {
         long offset = update.Entry.Offset + 0x1aL;
         this.baseStream_.Seek(offset, SeekOrigin.Begin);
         uint num2 = this.ReadLEUshort();
         uint num3 = this.ReadLEUshort();
         this.baseStream_.Seek((long) (num2 + num3), SeekOrigin.Current);
         this.CopyBytes(update, workFile.baseStream_, this.baseStream_, update.Entry.CompressedSize, false);
     }
     this.CopyDescriptorBytes(update, workFile.baseStream_, this.baseStream_);
 }
Ejemplo n.º 7
0
 private void AddEntry(ZipFile workFile, ZipUpdate update)
 {
     Stream source = null;
     if (update.Entry.IsFile)
     {
         source = update.GetSource();
         if (source == null)
         {
             source = this.updateDataSource_.GetSource(update.Entry, update.Filename);
         }
     }
     if (source != null)
     {
         using (source)
         {
             long length = source.Length;
             if (update.OutEntry.Size < 0L)
             {
                 update.OutEntry.Size = length;
             }
             else if (update.OutEntry.Size != length)
             {
                 throw new ZipException("Entry size/stream size mismatch");
             }
             workFile.WriteLocalEntryHeader(update);
             long position = workFile.baseStream_.Position;
             using (Stream stream2 = workFile.GetOutputStream(update.OutEntry))
             {
                 this.CopyBytes(update, stream2, source, length, true);
             }
             long num3 = workFile.baseStream_.Position;
             update.OutEntry.CompressedSize = num3 - position;
             if ((update.OutEntry.Flags & 8) == 8)
             {
                 new ZipHelperStream(workFile.baseStream_).WriteDataDescriptor(update.OutEntry);
             }
         }
     }
     else
     {
         workFile.WriteLocalEntryHeader(update);
         update.OutEntry.CompressedSize = 0L;
     }
 }
Ejemplo n.º 8
0
 public ZipUpdate(ZipFile.UpdateCommand command, ZipEntry entry)
 {
     this.sizePatchOffset_ = -1L;
     this.crcPatchOffset_ = -1L;
     this._offsetBasedSize = -1L;
     this.command_ = command;
     this.entry_ = (ZipEntry) entry.Clone();
 }
Ejemplo n.º 9
0
 public PartialInputStream(ZipFile zipFile, long start, long length)
 {
     this.start_ = start;
     this.length_ = length;
     this.zipFile_ = zipFile;
     this.baseStream_ = this.zipFile_.baseStream_;
     this.readPos_ = start;
     this.end_ = start + length;
 }