scripts
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000077 RID: 119
|
||||
public abstract class BaseArchiveStorage : IArchiveStorage
|
||||
{
|
||||
// Token: 0x0600048A RID: 1162 RVA: 0x00016931 File Offset: 0x00015931
|
||||
protected BaseArchiveStorage(FileUpdateMode updateMode)
|
||||
{
|
||||
this.updateMode_ = updateMode;
|
||||
}
|
||||
|
||||
// Token: 0x0600048B RID: 1163
|
||||
public abstract Stream GetTemporaryOutput();
|
||||
|
||||
// Token: 0x0600048C RID: 1164
|
||||
public abstract Stream ConvertTemporaryToFinal();
|
||||
|
||||
// Token: 0x0600048D RID: 1165
|
||||
public abstract Stream MakeTemporaryCopy(Stream stream);
|
||||
|
||||
// Token: 0x0600048E RID: 1166
|
||||
public abstract Stream OpenForDirectUpdate(Stream stream);
|
||||
|
||||
// Token: 0x0600048F RID: 1167
|
||||
public abstract void Dispose();
|
||||
|
||||
// Token: 0x1700010E RID: 270
|
||||
// (get) Token: 0x06000490 RID: 1168 RVA: 0x00016940 File Offset: 0x00015940
|
||||
public FileUpdateMode UpdateMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.updateMode_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000309 RID: 777
|
||||
private FileUpdateMode updateMode_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression
|
||||
{
|
||||
// Token: 0x02000041 RID: 65
|
||||
public enum DeflateStrategy
|
||||
{
|
||||
// Token: 0x0400018B RID: 395
|
||||
Default,
|
||||
// Token: 0x0400018C RID: 396
|
||||
Filtered,
|
||||
// Token: 0x0400018D RID: 397
|
||||
HuffmanOnly
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,319 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression
|
||||
{
|
||||
// Token: 0x0200003F RID: 63
|
||||
public class Deflater
|
||||
{
|
||||
// Token: 0x06000278 RID: 632 RVA: 0x0000CE3A File Offset: 0x0000BE3A
|
||||
public Deflater()
|
||||
: this(-1, false)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000279 RID: 633 RVA: 0x0000CE44 File Offset: 0x0000BE44
|
||||
public Deflater(int level)
|
||||
: this(level, false)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600027A RID: 634 RVA: 0x0000CE50 File Offset: 0x0000BE50
|
||||
public Deflater(int level, bool noZlibHeaderOrFooter)
|
||||
{
|
||||
if (level == -1)
|
||||
{
|
||||
level = 6;
|
||||
}
|
||||
else if (level < 0 || level > 9)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("level");
|
||||
}
|
||||
this.pending = new DeflaterPending();
|
||||
this.engine = new DeflaterEngine(this.pending);
|
||||
this.noZlibHeaderOrFooter = noZlibHeaderOrFooter;
|
||||
this.SetStrategy(DeflateStrategy.Default);
|
||||
this.SetLevel(level);
|
||||
this.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x0600027B RID: 635 RVA: 0x0000CEB7 File Offset: 0x0000BEB7
|
||||
public void Reset()
|
||||
{
|
||||
this.state = (this.noZlibHeaderOrFooter ? 16 : 0);
|
||||
this.totalOut = 0L;
|
||||
this.pending.Reset();
|
||||
this.engine.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x1700008C RID: 140
|
||||
// (get) Token: 0x0600027C RID: 636 RVA: 0x0000CEEA File Offset: 0x0000BEEA
|
||||
public int Adler
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.engine.Adler;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700008D RID: 141
|
||||
// (get) Token: 0x0600027D RID: 637 RVA: 0x0000CEF7 File Offset: 0x0000BEF7
|
||||
public long TotalIn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.engine.TotalIn;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700008E RID: 142
|
||||
// (get) Token: 0x0600027E RID: 638 RVA: 0x0000CF04 File Offset: 0x0000BF04
|
||||
public long TotalOut
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.totalOut;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600027F RID: 639 RVA: 0x0000CF0C File Offset: 0x0000BF0C
|
||||
public void Flush()
|
||||
{
|
||||
this.state |= 4;
|
||||
}
|
||||
|
||||
// Token: 0x06000280 RID: 640 RVA: 0x0000CF1C File Offset: 0x0000BF1C
|
||||
public void Finish()
|
||||
{
|
||||
this.state |= 12;
|
||||
}
|
||||
|
||||
// Token: 0x1700008F RID: 143
|
||||
// (get) Token: 0x06000281 RID: 641 RVA: 0x0000CF2D File Offset: 0x0000BF2D
|
||||
public bool IsFinished
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.state == 30 && this.pending.IsFlushed;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000090 RID: 144
|
||||
// (get) Token: 0x06000282 RID: 642 RVA: 0x0000CF46 File Offset: 0x0000BF46
|
||||
public bool IsNeedingInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.engine.NeedsInput();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000283 RID: 643 RVA: 0x0000CF53 File Offset: 0x0000BF53
|
||||
public void SetInput(byte[] input)
|
||||
{
|
||||
this.SetInput(input, 0, input.Length);
|
||||
}
|
||||
|
||||
// Token: 0x06000284 RID: 644 RVA: 0x0000CF60 File Offset: 0x0000BF60
|
||||
public void SetInput(byte[] input, int offset, int count)
|
||||
{
|
||||
if ((this.state & 8) != 0)
|
||||
{
|
||||
throw new InvalidOperationException("Finish() already called");
|
||||
}
|
||||
this.engine.SetInput(input, offset, count);
|
||||
}
|
||||
|
||||
// Token: 0x06000285 RID: 645 RVA: 0x0000CF85 File Offset: 0x0000BF85
|
||||
public void SetLevel(int level)
|
||||
{
|
||||
if (level == -1)
|
||||
{
|
||||
level = 6;
|
||||
}
|
||||
else if (level < 0 || level > 9)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("level");
|
||||
}
|
||||
if (this.level != level)
|
||||
{
|
||||
this.level = level;
|
||||
this.engine.SetLevel(level);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000286 RID: 646 RVA: 0x0000CFC0 File Offset: 0x0000BFC0
|
||||
public int GetLevel()
|
||||
{
|
||||
return this.level;
|
||||
}
|
||||
|
||||
// Token: 0x06000287 RID: 647 RVA: 0x0000CFC8 File Offset: 0x0000BFC8
|
||||
public void SetStrategy(DeflateStrategy strategy)
|
||||
{
|
||||
this.engine.Strategy = strategy;
|
||||
}
|
||||
|
||||
// Token: 0x06000288 RID: 648 RVA: 0x0000CFD6 File Offset: 0x0000BFD6
|
||||
public int Deflate(byte[] output)
|
||||
{
|
||||
return this.Deflate(output, 0, output.Length);
|
||||
}
|
||||
|
||||
// Token: 0x06000289 RID: 649 RVA: 0x0000CFE4 File Offset: 0x0000BFE4
|
||||
public int Deflate(byte[] output, int offset, int length)
|
||||
{
|
||||
int num = length;
|
||||
if (this.state == 127)
|
||||
{
|
||||
throw new InvalidOperationException("Deflater closed");
|
||||
}
|
||||
if (this.state < 16)
|
||||
{
|
||||
int num2 = 30720;
|
||||
int num3 = this.level - 1 >> 1;
|
||||
if (num3 < 0 || num3 > 3)
|
||||
{
|
||||
num3 = 3;
|
||||
}
|
||||
num2 |= num3 << 6;
|
||||
if ((this.state & 1) != 0)
|
||||
{
|
||||
num2 |= 32;
|
||||
}
|
||||
num2 += 31 - num2 % 31;
|
||||
this.pending.WriteShortMSB(num2);
|
||||
if ((this.state & 1) != 0)
|
||||
{
|
||||
int adler = this.engine.Adler;
|
||||
this.engine.ResetAdler();
|
||||
this.pending.WriteShortMSB(adler >> 16);
|
||||
this.pending.WriteShortMSB(adler & 65535);
|
||||
}
|
||||
this.state = 16 | (this.state & 12);
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
int num4 = this.pending.Flush(output, offset, length);
|
||||
offset += num4;
|
||||
this.totalOut += (long)num4;
|
||||
length -= num4;
|
||||
if (length == 0 || this.state == 30)
|
||||
{
|
||||
goto IL_1DE;
|
||||
}
|
||||
if (!this.engine.Deflate((this.state & 4) != 0, (this.state & 8) != 0))
|
||||
{
|
||||
if (this.state == 16)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (this.state == 20)
|
||||
{
|
||||
if (this.level != 0)
|
||||
{
|
||||
for (int i = 8 + (-this.pending.BitCount & 7); i > 0; i -= 10)
|
||||
{
|
||||
this.pending.WriteBits(2, 10);
|
||||
}
|
||||
}
|
||||
this.state = 16;
|
||||
}
|
||||
else if (this.state == 28)
|
||||
{
|
||||
this.pending.AlignToByte();
|
||||
if (!this.noZlibHeaderOrFooter)
|
||||
{
|
||||
int adler2 = this.engine.Adler;
|
||||
this.pending.WriteShortMSB(adler2 >> 16);
|
||||
this.pending.WriteShortMSB(adler2 & 65535);
|
||||
}
|
||||
this.state = 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
return num - length;
|
||||
IL_1DE:
|
||||
return num - length;
|
||||
}
|
||||
|
||||
// Token: 0x0600028A RID: 650 RVA: 0x0000D1D2 File Offset: 0x0000C1D2
|
||||
public void SetDictionary(byte[] dictionary)
|
||||
{
|
||||
this.SetDictionary(dictionary, 0, dictionary.Length);
|
||||
}
|
||||
|
||||
// Token: 0x0600028B RID: 651 RVA: 0x0000D1DF File Offset: 0x0000C1DF
|
||||
public void SetDictionary(byte[] dictionary, int index, int count)
|
||||
{
|
||||
if (this.state != 0)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
this.state = 1;
|
||||
this.engine.SetDictionary(dictionary, index, count);
|
||||
}
|
||||
|
||||
// Token: 0x0400015A RID: 346
|
||||
public const int BEST_COMPRESSION = 9;
|
||||
|
||||
// Token: 0x0400015B RID: 347
|
||||
public const int BEST_SPEED = 1;
|
||||
|
||||
// Token: 0x0400015C RID: 348
|
||||
public const int DEFAULT_COMPRESSION = -1;
|
||||
|
||||
// Token: 0x0400015D RID: 349
|
||||
public const int NO_COMPRESSION = 0;
|
||||
|
||||
// Token: 0x0400015E RID: 350
|
||||
public const int DEFLATED = 8;
|
||||
|
||||
// Token: 0x0400015F RID: 351
|
||||
private const int IS_SETDICT = 1;
|
||||
|
||||
// Token: 0x04000160 RID: 352
|
||||
private const int IS_FLUSHING = 4;
|
||||
|
||||
// Token: 0x04000161 RID: 353
|
||||
private const int IS_FINISHING = 8;
|
||||
|
||||
// Token: 0x04000162 RID: 354
|
||||
private const int INIT_STATE = 0;
|
||||
|
||||
// Token: 0x04000163 RID: 355
|
||||
private const int SETDICT_STATE = 1;
|
||||
|
||||
// Token: 0x04000164 RID: 356
|
||||
private const int BUSY_STATE = 16;
|
||||
|
||||
// Token: 0x04000165 RID: 357
|
||||
private const int FLUSHING_STATE = 20;
|
||||
|
||||
// Token: 0x04000166 RID: 358
|
||||
private const int FINISHING_STATE = 28;
|
||||
|
||||
// Token: 0x04000167 RID: 359
|
||||
private const int FINISHED_STATE = 30;
|
||||
|
||||
// Token: 0x04000168 RID: 360
|
||||
private const int CLOSED_STATE = 127;
|
||||
|
||||
// Token: 0x04000169 RID: 361
|
||||
private int level;
|
||||
|
||||
// Token: 0x0400016A RID: 362
|
||||
private bool noZlibHeaderOrFooter;
|
||||
|
||||
// Token: 0x0400016B RID: 363
|
||||
private int state;
|
||||
|
||||
// Token: 0x0400016C RID: 364
|
||||
private long totalOut;
|
||||
|
||||
// Token: 0x0400016D RID: 365
|
||||
private DeflaterPending pending;
|
||||
|
||||
// Token: 0x0400016E RID: 366
|
||||
private DeflaterEngine engine;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression
|
||||
{
|
||||
// Token: 0x02000040 RID: 64
|
||||
public class DeflaterConstants
|
||||
{
|
||||
// Token: 0x0400016F RID: 367
|
||||
public const bool DEBUGGING = false;
|
||||
|
||||
// Token: 0x04000170 RID: 368
|
||||
public const int STORED_BLOCK = 0;
|
||||
|
||||
// Token: 0x04000171 RID: 369
|
||||
public const int STATIC_TREES = 1;
|
||||
|
||||
// Token: 0x04000172 RID: 370
|
||||
public const int DYN_TREES = 2;
|
||||
|
||||
// Token: 0x04000173 RID: 371
|
||||
public const int PRESET_DICT = 32;
|
||||
|
||||
// Token: 0x04000174 RID: 372
|
||||
public const int DEFAULT_MEM_LEVEL = 8;
|
||||
|
||||
// Token: 0x04000175 RID: 373
|
||||
public const int MAX_MATCH = 258;
|
||||
|
||||
// Token: 0x04000176 RID: 374
|
||||
public const int MIN_MATCH = 3;
|
||||
|
||||
// Token: 0x04000177 RID: 375
|
||||
public const int MAX_WBITS = 15;
|
||||
|
||||
// Token: 0x04000178 RID: 376
|
||||
public const int WSIZE = 32768;
|
||||
|
||||
// Token: 0x04000179 RID: 377
|
||||
public const int WMASK = 32767;
|
||||
|
||||
// Token: 0x0400017A RID: 378
|
||||
public const int HASH_BITS = 15;
|
||||
|
||||
// Token: 0x0400017B RID: 379
|
||||
public const int HASH_SIZE = 32768;
|
||||
|
||||
// Token: 0x0400017C RID: 380
|
||||
public const int HASH_MASK = 32767;
|
||||
|
||||
// Token: 0x0400017D RID: 381
|
||||
public const int HASH_SHIFT = 5;
|
||||
|
||||
// Token: 0x0400017E RID: 382
|
||||
public const int MIN_LOOKAHEAD = 262;
|
||||
|
||||
// Token: 0x0400017F RID: 383
|
||||
public const int MAX_DIST = 32506;
|
||||
|
||||
// Token: 0x04000180 RID: 384
|
||||
public const int PENDING_BUF_SIZE = 65536;
|
||||
|
||||
// Token: 0x04000181 RID: 385
|
||||
public const int DEFLATE_STORED = 0;
|
||||
|
||||
// Token: 0x04000182 RID: 386
|
||||
public const int DEFLATE_FAST = 1;
|
||||
|
||||
// Token: 0x04000183 RID: 387
|
||||
public const int DEFLATE_SLOW = 2;
|
||||
|
||||
// Token: 0x04000184 RID: 388
|
||||
public static int MAX_BLOCK_SIZE = Math.Min(65535, 65531);
|
||||
|
||||
// Token: 0x04000185 RID: 389
|
||||
public static int[] GOOD_LENGTH = new int[] { 0, 4, 4, 4, 4, 8, 8, 8, 32, 32 };
|
||||
|
||||
// Token: 0x04000186 RID: 390
|
||||
public static int[] MAX_LAZY = new int[] { 0, 4, 5, 6, 4, 16, 16, 32, 128, 258 };
|
||||
|
||||
// Token: 0x04000187 RID: 391
|
||||
public static int[] NICE_LENGTH = new int[] { 0, 8, 16, 32, 16, 32, 128, 128, 258, 258 };
|
||||
|
||||
// Token: 0x04000188 RID: 392
|
||||
public static int[] MAX_CHAIN = new int[] { 0, 4, 8, 32, 16, 32, 128, 256, 1024, 4096 };
|
||||
|
||||
// Token: 0x04000189 RID: 393
|
||||
public static int[] COMPR_FUNC = new int[] { 0, 1, 1, 1, 1, 2, 2, 2, 2, 2 };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,571 @@
|
||||
using System;
|
||||
using ICSharpCode.SharpZipLib.Checksums;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression
|
||||
{
|
||||
// Token: 0x02000042 RID: 66
|
||||
public class DeflaterEngine : DeflaterConstants
|
||||
{
|
||||
// Token: 0x0600028E RID: 654 RVA: 0x0000D36C File Offset: 0x0000C36C
|
||||
public DeflaterEngine(DeflaterPending pending)
|
||||
{
|
||||
this.pending = pending;
|
||||
this.huffman = new DeflaterHuffman(pending);
|
||||
this.adler = new Adler32();
|
||||
this.window = new byte[65536];
|
||||
this.head = new short[32768];
|
||||
this.prev = new short[32768];
|
||||
this.blockStart = (this.strstart = 1);
|
||||
}
|
||||
|
||||
// Token: 0x0600028F RID: 655 RVA: 0x0000D3E0 File Offset: 0x0000C3E0
|
||||
public bool Deflate(bool flush, bool finish)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
this.FillWindow();
|
||||
bool flag = flush && this.inputOff == this.inputEnd;
|
||||
bool flag2;
|
||||
switch (this.compressionFunction)
|
||||
{
|
||||
case 0:
|
||||
flag2 = this.DeflateStored(flag, finish);
|
||||
goto IL_62;
|
||||
case 1:
|
||||
flag2 = this.DeflateFast(flag, finish);
|
||||
goto IL_62;
|
||||
case 2:
|
||||
flag2 = this.DeflateSlow(flag, finish);
|
||||
goto IL_62;
|
||||
}
|
||||
break;
|
||||
IL_62:
|
||||
if (!this.pending.IsFlushed || !flag2)
|
||||
{
|
||||
return flag2;
|
||||
}
|
||||
}
|
||||
throw new InvalidOperationException("unknown compressionFunction");
|
||||
}
|
||||
|
||||
// Token: 0x06000290 RID: 656 RVA: 0x0000D460 File Offset: 0x0000C460
|
||||
public void SetInput(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
if (this.inputOff < this.inputEnd)
|
||||
{
|
||||
throw new InvalidOperationException("Old input was not completely processed");
|
||||
}
|
||||
int num = offset + count;
|
||||
if (offset > num || num > buffer.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
this.inputBuf = buffer;
|
||||
this.inputOff = offset;
|
||||
this.inputEnd = num;
|
||||
}
|
||||
|
||||
// Token: 0x06000291 RID: 657 RVA: 0x0000D4E0 File Offset: 0x0000C4E0
|
||||
public bool NeedsInput()
|
||||
{
|
||||
return this.inputEnd == this.inputOff;
|
||||
}
|
||||
|
||||
// Token: 0x06000292 RID: 658 RVA: 0x0000D4F0 File Offset: 0x0000C4F0
|
||||
public void SetDictionary(byte[] buffer, int offset, int length)
|
||||
{
|
||||
this.adler.Update(buffer, offset, length);
|
||||
if (length < 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (length > 32506)
|
||||
{
|
||||
offset += length - 32506;
|
||||
length = 32506;
|
||||
}
|
||||
Array.Copy(buffer, offset, this.window, this.strstart, length);
|
||||
this.UpdateHash();
|
||||
length--;
|
||||
while (--length > 0)
|
||||
{
|
||||
this.InsertString();
|
||||
this.strstart++;
|
||||
}
|
||||
this.strstart += 2;
|
||||
this.blockStart = this.strstart;
|
||||
}
|
||||
|
||||
// Token: 0x06000293 RID: 659 RVA: 0x0000D584 File Offset: 0x0000C584
|
||||
public void Reset()
|
||||
{
|
||||
this.huffman.Reset();
|
||||
this.adler.Reset();
|
||||
this.blockStart = (this.strstart = 1);
|
||||
this.lookahead = 0;
|
||||
this.totalIn = 0L;
|
||||
this.prevAvailable = false;
|
||||
this.matchLen = 2;
|
||||
for (int i = 0; i < 32768; i++)
|
||||
{
|
||||
this.head[i] = 0;
|
||||
}
|
||||
for (int j = 0; j < 32768; j++)
|
||||
{
|
||||
this.prev[j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000294 RID: 660 RVA: 0x0000D606 File Offset: 0x0000C606
|
||||
public void ResetAdler()
|
||||
{
|
||||
this.adler.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x17000091 RID: 145
|
||||
// (get) Token: 0x06000295 RID: 661 RVA: 0x0000D613 File Offset: 0x0000C613
|
||||
public int Adler
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)this.adler.Value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000092 RID: 146
|
||||
// (get) Token: 0x06000296 RID: 662 RVA: 0x0000D621 File Offset: 0x0000C621
|
||||
public long TotalIn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.totalIn;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000093 RID: 147
|
||||
// (get) Token: 0x06000297 RID: 663 RVA: 0x0000D629 File Offset: 0x0000C629
|
||||
// (set) Token: 0x06000298 RID: 664 RVA: 0x0000D631 File Offset: 0x0000C631
|
||||
public DeflateStrategy Strategy
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.strategy;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.strategy = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000299 RID: 665 RVA: 0x0000D63C File Offset: 0x0000C63C
|
||||
public void SetLevel(int level)
|
||||
{
|
||||
if (level < 0 || level > 9)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("level");
|
||||
}
|
||||
this.goodLength = DeflaterConstants.GOOD_LENGTH[level];
|
||||
this.max_lazy = DeflaterConstants.MAX_LAZY[level];
|
||||
this.niceLength = DeflaterConstants.NICE_LENGTH[level];
|
||||
this.max_chain = DeflaterConstants.MAX_CHAIN[level];
|
||||
if (DeflaterConstants.COMPR_FUNC[level] != this.compressionFunction)
|
||||
{
|
||||
switch (this.compressionFunction)
|
||||
{
|
||||
case 0:
|
||||
if (this.strstart > this.blockStart)
|
||||
{
|
||||
this.huffman.FlushStoredBlock(this.window, this.blockStart, this.strstart - this.blockStart, false);
|
||||
this.blockStart = this.strstart;
|
||||
}
|
||||
this.UpdateHash();
|
||||
break;
|
||||
case 1:
|
||||
if (this.strstart > this.blockStart)
|
||||
{
|
||||
this.huffman.FlushBlock(this.window, this.blockStart, this.strstart - this.blockStart, false);
|
||||
this.blockStart = this.strstart;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (this.prevAvailable)
|
||||
{
|
||||
this.huffman.TallyLit((int)(this.window[this.strstart - 1] & byte.MaxValue));
|
||||
}
|
||||
if (this.strstart > this.blockStart)
|
||||
{
|
||||
this.huffman.FlushBlock(this.window, this.blockStart, this.strstart - this.blockStart, false);
|
||||
this.blockStart = this.strstart;
|
||||
}
|
||||
this.prevAvailable = false;
|
||||
this.matchLen = 2;
|
||||
break;
|
||||
}
|
||||
this.compressionFunction = DeflaterConstants.COMPR_FUNC[level];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600029A RID: 666 RVA: 0x0000D7D4 File Offset: 0x0000C7D4
|
||||
public void FillWindow()
|
||||
{
|
||||
if (this.strstart >= 65274)
|
||||
{
|
||||
this.SlideWindow();
|
||||
}
|
||||
while (this.lookahead < 262 && this.inputOff < this.inputEnd)
|
||||
{
|
||||
int num = 65536 - this.lookahead - this.strstart;
|
||||
if (num > this.inputEnd - this.inputOff)
|
||||
{
|
||||
num = this.inputEnd - this.inputOff;
|
||||
}
|
||||
Array.Copy(this.inputBuf, this.inputOff, this.window, this.strstart + this.lookahead, num);
|
||||
this.adler.Update(this.inputBuf, this.inputOff, num);
|
||||
this.inputOff += num;
|
||||
this.totalIn += (long)num;
|
||||
this.lookahead += num;
|
||||
}
|
||||
if (this.lookahead >= 3)
|
||||
{
|
||||
this.UpdateHash();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600029B RID: 667 RVA: 0x0000D8C3 File Offset: 0x0000C8C3
|
||||
private void UpdateHash()
|
||||
{
|
||||
this.ins_h = ((int)this.window[this.strstart] << 5) ^ (int)this.window[this.strstart + 1];
|
||||
}
|
||||
|
||||
// Token: 0x0600029C RID: 668 RVA: 0x0000D8EC File Offset: 0x0000C8EC
|
||||
private int InsertString()
|
||||
{
|
||||
int num = ((this.ins_h << 5) ^ (int)this.window[this.strstart + 2]) & 32767;
|
||||
short num2 = (this.prev[this.strstart & 32767] = this.head[num]);
|
||||
this.head[num] = (short)this.strstart;
|
||||
this.ins_h = num;
|
||||
return (int)num2 & 65535;
|
||||
}
|
||||
|
||||
// Token: 0x0600029D RID: 669 RVA: 0x0000D954 File Offset: 0x0000C954
|
||||
private void SlideWindow()
|
||||
{
|
||||
Array.Copy(this.window, 32768, this.window, 0, 32768);
|
||||
this.matchStart -= 32768;
|
||||
this.strstart -= 32768;
|
||||
this.blockStart -= 32768;
|
||||
for (int i = 0; i < 32768; i++)
|
||||
{
|
||||
int num = (int)this.head[i] & 65535;
|
||||
this.head[i] = (short)((num >= 32768) ? (num - 32768) : 0);
|
||||
}
|
||||
for (int j = 0; j < 32768; j++)
|
||||
{
|
||||
int num2 = (int)this.prev[j] & 65535;
|
||||
this.prev[j] = (short)((num2 >= 32768) ? (num2 - 32768) : 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600029E RID: 670 RVA: 0x0000DA28 File Offset: 0x0000CA28
|
||||
private bool FindLongestMatch(int curMatch)
|
||||
{
|
||||
int num = this.max_chain;
|
||||
int num2 = this.niceLength;
|
||||
short[] array = this.prev;
|
||||
int num3 = this.strstart;
|
||||
int num4 = this.strstart + this.matchLen;
|
||||
int num5 = Math.Max(this.matchLen, 2);
|
||||
int num6 = Math.Max(this.strstart - 32506, 0);
|
||||
int num7 = this.strstart + 258 - 1;
|
||||
byte b = this.window[num4 - 1];
|
||||
byte b2 = this.window[num4];
|
||||
if (num5 >= this.goodLength)
|
||||
{
|
||||
num >>= 2;
|
||||
}
|
||||
if (num2 > this.lookahead)
|
||||
{
|
||||
num2 = this.lookahead;
|
||||
}
|
||||
do
|
||||
{
|
||||
if (this.window[curMatch + num5] == b2 && this.window[curMatch + num5 - 1] == b && this.window[curMatch] == this.window[num3] && this.window[curMatch + 1] == this.window[num3 + 1])
|
||||
{
|
||||
int num8 = curMatch + 2;
|
||||
num3 += 2;
|
||||
while (this.window[++num3] == this.window[++num8] && this.window[++num3] == this.window[++num8] && this.window[++num3] == this.window[++num8] && this.window[++num3] == this.window[++num8] && this.window[++num3] == this.window[++num8] && this.window[++num3] == this.window[++num8] && this.window[++num3] == this.window[++num8] && this.window[++num3] == this.window[++num8] && num3 < num7)
|
||||
{
|
||||
}
|
||||
if (num3 > num4)
|
||||
{
|
||||
this.matchStart = curMatch;
|
||||
num4 = num3;
|
||||
num5 = num3 - this.strstart;
|
||||
if (num5 >= num2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
b = this.window[num4 - 1];
|
||||
b2 = this.window[num4];
|
||||
}
|
||||
num3 = this.strstart;
|
||||
}
|
||||
}
|
||||
while ((curMatch = (int)array[curMatch & 32767] & 65535) > num6 && --num != 0);
|
||||
this.matchLen = Math.Min(num5, this.lookahead);
|
||||
return this.matchLen >= 3;
|
||||
}
|
||||
|
||||
// Token: 0x0600029F RID: 671 RVA: 0x0000DC94 File Offset: 0x0000CC94
|
||||
private bool DeflateStored(bool flush, bool finish)
|
||||
{
|
||||
if (!flush && this.lookahead == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.strstart += this.lookahead;
|
||||
this.lookahead = 0;
|
||||
int num = this.strstart - this.blockStart;
|
||||
if (num >= DeflaterConstants.MAX_BLOCK_SIZE || (this.blockStart < 32768 && num >= 32506) || flush)
|
||||
{
|
||||
bool flag = finish;
|
||||
if (num > DeflaterConstants.MAX_BLOCK_SIZE)
|
||||
{
|
||||
num = DeflaterConstants.MAX_BLOCK_SIZE;
|
||||
flag = false;
|
||||
}
|
||||
this.huffman.FlushStoredBlock(this.window, this.blockStart, num, flag);
|
||||
this.blockStart += num;
|
||||
return !flag;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x060002A0 RID: 672 RVA: 0x0000DD38 File Offset: 0x0000CD38
|
||||
private bool DeflateFast(bool flush, bool finish)
|
||||
{
|
||||
if (this.lookahead < 262 && !flush)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
while (this.lookahead >= 262 || flush)
|
||||
{
|
||||
if (this.lookahead == 0)
|
||||
{
|
||||
this.huffman.FlushBlock(this.window, this.blockStart, this.strstart - this.blockStart, finish);
|
||||
this.blockStart = this.strstart;
|
||||
return false;
|
||||
}
|
||||
if (this.strstart > 65274)
|
||||
{
|
||||
this.SlideWindow();
|
||||
}
|
||||
int num;
|
||||
if (this.lookahead >= 3 && (num = this.InsertString()) != 0 && this.strategy != DeflateStrategy.HuffmanOnly && this.strstart - num <= 32506 && this.FindLongestMatch(num))
|
||||
{
|
||||
bool flag = this.huffman.TallyDist(this.strstart - this.matchStart, this.matchLen);
|
||||
this.lookahead -= this.matchLen;
|
||||
if (this.matchLen <= this.max_lazy && this.lookahead >= 3)
|
||||
{
|
||||
while (--this.matchLen > 0)
|
||||
{
|
||||
this.strstart++;
|
||||
this.InsertString();
|
||||
}
|
||||
this.strstart++;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.strstart += this.matchLen;
|
||||
if (this.lookahead >= 2)
|
||||
{
|
||||
this.UpdateHash();
|
||||
}
|
||||
}
|
||||
this.matchLen = 2;
|
||||
if (!flag)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.huffman.TallyLit((int)(this.window[this.strstart] & byte.MaxValue));
|
||||
this.strstart++;
|
||||
this.lookahead--;
|
||||
}
|
||||
if (this.huffman.IsFull())
|
||||
{
|
||||
bool flag2 = finish && this.lookahead == 0;
|
||||
this.huffman.FlushBlock(this.window, this.blockStart, this.strstart - this.blockStart, flag2);
|
||||
this.blockStart = this.strstart;
|
||||
return !flag2;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x060002A1 RID: 673 RVA: 0x0000DF48 File Offset: 0x0000CF48
|
||||
private bool DeflateSlow(bool flush, bool finish)
|
||||
{
|
||||
if (this.lookahead < 262 && !flush)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
while (this.lookahead >= 262 || flush)
|
||||
{
|
||||
if (this.lookahead == 0)
|
||||
{
|
||||
if (this.prevAvailable)
|
||||
{
|
||||
this.huffman.TallyLit((int)(this.window[this.strstart - 1] & byte.MaxValue));
|
||||
}
|
||||
this.prevAvailable = false;
|
||||
this.huffman.FlushBlock(this.window, this.blockStart, this.strstart - this.blockStart, finish);
|
||||
this.blockStart = this.strstart;
|
||||
return false;
|
||||
}
|
||||
if (this.strstart >= 65274)
|
||||
{
|
||||
this.SlideWindow();
|
||||
}
|
||||
int num = this.matchStart;
|
||||
int num2 = this.matchLen;
|
||||
if (this.lookahead >= 3)
|
||||
{
|
||||
int num3 = this.InsertString();
|
||||
if (this.strategy != DeflateStrategy.HuffmanOnly && num3 != 0 && this.strstart - num3 <= 32506 && this.FindLongestMatch(num3) && this.matchLen <= 5 && (this.strategy == DeflateStrategy.Filtered || (this.matchLen == 3 && this.strstart - this.matchStart > 4096)))
|
||||
{
|
||||
this.matchLen = 2;
|
||||
}
|
||||
}
|
||||
if (num2 >= 3 && this.matchLen <= num2)
|
||||
{
|
||||
this.huffman.TallyDist(this.strstart - 1 - num, num2);
|
||||
num2 -= 2;
|
||||
do
|
||||
{
|
||||
this.strstart++;
|
||||
this.lookahead--;
|
||||
if (this.lookahead >= 3)
|
||||
{
|
||||
this.InsertString();
|
||||
}
|
||||
}
|
||||
while (--num2 > 0);
|
||||
this.strstart++;
|
||||
this.lookahead--;
|
||||
this.prevAvailable = false;
|
||||
this.matchLen = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.prevAvailable)
|
||||
{
|
||||
this.huffman.TallyLit((int)(this.window[this.strstart - 1] & byte.MaxValue));
|
||||
}
|
||||
this.prevAvailable = true;
|
||||
this.strstart++;
|
||||
this.lookahead--;
|
||||
}
|
||||
if (this.huffman.IsFull())
|
||||
{
|
||||
int num4 = this.strstart - this.blockStart;
|
||||
if (this.prevAvailable)
|
||||
{
|
||||
num4--;
|
||||
}
|
||||
bool flag = finish && this.lookahead == 0 && !this.prevAvailable;
|
||||
this.huffman.FlushBlock(this.window, this.blockStart, num4, flag);
|
||||
this.blockStart += num4;
|
||||
return !flag;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x0400018E RID: 398
|
||||
private const int TooFar = 4096;
|
||||
|
||||
// Token: 0x0400018F RID: 399
|
||||
private int ins_h;
|
||||
|
||||
// Token: 0x04000190 RID: 400
|
||||
private short[] head;
|
||||
|
||||
// Token: 0x04000191 RID: 401
|
||||
private short[] prev;
|
||||
|
||||
// Token: 0x04000192 RID: 402
|
||||
private int matchStart;
|
||||
|
||||
// Token: 0x04000193 RID: 403
|
||||
private int matchLen;
|
||||
|
||||
// Token: 0x04000194 RID: 404
|
||||
private bool prevAvailable;
|
||||
|
||||
// Token: 0x04000195 RID: 405
|
||||
private int blockStart;
|
||||
|
||||
// Token: 0x04000196 RID: 406
|
||||
private int strstart;
|
||||
|
||||
// Token: 0x04000197 RID: 407
|
||||
private int lookahead;
|
||||
|
||||
// Token: 0x04000198 RID: 408
|
||||
private byte[] window;
|
||||
|
||||
// Token: 0x04000199 RID: 409
|
||||
private DeflateStrategy strategy;
|
||||
|
||||
// Token: 0x0400019A RID: 410
|
||||
private int max_chain;
|
||||
|
||||
// Token: 0x0400019B RID: 411
|
||||
private int max_lazy;
|
||||
|
||||
// Token: 0x0400019C RID: 412
|
||||
private int niceLength;
|
||||
|
||||
// Token: 0x0400019D RID: 413
|
||||
private int goodLength;
|
||||
|
||||
// Token: 0x0400019E RID: 414
|
||||
private int compressionFunction;
|
||||
|
||||
// Token: 0x0400019F RID: 415
|
||||
private byte[] inputBuf;
|
||||
|
||||
// Token: 0x040001A0 RID: 416
|
||||
private long totalIn;
|
||||
|
||||
// Token: 0x040001A1 RID: 417
|
||||
private int inputOff;
|
||||
|
||||
// Token: 0x040001A2 RID: 418
|
||||
private int inputEnd;
|
||||
|
||||
// Token: 0x040001A3 RID: 419
|
||||
private DeflaterPending pending;
|
||||
|
||||
// Token: 0x040001A4 RID: 420
|
||||
private DeflaterHuffman huffman;
|
||||
|
||||
// Token: 0x040001A5 RID: 421
|
||||
private Adler32 adler;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,726 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression
|
||||
{
|
||||
// Token: 0x02000043 RID: 67
|
||||
public class DeflaterHuffman
|
||||
{
|
||||
// Token: 0x060002A2 RID: 674 RVA: 0x0000E220 File Offset: 0x0000D220
|
||||
static DeflaterHuffman()
|
||||
{
|
||||
int i = 0;
|
||||
while (i < 144)
|
||||
{
|
||||
DeflaterHuffman.staticLCodes[i] = DeflaterHuffman.BitReverse(48 + i << 8);
|
||||
DeflaterHuffman.staticLLength[i++] = 8;
|
||||
}
|
||||
while (i < 256)
|
||||
{
|
||||
DeflaterHuffman.staticLCodes[i] = DeflaterHuffman.BitReverse(256 + i << 7);
|
||||
DeflaterHuffman.staticLLength[i++] = 9;
|
||||
}
|
||||
while (i < 280)
|
||||
{
|
||||
DeflaterHuffman.staticLCodes[i] = DeflaterHuffman.BitReverse(-256 + i << 9);
|
||||
DeflaterHuffman.staticLLength[i++] = 7;
|
||||
}
|
||||
while (i < 286)
|
||||
{
|
||||
DeflaterHuffman.staticLCodes[i] = DeflaterHuffman.BitReverse(-88 + i << 8);
|
||||
DeflaterHuffman.staticLLength[i++] = 8;
|
||||
}
|
||||
DeflaterHuffman.staticDCodes = new short[30];
|
||||
DeflaterHuffman.staticDLength = new byte[30];
|
||||
for (i = 0; i < 30; i++)
|
||||
{
|
||||
DeflaterHuffman.staticDCodes[i] = DeflaterHuffman.BitReverse(i << 11);
|
||||
DeflaterHuffman.staticDLength[i] = 5;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060002A3 RID: 675 RVA: 0x0000E360 File Offset: 0x0000D360
|
||||
public DeflaterHuffman(DeflaterPending pending)
|
||||
{
|
||||
this.pending = pending;
|
||||
this.literalTree = new DeflaterHuffman.Tree(this, 286, 257, 15);
|
||||
this.distTree = new DeflaterHuffman.Tree(this, 30, 1, 15);
|
||||
this.blTree = new DeflaterHuffman.Tree(this, 19, 4, 7);
|
||||
this.d_buf = new short[16384];
|
||||
this.l_buf = new byte[16384];
|
||||
}
|
||||
|
||||
// Token: 0x060002A4 RID: 676 RVA: 0x0000E3D3 File Offset: 0x0000D3D3
|
||||
public void Reset()
|
||||
{
|
||||
this.last_lit = 0;
|
||||
this.extra_bits = 0;
|
||||
this.literalTree.Reset();
|
||||
this.distTree.Reset();
|
||||
this.blTree.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x060002A5 RID: 677 RVA: 0x0000E404 File Offset: 0x0000D404
|
||||
public void SendAllTrees(int blTreeCodes)
|
||||
{
|
||||
this.blTree.BuildCodes();
|
||||
this.literalTree.BuildCodes();
|
||||
this.distTree.BuildCodes();
|
||||
this.pending.WriteBits(this.literalTree.numCodes - 257, 5);
|
||||
this.pending.WriteBits(this.distTree.numCodes - 1, 5);
|
||||
this.pending.WriteBits(blTreeCodes - 4, 4);
|
||||
for (int i = 0; i < blTreeCodes; i++)
|
||||
{
|
||||
this.pending.WriteBits((int)this.blTree.length[DeflaterHuffman.BL_ORDER[i]], 3);
|
||||
}
|
||||
this.literalTree.WriteTree(this.blTree);
|
||||
this.distTree.WriteTree(this.blTree);
|
||||
}
|
||||
|
||||
// Token: 0x060002A6 RID: 678 RVA: 0x0000E4C4 File Offset: 0x0000D4C4
|
||||
public void CompressBlock()
|
||||
{
|
||||
for (int i = 0; i < this.last_lit; i++)
|
||||
{
|
||||
int num = (int)(this.l_buf[i] & byte.MaxValue);
|
||||
int num2 = (int)this.d_buf[i];
|
||||
if (num2-- != 0)
|
||||
{
|
||||
int num3 = DeflaterHuffman.Lcode(num);
|
||||
this.literalTree.WriteSymbol(num3);
|
||||
int num4 = (num3 - 261) / 4;
|
||||
if (num4 > 0 && num4 <= 5)
|
||||
{
|
||||
this.pending.WriteBits(num & ((1 << num4) - 1), num4);
|
||||
}
|
||||
int num5 = DeflaterHuffman.Dcode(num2);
|
||||
this.distTree.WriteSymbol(num5);
|
||||
num4 = num5 / 2 - 1;
|
||||
if (num4 > 0)
|
||||
{
|
||||
this.pending.WriteBits(num2 & ((1 << num4) - 1), num4);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.literalTree.WriteSymbol(num);
|
||||
}
|
||||
}
|
||||
this.literalTree.WriteSymbol(256);
|
||||
}
|
||||
|
||||
// Token: 0x060002A7 RID: 679 RVA: 0x0000E5A0 File Offset: 0x0000D5A0
|
||||
public void FlushStoredBlock(byte[] stored, int storedOffset, int storedLength, bool lastBlock)
|
||||
{
|
||||
this.pending.WriteBits(lastBlock ? 1 : 0, 3);
|
||||
this.pending.AlignToByte();
|
||||
this.pending.WriteShort(storedLength);
|
||||
this.pending.WriteShort(~storedLength);
|
||||
this.pending.WriteBlock(stored, storedOffset, storedLength);
|
||||
this.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x060002A8 RID: 680 RVA: 0x0000E5FC File Offset: 0x0000D5FC
|
||||
public void FlushBlock(byte[] stored, int storedOffset, int storedLength, bool lastBlock)
|
||||
{
|
||||
short[] freqs = this.literalTree.freqs;
|
||||
int num = 256;
|
||||
freqs[num] += 1;
|
||||
this.literalTree.BuildTree();
|
||||
this.distTree.BuildTree();
|
||||
this.literalTree.CalcBLFreq(this.blTree);
|
||||
this.distTree.CalcBLFreq(this.blTree);
|
||||
this.blTree.BuildTree();
|
||||
int num2 = 4;
|
||||
for (int i = 18; i > num2; i--)
|
||||
{
|
||||
if (this.blTree.length[DeflaterHuffman.BL_ORDER[i]] > 0)
|
||||
{
|
||||
num2 = i + 1;
|
||||
}
|
||||
}
|
||||
int num3 = 14 + num2 * 3 + this.blTree.GetEncodedLength() + this.literalTree.GetEncodedLength() + this.distTree.GetEncodedLength() + this.extra_bits;
|
||||
int num4 = this.extra_bits;
|
||||
for (int j = 0; j < 286; j++)
|
||||
{
|
||||
num4 += (int)(this.literalTree.freqs[j] * (short)DeflaterHuffman.staticLLength[j]);
|
||||
}
|
||||
for (int k = 0; k < 30; k++)
|
||||
{
|
||||
num4 += (int)(this.distTree.freqs[k] * (short)DeflaterHuffman.staticDLength[k]);
|
||||
}
|
||||
if (num3 >= num4)
|
||||
{
|
||||
num3 = num4;
|
||||
}
|
||||
if (storedOffset >= 0 && storedLength + 4 < num3 >> 3)
|
||||
{
|
||||
this.FlushStoredBlock(stored, storedOffset, storedLength, lastBlock);
|
||||
return;
|
||||
}
|
||||
if (num3 == num4)
|
||||
{
|
||||
this.pending.WriteBits(2 + (lastBlock ? 1 : 0), 3);
|
||||
this.literalTree.SetStaticCodes(DeflaterHuffman.staticLCodes, DeflaterHuffman.staticLLength);
|
||||
this.distTree.SetStaticCodes(DeflaterHuffman.staticDCodes, DeflaterHuffman.staticDLength);
|
||||
this.CompressBlock();
|
||||
this.Reset();
|
||||
return;
|
||||
}
|
||||
this.pending.WriteBits(4 + (lastBlock ? 1 : 0), 3);
|
||||
this.SendAllTrees(num2);
|
||||
this.CompressBlock();
|
||||
this.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x060002A9 RID: 681 RVA: 0x0000E7C2 File Offset: 0x0000D7C2
|
||||
public bool IsFull()
|
||||
{
|
||||
return this.last_lit >= 16384;
|
||||
}
|
||||
|
||||
// Token: 0x060002AA RID: 682 RVA: 0x0000E7D4 File Offset: 0x0000D7D4
|
||||
public bool TallyLit(int literal)
|
||||
{
|
||||
this.d_buf[this.last_lit] = 0;
|
||||
this.l_buf[this.last_lit++] = (byte)literal;
|
||||
short[] freqs = this.literalTree.freqs;
|
||||
freqs[literal] += 1;
|
||||
return this.IsFull();
|
||||
}
|
||||
|
||||
// Token: 0x060002AB RID: 683 RVA: 0x0000E830 File Offset: 0x0000D830
|
||||
public bool TallyDist(int distance, int length)
|
||||
{
|
||||
this.d_buf[this.last_lit] = (short)distance;
|
||||
this.l_buf[this.last_lit++] = (byte)(length - 3);
|
||||
int num = DeflaterHuffman.Lcode(length - 3);
|
||||
short[] freqs = this.literalTree.freqs;
|
||||
int num2 = num;
|
||||
freqs[num2] += 1;
|
||||
if (num >= 265 && num < 285)
|
||||
{
|
||||
this.extra_bits += (num - 261) / 4;
|
||||
}
|
||||
int num3 = DeflaterHuffman.Dcode(distance - 1);
|
||||
short[] freqs2 = this.distTree.freqs;
|
||||
int num4 = num3;
|
||||
freqs2[num4] += 1;
|
||||
if (num3 >= 4)
|
||||
{
|
||||
this.extra_bits += num3 / 2 - 1;
|
||||
}
|
||||
return this.IsFull();
|
||||
}
|
||||
|
||||
// Token: 0x060002AC RID: 684 RVA: 0x0000E8FA File Offset: 0x0000D8FA
|
||||
public static short BitReverse(int toReverse)
|
||||
{
|
||||
return (short)(((int)DeflaterHuffman.bit4Reverse[toReverse & 15] << 12) | ((int)DeflaterHuffman.bit4Reverse[(toReverse >> 4) & 15] << 8) | ((int)DeflaterHuffman.bit4Reverse[(toReverse >> 8) & 15] << 4) | (int)DeflaterHuffman.bit4Reverse[toReverse >> 12]);
|
||||
}
|
||||
|
||||
// Token: 0x060002AD RID: 685 RVA: 0x0000E934 File Offset: 0x0000D934
|
||||
private static int Lcode(int length)
|
||||
{
|
||||
if (length == 255)
|
||||
{
|
||||
return 285;
|
||||
}
|
||||
int num = 257;
|
||||
while (length >= 8)
|
||||
{
|
||||
num += 4;
|
||||
length >>= 1;
|
||||
}
|
||||
return num + length;
|
||||
}
|
||||
|
||||
// Token: 0x060002AE RID: 686 RVA: 0x0000E968 File Offset: 0x0000D968
|
||||
private static int Dcode(int distance)
|
||||
{
|
||||
int num = 0;
|
||||
while (distance >= 4)
|
||||
{
|
||||
num += 2;
|
||||
distance >>= 1;
|
||||
}
|
||||
return num + distance;
|
||||
}
|
||||
|
||||
// Token: 0x040001A6 RID: 422
|
||||
private const int BUFSIZE = 16384;
|
||||
|
||||
// Token: 0x040001A7 RID: 423
|
||||
private const int LITERAL_NUM = 286;
|
||||
|
||||
// Token: 0x040001A8 RID: 424
|
||||
private const int DIST_NUM = 30;
|
||||
|
||||
// Token: 0x040001A9 RID: 425
|
||||
private const int BITLEN_NUM = 19;
|
||||
|
||||
// Token: 0x040001AA RID: 426
|
||||
private const int REP_3_6 = 16;
|
||||
|
||||
// Token: 0x040001AB RID: 427
|
||||
private const int REP_3_10 = 17;
|
||||
|
||||
// Token: 0x040001AC RID: 428
|
||||
private const int REP_11_138 = 18;
|
||||
|
||||
// Token: 0x040001AD RID: 429
|
||||
private const int EOF_SYMBOL = 256;
|
||||
|
||||
// Token: 0x040001AE RID: 430
|
||||
private static readonly int[] BL_ORDER = new int[]
|
||||
{
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5,
|
||||
11, 4, 12, 3, 13, 2, 14, 1, 15
|
||||
};
|
||||
|
||||
// Token: 0x040001AF RID: 431
|
||||
private static readonly byte[] bit4Reverse = new byte[]
|
||||
{
|
||||
0, 8, 4, 12, 2, 10, 6, 14, 1, 9,
|
||||
5, 13, 3, 11, 7, 15
|
||||
};
|
||||
|
||||
// Token: 0x040001B0 RID: 432
|
||||
private static short[] staticLCodes = new short[286];
|
||||
|
||||
// Token: 0x040001B1 RID: 433
|
||||
private static byte[] staticLLength = new byte[286];
|
||||
|
||||
// Token: 0x040001B2 RID: 434
|
||||
private static short[] staticDCodes;
|
||||
|
||||
// Token: 0x040001B3 RID: 435
|
||||
private static byte[] staticDLength;
|
||||
|
||||
// Token: 0x040001B4 RID: 436
|
||||
public DeflaterPending pending;
|
||||
|
||||
// Token: 0x040001B5 RID: 437
|
||||
private DeflaterHuffman.Tree literalTree;
|
||||
|
||||
// Token: 0x040001B6 RID: 438
|
||||
private DeflaterHuffman.Tree distTree;
|
||||
|
||||
// Token: 0x040001B7 RID: 439
|
||||
private DeflaterHuffman.Tree blTree;
|
||||
|
||||
// Token: 0x040001B8 RID: 440
|
||||
private short[] d_buf;
|
||||
|
||||
// Token: 0x040001B9 RID: 441
|
||||
private byte[] l_buf;
|
||||
|
||||
// Token: 0x040001BA RID: 442
|
||||
private int last_lit;
|
||||
|
||||
// Token: 0x040001BB RID: 443
|
||||
private int extra_bits;
|
||||
|
||||
// Token: 0x02000044 RID: 68
|
||||
private class Tree
|
||||
{
|
||||
// Token: 0x060002AF RID: 687 RVA: 0x0000E989 File Offset: 0x0000D989
|
||||
public Tree(DeflaterHuffman dh, int elems, int minCodes, int maxLength)
|
||||
{
|
||||
this.dh = dh;
|
||||
this.minNumCodes = minCodes;
|
||||
this.maxLength = maxLength;
|
||||
this.freqs = new short[elems];
|
||||
this.bl_counts = new int[maxLength];
|
||||
}
|
||||
|
||||
// Token: 0x060002B0 RID: 688 RVA: 0x0000E9C0 File Offset: 0x0000D9C0
|
||||
public void Reset()
|
||||
{
|
||||
for (int i = 0; i < this.freqs.Length; i++)
|
||||
{
|
||||
this.freqs[i] = 0;
|
||||
}
|
||||
this.codes = null;
|
||||
this.length = null;
|
||||
}
|
||||
|
||||
// Token: 0x060002B1 RID: 689 RVA: 0x0000E9F7 File Offset: 0x0000D9F7
|
||||
public void WriteSymbol(int code)
|
||||
{
|
||||
this.dh.pending.WriteBits((int)this.codes[code] & 65535, (int)this.length[code]);
|
||||
}
|
||||
|
||||
// Token: 0x060002B2 RID: 690 RVA: 0x0000EA20 File Offset: 0x0000DA20
|
||||
public void CheckEmpty()
|
||||
{
|
||||
bool flag = true;
|
||||
for (int i = 0; i < this.freqs.Length; i++)
|
||||
{
|
||||
if (this.freqs[i] != 0)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
throw new SharpZipBaseException("!Empty");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060002B3 RID: 691 RVA: 0x0000EA5C File Offset: 0x0000DA5C
|
||||
public void SetStaticCodes(short[] staticCodes, byte[] staticLengths)
|
||||
{
|
||||
this.codes = staticCodes;
|
||||
this.length = staticLengths;
|
||||
}
|
||||
|
||||
// Token: 0x060002B4 RID: 692 RVA: 0x0000EA6C File Offset: 0x0000DA6C
|
||||
public void BuildCodes()
|
||||
{
|
||||
int num = this.freqs.Length;
|
||||
int[] array = new int[this.maxLength];
|
||||
int num2 = 0;
|
||||
this.codes = new short[this.freqs.Length];
|
||||
for (int i = 0; i < this.maxLength; i++)
|
||||
{
|
||||
array[i] = num2;
|
||||
num2 += this.bl_counts[i] << 15 - i;
|
||||
}
|
||||
for (int j = 0; j < this.numCodes; j++)
|
||||
{
|
||||
int num3 = (int)this.length[j];
|
||||
if (num3 > 0)
|
||||
{
|
||||
this.codes[j] = DeflaterHuffman.BitReverse(array[num3 - 1]);
|
||||
array[num3 - 1] += 1 << 16 - num3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060002B5 RID: 693 RVA: 0x0000EB20 File Offset: 0x0000DB20
|
||||
public void BuildTree()
|
||||
{
|
||||
int num = this.freqs.Length;
|
||||
int[] array = new int[num];
|
||||
int i = 0;
|
||||
int num2 = 0;
|
||||
for (int j = 0; j < num; j++)
|
||||
{
|
||||
int num3 = (int)this.freqs[j];
|
||||
if (num3 != 0)
|
||||
{
|
||||
int num4 = i++;
|
||||
int num5;
|
||||
while (num4 > 0 && (int)this.freqs[array[num5 = (num4 - 1) / 2]] > num3)
|
||||
{
|
||||
array[num4] = array[num5];
|
||||
num4 = num5;
|
||||
}
|
||||
array[num4] = j;
|
||||
num2 = j;
|
||||
}
|
||||
}
|
||||
while (i < 2)
|
||||
{
|
||||
int num6 = ((num2 < 2) ? (++num2) : 0);
|
||||
array[i++] = num6;
|
||||
}
|
||||
this.numCodes = Math.Max(num2 + 1, this.minNumCodes);
|
||||
int num7 = i;
|
||||
int[] array2 = new int[4 * i - 2];
|
||||
int[] array3 = new int[2 * i - 1];
|
||||
int num8 = num7;
|
||||
for (int k = 0; k < i; k++)
|
||||
{
|
||||
int num9 = array[k];
|
||||
array2[2 * k] = num9;
|
||||
array2[2 * k + 1] = -1;
|
||||
array3[k] = (int)this.freqs[num9] << 8;
|
||||
array[k] = k;
|
||||
}
|
||||
do
|
||||
{
|
||||
int num10 = array[0];
|
||||
int num11 = array[--i];
|
||||
int num12 = 0;
|
||||
int l;
|
||||
for (l = 1; l < i; l = l * 2 + 1)
|
||||
{
|
||||
if (l + 1 < i && array3[array[l]] > array3[array[l + 1]])
|
||||
{
|
||||
l++;
|
||||
}
|
||||
array[num12] = array[l];
|
||||
num12 = l;
|
||||
}
|
||||
int num13 = array3[num11];
|
||||
while ((l = num12) > 0 && array3[array[num12 = (l - 1) / 2]] > num13)
|
||||
{
|
||||
array[l] = array[num12];
|
||||
}
|
||||
array[l] = num11;
|
||||
int num14 = array[0];
|
||||
num11 = num8++;
|
||||
array2[2 * num11] = num10;
|
||||
array2[2 * num11 + 1] = num14;
|
||||
int num15 = Math.Min(array3[num10] & 255, array3[num14] & 255);
|
||||
num13 = (array3[num11] = array3[num10] + array3[num14] - num15 + 1);
|
||||
num12 = 0;
|
||||
for (l = 1; l < i; l = num12 * 2 + 1)
|
||||
{
|
||||
if (l + 1 < i && array3[array[l]] > array3[array[l + 1]])
|
||||
{
|
||||
l++;
|
||||
}
|
||||
array[num12] = array[l];
|
||||
num12 = l;
|
||||
}
|
||||
while ((l = num12) > 0 && array3[array[num12 = (l - 1) / 2]] > num13)
|
||||
{
|
||||
array[l] = array[num12];
|
||||
}
|
||||
array[l] = num11;
|
||||
}
|
||||
while (i > 1);
|
||||
if (array[0] != array2.Length / 2 - 1)
|
||||
{
|
||||
throw new SharpZipBaseException("Heap invariant violated");
|
||||
}
|
||||
this.BuildLength(array2);
|
||||
}
|
||||
|
||||
// Token: 0x060002B6 RID: 694 RVA: 0x0000ED90 File Offset: 0x0000DD90
|
||||
public int GetEncodedLength()
|
||||
{
|
||||
int num = 0;
|
||||
for (int i = 0; i < this.freqs.Length; i++)
|
||||
{
|
||||
num += (int)(this.freqs[i] * (short)this.length[i]);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x060002B7 RID: 695 RVA: 0x0000EDC8 File Offset: 0x0000DDC8
|
||||
public void CalcBLFreq(DeflaterHuffman.Tree blTree)
|
||||
{
|
||||
int num = -1;
|
||||
int i = 0;
|
||||
while (i < this.numCodes)
|
||||
{
|
||||
int num2 = 1;
|
||||
int num3 = (int)this.length[i];
|
||||
int num4;
|
||||
int num5;
|
||||
if (num3 == 0)
|
||||
{
|
||||
num4 = 138;
|
||||
num5 = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
num4 = 6;
|
||||
num5 = 3;
|
||||
if (num != num3)
|
||||
{
|
||||
short[] array = blTree.freqs;
|
||||
int num6 = num3;
|
||||
array[num6] += 1;
|
||||
num2 = 0;
|
||||
}
|
||||
}
|
||||
num = num3;
|
||||
i++;
|
||||
while (i < this.numCodes && num == (int)this.length[i])
|
||||
{
|
||||
i++;
|
||||
if (++num2 >= num4)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (num2 < num5)
|
||||
{
|
||||
short[] array2 = blTree.freqs;
|
||||
int num7 = num;
|
||||
array2[num7] += (short)num2;
|
||||
}
|
||||
else if (num != 0)
|
||||
{
|
||||
short[] array3 = blTree.freqs;
|
||||
int num8 = 16;
|
||||
array3[num8] += 1;
|
||||
}
|
||||
else if (num2 <= 10)
|
||||
{
|
||||
short[] array4 = blTree.freqs;
|
||||
int num9 = 17;
|
||||
array4[num9] += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
short[] array5 = blTree.freqs;
|
||||
int num10 = 18;
|
||||
array5[num10] += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060002B8 RID: 696 RVA: 0x0000EEDC File Offset: 0x0000DEDC
|
||||
public void WriteTree(DeflaterHuffman.Tree blTree)
|
||||
{
|
||||
int num = -1;
|
||||
int i = 0;
|
||||
while (i < this.numCodes)
|
||||
{
|
||||
int num2 = 1;
|
||||
int num3 = (int)this.length[i];
|
||||
int num4;
|
||||
int num5;
|
||||
if (num3 == 0)
|
||||
{
|
||||
num4 = 138;
|
||||
num5 = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
num4 = 6;
|
||||
num5 = 3;
|
||||
if (num != num3)
|
||||
{
|
||||
blTree.WriteSymbol(num3);
|
||||
num2 = 0;
|
||||
}
|
||||
}
|
||||
num = num3;
|
||||
i++;
|
||||
while (i < this.numCodes && num == (int)this.length[i])
|
||||
{
|
||||
i++;
|
||||
if (++num2 >= num4)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (num2 < num5)
|
||||
{
|
||||
while (num2-- > 0)
|
||||
{
|
||||
blTree.WriteSymbol(num);
|
||||
}
|
||||
}
|
||||
else if (num != 0)
|
||||
{
|
||||
blTree.WriteSymbol(16);
|
||||
this.dh.pending.WriteBits(num2 - 3, 2);
|
||||
}
|
||||
else if (num2 <= 10)
|
||||
{
|
||||
blTree.WriteSymbol(17);
|
||||
this.dh.pending.WriteBits(num2 - 3, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
blTree.WriteSymbol(18);
|
||||
this.dh.pending.WriteBits(num2 - 11, 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060002B9 RID: 697 RVA: 0x0000EFD8 File Offset: 0x0000DFD8
|
||||
private void BuildLength(int[] childs)
|
||||
{
|
||||
this.length = new byte[this.freqs.Length];
|
||||
int num = childs.Length / 2;
|
||||
int num2 = (num + 1) / 2;
|
||||
int num3 = 0;
|
||||
for (int i = 0; i < this.maxLength; i++)
|
||||
{
|
||||
this.bl_counts[i] = 0;
|
||||
}
|
||||
int[] array = new int[num];
|
||||
array[num - 1] = 0;
|
||||
for (int j = num - 1; j >= 0; j--)
|
||||
{
|
||||
if (childs[2 * j + 1] != -1)
|
||||
{
|
||||
int num4 = array[j] + 1;
|
||||
if (num4 > this.maxLength)
|
||||
{
|
||||
num4 = this.maxLength;
|
||||
num3++;
|
||||
}
|
||||
array[childs[2 * j]] = (array[childs[2 * j + 1]] = num4);
|
||||
}
|
||||
else
|
||||
{
|
||||
int num5 = array[j];
|
||||
this.bl_counts[num5 - 1]++;
|
||||
this.length[childs[2 * j]] = (byte)array[j];
|
||||
}
|
||||
}
|
||||
if (num3 == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int num6 = this.maxLength - 1;
|
||||
for (;;)
|
||||
{
|
||||
if (this.bl_counts[--num6] != 0)
|
||||
{
|
||||
do
|
||||
{
|
||||
this.bl_counts[num6]--;
|
||||
this.bl_counts[++num6]++;
|
||||
num3 -= 1 << this.maxLength - 1 - num6;
|
||||
}
|
||||
while (num3 > 0 && num6 < this.maxLength - 1);
|
||||
if (num3 <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.bl_counts[this.maxLength - 1] += num3;
|
||||
this.bl_counts[this.maxLength - 2] -= num3;
|
||||
int num7 = 2 * num2;
|
||||
for (int num8 = this.maxLength; num8 != 0; num8--)
|
||||
{
|
||||
int k = this.bl_counts[num8 - 1];
|
||||
while (k > 0)
|
||||
{
|
||||
int num9 = 2 * childs[num7++];
|
||||
if (childs[num9 + 1] == -1)
|
||||
{
|
||||
this.length[childs[num9]] = (byte)num8;
|
||||
k--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040001BC RID: 444
|
||||
public short[] freqs;
|
||||
|
||||
// Token: 0x040001BD RID: 445
|
||||
public byte[] length;
|
||||
|
||||
// Token: 0x040001BE RID: 446
|
||||
public int minNumCodes;
|
||||
|
||||
// Token: 0x040001BF RID: 447
|
||||
public int numCodes;
|
||||
|
||||
// Token: 0x040001C0 RID: 448
|
||||
private short[] codes;
|
||||
|
||||
// Token: 0x040001C1 RID: 449
|
||||
private int[] bl_counts;
|
||||
|
||||
// Token: 0x040001C2 RID: 450
|
||||
private int maxLength;
|
||||
|
||||
// Token: 0x040001C3 RID: 451
|
||||
private DeflaterHuffman dh;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression
|
||||
{
|
||||
// Token: 0x02000046 RID: 70
|
||||
public class DeflaterPending : PendingBuffer
|
||||
{
|
||||
// Token: 0x060002C8 RID: 712 RVA: 0x0000F595 File Offset: 0x0000E595
|
||||
public DeflaterPending()
|
||||
: base(65536)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,631 @@
|
||||
using System;
|
||||
using ICSharpCode.SharpZipLib.Checksums;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression
|
||||
{
|
||||
// Token: 0x02000047 RID: 71
|
||||
public class Inflater
|
||||
{
|
||||
// Token: 0x060002C9 RID: 713 RVA: 0x0000F5A2 File Offset: 0x0000E5A2
|
||||
public Inflater()
|
||||
: this(false)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060002CA RID: 714 RVA: 0x0000F5AB File Offset: 0x0000E5AB
|
||||
public Inflater(bool noHeader)
|
||||
{
|
||||
this.noHeader = noHeader;
|
||||
this.adler = new Adler32();
|
||||
this.input = new StreamManipulator();
|
||||
this.outputWindow = new OutputWindow();
|
||||
this.mode = (noHeader ? 2 : 0);
|
||||
}
|
||||
|
||||
// Token: 0x060002CB RID: 715 RVA: 0x0000F5E8 File Offset: 0x0000E5E8
|
||||
public void Reset()
|
||||
{
|
||||
this.mode = (this.noHeader ? 2 : 0);
|
||||
this.totalIn = 0L;
|
||||
this.totalOut = 0L;
|
||||
this.input.Reset();
|
||||
this.outputWindow.Reset();
|
||||
this.dynHeader = null;
|
||||
this.litlenTree = null;
|
||||
this.distTree = null;
|
||||
this.isLastBlock = false;
|
||||
this.adler.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x060002CC RID: 716 RVA: 0x0000F654 File Offset: 0x0000E654
|
||||
private bool DecodeHeader()
|
||||
{
|
||||
int num = this.input.PeekBits(16);
|
||||
if (num < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.input.DropBits(16);
|
||||
num = ((num << 8) | (num >> 8)) & 65535;
|
||||
if (num % 31 != 0)
|
||||
{
|
||||
throw new SharpZipBaseException("Header checksum illegal");
|
||||
}
|
||||
if ((num & 3840) != 2048)
|
||||
{
|
||||
throw new SharpZipBaseException("Compression Method unknown");
|
||||
}
|
||||
if ((num & 32) == 0)
|
||||
{
|
||||
this.mode = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.mode = 1;
|
||||
this.neededBits = 32;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x060002CD RID: 717 RVA: 0x0000F6DC File Offset: 0x0000E6DC
|
||||
private bool DecodeDict()
|
||||
{
|
||||
while (this.neededBits > 0)
|
||||
{
|
||||
int num = this.input.PeekBits(8);
|
||||
if (num < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.input.DropBits(8);
|
||||
this.readAdler = (this.readAdler << 8) | num;
|
||||
this.neededBits -= 8;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x060002CE RID: 718 RVA: 0x0000F734 File Offset: 0x0000E734
|
||||
private bool DecodeHuffman()
|
||||
{
|
||||
int i = this.outputWindow.GetFreeSpace();
|
||||
while (i >= 258)
|
||||
{
|
||||
int num;
|
||||
switch (this.mode)
|
||||
{
|
||||
case 7:
|
||||
while (((num = this.litlenTree.GetSymbol(this.input)) & -256) == 0)
|
||||
{
|
||||
this.outputWindow.Write(num);
|
||||
if (--i < 258)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (num >= 257)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.repLength = Inflater.CPLENS[num - 257];
|
||||
this.neededBits = Inflater.CPLEXT[num - 257];
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new SharpZipBaseException("Illegal rep length code");
|
||||
}
|
||||
goto IL_C5;
|
||||
}
|
||||
if (num < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.distTree = null;
|
||||
this.litlenTree = null;
|
||||
this.mode = 2;
|
||||
return true;
|
||||
case 8:
|
||||
goto IL_C5;
|
||||
case 9:
|
||||
goto IL_114;
|
||||
case 10:
|
||||
break;
|
||||
default:
|
||||
throw new SharpZipBaseException("Inflater unknown mode");
|
||||
}
|
||||
IL_154:
|
||||
if (this.neededBits > 0)
|
||||
{
|
||||
this.mode = 10;
|
||||
int num2 = this.input.PeekBits(this.neededBits);
|
||||
if (num2 < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.input.DropBits(this.neededBits);
|
||||
this.repDist += num2;
|
||||
}
|
||||
this.outputWindow.Repeat(this.repLength, this.repDist);
|
||||
i -= this.repLength;
|
||||
this.mode = 7;
|
||||
continue;
|
||||
IL_114:
|
||||
num = this.distTree.GetSymbol(this.input);
|
||||
if (num < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
this.repDist = Inflater.CPDIST[num];
|
||||
this.neededBits = Inflater.CPDEXT[num];
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new SharpZipBaseException("Illegal rep dist code");
|
||||
}
|
||||
goto IL_154;
|
||||
IL_C5:
|
||||
if (this.neededBits > 0)
|
||||
{
|
||||
this.mode = 8;
|
||||
int num3 = this.input.PeekBits(this.neededBits);
|
||||
if (num3 < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.input.DropBits(this.neededBits);
|
||||
this.repLength += num3;
|
||||
}
|
||||
this.mode = 9;
|
||||
goto IL_114;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x060002CF RID: 719 RVA: 0x0000F93C File Offset: 0x0000E93C
|
||||
private bool DecodeChksum()
|
||||
{
|
||||
while (this.neededBits > 0)
|
||||
{
|
||||
int num = this.input.PeekBits(8);
|
||||
if (num < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.input.DropBits(8);
|
||||
this.readAdler = (this.readAdler << 8) | num;
|
||||
this.neededBits -= 8;
|
||||
}
|
||||
if ((int)this.adler.Value != this.readAdler)
|
||||
{
|
||||
throw new SharpZipBaseException(string.Concat(new object[]
|
||||
{
|
||||
"Adler chksum doesn't match: ",
|
||||
(int)this.adler.Value,
|
||||
" vs. ",
|
||||
this.readAdler
|
||||
}));
|
||||
}
|
||||
this.mode = 12;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x060002D0 RID: 720 RVA: 0x0000F9F4 File Offset: 0x0000E9F4
|
||||
private bool Decode()
|
||||
{
|
||||
switch (this.mode)
|
||||
{
|
||||
case 0:
|
||||
return this.DecodeHeader();
|
||||
case 1:
|
||||
return this.DecodeDict();
|
||||
case 2:
|
||||
if (this.isLastBlock)
|
||||
{
|
||||
if (this.noHeader)
|
||||
{
|
||||
this.mode = 12;
|
||||
return false;
|
||||
}
|
||||
this.input.SkipToByteBoundary();
|
||||
this.neededBits = 32;
|
||||
this.mode = 11;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = this.input.PeekBits(3);
|
||||
if (num < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.input.DropBits(3);
|
||||
if ((num & 1) != 0)
|
||||
{
|
||||
this.isLastBlock = true;
|
||||
}
|
||||
switch (num >> 1)
|
||||
{
|
||||
case 0:
|
||||
this.input.SkipToByteBoundary();
|
||||
this.mode = 3;
|
||||
break;
|
||||
case 1:
|
||||
this.litlenTree = InflaterHuffmanTree.defLitLenTree;
|
||||
this.distTree = InflaterHuffmanTree.defDistTree;
|
||||
this.mode = 7;
|
||||
break;
|
||||
case 2:
|
||||
this.dynHeader = new InflaterDynHeader();
|
||||
this.mode = 6;
|
||||
break;
|
||||
default:
|
||||
throw new SharpZipBaseException("Unknown block type " + num);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ((this.uncomprLen = this.input.PeekBits(16)) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.input.DropBits(16);
|
||||
this.mode = 4;
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
case 5:
|
||||
goto IL_1A9;
|
||||
case 6:
|
||||
if (!this.dynHeader.Decode(this.input))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.litlenTree = this.dynHeader.BuildLitLenTree();
|
||||
this.distTree = this.dynHeader.BuildDistTree();
|
||||
this.mode = 7;
|
||||
goto IL_22D;
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
goto IL_22D;
|
||||
case 11:
|
||||
return this.DecodeChksum();
|
||||
case 12:
|
||||
return false;
|
||||
default:
|
||||
throw new SharpZipBaseException("Inflater.Decode unknown mode");
|
||||
}
|
||||
int num2 = this.input.PeekBits(16);
|
||||
if (num2 < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.input.DropBits(16);
|
||||
if (num2 != (this.uncomprLen ^ 65535))
|
||||
{
|
||||
throw new SharpZipBaseException("broken uncompressed block");
|
||||
}
|
||||
this.mode = 5;
|
||||
IL_1A9:
|
||||
int num3 = this.outputWindow.CopyStored(this.input, this.uncomprLen);
|
||||
this.uncomprLen -= num3;
|
||||
if (this.uncomprLen == 0)
|
||||
{
|
||||
this.mode = 2;
|
||||
return true;
|
||||
}
|
||||
return !this.input.IsNeedingInput;
|
||||
IL_22D:
|
||||
return this.DecodeHuffman();
|
||||
}
|
||||
|
||||
// Token: 0x060002D1 RID: 721 RVA: 0x0000FC41 File Offset: 0x0000EC41
|
||||
public void SetDictionary(byte[] buffer)
|
||||
{
|
||||
this.SetDictionary(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
// Token: 0x060002D2 RID: 722 RVA: 0x0000FC50 File Offset: 0x0000EC50
|
||||
public void SetDictionary(byte[] buffer, int index, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
if (!this.IsNeedingDictionary)
|
||||
{
|
||||
throw new InvalidOperationException("Dictionary is not needed");
|
||||
}
|
||||
this.adler.Update(buffer, index, count);
|
||||
if ((int)this.adler.Value != this.readAdler)
|
||||
{
|
||||
throw new SharpZipBaseException("Wrong adler checksum");
|
||||
}
|
||||
this.adler.Reset();
|
||||
this.outputWindow.CopyDict(buffer, index, count);
|
||||
this.mode = 2;
|
||||
}
|
||||
|
||||
// Token: 0x060002D3 RID: 723 RVA: 0x0000FCE9 File Offset: 0x0000ECE9
|
||||
public void SetInput(byte[] buffer)
|
||||
{
|
||||
this.SetInput(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
// Token: 0x060002D4 RID: 724 RVA: 0x0000FCF6 File Offset: 0x0000ECF6
|
||||
public void SetInput(byte[] buffer, int index, int count)
|
||||
{
|
||||
this.input.SetInput(buffer, index, count);
|
||||
this.totalIn += (long)count;
|
||||
}
|
||||
|
||||
// Token: 0x060002D5 RID: 725 RVA: 0x0000FD15 File Offset: 0x0000ED15
|
||||
public int Inflate(byte[] buffer)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
return this.Inflate(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
// Token: 0x060002D6 RID: 726 RVA: 0x0000FD30 File Offset: 0x0000ED30
|
||||
public int Inflate(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "count cannot be negative");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "offset cannot be negative");
|
||||
}
|
||||
if (offset + count > buffer.Length)
|
||||
{
|
||||
throw new ArgumentException("count exceeds buffer bounds");
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
if (!this.IsFinished)
|
||||
{
|
||||
this.Decode();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int num = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (this.mode != 11)
|
||||
{
|
||||
int num2 = this.outputWindow.CopyOutput(buffer, offset, count);
|
||||
if (num2 > 0)
|
||||
{
|
||||
this.adler.Update(buffer, offset, num2);
|
||||
offset += num2;
|
||||
num += num2;
|
||||
this.totalOut += (long)num2;
|
||||
count -= num2;
|
||||
if (count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.Decode() && (this.outputWindow.GetAvailable() <= 0 || this.mode == 11))
|
||||
{
|
||||
return num;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x17000096 RID: 150
|
||||
// (get) Token: 0x060002D7 RID: 727 RVA: 0x0000FE0A File Offset: 0x0000EE0A
|
||||
public bool IsNeedingInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.input.IsNeedingInput;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000097 RID: 151
|
||||
// (get) Token: 0x060002D8 RID: 728 RVA: 0x0000FE17 File Offset: 0x0000EE17
|
||||
public bool IsNeedingDictionary
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mode == 1 && this.neededBits == 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000098 RID: 152
|
||||
// (get) Token: 0x060002D9 RID: 729 RVA: 0x0000FE2D File Offset: 0x0000EE2D
|
||||
public bool IsFinished
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mode == 12 && this.outputWindow.GetAvailable() == 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000099 RID: 153
|
||||
// (get) Token: 0x060002DA RID: 730 RVA: 0x0000FE49 File Offset: 0x0000EE49
|
||||
public int Adler
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!this.IsNeedingDictionary)
|
||||
{
|
||||
return (int)this.adler.Value;
|
||||
}
|
||||
return this.readAdler;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700009A RID: 154
|
||||
// (get) Token: 0x060002DB RID: 731 RVA: 0x0000FE66 File Offset: 0x0000EE66
|
||||
public long TotalOut
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.totalOut;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700009B RID: 155
|
||||
// (get) Token: 0x060002DC RID: 732 RVA: 0x0000FE6E File Offset: 0x0000EE6E
|
||||
public long TotalIn
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.totalIn - (long)this.RemainingInput;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700009C RID: 156
|
||||
// (get) Token: 0x060002DD RID: 733 RVA: 0x0000FE7E File Offset: 0x0000EE7E
|
||||
public int RemainingInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.input.AvailableBytes;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040001C9 RID: 457
|
||||
private const int DECODE_HEADER = 0;
|
||||
|
||||
// Token: 0x040001CA RID: 458
|
||||
private const int DECODE_DICT = 1;
|
||||
|
||||
// Token: 0x040001CB RID: 459
|
||||
private const int DECODE_BLOCKS = 2;
|
||||
|
||||
// Token: 0x040001CC RID: 460
|
||||
private const int DECODE_STORED_LEN1 = 3;
|
||||
|
||||
// Token: 0x040001CD RID: 461
|
||||
private const int DECODE_STORED_LEN2 = 4;
|
||||
|
||||
// Token: 0x040001CE RID: 462
|
||||
private const int DECODE_STORED = 5;
|
||||
|
||||
// Token: 0x040001CF RID: 463
|
||||
private const int DECODE_DYN_HEADER = 6;
|
||||
|
||||
// Token: 0x040001D0 RID: 464
|
||||
private const int DECODE_HUFFMAN = 7;
|
||||
|
||||
// Token: 0x040001D1 RID: 465
|
||||
private const int DECODE_HUFFMAN_LENBITS = 8;
|
||||
|
||||
// Token: 0x040001D2 RID: 466
|
||||
private const int DECODE_HUFFMAN_DIST = 9;
|
||||
|
||||
// Token: 0x040001D3 RID: 467
|
||||
private const int DECODE_HUFFMAN_DISTBITS = 10;
|
||||
|
||||
// Token: 0x040001D4 RID: 468
|
||||
private const int DECODE_CHKSUM = 11;
|
||||
|
||||
// Token: 0x040001D5 RID: 469
|
||||
private const int FINISHED = 12;
|
||||
|
||||
// Token: 0x040001D6 RID: 470
|
||||
private static readonly int[] CPLENS = new int[]
|
||||
{
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13,
|
||||
15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
|
||||
67, 83, 99, 115, 131, 163, 195, 227, 258
|
||||
};
|
||||
|
||||
// Token: 0x040001D7 RID: 471
|
||||
private static readonly int[] CPLEXT = new int[]
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
|
||||
1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
|
||||
4, 4, 4, 4, 5, 5, 5, 5, 0
|
||||
};
|
||||
|
||||
// Token: 0x040001D8 RID: 472
|
||||
private static readonly int[] CPDIST = new int[]
|
||||
{
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25,
|
||||
33, 49, 65, 97, 129, 193, 257, 385, 513, 769,
|
||||
1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577
|
||||
};
|
||||
|
||||
// Token: 0x040001D9 RID: 473
|
||||
private static readonly int[] CPDEXT = new int[]
|
||||
{
|
||||
0, 0, 0, 0, 1, 1, 2, 2, 3, 3,
|
||||
4, 4, 5, 5, 6, 6, 7, 7, 8, 8,
|
||||
9, 9, 10, 10, 11, 11, 12, 12, 13, 13
|
||||
};
|
||||
|
||||
// Token: 0x040001DA RID: 474
|
||||
private int mode;
|
||||
|
||||
// Token: 0x040001DB RID: 475
|
||||
private int readAdler;
|
||||
|
||||
// Token: 0x040001DC RID: 476
|
||||
private int neededBits;
|
||||
|
||||
// Token: 0x040001DD RID: 477
|
||||
private int repLength;
|
||||
|
||||
// Token: 0x040001DE RID: 478
|
||||
private int repDist;
|
||||
|
||||
// Token: 0x040001DF RID: 479
|
||||
private int uncomprLen;
|
||||
|
||||
// Token: 0x040001E0 RID: 480
|
||||
private bool isLastBlock;
|
||||
|
||||
// Token: 0x040001E1 RID: 481
|
||||
private long totalOut;
|
||||
|
||||
// Token: 0x040001E2 RID: 482
|
||||
private long totalIn;
|
||||
|
||||
// Token: 0x040001E3 RID: 483
|
||||
private bool noHeader;
|
||||
|
||||
// Token: 0x040001E4 RID: 484
|
||||
private StreamManipulator input;
|
||||
|
||||
// Token: 0x040001E5 RID: 485
|
||||
private OutputWindow outputWindow;
|
||||
|
||||
// Token: 0x040001E6 RID: 486
|
||||
private InflaterDynHeader dynHeader;
|
||||
|
||||
// Token: 0x040001E7 RID: 487
|
||||
private InflaterHuffmanTree litlenTree;
|
||||
|
||||
// Token: 0x040001E8 RID: 488
|
||||
private InflaterHuffmanTree distTree;
|
||||
|
||||
// Token: 0x040001E9 RID: 489
|
||||
private Adler32 adler;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
using System;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression
|
||||
{
|
||||
// Token: 0x02000048 RID: 72
|
||||
internal class InflaterDynHeader
|
||||
{
|
||||
// Token: 0x060002E0 RID: 736 RVA: 0x000100E4 File Offset: 0x0000F0E4
|
||||
public bool Decode(StreamManipulator input)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
switch (this.mode)
|
||||
{
|
||||
case 0:
|
||||
this.lnum = input.PeekBits(5);
|
||||
if (this.lnum < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.lnum += 257;
|
||||
input.DropBits(5);
|
||||
this.mode = 1;
|
||||
goto IL_61;
|
||||
case 1:
|
||||
goto IL_61;
|
||||
case 2:
|
||||
goto IL_B9;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
goto IL_1A8;
|
||||
case 5:
|
||||
goto IL_1EE;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
IL_13B:
|
||||
while (this.ptr < this.blnum)
|
||||
{
|
||||
int num = input.PeekBits(3);
|
||||
if (num < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
input.DropBits(3);
|
||||
this.blLens[InflaterDynHeader.BL_ORDER[this.ptr]] = (byte)num;
|
||||
this.ptr++;
|
||||
}
|
||||
this.blTree = new InflaterHuffmanTree(this.blLens);
|
||||
this.blLens = null;
|
||||
this.ptr = 0;
|
||||
this.mode = 4;
|
||||
IL_1A8:
|
||||
int symbol;
|
||||
while (((symbol = this.blTree.GetSymbol(input)) & -16) == 0)
|
||||
{
|
||||
this.litdistLens[this.ptr++] = (this.lastLen = (byte)symbol);
|
||||
if (this.ptr == this.num)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (symbol < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (symbol >= 17)
|
||||
{
|
||||
this.lastLen = 0;
|
||||
}
|
||||
else if (this.ptr == 0)
|
||||
{
|
||||
goto Block_10;
|
||||
}
|
||||
this.repSymbol = symbol - 16;
|
||||
this.mode = 5;
|
||||
IL_1EE:
|
||||
int num2 = InflaterDynHeader.repBits[this.repSymbol];
|
||||
int num3 = input.PeekBits(num2);
|
||||
if (num3 < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
input.DropBits(num2);
|
||||
num3 += InflaterDynHeader.repMin[this.repSymbol];
|
||||
if (this.ptr + num3 > this.num)
|
||||
{
|
||||
goto Block_12;
|
||||
}
|
||||
while (num3-- > 0)
|
||||
{
|
||||
this.litdistLens[this.ptr++] = this.lastLen;
|
||||
}
|
||||
if (this.ptr == this.num)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
this.mode = 4;
|
||||
continue;
|
||||
IL_B9:
|
||||
this.blnum = input.PeekBits(4);
|
||||
if (this.blnum < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.blnum += 4;
|
||||
input.DropBits(4);
|
||||
this.blLens = new byte[19];
|
||||
this.ptr = 0;
|
||||
this.mode = 3;
|
||||
goto IL_13B;
|
||||
IL_61:
|
||||
this.dnum = input.PeekBits(5);
|
||||
if (this.dnum < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.dnum++;
|
||||
input.DropBits(5);
|
||||
this.num = this.lnum + this.dnum;
|
||||
this.litdistLens = new byte[this.num];
|
||||
this.mode = 2;
|
||||
goto IL_B9;
|
||||
}
|
||||
return false;
|
||||
Block_10:
|
||||
throw new SharpZipBaseException();
|
||||
Block_12:
|
||||
throw new SharpZipBaseException();
|
||||
}
|
||||
|
||||
// Token: 0x060002E1 RID: 737 RVA: 0x0001036C File Offset: 0x0000F36C
|
||||
public InflaterHuffmanTree BuildLitLenTree()
|
||||
{
|
||||
byte[] array = new byte[this.lnum];
|
||||
Array.Copy(this.litdistLens, 0, array, 0, this.lnum);
|
||||
return new InflaterHuffmanTree(array);
|
||||
}
|
||||
|
||||
// Token: 0x060002E2 RID: 738 RVA: 0x000103A0 File Offset: 0x0000F3A0
|
||||
public InflaterHuffmanTree BuildDistTree()
|
||||
{
|
||||
byte[] array = new byte[this.dnum];
|
||||
Array.Copy(this.litdistLens, this.lnum, array, 0, this.dnum);
|
||||
return new InflaterHuffmanTree(array);
|
||||
}
|
||||
|
||||
// Token: 0x040001EA RID: 490
|
||||
private const int LNUM = 0;
|
||||
|
||||
// Token: 0x040001EB RID: 491
|
||||
private const int DNUM = 1;
|
||||
|
||||
// Token: 0x040001EC RID: 492
|
||||
private const int BLNUM = 2;
|
||||
|
||||
// Token: 0x040001ED RID: 493
|
||||
private const int BLLENS = 3;
|
||||
|
||||
// Token: 0x040001EE RID: 494
|
||||
private const int LENS = 4;
|
||||
|
||||
// Token: 0x040001EF RID: 495
|
||||
private const int REPS = 5;
|
||||
|
||||
// Token: 0x040001F0 RID: 496
|
||||
private static readonly int[] repMin = new int[] { 3, 3, 11 };
|
||||
|
||||
// Token: 0x040001F1 RID: 497
|
||||
private static readonly int[] repBits = new int[] { 2, 3, 7 };
|
||||
|
||||
// Token: 0x040001F2 RID: 498
|
||||
private static readonly int[] BL_ORDER = new int[]
|
||||
{
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5,
|
||||
11, 4, 12, 3, 13, 2, 14, 1, 15
|
||||
};
|
||||
|
||||
// Token: 0x040001F3 RID: 499
|
||||
private byte[] blLens;
|
||||
|
||||
// Token: 0x040001F4 RID: 500
|
||||
private byte[] litdistLens;
|
||||
|
||||
// Token: 0x040001F5 RID: 501
|
||||
private InflaterHuffmanTree blTree;
|
||||
|
||||
// Token: 0x040001F6 RID: 502
|
||||
private int mode;
|
||||
|
||||
// Token: 0x040001F7 RID: 503
|
||||
private int lnum;
|
||||
|
||||
// Token: 0x040001F8 RID: 504
|
||||
private int dnum;
|
||||
|
||||
// Token: 0x040001F9 RID: 505
|
||||
private int blnum;
|
||||
|
||||
// Token: 0x040001FA RID: 506
|
||||
private int num;
|
||||
|
||||
// Token: 0x040001FB RID: 507
|
||||
private int repSymbol;
|
||||
|
||||
// Token: 0x040001FC RID: 508
|
||||
private byte lastLen;
|
||||
|
||||
// Token: 0x040001FD RID: 509
|
||||
private int ptr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression
|
||||
{
|
||||
// Token: 0x02000049 RID: 73
|
||||
public class InflaterHuffmanTree
|
||||
{
|
||||
// Token: 0x060002E4 RID: 740 RVA: 0x00010494 File Offset: 0x0000F494
|
||||
static InflaterHuffmanTree()
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] array = new byte[288];
|
||||
int i = 0;
|
||||
while (i < 144)
|
||||
{
|
||||
array[i++] = 8;
|
||||
}
|
||||
while (i < 256)
|
||||
{
|
||||
array[i++] = 9;
|
||||
}
|
||||
while (i < 280)
|
||||
{
|
||||
array[i++] = 7;
|
||||
}
|
||||
while (i < 288)
|
||||
{
|
||||
array[i++] = 8;
|
||||
}
|
||||
InflaterHuffmanTree.defLitLenTree = new InflaterHuffmanTree(array);
|
||||
array = new byte[32];
|
||||
i = 0;
|
||||
while (i < 32)
|
||||
{
|
||||
array[i++] = 5;
|
||||
}
|
||||
InflaterHuffmanTree.defDistTree = new InflaterHuffmanTree(array);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new SharpZipBaseException("InflaterHuffmanTree: static tree length illegal");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060002E5 RID: 741 RVA: 0x00010544 File Offset: 0x0000F544
|
||||
public InflaterHuffmanTree(byte[] codeLengths)
|
||||
{
|
||||
this.BuildTree(codeLengths);
|
||||
}
|
||||
|
||||
// Token: 0x060002E6 RID: 742 RVA: 0x00010554 File Offset: 0x0000F554
|
||||
private void BuildTree(byte[] codeLengths)
|
||||
{
|
||||
int[] array = new int[16];
|
||||
int[] array2 = new int[16];
|
||||
foreach (int num in codeLengths)
|
||||
{
|
||||
if (num > 0)
|
||||
{
|
||||
array[num]++;
|
||||
}
|
||||
}
|
||||
int num2 = 0;
|
||||
int num3 = 512;
|
||||
for (int j = 1; j <= 15; j++)
|
||||
{
|
||||
array2[j] = num2;
|
||||
num2 += array[j] << 16 - j;
|
||||
if (j >= 10)
|
||||
{
|
||||
int num4 = array2[j] & 130944;
|
||||
int num5 = num2 & 130944;
|
||||
num3 += num5 - num4 >> 16 - j;
|
||||
}
|
||||
}
|
||||
this.tree = new short[num3];
|
||||
int num6 = 512;
|
||||
for (int k = 15; k >= 10; k--)
|
||||
{
|
||||
int num7 = num2 & 130944;
|
||||
num2 -= array[k] << 16 - k;
|
||||
int num8 = num2 & 130944;
|
||||
for (int l = num8; l < num7; l += 128)
|
||||
{
|
||||
this.tree[(int)DeflaterHuffman.BitReverse(l)] = (short)((-num6 << 4) | k);
|
||||
num6 += 1 << k - 9;
|
||||
}
|
||||
}
|
||||
for (int m = 0; m < codeLengths.Length; m++)
|
||||
{
|
||||
int num9 = (int)codeLengths[m];
|
||||
if (num9 != 0)
|
||||
{
|
||||
num2 = array2[num9];
|
||||
int num10 = (int)DeflaterHuffman.BitReverse(num2);
|
||||
if (num9 <= 9)
|
||||
{
|
||||
do
|
||||
{
|
||||
this.tree[num10] = (short)((m << 4) | num9);
|
||||
num10 += 1 << num9;
|
||||
}
|
||||
while (num10 < 512);
|
||||
}
|
||||
else
|
||||
{
|
||||
int num11 = (int)this.tree[num10 & 511];
|
||||
int num12 = 1 << (num11 & 15);
|
||||
num11 = -(num11 >> 4);
|
||||
do
|
||||
{
|
||||
this.tree[num11 | (num10 >> 9)] = (short)((m << 4) | num9);
|
||||
num10 += 1 << num9;
|
||||
}
|
||||
while (num10 < num12);
|
||||
}
|
||||
array2[num9] = num2 + (1 << 16 - num9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060002E7 RID: 743 RVA: 0x00010748 File Offset: 0x0000F748
|
||||
public int GetSymbol(StreamManipulator input)
|
||||
{
|
||||
int num;
|
||||
if ((num = input.PeekBits(9)) >= 0)
|
||||
{
|
||||
int num2;
|
||||
if ((num2 = (int)this.tree[num]) >= 0)
|
||||
{
|
||||
input.DropBits(num2 & 15);
|
||||
return num2 >> 4;
|
||||
}
|
||||
int num3 = -(num2 >> 4);
|
||||
int num4 = num2 & 15;
|
||||
if ((num = input.PeekBits(num4)) >= 0)
|
||||
{
|
||||
num2 = (int)this.tree[num3 | (num >> 9)];
|
||||
input.DropBits(num2 & 15);
|
||||
return num2 >> 4;
|
||||
}
|
||||
int availableBits = input.AvailableBits;
|
||||
num = input.PeekBits(availableBits);
|
||||
num2 = (int)this.tree[num3 | (num >> 9)];
|
||||
if ((num2 & 15) <= availableBits)
|
||||
{
|
||||
input.DropBits(num2 & 15);
|
||||
return num2 >> 4;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int availableBits2 = input.AvailableBits;
|
||||
num = input.PeekBits(availableBits2);
|
||||
int num2 = (int)this.tree[num];
|
||||
if (num2 >= 0 && (num2 & 15) <= availableBits2)
|
||||
{
|
||||
input.DropBits(num2 & 15);
|
||||
return num2 >> 4;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040001FE RID: 510
|
||||
private const int MAX_BITLEN = 15;
|
||||
|
||||
// Token: 0x040001FF RID: 511
|
||||
private short[] tree;
|
||||
|
||||
// Token: 0x04000200 RID: 512
|
||||
public static InflaterHuffmanTree defLitLenTree;
|
||||
|
||||
// Token: 0x04000201 RID: 513
|
||||
public static InflaterHuffmanTree defDistTree;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression
|
||||
{
|
||||
// Token: 0x02000045 RID: 69
|
||||
public class PendingBuffer
|
||||
{
|
||||
// Token: 0x060002BA RID: 698 RVA: 0x0000F1D9 File Offset: 0x0000E1D9
|
||||
public PendingBuffer()
|
||||
: this(4096)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060002BB RID: 699 RVA: 0x0000F1E6 File Offset: 0x0000E1E6
|
||||
public PendingBuffer(int bufferSize)
|
||||
{
|
||||
this.buffer_ = new byte[bufferSize];
|
||||
}
|
||||
|
||||
// Token: 0x060002BC RID: 700 RVA: 0x0000F1FC File Offset: 0x0000E1FC
|
||||
public void Reset()
|
||||
{
|
||||
this.start = (this.end = (this.bitCount = 0));
|
||||
}
|
||||
|
||||
// Token: 0x060002BD RID: 701 RVA: 0x0000F224 File Offset: 0x0000E224
|
||||
public void WriteByte(int value)
|
||||
{
|
||||
this.buffer_[this.end++] = (byte)value;
|
||||
}
|
||||
|
||||
// Token: 0x060002BE RID: 702 RVA: 0x0000F24C File Offset: 0x0000E24C
|
||||
public void WriteShort(int value)
|
||||
{
|
||||
this.buffer_[this.end++] = (byte)value;
|
||||
this.buffer_[this.end++] = (byte)(value >> 8);
|
||||
}
|
||||
|
||||
// Token: 0x060002BF RID: 703 RVA: 0x0000F290 File Offset: 0x0000E290
|
||||
public void WriteInt(int value)
|
||||
{
|
||||
this.buffer_[this.end++] = (byte)value;
|
||||
this.buffer_[this.end++] = (byte)(value >> 8);
|
||||
this.buffer_[this.end++] = (byte)(value >> 16);
|
||||
this.buffer_[this.end++] = (byte)(value >> 24);
|
||||
}
|
||||
|
||||
// Token: 0x060002C0 RID: 704 RVA: 0x0000F30D File Offset: 0x0000E30D
|
||||
public void WriteBlock(byte[] block, int offset, int length)
|
||||
{
|
||||
Array.Copy(block, offset, this.buffer_, this.end, length);
|
||||
this.end += length;
|
||||
}
|
||||
|
||||
// Token: 0x17000094 RID: 148
|
||||
// (get) Token: 0x060002C1 RID: 705 RVA: 0x0000F331 File Offset: 0x0000E331
|
||||
public int BitCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bitCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060002C2 RID: 706 RVA: 0x0000F33C File Offset: 0x0000E33C
|
||||
public void AlignToByte()
|
||||
{
|
||||
if (this.bitCount > 0)
|
||||
{
|
||||
this.buffer_[this.end++] = (byte)this.bits;
|
||||
if (this.bitCount > 8)
|
||||
{
|
||||
this.buffer_[this.end++] = (byte)(this.bits >> 8);
|
||||
}
|
||||
}
|
||||
this.bits = 0U;
|
||||
this.bitCount = 0;
|
||||
}
|
||||
|
||||
// Token: 0x060002C3 RID: 707 RVA: 0x0000F3AC File Offset: 0x0000E3AC
|
||||
public void WriteBits(int b, int count)
|
||||
{
|
||||
this.bits |= (uint)((uint)b << this.bitCount);
|
||||
this.bitCount += count;
|
||||
if (this.bitCount >= 16)
|
||||
{
|
||||
this.buffer_[this.end++] = (byte)this.bits;
|
||||
this.buffer_[this.end++] = (byte)(this.bits >> 8);
|
||||
this.bits >>= 16;
|
||||
this.bitCount -= 16;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060002C4 RID: 708 RVA: 0x0000F448 File Offset: 0x0000E448
|
||||
public void WriteShortMSB(int s)
|
||||
{
|
||||
this.buffer_[this.end++] = (byte)(s >> 8);
|
||||
this.buffer_[this.end++] = (byte)s;
|
||||
}
|
||||
|
||||
// Token: 0x17000095 RID: 149
|
||||
// (get) Token: 0x060002C5 RID: 709 RVA: 0x0000F48B File Offset: 0x0000E48B
|
||||
public bool IsFlushed
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.end == 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060002C6 RID: 710 RVA: 0x0000F498 File Offset: 0x0000E498
|
||||
public int Flush(byte[] output, int offset, int length)
|
||||
{
|
||||
if (this.bitCount >= 8)
|
||||
{
|
||||
this.buffer_[this.end++] = (byte)this.bits;
|
||||
this.bits >>= 8;
|
||||
this.bitCount -= 8;
|
||||
}
|
||||
if (length > this.end - this.start)
|
||||
{
|
||||
length = this.end - this.start;
|
||||
Array.Copy(this.buffer_, this.start, output, offset, length);
|
||||
this.start = 0;
|
||||
this.end = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Array.Copy(this.buffer_, this.start, output, offset, length);
|
||||
this.start += length;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
// Token: 0x060002C7 RID: 711 RVA: 0x0000F550 File Offset: 0x0000E550
|
||||
public byte[] ToByteArray()
|
||||
{
|
||||
byte[] array = new byte[this.end - this.start];
|
||||
Array.Copy(this.buffer_, this.start, array, 0, array.Length);
|
||||
this.start = 0;
|
||||
this.end = 0;
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x040001C4 RID: 452
|
||||
private byte[] buffer_;
|
||||
|
||||
// Token: 0x040001C5 RID: 453
|
||||
private int start;
|
||||
|
||||
// Token: 0x040001C6 RID: 454
|
||||
private int end;
|
||||
|
||||
// Token: 0x040001C7 RID: 455
|
||||
private uint bits;
|
||||
|
||||
// Token: 0x040001C8 RID: 456
|
||||
private int bitCount;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using ICSharpCode.SharpZipLib.Encryption;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams
|
||||
{
|
||||
// Token: 0x0200002B RID: 43
|
||||
public class DeflaterOutputStream : Stream
|
||||
{
|
||||
// Token: 0x06000130 RID: 304 RVA: 0x00008B1C File Offset: 0x00007B1C
|
||||
public DeflaterOutputStream(Stream baseOutputStream)
|
||||
: this(baseOutputStream, new Deflater(), 512)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000131 RID: 305 RVA: 0x00008B2F File Offset: 0x00007B2F
|
||||
public DeflaterOutputStream(Stream baseOutputStream, Deflater deflater)
|
||||
: this(baseOutputStream, deflater, 512)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000132 RID: 306 RVA: 0x00008B40 File Offset: 0x00007B40
|
||||
public DeflaterOutputStream(Stream baseOutputStream, Deflater deflater, int bufferSize)
|
||||
{
|
||||
if (baseOutputStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("baseOutputStream");
|
||||
}
|
||||
if (!baseOutputStream.CanWrite)
|
||||
{
|
||||
throw new ArgumentException("Must support writing", "baseOutputStream");
|
||||
}
|
||||
if (deflater == null)
|
||||
{
|
||||
throw new ArgumentNullException("deflater");
|
||||
}
|
||||
if (bufferSize < 512)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("bufferSize");
|
||||
}
|
||||
this.baseOutputStream_ = baseOutputStream;
|
||||
this.buffer_ = new byte[bufferSize];
|
||||
this.deflater_ = deflater;
|
||||
}
|
||||
|
||||
// Token: 0x06000133 RID: 307 RVA: 0x00008BBC File Offset: 0x00007BBC
|
||||
public virtual void Finish()
|
||||
{
|
||||
this.deflater_.Finish();
|
||||
while (!this.deflater_.IsFinished)
|
||||
{
|
||||
int num = this.deflater_.Deflate(this.buffer_, 0, this.buffer_.Length);
|
||||
if (num <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (this.cryptoTransform_ != null)
|
||||
{
|
||||
this.EncryptBlock(this.buffer_, 0, num);
|
||||
}
|
||||
this.baseOutputStream_.Write(this.buffer_, 0, num);
|
||||
}
|
||||
if (!this.deflater_.IsFinished)
|
||||
{
|
||||
throw new SharpZipBaseException("Can't deflate all input?");
|
||||
}
|
||||
this.baseOutputStream_.Flush();
|
||||
if (this.cryptoTransform_ != null)
|
||||
{
|
||||
if (this.cryptoTransform_ is ZipAESTransform)
|
||||
{
|
||||
this.AESAuthCode = ((ZipAESTransform)this.cryptoTransform_).GetAuthCode();
|
||||
}
|
||||
this.cryptoTransform_.Dispose();
|
||||
this.cryptoTransform_ = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700003B RID: 59
|
||||
// (get) Token: 0x06000134 RID: 308 RVA: 0x00008C8B File Offset: 0x00007C8B
|
||||
// (set) Token: 0x06000135 RID: 309 RVA: 0x00008C93 File Offset: 0x00007C93
|
||||
public bool IsStreamOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isStreamOwner_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.isStreamOwner_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700003C RID: 60
|
||||
// (get) Token: 0x06000136 RID: 310 RVA: 0x00008C9C File Offset: 0x00007C9C
|
||||
public bool CanPatchEntries
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseOutputStream_.CanSeek;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700003D RID: 61
|
||||
// (get) Token: 0x06000137 RID: 311 RVA: 0x00008CA9 File Offset: 0x00007CA9
|
||||
// (set) Token: 0x06000138 RID: 312 RVA: 0x00008CB1 File Offset: 0x00007CB1
|
||||
public string Password
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.password;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != null && value.Length == 0)
|
||||
{
|
||||
this.password = null;
|
||||
return;
|
||||
}
|
||||
this.password = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000139 RID: 313 RVA: 0x00008CCD File Offset: 0x00007CCD
|
||||
protected void EncryptBlock(byte[] buffer, int offset, int length)
|
||||
{
|
||||
this.cryptoTransform_.TransformBlock(buffer, 0, length, buffer, 0);
|
||||
}
|
||||
|
||||
// Token: 0x0600013A RID: 314 RVA: 0x00008CE0 File Offset: 0x00007CE0
|
||||
protected void InitializePassword(string password)
|
||||
{
|
||||
PkzipClassicManaged pkzipClassicManaged = new PkzipClassicManaged();
|
||||
byte[] array = PkzipClassic.GenerateKeys(ZipConstants.ConvertToArray(password));
|
||||
this.cryptoTransform_ = pkzipClassicManaged.CreateEncryptor(array, null);
|
||||
}
|
||||
|
||||
// Token: 0x0600013B RID: 315 RVA: 0x00008D10 File Offset: 0x00007D10
|
||||
protected void InitializeAESPassword(ZipEntry entry, string rawPassword, out byte[] salt, out byte[] pwdVerifier)
|
||||
{
|
||||
salt = new byte[entry.AESSaltLen];
|
||||
if (DeflaterOutputStream._aesRnd == null)
|
||||
{
|
||||
DeflaterOutputStream._aesRnd = new RNGCryptoServiceProvider();
|
||||
}
|
||||
DeflaterOutputStream._aesRnd.GetBytes(salt);
|
||||
int num = entry.AESKeySize / 8;
|
||||
this.cryptoTransform_ = new ZipAESTransform(rawPassword, salt, num, true);
|
||||
pwdVerifier = ((ZipAESTransform)this.cryptoTransform_).PwdVerifier;
|
||||
}
|
||||
|
||||
// Token: 0x0600013C RID: 316 RVA: 0x00008D74 File Offset: 0x00007D74
|
||||
protected void Deflate()
|
||||
{
|
||||
while (!this.deflater_.IsNeedingInput)
|
||||
{
|
||||
int num = this.deflater_.Deflate(this.buffer_, 0, this.buffer_.Length);
|
||||
if (num <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (this.cryptoTransform_ != null)
|
||||
{
|
||||
this.EncryptBlock(this.buffer_, 0, num);
|
||||
}
|
||||
this.baseOutputStream_.Write(this.buffer_, 0, num);
|
||||
}
|
||||
if (!this.deflater_.IsNeedingInput)
|
||||
{
|
||||
throw new SharpZipBaseException("DeflaterOutputStream can't deflate all input?");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700003E RID: 62
|
||||
// (get) Token: 0x0600013D RID: 317 RVA: 0x00008DF0 File Offset: 0x00007DF0
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700003F RID: 63
|
||||
// (get) Token: 0x0600013E RID: 318 RVA: 0x00008DF3 File Offset: 0x00007DF3
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000040 RID: 64
|
||||
// (get) Token: 0x0600013F RID: 319 RVA: 0x00008DF6 File Offset: 0x00007DF6
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseOutputStream_.CanWrite;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000041 RID: 65
|
||||
// (get) Token: 0x06000140 RID: 320 RVA: 0x00008E03 File Offset: 0x00007E03
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseOutputStream_.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000042 RID: 66
|
||||
// (get) Token: 0x06000141 RID: 321 RVA: 0x00008E10 File Offset: 0x00007E10
|
||||
// (set) Token: 0x06000142 RID: 322 RVA: 0x00008E1D File Offset: 0x00007E1D
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseOutputStream_.Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotSupportedException("Position property not supported");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000143 RID: 323 RVA: 0x00008E29 File Offset: 0x00007E29
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotSupportedException("DeflaterOutputStream Seek not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000144 RID: 324 RVA: 0x00008E35 File Offset: 0x00007E35
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException("DeflaterOutputStream SetLength not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000145 RID: 325 RVA: 0x00008E41 File Offset: 0x00007E41
|
||||
public override int ReadByte()
|
||||
{
|
||||
throw new NotSupportedException("DeflaterOutputStream ReadByte not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000146 RID: 326 RVA: 0x00008E4D File Offset: 0x00007E4D
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException("DeflaterOutputStream Read not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000147 RID: 327 RVA: 0x00008E59 File Offset: 0x00007E59
|
||||
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
|
||||
{
|
||||
throw new NotSupportedException("DeflaterOutputStream BeginRead not currently supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000148 RID: 328 RVA: 0x00008E65 File Offset: 0x00007E65
|
||||
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
|
||||
{
|
||||
throw new NotSupportedException("BeginWrite is not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000149 RID: 329 RVA: 0x00008E71 File Offset: 0x00007E71
|
||||
public override void Flush()
|
||||
{
|
||||
this.deflater_.Flush();
|
||||
this.Deflate();
|
||||
this.baseOutputStream_.Flush();
|
||||
}
|
||||
|
||||
// Token: 0x0600014A RID: 330 RVA: 0x00008E90 File Offset: 0x00007E90
|
||||
public override void Close()
|
||||
{
|
||||
if (!this.isClosed_)
|
||||
{
|
||||
this.isClosed_ = true;
|
||||
try
|
||||
{
|
||||
this.Finish();
|
||||
if (this.cryptoTransform_ != null)
|
||||
{
|
||||
this.GetAuthCodeIfAES();
|
||||
this.cryptoTransform_.Dispose();
|
||||
this.cryptoTransform_ = null;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (this.isStreamOwner_)
|
||||
{
|
||||
this.baseOutputStream_.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600014B RID: 331 RVA: 0x00008EF8 File Offset: 0x00007EF8
|
||||
private void GetAuthCodeIfAES()
|
||||
{
|
||||
if (this.cryptoTransform_ is ZipAESTransform)
|
||||
{
|
||||
this.AESAuthCode = ((ZipAESTransform)this.cryptoTransform_).GetAuthCode();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600014C RID: 332 RVA: 0x00008F20 File Offset: 0x00007F20
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
this.Write(new byte[] { value }, 0, 1);
|
||||
}
|
||||
|
||||
// Token: 0x0600014D RID: 333 RVA: 0x00008F41 File Offset: 0x00007F41
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
this.deflater_.SetInput(buffer, offset, count);
|
||||
this.Deflate();
|
||||
}
|
||||
|
||||
// Token: 0x040000AD RID: 173
|
||||
private string password;
|
||||
|
||||
// Token: 0x040000AE RID: 174
|
||||
private ICryptoTransform cryptoTransform_;
|
||||
|
||||
// Token: 0x040000AF RID: 175
|
||||
protected byte[] AESAuthCode;
|
||||
|
||||
// Token: 0x040000B0 RID: 176
|
||||
private byte[] buffer_;
|
||||
|
||||
// Token: 0x040000B1 RID: 177
|
||||
protected Deflater deflater_;
|
||||
|
||||
// Token: 0x040000B2 RID: 178
|
||||
protected Stream baseOutputStream_;
|
||||
|
||||
// Token: 0x040000B3 RID: 179
|
||||
private bool isClosed_;
|
||||
|
||||
// Token: 0x040000B4 RID: 180
|
||||
private bool isStreamOwner_ = true;
|
||||
|
||||
// Token: 0x040000B5 RID: 181
|
||||
private static RNGCryptoServiceProvider _aesRnd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams
|
||||
{
|
||||
// Token: 0x0200003C RID: 60
|
||||
public class InflaterInputBuffer
|
||||
{
|
||||
// Token: 0x06000251 RID: 593 RVA: 0x0000C425 File Offset: 0x0000B425
|
||||
public InflaterInputBuffer(Stream stream)
|
||||
: this(stream, 4096)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000252 RID: 594 RVA: 0x0000C433 File Offset: 0x0000B433
|
||||
public InflaterInputBuffer(Stream stream, int bufferSize)
|
||||
{
|
||||
this.inputStream = stream;
|
||||
if (bufferSize < 1024)
|
||||
{
|
||||
bufferSize = 1024;
|
||||
}
|
||||
this.rawData = new byte[bufferSize];
|
||||
this.clearText = this.rawData;
|
||||
}
|
||||
|
||||
// Token: 0x17000083 RID: 131
|
||||
// (get) Token: 0x06000253 RID: 595 RVA: 0x0000C469 File Offset: 0x0000B469
|
||||
public int RawLength
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.rawLength;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000084 RID: 132
|
||||
// (get) Token: 0x06000254 RID: 596 RVA: 0x0000C471 File Offset: 0x0000B471
|
||||
public byte[] RawData
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.rawData;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000085 RID: 133
|
||||
// (get) Token: 0x06000255 RID: 597 RVA: 0x0000C479 File Offset: 0x0000B479
|
||||
public int ClearTextLength
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.clearTextLength;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000086 RID: 134
|
||||
// (get) Token: 0x06000256 RID: 598 RVA: 0x0000C481 File Offset: 0x0000B481
|
||||
public byte[] ClearText
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.clearText;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000087 RID: 135
|
||||
// (get) Token: 0x06000257 RID: 599 RVA: 0x0000C489 File Offset: 0x0000B489
|
||||
// (set) Token: 0x06000258 RID: 600 RVA: 0x0000C491 File Offset: 0x0000B491
|
||||
public int Available
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.available;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.available = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000259 RID: 601 RVA: 0x0000C49A File Offset: 0x0000B49A
|
||||
public void SetInflaterInput(Inflater inflater)
|
||||
{
|
||||
if (this.available > 0)
|
||||
{
|
||||
inflater.SetInput(this.clearText, this.clearTextLength - this.available, this.available);
|
||||
this.available = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600025A RID: 602 RVA: 0x0000C4CC File Offset: 0x0000B4CC
|
||||
public void Fill()
|
||||
{
|
||||
this.rawLength = 0;
|
||||
int num;
|
||||
for (int i = this.rawData.Length; i > 0; i -= num)
|
||||
{
|
||||
num = this.inputStream.Read(this.rawData, this.rawLength, i);
|
||||
if (num <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
this.rawLength += num;
|
||||
}
|
||||
if (this.cryptoTransform != null)
|
||||
{
|
||||
this.clearTextLength = this.cryptoTransform.TransformBlock(this.rawData, 0, this.rawLength, this.clearText, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.clearTextLength = this.rawLength;
|
||||
}
|
||||
this.available = this.clearTextLength;
|
||||
}
|
||||
|
||||
// Token: 0x0600025B RID: 603 RVA: 0x0000C565 File Offset: 0x0000B565
|
||||
public int ReadRawBuffer(byte[] buffer)
|
||||
{
|
||||
return this.ReadRawBuffer(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
// Token: 0x0600025C RID: 604 RVA: 0x0000C574 File Offset: 0x0000B574
|
||||
public int ReadRawBuffer(byte[] outBuffer, int offset, int length)
|
||||
{
|
||||
if (length < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("length");
|
||||
}
|
||||
int num = offset;
|
||||
int i = length;
|
||||
while (i > 0)
|
||||
{
|
||||
if (this.available <= 0)
|
||||
{
|
||||
this.Fill();
|
||||
if (this.available <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
int num2 = Math.Min(i, this.available);
|
||||
Array.Copy(this.rawData, this.rawLength - this.available, outBuffer, num, num2);
|
||||
num += num2;
|
||||
i -= num2;
|
||||
this.available -= num2;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
// Token: 0x0600025D RID: 605 RVA: 0x0000C5F4 File Offset: 0x0000B5F4
|
||||
public int ReadClearTextBuffer(byte[] outBuffer, int offset, int length)
|
||||
{
|
||||
if (length < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("length");
|
||||
}
|
||||
int num = offset;
|
||||
int i = length;
|
||||
while (i > 0)
|
||||
{
|
||||
if (this.available <= 0)
|
||||
{
|
||||
this.Fill();
|
||||
if (this.available <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
int num2 = Math.Min(i, this.available);
|
||||
Array.Copy(this.clearText, this.clearTextLength - this.available, outBuffer, num, num2);
|
||||
num += num2;
|
||||
i -= num2;
|
||||
this.available -= num2;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
// Token: 0x0600025E RID: 606 RVA: 0x0000C674 File Offset: 0x0000B674
|
||||
public int ReadLeByte()
|
||||
{
|
||||
if (this.available <= 0)
|
||||
{
|
||||
this.Fill();
|
||||
if (this.available <= 0)
|
||||
{
|
||||
throw new ZipException("EOF in header");
|
||||
}
|
||||
}
|
||||
byte b = this.rawData[this.rawLength - this.available];
|
||||
this.available--;
|
||||
return (int)b;
|
||||
}
|
||||
|
||||
// Token: 0x0600025F RID: 607 RVA: 0x0000C6C8 File Offset: 0x0000B6C8
|
||||
public int ReadLeShort()
|
||||
{
|
||||
return this.ReadLeByte() | (this.ReadLeByte() << 8);
|
||||
}
|
||||
|
||||
// Token: 0x06000260 RID: 608 RVA: 0x0000C6D9 File Offset: 0x0000B6D9
|
||||
public int ReadLeInt()
|
||||
{
|
||||
return this.ReadLeShort() | (this.ReadLeShort() << 16);
|
||||
}
|
||||
|
||||
// Token: 0x06000261 RID: 609 RVA: 0x0000C6EB File Offset: 0x0000B6EB
|
||||
public long ReadLeLong()
|
||||
{
|
||||
return (long)((ulong)this.ReadLeInt() | (ulong)((ulong)((long)this.ReadLeInt()) << 32));
|
||||
}
|
||||
|
||||
// Token: 0x17000088 RID: 136
|
||||
// (set) Token: 0x06000262 RID: 610 RVA: 0x0000C700 File Offset: 0x0000B700
|
||||
public ICryptoTransform CryptoTransform
|
||||
{
|
||||
set
|
||||
{
|
||||
this.cryptoTransform = value;
|
||||
if (this.cryptoTransform != null)
|
||||
{
|
||||
if (this.rawData == this.clearText)
|
||||
{
|
||||
if (this.internalClearText == null)
|
||||
{
|
||||
this.internalClearText = new byte[this.rawData.Length];
|
||||
}
|
||||
this.clearText = this.internalClearText;
|
||||
}
|
||||
this.clearTextLength = this.rawLength;
|
||||
if (this.available > 0)
|
||||
{
|
||||
this.cryptoTransform.TransformBlock(this.rawData, this.rawLength - this.available, this.available, this.clearText, this.rawLength - this.available);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.clearText = this.rawData;
|
||||
this.clearTextLength = this.rawLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000148 RID: 328
|
||||
private int rawLength;
|
||||
|
||||
// Token: 0x04000149 RID: 329
|
||||
private byte[] rawData;
|
||||
|
||||
// Token: 0x0400014A RID: 330
|
||||
private int clearTextLength;
|
||||
|
||||
// Token: 0x0400014B RID: 331
|
||||
private byte[] clearText;
|
||||
|
||||
// Token: 0x0400014C RID: 332
|
||||
private byte[] internalClearText;
|
||||
|
||||
// Token: 0x0400014D RID: 333
|
||||
private int available;
|
||||
|
||||
// Token: 0x0400014E RID: 334
|
||||
private ICryptoTransform cryptoTransform;
|
||||
|
||||
// Token: 0x0400014F RID: 335
|
||||
private Stream inputStream;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams
|
||||
{
|
||||
// Token: 0x02000029 RID: 41
|
||||
public class InflaterInputStream : Stream
|
||||
{
|
||||
// Token: 0x06000114 RID: 276 RVA: 0x000083BD File Offset: 0x000073BD
|
||||
public InflaterInputStream(Stream baseInputStream)
|
||||
: this(baseInputStream, new Inflater(), 4096)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000115 RID: 277 RVA: 0x000083D0 File Offset: 0x000073D0
|
||||
public InflaterInputStream(Stream baseInputStream, Inflater inf)
|
||||
: this(baseInputStream, inf, 4096)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000116 RID: 278 RVA: 0x000083E0 File Offset: 0x000073E0
|
||||
public InflaterInputStream(Stream baseInputStream, Inflater inflater, int bufferSize)
|
||||
{
|
||||
if (baseInputStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("baseInputStream");
|
||||
}
|
||||
if (inflater == null)
|
||||
{
|
||||
throw new ArgumentNullException("inflater");
|
||||
}
|
||||
if (bufferSize <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("bufferSize");
|
||||
}
|
||||
this.baseInputStream = baseInputStream;
|
||||
this.inf = inflater;
|
||||
this.inputBuffer = new InflaterInputBuffer(baseInputStream, bufferSize);
|
||||
}
|
||||
|
||||
// Token: 0x17000034 RID: 52
|
||||
// (get) Token: 0x06000117 RID: 279 RVA: 0x00008440 File Offset: 0x00007440
|
||||
// (set) Token: 0x06000118 RID: 280 RVA: 0x00008448 File Offset: 0x00007448
|
||||
public bool IsStreamOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isStreamOwner;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.isStreamOwner = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000119 RID: 281 RVA: 0x00008454 File Offset: 0x00007454
|
||||
public long Skip(long count)
|
||||
{
|
||||
if (count <= 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
if (this.baseInputStream.CanSeek)
|
||||
{
|
||||
this.baseInputStream.Seek(count, SeekOrigin.Current);
|
||||
return count;
|
||||
}
|
||||
int num = 2048;
|
||||
if (count < (long)num)
|
||||
{
|
||||
num = (int)count;
|
||||
}
|
||||
byte[] array = new byte[num];
|
||||
int num2 = 1;
|
||||
long num3 = count;
|
||||
while (num3 > 0L && num2 > 0)
|
||||
{
|
||||
if (num3 < (long)num)
|
||||
{
|
||||
num = (int)num3;
|
||||
}
|
||||
num2 = this.baseInputStream.Read(array, 0, num);
|
||||
num3 -= (long)num2;
|
||||
}
|
||||
return count - num3;
|
||||
}
|
||||
|
||||
// Token: 0x0600011A RID: 282 RVA: 0x000084D1 File Offset: 0x000074D1
|
||||
protected void StopDecrypting()
|
||||
{
|
||||
this.inputBuffer.CryptoTransform = null;
|
||||
}
|
||||
|
||||
// Token: 0x17000035 RID: 53
|
||||
// (get) Token: 0x0600011B RID: 283 RVA: 0x000084DF File Offset: 0x000074DF
|
||||
public virtual int Available
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!this.inf.IsFinished)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600011C RID: 284 RVA: 0x000084F4 File Offset: 0x000074F4
|
||||
protected void Fill()
|
||||
{
|
||||
if (this.inputBuffer.Available <= 0)
|
||||
{
|
||||
this.inputBuffer.Fill();
|
||||
if (this.inputBuffer.Available <= 0)
|
||||
{
|
||||
throw new SharpZipBaseException("Unexpected EOF");
|
||||
}
|
||||
}
|
||||
this.inputBuffer.SetInflaterInput(this.inf);
|
||||
}
|
||||
|
||||
// Token: 0x17000036 RID: 54
|
||||
// (get) Token: 0x0600011D RID: 285 RVA: 0x00008544 File Offset: 0x00007544
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseInputStream.CanRead;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000037 RID: 55
|
||||
// (get) Token: 0x0600011E RID: 286 RVA: 0x00008551 File Offset: 0x00007551
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000038 RID: 56
|
||||
// (get) Token: 0x0600011F RID: 287 RVA: 0x00008554 File Offset: 0x00007554
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000039 RID: 57
|
||||
// (get) Token: 0x06000120 RID: 288 RVA: 0x00008557 File Offset: 0x00007557
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return (long)this.inputBuffer.RawLength;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700003A RID: 58
|
||||
// (get) Token: 0x06000121 RID: 289 RVA: 0x00008565 File Offset: 0x00007565
|
||||
// (set) Token: 0x06000122 RID: 290 RVA: 0x00008572 File Offset: 0x00007572
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseInputStream.Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotSupportedException("InflaterInputStream Position not supported");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000123 RID: 291 RVA: 0x0000857E File Offset: 0x0000757E
|
||||
public override void Flush()
|
||||
{
|
||||
this.baseInputStream.Flush();
|
||||
}
|
||||
|
||||
// Token: 0x06000124 RID: 292 RVA: 0x0000858B File Offset: 0x0000758B
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotSupportedException("Seek not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000125 RID: 293 RVA: 0x00008597 File Offset: 0x00007597
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException("InflaterInputStream SetLength not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000126 RID: 294 RVA: 0x000085A3 File Offset: 0x000075A3
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException("InflaterInputStream Write not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000127 RID: 295 RVA: 0x000085AF File Offset: 0x000075AF
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
throw new NotSupportedException("InflaterInputStream WriteByte not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000128 RID: 296 RVA: 0x000085BB File Offset: 0x000075BB
|
||||
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
|
||||
{
|
||||
throw new NotSupportedException("InflaterInputStream BeginWrite not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000129 RID: 297 RVA: 0x000085C7 File Offset: 0x000075C7
|
||||
public override void Close()
|
||||
{
|
||||
if (!this.isClosed)
|
||||
{
|
||||
this.isClosed = true;
|
||||
if (this.isStreamOwner)
|
||||
{
|
||||
this.baseInputStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600012A RID: 298 RVA: 0x000085EC File Offset: 0x000075EC
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (this.inf.IsNeedingDictionary)
|
||||
{
|
||||
throw new SharpZipBaseException("Need a dictionary");
|
||||
}
|
||||
int num = count;
|
||||
for (;;)
|
||||
{
|
||||
int num2 = this.inf.Inflate(buffer, offset, num);
|
||||
offset += num2;
|
||||
num -= num2;
|
||||
if (num == 0 || this.inf.IsFinished)
|
||||
{
|
||||
goto IL_65;
|
||||
}
|
||||
if (this.inf.IsNeedingInput)
|
||||
{
|
||||
this.Fill();
|
||||
}
|
||||
else if (num2 == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
throw new ZipException("Dont know what to do");
|
||||
IL_65:
|
||||
return count - num;
|
||||
}
|
||||
|
||||
// Token: 0x040000A5 RID: 165
|
||||
protected Inflater inf;
|
||||
|
||||
// Token: 0x040000A6 RID: 166
|
||||
protected InflaterInputBuffer inputBuffer;
|
||||
|
||||
// Token: 0x040000A7 RID: 167
|
||||
private Stream baseInputStream;
|
||||
|
||||
// Token: 0x040000A8 RID: 168
|
||||
protected long csize;
|
||||
|
||||
// Token: 0x040000A9 RID: 169
|
||||
private bool isClosed;
|
||||
|
||||
// Token: 0x040000AA RID: 170
|
||||
private bool isStreamOwner = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams
|
||||
{
|
||||
// Token: 0x0200003D RID: 61
|
||||
public class OutputWindow
|
||||
{
|
||||
// Token: 0x06000263 RID: 611 RVA: 0x0000C7BC File Offset: 0x0000B7BC
|
||||
public void Write(int value)
|
||||
{
|
||||
if (this.windowFilled++ == 32768)
|
||||
{
|
||||
throw new InvalidOperationException("Window full");
|
||||
}
|
||||
this.window[this.windowEnd++] = (byte)value;
|
||||
this.windowEnd &= 32767;
|
||||
}
|
||||
|
||||
// Token: 0x06000264 RID: 612 RVA: 0x0000C818 File Offset: 0x0000B818
|
||||
private void SlowRepeat(int repStart, int length, int distance)
|
||||
{
|
||||
while (length-- > 0)
|
||||
{
|
||||
this.window[this.windowEnd++] = this.window[repStart++];
|
||||
this.windowEnd &= 32767;
|
||||
repStart &= 32767;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000265 RID: 613 RVA: 0x0000C870 File Offset: 0x0000B870
|
||||
public void Repeat(int length, int distance)
|
||||
{
|
||||
if ((this.windowFilled += length) > 32768)
|
||||
{
|
||||
throw new InvalidOperationException("Window full");
|
||||
}
|
||||
int num = (this.windowEnd - distance) & 32767;
|
||||
int num2 = 32768 - length;
|
||||
if (num > num2 || this.windowEnd >= num2)
|
||||
{
|
||||
this.SlowRepeat(num, length, distance);
|
||||
return;
|
||||
}
|
||||
if (length <= distance)
|
||||
{
|
||||
Array.Copy(this.window, num, this.window, this.windowEnd, length);
|
||||
this.windowEnd += length;
|
||||
return;
|
||||
}
|
||||
while (length-- > 0)
|
||||
{
|
||||
this.window[this.windowEnd++] = this.window[num++];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000266 RID: 614 RVA: 0x0000C928 File Offset: 0x0000B928
|
||||
public int CopyStored(StreamManipulator input, int length)
|
||||
{
|
||||
length = Math.Min(Math.Min(length, 32768 - this.windowFilled), input.AvailableBytes);
|
||||
int num = 32768 - this.windowEnd;
|
||||
int num2;
|
||||
if (length > num)
|
||||
{
|
||||
num2 = input.CopyBytes(this.window, this.windowEnd, num);
|
||||
if (num2 == num)
|
||||
{
|
||||
num2 += input.CopyBytes(this.window, 0, length - num);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 = input.CopyBytes(this.window, this.windowEnd, length);
|
||||
}
|
||||
this.windowEnd = (this.windowEnd + num2) & 32767;
|
||||
this.windowFilled += num2;
|
||||
return num2;
|
||||
}
|
||||
|
||||
// Token: 0x06000267 RID: 615 RVA: 0x0000C9CC File Offset: 0x0000B9CC
|
||||
public void CopyDict(byte[] dictionary, int offset, int length)
|
||||
{
|
||||
if (dictionary == null)
|
||||
{
|
||||
throw new ArgumentNullException("dictionary");
|
||||
}
|
||||
if (this.windowFilled > 0)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
if (length > 32768)
|
||||
{
|
||||
offset += length - 32768;
|
||||
length = 32768;
|
||||
}
|
||||
Array.Copy(dictionary, offset, this.window, 0, length);
|
||||
this.windowEnd = length & 32767;
|
||||
}
|
||||
|
||||
// Token: 0x06000268 RID: 616 RVA: 0x0000CA2C File Offset: 0x0000BA2C
|
||||
public int GetFreeSpace()
|
||||
{
|
||||
return 32768 - this.windowFilled;
|
||||
}
|
||||
|
||||
// Token: 0x06000269 RID: 617 RVA: 0x0000CA3A File Offset: 0x0000BA3A
|
||||
public int GetAvailable()
|
||||
{
|
||||
return this.windowFilled;
|
||||
}
|
||||
|
||||
// Token: 0x0600026A RID: 618 RVA: 0x0000CA44 File Offset: 0x0000BA44
|
||||
public int CopyOutput(byte[] output, int offset, int len)
|
||||
{
|
||||
int num = this.windowEnd;
|
||||
if (len > this.windowFilled)
|
||||
{
|
||||
len = this.windowFilled;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = (this.windowEnd - this.windowFilled + len) & 32767;
|
||||
}
|
||||
int num2 = len;
|
||||
int num3 = len - num;
|
||||
if (num3 > 0)
|
||||
{
|
||||
Array.Copy(this.window, 32768 - num3, output, offset, num3);
|
||||
offset += num3;
|
||||
len = num;
|
||||
}
|
||||
Array.Copy(this.window, num - len, output, offset, len);
|
||||
this.windowFilled -= num2;
|
||||
if (this.windowFilled < 0)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
return num2;
|
||||
}
|
||||
|
||||
// Token: 0x0600026B RID: 619 RVA: 0x0000CAD8 File Offset: 0x0000BAD8
|
||||
public void Reset()
|
||||
{
|
||||
this.windowFilled = (this.windowEnd = 0);
|
||||
}
|
||||
|
||||
// Token: 0x04000150 RID: 336
|
||||
private const int WindowSize = 32768;
|
||||
|
||||
// Token: 0x04000151 RID: 337
|
||||
private const int WindowMask = 32767;
|
||||
|
||||
// Token: 0x04000152 RID: 338
|
||||
private byte[] window = new byte[32768];
|
||||
|
||||
// Token: 0x04000153 RID: 339
|
||||
private int windowEnd;
|
||||
|
||||
// Token: 0x04000154 RID: 340
|
||||
private int windowFilled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams
|
||||
{
|
||||
// Token: 0x0200003E RID: 62
|
||||
public class StreamManipulator
|
||||
{
|
||||
// Token: 0x0600026E RID: 622 RVA: 0x0000CB18 File Offset: 0x0000BB18
|
||||
public int PeekBits(int bitCount)
|
||||
{
|
||||
if (this.bitsInBuffer_ < bitCount)
|
||||
{
|
||||
if (this.windowStart_ == this.windowEnd_)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
this.buffer_ |= (uint)((uint)((int)(this.window_[this.windowStart_++] & byte.MaxValue) | ((int)(this.window_[this.windowStart_++] & byte.MaxValue) << 8)) << this.bitsInBuffer_);
|
||||
this.bitsInBuffer_ += 16;
|
||||
}
|
||||
return (int)((ulong)this.buffer_ & (ulong)((long)((1 << bitCount) - 1)));
|
||||
}
|
||||
|
||||
// Token: 0x0600026F RID: 623 RVA: 0x0000CBB5 File Offset: 0x0000BBB5
|
||||
public void DropBits(int bitCount)
|
||||
{
|
||||
this.buffer_ >>= bitCount;
|
||||
this.bitsInBuffer_ -= bitCount;
|
||||
}
|
||||
|
||||
// Token: 0x06000270 RID: 624 RVA: 0x0000CBD8 File Offset: 0x0000BBD8
|
||||
public int GetBits(int bitCount)
|
||||
{
|
||||
int num = this.PeekBits(bitCount);
|
||||
if (num >= 0)
|
||||
{
|
||||
this.DropBits(bitCount);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x17000089 RID: 137
|
||||
// (get) Token: 0x06000271 RID: 625 RVA: 0x0000CBF9 File Offset: 0x0000BBF9
|
||||
public int AvailableBits
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bitsInBuffer_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700008A RID: 138
|
||||
// (get) Token: 0x06000272 RID: 626 RVA: 0x0000CC01 File Offset: 0x0000BC01
|
||||
public int AvailableBytes
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.windowEnd_ - this.windowStart_ + (this.bitsInBuffer_ >> 3);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000273 RID: 627 RVA: 0x0000CC19 File Offset: 0x0000BC19
|
||||
public void SkipToByteBoundary()
|
||||
{
|
||||
this.buffer_ >>= this.bitsInBuffer_ & 7;
|
||||
this.bitsInBuffer_ &= -8;
|
||||
}
|
||||
|
||||
// Token: 0x1700008B RID: 139
|
||||
// (get) Token: 0x06000274 RID: 628 RVA: 0x0000CC42 File Offset: 0x0000BC42
|
||||
public bool IsNeedingInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.windowStart_ == this.windowEnd_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000275 RID: 629 RVA: 0x0000CC54 File Offset: 0x0000BC54
|
||||
public int CopyBytes(byte[] output, int offset, int length)
|
||||
{
|
||||
if (length < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("length");
|
||||
}
|
||||
if ((this.bitsInBuffer_ & 7) != 0)
|
||||
{
|
||||
throw new InvalidOperationException("Bit buffer is not byte aligned!");
|
||||
}
|
||||
int num = 0;
|
||||
while (this.bitsInBuffer_ > 0 && length > 0)
|
||||
{
|
||||
output[offset++] = (byte)this.buffer_;
|
||||
this.buffer_ >>= 8;
|
||||
this.bitsInBuffer_ -= 8;
|
||||
length--;
|
||||
num++;
|
||||
}
|
||||
if (length == 0)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
int num2 = this.windowEnd_ - this.windowStart_;
|
||||
if (length > num2)
|
||||
{
|
||||
length = num2;
|
||||
}
|
||||
Array.Copy(this.window_, this.windowStart_, output, offset, length);
|
||||
this.windowStart_ += length;
|
||||
if (((this.windowStart_ - this.windowEnd_) & 1) != 0)
|
||||
{
|
||||
this.buffer_ = (uint)(this.window_[this.windowStart_++] & byte.MaxValue);
|
||||
this.bitsInBuffer_ = 8;
|
||||
}
|
||||
return num + length;
|
||||
}
|
||||
|
||||
// Token: 0x06000276 RID: 630 RVA: 0x0000CD48 File Offset: 0x0000BD48
|
||||
public void Reset()
|
||||
{
|
||||
this.buffer_ = 0U;
|
||||
this.windowStart_ = (this.windowEnd_ = (this.bitsInBuffer_ = 0));
|
||||
}
|
||||
|
||||
// Token: 0x06000277 RID: 631 RVA: 0x0000CD78 File Offset: 0x0000BD78
|
||||
public void SetInput(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "Cannot be negative");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "Cannot be negative");
|
||||
}
|
||||
if (this.windowStart_ < this.windowEnd_)
|
||||
{
|
||||
throw new InvalidOperationException("Old input was not completely processed");
|
||||
}
|
||||
int num = offset + count;
|
||||
if (offset > num || num > buffer.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
if ((count & 1) != 0)
|
||||
{
|
||||
this.buffer_ |= (uint)((uint)(buffer[offset++] & byte.MaxValue) << this.bitsInBuffer_);
|
||||
this.bitsInBuffer_ += 8;
|
||||
}
|
||||
this.window_ = buffer;
|
||||
this.windowStart_ = offset;
|
||||
this.windowEnd_ = num;
|
||||
}
|
||||
|
||||
// Token: 0x04000155 RID: 341
|
||||
private byte[] window_;
|
||||
|
||||
// Token: 0x04000156 RID: 342
|
||||
private int windowStart_;
|
||||
|
||||
// Token: 0x04000157 RID: 343
|
||||
private int windowEnd_;
|
||||
|
||||
// Token: 0x04000158 RID: 344
|
||||
private uint buffer_;
|
||||
|
||||
// Token: 0x04000159 RID: 345
|
||||
private int bitsInBuffer_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000051 RID: 81
|
||||
public enum CompressionMethod
|
||||
{
|
||||
// Token: 0x04000228 RID: 552
|
||||
Stored,
|
||||
// Token: 0x04000229 RID: 553
|
||||
Deflated = 8,
|
||||
// Token: 0x0400022A RID: 554
|
||||
Deflate64,
|
||||
// Token: 0x0400022B RID: 555
|
||||
BZip2 = 11,
|
||||
// Token: 0x0400022C RID: 556
|
||||
WinZipAES = 99
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200007A RID: 122
|
||||
public class DescriptorData
|
||||
{
|
||||
// Token: 0x17000110 RID: 272
|
||||
// (get) Token: 0x060004A1 RID: 1185 RVA: 0x00016CAE File Offset: 0x00015CAE
|
||||
// (set) Token: 0x060004A2 RID: 1186 RVA: 0x00016CB6 File Offset: 0x00015CB6
|
||||
public long CompressedSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.compressedSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.compressedSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000111 RID: 273
|
||||
// (get) Token: 0x060004A3 RID: 1187 RVA: 0x00016CBF File Offset: 0x00015CBF
|
||||
// (set) Token: 0x060004A4 RID: 1188 RVA: 0x00016CC7 File Offset: 0x00015CC7
|
||||
public long Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.size;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.size = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000112 RID: 274
|
||||
// (get) Token: 0x060004A5 RID: 1189 RVA: 0x00016CD0 File Offset: 0x00015CD0
|
||||
// (set) Token: 0x060004A6 RID: 1190 RVA: 0x00016CD8 File Offset: 0x00015CD8
|
||||
public long Crc
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.crc;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.crc = value & (long)((ulong)(-1));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400030F RID: 783
|
||||
private long size;
|
||||
|
||||
// Token: 0x04000310 RID: 784
|
||||
private long compressedSize;
|
||||
|
||||
// Token: 0x04000311 RID: 785
|
||||
private long crc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000078 RID: 120
|
||||
public class DiskArchiveStorage : BaseArchiveStorage
|
||||
{
|
||||
// Token: 0x06000491 RID: 1169 RVA: 0x00016948 File Offset: 0x00015948
|
||||
public DiskArchiveStorage(ZipFile file, FileUpdateMode updateMode)
|
||||
: base(updateMode)
|
||||
{
|
||||
if (file.Name == null)
|
||||
{
|
||||
throw new ZipException("Cant handle non file archives");
|
||||
}
|
||||
this.fileName_ = file.Name;
|
||||
}
|
||||
|
||||
// Token: 0x06000492 RID: 1170 RVA: 0x00016970 File Offset: 0x00015970
|
||||
public DiskArchiveStorage(ZipFile file)
|
||||
: this(file, FileUpdateMode.Safe)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000493 RID: 1171 RVA: 0x0001697C File Offset: 0x0001597C
|
||||
public override Stream GetTemporaryOutput()
|
||||
{
|
||||
if (this.temporaryName_ != null)
|
||||
{
|
||||
this.temporaryName_ = DiskArchiveStorage.GetTempFileName(this.temporaryName_, true);
|
||||
this.temporaryStream_ = File.Open(this.temporaryName_, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.temporaryName_ = Path.GetTempFileName();
|
||||
this.temporaryStream_ = File.Open(this.temporaryName_, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
|
||||
}
|
||||
return this.temporaryStream_;
|
||||
}
|
||||
|
||||
// Token: 0x06000494 RID: 1172 RVA: 0x000169E0 File Offset: 0x000159E0
|
||||
public override Stream ConvertTemporaryToFinal()
|
||||
{
|
||||
if (this.temporaryStream_ == null)
|
||||
{
|
||||
throw new ZipException("No temporary stream has been created");
|
||||
}
|
||||
Stream stream = null;
|
||||
string tempFileName = DiskArchiveStorage.GetTempFileName(this.fileName_, false);
|
||||
bool flag = false;
|
||||
try
|
||||
{
|
||||
this.temporaryStream_.Close();
|
||||
File.Move(this.fileName_, tempFileName);
|
||||
File.Move(this.temporaryName_, this.fileName_);
|
||||
flag = true;
|
||||
File.Delete(tempFileName);
|
||||
stream = File.Open(this.fileName_, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
stream = null;
|
||||
if (!flag)
|
||||
{
|
||||
File.Move(tempFileName, this.fileName_);
|
||||
File.Delete(this.temporaryName_);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
// Token: 0x06000495 RID: 1173 RVA: 0x00016A84 File Offset: 0x00015A84
|
||||
public override Stream MakeTemporaryCopy(Stream stream)
|
||||
{
|
||||
stream.Close();
|
||||
this.temporaryName_ = DiskArchiveStorage.GetTempFileName(this.fileName_, true);
|
||||
File.Copy(this.fileName_, this.temporaryName_, true);
|
||||
this.temporaryStream_ = new FileStream(this.temporaryName_, FileMode.Open, FileAccess.ReadWrite);
|
||||
return this.temporaryStream_;
|
||||
}
|
||||
|
||||
// Token: 0x06000496 RID: 1174 RVA: 0x00016AD4 File Offset: 0x00015AD4
|
||||
public override Stream OpenForDirectUpdate(Stream stream)
|
||||
{
|
||||
Stream stream2;
|
||||
if (stream == null || !stream.CanWrite)
|
||||
{
|
||||
if (stream != null)
|
||||
{
|
||||
stream.Close();
|
||||
}
|
||||
stream2 = new FileStream(this.fileName_, FileMode.Open, FileAccess.ReadWrite);
|
||||
}
|
||||
else
|
||||
{
|
||||
stream2 = stream;
|
||||
}
|
||||
return stream2;
|
||||
}
|
||||
|
||||
// Token: 0x06000497 RID: 1175 RVA: 0x00016B08 File Offset: 0x00015B08
|
||||
public override void Dispose()
|
||||
{
|
||||
if (this.temporaryStream_ != null)
|
||||
{
|
||||
this.temporaryStream_.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000498 RID: 1176 RVA: 0x00016B20 File Offset: 0x00015B20
|
||||
private static string GetTempFileName(string original, bool makeTempFile)
|
||||
{
|
||||
string text = null;
|
||||
if (original == null)
|
||||
{
|
||||
text = Path.GetTempFileName();
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = 0;
|
||||
int num2 = DateTime.Now.Second;
|
||||
while (text == null)
|
||||
{
|
||||
num++;
|
||||
string text2 = string.Format("{0}.{1}{2}.tmp", original, num2, num);
|
||||
if (!File.Exists(text2))
|
||||
{
|
||||
if (makeTempFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (File.Create(text2))
|
||||
{
|
||||
}
|
||||
text = text2;
|
||||
continue;
|
||||
}
|
||||
catch
|
||||
{
|
||||
num2 = DateTime.Now.Second;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
text = text2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x0400030A RID: 778
|
||||
private Stream temporaryStream_;
|
||||
|
||||
// Token: 0x0400030B RID: 779
|
||||
private string fileName_;
|
||||
|
||||
// Token: 0x0400030C RID: 780
|
||||
private string temporaryName_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000075 RID: 117
|
||||
public class DynamicDiskDataSource : IDynamicDataSource
|
||||
{
|
||||
// Token: 0x06000483 RID: 1155 RVA: 0x00016914 File Offset: 0x00015914
|
||||
public Stream GetSource(ZipEntry entry, string name)
|
||||
{
|
||||
Stream stream = null;
|
||||
if (name != null)
|
||||
{
|
||||
stream = File.Open(name, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000052 RID: 82
|
||||
public enum EncryptionAlgorithm
|
||||
{
|
||||
// Token: 0x0400022E RID: 558
|
||||
None,
|
||||
// Token: 0x0400022F RID: 559
|
||||
PkzipClassic,
|
||||
// Token: 0x04000230 RID: 560
|
||||
Des = 26113,
|
||||
// Token: 0x04000231 RID: 561
|
||||
RC2,
|
||||
// Token: 0x04000232 RID: 562
|
||||
TripleDes168,
|
||||
// Token: 0x04000233 RID: 563
|
||||
TripleDes112 = 26121,
|
||||
// Token: 0x04000234 RID: 564
|
||||
Aes128 = 26126,
|
||||
// Token: 0x04000235 RID: 565
|
||||
Aes192,
|
||||
// Token: 0x04000236 RID: 566
|
||||
Aes256,
|
||||
// Token: 0x04000237 RID: 567
|
||||
RC2Corrected = 26370,
|
||||
// Token: 0x04000238 RID: 568
|
||||
Blowfish = 26400,
|
||||
// Token: 0x04000239 RID: 569
|
||||
Twofish,
|
||||
// Token: 0x0400023A RID: 570
|
||||
RC4 = 26625,
|
||||
// Token: 0x0400023B RID: 571
|
||||
Unknown = 65535
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200007B RID: 123
|
||||
internal class EntryPatchData
|
||||
{
|
||||
// Token: 0x17000113 RID: 275
|
||||
// (get) Token: 0x060004A8 RID: 1192 RVA: 0x00016CEC File Offset: 0x00015CEC
|
||||
// (set) Token: 0x060004A9 RID: 1193 RVA: 0x00016CF4 File Offset: 0x00015CF4
|
||||
public long SizePatchOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.sizePatchOffset_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.sizePatchOffset_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000114 RID: 276
|
||||
// (get) Token: 0x060004AA RID: 1194 RVA: 0x00016CFD File Offset: 0x00015CFD
|
||||
// (set) Token: 0x060004AB RID: 1195 RVA: 0x00016D05 File Offset: 0x00015D05
|
||||
public long CrcPatchOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.crcPatchOffset_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.crcPatchOffset_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000312 RID: 786
|
||||
private long sizePatchOffset_;
|
||||
|
||||
// Token: 0x04000313 RID: 787
|
||||
private long crcPatchOffset_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200005D RID: 93
|
||||
public class ExtendedUnixData : ITaggedData
|
||||
{
|
||||
// Token: 0x170000D2 RID: 210
|
||||
// (get) Token: 0x0600038D RID: 909 RVA: 0x000125C0 File Offset: 0x000115C0
|
||||
public short TagID
|
||||
{
|
||||
get
|
||||
{
|
||||
return 21589;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600038E RID: 910 RVA: 0x000125C8 File Offset: 0x000115C8
|
||||
public void SetData(byte[] data, int index, int count)
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(data, index, count, false))
|
||||
{
|
||||
using (ZipHelperStream zipHelperStream = new ZipHelperStream(memoryStream))
|
||||
{
|
||||
this._flags = (ExtendedUnixData.Flags)zipHelperStream.ReadByte();
|
||||
if ((byte)(this._flags & ExtendedUnixData.Flags.ModificationTime) != 0 && count >= 5)
|
||||
{
|
||||
int num = zipHelperStream.ReadLEInt();
|
||||
this._modificationTime = (new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, num, 0)).ToLocalTime();
|
||||
}
|
||||
if ((byte)(this._flags & ExtendedUnixData.Flags.AccessTime) != 0)
|
||||
{
|
||||
int num2 = zipHelperStream.ReadLEInt();
|
||||
this._lastAccessTime = (new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, num2, 0)).ToLocalTime();
|
||||
}
|
||||
if ((byte)(this._flags & ExtendedUnixData.Flags.CreateTime) != 0)
|
||||
{
|
||||
int num3 = zipHelperStream.ReadLEInt();
|
||||
this._createTime = (new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, num3, 0)).ToLocalTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600038F RID: 911 RVA: 0x00012720 File Offset: 0x00011720
|
||||
public byte[] GetData()
|
||||
{
|
||||
byte[] array;
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
using (ZipHelperStream zipHelperStream = new ZipHelperStream(memoryStream))
|
||||
{
|
||||
zipHelperStream.IsStreamOwner = false;
|
||||
zipHelperStream.WriteByte((byte)this._flags);
|
||||
if ((byte)(this._flags & ExtendedUnixData.Flags.ModificationTime) != 0)
|
||||
{
|
||||
int num = (int)(this._modificationTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime()).TotalSeconds;
|
||||
zipHelperStream.WriteLEInt(num);
|
||||
}
|
||||
if ((byte)(this._flags & ExtendedUnixData.Flags.AccessTime) != 0)
|
||||
{
|
||||
int num2 = (int)(this._lastAccessTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime()).TotalSeconds;
|
||||
zipHelperStream.WriteLEInt(num2);
|
||||
}
|
||||
if ((byte)(this._flags & ExtendedUnixData.Flags.CreateTime) != 0)
|
||||
{
|
||||
int num3 = (int)(this._createTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime()).TotalSeconds;
|
||||
zipHelperStream.WriteLEInt(num3);
|
||||
}
|
||||
array = memoryStream.ToArray();
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x06000390 RID: 912 RVA: 0x00012874 File Offset: 0x00011874
|
||||
public static bool IsValidValue(DateTime value)
|
||||
{
|
||||
return value >= new DateTime(1901, 12, 13, 20, 45, 52) || value <= new DateTime(2038, 1, 19, 3, 14, 7);
|
||||
}
|
||||
|
||||
// Token: 0x170000D3 RID: 211
|
||||
// (get) Token: 0x06000391 RID: 913 RVA: 0x000128AB File Offset: 0x000118AB
|
||||
// (set) Token: 0x06000392 RID: 914 RVA: 0x000128B3 File Offset: 0x000118B3
|
||||
public DateTime ModificationTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._modificationTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!ExtendedUnixData.IsValidValue(value))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
this._flags |= ExtendedUnixData.Flags.ModificationTime;
|
||||
this._modificationTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000D4 RID: 212
|
||||
// (get) Token: 0x06000393 RID: 915 RVA: 0x000128DE File Offset: 0x000118DE
|
||||
// (set) Token: 0x06000394 RID: 916 RVA: 0x000128E6 File Offset: 0x000118E6
|
||||
public DateTime AccessTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._lastAccessTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!ExtendedUnixData.IsValidValue(value))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
this._flags |= ExtendedUnixData.Flags.AccessTime;
|
||||
this._lastAccessTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000D5 RID: 213
|
||||
// (get) Token: 0x06000395 RID: 917 RVA: 0x00012911 File Offset: 0x00011911
|
||||
// (set) Token: 0x06000396 RID: 918 RVA: 0x00012919 File Offset: 0x00011919
|
||||
public DateTime CreateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._createTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!ExtendedUnixData.IsValidValue(value))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
this._flags |= ExtendedUnixData.Flags.CreateTime;
|
||||
this._createTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000D6 RID: 214
|
||||
// (get) Token: 0x06000397 RID: 919 RVA: 0x00012944 File Offset: 0x00011944
|
||||
// (set) Token: 0x06000398 RID: 920 RVA: 0x0001294C File Offset: 0x0001194C
|
||||
private ExtendedUnixData.Flags Include
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._flags;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._flags = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040002B0 RID: 688
|
||||
private ExtendedUnixData.Flags _flags;
|
||||
|
||||
// Token: 0x040002B1 RID: 689
|
||||
private DateTime _modificationTime = new DateTime(1970, 1, 1);
|
||||
|
||||
// Token: 0x040002B2 RID: 690
|
||||
private DateTime _lastAccessTime = new DateTime(1970, 1, 1);
|
||||
|
||||
// Token: 0x040002B3 RID: 691
|
||||
private DateTime _createTime = new DateTime(1970, 1, 1);
|
||||
|
||||
// Token: 0x0200005E RID: 94
|
||||
[Flags]
|
||||
public enum Flags : byte
|
||||
{
|
||||
// Token: 0x040002B5 RID: 693
|
||||
ModificationTime = 1,
|
||||
// Token: 0x040002B6 RID: 694
|
||||
AccessTime = 2,
|
||||
// Token: 0x040002B7 RID: 695
|
||||
CreateTime = 4
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,512 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using ICSharpCode.SharpZipLib.Core;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200004B RID: 75
|
||||
public class FastZip
|
||||
{
|
||||
// Token: 0x060002F0 RID: 752 RVA: 0x0001094A File Offset: 0x0000F94A
|
||||
public FastZip()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060002F1 RID: 753 RVA: 0x00010964 File Offset: 0x0000F964
|
||||
public FastZip(FastZipEvents events)
|
||||
{
|
||||
this.events_ = events;
|
||||
}
|
||||
|
||||
// Token: 0x1700009E RID: 158
|
||||
// (get) Token: 0x060002F2 RID: 754 RVA: 0x00010985 File Offset: 0x0000F985
|
||||
// (set) Token: 0x060002F3 RID: 755 RVA: 0x0001098D File Offset: 0x0000F98D
|
||||
public bool CreateEmptyDirectories
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.createEmptyDirectories_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.createEmptyDirectories_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700009F RID: 159
|
||||
// (get) Token: 0x060002F4 RID: 756 RVA: 0x00010996 File Offset: 0x0000F996
|
||||
// (set) Token: 0x060002F5 RID: 757 RVA: 0x0001099E File Offset: 0x0000F99E
|
||||
public string Password
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.password_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.password_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000A0 RID: 160
|
||||
// (get) Token: 0x060002F6 RID: 758 RVA: 0x000109A7 File Offset: 0x0000F9A7
|
||||
// (set) Token: 0x060002F7 RID: 759 RVA: 0x000109B4 File Offset: 0x0000F9B4
|
||||
public INameTransform NameTransform
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.entryFactory_.NameTransform;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.entryFactory_.NameTransform = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000A1 RID: 161
|
||||
// (get) Token: 0x060002F8 RID: 760 RVA: 0x000109C2 File Offset: 0x0000F9C2
|
||||
// (set) Token: 0x060002F9 RID: 761 RVA: 0x000109CA File Offset: 0x0000F9CA
|
||||
public IEntryFactory EntryFactory
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.entryFactory_;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
this.entryFactory_ = new ZipEntryFactory();
|
||||
return;
|
||||
}
|
||||
this.entryFactory_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000A2 RID: 162
|
||||
// (get) Token: 0x060002FA RID: 762 RVA: 0x000109E2 File Offset: 0x0000F9E2
|
||||
// (set) Token: 0x060002FB RID: 763 RVA: 0x000109EA File Offset: 0x0000F9EA
|
||||
public UseZip64 UseZip64
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.useZip64_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.useZip64_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000A3 RID: 163
|
||||
// (get) Token: 0x060002FC RID: 764 RVA: 0x000109F3 File Offset: 0x0000F9F3
|
||||
// (set) Token: 0x060002FD RID: 765 RVA: 0x000109FB File Offset: 0x0000F9FB
|
||||
public bool RestoreDateTimeOnExtract
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.restoreDateTimeOnExtract_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.restoreDateTimeOnExtract_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000A4 RID: 164
|
||||
// (get) Token: 0x060002FE RID: 766 RVA: 0x00010A04 File Offset: 0x0000FA04
|
||||
// (set) Token: 0x060002FF RID: 767 RVA: 0x00010A0C File Offset: 0x0000FA0C
|
||||
public bool RestoreAttributesOnExtract
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.restoreAttributesOnExtract_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.restoreAttributesOnExtract_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000300 RID: 768 RVA: 0x00010A15 File Offset: 0x0000FA15
|
||||
public void CreateZip(string zipFileName, string sourceDirectory, bool recurse, string fileFilter, string directoryFilter)
|
||||
{
|
||||
this.CreateZip(File.Create(zipFileName), sourceDirectory, recurse, fileFilter, directoryFilter);
|
||||
}
|
||||
|
||||
// Token: 0x06000301 RID: 769 RVA: 0x00010A29 File Offset: 0x0000FA29
|
||||
public void CreateZip(string zipFileName, string sourceDirectory, bool recurse, string fileFilter)
|
||||
{
|
||||
this.CreateZip(File.Create(zipFileName), sourceDirectory, recurse, fileFilter, null);
|
||||
}
|
||||
|
||||
// Token: 0x06000302 RID: 770 RVA: 0x00010A3C File Offset: 0x0000FA3C
|
||||
public void CreateZip(Stream outputStream, string sourceDirectory, bool recurse, string fileFilter, string directoryFilter)
|
||||
{
|
||||
this.NameTransform = new ZipNameTransform(sourceDirectory);
|
||||
this.sourceDirectory_ = sourceDirectory;
|
||||
using (this.outputStream_ = new ZipOutputStream(outputStream))
|
||||
{
|
||||
if (this.password_ != null)
|
||||
{
|
||||
this.outputStream_.Password = this.password_;
|
||||
}
|
||||
this.outputStream_.UseZip64 = this.UseZip64;
|
||||
FileSystemScanner fileSystemScanner = new FileSystemScanner(fileFilter, directoryFilter);
|
||||
FileSystemScanner fileSystemScanner2 = fileSystemScanner;
|
||||
fileSystemScanner2.ProcessFile = (ProcessFileHandler)Delegate.Combine(fileSystemScanner2.ProcessFile, new ProcessFileHandler(this.ProcessFile));
|
||||
if (this.CreateEmptyDirectories)
|
||||
{
|
||||
FileSystemScanner fileSystemScanner3 = fileSystemScanner;
|
||||
fileSystemScanner3.ProcessDirectory = (ProcessDirectoryHandler)Delegate.Combine(fileSystemScanner3.ProcessDirectory, new ProcessDirectoryHandler(this.ProcessDirectory));
|
||||
}
|
||||
if (this.events_ != null)
|
||||
{
|
||||
if (this.events_.FileFailure != null)
|
||||
{
|
||||
FileSystemScanner fileSystemScanner4 = fileSystemScanner;
|
||||
fileSystemScanner4.FileFailure = (FileFailureHandler)Delegate.Combine(fileSystemScanner4.FileFailure, this.events_.FileFailure);
|
||||
}
|
||||
if (this.events_.DirectoryFailure != null)
|
||||
{
|
||||
FileSystemScanner fileSystemScanner5 = fileSystemScanner;
|
||||
fileSystemScanner5.DirectoryFailure = (DirectoryFailureHandler)Delegate.Combine(fileSystemScanner5.DirectoryFailure, this.events_.DirectoryFailure);
|
||||
}
|
||||
}
|
||||
fileSystemScanner.Scan(sourceDirectory, recurse);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000303 RID: 771 RVA: 0x00010B74 File Offset: 0x0000FB74
|
||||
public void ExtractZip(string zipFileName, string targetDirectory, string fileFilter)
|
||||
{
|
||||
this.ExtractZip(zipFileName, targetDirectory, FastZip.Overwrite.Always, null, fileFilter, null, this.restoreDateTimeOnExtract_);
|
||||
}
|
||||
|
||||
// Token: 0x06000304 RID: 772 RVA: 0x00010B88 File Offset: 0x0000FB88
|
||||
public void ExtractZip(string zipFileName, string targetDirectory, FastZip.Overwrite overwrite, FastZip.ConfirmOverwriteDelegate confirmDelegate, string fileFilter, string directoryFilter, bool restoreDateTime)
|
||||
{
|
||||
Stream stream = File.Open(zipFileName, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
this.ExtractZip(stream, targetDirectory, overwrite, confirmDelegate, fileFilter, directoryFilter, restoreDateTime, true);
|
||||
}
|
||||
|
||||
// Token: 0x06000305 RID: 773 RVA: 0x00010BB4 File Offset: 0x0000FBB4
|
||||
public void ExtractZip(Stream inputStream, string targetDirectory, FastZip.Overwrite overwrite, FastZip.ConfirmOverwriteDelegate confirmDelegate, string fileFilter, string directoryFilter, bool restoreDateTime, bool isStreamOwner)
|
||||
{
|
||||
if (overwrite == FastZip.Overwrite.Prompt && confirmDelegate == null)
|
||||
{
|
||||
throw new ArgumentNullException("confirmDelegate");
|
||||
}
|
||||
this.continueRunning_ = true;
|
||||
this.overwrite_ = overwrite;
|
||||
this.confirmDelegate_ = confirmDelegate;
|
||||
this.extractNameTransform_ = new WindowsNameTransform(targetDirectory);
|
||||
this.fileFilter_ = new NameFilter(fileFilter);
|
||||
this.directoryFilter_ = new NameFilter(directoryFilter);
|
||||
this.restoreDateTimeOnExtract_ = restoreDateTime;
|
||||
using (this.zipFile_ = new ZipFile(inputStream))
|
||||
{
|
||||
if (this.password_ != null)
|
||||
{
|
||||
this.zipFile_.Password = this.password_;
|
||||
}
|
||||
this.zipFile_.IsStreamOwner = isStreamOwner;
|
||||
IEnumerator enumerator = this.zipFile_.GetEnumerator();
|
||||
while (this.continueRunning_ && enumerator.MoveNext())
|
||||
{
|
||||
ZipEntry zipEntry = (ZipEntry)enumerator.Current;
|
||||
if (zipEntry.IsFile)
|
||||
{
|
||||
if (this.directoryFilter_.IsMatch(Path.GetDirectoryName(zipEntry.Name)) && this.fileFilter_.IsMatch(zipEntry.Name))
|
||||
{
|
||||
this.ExtractEntry(zipEntry);
|
||||
}
|
||||
}
|
||||
else if (zipEntry.IsDirectory && this.directoryFilter_.IsMatch(zipEntry.Name) && this.CreateEmptyDirectories)
|
||||
{
|
||||
this.ExtractEntry(zipEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000306 RID: 774 RVA: 0x00010CFC File Offset: 0x0000FCFC
|
||||
private void ProcessDirectory(object sender, DirectoryEventArgs e)
|
||||
{
|
||||
if (!e.HasMatchingFiles && this.CreateEmptyDirectories)
|
||||
{
|
||||
if (this.events_ != null)
|
||||
{
|
||||
this.events_.OnProcessDirectory(e.Name, e.HasMatchingFiles);
|
||||
}
|
||||
if (e.ContinueRunning && e.Name != this.sourceDirectory_)
|
||||
{
|
||||
ZipEntry zipEntry = this.entryFactory_.MakeDirectoryEntry(e.Name);
|
||||
this.outputStream_.PutNextEntry(zipEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000307 RID: 775 RVA: 0x00010D74 File Offset: 0x0000FD74
|
||||
private void ProcessFile(object sender, ScanEventArgs e)
|
||||
{
|
||||
if (this.events_ != null && this.events_.ProcessFile != null)
|
||||
{
|
||||
this.events_.ProcessFile(sender, e);
|
||||
}
|
||||
if (e.ContinueRunning)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (FileStream fileStream = File.Open(e.Name, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
ZipEntry zipEntry = this.entryFactory_.MakeFileEntry(e.Name);
|
||||
this.outputStream_.PutNextEntry(zipEntry);
|
||||
this.AddFileContents(e.Name, fileStream);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (this.events_ == null)
|
||||
{
|
||||
this.continueRunning_ = false;
|
||||
throw;
|
||||
}
|
||||
this.continueRunning_ = this.events_.OnFileFailure(e.Name, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000308 RID: 776 RVA: 0x00010E44 File Offset: 0x0000FE44
|
||||
private void AddFileContents(string name, Stream stream)
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ArgumentNullException("stream");
|
||||
}
|
||||
if (this.buffer_ == null)
|
||||
{
|
||||
this.buffer_ = new byte[4096];
|
||||
}
|
||||
if (this.events_ != null && this.events_.Progress != null)
|
||||
{
|
||||
StreamUtils.Copy(stream, this.outputStream_, this.buffer_, this.events_.Progress, this.events_.ProgressInterval, this, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
StreamUtils.Copy(stream, this.outputStream_, this.buffer_);
|
||||
}
|
||||
if (this.events_ != null)
|
||||
{
|
||||
this.continueRunning_ = this.events_.OnCompletedFile(name);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000309 RID: 777 RVA: 0x00010EE4 File Offset: 0x0000FEE4
|
||||
private void ExtractFileEntry(ZipEntry entry, string targetName)
|
||||
{
|
||||
bool flag = true;
|
||||
if (this.overwrite_ != FastZip.Overwrite.Always && File.Exists(targetName))
|
||||
{
|
||||
flag = this.overwrite_ == FastZip.Overwrite.Prompt && this.confirmDelegate_ != null && this.confirmDelegate_(targetName);
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
if (this.events_ != null)
|
||||
{
|
||||
this.continueRunning_ = this.events_.OnProcessFile(entry.Name);
|
||||
}
|
||||
if (this.continueRunning_)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (FileStream fileStream = File.Create(targetName))
|
||||
{
|
||||
if (this.buffer_ == null)
|
||||
{
|
||||
this.buffer_ = new byte[4096];
|
||||
}
|
||||
if (this.events_ != null && this.events_.Progress != null)
|
||||
{
|
||||
StreamUtils.Copy(this.zipFile_.GetInputStream(entry), fileStream, this.buffer_, this.events_.Progress, this.events_.ProgressInterval, this, entry.Name, entry.Size);
|
||||
}
|
||||
else
|
||||
{
|
||||
StreamUtils.Copy(this.zipFile_.GetInputStream(entry), fileStream, this.buffer_);
|
||||
}
|
||||
if (this.events_ != null)
|
||||
{
|
||||
this.continueRunning_ = this.events_.OnCompletedFile(entry.Name);
|
||||
}
|
||||
}
|
||||
if (this.restoreDateTimeOnExtract_)
|
||||
{
|
||||
File.SetLastWriteTime(targetName, entry.DateTime);
|
||||
}
|
||||
if (this.RestoreAttributesOnExtract && entry.IsDOSEntry && entry.ExternalFileAttributes != -1)
|
||||
{
|
||||
FileAttributes fileAttributes = (FileAttributes)entry.ExternalFileAttributes;
|
||||
fileAttributes &= FileAttributes.Archive | FileAttributes.Hidden | FileAttributes.Normal | FileAttributes.ReadOnly;
|
||||
File.SetAttributes(targetName, fileAttributes);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (this.events_ == null)
|
||||
{
|
||||
this.continueRunning_ = false;
|
||||
throw;
|
||||
}
|
||||
this.continueRunning_ = this.events_.OnFileFailure(targetName, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600030A RID: 778 RVA: 0x00011094 File Offset: 0x00010094
|
||||
private void ExtractEntry(ZipEntry entry)
|
||||
{
|
||||
bool flag = entry.IsCompressionMethodSupported();
|
||||
string text = entry.Name;
|
||||
if (flag)
|
||||
{
|
||||
if (entry.IsFile)
|
||||
{
|
||||
text = this.extractNameTransform_.TransformFile(text);
|
||||
}
|
||||
else if (entry.IsDirectory)
|
||||
{
|
||||
text = this.extractNameTransform_.TransformDirectory(text);
|
||||
}
|
||||
flag = text != null && text.Length != 0;
|
||||
}
|
||||
string text2 = null;
|
||||
if (flag)
|
||||
{
|
||||
if (entry.IsDirectory)
|
||||
{
|
||||
text2 = text;
|
||||
}
|
||||
else
|
||||
{
|
||||
text2 = Path.GetDirectoryName(Path.GetFullPath(text));
|
||||
}
|
||||
}
|
||||
if (flag && !Directory.Exists(text2))
|
||||
{
|
||||
if (entry.IsDirectory)
|
||||
{
|
||||
if (!this.CreateEmptyDirectories)
|
||||
{
|
||||
goto IL_D9;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(text2);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
flag = false;
|
||||
if (this.events_ == null)
|
||||
{
|
||||
this.continueRunning_ = false;
|
||||
throw;
|
||||
}
|
||||
if (entry.IsDirectory)
|
||||
{
|
||||
this.continueRunning_ = this.events_.OnDirectoryFailure(text, ex);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.continueRunning_ = this.events_.OnFileFailure(text, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
IL_D9:
|
||||
if (flag && entry.IsFile)
|
||||
{
|
||||
this.ExtractFileEntry(entry, text);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600030B RID: 779 RVA: 0x000111A0 File Offset: 0x000101A0
|
||||
private static int MakeExternalAttributes(FileInfo info)
|
||||
{
|
||||
return (int)info.Attributes;
|
||||
}
|
||||
|
||||
// Token: 0x0600030C RID: 780 RVA: 0x000111A8 File Offset: 0x000101A8
|
||||
private static bool NameIsValid(string name)
|
||||
{
|
||||
return name != null && name.Length > 0 && name.IndexOfAny(Path.GetInvalidPathChars()) < 0;
|
||||
}
|
||||
|
||||
// Token: 0x04000209 RID: 521
|
||||
private bool continueRunning_;
|
||||
|
||||
// Token: 0x0400020A RID: 522
|
||||
private byte[] buffer_;
|
||||
|
||||
// Token: 0x0400020B RID: 523
|
||||
private ZipOutputStream outputStream_;
|
||||
|
||||
// Token: 0x0400020C RID: 524
|
||||
private ZipFile zipFile_;
|
||||
|
||||
// Token: 0x0400020D RID: 525
|
||||
private string sourceDirectory_;
|
||||
|
||||
// Token: 0x0400020E RID: 526
|
||||
private NameFilter fileFilter_;
|
||||
|
||||
// Token: 0x0400020F RID: 527
|
||||
private NameFilter directoryFilter_;
|
||||
|
||||
// Token: 0x04000210 RID: 528
|
||||
private FastZip.Overwrite overwrite_;
|
||||
|
||||
// Token: 0x04000211 RID: 529
|
||||
private FastZip.ConfirmOverwriteDelegate confirmDelegate_;
|
||||
|
||||
// Token: 0x04000212 RID: 530
|
||||
private bool restoreDateTimeOnExtract_;
|
||||
|
||||
// Token: 0x04000213 RID: 531
|
||||
private bool restoreAttributesOnExtract_;
|
||||
|
||||
// Token: 0x04000214 RID: 532
|
||||
private bool createEmptyDirectories_;
|
||||
|
||||
// Token: 0x04000215 RID: 533
|
||||
private FastZipEvents events_;
|
||||
|
||||
// Token: 0x04000216 RID: 534
|
||||
private IEntryFactory entryFactory_ = new ZipEntryFactory();
|
||||
|
||||
// Token: 0x04000217 RID: 535
|
||||
private INameTransform extractNameTransform_;
|
||||
|
||||
// Token: 0x04000218 RID: 536
|
||||
private UseZip64 useZip64_ = UseZip64.Dynamic;
|
||||
|
||||
// Token: 0x04000219 RID: 537
|
||||
private string password_;
|
||||
|
||||
// Token: 0x0200004C RID: 76
|
||||
public enum Overwrite
|
||||
{
|
||||
// Token: 0x0400021B RID: 539
|
||||
Prompt,
|
||||
// Token: 0x0400021C RID: 540
|
||||
Never,
|
||||
// Token: 0x0400021D RID: 541
|
||||
Always
|
||||
}
|
||||
|
||||
// Token: 0x0200004D RID: 77
|
||||
// (Invoke) Token: 0x0600030E RID: 782
|
||||
public delegate bool ConfirmOverwriteDelegate(string fileName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using ICSharpCode.SharpZipLib.Core;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200004A RID: 74
|
||||
public class FastZipEvents
|
||||
{
|
||||
// Token: 0x060002E8 RID: 744 RVA: 0x00010820 File Offset: 0x0000F820
|
||||
public bool OnDirectoryFailure(string directory, Exception e)
|
||||
{
|
||||
bool flag = false;
|
||||
DirectoryFailureHandler directoryFailure = this.DirectoryFailure;
|
||||
if (directoryFailure != null)
|
||||
{
|
||||
ScanFailureEventArgs scanFailureEventArgs = new ScanFailureEventArgs(directory, e);
|
||||
directoryFailure(this, scanFailureEventArgs);
|
||||
flag = scanFailureEventArgs.ContinueRunning;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060002E9 RID: 745 RVA: 0x00010854 File Offset: 0x0000F854
|
||||
public bool OnFileFailure(string file, Exception e)
|
||||
{
|
||||
FileFailureHandler fileFailure = this.FileFailure;
|
||||
bool flag = fileFailure != null;
|
||||
if (flag)
|
||||
{
|
||||
ScanFailureEventArgs scanFailureEventArgs = new ScanFailureEventArgs(file, e);
|
||||
fileFailure(this, scanFailureEventArgs);
|
||||
flag = scanFailureEventArgs.ContinueRunning;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060002EA RID: 746 RVA: 0x0001088C File Offset: 0x0000F88C
|
||||
public bool OnProcessFile(string file)
|
||||
{
|
||||
bool flag = true;
|
||||
ProcessFileHandler processFile = this.ProcessFile;
|
||||
if (processFile != null)
|
||||
{
|
||||
ScanEventArgs scanEventArgs = new ScanEventArgs(file);
|
||||
processFile(this, scanEventArgs);
|
||||
flag = scanEventArgs.ContinueRunning;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060002EB RID: 747 RVA: 0x000108BC File Offset: 0x0000F8BC
|
||||
public bool OnCompletedFile(string file)
|
||||
{
|
||||
bool flag = true;
|
||||
CompletedFileHandler completedFile = this.CompletedFile;
|
||||
if (completedFile != null)
|
||||
{
|
||||
ScanEventArgs scanEventArgs = new ScanEventArgs(file);
|
||||
completedFile(this, scanEventArgs);
|
||||
flag = scanEventArgs.ContinueRunning;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060002EC RID: 748 RVA: 0x000108EC File Offset: 0x0000F8EC
|
||||
public bool OnProcessDirectory(string directory, bool hasMatchingFiles)
|
||||
{
|
||||
bool flag = true;
|
||||
ProcessDirectoryHandler processDirectory = this.ProcessDirectory;
|
||||
if (processDirectory != null)
|
||||
{
|
||||
DirectoryEventArgs directoryEventArgs = new DirectoryEventArgs(directory, hasMatchingFiles);
|
||||
processDirectory(this, directoryEventArgs);
|
||||
flag = directoryEventArgs.ContinueRunning;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x1700009D RID: 157
|
||||
// (get) Token: 0x060002ED RID: 749 RVA: 0x0001091D File Offset: 0x0000F91D
|
||||
// (set) Token: 0x060002EE RID: 750 RVA: 0x00010925 File Offset: 0x0000F925
|
||||
public TimeSpan ProgressInterval
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.progressInterval_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.progressInterval_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000202 RID: 514
|
||||
public ProcessDirectoryHandler ProcessDirectory;
|
||||
|
||||
// Token: 0x04000203 RID: 515
|
||||
public ProcessFileHandler ProcessFile;
|
||||
|
||||
// Token: 0x04000204 RID: 516
|
||||
public ProgressHandler Progress;
|
||||
|
||||
// Token: 0x04000205 RID: 517
|
||||
public CompletedFileHandler CompletedFile;
|
||||
|
||||
// Token: 0x04000206 RID: 518
|
||||
public DirectoryFailureHandler DirectoryFailure;
|
||||
|
||||
// Token: 0x04000207 RID: 519
|
||||
public FileFailureHandler FileFailure;
|
||||
|
||||
// Token: 0x04000208 RID: 520
|
||||
private TimeSpan progressInterval_ = TimeSpan.FromSeconds(3.0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000067 RID: 103
|
||||
public enum FileUpdateMode
|
||||
{
|
||||
// Token: 0x040002D3 RID: 723
|
||||
Safe,
|
||||
// Token: 0x040002D4 RID: 724
|
||||
Direct
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000053 RID: 83
|
||||
[Flags]
|
||||
public enum GeneralBitFlags
|
||||
{
|
||||
// Token: 0x0400023D RID: 573
|
||||
Encrypted = 1,
|
||||
// Token: 0x0400023E RID: 574
|
||||
Method = 6,
|
||||
// Token: 0x0400023F RID: 575
|
||||
Descriptor = 8,
|
||||
// Token: 0x04000240 RID: 576
|
||||
ReservedPKware4 = 16,
|
||||
// Token: 0x04000241 RID: 577
|
||||
Patched = 32,
|
||||
// Token: 0x04000242 RID: 578
|
||||
StrongEncryption = 64,
|
||||
// Token: 0x04000243 RID: 579
|
||||
Unused7 = 128,
|
||||
// Token: 0x04000244 RID: 580
|
||||
Unused8 = 256,
|
||||
// Token: 0x04000245 RID: 581
|
||||
Unused9 = 512,
|
||||
// Token: 0x04000246 RID: 582
|
||||
Unused10 = 1024,
|
||||
// Token: 0x04000247 RID: 583
|
||||
UnicodeText = 2048,
|
||||
// Token: 0x04000248 RID: 584
|
||||
EnhancedCompress = 4096,
|
||||
// Token: 0x04000249 RID: 585
|
||||
HeaderMasked = 8192,
|
||||
// Token: 0x0400024A RID: 586
|
||||
ReservedPkware14 = 16384,
|
||||
// Token: 0x0400024B RID: 587
|
||||
ReservedPkware15 = 32768
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000055 RID: 85
|
||||
public enum HostSystemID
|
||||
{
|
||||
// Token: 0x04000271 RID: 625
|
||||
Msdos,
|
||||
// Token: 0x04000272 RID: 626
|
||||
Amiga,
|
||||
// Token: 0x04000273 RID: 627
|
||||
OpenVms,
|
||||
// Token: 0x04000274 RID: 628
|
||||
Unix,
|
||||
// Token: 0x04000275 RID: 629
|
||||
VMCms,
|
||||
// Token: 0x04000276 RID: 630
|
||||
AtariST,
|
||||
// Token: 0x04000277 RID: 631
|
||||
OS2,
|
||||
// Token: 0x04000278 RID: 632
|
||||
Macintosh,
|
||||
// Token: 0x04000279 RID: 633
|
||||
ZSystem,
|
||||
// Token: 0x0400027A RID: 634
|
||||
Cpm,
|
||||
// Token: 0x0400027B RID: 635
|
||||
WindowsNT,
|
||||
// Token: 0x0400027C RID: 636
|
||||
MVS,
|
||||
// Token: 0x0400027D RID: 637
|
||||
Vse,
|
||||
// Token: 0x0400027E RID: 638
|
||||
AcornRisc,
|
||||
// Token: 0x0400027F RID: 639
|
||||
Vfat,
|
||||
// Token: 0x04000280 RID: 640
|
||||
AlternateMvs,
|
||||
// Token: 0x04000281 RID: 641
|
||||
BeOS,
|
||||
// Token: 0x04000282 RID: 642
|
||||
Tandem,
|
||||
// Token: 0x04000283 RID: 643
|
||||
OS400,
|
||||
// Token: 0x04000284 RID: 644
|
||||
OSX,
|
||||
// Token: 0x04000285 RID: 645
|
||||
WinZipAES = 99
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000076 RID: 118
|
||||
public interface IArchiveStorage
|
||||
{
|
||||
// Token: 0x1700010D RID: 269
|
||||
// (get) Token: 0x06000484 RID: 1156
|
||||
FileUpdateMode UpdateMode { get; }
|
||||
|
||||
// Token: 0x06000485 RID: 1157
|
||||
Stream GetTemporaryOutput();
|
||||
|
||||
// Token: 0x06000486 RID: 1158
|
||||
Stream ConvertTemporaryToFinal();
|
||||
|
||||
// Token: 0x06000487 RID: 1159
|
||||
Stream MakeTemporaryCopy(Stream stream);
|
||||
|
||||
// Token: 0x06000488 RID: 1160
|
||||
Stream OpenForDirectUpdate(Stream stream);
|
||||
|
||||
// Token: 0x06000489 RID: 1161
|
||||
void Dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000073 RID: 115
|
||||
public interface IDynamicDataSource
|
||||
{
|
||||
// Token: 0x0600047F RID: 1151
|
||||
Stream GetSource(ZipEntry entry, string name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using ICSharpCode.SharpZipLib.Core;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200004E RID: 78
|
||||
public interface IEntryFactory
|
||||
{
|
||||
// Token: 0x06000311 RID: 785
|
||||
ZipEntry MakeFileEntry(string fileName);
|
||||
|
||||
// Token: 0x06000312 RID: 786
|
||||
ZipEntry MakeFileEntry(string fileName, bool useFileSystem);
|
||||
|
||||
// Token: 0x06000313 RID: 787
|
||||
ZipEntry MakeDirectoryEntry(string directoryName);
|
||||
|
||||
// Token: 0x06000314 RID: 788
|
||||
ZipEntry MakeDirectoryEntry(string directoryName, bool useFileSystem);
|
||||
|
||||
// Token: 0x170000A5 RID: 165
|
||||
// (get) Token: 0x06000315 RID: 789
|
||||
// (set) Token: 0x06000316 RID: 790
|
||||
INameTransform NameTransform { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000072 RID: 114
|
||||
public interface IStaticDataSource
|
||||
{
|
||||
// Token: 0x0600047E RID: 1150
|
||||
Stream GetSource();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200005B RID: 91
|
||||
public interface ITaggedData
|
||||
{
|
||||
// Token: 0x170000CF RID: 207
|
||||
// (get) Token: 0x06000383 RID: 899
|
||||
short TagID { get; }
|
||||
|
||||
// Token: 0x06000384 RID: 900
|
||||
void SetData(byte[] data, int offset, int count);
|
||||
|
||||
// Token: 0x06000385 RID: 901
|
||||
byte[] GetData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000060 RID: 96
|
||||
internal interface ITaggedDataFactory
|
||||
{
|
||||
// Token: 0x060003A5 RID: 933
|
||||
ITaggedData Create(short tag, byte[] data, int offset, int count);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000062 RID: 98
|
||||
public class KeysRequiredEventArgs : EventArgs
|
||||
{
|
||||
// Token: 0x060003C5 RID: 965 RVA: 0x00013228 File Offset: 0x00012228
|
||||
public KeysRequiredEventArgs(string name)
|
||||
{
|
||||
this.fileName = name;
|
||||
}
|
||||
|
||||
// Token: 0x060003C6 RID: 966 RVA: 0x00013237 File Offset: 0x00012237
|
||||
public KeysRequiredEventArgs(string name, byte[] keyValue)
|
||||
{
|
||||
this.fileName = name;
|
||||
this.key = keyValue;
|
||||
}
|
||||
|
||||
// Token: 0x170000DF RID: 223
|
||||
// (get) Token: 0x060003C7 RID: 967 RVA: 0x0001324D File Offset: 0x0001224D
|
||||
public string FileName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.fileName;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000E0 RID: 224
|
||||
// (get) Token: 0x060003C8 RID: 968 RVA: 0x00013255 File Offset: 0x00012255
|
||||
// (set) Token: 0x060003C9 RID: 969 RVA: 0x0001325D File Offset: 0x0001225D
|
||||
public byte[] Key
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.key;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.key = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040002C0 RID: 704
|
||||
private string fileName;
|
||||
|
||||
// Token: 0x040002C1 RID: 705
|
||||
private byte[] key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using ICSharpCode.SharpZipLib.Core;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000079 RID: 121
|
||||
public class MemoryArchiveStorage : BaseArchiveStorage
|
||||
{
|
||||
// Token: 0x06000499 RID: 1177 RVA: 0x00016BC4 File Offset: 0x00015BC4
|
||||
public MemoryArchiveStorage()
|
||||
: base(FileUpdateMode.Direct)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600049A RID: 1178 RVA: 0x00016BCD File Offset: 0x00015BCD
|
||||
public MemoryArchiveStorage(FileUpdateMode updateMode)
|
||||
: base(updateMode)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x1700010F RID: 271
|
||||
// (get) Token: 0x0600049B RID: 1179 RVA: 0x00016BD6 File Offset: 0x00015BD6
|
||||
public MemoryStream FinalStream
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.finalStream_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600049C RID: 1180 RVA: 0x00016BDE File Offset: 0x00015BDE
|
||||
public override Stream GetTemporaryOutput()
|
||||
{
|
||||
this.temporaryStream_ = new MemoryStream();
|
||||
return this.temporaryStream_;
|
||||
}
|
||||
|
||||
// Token: 0x0600049D RID: 1181 RVA: 0x00016BF1 File Offset: 0x00015BF1
|
||||
public override Stream ConvertTemporaryToFinal()
|
||||
{
|
||||
if (this.temporaryStream_ == null)
|
||||
{
|
||||
throw new ZipException("No temporary stream has been created");
|
||||
}
|
||||
this.finalStream_ = new MemoryStream(this.temporaryStream_.ToArray());
|
||||
return this.finalStream_;
|
||||
}
|
||||
|
||||
// Token: 0x0600049E RID: 1182 RVA: 0x00016C22 File Offset: 0x00015C22
|
||||
public override Stream MakeTemporaryCopy(Stream stream)
|
||||
{
|
||||
this.temporaryStream_ = new MemoryStream();
|
||||
stream.Position = 0L;
|
||||
StreamUtils.Copy(stream, this.temporaryStream_, new byte[4096]);
|
||||
return this.temporaryStream_;
|
||||
}
|
||||
|
||||
// Token: 0x0600049F RID: 1183 RVA: 0x00016C54 File Offset: 0x00015C54
|
||||
public override Stream OpenForDirectUpdate(Stream stream)
|
||||
{
|
||||
Stream stream2;
|
||||
if (stream == null || !stream.CanWrite)
|
||||
{
|
||||
stream2 = new MemoryStream();
|
||||
if (stream != null)
|
||||
{
|
||||
stream.Position = 0L;
|
||||
StreamUtils.Copy(stream, stream2, new byte[4096]);
|
||||
stream.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stream2 = stream;
|
||||
}
|
||||
return stream2;
|
||||
}
|
||||
|
||||
// Token: 0x060004A0 RID: 1184 RVA: 0x00016C99 File Offset: 0x00015C99
|
||||
public override void Dispose()
|
||||
{
|
||||
if (this.temporaryStream_ != null)
|
||||
{
|
||||
this.temporaryStream_.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400030D RID: 781
|
||||
private MemoryStream temporaryStream_;
|
||||
|
||||
// Token: 0x0400030E RID: 782
|
||||
private MemoryStream finalStream_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200005F RID: 95
|
||||
public class NTTaggedData : ITaggedData
|
||||
{
|
||||
// Token: 0x170000D7 RID: 215
|
||||
// (get) Token: 0x0600039A RID: 922 RVA: 0x00012993 File Offset: 0x00011993
|
||||
public short TagID
|
||||
{
|
||||
get
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600039B RID: 923 RVA: 0x00012998 File Offset: 0x00011998
|
||||
public void SetData(byte[] data, int index, int count)
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(data, index, count, false))
|
||||
{
|
||||
using (ZipHelperStream zipHelperStream = new ZipHelperStream(memoryStream))
|
||||
{
|
||||
zipHelperStream.ReadLEInt();
|
||||
while (zipHelperStream.Position < zipHelperStream.Length)
|
||||
{
|
||||
int num = zipHelperStream.ReadLEShort();
|
||||
int num2 = zipHelperStream.ReadLEShort();
|
||||
if (num == 1)
|
||||
{
|
||||
if (num2 >= 24)
|
||||
{
|
||||
long num3 = zipHelperStream.ReadLELong();
|
||||
this._lastModificationTime = DateTime.FromFileTime(num3);
|
||||
long num4 = zipHelperStream.ReadLELong();
|
||||
this._lastAccessTime = DateTime.FromFileTime(num4);
|
||||
long num5 = zipHelperStream.ReadLELong();
|
||||
this._createTime = DateTime.FromFileTime(num5);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
zipHelperStream.Seek((long)num2, SeekOrigin.Current);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600039C RID: 924 RVA: 0x00012A64 File Offset: 0x00011A64
|
||||
public byte[] GetData()
|
||||
{
|
||||
byte[] array;
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
using (ZipHelperStream zipHelperStream = new ZipHelperStream(memoryStream))
|
||||
{
|
||||
zipHelperStream.IsStreamOwner = false;
|
||||
zipHelperStream.WriteLEInt(0);
|
||||
zipHelperStream.WriteLEShort(1);
|
||||
zipHelperStream.WriteLEShort(24);
|
||||
zipHelperStream.WriteLELong(this._lastModificationTime.ToFileTime());
|
||||
zipHelperStream.WriteLELong(this._lastAccessTime.ToFileTime());
|
||||
zipHelperStream.WriteLELong(this._createTime.ToFileTime());
|
||||
array = memoryStream.ToArray();
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x0600039D RID: 925 RVA: 0x00012B08 File Offset: 0x00011B08
|
||||
public static bool IsValidValue(DateTime value)
|
||||
{
|
||||
bool flag = true;
|
||||
try
|
||||
{
|
||||
value.ToFileTimeUtc();
|
||||
}
|
||||
catch
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x170000D8 RID: 216
|
||||
// (get) Token: 0x0600039E RID: 926 RVA: 0x00012B38 File Offset: 0x00011B38
|
||||
// (set) Token: 0x0600039F RID: 927 RVA: 0x00012B40 File Offset: 0x00011B40
|
||||
public DateTime LastModificationTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._lastModificationTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!NTTaggedData.IsValidValue(value))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
this._lastModificationTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000D9 RID: 217
|
||||
// (get) Token: 0x060003A0 RID: 928 RVA: 0x00012B5C File Offset: 0x00011B5C
|
||||
// (set) Token: 0x060003A1 RID: 929 RVA: 0x00012B64 File Offset: 0x00011B64
|
||||
public DateTime CreateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._createTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!NTTaggedData.IsValidValue(value))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
this._createTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000DA RID: 218
|
||||
// (get) Token: 0x060003A2 RID: 930 RVA: 0x00012B80 File Offset: 0x00011B80
|
||||
// (set) Token: 0x060003A3 RID: 931 RVA: 0x00012B88 File Offset: 0x00011B88
|
||||
public DateTime LastAccessTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._lastAccessTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!NTTaggedData.IsValidValue(value))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
this._lastAccessTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040002B8 RID: 696
|
||||
private DateTime _lastAccessTime = DateTime.FromFileTime(0L);
|
||||
|
||||
// Token: 0x040002B9 RID: 697
|
||||
private DateTime _lastModificationTime = DateTime.FromFileTime(0L);
|
||||
|
||||
// Token: 0x040002BA RID: 698
|
||||
private DateTime _createTime = DateTime.FromFileTime(0L);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200005C RID: 92
|
||||
public class RawTaggedData : ITaggedData
|
||||
{
|
||||
// Token: 0x06000386 RID: 902 RVA: 0x0001255C File Offset: 0x0001155C
|
||||
public RawTaggedData(short tag)
|
||||
{
|
||||
this._tag = tag;
|
||||
}
|
||||
|
||||
// Token: 0x170000D0 RID: 208
|
||||
// (get) Token: 0x06000387 RID: 903 RVA: 0x0001256B File Offset: 0x0001156B
|
||||
// (set) Token: 0x06000388 RID: 904 RVA: 0x00012573 File Offset: 0x00011573
|
||||
public short TagID
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._tag;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._tag = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000389 RID: 905 RVA: 0x0001257C File Offset: 0x0001157C
|
||||
public void SetData(byte[] data, int offset, int count)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
}
|
||||
this._data = new byte[count];
|
||||
Array.Copy(data, offset, this._data, 0, count);
|
||||
}
|
||||
|
||||
// Token: 0x0600038A RID: 906 RVA: 0x000125A7 File Offset: 0x000115A7
|
||||
public byte[] GetData()
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
|
||||
// Token: 0x170000D1 RID: 209
|
||||
// (get) Token: 0x0600038B RID: 907 RVA: 0x000125AF File Offset: 0x000115AF
|
||||
// (set) Token: 0x0600038C RID: 908 RVA: 0x000125B7 File Offset: 0x000115B7
|
||||
public byte[] Data
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._data = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040002AE RID: 686
|
||||
private short _tag;
|
||||
|
||||
// Token: 0x040002AF RID: 687
|
||||
private byte[] _data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000074 RID: 116
|
||||
public class StaticDiskDataSource : IStaticDataSource
|
||||
{
|
||||
// Token: 0x06000480 RID: 1152 RVA: 0x000168EB File Offset: 0x000158EB
|
||||
public StaticDiskDataSource(string fileName)
|
||||
{
|
||||
this.fileName_ = fileName;
|
||||
}
|
||||
|
||||
// Token: 0x06000481 RID: 1153 RVA: 0x000168FA File Offset: 0x000158FA
|
||||
public Stream GetSource()
|
||||
{
|
||||
return File.Open(this.fileName_, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
}
|
||||
|
||||
// Token: 0x04000308 RID: 776
|
||||
private string fileName_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000064 RID: 100
|
||||
public enum TestOperation
|
||||
{
|
||||
// Token: 0x040002C6 RID: 710
|
||||
Initialising,
|
||||
// Token: 0x040002C7 RID: 711
|
||||
EntryHeader,
|
||||
// Token: 0x040002C8 RID: 712
|
||||
EntryData,
|
||||
// Token: 0x040002C9 RID: 713
|
||||
EntryComplete,
|
||||
// Token: 0x040002CA RID: 714
|
||||
MiscellaneousTests,
|
||||
// Token: 0x040002CB RID: 715
|
||||
Complete
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000065 RID: 101
|
||||
public class TestStatus
|
||||
{
|
||||
// Token: 0x060003CA RID: 970 RVA: 0x00013266 File Offset: 0x00012266
|
||||
public TestStatus(ZipFile file)
|
||||
{
|
||||
this.file_ = file;
|
||||
}
|
||||
|
||||
// Token: 0x170000E1 RID: 225
|
||||
// (get) Token: 0x060003CB RID: 971 RVA: 0x00013275 File Offset: 0x00012275
|
||||
public TestOperation Operation
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.operation_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000E2 RID: 226
|
||||
// (get) Token: 0x060003CC RID: 972 RVA: 0x0001327D File Offset: 0x0001227D
|
||||
public ZipFile File
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.file_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000E3 RID: 227
|
||||
// (get) Token: 0x060003CD RID: 973 RVA: 0x00013285 File Offset: 0x00012285
|
||||
public ZipEntry Entry
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.entry_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000E4 RID: 228
|
||||
// (get) Token: 0x060003CE RID: 974 RVA: 0x0001328D File Offset: 0x0001228D
|
||||
public int ErrorCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.errorCount_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000E5 RID: 229
|
||||
// (get) Token: 0x060003CF RID: 975 RVA: 0x00013295 File Offset: 0x00012295
|
||||
public long BytesTested
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bytesTested_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000E6 RID: 230
|
||||
// (get) Token: 0x060003D0 RID: 976 RVA: 0x0001329D File Offset: 0x0001229D
|
||||
public bool EntryValid
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.entryValid_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060003D1 RID: 977 RVA: 0x000132A5 File Offset: 0x000122A5
|
||||
internal void AddError()
|
||||
{
|
||||
this.errorCount_++;
|
||||
this.entryValid_ = false;
|
||||
}
|
||||
|
||||
// Token: 0x060003D2 RID: 978 RVA: 0x000132BC File Offset: 0x000122BC
|
||||
internal void SetOperation(TestOperation operation)
|
||||
{
|
||||
this.operation_ = operation;
|
||||
}
|
||||
|
||||
// Token: 0x060003D3 RID: 979 RVA: 0x000132C5 File Offset: 0x000122C5
|
||||
internal void SetEntry(ZipEntry entry)
|
||||
{
|
||||
this.entry_ = entry;
|
||||
this.entryValid_ = true;
|
||||
this.bytesTested_ = 0L;
|
||||
}
|
||||
|
||||
// Token: 0x060003D4 RID: 980 RVA: 0x000132DD File Offset: 0x000122DD
|
||||
internal void SetBytesTested(long value)
|
||||
{
|
||||
this.bytesTested_ = value;
|
||||
}
|
||||
|
||||
// Token: 0x040002CC RID: 716
|
||||
private ZipFile file_;
|
||||
|
||||
// Token: 0x040002CD RID: 717
|
||||
private ZipEntry entry_;
|
||||
|
||||
// Token: 0x040002CE RID: 718
|
||||
private bool entryValid_;
|
||||
|
||||
// Token: 0x040002CF RID: 719
|
||||
private int errorCount_;
|
||||
|
||||
// Token: 0x040002D0 RID: 720
|
||||
private long bytesTested_;
|
||||
|
||||
// Token: 0x040002D1 RID: 721
|
||||
private TestOperation operation_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000063 RID: 99
|
||||
public enum TestStrategy
|
||||
{
|
||||
// Token: 0x040002C3 RID: 707
|
||||
FindFirstError,
|
||||
// Token: 0x040002C4 RID: 708
|
||||
FindAllErrors
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000050 RID: 80
|
||||
public enum UseZip64
|
||||
{
|
||||
// Token: 0x04000224 RID: 548
|
||||
Off,
|
||||
// Token: 0x04000225 RID: 549
|
||||
On,
|
||||
// Token: 0x04000226 RID: 550
|
||||
Dynamic
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using ICSharpCode.SharpZipLib.Core;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200004F RID: 79
|
||||
public class WindowsNameTransform : INameTransform
|
||||
{
|
||||
// Token: 0x06000317 RID: 791 RVA: 0x000111C6 File Offset: 0x000101C6
|
||||
public WindowsNameTransform(string baseDirectory)
|
||||
{
|
||||
if (baseDirectory == null)
|
||||
{
|
||||
throw new ArgumentNullException("baseDirectory", "Directory name is invalid");
|
||||
}
|
||||
this.BaseDirectory = baseDirectory;
|
||||
}
|
||||
|
||||
// Token: 0x06000318 RID: 792 RVA: 0x000111F0 File Offset: 0x000101F0
|
||||
public WindowsNameTransform()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x170000A6 RID: 166
|
||||
// (get) Token: 0x06000319 RID: 793 RVA: 0x00011200 File Offset: 0x00010200
|
||||
// (set) Token: 0x0600031A RID: 794 RVA: 0x00011208 File Offset: 0x00010208
|
||||
public string BaseDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._baseDirectory;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
this._baseDirectory = Path.GetFullPath(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000A7 RID: 167
|
||||
// (get) Token: 0x0600031B RID: 795 RVA: 0x00011224 File Offset: 0x00010224
|
||||
// (set) Token: 0x0600031C RID: 796 RVA: 0x0001122C File Offset: 0x0001022C
|
||||
public bool TrimIncomingPaths
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._trimIncomingPaths;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._trimIncomingPaths = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600031D RID: 797 RVA: 0x00011238 File Offset: 0x00010238
|
||||
public string TransformDirectory(string name)
|
||||
{
|
||||
name = this.TransformFile(name);
|
||||
if (name.Length > 0)
|
||||
{
|
||||
while (name.EndsWith("\\"))
|
||||
{
|
||||
name = name.Remove(name.Length - 1, 1);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
throw new ZipException("Cannot have an empty directory name");
|
||||
}
|
||||
|
||||
// Token: 0x0600031E RID: 798 RVA: 0x00011288 File Offset: 0x00010288
|
||||
public string TransformFile(string name)
|
||||
{
|
||||
if (name != null)
|
||||
{
|
||||
name = WindowsNameTransform.MakeValidName(name, this._replacementChar);
|
||||
if (this._trimIncomingPaths)
|
||||
{
|
||||
name = Path.GetFileName(name);
|
||||
}
|
||||
if (this._baseDirectory != null)
|
||||
{
|
||||
name = Path.Combine(this._baseDirectory, name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
name = string.Empty;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
// Token: 0x0600031F RID: 799 RVA: 0x000112D8 File Offset: 0x000102D8
|
||||
public static bool IsValidName(string name)
|
||||
{
|
||||
return name != null && name.Length <= 260 && string.Compare(name, WindowsNameTransform.MakeValidName(name, '_')) == 0;
|
||||
}
|
||||
|
||||
// Token: 0x06000320 RID: 800 RVA: 0x0001130C File Offset: 0x0001030C
|
||||
static WindowsNameTransform()
|
||||
{
|
||||
char[] invalidPathChars = Path.GetInvalidPathChars();
|
||||
int num = invalidPathChars.Length + 3;
|
||||
WindowsNameTransform.InvalidEntryChars = new char[num];
|
||||
Array.Copy(invalidPathChars, 0, WindowsNameTransform.InvalidEntryChars, 0, invalidPathChars.Length);
|
||||
WindowsNameTransform.InvalidEntryChars[num - 1] = '*';
|
||||
WindowsNameTransform.InvalidEntryChars[num - 2] = '?';
|
||||
WindowsNameTransform.InvalidEntryChars[num - 3] = ':';
|
||||
}
|
||||
|
||||
// Token: 0x06000321 RID: 801 RVA: 0x00011364 File Offset: 0x00010364
|
||||
public static string MakeValidName(string name, char replacement)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
name = WindowsPathUtils.DropPathRoot(name.Replace("/", "\\"));
|
||||
while (name.Length > 0)
|
||||
{
|
||||
if (name[0] != '\\')
|
||||
{
|
||||
break;
|
||||
}
|
||||
name = name.Remove(0, 1);
|
||||
}
|
||||
while (name.Length > 0 && name[name.Length - 1] == '\\')
|
||||
{
|
||||
name = name.Remove(name.Length - 1, 1);
|
||||
}
|
||||
int i;
|
||||
for (i = name.IndexOf("\\\\"); i >= 0; i = name.IndexOf("\\\\"))
|
||||
{
|
||||
name = name.Remove(i, 1);
|
||||
}
|
||||
i = name.IndexOfAny(WindowsNameTransform.InvalidEntryChars);
|
||||
if (i >= 0)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(name);
|
||||
while (i >= 0)
|
||||
{
|
||||
stringBuilder[i] = replacement;
|
||||
if (i >= name.Length)
|
||||
{
|
||||
i = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = name.IndexOfAny(WindowsNameTransform.InvalidEntryChars, i + 1);
|
||||
}
|
||||
}
|
||||
name = stringBuilder.ToString();
|
||||
}
|
||||
if (name.Length > 260)
|
||||
{
|
||||
throw new PathTooLongException();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
// Token: 0x170000A8 RID: 168
|
||||
// (get) Token: 0x06000322 RID: 802 RVA: 0x00011469 File Offset: 0x00010469
|
||||
// (set) Token: 0x06000323 RID: 803 RVA: 0x00011474 File Offset: 0x00010474
|
||||
public char Replacement
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._replacementChar;
|
||||
}
|
||||
set
|
||||
{
|
||||
for (int i = 0; i < WindowsNameTransform.InvalidEntryChars.Length; i++)
|
||||
{
|
||||
if (WindowsNameTransform.InvalidEntryChars[i] == value)
|
||||
{
|
||||
throw new ArgumentException("invalid path character");
|
||||
}
|
||||
}
|
||||
if (value == '\\' || value == '/')
|
||||
{
|
||||
throw new ArgumentException("invalid replacement character");
|
||||
}
|
||||
this._replacementChar = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400021E RID: 542
|
||||
private const int MaxPath = 260;
|
||||
|
||||
// Token: 0x0400021F RID: 543
|
||||
private string _baseDirectory;
|
||||
|
||||
// Token: 0x04000220 RID: 544
|
||||
private bool _trimIncomingPaths;
|
||||
|
||||
// Token: 0x04000221 RID: 545
|
||||
private char _replacementChar = '_';
|
||||
|
||||
// Token: 0x04000222 RID: 546
|
||||
private static readonly char[] InvalidEntryChars;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000054 RID: 84
|
||||
public sealed class ZipConstants
|
||||
{
|
||||
// Token: 0x170000A9 RID: 169
|
||||
// (get) Token: 0x06000324 RID: 804 RVA: 0x000114C4 File Offset: 0x000104C4
|
||||
// (set) Token: 0x06000325 RID: 805 RVA: 0x000114CB File Offset: 0x000104CB
|
||||
public static int DefaultCodePage
|
||||
{
|
||||
get
|
||||
{
|
||||
return ZipConstants.defaultCodePage;
|
||||
}
|
||||
set
|
||||
{
|
||||
ZipConstants.defaultCodePage = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000326 RID: 806 RVA: 0x000114D3 File Offset: 0x000104D3
|
||||
public static string ConvertToString(byte[] data, int count)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return Encoding.GetEncoding(ZipConstants.DefaultCodePage).GetString(data, 0, count);
|
||||
}
|
||||
|
||||
// Token: 0x06000327 RID: 807 RVA: 0x000114F0 File Offset: 0x000104F0
|
||||
public static string ConvertToString(byte[] data)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return ZipConstants.ConvertToString(data, data.Length);
|
||||
}
|
||||
|
||||
// Token: 0x06000328 RID: 808 RVA: 0x00011504 File Offset: 0x00010504
|
||||
public static string ConvertToStringExt(int flags, byte[] data, int count)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
if ((flags & 2048) != 0)
|
||||
{
|
||||
return Encoding.UTF8.GetString(data, 0, count);
|
||||
}
|
||||
return ZipConstants.ConvertToString(data, count);
|
||||
}
|
||||
|
||||
// Token: 0x06000329 RID: 809 RVA: 0x0001152D File Offset: 0x0001052D
|
||||
public static string ConvertToStringExt(int flags, byte[] data)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
if ((flags & 2048) != 0)
|
||||
{
|
||||
return Encoding.UTF8.GetString(data, 0, data.Length);
|
||||
}
|
||||
return ZipConstants.ConvertToString(data, data.Length);
|
||||
}
|
||||
|
||||
// Token: 0x0600032A RID: 810 RVA: 0x0001155A File Offset: 0x0001055A
|
||||
public static byte[] ConvertToArray(string str)
|
||||
{
|
||||
if (str == null)
|
||||
{
|
||||
return new byte[0];
|
||||
}
|
||||
return Encoding.GetEncoding(ZipConstants.DefaultCodePage).GetBytes(str);
|
||||
}
|
||||
|
||||
// Token: 0x0600032B RID: 811 RVA: 0x00011576 File Offset: 0x00010576
|
||||
public static byte[] ConvertToArray(int flags, string str)
|
||||
{
|
||||
if (str == null)
|
||||
{
|
||||
return new byte[0];
|
||||
}
|
||||
if ((flags & 2048) != 0)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(str);
|
||||
}
|
||||
return ZipConstants.ConvertToArray(str);
|
||||
}
|
||||
|
||||
// Token: 0x0600032C RID: 812 RVA: 0x0001159D File Offset: 0x0001059D
|
||||
private ZipConstants()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0400024C RID: 588
|
||||
public const int VersionMadeBy = 51;
|
||||
|
||||
// Token: 0x0400024D RID: 589
|
||||
[Obsolete("Use VersionMadeBy instead")]
|
||||
public const int VERSION_MADE_BY = 51;
|
||||
|
||||
// Token: 0x0400024E RID: 590
|
||||
public const int VersionStrongEncryption = 50;
|
||||
|
||||
// Token: 0x0400024F RID: 591
|
||||
[Obsolete("Use VersionStrongEncryption instead")]
|
||||
public const int VERSION_STRONG_ENCRYPTION = 50;
|
||||
|
||||
// Token: 0x04000250 RID: 592
|
||||
public const int VERSION_AES = 51;
|
||||
|
||||
// Token: 0x04000251 RID: 593
|
||||
public const int VersionZip64 = 45;
|
||||
|
||||
// Token: 0x04000252 RID: 594
|
||||
public const int LocalHeaderBaseSize = 30;
|
||||
|
||||
// Token: 0x04000253 RID: 595
|
||||
[Obsolete("Use LocalHeaderBaseSize instead")]
|
||||
public const int LOCHDR = 30;
|
||||
|
||||
// Token: 0x04000254 RID: 596
|
||||
public const int Zip64DataDescriptorSize = 24;
|
||||
|
||||
// Token: 0x04000255 RID: 597
|
||||
public const int DataDescriptorSize = 16;
|
||||
|
||||
// Token: 0x04000256 RID: 598
|
||||
[Obsolete("Use DataDescriptorSize instead")]
|
||||
public const int EXTHDR = 16;
|
||||
|
||||
// Token: 0x04000257 RID: 599
|
||||
public const int CentralHeaderBaseSize = 46;
|
||||
|
||||
// Token: 0x04000258 RID: 600
|
||||
[Obsolete("Use CentralHeaderBaseSize instead")]
|
||||
public const int CENHDR = 46;
|
||||
|
||||
// Token: 0x04000259 RID: 601
|
||||
public const int EndOfCentralRecordBaseSize = 22;
|
||||
|
||||
// Token: 0x0400025A RID: 602
|
||||
[Obsolete("Use EndOfCentralRecordBaseSize instead")]
|
||||
public const int ENDHDR = 22;
|
||||
|
||||
// Token: 0x0400025B RID: 603
|
||||
public const int CryptoHeaderSize = 12;
|
||||
|
||||
// Token: 0x0400025C RID: 604
|
||||
[Obsolete("Use CryptoHeaderSize instead")]
|
||||
public const int CRYPTO_HEADER_SIZE = 12;
|
||||
|
||||
// Token: 0x0400025D RID: 605
|
||||
public const int LocalHeaderSignature = 67324752;
|
||||
|
||||
// Token: 0x0400025E RID: 606
|
||||
[Obsolete("Use LocalHeaderSignature instead")]
|
||||
public const int LOCSIG = 67324752;
|
||||
|
||||
// Token: 0x0400025F RID: 607
|
||||
public const int SpanningSignature = 134695760;
|
||||
|
||||
// Token: 0x04000260 RID: 608
|
||||
[Obsolete("Use SpanningSignature instead")]
|
||||
public const int SPANNINGSIG = 134695760;
|
||||
|
||||
// Token: 0x04000261 RID: 609
|
||||
public const int SpanningTempSignature = 808471376;
|
||||
|
||||
// Token: 0x04000262 RID: 610
|
||||
[Obsolete("Use SpanningTempSignature instead")]
|
||||
public const int SPANTEMPSIG = 808471376;
|
||||
|
||||
// Token: 0x04000263 RID: 611
|
||||
public const int DataDescriptorSignature = 134695760;
|
||||
|
||||
// Token: 0x04000264 RID: 612
|
||||
[Obsolete("Use DataDescriptorSignature instead")]
|
||||
public const int EXTSIG = 134695760;
|
||||
|
||||
// Token: 0x04000265 RID: 613
|
||||
[Obsolete("Use CentralHeaderSignature instead")]
|
||||
public const int CENSIG = 33639248;
|
||||
|
||||
// Token: 0x04000266 RID: 614
|
||||
public const int CentralHeaderSignature = 33639248;
|
||||
|
||||
// Token: 0x04000267 RID: 615
|
||||
public const int Zip64CentralFileHeaderSignature = 101075792;
|
||||
|
||||
// Token: 0x04000268 RID: 616
|
||||
[Obsolete("Use Zip64CentralFileHeaderSignature instead")]
|
||||
public const int CENSIG64 = 101075792;
|
||||
|
||||
// Token: 0x04000269 RID: 617
|
||||
public const int Zip64CentralDirLocatorSignature = 117853008;
|
||||
|
||||
// Token: 0x0400026A RID: 618
|
||||
public const int ArchiveExtraDataSignature = 117853008;
|
||||
|
||||
// Token: 0x0400026B RID: 619
|
||||
public const int CentralHeaderDigitalSignature = 84233040;
|
||||
|
||||
// Token: 0x0400026C RID: 620
|
||||
[Obsolete("Use CentralHeaderDigitalSignaure instead")]
|
||||
public const int CENDIGITALSIG = 84233040;
|
||||
|
||||
// Token: 0x0400026D RID: 621
|
||||
public const int EndOfCentralDirectorySignature = 101010256;
|
||||
|
||||
// Token: 0x0400026E RID: 622
|
||||
[Obsolete("Use EndOfCentralDirectorySignature instead")]
|
||||
public const int ENDSIG = 101010256;
|
||||
|
||||
// Token: 0x0400026F RID: 623
|
||||
private static int defaultCodePage = Thread.CurrentThread.CurrentCulture.TextInfo.OEMCodePage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,877 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000056 RID: 86
|
||||
public class ZipEntry : ICloneable
|
||||
{
|
||||
// Token: 0x0600032E RID: 814 RVA: 0x000115C0 File Offset: 0x000105C0
|
||||
public ZipEntry(string name)
|
||||
: this(name, 0, 51, CompressionMethod.Deflated)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600032F RID: 815 RVA: 0x000115CD File Offset: 0x000105CD
|
||||
internal ZipEntry(string name, int versionRequiredToExtract)
|
||||
: this(name, versionRequiredToExtract, 51, CompressionMethod.Deflated)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000330 RID: 816 RVA: 0x000115DC File Offset: 0x000105DC
|
||||
internal ZipEntry(string name, int versionRequiredToExtract, int madeByInfo, CompressionMethod method)
|
||||
{
|
||||
this.externalFileAttributes = -1;
|
||||
this.method = CompressionMethod.Deflated;
|
||||
this.zipFileIndex = -1L;
|
||||
base..ctor();
|
||||
if (name == null)
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
if (name.Length > 65535)
|
||||
{
|
||||
throw new ArgumentException("Name is too long", "name");
|
||||
}
|
||||
if (versionRequiredToExtract != 0 && versionRequiredToExtract < 10)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("versionRequiredToExtract");
|
||||
}
|
||||
this.DateTime = DateTime.Now;
|
||||
this.name = name;
|
||||
this.versionMadeBy = (ushort)madeByInfo;
|
||||
this.versionToExtract = (ushort)versionRequiredToExtract;
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
// Token: 0x06000331 RID: 817 RVA: 0x00011670 File Offset: 0x00010670
|
||||
[Obsolete("Use Clone instead")]
|
||||
public ZipEntry(ZipEntry entry)
|
||||
{
|
||||
this.externalFileAttributes = -1;
|
||||
this.method = CompressionMethod.Deflated;
|
||||
this.zipFileIndex = -1L;
|
||||
base..ctor();
|
||||
if (entry == null)
|
||||
{
|
||||
throw new ArgumentNullException("entry");
|
||||
}
|
||||
this.known = entry.known;
|
||||
this.name = entry.name;
|
||||
this.size = entry.size;
|
||||
this.compressedSize = entry.compressedSize;
|
||||
this.crc = entry.crc;
|
||||
this.dosTime = entry.dosTime;
|
||||
this.method = entry.method;
|
||||
this.comment = entry.comment;
|
||||
this.versionToExtract = entry.versionToExtract;
|
||||
this.versionMadeBy = entry.versionMadeBy;
|
||||
this.externalFileAttributes = entry.externalFileAttributes;
|
||||
this.flags = entry.flags;
|
||||
this.zipFileIndex = entry.zipFileIndex;
|
||||
this.offset = entry.offset;
|
||||
this.forceZip64_ = entry.forceZip64_;
|
||||
if (entry.extra != null)
|
||||
{
|
||||
this.extra = new byte[entry.extra.Length];
|
||||
Array.Copy(entry.extra, 0, this.extra, 0, entry.extra.Length);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000AA RID: 170
|
||||
// (get) Token: 0x06000332 RID: 818 RVA: 0x00011791 File Offset: 0x00010791
|
||||
public bool HasCrc
|
||||
{
|
||||
get
|
||||
{
|
||||
return (byte)(this.known & ZipEntry.Known.Crc) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000AB RID: 171
|
||||
// (get) Token: 0x06000333 RID: 819 RVA: 0x000117A2 File Offset: 0x000107A2
|
||||
// (set) Token: 0x06000334 RID: 820 RVA: 0x000117B2 File Offset: 0x000107B2
|
||||
public bool IsCrypted
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this.flags & 1) != 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
this.flags |= 1;
|
||||
return;
|
||||
}
|
||||
this.flags &= -2;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000AC RID: 172
|
||||
// (get) Token: 0x06000335 RID: 821 RVA: 0x000117D5 File Offset: 0x000107D5
|
||||
// (set) Token: 0x06000336 RID: 822 RVA: 0x000117E9 File Offset: 0x000107E9
|
||||
public bool IsUnicodeText
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this.flags & 2048) != 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
this.flags |= 2048;
|
||||
return;
|
||||
}
|
||||
this.flags &= -2049;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000AD RID: 173
|
||||
// (get) Token: 0x06000337 RID: 823 RVA: 0x00011813 File Offset: 0x00010813
|
||||
// (set) Token: 0x06000338 RID: 824 RVA: 0x0001181B File Offset: 0x0001081B
|
||||
internal byte CryptoCheckValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.cryptoCheckValue_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.cryptoCheckValue_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000AE RID: 174
|
||||
// (get) Token: 0x06000339 RID: 825 RVA: 0x00011824 File Offset: 0x00010824
|
||||
// (set) Token: 0x0600033A RID: 826 RVA: 0x0001182C File Offset: 0x0001082C
|
||||
public int Flags
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.flags;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.flags = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000AF RID: 175
|
||||
// (get) Token: 0x0600033B RID: 827 RVA: 0x00011835 File Offset: 0x00010835
|
||||
// (set) Token: 0x0600033C RID: 828 RVA: 0x0001183D File Offset: 0x0001083D
|
||||
public long ZipFileIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.zipFileIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.zipFileIndex = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000B0 RID: 176
|
||||
// (get) Token: 0x0600033D RID: 829 RVA: 0x00011846 File Offset: 0x00010846
|
||||
// (set) Token: 0x0600033E RID: 830 RVA: 0x0001184E File Offset: 0x0001084E
|
||||
public long Offset
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.offset;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.offset = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000B1 RID: 177
|
||||
// (get) Token: 0x0600033F RID: 831 RVA: 0x00011857 File Offset: 0x00010857
|
||||
// (set) Token: 0x06000340 RID: 832 RVA: 0x0001186D File Offset: 0x0001086D
|
||||
public int ExternalFileAttributes
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((byte)(this.known & ZipEntry.Known.ExternalAttributes) == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return this.externalFileAttributes;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.externalFileAttributes = value;
|
||||
this.known |= ZipEntry.Known.ExternalAttributes;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000B2 RID: 178
|
||||
// (get) Token: 0x06000341 RID: 833 RVA: 0x00011886 File Offset: 0x00010886
|
||||
public int VersionMadeBy
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)(this.versionMadeBy & 255);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000B3 RID: 179
|
||||
// (get) Token: 0x06000342 RID: 834 RVA: 0x00011894 File Offset: 0x00010894
|
||||
public bool IsDOSEntry
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.HostSystem == 0 || this.HostSystem == 10;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000343 RID: 835 RVA: 0x000118AC File Offset: 0x000108AC
|
||||
private bool HasDosAttributes(int attributes)
|
||||
{
|
||||
bool flag = false;
|
||||
if ((byte)(this.known & ZipEntry.Known.ExternalAttributes) != 0 && (this.HostSystem == 0 || this.HostSystem == 10) && (this.ExternalFileAttributes & attributes) == attributes)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x170000B4 RID: 180
|
||||
// (get) Token: 0x06000344 RID: 836 RVA: 0x000118E7 File Offset: 0x000108E7
|
||||
// (set) Token: 0x06000345 RID: 837 RVA: 0x000118F7 File Offset: 0x000108F7
|
||||
public int HostSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this.versionMadeBy >> 8) & 255;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.versionMadeBy &= 255;
|
||||
this.versionMadeBy |= (ushort)((value & 255) << 8);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000B5 RID: 181
|
||||
// (get) Token: 0x06000346 RID: 838 RVA: 0x00011924 File Offset: 0x00010924
|
||||
public int Version
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.versionToExtract != 0)
|
||||
{
|
||||
return (int)this.versionToExtract;
|
||||
}
|
||||
int num = 10;
|
||||
if (this.AESKeySize > 0)
|
||||
{
|
||||
num = 51;
|
||||
}
|
||||
else if (this.CentralHeaderRequiresZip64)
|
||||
{
|
||||
num = 45;
|
||||
}
|
||||
else if (CompressionMethod.Deflated == this.method)
|
||||
{
|
||||
num = 20;
|
||||
}
|
||||
else if (this.IsDirectory)
|
||||
{
|
||||
num = 20;
|
||||
}
|
||||
else if (this.IsCrypted)
|
||||
{
|
||||
num = 20;
|
||||
}
|
||||
else if (this.HasDosAttributes(8))
|
||||
{
|
||||
num = 11;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000B6 RID: 182
|
||||
// (get) Token: 0x06000347 RID: 839 RVA: 0x00011994 File Offset: 0x00010994
|
||||
public bool CanDecompress
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Version <= 51 && (this.Version == 10 || this.Version == 11 || this.Version == 20 || this.Version == 45 || this.Version == 51) && this.IsCompressionMethodSupported();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000348 RID: 840 RVA: 0x000119E5 File Offset: 0x000109E5
|
||||
public void ForceZip64()
|
||||
{
|
||||
this.forceZip64_ = true;
|
||||
}
|
||||
|
||||
// Token: 0x06000349 RID: 841 RVA: 0x000119EE File Offset: 0x000109EE
|
||||
public bool IsZip64Forced()
|
||||
{
|
||||
return this.forceZip64_;
|
||||
}
|
||||
|
||||
// Token: 0x170000B7 RID: 183
|
||||
// (get) Token: 0x0600034A RID: 842 RVA: 0x000119F8 File Offset: 0x000109F8
|
||||
public bool LocalHeaderRequiresZip64
|
||||
{
|
||||
get
|
||||
{
|
||||
bool flag = this.forceZip64_;
|
||||
if (!flag)
|
||||
{
|
||||
ulong num = this.compressedSize;
|
||||
if (this.versionToExtract == 0 && this.IsCrypted)
|
||||
{
|
||||
num += 12UL;
|
||||
}
|
||||
flag = (this.size >= (ulong)(-1) || num >= (ulong)(-1)) && (this.versionToExtract == 0 || this.versionToExtract >= 45);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000B8 RID: 184
|
||||
// (get) Token: 0x0600034B RID: 843 RVA: 0x00011A58 File Offset: 0x00010A58
|
||||
public bool CentralHeaderRequiresZip64
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.LocalHeaderRequiresZip64 || this.offset >= (long)((ulong)(-1));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000B9 RID: 185
|
||||
// (get) Token: 0x0600034C RID: 844 RVA: 0x00011A71 File Offset: 0x00010A71
|
||||
// (set) Token: 0x0600034D RID: 845 RVA: 0x00011A88 File Offset: 0x00010A88
|
||||
public long DosTime
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((byte)(this.known & ZipEntry.Known.Time) == 0)
|
||||
{
|
||||
return 0L;
|
||||
}
|
||||
return (long)((ulong)this.dosTime);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.dosTime = (uint)value;
|
||||
this.known |= ZipEntry.Known.Time;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000BA RID: 186
|
||||
// (get) Token: 0x0600034E RID: 846 RVA: 0x00011AA4 File Offset: 0x00010AA4
|
||||
// (set) Token: 0x0600034F RID: 847 RVA: 0x00011B48 File Offset: 0x00010B48
|
||||
public DateTime DateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
uint num = Math.Min(59U, 2U * (this.dosTime & 31U));
|
||||
uint num2 = Math.Min(59U, (this.dosTime >> 5) & 63U);
|
||||
uint num3 = Math.Min(23U, (this.dosTime >> 11) & 31U);
|
||||
uint num4 = Math.Max(1U, Math.Min(12U, (this.dosTime >> 21) & 15U));
|
||||
uint num5 = ((this.dosTime >> 25) & 127U) + 1980U;
|
||||
int num6 = Math.Max(1, Math.Min(DateTime.DaysInMonth((int)num5, (int)num4), (int)((this.dosTime >> 16) & 31U)));
|
||||
return new DateTime((int)num5, (int)num4, num6, (int)num3, (int)num2, (int)num);
|
||||
}
|
||||
set
|
||||
{
|
||||
uint num = (uint)value.Year;
|
||||
uint num2 = (uint)value.Month;
|
||||
uint num3 = (uint)value.Day;
|
||||
uint num4 = (uint)value.Hour;
|
||||
uint num5 = (uint)value.Minute;
|
||||
uint num6 = (uint)value.Second;
|
||||
if (num < 1980U)
|
||||
{
|
||||
num = 1980U;
|
||||
num2 = 1U;
|
||||
num3 = 1U;
|
||||
num4 = 0U;
|
||||
num5 = 0U;
|
||||
num6 = 0U;
|
||||
}
|
||||
else if (num > 2107U)
|
||||
{
|
||||
num = 2107U;
|
||||
num2 = 12U;
|
||||
num3 = 31U;
|
||||
num4 = 23U;
|
||||
num5 = 59U;
|
||||
num6 = 59U;
|
||||
}
|
||||
this.DosTime = (long)((ulong)((((num - 1980U) & 127U) << 25) | (num2 << 21) | (num3 << 16) | (num4 << 11) | (num5 << 5) | (num6 >> 1)));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000BB RID: 187
|
||||
// (get) Token: 0x06000350 RID: 848 RVA: 0x00011BEF File Offset: 0x00010BEF
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000BC RID: 188
|
||||
// (get) Token: 0x06000351 RID: 849 RVA: 0x00011BF7 File Offset: 0x00010BF7
|
||||
// (set) Token: 0x06000352 RID: 850 RVA: 0x00011C0D File Offset: 0x00010C0D
|
||||
public long Size
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((byte)(this.known & ZipEntry.Known.Size) == 0)
|
||||
{
|
||||
return -1L;
|
||||
}
|
||||
return (long)this.size;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.size = (ulong)value;
|
||||
this.known |= ZipEntry.Known.Size;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000BD RID: 189
|
||||
// (get) Token: 0x06000353 RID: 851 RVA: 0x00011C25 File Offset: 0x00010C25
|
||||
// (set) Token: 0x06000354 RID: 852 RVA: 0x00011C3B File Offset: 0x00010C3B
|
||||
public long CompressedSize
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((byte)(this.known & ZipEntry.Known.CompressedSize) == 0)
|
||||
{
|
||||
return -1L;
|
||||
}
|
||||
return (long)this.compressedSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.compressedSize = (ulong)value;
|
||||
this.known |= ZipEntry.Known.CompressedSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000BE RID: 190
|
||||
// (get) Token: 0x06000355 RID: 853 RVA: 0x00011C53 File Offset: 0x00010C53
|
||||
// (set) Token: 0x06000356 RID: 854 RVA: 0x00011C6D File Offset: 0x00010C6D
|
||||
public long Crc
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((byte)(this.known & ZipEntry.Known.Crc) == 0)
|
||||
{
|
||||
return -1L;
|
||||
}
|
||||
return (long)((ulong)this.crc & (ulong)(-1));
|
||||
}
|
||||
set
|
||||
{
|
||||
if (((ulong)this.crc & 18446744069414584320UL) != 0UL)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
this.crc = (uint)value;
|
||||
this.known |= ZipEntry.Known.Crc;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000BF RID: 191
|
||||
// (get) Token: 0x06000357 RID: 855 RVA: 0x00011CA6 File Offset: 0x00010CA6
|
||||
// (set) Token: 0x06000358 RID: 856 RVA: 0x00011CAE File Offset: 0x00010CAE
|
||||
public CompressionMethod CompressionMethod
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.method;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!ZipEntry.IsCompressionMethodSupported(value))
|
||||
{
|
||||
throw new NotSupportedException("Compression method not supported");
|
||||
}
|
||||
this.method = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000C0 RID: 192
|
||||
// (get) Token: 0x06000359 RID: 857 RVA: 0x00011CCA File Offset: 0x00010CCA
|
||||
internal CompressionMethod CompressionMethodForHeader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.AESKeySize <= 0)
|
||||
{
|
||||
return this.method;
|
||||
}
|
||||
return CompressionMethod.WinZipAES;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000C1 RID: 193
|
||||
// (get) Token: 0x0600035A RID: 858 RVA: 0x00011CDE File Offset: 0x00010CDE
|
||||
// (set) Token: 0x0600035B RID: 859 RVA: 0x00011CE8 File Offset: 0x00010CE8
|
||||
public byte[] ExtraData
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.extra;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
this.extra = null;
|
||||
return;
|
||||
}
|
||||
if (value.Length > 65535)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
this.extra = new byte[value.Length];
|
||||
Array.Copy(value, 0, this.extra, 0, value.Length);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000C2 RID: 194
|
||||
// (get) Token: 0x0600035C RID: 860 RVA: 0x00011D34 File Offset: 0x00010D34
|
||||
// (set) Token: 0x0600035D RID: 861 RVA: 0x00011D90 File Offset: 0x00010D90
|
||||
public int AESKeySize
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (this._aesEncryptionStrength)
|
||||
{
|
||||
case 0:
|
||||
return 0;
|
||||
case 1:
|
||||
return 128;
|
||||
case 2:
|
||||
return 192;
|
||||
case 3:
|
||||
return 256;
|
||||
default:
|
||||
throw new ZipException("Invalid AESEncryptionStrength " + this._aesEncryptionStrength);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
this._aesEncryptionStrength = 0;
|
||||
return;
|
||||
}
|
||||
if (value == 128)
|
||||
{
|
||||
this._aesEncryptionStrength = 1;
|
||||
return;
|
||||
}
|
||||
if (value != 256)
|
||||
{
|
||||
throw new ZipException("AESKeySize must be 0, 128 or 256: " + value);
|
||||
}
|
||||
this._aesEncryptionStrength = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000C3 RID: 195
|
||||
// (get) Token: 0x0600035E RID: 862 RVA: 0x00011DE2 File Offset: 0x00010DE2
|
||||
internal byte AESEncryptionStrength
|
||||
{
|
||||
get
|
||||
{
|
||||
return (byte)this._aesEncryptionStrength;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000C4 RID: 196
|
||||
// (get) Token: 0x0600035F RID: 863 RVA: 0x00011DEB File Offset: 0x00010DEB
|
||||
internal int AESSaltLen
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.AESKeySize / 16;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000C5 RID: 197
|
||||
// (get) Token: 0x06000360 RID: 864 RVA: 0x00011DF6 File Offset: 0x00010DF6
|
||||
internal int AESOverheadSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return 12 + this.AESSaltLen;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000361 RID: 865 RVA: 0x00011E04 File Offset: 0x00010E04
|
||||
internal void ProcessExtraData(bool localHeader)
|
||||
{
|
||||
ZipExtraData zipExtraData = new ZipExtraData(this.extra);
|
||||
if (zipExtraData.Find(1))
|
||||
{
|
||||
this.forceZip64_ = true;
|
||||
if (zipExtraData.ValueLength < 4)
|
||||
{
|
||||
throw new ZipException("Extra data extended Zip64 information length is invalid");
|
||||
}
|
||||
if (localHeader || this.size == (ulong)(-1))
|
||||
{
|
||||
this.size = (ulong)zipExtraData.ReadLong();
|
||||
}
|
||||
if (localHeader || this.compressedSize == (ulong)(-1))
|
||||
{
|
||||
this.compressedSize = (ulong)zipExtraData.ReadLong();
|
||||
}
|
||||
if (!localHeader && this.offset == (long)((ulong)(-1)))
|
||||
{
|
||||
this.offset = zipExtraData.ReadLong();
|
||||
}
|
||||
}
|
||||
else if ((this.versionToExtract & 255) >= 45 && (this.size == (ulong)(-1) || this.compressedSize == (ulong)(-1)))
|
||||
{
|
||||
throw new ZipException("Zip64 Extended information required but is missing.");
|
||||
}
|
||||
if (zipExtraData.Find(10))
|
||||
{
|
||||
if (zipExtraData.ValueLength < 4)
|
||||
{
|
||||
throw new ZipException("NTFS Extra data invalid");
|
||||
}
|
||||
zipExtraData.ReadInt();
|
||||
while (zipExtraData.UnreadCount >= 4)
|
||||
{
|
||||
int num = zipExtraData.ReadShort();
|
||||
int num2 = zipExtraData.ReadShort();
|
||||
if (num == 1)
|
||||
{
|
||||
if (num2 >= 24)
|
||||
{
|
||||
long num3 = zipExtraData.ReadLong();
|
||||
zipExtraData.ReadLong();
|
||||
zipExtraData.ReadLong();
|
||||
this.DateTime = DateTime.FromFileTime(num3);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
zipExtraData.Skip(num2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (zipExtraData.Find(21589))
|
||||
{
|
||||
int valueLength = zipExtraData.ValueLength;
|
||||
int num4 = zipExtraData.ReadByte();
|
||||
if ((num4 & 1) != 0 && valueLength >= 5)
|
||||
{
|
||||
int num5 = zipExtraData.ReadInt();
|
||||
this.DateTime = (new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, num5, 0)).ToLocalTime();
|
||||
}
|
||||
}
|
||||
if (this.method == CompressionMethod.WinZipAES)
|
||||
{
|
||||
this.ProcessAESExtraData(zipExtraData);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000362 RID: 866 RVA: 0x00011FAC File Offset: 0x00010FAC
|
||||
private void ProcessAESExtraData(ZipExtraData extraData)
|
||||
{
|
||||
if (!extraData.Find(39169))
|
||||
{
|
||||
throw new ZipException("AES Extra Data missing");
|
||||
}
|
||||
this.versionToExtract = 51;
|
||||
this.Flags |= 64;
|
||||
int valueLength = extraData.ValueLength;
|
||||
if (valueLength < 7)
|
||||
{
|
||||
throw new ZipException("AES Extra Data Length " + valueLength + " invalid.");
|
||||
}
|
||||
int num = extraData.ReadShort();
|
||||
extraData.ReadShort();
|
||||
int num2 = extraData.ReadByte();
|
||||
int num3 = extraData.ReadShort();
|
||||
this._aesVer = num;
|
||||
this._aesEncryptionStrength = num2;
|
||||
this.method = (CompressionMethod)num3;
|
||||
}
|
||||
|
||||
// Token: 0x170000C6 RID: 198
|
||||
// (get) Token: 0x06000363 RID: 867 RVA: 0x0001203F File Offset: 0x0001103F
|
||||
// (set) Token: 0x06000364 RID: 868 RVA: 0x00012047 File Offset: 0x00011047
|
||||
public string Comment
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.comment;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != null && value.Length > 65535)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "cannot exceed 65535");
|
||||
}
|
||||
this.comment = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000C7 RID: 199
|
||||
// (get) Token: 0x06000365 RID: 869 RVA: 0x00012070 File Offset: 0x00011070
|
||||
public bool IsDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
int length = this.name.Length;
|
||||
return (length > 0 && (this.name[length - 1] == '/' || this.name[length - 1] == '\\')) || this.HasDosAttributes(16);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000C8 RID: 200
|
||||
// (get) Token: 0x06000366 RID: 870 RVA: 0x000120BE File Offset: 0x000110BE
|
||||
public bool IsFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return !this.IsDirectory && !this.HasDosAttributes(8);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000367 RID: 871 RVA: 0x000120D4 File Offset: 0x000110D4
|
||||
public bool IsCompressionMethodSupported()
|
||||
{
|
||||
return ZipEntry.IsCompressionMethodSupported(this.CompressionMethod);
|
||||
}
|
||||
|
||||
// Token: 0x06000368 RID: 872 RVA: 0x000120E4 File Offset: 0x000110E4
|
||||
public object Clone()
|
||||
{
|
||||
ZipEntry zipEntry = (ZipEntry)base.MemberwiseClone();
|
||||
if (this.extra != null)
|
||||
{
|
||||
zipEntry.extra = new byte[this.extra.Length];
|
||||
Array.Copy(this.extra, 0, zipEntry.extra, 0, this.extra.Length);
|
||||
}
|
||||
return zipEntry;
|
||||
}
|
||||
|
||||
// Token: 0x06000369 RID: 873 RVA: 0x00012134 File Offset: 0x00011134
|
||||
public override string ToString()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
// Token: 0x0600036A RID: 874 RVA: 0x0001213C File Offset: 0x0001113C
|
||||
public static bool IsCompressionMethodSupported(CompressionMethod method)
|
||||
{
|
||||
return method == CompressionMethod.Deflated || method == CompressionMethod.Stored;
|
||||
}
|
||||
|
||||
// Token: 0x0600036B RID: 875 RVA: 0x00012148 File Offset: 0x00011148
|
||||
public static string CleanName(string name)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
if (Path.IsPathRooted(name))
|
||||
{
|
||||
name = name.Substring(Path.GetPathRoot(name).Length);
|
||||
}
|
||||
name = name.Replace("\\", "/");
|
||||
while (name.Length > 0 && name[0] == '/')
|
||||
{
|
||||
name = name.Remove(0, 1);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
// Token: 0x04000286 RID: 646
|
||||
private ZipEntry.Known known;
|
||||
|
||||
// Token: 0x04000287 RID: 647
|
||||
private int externalFileAttributes;
|
||||
|
||||
// Token: 0x04000288 RID: 648
|
||||
private ushort versionMadeBy;
|
||||
|
||||
// Token: 0x04000289 RID: 649
|
||||
private string name;
|
||||
|
||||
// Token: 0x0400028A RID: 650
|
||||
private ulong size;
|
||||
|
||||
// Token: 0x0400028B RID: 651
|
||||
private ulong compressedSize;
|
||||
|
||||
// Token: 0x0400028C RID: 652
|
||||
private ushort versionToExtract;
|
||||
|
||||
// Token: 0x0400028D RID: 653
|
||||
private uint crc;
|
||||
|
||||
// Token: 0x0400028E RID: 654
|
||||
private uint dosTime;
|
||||
|
||||
// Token: 0x0400028F RID: 655
|
||||
private CompressionMethod method;
|
||||
|
||||
// Token: 0x04000290 RID: 656
|
||||
private byte[] extra;
|
||||
|
||||
// Token: 0x04000291 RID: 657
|
||||
private string comment;
|
||||
|
||||
// Token: 0x04000292 RID: 658
|
||||
private int flags;
|
||||
|
||||
// Token: 0x04000293 RID: 659
|
||||
private long zipFileIndex;
|
||||
|
||||
// Token: 0x04000294 RID: 660
|
||||
private long offset;
|
||||
|
||||
// Token: 0x04000295 RID: 661
|
||||
private bool forceZip64_;
|
||||
|
||||
// Token: 0x04000296 RID: 662
|
||||
private byte cryptoCheckValue_;
|
||||
|
||||
// Token: 0x04000297 RID: 663
|
||||
private int _aesVer;
|
||||
|
||||
// Token: 0x04000298 RID: 664
|
||||
private int _aesEncryptionStrength;
|
||||
|
||||
// Token: 0x02000057 RID: 87
|
||||
[Flags]
|
||||
private enum Known : byte
|
||||
{
|
||||
// Token: 0x0400029A RID: 666
|
||||
None = 0,
|
||||
// Token: 0x0400029B RID: 667
|
||||
Size = 1,
|
||||
// Token: 0x0400029C RID: 668
|
||||
CompressedSize = 2,
|
||||
// Token: 0x0400029D RID: 669
|
||||
Crc = 4,
|
||||
// Token: 0x0400029E RID: 670
|
||||
Time = 8,
|
||||
// Token: 0x0400029F RID: 671
|
||||
ExternalAttributes = 16
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using ICSharpCode.SharpZipLib.Core;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000058 RID: 88
|
||||
public class ZipEntryFactory : IEntryFactory
|
||||
{
|
||||
// Token: 0x0600036C RID: 876 RVA: 0x000121AC File Offset: 0x000111AC
|
||||
public ZipEntryFactory()
|
||||
{
|
||||
this.nameTransform_ = new ZipNameTransform();
|
||||
}
|
||||
|
||||
// Token: 0x0600036D RID: 877 RVA: 0x000121D1 File Offset: 0x000111D1
|
||||
public ZipEntryFactory(ZipEntryFactory.TimeSetting timeSetting)
|
||||
{
|
||||
this.timeSetting_ = timeSetting;
|
||||
this.nameTransform_ = new ZipNameTransform();
|
||||
}
|
||||
|
||||
// Token: 0x0600036E RID: 878 RVA: 0x000121FD File Offset: 0x000111FD
|
||||
public ZipEntryFactory(DateTime time)
|
||||
{
|
||||
this.timeSetting_ = ZipEntryFactory.TimeSetting.Fixed;
|
||||
this.FixedDateTime = time;
|
||||
this.nameTransform_ = new ZipNameTransform();
|
||||
}
|
||||
|
||||
// Token: 0x170000C9 RID: 201
|
||||
// (get) Token: 0x0600036F RID: 879 RVA: 0x00012230 File Offset: 0x00011230
|
||||
// (set) Token: 0x06000370 RID: 880 RVA: 0x00012238 File Offset: 0x00011238
|
||||
public INameTransform NameTransform
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.nameTransform_;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
this.nameTransform_ = new ZipNameTransform();
|
||||
return;
|
||||
}
|
||||
this.nameTransform_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000CA RID: 202
|
||||
// (get) Token: 0x06000371 RID: 881 RVA: 0x00012250 File Offset: 0x00011250
|
||||
// (set) Token: 0x06000372 RID: 882 RVA: 0x00012258 File Offset: 0x00011258
|
||||
public ZipEntryFactory.TimeSetting Setting
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.timeSetting_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.timeSetting_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000CB RID: 203
|
||||
// (get) Token: 0x06000373 RID: 883 RVA: 0x00012261 File Offset: 0x00011261
|
||||
// (set) Token: 0x06000374 RID: 884 RVA: 0x00012269 File Offset: 0x00011269
|
||||
public DateTime FixedDateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.fixedDateTime_;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value.Year < 1970)
|
||||
{
|
||||
throw new ArgumentException("Value is too old to be valid", "value");
|
||||
}
|
||||
this.fixedDateTime_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000CC RID: 204
|
||||
// (get) Token: 0x06000375 RID: 885 RVA: 0x00012290 File Offset: 0x00011290
|
||||
// (set) Token: 0x06000376 RID: 886 RVA: 0x00012298 File Offset: 0x00011298
|
||||
public int GetAttributes
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.getAttributes_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.getAttributes_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000CD RID: 205
|
||||
// (get) Token: 0x06000377 RID: 887 RVA: 0x000122A1 File Offset: 0x000112A1
|
||||
// (set) Token: 0x06000378 RID: 888 RVA: 0x000122A9 File Offset: 0x000112A9
|
||||
public int SetAttributes
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.setAttributes_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.setAttributes_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000CE RID: 206
|
||||
// (get) Token: 0x06000379 RID: 889 RVA: 0x000122B2 File Offset: 0x000112B2
|
||||
// (set) Token: 0x0600037A RID: 890 RVA: 0x000122BA File Offset: 0x000112BA
|
||||
public bool IsUnicodeText
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isUnicodeText_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.isUnicodeText_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600037B RID: 891 RVA: 0x000122C3 File Offset: 0x000112C3
|
||||
public ZipEntry MakeFileEntry(string fileName)
|
||||
{
|
||||
return this.MakeFileEntry(fileName, true);
|
||||
}
|
||||
|
||||
// Token: 0x0600037C RID: 892 RVA: 0x000122D0 File Offset: 0x000112D0
|
||||
public ZipEntry MakeFileEntry(string fileName, bool useFileSystem)
|
||||
{
|
||||
ZipEntry zipEntry = new ZipEntry(this.nameTransform_.TransformFile(fileName));
|
||||
zipEntry.IsUnicodeText = this.isUnicodeText_;
|
||||
int num = 0;
|
||||
bool flag = this.setAttributes_ != 0;
|
||||
FileInfo fileInfo = null;
|
||||
if (useFileSystem)
|
||||
{
|
||||
fileInfo = new FileInfo(fileName);
|
||||
}
|
||||
if (fileInfo != null && fileInfo.Exists)
|
||||
{
|
||||
switch (this.timeSetting_)
|
||||
{
|
||||
case ZipEntryFactory.TimeSetting.LastWriteTime:
|
||||
zipEntry.DateTime = fileInfo.LastWriteTime;
|
||||
break;
|
||||
case ZipEntryFactory.TimeSetting.LastWriteTimeUtc:
|
||||
zipEntry.DateTime = fileInfo.LastWriteTimeUtc;
|
||||
break;
|
||||
case ZipEntryFactory.TimeSetting.CreateTime:
|
||||
zipEntry.DateTime = fileInfo.CreationTime;
|
||||
break;
|
||||
case ZipEntryFactory.TimeSetting.CreateTimeUtc:
|
||||
zipEntry.DateTime = fileInfo.CreationTimeUtc;
|
||||
break;
|
||||
case ZipEntryFactory.TimeSetting.LastAccessTime:
|
||||
zipEntry.DateTime = fileInfo.LastAccessTime;
|
||||
break;
|
||||
case ZipEntryFactory.TimeSetting.LastAccessTimeUtc:
|
||||
zipEntry.DateTime = fileInfo.LastAccessTimeUtc;
|
||||
break;
|
||||
case ZipEntryFactory.TimeSetting.Fixed:
|
||||
zipEntry.DateTime = this.fixedDateTime_;
|
||||
break;
|
||||
default:
|
||||
throw new ZipException("Unhandled time setting in MakeFileEntry");
|
||||
}
|
||||
zipEntry.Size = fileInfo.Length;
|
||||
flag = true;
|
||||
num = (int)(fileInfo.Attributes & (FileAttributes)this.getAttributes_);
|
||||
}
|
||||
else if (this.timeSetting_ == ZipEntryFactory.TimeSetting.Fixed)
|
||||
{
|
||||
zipEntry.DateTime = this.fixedDateTime_;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
num |= this.setAttributes_;
|
||||
zipEntry.ExternalFileAttributes = num;
|
||||
}
|
||||
return zipEntry;
|
||||
}
|
||||
|
||||
// Token: 0x0600037D RID: 893 RVA: 0x00012408 File Offset: 0x00011408
|
||||
public ZipEntry MakeDirectoryEntry(string directoryName)
|
||||
{
|
||||
return this.MakeDirectoryEntry(directoryName, true);
|
||||
}
|
||||
|
||||
// Token: 0x0600037E RID: 894 RVA: 0x00012414 File Offset: 0x00011414
|
||||
public ZipEntry MakeDirectoryEntry(string directoryName, bool useFileSystem)
|
||||
{
|
||||
ZipEntry zipEntry = new ZipEntry(this.nameTransform_.TransformDirectory(directoryName));
|
||||
zipEntry.IsUnicodeText = this.isUnicodeText_;
|
||||
zipEntry.Size = 0L;
|
||||
int num = 0;
|
||||
DirectoryInfo directoryInfo = null;
|
||||
if (useFileSystem)
|
||||
{
|
||||
directoryInfo = new DirectoryInfo(directoryName);
|
||||
}
|
||||
if (directoryInfo != null && directoryInfo.Exists)
|
||||
{
|
||||
switch (this.timeSetting_)
|
||||
{
|
||||
case ZipEntryFactory.TimeSetting.LastWriteTime:
|
||||
zipEntry.DateTime = directoryInfo.LastWriteTime;
|
||||
break;
|
||||
case ZipEntryFactory.TimeSetting.LastWriteTimeUtc:
|
||||
zipEntry.DateTime = directoryInfo.LastWriteTimeUtc;
|
||||
break;
|
||||
case ZipEntryFactory.TimeSetting.CreateTime:
|
||||
zipEntry.DateTime = directoryInfo.CreationTime;
|
||||
break;
|
||||
case ZipEntryFactory.TimeSetting.CreateTimeUtc:
|
||||
zipEntry.DateTime = directoryInfo.CreationTimeUtc;
|
||||
break;
|
||||
case ZipEntryFactory.TimeSetting.LastAccessTime:
|
||||
zipEntry.DateTime = directoryInfo.LastAccessTime;
|
||||
break;
|
||||
case ZipEntryFactory.TimeSetting.LastAccessTimeUtc:
|
||||
zipEntry.DateTime = directoryInfo.LastAccessTimeUtc;
|
||||
break;
|
||||
case ZipEntryFactory.TimeSetting.Fixed:
|
||||
zipEntry.DateTime = this.fixedDateTime_;
|
||||
break;
|
||||
default:
|
||||
throw new ZipException("Unhandled time setting in MakeDirectoryEntry");
|
||||
}
|
||||
num = (int)(directoryInfo.Attributes & (FileAttributes)this.getAttributes_);
|
||||
}
|
||||
else if (this.timeSetting_ == ZipEntryFactory.TimeSetting.Fixed)
|
||||
{
|
||||
zipEntry.DateTime = this.fixedDateTime_;
|
||||
}
|
||||
num |= this.setAttributes_ | 16;
|
||||
zipEntry.ExternalFileAttributes = num;
|
||||
return zipEntry;
|
||||
}
|
||||
|
||||
// Token: 0x040002A0 RID: 672
|
||||
private INameTransform nameTransform_;
|
||||
|
||||
// Token: 0x040002A1 RID: 673
|
||||
private DateTime fixedDateTime_ = DateTime.Now;
|
||||
|
||||
// Token: 0x040002A2 RID: 674
|
||||
private ZipEntryFactory.TimeSetting timeSetting_;
|
||||
|
||||
// Token: 0x040002A3 RID: 675
|
||||
private bool isUnicodeText_;
|
||||
|
||||
// Token: 0x040002A4 RID: 676
|
||||
private int getAttributes_ = -1;
|
||||
|
||||
// Token: 0x040002A5 RID: 677
|
||||
private int setAttributes_;
|
||||
|
||||
// Token: 0x02000059 RID: 89
|
||||
public enum TimeSetting
|
||||
{
|
||||
// Token: 0x040002A7 RID: 679
|
||||
LastWriteTime,
|
||||
// Token: 0x040002A8 RID: 680
|
||||
LastWriteTimeUtc,
|
||||
// Token: 0x040002A9 RID: 681
|
||||
CreateTime,
|
||||
// Token: 0x040002AA RID: 682
|
||||
CreateTimeUtc,
|
||||
// Token: 0x040002AB RID: 683
|
||||
LastAccessTime,
|
||||
// Token: 0x040002AC RID: 684
|
||||
LastAccessTimeUtc,
|
||||
// Token: 0x040002AD RID: 685
|
||||
Fixed
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200005A RID: 90
|
||||
[Serializable]
|
||||
public class ZipException : SharpZipBaseException
|
||||
{
|
||||
// Token: 0x0600037F RID: 895 RVA: 0x00012537 File Offset: 0x00011537
|
||||
protected ZipException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000380 RID: 896 RVA: 0x00012541 File Offset: 0x00011541
|
||||
public ZipException()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000381 RID: 897 RVA: 0x00012549 File Offset: 0x00011549
|
||||
public ZipException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000382 RID: 898 RVA: 0x00012552 File Offset: 0x00011552
|
||||
public ZipException(string message, Exception exception)
|
||||
: base(message, exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,377 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000061 RID: 97
|
||||
public sealed class ZipExtraData : IDisposable
|
||||
{
|
||||
// Token: 0x060003A6 RID: 934 RVA: 0x00012BD3 File Offset: 0x00011BD3
|
||||
public ZipExtraData()
|
||||
{
|
||||
this.Clear();
|
||||
}
|
||||
|
||||
// Token: 0x060003A7 RID: 935 RVA: 0x00012BE1 File Offset: 0x00011BE1
|
||||
public ZipExtraData(byte[] data)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
this._data = new byte[0];
|
||||
return;
|
||||
}
|
||||
this._data = data;
|
||||
}
|
||||
|
||||
// Token: 0x060003A8 RID: 936 RVA: 0x00012C00 File Offset: 0x00011C00
|
||||
public byte[] GetEntryData()
|
||||
{
|
||||
if (this.Length > 65535)
|
||||
{
|
||||
throw new ZipException("Data exceeds maximum length");
|
||||
}
|
||||
return (byte[])this._data.Clone();
|
||||
}
|
||||
|
||||
// Token: 0x060003A9 RID: 937 RVA: 0x00012C2A File Offset: 0x00011C2A
|
||||
public void Clear()
|
||||
{
|
||||
if (this._data == null || this._data.Length != 0)
|
||||
{
|
||||
this._data = new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000DB RID: 219
|
||||
// (get) Token: 0x060003AA RID: 938 RVA: 0x00012C4A File Offset: 0x00011C4A
|
||||
public int Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._data.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060003AB RID: 939 RVA: 0x00012C54 File Offset: 0x00011C54
|
||||
public Stream GetStreamForTag(int tag)
|
||||
{
|
||||
Stream stream = null;
|
||||
if (this.Find(tag))
|
||||
{
|
||||
stream = new MemoryStream(this._data, this._index, this._readValueLength, false);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
// Token: 0x060003AC RID: 940 RVA: 0x00012C88 File Offset: 0x00011C88
|
||||
private ITaggedData GetData(short tag)
|
||||
{
|
||||
ITaggedData taggedData = null;
|
||||
if (this.Find((int)tag))
|
||||
{
|
||||
taggedData = ZipExtraData.Create(tag, this._data, this._readValueStart, this._readValueLength);
|
||||
}
|
||||
return taggedData;
|
||||
}
|
||||
|
||||
// Token: 0x060003AD RID: 941 RVA: 0x00012CBC File Offset: 0x00011CBC
|
||||
private static ITaggedData Create(short tag, byte[] data, int offset, int count)
|
||||
{
|
||||
ITaggedData taggedData;
|
||||
if (tag != 10)
|
||||
{
|
||||
if (tag != 21589)
|
||||
{
|
||||
taggedData = new RawTaggedData(tag);
|
||||
}
|
||||
else
|
||||
{
|
||||
taggedData = new ExtendedUnixData();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
taggedData = new NTTaggedData();
|
||||
}
|
||||
taggedData.SetData(data, offset, count);
|
||||
return taggedData;
|
||||
}
|
||||
|
||||
// Token: 0x170000DC RID: 220
|
||||
// (get) Token: 0x060003AE RID: 942 RVA: 0x00012CFD File Offset: 0x00011CFD
|
||||
public int ValueLength
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._readValueLength;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000DD RID: 221
|
||||
// (get) Token: 0x060003AF RID: 943 RVA: 0x00012D05 File Offset: 0x00011D05
|
||||
public int CurrentReadIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._index;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000DE RID: 222
|
||||
// (get) Token: 0x060003B0 RID: 944 RVA: 0x00012D0D File Offset: 0x00011D0D
|
||||
public int UnreadCount
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._readValueStart > this._data.Length || this._readValueStart < 4)
|
||||
{
|
||||
throw new ZipException("Find must be called before calling a Read method");
|
||||
}
|
||||
return this._readValueStart + this._readValueLength - this._index;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060003B1 RID: 945 RVA: 0x00012D48 File Offset: 0x00011D48
|
||||
public bool Find(int headerID)
|
||||
{
|
||||
this._readValueStart = this._data.Length;
|
||||
this._readValueLength = 0;
|
||||
this._index = 0;
|
||||
int num = this._readValueStart;
|
||||
int num2 = headerID - 1;
|
||||
while (num2 != headerID && this._index < this._data.Length - 3)
|
||||
{
|
||||
num2 = this.ReadShortInternal();
|
||||
num = this.ReadShortInternal();
|
||||
if (num2 != headerID)
|
||||
{
|
||||
this._index += num;
|
||||
}
|
||||
}
|
||||
bool flag = num2 == headerID && this._index + num <= this._data.Length;
|
||||
if (flag)
|
||||
{
|
||||
this._readValueStart = this._index;
|
||||
this._readValueLength = num;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060003B2 RID: 946 RVA: 0x00012DE8 File Offset: 0x00011DE8
|
||||
public void AddEntry(ITaggedData taggedData)
|
||||
{
|
||||
if (taggedData == null)
|
||||
{
|
||||
throw new ArgumentNullException("taggedData");
|
||||
}
|
||||
this.AddEntry((int)taggedData.TagID, taggedData.GetData());
|
||||
}
|
||||
|
||||
// Token: 0x060003B3 RID: 947 RVA: 0x00012E0C File Offset: 0x00011E0C
|
||||
public void AddEntry(int headerID, byte[] fieldData)
|
||||
{
|
||||
if (headerID > 65535 || headerID < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("headerID");
|
||||
}
|
||||
int num = ((fieldData == null) ? 0 : fieldData.Length);
|
||||
if (num > 65535)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("fieldData", "exceeds maximum length");
|
||||
}
|
||||
int num2 = this._data.Length + num + 4;
|
||||
if (this.Find(headerID))
|
||||
{
|
||||
num2 -= this.ValueLength + 4;
|
||||
}
|
||||
if (num2 > 65535)
|
||||
{
|
||||
throw new ZipException("Data exceeds maximum length");
|
||||
}
|
||||
this.Delete(headerID);
|
||||
byte[] array = new byte[num2];
|
||||
this._data.CopyTo(array, 0);
|
||||
int num3 = this._data.Length;
|
||||
this._data = array;
|
||||
this.SetShort(ref num3, headerID);
|
||||
this.SetShort(ref num3, num);
|
||||
if (fieldData != null)
|
||||
{
|
||||
fieldData.CopyTo(array, num3);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060003B4 RID: 948 RVA: 0x00012ECF File Offset: 0x00011ECF
|
||||
public void StartNewEntry()
|
||||
{
|
||||
this._newEntry = new MemoryStream();
|
||||
}
|
||||
|
||||
// Token: 0x060003B5 RID: 949 RVA: 0x00012EDC File Offset: 0x00011EDC
|
||||
public void AddNewEntry(int headerID)
|
||||
{
|
||||
byte[] array = this._newEntry.ToArray();
|
||||
this._newEntry = null;
|
||||
this.AddEntry(headerID, array);
|
||||
}
|
||||
|
||||
// Token: 0x060003B6 RID: 950 RVA: 0x00012F04 File Offset: 0x00011F04
|
||||
public void AddData(byte data)
|
||||
{
|
||||
this._newEntry.WriteByte(data);
|
||||
}
|
||||
|
||||
// Token: 0x060003B7 RID: 951 RVA: 0x00012F12 File Offset: 0x00011F12
|
||||
public void AddData(byte[] data)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
}
|
||||
this._newEntry.Write(data, 0, data.Length);
|
||||
}
|
||||
|
||||
// Token: 0x060003B8 RID: 952 RVA: 0x00012F32 File Offset: 0x00011F32
|
||||
public void AddLeShort(int toAdd)
|
||||
{
|
||||
this._newEntry.WriteByte((byte)toAdd);
|
||||
this._newEntry.WriteByte((byte)(toAdd >> 8));
|
||||
}
|
||||
|
||||
// Token: 0x060003B9 RID: 953 RVA: 0x00012F50 File Offset: 0x00011F50
|
||||
public void AddLeInt(int toAdd)
|
||||
{
|
||||
this.AddLeShort((int)((short)toAdd));
|
||||
this.AddLeShort((int)((short)(toAdd >> 16)));
|
||||
}
|
||||
|
||||
// Token: 0x060003BA RID: 954 RVA: 0x00012F65 File Offset: 0x00011F65
|
||||
public void AddLeLong(long toAdd)
|
||||
{
|
||||
this.AddLeInt((int)(toAdd & (long)((ulong)(-1))));
|
||||
this.AddLeInt((int)(toAdd >> 32));
|
||||
}
|
||||
|
||||
// Token: 0x060003BB RID: 955 RVA: 0x00012F80 File Offset: 0x00011F80
|
||||
public bool Delete(int headerID)
|
||||
{
|
||||
bool flag = false;
|
||||
if (this.Find(headerID))
|
||||
{
|
||||
flag = true;
|
||||
int num = this._readValueStart - 4;
|
||||
byte[] array = new byte[this._data.Length - (this.ValueLength + 4)];
|
||||
Array.Copy(this._data, 0, array, 0, num);
|
||||
int num2 = num + this.ValueLength + 4;
|
||||
Array.Copy(this._data, num2, array, num, this._data.Length - num2);
|
||||
this._data = array;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060003BC RID: 956 RVA: 0x00012FF4 File Offset: 0x00011FF4
|
||||
public long ReadLong()
|
||||
{
|
||||
this.ReadCheck(8);
|
||||
return ((long)this.ReadInt() & (long)((ulong)(-1))) | ((long)this.ReadInt() << 32);
|
||||
}
|
||||
|
||||
// Token: 0x060003BD RID: 957 RVA: 0x00013014 File Offset: 0x00012014
|
||||
public int ReadInt()
|
||||
{
|
||||
this.ReadCheck(4);
|
||||
int num = (int)this._data[this._index] + ((int)this._data[this._index + 1] << 8) + ((int)this._data[this._index + 2] << 16) + ((int)this._data[this._index + 3] << 24);
|
||||
this._index += 4;
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x060003BE RID: 958 RVA: 0x00013080 File Offset: 0x00012080
|
||||
public int ReadShort()
|
||||
{
|
||||
this.ReadCheck(2);
|
||||
int num = (int)this._data[this._index] + ((int)this._data[this._index + 1] << 8);
|
||||
this._index += 2;
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x060003BF RID: 959 RVA: 0x000130C4 File Offset: 0x000120C4
|
||||
public int ReadByte()
|
||||
{
|
||||
int num = -1;
|
||||
if (this._index < this._data.Length && this._readValueStart + this._readValueLength > this._index)
|
||||
{
|
||||
num = (int)this._data[this._index];
|
||||
this._index++;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x060003C0 RID: 960 RVA: 0x00013115 File Offset: 0x00012115
|
||||
public void Skip(int amount)
|
||||
{
|
||||
this.ReadCheck(amount);
|
||||
this._index += amount;
|
||||
}
|
||||
|
||||
// Token: 0x060003C1 RID: 961 RVA: 0x0001312C File Offset: 0x0001212C
|
||||
private void ReadCheck(int length)
|
||||
{
|
||||
if (this._readValueStart > this._data.Length || this._readValueStart < 4)
|
||||
{
|
||||
throw new ZipException("Find must be called before calling a Read method");
|
||||
}
|
||||
if (this._index > this._readValueStart + this._readValueLength - length)
|
||||
{
|
||||
throw new ZipException("End of extra data");
|
||||
}
|
||||
if (this._index + length < 4)
|
||||
{
|
||||
throw new ZipException("Cannot read before start of tag");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060003C2 RID: 962 RVA: 0x00013198 File Offset: 0x00012198
|
||||
private int ReadShortInternal()
|
||||
{
|
||||
if (this._index > this._data.Length - 2)
|
||||
{
|
||||
throw new ZipException("End of extra data");
|
||||
}
|
||||
int num = (int)this._data[this._index] + ((int)this._data[this._index + 1] << 8);
|
||||
this._index += 2;
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x060003C3 RID: 963 RVA: 0x000131F1 File Offset: 0x000121F1
|
||||
private void SetShort(ref int index, int source)
|
||||
{
|
||||
this._data[index] = (byte)source;
|
||||
this._data[index + 1] = (byte)(source >> 8);
|
||||
index += 2;
|
||||
}
|
||||
|
||||
// Token: 0x060003C4 RID: 964 RVA: 0x00013213 File Offset: 0x00012213
|
||||
public void Dispose()
|
||||
{
|
||||
if (this._newEntry != null)
|
||||
{
|
||||
this._newEntry.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040002BB RID: 699
|
||||
private int _index;
|
||||
|
||||
// Token: 0x040002BC RID: 700
|
||||
private int _readValueStart;
|
||||
|
||||
// Token: 0x040002BD RID: 701
|
||||
private int _readValueLength;
|
||||
|
||||
// Token: 0x040002BE RID: 702
|
||||
private MemoryStream _newEntry;
|
||||
|
||||
// Token: 0x040002BF RID: 703
|
||||
private byte[] _data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2983 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using ICSharpCode.SharpZipLib.Checksums;
|
||||
using ICSharpCode.SharpZipLib.Core;
|
||||
using ICSharpCode.SharpZipLib.Encryption;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000068 RID: 104
|
||||
public class ZipFile : IEnumerable, IDisposable
|
||||
{
|
||||
// Token: 0x060003D9 RID: 985 RVA: 0x000132E8 File Offset: 0x000122E8
|
||||
private void OnKeysRequired(string fileName)
|
||||
{
|
||||
if (this.KeysRequired != null)
|
||||
{
|
||||
KeysRequiredEventArgs keysRequiredEventArgs = new KeysRequiredEventArgs(fileName, this.key);
|
||||
this.KeysRequired(this, keysRequiredEventArgs);
|
||||
this.key = keysRequiredEventArgs.Key;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000E7 RID: 231
|
||||
// (get) Token: 0x060003DA RID: 986 RVA: 0x00013323 File Offset: 0x00012323
|
||||
// (set) Token: 0x060003DB RID: 987 RVA: 0x0001332B File Offset: 0x0001232B
|
||||
private byte[] Key
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.key;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.key = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000E8 RID: 232
|
||||
// (set) Token: 0x060003DC RID: 988 RVA: 0x00013334 File Offset: 0x00012334
|
||||
public string Password
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value == null || value.Length == 0)
|
||||
{
|
||||
this.key = null;
|
||||
return;
|
||||
}
|
||||
this.rawPassword_ = value;
|
||||
this.key = PkzipClassic.GenerateKeys(ZipConstants.ConvertToArray(value));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000E9 RID: 233
|
||||
// (get) Token: 0x060003DD RID: 989 RVA: 0x00013361 File Offset: 0x00012361
|
||||
private bool HaveKeys
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.key != null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060003DE RID: 990 RVA: 0x00013370 File Offset: 0x00012370
|
||||
public ZipFile(string name)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
this.name_ = name;
|
||||
this.baseStream_ = File.Open(name, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
this.isStreamOwner = true;
|
||||
try
|
||||
{
|
||||
this.ReadEntries();
|
||||
}
|
||||
catch
|
||||
{
|
||||
this.DisposeInternal(true);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060003DF RID: 991 RVA: 0x000133F0 File Offset: 0x000123F0
|
||||
public ZipFile(FileStream file)
|
||||
{
|
||||
if (file == null)
|
||||
{
|
||||
throw new ArgumentNullException("file");
|
||||
}
|
||||
if (!file.CanSeek)
|
||||
{
|
||||
throw new ArgumentException("Stream is not seekable", "file");
|
||||
}
|
||||
this.baseStream_ = file;
|
||||
this.name_ = file.Name;
|
||||
this.isStreamOwner = true;
|
||||
try
|
||||
{
|
||||
this.ReadEntries();
|
||||
}
|
||||
catch
|
||||
{
|
||||
this.DisposeInternal(true);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060003E0 RID: 992 RVA: 0x00013484 File Offset: 0x00012484
|
||||
public ZipFile(Stream stream)
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ArgumentNullException("stream");
|
||||
}
|
||||
if (!stream.CanSeek)
|
||||
{
|
||||
throw new ArgumentException("Stream is not seekable", "stream");
|
||||
}
|
||||
this.baseStream_ = stream;
|
||||
this.isStreamOwner = true;
|
||||
if (this.baseStream_.Length > 0L)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.ReadEntries();
|
||||
return;
|
||||
}
|
||||
catch
|
||||
{
|
||||
this.DisposeInternal(true);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
this.entries_ = new ZipEntry[0];
|
||||
this.isNewArchive_ = true;
|
||||
}
|
||||
|
||||
// Token: 0x060003E1 RID: 993 RVA: 0x0001352C File Offset: 0x0001252C
|
||||
internal ZipFile()
|
||||
{
|
||||
this.entries_ = new ZipEntry[0];
|
||||
this.isNewArchive_ = true;
|
||||
}
|
||||
|
||||
// Token: 0x060003E2 RID: 994 RVA: 0x00013564 File Offset: 0x00012564
|
||||
~ZipFile()
|
||||
{
|
||||
this.Dispose(false);
|
||||
}
|
||||
|
||||
// Token: 0x060003E3 RID: 995 RVA: 0x00013594 File Offset: 0x00012594
|
||||
public void Close()
|
||||
{
|
||||
this.DisposeInternal(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Token: 0x060003E4 RID: 996 RVA: 0x000135A4 File Offset: 0x000125A4
|
||||
public static ZipFile Create(string fileName)
|
||||
{
|
||||
if (fileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileName");
|
||||
}
|
||||
FileStream fileStream = File.Create(fileName);
|
||||
return new ZipFile
|
||||
{
|
||||
name_ = fileName,
|
||||
baseStream_ = fileStream,
|
||||
isStreamOwner = true
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x060003E5 RID: 997 RVA: 0x000135E4 File Offset: 0x000125E4
|
||||
public static ZipFile Create(Stream outStream)
|
||||
{
|
||||
if (outStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("outStream");
|
||||
}
|
||||
if (!outStream.CanWrite)
|
||||
{
|
||||
throw new ArgumentException("Stream is not writeable", "outStream");
|
||||
}
|
||||
if (!outStream.CanSeek)
|
||||
{
|
||||
throw new ArgumentException("Stream is not seekable", "outStream");
|
||||
}
|
||||
return new ZipFile
|
||||
{
|
||||
baseStream_ = outStream
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x170000EA RID: 234
|
||||
// (get) Token: 0x060003E6 RID: 998 RVA: 0x0001363D File Offset: 0x0001263D
|
||||
// (set) Token: 0x060003E7 RID: 999 RVA: 0x00013645 File Offset: 0x00012645
|
||||
public bool IsStreamOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isStreamOwner;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.isStreamOwner = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000EB RID: 235
|
||||
// (get) Token: 0x060003E8 RID: 1000 RVA: 0x0001364E File Offset: 0x0001264E
|
||||
public bool IsEmbeddedArchive
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.offsetOfFirstEntry > 0L;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000EC RID: 236
|
||||
// (get) Token: 0x060003E9 RID: 1001 RVA: 0x0001365A File Offset: 0x0001265A
|
||||
public bool IsNewArchive
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isNewArchive_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000ED RID: 237
|
||||
// (get) Token: 0x060003EA RID: 1002 RVA: 0x00013662 File Offset: 0x00012662
|
||||
public string ZipFileComment
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.comment_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000EE RID: 238
|
||||
// (get) Token: 0x060003EB RID: 1003 RVA: 0x0001366A File Offset: 0x0001266A
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000EF RID: 239
|
||||
// (get) Token: 0x060003EC RID: 1004 RVA: 0x00013672 File Offset: 0x00012672
|
||||
[Obsolete("Use the Count property instead")]
|
||||
public int Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.entries_.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000F0 RID: 240
|
||||
// (get) Token: 0x060003ED RID: 1005 RVA: 0x0001367C File Offset: 0x0001267C
|
||||
public long Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return (long)this.entries_.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000F1 RID: 241
|
||||
[IndexerName("EntryByIndex")]
|
||||
public ZipEntry this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ZipEntry)this.entries_[index].Clone();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060003EF RID: 1007 RVA: 0x0001369B File Offset: 0x0001269B
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
if (this.isDisposed_)
|
||||
{
|
||||
throw new ObjectDisposedException("ZipFile");
|
||||
}
|
||||
return new ZipFile.ZipEntryEnumerator(this.entries_);
|
||||
}
|
||||
|
||||
// Token: 0x060003F0 RID: 1008 RVA: 0x000136BC File Offset: 0x000126BC
|
||||
public int FindEntry(string name, bool ignoreCase)
|
||||
{
|
||||
if (this.isDisposed_)
|
||||
{
|
||||
throw new ObjectDisposedException("ZipFile");
|
||||
}
|
||||
for (int i = 0; i < this.entries_.Length; i++)
|
||||
{
|
||||
if (string.Compare(name, this.entries_[i].Name, ignoreCase, CultureInfo.InvariantCulture) == 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x060003F1 RID: 1009 RVA: 0x00013710 File Offset: 0x00012710
|
||||
public ZipEntry GetEntry(string name)
|
||||
{
|
||||
if (this.isDisposed_)
|
||||
{
|
||||
throw new ObjectDisposedException("ZipFile");
|
||||
}
|
||||
int num = this.FindEntry(name, true);
|
||||
if (num < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return (ZipEntry)this.entries_[num].Clone();
|
||||
}
|
||||
|
||||
// Token: 0x060003F2 RID: 1010 RVA: 0x00013754 File Offset: 0x00012754
|
||||
public Stream GetInputStream(ZipEntry entry)
|
||||
{
|
||||
if (entry == null)
|
||||
{
|
||||
throw new ArgumentNullException("entry");
|
||||
}
|
||||
if (this.isDisposed_)
|
||||
{
|
||||
throw new ObjectDisposedException("ZipFile");
|
||||
}
|
||||
long num = entry.ZipFileIndex;
|
||||
if (num < 0L || num >= (long)this.entries_.Length || this.entries_[(int)(checked((IntPtr)num))].Name != entry.Name)
|
||||
{
|
||||
num = (long)this.FindEntry(entry.Name, true);
|
||||
if (num < 0L)
|
||||
{
|
||||
throw new ZipException("Entry cannot be found");
|
||||
}
|
||||
}
|
||||
return this.GetInputStream(num);
|
||||
}
|
||||
|
||||
// Token: 0x060003F3 RID: 1011 RVA: 0x000137DC File Offset: 0x000127DC
|
||||
public Stream GetInputStream(long entryIndex)
|
||||
{
|
||||
if (this.isDisposed_)
|
||||
{
|
||||
throw new ObjectDisposedException("ZipFile");
|
||||
}
|
||||
checked
|
||||
{
|
||||
long num = this.LocateEntry(this.entries_[(int)((IntPtr)entryIndex)]);
|
||||
CompressionMethod compressionMethod = this.entries_[(int)((IntPtr)entryIndex)].CompressionMethod;
|
||||
Stream stream = new ZipFile.PartialInputStream(this, num, this.entries_[(int)((IntPtr)entryIndex)].CompressedSize);
|
||||
if (this.entries_[(int)((IntPtr)entryIndex)].IsCrypted)
|
||||
{
|
||||
stream = this.CreateAndInitDecryptionStream(stream, this.entries_[(int)((IntPtr)entryIndex)]);
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ZipException("Unable to decrypt this entry");
|
||||
}
|
||||
}
|
||||
CompressionMethod compressionMethod2 = compressionMethod;
|
||||
if (compressionMethod2 != CompressionMethod.Stored)
|
||||
{
|
||||
if (compressionMethod2 != CompressionMethod.Deflated)
|
||||
{
|
||||
throw new ZipException("Unsupported compression method " + compressionMethod);
|
||||
}
|
||||
stream = new InflaterInputStream(stream, new Inflater(true));
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060003F4 RID: 1012 RVA: 0x00013890 File Offset: 0x00012890
|
||||
public bool TestArchive(bool testData)
|
||||
{
|
||||
return this.TestArchive(testData, TestStrategy.FindFirstError, null);
|
||||
}
|
||||
|
||||
// Token: 0x060003F5 RID: 1013 RVA: 0x0001389C File Offset: 0x0001289C
|
||||
public bool TestArchive(bool testData, TestStrategy strategy, ZipTestResultHandler resultHandler)
|
||||
{
|
||||
if (this.isDisposed_)
|
||||
{
|
||||
throw new ObjectDisposedException("ZipFile");
|
||||
}
|
||||
TestStatus testStatus = new TestStatus(this);
|
||||
if (resultHandler != null)
|
||||
{
|
||||
resultHandler(testStatus, null);
|
||||
}
|
||||
ZipFile.HeaderTest headerTest = (testData ? (ZipFile.HeaderTest.Extract | ZipFile.HeaderTest.Header) : ZipFile.HeaderTest.Header);
|
||||
bool flag = true;
|
||||
try
|
||||
{
|
||||
int num = 0;
|
||||
while (flag && (long)num < this.Count)
|
||||
{
|
||||
if (resultHandler != null)
|
||||
{
|
||||
testStatus.SetEntry(this[num]);
|
||||
testStatus.SetOperation(TestOperation.EntryHeader);
|
||||
resultHandler(testStatus, null);
|
||||
}
|
||||
try
|
||||
{
|
||||
this.TestLocalHeader(this[num], headerTest);
|
||||
}
|
||||
catch (ZipException ex)
|
||||
{
|
||||
testStatus.AddError();
|
||||
if (resultHandler != null)
|
||||
{
|
||||
resultHandler(testStatus, string.Format("Exception during test - '{0}'", ex.Message));
|
||||
}
|
||||
if (strategy == TestStrategy.FindFirstError)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
if (flag && testData && this[num].IsFile)
|
||||
{
|
||||
if (resultHandler != null)
|
||||
{
|
||||
testStatus.SetOperation(TestOperation.EntryData);
|
||||
resultHandler(testStatus, null);
|
||||
}
|
||||
Crc32 crc = new Crc32();
|
||||
using (Stream inputStream = this.GetInputStream(this[num]))
|
||||
{
|
||||
byte[] array = new byte[4096];
|
||||
long num2 = 0L;
|
||||
int num3;
|
||||
while ((num3 = inputStream.Read(array, 0, array.Length)) > 0)
|
||||
{
|
||||
crc.Update(array, 0, num3);
|
||||
if (resultHandler != null)
|
||||
{
|
||||
num2 += (long)num3;
|
||||
testStatus.SetBytesTested(num2);
|
||||
resultHandler(testStatus, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this[num].Crc != crc.Value)
|
||||
{
|
||||
testStatus.AddError();
|
||||
if (resultHandler != null)
|
||||
{
|
||||
resultHandler(testStatus, "CRC mismatch");
|
||||
}
|
||||
if (strategy == TestStrategy.FindFirstError)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
if ((this[num].Flags & 8) != 0)
|
||||
{
|
||||
ZipHelperStream zipHelperStream = new ZipHelperStream(this.baseStream_);
|
||||
DescriptorData descriptorData = new DescriptorData();
|
||||
zipHelperStream.ReadDataDescriptor(this[num].LocalHeaderRequiresZip64, descriptorData);
|
||||
if (this[num].Crc != descriptorData.Crc)
|
||||
{
|
||||
testStatus.AddError();
|
||||
}
|
||||
if (this[num].CompressedSize != descriptorData.CompressedSize)
|
||||
{
|
||||
testStatus.AddError();
|
||||
}
|
||||
if (this[num].Size != descriptorData.Size)
|
||||
{
|
||||
testStatus.AddError();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (resultHandler != null)
|
||||
{
|
||||
testStatus.SetOperation(TestOperation.EntryComplete);
|
||||
resultHandler(testStatus, null);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
if (resultHandler != null)
|
||||
{
|
||||
testStatus.SetOperation(TestOperation.MiscellaneousTests);
|
||||
resultHandler(testStatus, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
testStatus.AddError();
|
||||
if (resultHandler != null)
|
||||
{
|
||||
resultHandler(testStatus, string.Format("Exception during test - '{0}'", ex2.Message));
|
||||
}
|
||||
}
|
||||
if (resultHandler != null)
|
||||
{
|
||||
testStatus.SetOperation(TestOperation.Complete);
|
||||
testStatus.SetEntry(null);
|
||||
resultHandler(testStatus, null);
|
||||
}
|
||||
return testStatus.ErrorCount == 0;
|
||||
}
|
||||
|
||||
// Token: 0x060003F6 RID: 1014 RVA: 0x00013B60 File Offset: 0x00012B60
|
||||
private long TestLocalHeader(ZipEntry entry, ZipFile.HeaderTest tests)
|
||||
{
|
||||
long num12;
|
||||
lock (this.baseStream_)
|
||||
{
|
||||
bool flag = (tests & ZipFile.HeaderTest.Header) != (ZipFile.HeaderTest)0;
|
||||
bool flag2 = (tests & ZipFile.HeaderTest.Extract) != (ZipFile.HeaderTest)0;
|
||||
this.baseStream_.Seek(this.offsetOfFirstEntry + entry.Offset, SeekOrigin.Begin);
|
||||
if (this.ReadLEUint() != 67324752U)
|
||||
{
|
||||
throw new ZipException(string.Format("Wrong local header signature @{0:X}", this.offsetOfFirstEntry + entry.Offset));
|
||||
}
|
||||
short num = (short)this.ReadLEUshort();
|
||||
short num2 = (short)this.ReadLEUshort();
|
||||
short num3 = (short)this.ReadLEUshort();
|
||||
short num4 = (short)this.ReadLEUshort();
|
||||
short num5 = (short)this.ReadLEUshort();
|
||||
uint num6 = this.ReadLEUint();
|
||||
long num7 = (long)((ulong)this.ReadLEUint());
|
||||
long num8 = (long)((ulong)this.ReadLEUint());
|
||||
int num9 = (int)this.ReadLEUshort();
|
||||
int num10 = (int)this.ReadLEUshort();
|
||||
byte[] array = new byte[num9];
|
||||
StreamUtils.ReadFully(this.baseStream_, array);
|
||||
byte[] array2 = new byte[num10];
|
||||
StreamUtils.ReadFully(this.baseStream_, array2);
|
||||
ZipExtraData zipExtraData = new ZipExtraData(array2);
|
||||
if (zipExtraData.Find(1))
|
||||
{
|
||||
num8 = zipExtraData.ReadLong();
|
||||
num7 = zipExtraData.ReadLong();
|
||||
if ((num2 & 8) != 0)
|
||||
{
|
||||
if (num8 != -1L && num8 != entry.Size)
|
||||
{
|
||||
throw new ZipException("Size invalid for descriptor");
|
||||
}
|
||||
if (num7 != -1L && num7 != entry.CompressedSize)
|
||||
{
|
||||
throw new ZipException("Compressed size invalid for descriptor");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (num >= 45 && ((uint)num8 == 4294967295U || (uint)num7 == 4294967295U))
|
||||
{
|
||||
throw new ZipException("Required Zip64 extended information missing");
|
||||
}
|
||||
if (flag2 && entry.IsFile)
|
||||
{
|
||||
if (!entry.IsCompressionMethodSupported())
|
||||
{
|
||||
throw new ZipException("Compression method not supported");
|
||||
}
|
||||
if (num > 51 || (num > 20 && num < 45))
|
||||
{
|
||||
throw new ZipException(string.Format("Version required to extract this entry not supported ({0})", num));
|
||||
}
|
||||
if ((num2 & 12384) != 0)
|
||||
{
|
||||
throw new ZipException("The library does not support the zip version required to extract this entry");
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
if (num <= 63 && num != 10 && num != 11 && num != 20 && num != 21 && num != 25 && num != 27 && num != 45 && num != 46 && num != 50 && num != 51 && num != 52 && num != 61 && num != 62 && num != 63)
|
||||
{
|
||||
throw new ZipException(string.Format("Version required to extract this entry is invalid ({0})", num));
|
||||
}
|
||||
if (((int)num2 & 49168) != 0)
|
||||
{
|
||||
throw new ZipException("Reserved bit flags cannot be set.");
|
||||
}
|
||||
if ((num2 & 1) != 0 && num < 20)
|
||||
{
|
||||
throw new ZipException(string.Format("Version required to extract this entry is too low for encryption ({0})", num));
|
||||
}
|
||||
if ((num2 & 64) != 0)
|
||||
{
|
||||
if ((num2 & 1) == 0)
|
||||
{
|
||||
throw new ZipException("Strong encryption flag set but encryption flag is not set");
|
||||
}
|
||||
if (num < 50)
|
||||
{
|
||||
throw new ZipException(string.Format("Version required to extract this entry is too low for encryption ({0})", num));
|
||||
}
|
||||
}
|
||||
if ((num2 & 32) != 0 && num < 27)
|
||||
{
|
||||
throw new ZipException(string.Format("Patched data requires higher version than ({0})", num));
|
||||
}
|
||||
if ((int)num2 != entry.Flags)
|
||||
{
|
||||
throw new ZipException("Central header/local header flags mismatch");
|
||||
}
|
||||
if (entry.CompressionMethod != (CompressionMethod)num3)
|
||||
{
|
||||
throw new ZipException("Central header/local header compression method mismatch");
|
||||
}
|
||||
if (entry.Version != (int)num)
|
||||
{
|
||||
throw new ZipException("Extract version mismatch");
|
||||
}
|
||||
if ((num2 & 64) != 0 && num < 62)
|
||||
{
|
||||
throw new ZipException("Strong encryption flag set but version not high enough");
|
||||
}
|
||||
if ((num2 & 8192) != 0 && (num4 != 0 || num5 != 0))
|
||||
{
|
||||
throw new ZipException("Header masked set but date/time values non-zero");
|
||||
}
|
||||
if ((num2 & 8) == 0 && num6 != (uint)entry.Crc)
|
||||
{
|
||||
throw new ZipException("Central header/local header crc mismatch");
|
||||
}
|
||||
if (num8 == 0L && num7 == 0L && num6 != 0U)
|
||||
{
|
||||
throw new ZipException("Invalid CRC for empty entry");
|
||||
}
|
||||
if (entry.Name.Length > num9)
|
||||
{
|
||||
throw new ZipException("File name length mismatch");
|
||||
}
|
||||
string text = ZipConstants.ConvertToStringExt((int)num2, array);
|
||||
if (text != entry.Name)
|
||||
{
|
||||
throw new ZipException("Central header and local header file name mismatch");
|
||||
}
|
||||
if (entry.IsDirectory)
|
||||
{
|
||||
if (num8 > 0L)
|
||||
{
|
||||
throw new ZipException("Directory cannot have size");
|
||||
}
|
||||
if (entry.IsCrypted)
|
||||
{
|
||||
if (num7 > 14L)
|
||||
{
|
||||
throw new ZipException("Directory compressed size invalid");
|
||||
}
|
||||
}
|
||||
else if (num7 > 2L)
|
||||
{
|
||||
throw new ZipException("Directory compressed size invalid");
|
||||
}
|
||||
}
|
||||
if (!ZipNameTransform.IsValidName(text, true))
|
||||
{
|
||||
throw new ZipException("Name is invalid");
|
||||
}
|
||||
}
|
||||
if ((num2 & 8) == 0 || num8 > 0L || num7 > 0L)
|
||||
{
|
||||
if (num8 != entry.Size)
|
||||
{
|
||||
throw new ZipException(string.Format("Size mismatch between central header({0}) and local header({1})", entry.Size, num8));
|
||||
}
|
||||
if (num7 != entry.CompressedSize && num7 != (long)((ulong)(-1)) && num7 != -1L)
|
||||
{
|
||||
throw new ZipException(string.Format("Compressed size mismatch between central header({0}) and local header({1})", entry.CompressedSize, num7));
|
||||
}
|
||||
}
|
||||
int num11 = num9 + num10;
|
||||
num12 = this.offsetOfFirstEntry + entry.Offset + 30L + (long)num11;
|
||||
}
|
||||
return num12;
|
||||
}
|
||||
|
||||
// Token: 0x170000F2 RID: 242
|
||||
// (get) Token: 0x060003F7 RID: 1015 RVA: 0x00014010 File Offset: 0x00013010
|
||||
// (set) Token: 0x060003F8 RID: 1016 RVA: 0x0001401D File Offset: 0x0001301D
|
||||
public INameTransform NameTransform
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.updateEntryFactory_.NameTransform;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.updateEntryFactory_.NameTransform = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000F3 RID: 243
|
||||
// (get) Token: 0x060003F9 RID: 1017 RVA: 0x0001402B File Offset: 0x0001302B
|
||||
// (set) Token: 0x060003FA RID: 1018 RVA: 0x00014033 File Offset: 0x00013033
|
||||
public IEntryFactory EntryFactory
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.updateEntryFactory_;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
this.updateEntryFactory_ = new ZipEntryFactory();
|
||||
return;
|
||||
}
|
||||
this.updateEntryFactory_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000F4 RID: 244
|
||||
// (get) Token: 0x060003FB RID: 1019 RVA: 0x0001404B File Offset: 0x0001304B
|
||||
// (set) Token: 0x060003FC RID: 1020 RVA: 0x00014053 File Offset: 0x00013053
|
||||
public int BufferSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bufferSize_;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 1024)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "cannot be below 1024");
|
||||
}
|
||||
if (this.bufferSize_ != value)
|
||||
{
|
||||
this.bufferSize_ = value;
|
||||
this.copyBuffer_ = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000F5 RID: 245
|
||||
// (get) Token: 0x060003FD RID: 1021 RVA: 0x00014084 File Offset: 0x00013084
|
||||
public bool IsUpdating
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.updates_ != null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000F6 RID: 246
|
||||
// (get) Token: 0x060003FE RID: 1022 RVA: 0x00014092 File Offset: 0x00013092
|
||||
// (set) Token: 0x060003FF RID: 1023 RVA: 0x0001409A File Offset: 0x0001309A
|
||||
public UseZip64 UseZip64
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.useZip64_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.useZip64_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000400 RID: 1024 RVA: 0x000140A4 File Offset: 0x000130A4
|
||||
public void BeginUpdate(IArchiveStorage archiveStorage, IDynamicDataSource dataSource)
|
||||
{
|
||||
if (archiveStorage == null)
|
||||
{
|
||||
throw new ArgumentNullException("archiveStorage");
|
||||
}
|
||||
if (dataSource == null)
|
||||
{
|
||||
throw new ArgumentNullException("dataSource");
|
||||
}
|
||||
if (this.isDisposed_)
|
||||
{
|
||||
throw new ObjectDisposedException("ZipFile");
|
||||
}
|
||||
if (this.IsEmbeddedArchive)
|
||||
{
|
||||
throw new ZipException("Cannot update embedded/SFX archives");
|
||||
}
|
||||
this.archiveStorage_ = archiveStorage;
|
||||
this.updateDataSource_ = dataSource;
|
||||
this.updateIndex_ = new Hashtable();
|
||||
this.updates_ = new ArrayList(this.entries_.Length);
|
||||
foreach (ZipEntry zipEntry in this.entries_)
|
||||
{
|
||||
int num = this.updates_.Add(new ZipFile.ZipUpdate(zipEntry));
|
||||
this.updateIndex_.Add(zipEntry.Name, num);
|
||||
}
|
||||
this.updates_.Sort(new ZipFile.UpdateComparer());
|
||||
int num2 = 0;
|
||||
foreach (object obj in this.updates_)
|
||||
{
|
||||
ZipFile.ZipUpdate zipUpdate = (ZipFile.ZipUpdate)obj;
|
||||
if (num2 == this.updates_.Count - 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
zipUpdate.OffsetBasedSize = ((ZipFile.ZipUpdate)this.updates_[num2 + 1]).Entry.Offset - zipUpdate.Entry.Offset;
|
||||
num2++;
|
||||
}
|
||||
this.updateCount_ = (long)this.updates_.Count;
|
||||
this.contentsEdited_ = false;
|
||||
this.commentEdited_ = false;
|
||||
this.newComment_ = null;
|
||||
}
|
||||
|
||||
// Token: 0x06000401 RID: 1025 RVA: 0x00014234 File Offset: 0x00013234
|
||||
public void BeginUpdate(IArchiveStorage archiveStorage)
|
||||
{
|
||||
this.BeginUpdate(archiveStorage, new DynamicDiskDataSource());
|
||||
}
|
||||
|
||||
// Token: 0x06000402 RID: 1026 RVA: 0x00014242 File Offset: 0x00013242
|
||||
public void BeginUpdate()
|
||||
{
|
||||
if (this.Name == null)
|
||||
{
|
||||
this.BeginUpdate(new MemoryArchiveStorage(), new DynamicDiskDataSource());
|
||||
return;
|
||||
}
|
||||
this.BeginUpdate(new DiskArchiveStorage(this), new DynamicDiskDataSource());
|
||||
}
|
||||
|
||||
// Token: 0x06000403 RID: 1027 RVA: 0x00014270 File Offset: 0x00013270
|
||||
public void CommitUpdate()
|
||||
{
|
||||
if (this.isDisposed_)
|
||||
{
|
||||
throw new ObjectDisposedException("ZipFile");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
try
|
||||
{
|
||||
this.updateIndex_.Clear();
|
||||
this.updateIndex_ = null;
|
||||
if (this.contentsEdited_)
|
||||
{
|
||||
this.RunUpdates();
|
||||
}
|
||||
else if (this.commentEdited_)
|
||||
{
|
||||
this.UpdateCommentOnly();
|
||||
}
|
||||
else if (this.entries_.Length == 0)
|
||||
{
|
||||
byte[] array = ((this.newComment_ != null) ? this.newComment_.RawComment : ZipConstants.ConvertToArray(this.comment_));
|
||||
using (ZipHelperStream zipHelperStream = new ZipHelperStream(this.baseStream_))
|
||||
{
|
||||
zipHelperStream.WriteEndOfCentralDirectory(0L, 0L, 0L, array);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.PostUpdateCleanup();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000404 RID: 1028 RVA: 0x00014340 File Offset: 0x00013340
|
||||
public void AbortUpdate()
|
||||
{
|
||||
this.PostUpdateCleanup();
|
||||
}
|
||||
|
||||
// Token: 0x06000405 RID: 1029 RVA: 0x00014348 File Offset: 0x00013348
|
||||
public void SetComment(string comment)
|
||||
{
|
||||
if (this.isDisposed_)
|
||||
{
|
||||
throw new ObjectDisposedException("ZipFile");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
this.newComment_ = new ZipFile.ZipString(comment);
|
||||
if (this.newComment_.RawLength > 65535)
|
||||
{
|
||||
this.newComment_ = null;
|
||||
throw new ZipException("Comment length exceeds maximum - 65535");
|
||||
}
|
||||
this.commentEdited_ = true;
|
||||
}
|
||||
|
||||
// Token: 0x06000406 RID: 1030 RVA: 0x000143A8 File Offset: 0x000133A8
|
||||
private void AddUpdate(ZipFile.ZipUpdate update)
|
||||
{
|
||||
this.contentsEdited_ = true;
|
||||
int num = this.FindExistingUpdate(update.Entry.Name);
|
||||
if (num >= 0)
|
||||
{
|
||||
if (this.updates_[num] == null)
|
||||
{
|
||||
this.updateCount_ += 1L;
|
||||
}
|
||||
this.updates_[num] = update;
|
||||
return;
|
||||
}
|
||||
num = this.updates_.Add(update);
|
||||
this.updateCount_ += 1L;
|
||||
this.updateIndex_.Add(update.Entry.Name, num);
|
||||
}
|
||||
|
||||
// Token: 0x06000407 RID: 1031 RVA: 0x00014438 File Offset: 0x00013438
|
||||
public void Add(string fileName, CompressionMethod compressionMethod, bool useUnicodeText)
|
||||
{
|
||||
if (fileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileName");
|
||||
}
|
||||
if (this.isDisposed_)
|
||||
{
|
||||
throw new ObjectDisposedException("ZipFile");
|
||||
}
|
||||
if (!ZipEntry.IsCompressionMethodSupported(compressionMethod))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("compressionMethod");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
this.contentsEdited_ = true;
|
||||
ZipEntry zipEntry = this.EntryFactory.MakeFileEntry(fileName);
|
||||
zipEntry.IsUnicodeText = useUnicodeText;
|
||||
zipEntry.CompressionMethod = compressionMethod;
|
||||
this.AddUpdate(new ZipFile.ZipUpdate(fileName, zipEntry));
|
||||
}
|
||||
|
||||
// Token: 0x06000408 RID: 1032 RVA: 0x000144B0 File Offset: 0x000134B0
|
||||
public void Add(string fileName, CompressionMethod compressionMethod)
|
||||
{
|
||||
if (fileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileName");
|
||||
}
|
||||
if (!ZipEntry.IsCompressionMethodSupported(compressionMethod))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("compressionMethod");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
this.contentsEdited_ = true;
|
||||
ZipEntry zipEntry = this.EntryFactory.MakeFileEntry(fileName);
|
||||
zipEntry.CompressionMethod = compressionMethod;
|
||||
this.AddUpdate(new ZipFile.ZipUpdate(fileName, zipEntry));
|
||||
}
|
||||
|
||||
// Token: 0x06000409 RID: 1033 RVA: 0x0001450C File Offset: 0x0001350C
|
||||
public void Add(string fileName)
|
||||
{
|
||||
if (fileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileName");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
this.AddUpdate(new ZipFile.ZipUpdate(fileName, this.EntryFactory.MakeFileEntry(fileName)));
|
||||
}
|
||||
|
||||
// Token: 0x0600040A RID: 1034 RVA: 0x0001453A File Offset: 0x0001353A
|
||||
public void Add(string fileName, string entryName)
|
||||
{
|
||||
if (fileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileName");
|
||||
}
|
||||
if (entryName == null)
|
||||
{
|
||||
throw new ArgumentNullException("entryName");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
this.AddUpdate(new ZipFile.ZipUpdate(fileName, this.EntryFactory.MakeFileEntry(entryName)));
|
||||
}
|
||||
|
||||
// Token: 0x0600040B RID: 1035 RVA: 0x00014576 File Offset: 0x00013576
|
||||
public void Add(IStaticDataSource dataSource, string entryName)
|
||||
{
|
||||
if (dataSource == null)
|
||||
{
|
||||
throw new ArgumentNullException("dataSource");
|
||||
}
|
||||
if (entryName == null)
|
||||
{
|
||||
throw new ArgumentNullException("entryName");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
this.AddUpdate(new ZipFile.ZipUpdate(dataSource, this.EntryFactory.MakeFileEntry(entryName, false)));
|
||||
}
|
||||
|
||||
// Token: 0x0600040C RID: 1036 RVA: 0x000145B4 File Offset: 0x000135B4
|
||||
public void Add(IStaticDataSource dataSource, string entryName, CompressionMethod compressionMethod)
|
||||
{
|
||||
if (dataSource == null)
|
||||
{
|
||||
throw new ArgumentNullException("dataSource");
|
||||
}
|
||||
if (entryName == null)
|
||||
{
|
||||
throw new ArgumentNullException("entryName");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
ZipEntry zipEntry = this.EntryFactory.MakeFileEntry(entryName, false);
|
||||
zipEntry.CompressionMethod = compressionMethod;
|
||||
this.AddUpdate(new ZipFile.ZipUpdate(dataSource, zipEntry));
|
||||
}
|
||||
|
||||
// Token: 0x0600040D RID: 1037 RVA: 0x00014608 File Offset: 0x00013608
|
||||
public void Add(IStaticDataSource dataSource, string entryName, CompressionMethod compressionMethod, bool useUnicodeText)
|
||||
{
|
||||
if (dataSource == null)
|
||||
{
|
||||
throw new ArgumentNullException("dataSource");
|
||||
}
|
||||
if (entryName == null)
|
||||
{
|
||||
throw new ArgumentNullException("entryName");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
ZipEntry zipEntry = this.EntryFactory.MakeFileEntry(entryName, false);
|
||||
zipEntry.IsUnicodeText = useUnicodeText;
|
||||
zipEntry.CompressionMethod = compressionMethod;
|
||||
this.AddUpdate(new ZipFile.ZipUpdate(dataSource, zipEntry));
|
||||
}
|
||||
|
||||
// Token: 0x0600040E RID: 1038 RVA: 0x00014664 File Offset: 0x00013664
|
||||
public void Add(ZipEntry entry)
|
||||
{
|
||||
if (entry == null)
|
||||
{
|
||||
throw new ArgumentNullException("entry");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
if (entry.Size != 0L || entry.CompressedSize != 0L)
|
||||
{
|
||||
throw new ZipException("Entry cannot have any data");
|
||||
}
|
||||
this.AddUpdate(new ZipFile.ZipUpdate(ZipFile.UpdateCommand.Add, entry));
|
||||
}
|
||||
|
||||
// Token: 0x0600040F RID: 1039 RVA: 0x000146B4 File Offset: 0x000136B4
|
||||
public void AddDirectory(string directoryName)
|
||||
{
|
||||
if (directoryName == null)
|
||||
{
|
||||
throw new ArgumentNullException("directoryName");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
ZipEntry zipEntry = this.EntryFactory.MakeDirectoryEntry(directoryName);
|
||||
this.AddUpdate(new ZipFile.ZipUpdate(ZipFile.UpdateCommand.Add, zipEntry));
|
||||
}
|
||||
|
||||
// Token: 0x06000410 RID: 1040 RVA: 0x000146F0 File Offset: 0x000136F0
|
||||
public bool Delete(string fileName)
|
||||
{
|
||||
if (fileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileName");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
int num = this.FindExistingUpdate(fileName);
|
||||
if (num >= 0 && this.updates_[num] != null)
|
||||
{
|
||||
bool flag = true;
|
||||
this.contentsEdited_ = true;
|
||||
this.updates_[num] = null;
|
||||
this.updateCount_ -= 1L;
|
||||
return flag;
|
||||
}
|
||||
throw new ZipException("Cannot find entry to delete");
|
||||
}
|
||||
|
||||
// Token: 0x06000411 RID: 1041 RVA: 0x00014760 File Offset: 0x00013760
|
||||
public void Delete(ZipEntry entry)
|
||||
{
|
||||
if (entry == null)
|
||||
{
|
||||
throw new ArgumentNullException("entry");
|
||||
}
|
||||
this.CheckUpdating();
|
||||
int num = this.FindExistingUpdate(entry);
|
||||
if (num >= 0)
|
||||
{
|
||||
this.contentsEdited_ = true;
|
||||
this.updates_[num] = null;
|
||||
this.updateCount_ -= 1L;
|
||||
return;
|
||||
}
|
||||
throw new ZipException("Cannot find entry to delete");
|
||||
}
|
||||
|
||||
// Token: 0x06000412 RID: 1042 RVA: 0x000147BB File Offset: 0x000137BB
|
||||
private void WriteLEShort(int value)
|
||||
{
|
||||
this.baseStream_.WriteByte((byte)(value & 255));
|
||||
this.baseStream_.WriteByte((byte)((value >> 8) & 255));
|
||||
}
|
||||
|
||||
// Token: 0x06000413 RID: 1043 RVA: 0x000147E5 File Offset: 0x000137E5
|
||||
private void WriteLEUshort(ushort value)
|
||||
{
|
||||
this.baseStream_.WriteByte((byte)(value & 255));
|
||||
this.baseStream_.WriteByte((byte)(value >> 8));
|
||||
}
|
||||
|
||||
// Token: 0x06000414 RID: 1044 RVA: 0x00014809 File Offset: 0x00013809
|
||||
private void WriteLEInt(int value)
|
||||
{
|
||||
this.WriteLEShort(value & 65535);
|
||||
this.WriteLEShort(value >> 16);
|
||||
}
|
||||
|
||||
// Token: 0x06000415 RID: 1045 RVA: 0x00014822 File Offset: 0x00013822
|
||||
private void WriteLEUint(uint value)
|
||||
{
|
||||
this.WriteLEUshort((ushort)(value & 65535U));
|
||||
this.WriteLEUshort((ushort)(value >> 16));
|
||||
}
|
||||
|
||||
// Token: 0x06000416 RID: 1046 RVA: 0x0001483D File Offset: 0x0001383D
|
||||
private void WriteLeLong(long value)
|
||||
{
|
||||
this.WriteLEInt((int)(value & (long)((ulong)(-1))));
|
||||
this.WriteLEInt((int)(value >> 32));
|
||||
}
|
||||
|
||||
// Token: 0x06000417 RID: 1047 RVA: 0x00014855 File Offset: 0x00013855
|
||||
private void WriteLEUlong(ulong value)
|
||||
{
|
||||
this.WriteLEUint((uint)(value & (ulong)(-1)));
|
||||
this.WriteLEUint((uint)(value >> 32));
|
||||
}
|
||||
|
||||
// Token: 0x06000418 RID: 1048 RVA: 0x00014870 File Offset: 0x00013870
|
||||
private void WriteLocalEntryHeader(ZipFile.ZipUpdate update)
|
||||
{
|
||||
ZipEntry outEntry = update.OutEntry;
|
||||
outEntry.Offset = this.baseStream_.Position;
|
||||
if (update.Command != ZipFile.UpdateCommand.Copy)
|
||||
{
|
||||
if (outEntry.CompressionMethod == CompressionMethod.Deflated)
|
||||
{
|
||||
if (outEntry.Size == 0L)
|
||||
{
|
||||
outEntry.CompressedSize = outEntry.Size;
|
||||
outEntry.Crc = 0L;
|
||||
outEntry.CompressionMethod = CompressionMethod.Stored;
|
||||
}
|
||||
}
|
||||
else if (outEntry.CompressionMethod == CompressionMethod.Stored)
|
||||
{
|
||||
outEntry.Flags &= -9;
|
||||
}
|
||||
if (this.HaveKeys)
|
||||
{
|
||||
outEntry.IsCrypted = true;
|
||||
if (outEntry.Crc < 0L)
|
||||
{
|
||||
outEntry.Flags |= 8;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
outEntry.IsCrypted = false;
|
||||
}
|
||||
switch (this.useZip64_)
|
||||
{
|
||||
case UseZip64.On:
|
||||
outEntry.ForceZip64();
|
||||
break;
|
||||
case UseZip64.Dynamic:
|
||||
if (outEntry.Size < 0L)
|
||||
{
|
||||
outEntry.ForceZip64();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.WriteLEInt(67324752);
|
||||
this.WriteLEShort(outEntry.Version);
|
||||
this.WriteLEShort(outEntry.Flags);
|
||||
this.WriteLEShort((int)((byte)outEntry.CompressionMethod));
|
||||
this.WriteLEInt((int)outEntry.DosTime);
|
||||
if (!outEntry.HasCrc)
|
||||
{
|
||||
update.CrcPatchOffset = this.baseStream_.Position;
|
||||
this.WriteLEInt(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLEInt((int)outEntry.Crc);
|
||||
}
|
||||
if (outEntry.LocalHeaderRequiresZip64)
|
||||
{
|
||||
this.WriteLEInt(-1);
|
||||
this.WriteLEInt(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (outEntry.CompressedSize < 0L || outEntry.Size < 0L)
|
||||
{
|
||||
update.SizePatchOffset = this.baseStream_.Position;
|
||||
}
|
||||
this.WriteLEInt((int)outEntry.CompressedSize);
|
||||
this.WriteLEInt((int)outEntry.Size);
|
||||
}
|
||||
byte[] array = ZipConstants.ConvertToArray(outEntry.Flags, outEntry.Name);
|
||||
if (array.Length > 65535)
|
||||
{
|
||||
throw new ZipException("Entry name too long.");
|
||||
}
|
||||
ZipExtraData zipExtraData = new ZipExtraData(outEntry.ExtraData);
|
||||
if (outEntry.LocalHeaderRequiresZip64)
|
||||
{
|
||||
zipExtraData.StartNewEntry();
|
||||
zipExtraData.AddLeLong(outEntry.Size);
|
||||
zipExtraData.AddLeLong(outEntry.CompressedSize);
|
||||
zipExtraData.AddNewEntry(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
zipExtraData.Delete(1);
|
||||
}
|
||||
outEntry.ExtraData = zipExtraData.GetEntryData();
|
||||
this.WriteLEShort(array.Length);
|
||||
this.WriteLEShort(outEntry.ExtraData.Length);
|
||||
if (array.Length > 0)
|
||||
{
|
||||
this.baseStream_.Write(array, 0, array.Length);
|
||||
}
|
||||
if (outEntry.LocalHeaderRequiresZip64)
|
||||
{
|
||||
if (!zipExtraData.Find(1))
|
||||
{
|
||||
throw new ZipException("Internal error cannot find extra data");
|
||||
}
|
||||
update.SizePatchOffset = this.baseStream_.Position + (long)zipExtraData.CurrentReadIndex;
|
||||
}
|
||||
if (outEntry.ExtraData.Length > 0)
|
||||
{
|
||||
this.baseStream_.Write(outEntry.ExtraData, 0, outEntry.ExtraData.Length);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000419 RID: 1049 RVA: 0x00014B0C File Offset: 0x00013B0C
|
||||
private int WriteCentralDirectoryHeader(ZipEntry entry)
|
||||
{
|
||||
if (entry.CompressedSize < 0L)
|
||||
{
|
||||
throw new ZipException("Attempt to write central directory entry with unknown csize");
|
||||
}
|
||||
if (entry.Size < 0L)
|
||||
{
|
||||
throw new ZipException("Attempt to write central directory entry with unknown size");
|
||||
}
|
||||
if (entry.Crc < 0L)
|
||||
{
|
||||
throw new ZipException("Attempt to write central directory entry with unknown crc");
|
||||
}
|
||||
this.WriteLEInt(33639248);
|
||||
this.WriteLEShort(51);
|
||||
this.WriteLEShort(entry.Version);
|
||||
this.WriteLEShort(entry.Flags);
|
||||
this.WriteLEShort((int)((byte)entry.CompressionMethod));
|
||||
this.WriteLEInt((int)entry.DosTime);
|
||||
this.WriteLEInt((int)entry.Crc);
|
||||
if (entry.IsZip64Forced() || entry.CompressedSize >= (long)((ulong)(-1)))
|
||||
{
|
||||
this.WriteLEInt(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLEInt((int)(entry.CompressedSize & (long)((ulong)(-1))));
|
||||
}
|
||||
if (entry.IsZip64Forced() || entry.Size >= (long)((ulong)(-1)))
|
||||
{
|
||||
this.WriteLEInt(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLEInt((int)entry.Size);
|
||||
}
|
||||
byte[] array = ZipConstants.ConvertToArray(entry.Flags, entry.Name);
|
||||
if (array.Length > 65535)
|
||||
{
|
||||
throw new ZipException("Entry name is too long.");
|
||||
}
|
||||
this.WriteLEShort(array.Length);
|
||||
ZipExtraData zipExtraData = new ZipExtraData(entry.ExtraData);
|
||||
if (entry.CentralHeaderRequiresZip64)
|
||||
{
|
||||
zipExtraData.StartNewEntry();
|
||||
if (entry.Size >= (long)((ulong)(-1)) || this.useZip64_ == UseZip64.On)
|
||||
{
|
||||
zipExtraData.AddLeLong(entry.Size);
|
||||
}
|
||||
if (entry.CompressedSize >= (long)((ulong)(-1)) || this.useZip64_ == UseZip64.On)
|
||||
{
|
||||
zipExtraData.AddLeLong(entry.CompressedSize);
|
||||
}
|
||||
if (entry.Offset >= (long)((ulong)(-1)))
|
||||
{
|
||||
zipExtraData.AddLeLong(entry.Offset);
|
||||
}
|
||||
zipExtraData.AddNewEntry(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
zipExtraData.Delete(1);
|
||||
}
|
||||
byte[] entryData = zipExtraData.GetEntryData();
|
||||
this.WriteLEShort(entryData.Length);
|
||||
this.WriteLEShort((entry.Comment != null) ? entry.Comment.Length : 0);
|
||||
this.WriteLEShort(0);
|
||||
this.WriteLEShort(0);
|
||||
if (entry.ExternalFileAttributes != -1)
|
||||
{
|
||||
this.WriteLEInt(entry.ExternalFileAttributes);
|
||||
}
|
||||
else if (entry.IsDirectory)
|
||||
{
|
||||
this.WriteLEUint(16U);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLEUint(0U);
|
||||
}
|
||||
if (entry.Offset >= (long)((ulong)(-1)))
|
||||
{
|
||||
this.WriteLEUint(uint.MaxValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLEUint((uint)((int)entry.Offset));
|
||||
}
|
||||
if (array.Length > 0)
|
||||
{
|
||||
this.baseStream_.Write(array, 0, array.Length);
|
||||
}
|
||||
if (entryData.Length > 0)
|
||||
{
|
||||
this.baseStream_.Write(entryData, 0, entryData.Length);
|
||||
}
|
||||
byte[] array2 = ((entry.Comment != null) ? Encoding.ASCII.GetBytes(entry.Comment) : new byte[0]);
|
||||
if (array2.Length > 0)
|
||||
{
|
||||
this.baseStream_.Write(array2, 0, array2.Length);
|
||||
}
|
||||
return 46 + array.Length + entryData.Length + array2.Length;
|
||||
}
|
||||
|
||||
// Token: 0x0600041A RID: 1050 RVA: 0x00014DA7 File Offset: 0x00013DA7
|
||||
private void PostUpdateCleanup()
|
||||
{
|
||||
this.updateDataSource_ = null;
|
||||
this.updates_ = null;
|
||||
this.updateIndex_ = null;
|
||||
if (this.archiveStorage_ != null)
|
||||
{
|
||||
this.archiveStorage_.Dispose();
|
||||
this.archiveStorage_ = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600041B RID: 1051 RVA: 0x00014DD8 File Offset: 0x00013DD8
|
||||
private string GetTransformedFileName(string name)
|
||||
{
|
||||
INameTransform nameTransform = this.NameTransform;
|
||||
if (nameTransform == null)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
return nameTransform.TransformFile(name);
|
||||
}
|
||||
|
||||
// Token: 0x0600041C RID: 1052 RVA: 0x00014DF8 File Offset: 0x00013DF8
|
||||
private string GetTransformedDirectoryName(string name)
|
||||
{
|
||||
INameTransform nameTransform = this.NameTransform;
|
||||
if (nameTransform == null)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
return nameTransform.TransformDirectory(name);
|
||||
}
|
||||
|
||||
// Token: 0x0600041D RID: 1053 RVA: 0x00014E18 File Offset: 0x00013E18
|
||||
private byte[] GetBuffer()
|
||||
{
|
||||
if (this.copyBuffer_ == null)
|
||||
{
|
||||
this.copyBuffer_ = new byte[this.bufferSize_];
|
||||
}
|
||||
return this.copyBuffer_;
|
||||
}
|
||||
|
||||
// Token: 0x0600041E RID: 1054 RVA: 0x00014E3C File Offset: 0x00013E3C
|
||||
private void CopyDescriptorBytes(ZipFile.ZipUpdate update, Stream dest, Stream source)
|
||||
{
|
||||
int i = this.GetDescriptorSize(update);
|
||||
if (i > 0)
|
||||
{
|
||||
byte[] buffer = this.GetBuffer();
|
||||
while (i > 0)
|
||||
{
|
||||
int num = Math.Min(buffer.Length, i);
|
||||
int num2 = source.Read(buffer, 0, num);
|
||||
if (num2 <= 0)
|
||||
{
|
||||
throw new ZipException("Unxpected end of stream");
|
||||
}
|
||||
dest.Write(buffer, 0, num2);
|
||||
i -= num2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600041F RID: 1055 RVA: 0x00014E94 File Offset: 0x00013E94
|
||||
private void CopyBytes(ZipFile.ZipUpdate update, Stream destination, Stream source, long bytesToCopy, bool updateCrc)
|
||||
{
|
||||
if (destination == source)
|
||||
{
|
||||
throw new InvalidOperationException("Destination and source are the same");
|
||||
}
|
||||
Crc32 crc = new Crc32();
|
||||
byte[] buffer = this.GetBuffer();
|
||||
long num = bytesToCopy;
|
||||
long num2 = 0L;
|
||||
int num4;
|
||||
do
|
||||
{
|
||||
int num3 = buffer.Length;
|
||||
if (bytesToCopy < (long)num3)
|
||||
{
|
||||
num3 = (int)bytesToCopy;
|
||||
}
|
||||
num4 = source.Read(buffer, 0, num3);
|
||||
if (num4 > 0)
|
||||
{
|
||||
if (updateCrc)
|
||||
{
|
||||
crc.Update(buffer, 0, num4);
|
||||
}
|
||||
destination.Write(buffer, 0, num4);
|
||||
bytesToCopy -= (long)num4;
|
||||
num2 += (long)num4;
|
||||
}
|
||||
}
|
||||
while (num4 > 0 && bytesToCopy > 0L);
|
||||
if (num2 != num)
|
||||
{
|
||||
throw new ZipException(string.Format("Failed to copy bytes expected {0} read {1}", num, num2));
|
||||
}
|
||||
if (updateCrc)
|
||||
{
|
||||
update.OutEntry.Crc = crc.Value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000420 RID: 1056 RVA: 0x00014F4C File Offset: 0x00013F4C
|
||||
private int GetDescriptorSize(ZipFile.ZipUpdate update)
|
||||
{
|
||||
int num = 0;
|
||||
if ((update.Entry.Flags & 8) != 0)
|
||||
{
|
||||
num = 12;
|
||||
if (update.Entry.LocalHeaderRequiresZip64)
|
||||
{
|
||||
num = 20;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000421 RID: 1057 RVA: 0x00014F80 File Offset: 0x00013F80
|
||||
private void CopyDescriptorBytesDirect(ZipFile.ZipUpdate update, Stream stream, ref long destinationPosition, long sourcePosition)
|
||||
{
|
||||
int i = this.GetDescriptorSize(update);
|
||||
while (i > 0)
|
||||
{
|
||||
int num = i;
|
||||
byte[] buffer = this.GetBuffer();
|
||||
stream.Position = sourcePosition;
|
||||
int num2 = stream.Read(buffer, 0, num);
|
||||
if (num2 <= 0)
|
||||
{
|
||||
throw new ZipException("Unxpected end of stream");
|
||||
}
|
||||
stream.Position = destinationPosition;
|
||||
stream.Write(buffer, 0, num2);
|
||||
i -= num2;
|
||||
destinationPosition += (long)num2;
|
||||
sourcePosition += (long)num2;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000422 RID: 1058 RVA: 0x00014FEC File Offset: 0x00013FEC
|
||||
private void CopyEntryDataDirect(ZipFile.ZipUpdate update, Stream stream, bool updateCrc, ref long destinationPosition, ref long sourcePosition)
|
||||
{
|
||||
long num = update.Entry.CompressedSize;
|
||||
Crc32 crc = new Crc32();
|
||||
byte[] buffer = this.GetBuffer();
|
||||
long num2 = num;
|
||||
long num3 = 0L;
|
||||
int num5;
|
||||
do
|
||||
{
|
||||
int num4 = buffer.Length;
|
||||
if (num < (long)num4)
|
||||
{
|
||||
num4 = (int)num;
|
||||
}
|
||||
stream.Position = sourcePosition;
|
||||
num5 = stream.Read(buffer, 0, num4);
|
||||
if (num5 > 0)
|
||||
{
|
||||
if (updateCrc)
|
||||
{
|
||||
crc.Update(buffer, 0, num5);
|
||||
}
|
||||
stream.Position = destinationPosition;
|
||||
stream.Write(buffer, 0, num5);
|
||||
destinationPosition += (long)num5;
|
||||
sourcePosition += (long)num5;
|
||||
num -= (long)num5;
|
||||
num3 += (long)num5;
|
||||
}
|
||||
}
|
||||
while (num5 > 0 && num > 0L);
|
||||
if (num3 != num2)
|
||||
{
|
||||
throw new ZipException(string.Format("Failed to copy bytes expected {0} read {1}", num2, num3));
|
||||
}
|
||||
if (updateCrc)
|
||||
{
|
||||
update.OutEntry.Crc = crc.Value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000423 RID: 1059 RVA: 0x000150C4 File Offset: 0x000140C4
|
||||
private int FindExistingUpdate(ZipEntry entry)
|
||||
{
|
||||
int num = -1;
|
||||
string transformedFileName = this.GetTransformedFileName(entry.Name);
|
||||
if (this.updateIndex_.ContainsKey(transformedFileName))
|
||||
{
|
||||
num = (int)this.updateIndex_[transformedFileName];
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000424 RID: 1060 RVA: 0x00015104 File Offset: 0x00014104
|
||||
private int FindExistingUpdate(string fileName)
|
||||
{
|
||||
int num = -1;
|
||||
string transformedFileName = this.GetTransformedFileName(fileName);
|
||||
if (this.updateIndex_.ContainsKey(transformedFileName))
|
||||
{
|
||||
num = (int)this.updateIndex_[transformedFileName];
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000425 RID: 1061 RVA: 0x0001513C File Offset: 0x0001413C
|
||||
private Stream GetOutputStream(ZipEntry entry)
|
||||
{
|
||||
Stream stream = this.baseStream_;
|
||||
if (entry.IsCrypted)
|
||||
{
|
||||
stream = this.CreateAndInitEncryptionStream(stream, entry);
|
||||
}
|
||||
CompressionMethod compressionMethod = entry.CompressionMethod;
|
||||
if (compressionMethod != CompressionMethod.Stored)
|
||||
{
|
||||
if (compressionMethod != CompressionMethod.Deflated)
|
||||
{
|
||||
throw new ZipException("Unknown compression method " + entry.CompressionMethod);
|
||||
}
|
||||
stream = new DeflaterOutputStream(stream, new Deflater(9, true))
|
||||
{
|
||||
IsStreamOwner = false
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
stream = new ZipFile.UncompressedStream(stream);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
// Token: 0x06000426 RID: 1062 RVA: 0x000151B4 File Offset: 0x000141B4
|
||||
private void AddEntry(ZipFile workFile, ZipFile.ZipUpdate update)
|
||||
{
|
||||
Stream stream = null;
|
||||
if (update.Entry.IsFile)
|
||||
{
|
||||
stream = update.GetSource();
|
||||
if (stream == null)
|
||||
{
|
||||
stream = this.updateDataSource_.GetSource(update.Entry, update.Filename);
|
||||
}
|
||||
}
|
||||
if (stream != null)
|
||||
{
|
||||
using (stream)
|
||||
{
|
||||
long length = stream.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 outputStream = workFile.GetOutputStream(update.OutEntry))
|
||||
{
|
||||
this.CopyBytes(update, outputStream, stream, length, true);
|
||||
}
|
||||
long position2 = workFile.baseStream_.Position;
|
||||
update.OutEntry.CompressedSize = position2 - position;
|
||||
if ((update.OutEntry.Flags & 8) == 8)
|
||||
{
|
||||
ZipHelperStream zipHelperStream = new ZipHelperStream(workFile.baseStream_);
|
||||
zipHelperStream.WriteDataDescriptor(update.OutEntry);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
workFile.WriteLocalEntryHeader(update);
|
||||
update.OutEntry.CompressedSize = 0L;
|
||||
}
|
||||
|
||||
// Token: 0x06000427 RID: 1063 RVA: 0x000152F4 File Offset: 0x000142F4
|
||||
private void ModifyEntry(ZipFile workFile, ZipFile.ZipUpdate update)
|
||||
{
|
||||
workFile.WriteLocalEntryHeader(update);
|
||||
long position = workFile.baseStream_.Position;
|
||||
if (update.Entry.IsFile && update.Filename != null)
|
||||
{
|
||||
using (Stream outputStream = workFile.GetOutputStream(update.OutEntry))
|
||||
{
|
||||
using (Stream inputStream = this.GetInputStream(update.Entry))
|
||||
{
|
||||
this.CopyBytes(update, outputStream, inputStream, inputStream.Length, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
long position2 = workFile.baseStream_.Position;
|
||||
update.Entry.CompressedSize = position2 - position;
|
||||
}
|
||||
|
||||
// Token: 0x06000428 RID: 1064 RVA: 0x000153A4 File Offset: 0x000143A4
|
||||
private void CopyEntryDirect(ZipFile workFile, ZipFile.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 num = 0L;
|
||||
long num2 = update.Entry.Offset + 26L;
|
||||
this.baseStream_.Seek(num2, SeekOrigin.Begin);
|
||||
uint num3 = (uint)this.ReadLEUshort();
|
||||
uint num4 = (uint)this.ReadLEUshort();
|
||||
num = this.baseStream_.Position + (long)((ulong)num3) + (long)((ulong)num4);
|
||||
if (!flag)
|
||||
{
|
||||
if (update.Entry.CompressedSize > 0L)
|
||||
{
|
||||
this.CopyEntryDataDirect(update, this.baseStream_, false, ref destinationPosition, ref num);
|
||||
}
|
||||
this.CopyDescriptorBytesDirect(update, this.baseStream_, ref destinationPosition, num);
|
||||
return;
|
||||
}
|
||||
if (update.OffsetBasedSize != -1L)
|
||||
{
|
||||
destinationPosition += update.OffsetBasedSize;
|
||||
return;
|
||||
}
|
||||
destinationPosition += num - num2 + 26L + update.Entry.CompressedSize + (long)this.GetDescriptorSize(update);
|
||||
}
|
||||
|
||||
// Token: 0x06000429 RID: 1065 RVA: 0x00015498 File Offset: 0x00014498
|
||||
private void CopyEntry(ZipFile workFile, ZipFile.ZipUpdate update)
|
||||
{
|
||||
workFile.WriteLocalEntryHeader(update);
|
||||
if (update.Entry.CompressedSize > 0L)
|
||||
{
|
||||
long num = update.Entry.Offset + 26L;
|
||||
this.baseStream_.Seek(num, SeekOrigin.Begin);
|
||||
uint num2 = (uint)this.ReadLEUshort();
|
||||
uint num3 = (uint)this.ReadLEUshort();
|
||||
this.baseStream_.Seek((long)((ulong)(num2 + num3)), SeekOrigin.Current);
|
||||
this.CopyBytes(update, workFile.baseStream_, this.baseStream_, update.Entry.CompressedSize, false);
|
||||
}
|
||||
this.CopyDescriptorBytes(update, workFile.baseStream_, this.baseStream_);
|
||||
}
|
||||
|
||||
// Token: 0x0600042A RID: 1066 RVA: 0x0001552A File Offset: 0x0001452A
|
||||
private void Reopen(Stream source)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ZipException("Failed to reopen archive - no source");
|
||||
}
|
||||
this.isNewArchive_ = false;
|
||||
this.baseStream_ = source;
|
||||
this.ReadEntries();
|
||||
}
|
||||
|
||||
// Token: 0x0600042B RID: 1067 RVA: 0x0001554E File Offset: 0x0001454E
|
||||
private void Reopen()
|
||||
{
|
||||
if (this.Name == null)
|
||||
{
|
||||
throw new InvalidOperationException("Name is not known cannot Reopen");
|
||||
}
|
||||
this.Reopen(File.Open(this.Name, FileMode.Open, FileAccess.Read, FileShare.Read));
|
||||
}
|
||||
|
||||
// Token: 0x0600042C RID: 1068 RVA: 0x00015578 File Offset: 0x00014578
|
||||
private void UpdateCommentOnly()
|
||||
{
|
||||
long length = this.baseStream_.Length;
|
||||
ZipHelperStream zipHelperStream;
|
||||
if (this.archiveStorage_.UpdateMode == FileUpdateMode.Safe)
|
||||
{
|
||||
Stream stream = this.archiveStorage_.MakeTemporaryCopy(this.baseStream_);
|
||||
zipHelperStream = new ZipHelperStream(stream);
|
||||
zipHelperStream.IsStreamOwner = true;
|
||||
this.baseStream_.Close();
|
||||
this.baseStream_ = null;
|
||||
}
|
||||
else if (this.archiveStorage_.UpdateMode == FileUpdateMode.Direct)
|
||||
{
|
||||
this.baseStream_ = this.archiveStorage_.OpenForDirectUpdate(this.baseStream_);
|
||||
zipHelperStream = new ZipHelperStream(this.baseStream_);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.baseStream_.Close();
|
||||
this.baseStream_ = null;
|
||||
zipHelperStream = new ZipHelperStream(this.Name);
|
||||
}
|
||||
using (zipHelperStream)
|
||||
{
|
||||
long num = zipHelperStream.LocateBlockWithSignature(101010256, length, 22, 65535);
|
||||
if (num < 0L)
|
||||
{
|
||||
throw new ZipException("Cannot find central directory");
|
||||
}
|
||||
zipHelperStream.Position += 16L;
|
||||
byte[] rawComment = this.newComment_.RawComment;
|
||||
zipHelperStream.WriteLEShort(rawComment.Length);
|
||||
zipHelperStream.Write(rawComment, 0, rawComment.Length);
|
||||
zipHelperStream.SetLength(zipHelperStream.Position);
|
||||
}
|
||||
if (this.archiveStorage_.UpdateMode == FileUpdateMode.Safe)
|
||||
{
|
||||
this.Reopen(this.archiveStorage_.ConvertTemporaryToFinal());
|
||||
return;
|
||||
}
|
||||
this.ReadEntries();
|
||||
}
|
||||
|
||||
// Token: 0x0600042D RID: 1069 RVA: 0x000156D0 File Offset: 0x000146D0
|
||||
private void RunUpdates()
|
||||
{
|
||||
long num = 0L;
|
||||
long num2 = 0L;
|
||||
bool flag = false;
|
||||
long num3 = 0L;
|
||||
ZipFile zipFile;
|
||||
if (this.IsNewArchive)
|
||||
{
|
||||
zipFile = this;
|
||||
zipFile.baseStream_.Position = 0L;
|
||||
flag = true;
|
||||
}
|
||||
else if (this.archiveStorage_.UpdateMode == FileUpdateMode.Direct)
|
||||
{
|
||||
zipFile = this;
|
||||
zipFile.baseStream_.Position = 0L;
|
||||
flag = true;
|
||||
this.updates_.Sort(new ZipFile.UpdateComparer());
|
||||
}
|
||||
else
|
||||
{
|
||||
zipFile = ZipFile.Create(this.archiveStorage_.GetTemporaryOutput());
|
||||
zipFile.UseZip64 = this.UseZip64;
|
||||
if (this.key != null)
|
||||
{
|
||||
zipFile.key = (byte[])this.key.Clone();
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
foreach (object obj in this.updates_)
|
||||
{
|
||||
ZipFile.ZipUpdate zipUpdate = (ZipFile.ZipUpdate)obj;
|
||||
if (zipUpdate != null)
|
||||
{
|
||||
switch (zipUpdate.Command)
|
||||
{
|
||||
case ZipFile.UpdateCommand.Copy:
|
||||
if (flag)
|
||||
{
|
||||
this.CopyEntryDirect(zipFile, zipUpdate, ref num3);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CopyEntry(zipFile, zipUpdate);
|
||||
}
|
||||
break;
|
||||
case ZipFile.UpdateCommand.Modify:
|
||||
this.ModifyEntry(zipFile, zipUpdate);
|
||||
break;
|
||||
case ZipFile.UpdateCommand.Add:
|
||||
if (!this.IsNewArchive && flag)
|
||||
{
|
||||
zipFile.baseStream_.Position = num3;
|
||||
}
|
||||
this.AddEntry(zipFile, zipUpdate);
|
||||
if (flag)
|
||||
{
|
||||
num3 = zipFile.baseStream_.Position;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.IsNewArchive && flag)
|
||||
{
|
||||
zipFile.baseStream_.Position = num3;
|
||||
}
|
||||
long position = zipFile.baseStream_.Position;
|
||||
foreach (object obj2 in this.updates_)
|
||||
{
|
||||
ZipFile.ZipUpdate zipUpdate2 = (ZipFile.ZipUpdate)obj2;
|
||||
if (zipUpdate2 != null)
|
||||
{
|
||||
num += (long)zipFile.WriteCentralDirectoryHeader(zipUpdate2.OutEntry);
|
||||
}
|
||||
}
|
||||
byte[] array = ((this.newComment_ != null) ? this.newComment_.RawComment : ZipConstants.ConvertToArray(this.comment_));
|
||||
using (ZipHelperStream zipHelperStream = new ZipHelperStream(zipFile.baseStream_))
|
||||
{
|
||||
zipHelperStream.WriteEndOfCentralDirectory(this.updateCount_, num, position, array);
|
||||
}
|
||||
num2 = zipFile.baseStream_.Position;
|
||||
foreach (object obj3 in this.updates_)
|
||||
{
|
||||
ZipFile.ZipUpdate zipUpdate3 = (ZipFile.ZipUpdate)obj3;
|
||||
if (zipUpdate3 != null)
|
||||
{
|
||||
if (zipUpdate3.CrcPatchOffset > 0L && zipUpdate3.OutEntry.CompressedSize > 0L)
|
||||
{
|
||||
zipFile.baseStream_.Position = zipUpdate3.CrcPatchOffset;
|
||||
zipFile.WriteLEInt((int)zipUpdate3.OutEntry.Crc);
|
||||
}
|
||||
if (zipUpdate3.SizePatchOffset > 0L)
|
||||
{
|
||||
zipFile.baseStream_.Position = zipUpdate3.SizePatchOffset;
|
||||
if (zipUpdate3.OutEntry.LocalHeaderRequiresZip64)
|
||||
{
|
||||
zipFile.WriteLeLong(zipUpdate3.OutEntry.Size);
|
||||
zipFile.WriteLeLong(zipUpdate3.OutEntry.CompressedSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
zipFile.WriteLEInt((int)zipUpdate3.OutEntry.CompressedSize);
|
||||
zipFile.WriteLEInt((int)zipUpdate3.OutEntry.Size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
zipFile.Close();
|
||||
if (!flag && zipFile.Name != null)
|
||||
{
|
||||
File.Delete(zipFile.Name);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
zipFile.baseStream_.SetLength(num2);
|
||||
zipFile.baseStream_.Flush();
|
||||
this.isNewArchive_ = false;
|
||||
this.ReadEntries();
|
||||
return;
|
||||
}
|
||||
this.baseStream_.Close();
|
||||
this.Reopen(this.archiveStorage_.ConvertTemporaryToFinal());
|
||||
}
|
||||
|
||||
// Token: 0x0600042E RID: 1070 RVA: 0x00015AFC File Offset: 0x00014AFC
|
||||
private void CheckUpdating()
|
||||
{
|
||||
if (this.updates_ == null)
|
||||
{
|
||||
throw new InvalidOperationException("BeginUpdate has not been called");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600042F RID: 1071 RVA: 0x00015B11 File Offset: 0x00014B11
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Token: 0x06000430 RID: 1072 RVA: 0x00015B1C File Offset: 0x00014B1C
|
||||
private void DisposeInternal(bool disposing)
|
||||
{
|
||||
if (!this.isDisposed_)
|
||||
{
|
||||
this.isDisposed_ = true;
|
||||
this.entries_ = new ZipEntry[0];
|
||||
if (this.IsStreamOwner && this.baseStream_ != null)
|
||||
{
|
||||
lock (this.baseStream_)
|
||||
{
|
||||
this.baseStream_.Close();
|
||||
}
|
||||
}
|
||||
this.PostUpdateCleanup();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000431 RID: 1073 RVA: 0x00015B8C File Offset: 0x00014B8C
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
this.DisposeInternal(disposing);
|
||||
}
|
||||
|
||||
// Token: 0x06000432 RID: 1074 RVA: 0x00015B98 File Offset: 0x00014B98
|
||||
private ushort ReadLEUshort()
|
||||
{
|
||||
int num = this.baseStream_.ReadByte();
|
||||
if (num < 0)
|
||||
{
|
||||
throw new EndOfStreamException("End of stream");
|
||||
}
|
||||
int num2 = this.baseStream_.ReadByte();
|
||||
if (num2 < 0)
|
||||
{
|
||||
throw new EndOfStreamException("End of stream");
|
||||
}
|
||||
return (ushort)num | (ushort)(num2 << 8);
|
||||
}
|
||||
|
||||
// Token: 0x06000433 RID: 1075 RVA: 0x00015BE3 File Offset: 0x00014BE3
|
||||
private uint ReadLEUint()
|
||||
{
|
||||
return (uint)((int)this.ReadLEUshort() | ((int)this.ReadLEUshort() << 16));
|
||||
}
|
||||
|
||||
// Token: 0x06000434 RID: 1076 RVA: 0x00015BF5 File Offset: 0x00014BF5
|
||||
private ulong ReadLEUlong()
|
||||
{
|
||||
return (ulong)this.ReadLEUint() | ((ulong)this.ReadLEUint() << 32);
|
||||
}
|
||||
|
||||
// Token: 0x06000435 RID: 1077 RVA: 0x00015C0C File Offset: 0x00014C0C
|
||||
private long LocateBlockWithSignature(int signature, long endLocation, int minimumBlockSize, int maximumVariableData)
|
||||
{
|
||||
long num;
|
||||
using (ZipHelperStream zipHelperStream = new ZipHelperStream(this.baseStream_))
|
||||
{
|
||||
num = zipHelperStream.LocateBlockWithSignature(signature, endLocation, minimumBlockSize, maximumVariableData);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000436 RID: 1078 RVA: 0x00015C50 File Offset: 0x00014C50
|
||||
private void ReadEntries()
|
||||
{
|
||||
if (!this.baseStream_.CanSeek)
|
||||
{
|
||||
throw new ZipException("ZipFile stream must be seekable");
|
||||
}
|
||||
long num = this.LocateBlockWithSignature(101010256, this.baseStream_.Length, 22, 65535);
|
||||
if (num < 0L)
|
||||
{
|
||||
throw new ZipException("Cannot find central directory");
|
||||
}
|
||||
ushort num2 = this.ReadLEUshort();
|
||||
ushort num3 = this.ReadLEUshort();
|
||||
ulong num4 = (ulong)this.ReadLEUshort();
|
||||
ulong num5 = (ulong)this.ReadLEUshort();
|
||||
ulong num6 = (ulong)this.ReadLEUint();
|
||||
long num7 = (long)((ulong)this.ReadLEUint());
|
||||
uint num8 = (uint)this.ReadLEUshort();
|
||||
if (num8 > 0U)
|
||||
{
|
||||
byte[] array = new byte[num8];
|
||||
StreamUtils.ReadFully(this.baseStream_, array);
|
||||
this.comment_ = ZipConstants.ConvertToString(array);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.comment_ = string.Empty;
|
||||
}
|
||||
bool flag = false;
|
||||
if (num2 == 65535 || num3 == 65535 || num4 == 65535UL || num5 == 65535UL || num6 == (ulong)(-1) || num7 == (long)((ulong)(-1)))
|
||||
{
|
||||
flag = true;
|
||||
long num9 = this.LocateBlockWithSignature(117853008, num, 0, 4096);
|
||||
if (num9 < 0L)
|
||||
{
|
||||
throw new ZipException("Cannot find Zip64 locator");
|
||||
}
|
||||
this.ReadLEUint();
|
||||
ulong num10 = this.ReadLEUlong();
|
||||
this.ReadLEUint();
|
||||
this.baseStream_.Position = (long)num10;
|
||||
long num11 = (long)((ulong)this.ReadLEUint());
|
||||
if (num11 != 101075792L)
|
||||
{
|
||||
throw new ZipException(string.Format("Invalid Zip64 Central directory signature at {0:X}", num10));
|
||||
}
|
||||
this.ReadLEUlong();
|
||||
this.ReadLEUshort();
|
||||
this.ReadLEUshort();
|
||||
this.ReadLEUint();
|
||||
this.ReadLEUint();
|
||||
num4 = this.ReadLEUlong();
|
||||
num5 = this.ReadLEUlong();
|
||||
num6 = this.ReadLEUlong();
|
||||
num7 = (long)this.ReadLEUlong();
|
||||
}
|
||||
this.entries_ = new ZipEntry[num4];
|
||||
if (!flag && num7 < num - (long)(4UL + num6))
|
||||
{
|
||||
this.offsetOfFirstEntry = num - (long)(4UL + num6 + (ulong)num7);
|
||||
if (this.offsetOfFirstEntry <= 0L)
|
||||
{
|
||||
throw new ZipException("Invalid embedded zip archive");
|
||||
}
|
||||
}
|
||||
this.baseStream_.Seek(this.offsetOfFirstEntry + num7, SeekOrigin.Begin);
|
||||
for (ulong num12 = 0UL; num12 < num4; num12 += 1UL)
|
||||
{
|
||||
if (this.ReadLEUint() != 33639248U)
|
||||
{
|
||||
throw new ZipException("Wrong Central Directory signature");
|
||||
}
|
||||
int num13 = (int)this.ReadLEUshort();
|
||||
int num14 = (int)this.ReadLEUshort();
|
||||
int num15 = (int)this.ReadLEUshort();
|
||||
int num16 = (int)this.ReadLEUshort();
|
||||
uint num17 = this.ReadLEUint();
|
||||
uint num18 = this.ReadLEUint();
|
||||
long num19 = (long)((ulong)this.ReadLEUint());
|
||||
long num20 = (long)((ulong)this.ReadLEUint());
|
||||
int num21 = (int)this.ReadLEUshort();
|
||||
int num22 = (int)this.ReadLEUshort();
|
||||
int num23 = (int)this.ReadLEUshort();
|
||||
this.ReadLEUshort();
|
||||
this.ReadLEUshort();
|
||||
uint num24 = this.ReadLEUint();
|
||||
long num25 = (long)((ulong)this.ReadLEUint());
|
||||
byte[] array2 = new byte[Math.Max(num21, num23)];
|
||||
StreamUtils.ReadFully(this.baseStream_, array2, 0, num21);
|
||||
string text = ZipConstants.ConvertToStringExt(num15, array2, num21);
|
||||
ZipEntry zipEntry = new ZipEntry(text, num14, num13, (CompressionMethod)num16);
|
||||
zipEntry.Crc = (long)((ulong)num18 & (ulong)(-1));
|
||||
zipEntry.Size = num20 & (long)((ulong)(-1));
|
||||
zipEntry.CompressedSize = num19 & (long)((ulong)(-1));
|
||||
zipEntry.Flags = num15;
|
||||
zipEntry.DosTime = (long)((ulong)num17);
|
||||
zipEntry.ZipFileIndex = (long)num12;
|
||||
zipEntry.Offset = num25;
|
||||
zipEntry.ExternalFileAttributes = (int)num24;
|
||||
if ((num15 & 8) == 0)
|
||||
{
|
||||
zipEntry.CryptoCheckValue = (byte)(num18 >> 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
zipEntry.CryptoCheckValue = (byte)((num17 >> 8) & 255U);
|
||||
}
|
||||
if (num22 > 0)
|
||||
{
|
||||
byte[] array3 = new byte[num22];
|
||||
StreamUtils.ReadFully(this.baseStream_, array3);
|
||||
zipEntry.ExtraData = array3;
|
||||
}
|
||||
zipEntry.ProcessExtraData(false);
|
||||
if (num23 > 0)
|
||||
{
|
||||
StreamUtils.ReadFully(this.baseStream_, array2, 0, num23);
|
||||
zipEntry.Comment = ZipConstants.ConvertToStringExt(num15, array2, num23);
|
||||
}
|
||||
this.entries_[(int)(checked((IntPtr)num12))] = zipEntry;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000437 RID: 1079 RVA: 0x00016013 File Offset: 0x00015013
|
||||
private long LocateEntry(ZipEntry entry)
|
||||
{
|
||||
return this.TestLocalHeader(entry, ZipFile.HeaderTest.Extract);
|
||||
}
|
||||
|
||||
// Token: 0x06000438 RID: 1080 RVA: 0x00016020 File Offset: 0x00015020
|
||||
private Stream CreateAndInitDecryptionStream(Stream baseStream, ZipEntry entry)
|
||||
{
|
||||
CryptoStream cryptoStream;
|
||||
if (entry.Version < 50 || (entry.Flags & 64) == 0)
|
||||
{
|
||||
PkzipClassicManaged pkzipClassicManaged = new PkzipClassicManaged();
|
||||
this.OnKeysRequired(entry.Name);
|
||||
if (!this.HaveKeys)
|
||||
{
|
||||
throw new ZipException("No password available for encrypted stream");
|
||||
}
|
||||
cryptoStream = new CryptoStream(baseStream, pkzipClassicManaged.CreateDecryptor(this.key, null), CryptoStreamMode.Read);
|
||||
ZipFile.CheckClassicPassword(cryptoStream, entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (entry.Version != 51)
|
||||
{
|
||||
throw new ZipException("Decryption method not supported");
|
||||
}
|
||||
this.OnKeysRequired(entry.Name);
|
||||
if (!this.HaveKeys)
|
||||
{
|
||||
throw new ZipException("No password available for AES encrypted stream");
|
||||
}
|
||||
int aessaltLen = entry.AESSaltLen;
|
||||
byte[] array = new byte[aessaltLen];
|
||||
int num = baseStream.Read(array, 0, aessaltLen);
|
||||
if (num != aessaltLen)
|
||||
{
|
||||
throw new ZipException(string.Concat(new object[] { "AES Salt expected ", aessaltLen, " got ", num }));
|
||||
}
|
||||
byte[] array2 = new byte[2];
|
||||
baseStream.Read(array2, 0, 2);
|
||||
int num2 = entry.AESKeySize / 8;
|
||||
ZipAESTransform zipAESTransform = new ZipAESTransform(this.rawPassword_, array, num2, false);
|
||||
byte[] pwdVerifier = zipAESTransform.PwdVerifier;
|
||||
if (pwdVerifier[0] != array2[0] || pwdVerifier[1] != array2[1])
|
||||
{
|
||||
throw new Exception("Invalid password for AES");
|
||||
}
|
||||
cryptoStream = new ZipAESStream(baseStream, zipAESTransform, CryptoStreamMode.Read);
|
||||
}
|
||||
return cryptoStream;
|
||||
}
|
||||
|
||||
// Token: 0x06000439 RID: 1081 RVA: 0x00016180 File Offset: 0x00015180
|
||||
private Stream CreateAndInitEncryptionStream(Stream baseStream, ZipEntry entry)
|
||||
{
|
||||
CryptoStream cryptoStream = null;
|
||||
if (entry.Version < 50 || (entry.Flags & 64) == 0)
|
||||
{
|
||||
PkzipClassicManaged pkzipClassicManaged = new PkzipClassicManaged();
|
||||
this.OnKeysRequired(entry.Name);
|
||||
if (!this.HaveKeys)
|
||||
{
|
||||
throw new ZipException("No password available for encrypted stream");
|
||||
}
|
||||
cryptoStream = new CryptoStream(new ZipFile.UncompressedStream(baseStream), pkzipClassicManaged.CreateEncryptor(this.key, null), CryptoStreamMode.Write);
|
||||
if (entry.Crc < 0L || (entry.Flags & 8) != 0)
|
||||
{
|
||||
ZipFile.WriteEncryptionHeader(cryptoStream, entry.DosTime << 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZipFile.WriteEncryptionHeader(cryptoStream, entry.Crc);
|
||||
}
|
||||
}
|
||||
return cryptoStream;
|
||||
}
|
||||
|
||||
// Token: 0x0600043A RID: 1082 RVA: 0x00016218 File Offset: 0x00015218
|
||||
private static void CheckClassicPassword(CryptoStream classicCryptoStream, ZipEntry entry)
|
||||
{
|
||||
byte[] array = new byte[12];
|
||||
StreamUtils.ReadFully(classicCryptoStream, array);
|
||||
if (array[11] != entry.CryptoCheckValue)
|
||||
{
|
||||
throw new ZipException("Invalid password");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600043B RID: 1083 RVA: 0x0001624C File Offset: 0x0001524C
|
||||
private static void WriteEncryptionHeader(Stream stream, long crcValue)
|
||||
{
|
||||
byte[] array = new byte[12];
|
||||
Random random = new Random();
|
||||
random.NextBytes(array);
|
||||
array[11] = (byte)(crcValue >> 24);
|
||||
stream.Write(array, 0, array.Length);
|
||||
}
|
||||
|
||||
// Token: 0x040002D5 RID: 725
|
||||
private const int DefaultBufferSize = 4096;
|
||||
|
||||
// Token: 0x040002D6 RID: 726
|
||||
public ZipFile.KeysRequiredEventHandler KeysRequired;
|
||||
|
||||
// Token: 0x040002D7 RID: 727
|
||||
private bool isDisposed_;
|
||||
|
||||
// Token: 0x040002D8 RID: 728
|
||||
private string name_;
|
||||
|
||||
// Token: 0x040002D9 RID: 729
|
||||
private string comment_;
|
||||
|
||||
// Token: 0x040002DA RID: 730
|
||||
private string rawPassword_;
|
||||
|
||||
// Token: 0x040002DB RID: 731
|
||||
private Stream baseStream_;
|
||||
|
||||
// Token: 0x040002DC RID: 732
|
||||
private bool isStreamOwner;
|
||||
|
||||
// Token: 0x040002DD RID: 733
|
||||
private long offsetOfFirstEntry;
|
||||
|
||||
// Token: 0x040002DE RID: 734
|
||||
private ZipEntry[] entries_;
|
||||
|
||||
// Token: 0x040002DF RID: 735
|
||||
private byte[] key;
|
||||
|
||||
// Token: 0x040002E0 RID: 736
|
||||
private bool isNewArchive_;
|
||||
|
||||
// Token: 0x040002E1 RID: 737
|
||||
private UseZip64 useZip64_ = UseZip64.Dynamic;
|
||||
|
||||
// Token: 0x040002E2 RID: 738
|
||||
private ArrayList updates_;
|
||||
|
||||
// Token: 0x040002E3 RID: 739
|
||||
private long updateCount_;
|
||||
|
||||
// Token: 0x040002E4 RID: 740
|
||||
private Hashtable updateIndex_;
|
||||
|
||||
// Token: 0x040002E5 RID: 741
|
||||
private IArchiveStorage archiveStorage_;
|
||||
|
||||
// Token: 0x040002E6 RID: 742
|
||||
private IDynamicDataSource updateDataSource_;
|
||||
|
||||
// Token: 0x040002E7 RID: 743
|
||||
private bool contentsEdited_;
|
||||
|
||||
// Token: 0x040002E8 RID: 744
|
||||
private int bufferSize_ = 4096;
|
||||
|
||||
// Token: 0x040002E9 RID: 745
|
||||
private byte[] copyBuffer_;
|
||||
|
||||
// Token: 0x040002EA RID: 746
|
||||
private ZipFile.ZipString newComment_;
|
||||
|
||||
// Token: 0x040002EB RID: 747
|
||||
private bool commentEdited_;
|
||||
|
||||
// Token: 0x040002EC RID: 748
|
||||
private IEntryFactory updateEntryFactory_ = new ZipEntryFactory();
|
||||
|
||||
// Token: 0x02000069 RID: 105
|
||||
// (Invoke) Token: 0x0600043D RID: 1085
|
||||
public delegate void KeysRequiredEventHandler(object sender, KeysRequiredEventArgs e);
|
||||
|
||||
// Token: 0x0200006A RID: 106
|
||||
[Flags]
|
||||
private enum HeaderTest
|
||||
{
|
||||
// Token: 0x040002EE RID: 750
|
||||
Extract = 1,
|
||||
// Token: 0x040002EF RID: 751
|
||||
Header = 2
|
||||
}
|
||||
|
||||
// Token: 0x0200006B RID: 107
|
||||
private enum UpdateCommand
|
||||
{
|
||||
// Token: 0x040002F1 RID: 753
|
||||
Copy,
|
||||
// Token: 0x040002F2 RID: 754
|
||||
Modify,
|
||||
// Token: 0x040002F3 RID: 755
|
||||
Add
|
||||
}
|
||||
|
||||
// Token: 0x0200006C RID: 108
|
||||
private class UpdateComparer : IComparer
|
||||
{
|
||||
// Token: 0x06000440 RID: 1088 RVA: 0x00016284 File Offset: 0x00015284
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
ZipFile.ZipUpdate zipUpdate = x as ZipFile.ZipUpdate;
|
||||
ZipFile.ZipUpdate zipUpdate2 = y as ZipFile.ZipUpdate;
|
||||
int num;
|
||||
if (zipUpdate == null)
|
||||
{
|
||||
if (zipUpdate2 == null)
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = -1;
|
||||
}
|
||||
}
|
||||
else if (zipUpdate2 == null)
|
||||
{
|
||||
num = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num2 = ((zipUpdate.Command == ZipFile.UpdateCommand.Copy || zipUpdate.Command == ZipFile.UpdateCommand.Modify) ? 0 : 1);
|
||||
int num3 = ((zipUpdate2.Command == ZipFile.UpdateCommand.Copy || zipUpdate2.Command == ZipFile.UpdateCommand.Modify) ? 0 : 1);
|
||||
num = num2 - num3;
|
||||
if (num == 0)
|
||||
{
|
||||
long num4 = zipUpdate.Entry.Offset - zipUpdate2.Entry.Offset;
|
||||
if (num4 < 0L)
|
||||
{
|
||||
num = -1;
|
||||
}
|
||||
else if (num4 == 0L)
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0200006D RID: 109
|
||||
private class ZipUpdate
|
||||
{
|
||||
// Token: 0x06000442 RID: 1090 RVA: 0x00016321 File Offset: 0x00015321
|
||||
public ZipUpdate(string fileName, ZipEntry entry)
|
||||
{
|
||||
this.command_ = ZipFile.UpdateCommand.Add;
|
||||
this.entry_ = entry;
|
||||
this.filename_ = fileName;
|
||||
}
|
||||
|
||||
// Token: 0x06000443 RID: 1091 RVA: 0x00016358 File Offset: 0x00015358
|
||||
[Obsolete]
|
||||
public ZipUpdate(string fileName, string entryName, CompressionMethod compressionMethod)
|
||||
{
|
||||
this.command_ = ZipFile.UpdateCommand.Add;
|
||||
this.entry_ = new ZipEntry(entryName);
|
||||
this.entry_.CompressionMethod = compressionMethod;
|
||||
this.filename_ = fileName;
|
||||
}
|
||||
|
||||
// Token: 0x06000444 RID: 1092 RVA: 0x000163A9 File Offset: 0x000153A9
|
||||
[Obsolete]
|
||||
public ZipUpdate(string fileName, string entryName)
|
||||
: this(fileName, entryName, CompressionMethod.Deflated)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000445 RID: 1093 RVA: 0x000163B4 File Offset: 0x000153B4
|
||||
[Obsolete]
|
||||
public ZipUpdate(IStaticDataSource dataSource, string entryName, CompressionMethod compressionMethod)
|
||||
{
|
||||
this.command_ = ZipFile.UpdateCommand.Add;
|
||||
this.entry_ = new ZipEntry(entryName);
|
||||
this.entry_.CompressionMethod = compressionMethod;
|
||||
this.dataSource_ = dataSource;
|
||||
}
|
||||
|
||||
// Token: 0x06000446 RID: 1094 RVA: 0x00016405 File Offset: 0x00015405
|
||||
public ZipUpdate(IStaticDataSource dataSource, ZipEntry entry)
|
||||
{
|
||||
this.command_ = ZipFile.UpdateCommand.Add;
|
||||
this.entry_ = entry;
|
||||
this.dataSource_ = dataSource;
|
||||
}
|
||||
|
||||
// Token: 0x06000447 RID: 1095 RVA: 0x0001643A File Offset: 0x0001543A
|
||||
public ZipUpdate(ZipEntry original, ZipEntry updated)
|
||||
{
|
||||
throw new ZipException("Modify not currently supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000448 RID: 1096 RVA: 0x00016464 File Offset: 0x00015464
|
||||
public ZipUpdate(ZipFile.UpdateCommand command, ZipEntry entry)
|
||||
{
|
||||
this.command_ = command;
|
||||
this.entry_ = (ZipEntry)entry.Clone();
|
||||
}
|
||||
|
||||
// Token: 0x06000449 RID: 1097 RVA: 0x0001649C File Offset: 0x0001549C
|
||||
public ZipUpdate(ZipEntry entry)
|
||||
: this(ZipFile.UpdateCommand.Copy, entry)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x170000F7 RID: 247
|
||||
// (get) Token: 0x0600044A RID: 1098 RVA: 0x000164A6 File Offset: 0x000154A6
|
||||
public ZipEntry Entry
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.entry_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000F8 RID: 248
|
||||
// (get) Token: 0x0600044B RID: 1099 RVA: 0x000164AE File Offset: 0x000154AE
|
||||
public ZipEntry OutEntry
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.outEntry_ == null)
|
||||
{
|
||||
this.outEntry_ = (ZipEntry)this.entry_.Clone();
|
||||
}
|
||||
return this.outEntry_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000F9 RID: 249
|
||||
// (get) Token: 0x0600044C RID: 1100 RVA: 0x000164D4 File Offset: 0x000154D4
|
||||
public ZipFile.UpdateCommand Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.command_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000FA RID: 250
|
||||
// (get) Token: 0x0600044D RID: 1101 RVA: 0x000164DC File Offset: 0x000154DC
|
||||
public string Filename
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.filename_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000FB RID: 251
|
||||
// (get) Token: 0x0600044E RID: 1102 RVA: 0x000164E4 File Offset: 0x000154E4
|
||||
// (set) Token: 0x0600044F RID: 1103 RVA: 0x000164EC File Offset: 0x000154EC
|
||||
public long SizePatchOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.sizePatchOffset_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.sizePatchOffset_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000FC RID: 252
|
||||
// (get) Token: 0x06000450 RID: 1104 RVA: 0x000164F5 File Offset: 0x000154F5
|
||||
// (set) Token: 0x06000451 RID: 1105 RVA: 0x000164FD File Offset: 0x000154FD
|
||||
public long CrcPatchOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.crcPatchOffset_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.crcPatchOffset_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000FD RID: 253
|
||||
// (get) Token: 0x06000452 RID: 1106 RVA: 0x00016506 File Offset: 0x00015506
|
||||
// (set) Token: 0x06000453 RID: 1107 RVA: 0x0001650E File Offset: 0x0001550E
|
||||
public long OffsetBasedSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._offsetBasedSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._offsetBasedSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000454 RID: 1108 RVA: 0x00016518 File Offset: 0x00015518
|
||||
public Stream GetSource()
|
||||
{
|
||||
Stream stream = null;
|
||||
if (this.dataSource_ != null)
|
||||
{
|
||||
stream = this.dataSource_.GetSource();
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
// Token: 0x040002F4 RID: 756
|
||||
private ZipEntry entry_;
|
||||
|
||||
// Token: 0x040002F5 RID: 757
|
||||
private ZipEntry outEntry_;
|
||||
|
||||
// Token: 0x040002F6 RID: 758
|
||||
private ZipFile.UpdateCommand command_;
|
||||
|
||||
// Token: 0x040002F7 RID: 759
|
||||
private IStaticDataSource dataSource_;
|
||||
|
||||
// Token: 0x040002F8 RID: 760
|
||||
private string filename_;
|
||||
|
||||
// Token: 0x040002F9 RID: 761
|
||||
private long sizePatchOffset_ = -1L;
|
||||
|
||||
// Token: 0x040002FA RID: 762
|
||||
private long crcPatchOffset_ = -1L;
|
||||
|
||||
// Token: 0x040002FB RID: 763
|
||||
private long _offsetBasedSize = -1L;
|
||||
}
|
||||
|
||||
// Token: 0x0200006E RID: 110
|
||||
private class ZipString
|
||||
{
|
||||
// Token: 0x06000455 RID: 1109 RVA: 0x0001653C File Offset: 0x0001553C
|
||||
public ZipString(string comment)
|
||||
{
|
||||
this.comment_ = comment;
|
||||
this.isSourceString_ = true;
|
||||
}
|
||||
|
||||
// Token: 0x06000456 RID: 1110 RVA: 0x00016552 File Offset: 0x00015552
|
||||
public ZipString(byte[] rawString)
|
||||
{
|
||||
this.rawComment_ = rawString;
|
||||
}
|
||||
|
||||
// Token: 0x170000FE RID: 254
|
||||
// (get) Token: 0x06000457 RID: 1111 RVA: 0x00016561 File Offset: 0x00015561
|
||||
public bool IsSourceString
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isSourceString_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000FF RID: 255
|
||||
// (get) Token: 0x06000458 RID: 1112 RVA: 0x00016569 File Offset: 0x00015569
|
||||
public int RawLength
|
||||
{
|
||||
get
|
||||
{
|
||||
this.MakeBytesAvailable();
|
||||
return this.rawComment_.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000100 RID: 256
|
||||
// (get) Token: 0x06000459 RID: 1113 RVA: 0x00016579 File Offset: 0x00015579
|
||||
public byte[] RawComment
|
||||
{
|
||||
get
|
||||
{
|
||||
this.MakeBytesAvailable();
|
||||
return (byte[])this.rawComment_.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600045A RID: 1114 RVA: 0x00016591 File Offset: 0x00015591
|
||||
public void Reset()
|
||||
{
|
||||
if (this.isSourceString_)
|
||||
{
|
||||
this.rawComment_ = null;
|
||||
return;
|
||||
}
|
||||
this.comment_ = null;
|
||||
}
|
||||
|
||||
// Token: 0x0600045B RID: 1115 RVA: 0x000165AA File Offset: 0x000155AA
|
||||
private void MakeTextAvailable()
|
||||
{
|
||||
if (this.comment_ == null)
|
||||
{
|
||||
this.comment_ = ZipConstants.ConvertToString(this.rawComment_);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600045C RID: 1116 RVA: 0x000165C5 File Offset: 0x000155C5
|
||||
private void MakeBytesAvailable()
|
||||
{
|
||||
if (this.rawComment_ == null)
|
||||
{
|
||||
this.rawComment_ = ZipConstants.ConvertToArray(this.comment_);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600045D RID: 1117 RVA: 0x000165E0 File Offset: 0x000155E0
|
||||
public static implicit operator string(ZipFile.ZipString zipString)
|
||||
{
|
||||
zipString.MakeTextAvailable();
|
||||
return zipString.comment_;
|
||||
}
|
||||
|
||||
// Token: 0x040002FC RID: 764
|
||||
private string comment_;
|
||||
|
||||
// Token: 0x040002FD RID: 765
|
||||
private byte[] rawComment_;
|
||||
|
||||
// Token: 0x040002FE RID: 766
|
||||
private bool isSourceString_;
|
||||
}
|
||||
|
||||
// Token: 0x0200006F RID: 111
|
||||
private class ZipEntryEnumerator : IEnumerator
|
||||
{
|
||||
// Token: 0x0600045E RID: 1118 RVA: 0x000165EE File Offset: 0x000155EE
|
||||
public ZipEntryEnumerator(ZipEntry[] entries)
|
||||
{
|
||||
this.array = entries;
|
||||
}
|
||||
|
||||
// Token: 0x17000101 RID: 257
|
||||
// (get) Token: 0x0600045F RID: 1119 RVA: 0x00016604 File Offset: 0x00015604
|
||||
public object Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.array[this.index];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000460 RID: 1120 RVA: 0x00016613 File Offset: 0x00015613
|
||||
public void Reset()
|
||||
{
|
||||
this.index = -1;
|
||||
}
|
||||
|
||||
// Token: 0x06000461 RID: 1121 RVA: 0x0001661C File Offset: 0x0001561C
|
||||
public bool MoveNext()
|
||||
{
|
||||
return ++this.index < this.array.Length;
|
||||
}
|
||||
|
||||
// Token: 0x040002FF RID: 767
|
||||
private ZipEntry[] array;
|
||||
|
||||
// Token: 0x04000300 RID: 768
|
||||
private int index = -1;
|
||||
}
|
||||
|
||||
// Token: 0x02000070 RID: 112
|
||||
private class UncompressedStream : Stream
|
||||
{
|
||||
// Token: 0x06000462 RID: 1122 RVA: 0x00016644 File Offset: 0x00015644
|
||||
public UncompressedStream(Stream baseStream)
|
||||
{
|
||||
this.baseStream_ = baseStream;
|
||||
}
|
||||
|
||||
// Token: 0x06000463 RID: 1123 RVA: 0x00016653 File Offset: 0x00015653
|
||||
public override void Close()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x17000102 RID: 258
|
||||
// (get) Token: 0x06000464 RID: 1124 RVA: 0x00016655 File Offset: 0x00015655
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000465 RID: 1125 RVA: 0x00016658 File Offset: 0x00015658
|
||||
public override void Flush()
|
||||
{
|
||||
this.baseStream_.Flush();
|
||||
}
|
||||
|
||||
// Token: 0x17000103 RID: 259
|
||||
// (get) Token: 0x06000466 RID: 1126 RVA: 0x00016665 File Offset: 0x00015665
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseStream_.CanWrite;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000104 RID: 260
|
||||
// (get) Token: 0x06000467 RID: 1127 RVA: 0x00016672 File Offset: 0x00015672
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000105 RID: 261
|
||||
// (get) Token: 0x06000468 RID: 1128 RVA: 0x00016675 File Offset: 0x00015675
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000106 RID: 262
|
||||
// (get) Token: 0x06000469 RID: 1129 RVA: 0x00016679 File Offset: 0x00015679
|
||||
// (set) Token: 0x0600046A RID: 1130 RVA: 0x00016686 File Offset: 0x00015686
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseStream_.Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600046B RID: 1131 RVA: 0x00016688 File Offset: 0x00015688
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Token: 0x0600046C RID: 1132 RVA: 0x0001668B File Offset: 0x0001568B
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
return 0L;
|
||||
}
|
||||
|
||||
// Token: 0x0600046D RID: 1133 RVA: 0x0001668F File Offset: 0x0001568F
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600046E RID: 1134 RVA: 0x00016691 File Offset: 0x00015691
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
this.baseStream_.Write(buffer, offset, count);
|
||||
}
|
||||
|
||||
// Token: 0x04000301 RID: 769
|
||||
private Stream baseStream_;
|
||||
}
|
||||
|
||||
// Token: 0x02000071 RID: 113
|
||||
private class PartialInputStream : Stream
|
||||
{
|
||||
// Token: 0x0600046F RID: 1135 RVA: 0x000166A1 File Offset: 0x000156A1
|
||||
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;
|
||||
}
|
||||
|
||||
// Token: 0x06000470 RID: 1136 RVA: 0x000166E0 File Offset: 0x000156E0
|
||||
public override int ReadByte()
|
||||
{
|
||||
if (this.readPos_ >= this.end_)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int num2;
|
||||
lock (this.baseStream_)
|
||||
{
|
||||
Stream stream2 = this.baseStream_;
|
||||
long num;
|
||||
this.readPos_ = (num = this.readPos_) + 1L;
|
||||
stream2.Seek(num, SeekOrigin.Begin);
|
||||
num2 = this.baseStream_.ReadByte();
|
||||
}
|
||||
return num2;
|
||||
}
|
||||
|
||||
// Token: 0x06000471 RID: 1137 RVA: 0x00016750 File Offset: 0x00015750
|
||||
public override void Close()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000472 RID: 1138 RVA: 0x00016754 File Offset: 0x00015754
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
int num2;
|
||||
lock (this.baseStream_)
|
||||
{
|
||||
if ((long)count > this.end_ - this.readPos_)
|
||||
{
|
||||
count = (int)(this.end_ - this.readPos_);
|
||||
if (count == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
this.baseStream_.Seek(this.readPos_, SeekOrigin.Begin);
|
||||
int num = this.baseStream_.Read(buffer, offset, count);
|
||||
if (num > 0)
|
||||
{
|
||||
this.readPos_ += (long)num;
|
||||
}
|
||||
num2 = num;
|
||||
}
|
||||
return num2;
|
||||
}
|
||||
|
||||
// Token: 0x06000473 RID: 1139 RVA: 0x000167E8 File Offset: 0x000157E8
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
// Token: 0x06000474 RID: 1140 RVA: 0x000167EF File Offset: 0x000157EF
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
// Token: 0x06000475 RID: 1141 RVA: 0x000167F8 File Offset: 0x000157F8
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
long num = this.readPos_;
|
||||
switch (origin)
|
||||
{
|
||||
case SeekOrigin.Begin:
|
||||
num = this.start_ + offset;
|
||||
break;
|
||||
case SeekOrigin.Current:
|
||||
num = this.readPos_ + offset;
|
||||
break;
|
||||
case SeekOrigin.End:
|
||||
num = this.end_ + offset;
|
||||
break;
|
||||
}
|
||||
if (num < this.start_)
|
||||
{
|
||||
throw new ArgumentException("Negative position is invalid");
|
||||
}
|
||||
if (num >= this.end_)
|
||||
{
|
||||
throw new IOException("Cannot seek past end");
|
||||
}
|
||||
this.readPos_ = num;
|
||||
return this.readPos_;
|
||||
}
|
||||
|
||||
// Token: 0x06000476 RID: 1142 RVA: 0x00016876 File Offset: 0x00015876
|
||||
public override void Flush()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x17000107 RID: 263
|
||||
// (get) Token: 0x06000477 RID: 1143 RVA: 0x00016878 File Offset: 0x00015878
|
||||
// (set) Token: 0x06000478 RID: 1144 RVA: 0x00016888 File Offset: 0x00015888
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.readPos_ - this.start_;
|
||||
}
|
||||
set
|
||||
{
|
||||
long num = this.start_ + value;
|
||||
if (num < this.start_)
|
||||
{
|
||||
throw new ArgumentException("Negative position is invalid");
|
||||
}
|
||||
if (num >= this.end_)
|
||||
{
|
||||
throw new InvalidOperationException("Cannot seek past end");
|
||||
}
|
||||
this.readPos_ = num;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000108 RID: 264
|
||||
// (get) Token: 0x06000479 RID: 1145 RVA: 0x000168CD File Offset: 0x000158CD
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.length_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000109 RID: 265
|
||||
// (get) Token: 0x0600047A RID: 1146 RVA: 0x000168D5 File Offset: 0x000158D5
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700010A RID: 266
|
||||
// (get) Token: 0x0600047B RID: 1147 RVA: 0x000168D8 File Offset: 0x000158D8
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700010B RID: 267
|
||||
// (get) Token: 0x0600047C RID: 1148 RVA: 0x000168DB File Offset: 0x000158DB
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700010C RID: 268
|
||||
// (get) Token: 0x0600047D RID: 1149 RVA: 0x000168DE File Offset: 0x000158DE
|
||||
public override bool CanTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseStream_.CanTimeout;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000302 RID: 770
|
||||
private ZipFile zipFile_;
|
||||
|
||||
// Token: 0x04000303 RID: 771
|
||||
private Stream baseStream_;
|
||||
|
||||
// Token: 0x04000304 RID: 772
|
||||
private long start_;
|
||||
|
||||
// Token: 0x04000305 RID: 773
|
||||
private long length_;
|
||||
|
||||
// Token: 0x04000306 RID: 774
|
||||
private long readPos_;
|
||||
|
||||
// Token: 0x04000307 RID: 775
|
||||
private long end_;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,455 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200007C RID: 124
|
||||
internal class ZipHelperStream : Stream
|
||||
{
|
||||
// Token: 0x060004AD RID: 1197 RVA: 0x00016D16 File Offset: 0x00015D16
|
||||
public ZipHelperStream(string name)
|
||||
{
|
||||
this.stream_ = new FileStream(name, FileMode.Open, FileAccess.ReadWrite);
|
||||
this.isOwner_ = true;
|
||||
}
|
||||
|
||||
// Token: 0x060004AE RID: 1198 RVA: 0x00016D33 File Offset: 0x00015D33
|
||||
public ZipHelperStream(Stream stream)
|
||||
{
|
||||
this.stream_ = stream;
|
||||
}
|
||||
|
||||
// Token: 0x17000115 RID: 277
|
||||
// (get) Token: 0x060004AF RID: 1199 RVA: 0x00016D42 File Offset: 0x00015D42
|
||||
// (set) Token: 0x060004B0 RID: 1200 RVA: 0x00016D4A File Offset: 0x00015D4A
|
||||
public bool IsStreamOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isOwner_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.isOwner_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000116 RID: 278
|
||||
// (get) Token: 0x060004B1 RID: 1201 RVA: 0x00016D53 File Offset: 0x00015D53
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.stream_.CanRead;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000117 RID: 279
|
||||
// (get) Token: 0x060004B2 RID: 1202 RVA: 0x00016D60 File Offset: 0x00015D60
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.stream_.CanSeek;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000118 RID: 280
|
||||
// (get) Token: 0x060004B3 RID: 1203 RVA: 0x00016D6D File Offset: 0x00015D6D
|
||||
public override bool CanTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.stream_.CanTimeout;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000119 RID: 281
|
||||
// (get) Token: 0x060004B4 RID: 1204 RVA: 0x00016D7A File Offset: 0x00015D7A
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.stream_.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700011A RID: 282
|
||||
// (get) Token: 0x060004B5 RID: 1205 RVA: 0x00016D87 File Offset: 0x00015D87
|
||||
// (set) Token: 0x060004B6 RID: 1206 RVA: 0x00016D94 File Offset: 0x00015D94
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.stream_.Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.stream_.Position = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700011B RID: 283
|
||||
// (get) Token: 0x060004B7 RID: 1207 RVA: 0x00016DA2 File Offset: 0x00015DA2
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.stream_.CanWrite;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060004B8 RID: 1208 RVA: 0x00016DAF File Offset: 0x00015DAF
|
||||
public override void Flush()
|
||||
{
|
||||
this.stream_.Flush();
|
||||
}
|
||||
|
||||
// Token: 0x060004B9 RID: 1209 RVA: 0x00016DBC File Offset: 0x00015DBC
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
return this.stream_.Seek(offset, origin);
|
||||
}
|
||||
|
||||
// Token: 0x060004BA RID: 1210 RVA: 0x00016DCB File Offset: 0x00015DCB
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
this.stream_.SetLength(value);
|
||||
}
|
||||
|
||||
// Token: 0x060004BB RID: 1211 RVA: 0x00016DD9 File Offset: 0x00015DD9
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
return this.stream_.Read(buffer, offset, count);
|
||||
}
|
||||
|
||||
// Token: 0x060004BC RID: 1212 RVA: 0x00016DE9 File Offset: 0x00015DE9
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
this.stream_.Write(buffer, offset, count);
|
||||
}
|
||||
|
||||
// Token: 0x060004BD RID: 1213 RVA: 0x00016DFC File Offset: 0x00015DFC
|
||||
public override void Close()
|
||||
{
|
||||
Stream stream = this.stream_;
|
||||
this.stream_ = null;
|
||||
if (this.isOwner_ && stream != null)
|
||||
{
|
||||
this.isOwner_ = false;
|
||||
stream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060004BE RID: 1214 RVA: 0x00016E30 File Offset: 0x00015E30
|
||||
private void WriteLocalHeader(ZipEntry entry, EntryPatchData patchData)
|
||||
{
|
||||
CompressionMethod compressionMethod = entry.CompressionMethod;
|
||||
bool flag = true;
|
||||
bool flag2 = false;
|
||||
this.WriteLEInt(67324752);
|
||||
this.WriteLEShort(entry.Version);
|
||||
this.WriteLEShort(entry.Flags);
|
||||
this.WriteLEShort((int)((byte)compressionMethod));
|
||||
this.WriteLEInt((int)entry.DosTime);
|
||||
if (flag)
|
||||
{
|
||||
this.WriteLEInt((int)entry.Crc);
|
||||
if (entry.LocalHeaderRequiresZip64)
|
||||
{
|
||||
this.WriteLEInt(-1);
|
||||
this.WriteLEInt(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLEInt(entry.IsCrypted ? ((int)entry.CompressedSize + 12) : ((int)entry.CompressedSize));
|
||||
this.WriteLEInt((int)entry.Size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (patchData != null)
|
||||
{
|
||||
patchData.CrcPatchOffset = this.stream_.Position;
|
||||
}
|
||||
this.WriteLEInt(0);
|
||||
if (patchData != null)
|
||||
{
|
||||
patchData.SizePatchOffset = this.stream_.Position;
|
||||
}
|
||||
if (entry.LocalHeaderRequiresZip64 && flag2)
|
||||
{
|
||||
this.WriteLEInt(-1);
|
||||
this.WriteLEInt(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLEInt(0);
|
||||
this.WriteLEInt(0);
|
||||
}
|
||||
}
|
||||
byte[] array = ZipConstants.ConvertToArray(entry.Flags, entry.Name);
|
||||
if (array.Length > 65535)
|
||||
{
|
||||
throw new ZipException("Entry name too long.");
|
||||
}
|
||||
ZipExtraData zipExtraData = new ZipExtraData(entry.ExtraData);
|
||||
if (entry.LocalHeaderRequiresZip64 && (flag || flag2))
|
||||
{
|
||||
zipExtraData.StartNewEntry();
|
||||
if (flag)
|
||||
{
|
||||
zipExtraData.AddLeLong(entry.Size);
|
||||
zipExtraData.AddLeLong(entry.CompressedSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
zipExtraData.AddLeLong(-1L);
|
||||
zipExtraData.AddLeLong(-1L);
|
||||
}
|
||||
zipExtraData.AddNewEntry(1);
|
||||
if (!zipExtraData.Find(1))
|
||||
{
|
||||
throw new ZipException("Internal error cant find extra data");
|
||||
}
|
||||
if (patchData != null)
|
||||
{
|
||||
patchData.SizePatchOffset = (long)zipExtraData.CurrentReadIndex;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
zipExtraData.Delete(1);
|
||||
}
|
||||
byte[] entryData = zipExtraData.GetEntryData();
|
||||
this.WriteLEShort(array.Length);
|
||||
this.WriteLEShort(entryData.Length);
|
||||
if (array.Length > 0)
|
||||
{
|
||||
this.stream_.Write(array, 0, array.Length);
|
||||
}
|
||||
if (entry.LocalHeaderRequiresZip64 && flag2)
|
||||
{
|
||||
patchData.SizePatchOffset += this.stream_.Position;
|
||||
}
|
||||
if (entryData.Length > 0)
|
||||
{
|
||||
this.stream_.Write(entryData, 0, entryData.Length);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060004BF RID: 1215 RVA: 0x00017054 File Offset: 0x00016054
|
||||
public long LocateBlockWithSignature(int signature, long endLocation, int minimumBlockSize, int maximumVariableData)
|
||||
{
|
||||
long num = endLocation - (long)minimumBlockSize;
|
||||
if (num < 0L)
|
||||
{
|
||||
return -1L;
|
||||
}
|
||||
long num2 = Math.Max(num - (long)maximumVariableData, 0L);
|
||||
while (num >= num2)
|
||||
{
|
||||
long num3 = num;
|
||||
num = num3 - 1L;
|
||||
this.Seek(num3, SeekOrigin.Begin);
|
||||
if (this.ReadLEInt() == signature)
|
||||
{
|
||||
return this.Position;
|
||||
}
|
||||
}
|
||||
return -1L;
|
||||
}
|
||||
|
||||
// Token: 0x060004C0 RID: 1216 RVA: 0x000170A0 File Offset: 0x000160A0
|
||||
public void WriteZip64EndOfCentralDirectory(long noOfEntries, long sizeEntries, long centralDirOffset)
|
||||
{
|
||||
long position = this.stream_.Position;
|
||||
this.WriteLEInt(101075792);
|
||||
this.WriteLELong(44L);
|
||||
this.WriteLEShort(51);
|
||||
this.WriteLEShort(45);
|
||||
this.WriteLEInt(0);
|
||||
this.WriteLEInt(0);
|
||||
this.WriteLELong(noOfEntries);
|
||||
this.WriteLELong(noOfEntries);
|
||||
this.WriteLELong(sizeEntries);
|
||||
this.WriteLELong(centralDirOffset);
|
||||
this.WriteLEInt(117853008);
|
||||
this.WriteLEInt(0);
|
||||
this.WriteLELong(position);
|
||||
this.WriteLEInt(1);
|
||||
}
|
||||
|
||||
// Token: 0x060004C1 RID: 1217 RVA: 0x00017128 File Offset: 0x00016128
|
||||
public void WriteEndOfCentralDirectory(long noOfEntries, long sizeEntries, long startOfCentralDirectory, byte[] comment)
|
||||
{
|
||||
if (noOfEntries >= 65535L || startOfCentralDirectory >= (long)((ulong)(-1)) || sizeEntries >= (long)((ulong)(-1)))
|
||||
{
|
||||
this.WriteZip64EndOfCentralDirectory(noOfEntries, sizeEntries, startOfCentralDirectory);
|
||||
}
|
||||
this.WriteLEInt(101010256);
|
||||
this.WriteLEShort(0);
|
||||
this.WriteLEShort(0);
|
||||
if (noOfEntries >= 65535L)
|
||||
{
|
||||
this.WriteLEUshort(ushort.MaxValue);
|
||||
this.WriteLEUshort(ushort.MaxValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLEShort((int)((short)noOfEntries));
|
||||
this.WriteLEShort((int)((short)noOfEntries));
|
||||
}
|
||||
if (sizeEntries >= (long)((ulong)(-1)))
|
||||
{
|
||||
this.WriteLEUint(uint.MaxValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLEInt((int)sizeEntries);
|
||||
}
|
||||
if (startOfCentralDirectory >= (long)((ulong)(-1)))
|
||||
{
|
||||
this.WriteLEUint(uint.MaxValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLEInt((int)startOfCentralDirectory);
|
||||
}
|
||||
int num = ((comment != null) ? comment.Length : 0);
|
||||
if (num > 65535)
|
||||
{
|
||||
throw new ZipException(string.Format("Comment length({0}) is too long can only be 64K", num));
|
||||
}
|
||||
this.WriteLEShort(num);
|
||||
if (num > 0)
|
||||
{
|
||||
this.Write(comment, 0, comment.Length);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060004C2 RID: 1218 RVA: 0x0001720C File Offset: 0x0001620C
|
||||
public int ReadLEShort()
|
||||
{
|
||||
int num = this.stream_.ReadByte();
|
||||
if (num < 0)
|
||||
{
|
||||
throw new EndOfStreamException();
|
||||
}
|
||||
int num2 = this.stream_.ReadByte();
|
||||
if (num2 < 0)
|
||||
{
|
||||
throw new EndOfStreamException();
|
||||
}
|
||||
return num | (num2 << 8);
|
||||
}
|
||||
|
||||
// Token: 0x060004C3 RID: 1219 RVA: 0x0001724A File Offset: 0x0001624A
|
||||
public int ReadLEInt()
|
||||
{
|
||||
return this.ReadLEShort() | (this.ReadLEShort() << 16);
|
||||
}
|
||||
|
||||
// Token: 0x060004C4 RID: 1220 RVA: 0x0001725C File Offset: 0x0001625C
|
||||
public long ReadLELong()
|
||||
{
|
||||
return (long)((ulong)this.ReadLEInt() | (ulong)((ulong)((long)this.ReadLEInt()) << 32));
|
||||
}
|
||||
|
||||
// Token: 0x060004C5 RID: 1221 RVA: 0x00017270 File Offset: 0x00016270
|
||||
public void WriteLEShort(int value)
|
||||
{
|
||||
this.stream_.WriteByte((byte)(value & 255));
|
||||
this.stream_.WriteByte((byte)((value >> 8) & 255));
|
||||
}
|
||||
|
||||
// Token: 0x060004C6 RID: 1222 RVA: 0x0001729A File Offset: 0x0001629A
|
||||
public void WriteLEUshort(ushort value)
|
||||
{
|
||||
this.stream_.WriteByte((byte)(value & 255));
|
||||
this.stream_.WriteByte((byte)(value >> 8));
|
||||
}
|
||||
|
||||
// Token: 0x060004C7 RID: 1223 RVA: 0x000172BE File Offset: 0x000162BE
|
||||
public void WriteLEInt(int value)
|
||||
{
|
||||
this.WriteLEShort(value);
|
||||
this.WriteLEShort(value >> 16);
|
||||
}
|
||||
|
||||
// Token: 0x060004C8 RID: 1224 RVA: 0x000172D1 File Offset: 0x000162D1
|
||||
public void WriteLEUint(uint value)
|
||||
{
|
||||
this.WriteLEUshort((ushort)(value & 65535U));
|
||||
this.WriteLEUshort((ushort)(value >> 16));
|
||||
}
|
||||
|
||||
// Token: 0x060004C9 RID: 1225 RVA: 0x000172EC File Offset: 0x000162EC
|
||||
public void WriteLELong(long value)
|
||||
{
|
||||
this.WriteLEInt((int)value);
|
||||
this.WriteLEInt((int)(value >> 32));
|
||||
}
|
||||
|
||||
// Token: 0x060004CA RID: 1226 RVA: 0x00017301 File Offset: 0x00016301
|
||||
public void WriteLEUlong(ulong value)
|
||||
{
|
||||
this.WriteLEUint((uint)(value & (ulong)(-1)));
|
||||
this.WriteLEUint((uint)(value >> 32));
|
||||
}
|
||||
|
||||
// Token: 0x060004CB RID: 1227 RVA: 0x0001731C File Offset: 0x0001631C
|
||||
public int WriteDataDescriptor(ZipEntry entry)
|
||||
{
|
||||
if (entry == null)
|
||||
{
|
||||
throw new ArgumentNullException("entry");
|
||||
}
|
||||
int num = 0;
|
||||
if ((entry.Flags & 8) != 0)
|
||||
{
|
||||
this.WriteLEInt(134695760);
|
||||
this.WriteLEInt((int)entry.Crc);
|
||||
num += 8;
|
||||
if (entry.LocalHeaderRequiresZip64)
|
||||
{
|
||||
this.WriteLELong(entry.CompressedSize);
|
||||
this.WriteLELong(entry.Size);
|
||||
num += 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLEInt((int)entry.CompressedSize);
|
||||
this.WriteLEInt((int)entry.Size);
|
||||
num += 8;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x060004CC RID: 1228 RVA: 0x000173A8 File Offset: 0x000163A8
|
||||
public void ReadDataDescriptor(bool zip64, DescriptorData data)
|
||||
{
|
||||
int num = this.ReadLEInt();
|
||||
if (num != 134695760)
|
||||
{
|
||||
throw new ZipException("Data descriptor signature not found");
|
||||
}
|
||||
data.Crc = (long)this.ReadLEInt();
|
||||
if (zip64)
|
||||
{
|
||||
data.CompressedSize = this.ReadLELong();
|
||||
data.Size = this.ReadLELong();
|
||||
return;
|
||||
}
|
||||
data.CompressedSize = (long)this.ReadLEInt();
|
||||
data.Size = (long)this.ReadLEInt();
|
||||
}
|
||||
|
||||
// Token: 0x04000314 RID: 788
|
||||
private bool isOwner_;
|
||||
|
||||
// Token: 0x04000315 RID: 789
|
||||
private Stream stream_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,477 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using ICSharpCode.SharpZipLib.Checksums;
|
||||
using ICSharpCode.SharpZipLib.Encryption;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200007D RID: 125
|
||||
public class ZipInputStream : InflaterInputStream
|
||||
{
|
||||
// Token: 0x060004CD RID: 1229 RVA: 0x00017412 File Offset: 0x00016412
|
||||
public ZipInputStream(Stream baseInputStream)
|
||||
: base(baseInputStream, new Inflater(true))
|
||||
{
|
||||
this.internalReader = new ZipInputStream.ReadDataHandler(this.ReadingNotAvailable);
|
||||
}
|
||||
|
||||
// Token: 0x060004CE RID: 1230 RVA: 0x0001743E File Offset: 0x0001643E
|
||||
public ZipInputStream(Stream baseInputStream, int bufferSize)
|
||||
: base(baseInputStream, new Inflater(true), bufferSize)
|
||||
{
|
||||
this.internalReader = new ZipInputStream.ReadDataHandler(this.ReadingNotAvailable);
|
||||
}
|
||||
|
||||
// Token: 0x1700011C RID: 284
|
||||
// (get) Token: 0x060004CF RID: 1231 RVA: 0x0001746B File Offset: 0x0001646B
|
||||
// (set) Token: 0x060004D0 RID: 1232 RVA: 0x00017473 File Offset: 0x00016473
|
||||
public string Password
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.password;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.password = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700011D RID: 285
|
||||
// (get) Token: 0x060004D1 RID: 1233 RVA: 0x0001747C File Offset: 0x0001647C
|
||||
public bool CanDecompressEntry
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.entry != null && this.entry.CanDecompress;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060004D2 RID: 1234 RVA: 0x00017494 File Offset: 0x00016494
|
||||
public ZipEntry GetNextEntry()
|
||||
{
|
||||
if (this.crc == null)
|
||||
{
|
||||
throw new InvalidOperationException("Closed.");
|
||||
}
|
||||
if (this.entry != null)
|
||||
{
|
||||
this.CloseEntry();
|
||||
}
|
||||
int num = this.inputBuffer.ReadLeInt();
|
||||
if (num == 33639248 || num == 101010256 || num == 84233040 || num == 117853008 || num == 101075792)
|
||||
{
|
||||
this.Close();
|
||||
return null;
|
||||
}
|
||||
if (num == 808471376 || num == 134695760)
|
||||
{
|
||||
num = this.inputBuffer.ReadLeInt();
|
||||
}
|
||||
if (num != 67324752)
|
||||
{
|
||||
throw new ZipException("Wrong Local header signature: 0x" + string.Format("{0:X}", num));
|
||||
}
|
||||
short num2 = (short)this.inputBuffer.ReadLeShort();
|
||||
this.flags = this.inputBuffer.ReadLeShort();
|
||||
this.method = this.inputBuffer.ReadLeShort();
|
||||
uint num3 = (uint)this.inputBuffer.ReadLeInt();
|
||||
int num4 = this.inputBuffer.ReadLeInt();
|
||||
this.csize = (long)this.inputBuffer.ReadLeInt();
|
||||
this.size = (long)this.inputBuffer.ReadLeInt();
|
||||
int num5 = this.inputBuffer.ReadLeShort();
|
||||
int num6 = this.inputBuffer.ReadLeShort();
|
||||
bool flag = (this.flags & 1) == 1;
|
||||
byte[] array = new byte[num5];
|
||||
this.inputBuffer.ReadRawBuffer(array);
|
||||
string text = ZipConstants.ConvertToStringExt(this.flags, array);
|
||||
this.entry = new ZipEntry(text, (int)num2);
|
||||
this.entry.Flags = this.flags;
|
||||
this.entry.CompressionMethod = (CompressionMethod)this.method;
|
||||
if ((this.flags & 8) == 0)
|
||||
{
|
||||
this.entry.Crc = (long)num4 & (long)((ulong)(-1));
|
||||
this.entry.Size = this.size & (long)((ulong)(-1));
|
||||
this.entry.CompressedSize = this.csize & (long)((ulong)(-1));
|
||||
this.entry.CryptoCheckValue = (byte)((num4 >> 24) & 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num4 != 0)
|
||||
{
|
||||
this.entry.Crc = (long)num4 & (long)((ulong)(-1));
|
||||
}
|
||||
if (this.size != 0L)
|
||||
{
|
||||
this.entry.Size = this.size & (long)((ulong)(-1));
|
||||
}
|
||||
if (this.csize != 0L)
|
||||
{
|
||||
this.entry.CompressedSize = this.csize & (long)((ulong)(-1));
|
||||
}
|
||||
this.entry.CryptoCheckValue = (byte)((num3 >> 8) & 255U);
|
||||
}
|
||||
this.entry.DosTime = (long)((ulong)num3);
|
||||
if (num6 > 0)
|
||||
{
|
||||
byte[] array2 = new byte[num6];
|
||||
this.inputBuffer.ReadRawBuffer(array2);
|
||||
this.entry.ExtraData = array2;
|
||||
}
|
||||
this.entry.ProcessExtraData(true);
|
||||
if (this.entry.CompressedSize >= 0L)
|
||||
{
|
||||
this.csize = this.entry.CompressedSize;
|
||||
}
|
||||
if (this.entry.Size >= 0L)
|
||||
{
|
||||
this.size = this.entry.Size;
|
||||
}
|
||||
if (this.method == 0 && ((!flag && this.csize != this.size) || (flag && this.csize - 12L != this.size)))
|
||||
{
|
||||
throw new ZipException("Stored, but compressed != uncompressed");
|
||||
}
|
||||
if (this.entry.IsCompressionMethodSupported())
|
||||
{
|
||||
this.internalReader = new ZipInputStream.ReadDataHandler(this.InitialRead);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.internalReader = new ZipInputStream.ReadDataHandler(this.ReadingNotSupported);
|
||||
}
|
||||
return this.entry;
|
||||
}
|
||||
|
||||
// Token: 0x060004D3 RID: 1235 RVA: 0x000177E0 File Offset: 0x000167E0
|
||||
private void ReadDataDescriptor()
|
||||
{
|
||||
if (this.inputBuffer.ReadLeInt() != 134695760)
|
||||
{
|
||||
throw new ZipException("Data descriptor signature not found");
|
||||
}
|
||||
this.entry.Crc = (long)this.inputBuffer.ReadLeInt() & (long)((ulong)(-1));
|
||||
if (this.entry.LocalHeaderRequiresZip64)
|
||||
{
|
||||
this.csize = this.inputBuffer.ReadLeLong();
|
||||
this.size = this.inputBuffer.ReadLeLong();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.csize = (long)this.inputBuffer.ReadLeInt();
|
||||
this.size = (long)this.inputBuffer.ReadLeInt();
|
||||
}
|
||||
this.entry.CompressedSize = this.csize;
|
||||
this.entry.Size = this.size;
|
||||
}
|
||||
|
||||
// Token: 0x060004D4 RID: 1236 RVA: 0x0001789C File Offset: 0x0001689C
|
||||
private void CompleteCloseEntry(bool testCrc)
|
||||
{
|
||||
base.StopDecrypting();
|
||||
if ((this.flags & 8) != 0)
|
||||
{
|
||||
this.ReadDataDescriptor();
|
||||
}
|
||||
this.size = 0L;
|
||||
if (testCrc && (this.crc.Value & (long)((ulong)(-1))) != this.entry.Crc && this.entry.Crc != -1L)
|
||||
{
|
||||
throw new ZipException("CRC mismatch");
|
||||
}
|
||||
this.crc.Reset();
|
||||
if (this.method == 8)
|
||||
{
|
||||
this.inf.Reset();
|
||||
}
|
||||
this.entry = null;
|
||||
}
|
||||
|
||||
// Token: 0x060004D5 RID: 1237 RVA: 0x00017928 File Offset: 0x00016928
|
||||
public void CloseEntry()
|
||||
{
|
||||
if (this.crc == null)
|
||||
{
|
||||
throw new InvalidOperationException("Closed");
|
||||
}
|
||||
if (this.entry == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.method == 8)
|
||||
{
|
||||
if ((this.flags & 8) != 0)
|
||||
{
|
||||
byte[] array = new byte[4096];
|
||||
while (this.Read(array, 0, array.Length) > 0)
|
||||
{
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.csize -= this.inf.TotalIn;
|
||||
this.inputBuffer.Available += this.inf.RemainingInput;
|
||||
}
|
||||
if ((long)this.inputBuffer.Available > this.csize && this.csize >= 0L)
|
||||
{
|
||||
this.inputBuffer.Available = (int)((long)this.inputBuffer.Available - this.csize);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.csize -= (long)this.inputBuffer.Available;
|
||||
this.inputBuffer.Available = 0;
|
||||
while (this.csize != 0L)
|
||||
{
|
||||
long num = base.Skip(this.csize);
|
||||
if (num <= 0L)
|
||||
{
|
||||
throw new ZipException("Zip archive ends early.");
|
||||
}
|
||||
this.csize -= num;
|
||||
}
|
||||
}
|
||||
this.CompleteCloseEntry(false);
|
||||
}
|
||||
|
||||
// Token: 0x1700011E RID: 286
|
||||
// (get) Token: 0x060004D6 RID: 1238 RVA: 0x00017A55 File Offset: 0x00016A55
|
||||
public override int Available
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.entry == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700011F RID: 287
|
||||
// (get) Token: 0x060004D7 RID: 1239 RVA: 0x00017A62 File Offset: 0x00016A62
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.entry == null)
|
||||
{
|
||||
throw new InvalidOperationException("No current entry");
|
||||
}
|
||||
if (this.entry.Size >= 0L)
|
||||
{
|
||||
return this.entry.Size;
|
||||
}
|
||||
throw new ZipException("Length not available for the current entry");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060004D8 RID: 1240 RVA: 0x00017A9C File Offset: 0x00016A9C
|
||||
public override int ReadByte()
|
||||
{
|
||||
byte[] array = new byte[1];
|
||||
if (this.Read(array, 0, 1) <= 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return (int)(array[0] & byte.MaxValue);
|
||||
}
|
||||
|
||||
// Token: 0x060004D9 RID: 1241 RVA: 0x00017AC7 File Offset: 0x00016AC7
|
||||
private int ReadingNotAvailable(byte[] destination, int offset, int count)
|
||||
{
|
||||
throw new InvalidOperationException("Unable to read from this stream");
|
||||
}
|
||||
|
||||
// Token: 0x060004DA RID: 1242 RVA: 0x00017AD3 File Offset: 0x00016AD3
|
||||
private int ReadingNotSupported(byte[] destination, int offset, int count)
|
||||
{
|
||||
throw new ZipException("The compression method for this entry is not supported");
|
||||
}
|
||||
|
||||
// Token: 0x060004DB RID: 1243 RVA: 0x00017AE0 File Offset: 0x00016AE0
|
||||
private int InitialRead(byte[] destination, int offset, int count)
|
||||
{
|
||||
if (!this.CanDecompressEntry)
|
||||
{
|
||||
throw new ZipException("Library cannot extract this entry. Version required is (" + this.entry.Version.ToString() + ")");
|
||||
}
|
||||
if (this.entry.IsCrypted)
|
||||
{
|
||||
if (this.password == null)
|
||||
{
|
||||
throw new ZipException("No password set.");
|
||||
}
|
||||
PkzipClassicManaged pkzipClassicManaged = new PkzipClassicManaged();
|
||||
byte[] array = PkzipClassic.GenerateKeys(ZipConstants.ConvertToArray(this.password));
|
||||
this.inputBuffer.CryptoTransform = pkzipClassicManaged.CreateDecryptor(array, null);
|
||||
byte[] array2 = new byte[12];
|
||||
this.inputBuffer.ReadClearTextBuffer(array2, 0, 12);
|
||||
if (array2[11] != this.entry.CryptoCheckValue)
|
||||
{
|
||||
throw new ZipException("Invalid password");
|
||||
}
|
||||
if (this.csize >= 12L)
|
||||
{
|
||||
this.csize -= 12L;
|
||||
}
|
||||
else if ((this.entry.Flags & 8) == 0)
|
||||
{
|
||||
throw new ZipException(string.Format("Entry compressed size {0} too small for encryption", this.csize));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.inputBuffer.CryptoTransform = null;
|
||||
}
|
||||
if (this.csize > 0L || (this.flags & 8) != 0)
|
||||
{
|
||||
if (this.method == 8 && this.inputBuffer.Available > 0)
|
||||
{
|
||||
this.inputBuffer.SetInflaterInput(this.inf);
|
||||
}
|
||||
this.internalReader = new ZipInputStream.ReadDataHandler(this.BodyRead);
|
||||
return this.BodyRead(destination, offset, count);
|
||||
}
|
||||
this.internalReader = new ZipInputStream.ReadDataHandler(this.ReadingNotAvailable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Token: 0x060004DC RID: 1244 RVA: 0x00017C5C File Offset: 0x00016C5C
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "Cannot be negative");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "Cannot be negative");
|
||||
}
|
||||
if (buffer.Length - offset < count)
|
||||
{
|
||||
throw new ArgumentException("Invalid offset/count combination");
|
||||
}
|
||||
return this.internalReader(buffer, offset, count);
|
||||
}
|
||||
|
||||
// Token: 0x060004DD RID: 1245 RVA: 0x00017CC0 File Offset: 0x00016CC0
|
||||
private int BodyRead(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (this.crc == null)
|
||||
{
|
||||
throw new InvalidOperationException("Closed");
|
||||
}
|
||||
if (this.entry == null || count <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (offset + count > buffer.Length)
|
||||
{
|
||||
throw new ArgumentException("Offset + count exceeds buffer size");
|
||||
}
|
||||
bool flag = false;
|
||||
int num = this.method;
|
||||
if (num != 0)
|
||||
{
|
||||
if (num == 8)
|
||||
{
|
||||
count = base.Read(buffer, offset, count);
|
||||
if (count <= 0)
|
||||
{
|
||||
if (!this.inf.IsFinished)
|
||||
{
|
||||
throw new ZipException("Inflater not finished!");
|
||||
}
|
||||
this.inputBuffer.Available = this.inf.RemainingInput;
|
||||
if ((this.flags & 8) == 0 && ((this.inf.TotalIn != this.csize && this.csize != (long)((ulong)(-1)) && this.csize != -1L) || this.inf.TotalOut != this.size))
|
||||
{
|
||||
throw new ZipException(string.Concat(new object[]
|
||||
{
|
||||
"Size mismatch: ",
|
||||
this.csize,
|
||||
";",
|
||||
this.size,
|
||||
" <-> ",
|
||||
this.inf.TotalIn,
|
||||
";",
|
||||
this.inf.TotalOut
|
||||
}));
|
||||
}
|
||||
this.inf.Reset();
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((long)count > this.csize && this.csize >= 0L)
|
||||
{
|
||||
count = (int)this.csize;
|
||||
}
|
||||
if (count > 0)
|
||||
{
|
||||
count = this.inputBuffer.ReadClearTextBuffer(buffer, offset, count);
|
||||
if (count > 0)
|
||||
{
|
||||
this.csize -= (long)count;
|
||||
this.size -= (long)count;
|
||||
}
|
||||
}
|
||||
if (this.csize == 0L)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
else if (count < 0)
|
||||
{
|
||||
throw new ZipException("EOF in stored block");
|
||||
}
|
||||
}
|
||||
if (count > 0)
|
||||
{
|
||||
this.crc.Update(buffer, offset, count);
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
this.CompleteCloseEntry(true);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// Token: 0x060004DE RID: 1246 RVA: 0x00017EB0 File Offset: 0x00016EB0
|
||||
public override void Close()
|
||||
{
|
||||
this.internalReader = new ZipInputStream.ReadDataHandler(this.ReadingNotAvailable);
|
||||
this.crc = null;
|
||||
this.entry = null;
|
||||
base.Close();
|
||||
}
|
||||
|
||||
// Token: 0x04000316 RID: 790
|
||||
private ZipInputStream.ReadDataHandler internalReader;
|
||||
|
||||
// Token: 0x04000317 RID: 791
|
||||
private Crc32 crc = new Crc32();
|
||||
|
||||
// Token: 0x04000318 RID: 792
|
||||
private ZipEntry entry;
|
||||
|
||||
// Token: 0x04000319 RID: 793
|
||||
private long size;
|
||||
|
||||
// Token: 0x0400031A RID: 794
|
||||
private int method;
|
||||
|
||||
// Token: 0x0400031B RID: 795
|
||||
private int flags;
|
||||
|
||||
// Token: 0x0400031C RID: 796
|
||||
private string password;
|
||||
|
||||
// Token: 0x0200007E RID: 126
|
||||
// (Invoke) Token: 0x060004E0 RID: 1248
|
||||
private delegate int ReadDataHandler(byte[] b, int offset, int length);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using ICSharpCode.SharpZipLib.Core;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x0200007F RID: 127
|
||||
public class ZipNameTransform : INameTransform
|
||||
{
|
||||
// Token: 0x060004E3 RID: 1251 RVA: 0x00017ED8 File Offset: 0x00016ED8
|
||||
public ZipNameTransform()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060004E4 RID: 1252 RVA: 0x00017EE0 File Offset: 0x00016EE0
|
||||
public ZipNameTransform(string trimPrefix)
|
||||
{
|
||||
this.TrimPrefix = trimPrefix;
|
||||
}
|
||||
|
||||
// Token: 0x060004E5 RID: 1253 RVA: 0x00017EF0 File Offset: 0x00016EF0
|
||||
static ZipNameTransform()
|
||||
{
|
||||
char[] invalidPathChars = Path.GetInvalidPathChars();
|
||||
int num = invalidPathChars.Length + 2;
|
||||
ZipNameTransform.InvalidEntryCharsRelaxed = new char[num];
|
||||
Array.Copy(invalidPathChars, 0, ZipNameTransform.InvalidEntryCharsRelaxed, 0, invalidPathChars.Length);
|
||||
ZipNameTransform.InvalidEntryCharsRelaxed[num - 1] = '*';
|
||||
ZipNameTransform.InvalidEntryCharsRelaxed[num - 2] = '?';
|
||||
num = invalidPathChars.Length + 4;
|
||||
ZipNameTransform.InvalidEntryChars = new char[num];
|
||||
Array.Copy(invalidPathChars, 0, ZipNameTransform.InvalidEntryChars, 0, invalidPathChars.Length);
|
||||
ZipNameTransform.InvalidEntryChars[num - 1] = ':';
|
||||
ZipNameTransform.InvalidEntryChars[num - 2] = '\\';
|
||||
ZipNameTransform.InvalidEntryChars[num - 3] = '*';
|
||||
ZipNameTransform.InvalidEntryChars[num - 4] = '?';
|
||||
}
|
||||
|
||||
// Token: 0x060004E6 RID: 1254 RVA: 0x00017F87 File Offset: 0x00016F87
|
||||
public string TransformDirectory(string name)
|
||||
{
|
||||
name = this.TransformFile(name);
|
||||
if (name.Length > 0)
|
||||
{
|
||||
if (!name.EndsWith("/"))
|
||||
{
|
||||
name += "/";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
throw new ZipException("Cannot have an empty directory name");
|
||||
}
|
||||
|
||||
// Token: 0x060004E7 RID: 1255 RVA: 0x00017FC4 File Offset: 0x00016FC4
|
||||
public string TransformFile(string name)
|
||||
{
|
||||
if (name != null)
|
||||
{
|
||||
string text = name.ToLower();
|
||||
if (this.trimPrefix_ != null && text.IndexOf(this.trimPrefix_) == 0)
|
||||
{
|
||||
name = name.Substring(this.trimPrefix_.Length);
|
||||
}
|
||||
name = name.Replace("\\", "/");
|
||||
name = WindowsPathUtils.DropPathRoot(name);
|
||||
while (name.Length > 0)
|
||||
{
|
||||
if (name[0] != '/')
|
||||
{
|
||||
break;
|
||||
}
|
||||
name = name.Remove(0, 1);
|
||||
}
|
||||
while (name.Length > 0 && name[name.Length - 1] == '/')
|
||||
{
|
||||
name = name.Remove(name.Length - 1, 1);
|
||||
}
|
||||
for (int i = name.IndexOf("//"); i >= 0; i = name.IndexOf("//"))
|
||||
{
|
||||
name = name.Remove(i, 1);
|
||||
}
|
||||
name = ZipNameTransform.MakeValidName(name, '_');
|
||||
}
|
||||
else
|
||||
{
|
||||
name = string.Empty;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
// Token: 0x17000120 RID: 288
|
||||
// (get) Token: 0x060004E8 RID: 1256 RVA: 0x000180AB File Offset: 0x000170AB
|
||||
// (set) Token: 0x060004E9 RID: 1257 RVA: 0x000180B3 File Offset: 0x000170B3
|
||||
public string TrimPrefix
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.trimPrefix_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.trimPrefix_ = value;
|
||||
if (this.trimPrefix_ != null)
|
||||
{
|
||||
this.trimPrefix_ = this.trimPrefix_.ToLower();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060004EA RID: 1258 RVA: 0x000180D8 File Offset: 0x000170D8
|
||||
private static string MakeValidName(string name, char replacement)
|
||||
{
|
||||
int i = name.IndexOfAny(ZipNameTransform.InvalidEntryChars);
|
||||
if (i >= 0)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(name);
|
||||
while (i >= 0)
|
||||
{
|
||||
stringBuilder[i] = replacement;
|
||||
if (i >= name.Length)
|
||||
{
|
||||
i = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = name.IndexOfAny(ZipNameTransform.InvalidEntryChars, i + 1);
|
||||
}
|
||||
}
|
||||
name = stringBuilder.ToString();
|
||||
}
|
||||
if (name.Length > 65535)
|
||||
{
|
||||
throw new PathTooLongException();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
// Token: 0x060004EB RID: 1259 RVA: 0x00018144 File Offset: 0x00017144
|
||||
public static bool IsValidName(string name, bool relaxed)
|
||||
{
|
||||
bool flag = name != null;
|
||||
if (flag)
|
||||
{
|
||||
if (relaxed)
|
||||
{
|
||||
flag = name.IndexOfAny(ZipNameTransform.InvalidEntryCharsRelaxed) < 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = name.IndexOfAny(ZipNameTransform.InvalidEntryChars) < 0 && name.IndexOf('/') != 0;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060004EC RID: 1260 RVA: 0x00018194 File Offset: 0x00017194
|
||||
public static bool IsValidName(string name)
|
||||
{
|
||||
return name != null && name.IndexOfAny(ZipNameTransform.InvalidEntryChars) < 0 && name.IndexOf('/') != 0;
|
||||
}
|
||||
|
||||
// Token: 0x0400031D RID: 797
|
||||
private string trimPrefix_;
|
||||
|
||||
// Token: 0x0400031E RID: 798
|
||||
private static readonly char[] InvalidEntryChars;
|
||||
|
||||
// Token: 0x0400031F RID: 799
|
||||
private static readonly char[] InvalidEntryCharsRelaxed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,671 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using ICSharpCode.SharpZipLib.Checksums;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000080 RID: 128
|
||||
public class ZipOutputStream : DeflaterOutputStream
|
||||
{
|
||||
// Token: 0x060004ED RID: 1261 RVA: 0x000181C8 File Offset: 0x000171C8
|
||||
public ZipOutputStream(Stream baseOutputStream)
|
||||
: base(baseOutputStream, new Deflater(-1, true))
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060004EE RID: 1262 RVA: 0x0001822C File Offset: 0x0001722C
|
||||
public ZipOutputStream(Stream baseOutputStream, int bufferSize)
|
||||
: base(baseOutputStream, new Deflater(-1, true), bufferSize)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x17000121 RID: 289
|
||||
// (get) Token: 0x060004EF RID: 1263 RVA: 0x0001828F File Offset: 0x0001728F
|
||||
public bool IsFinished
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.entries == null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060004F0 RID: 1264 RVA: 0x0001829C File Offset: 0x0001729C
|
||||
public void SetComment(string comment)
|
||||
{
|
||||
byte[] array = ZipConstants.ConvertToArray(comment);
|
||||
if (array.Length > 65535)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("comment");
|
||||
}
|
||||
this.zipComment = array;
|
||||
}
|
||||
|
||||
// Token: 0x060004F1 RID: 1265 RVA: 0x000182CC File Offset: 0x000172CC
|
||||
public void SetLevel(int level)
|
||||
{
|
||||
this.deflater_.SetLevel(level);
|
||||
this.defaultCompressionLevel = level;
|
||||
}
|
||||
|
||||
// Token: 0x060004F2 RID: 1266 RVA: 0x000182E1 File Offset: 0x000172E1
|
||||
public int GetLevel()
|
||||
{
|
||||
return this.deflater_.GetLevel();
|
||||
}
|
||||
|
||||
// Token: 0x17000122 RID: 290
|
||||
// (get) Token: 0x060004F3 RID: 1267 RVA: 0x000182EE File Offset: 0x000172EE
|
||||
// (set) Token: 0x060004F4 RID: 1268 RVA: 0x000182F6 File Offset: 0x000172F6
|
||||
public UseZip64 UseZip64
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.useZip64_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.useZip64_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060004F5 RID: 1269 RVA: 0x000182FF File Offset: 0x000172FF
|
||||
private void WriteLeShort(int value)
|
||||
{
|
||||
this.baseOutputStream_.WriteByte((byte)(value & 255));
|
||||
this.baseOutputStream_.WriteByte((byte)((value >> 8) & 255));
|
||||
}
|
||||
|
||||
// Token: 0x060004F6 RID: 1270 RVA: 0x00018329 File Offset: 0x00017329
|
||||
private void WriteLeInt(int value)
|
||||
{
|
||||
this.WriteLeShort(value);
|
||||
this.WriteLeShort(value >> 16);
|
||||
}
|
||||
|
||||
// Token: 0x060004F7 RID: 1271 RVA: 0x0001833C File Offset: 0x0001733C
|
||||
private void WriteLeLong(long value)
|
||||
{
|
||||
this.WriteLeInt((int)value);
|
||||
this.WriteLeInt((int)(value >> 32));
|
||||
}
|
||||
|
||||
// Token: 0x060004F8 RID: 1272 RVA: 0x00018354 File Offset: 0x00017354
|
||||
public void PutNextEntry(ZipEntry entry)
|
||||
{
|
||||
if (entry == null)
|
||||
{
|
||||
throw new ArgumentNullException("entry");
|
||||
}
|
||||
if (this.entries == null)
|
||||
{
|
||||
throw new InvalidOperationException("ZipOutputStream was finished");
|
||||
}
|
||||
if (this.curEntry != null)
|
||||
{
|
||||
this.CloseEntry();
|
||||
}
|
||||
if (this.entries.Count == 2147483647)
|
||||
{
|
||||
throw new ZipException("Too many entries for Zip file");
|
||||
}
|
||||
CompressionMethod compressionMethod = entry.CompressionMethod;
|
||||
int num = this.defaultCompressionLevel;
|
||||
entry.Flags &= 2048;
|
||||
this.patchEntryHeader = false;
|
||||
bool flag;
|
||||
if (entry.Size == 0L)
|
||||
{
|
||||
entry.CompressedSize = entry.Size;
|
||||
entry.Crc = 0L;
|
||||
compressionMethod = CompressionMethod.Stored;
|
||||
flag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = entry.Size >= 0L && entry.HasCrc;
|
||||
if (compressionMethod == CompressionMethod.Stored)
|
||||
{
|
||||
if (!flag)
|
||||
{
|
||||
if (!base.CanPatchEntries)
|
||||
{
|
||||
compressionMethod = CompressionMethod.Deflated;
|
||||
num = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entry.CompressedSize = entry.Size;
|
||||
flag = entry.HasCrc;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
if (!base.CanPatchEntries)
|
||||
{
|
||||
entry.Flags |= 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.patchEntryHeader = true;
|
||||
}
|
||||
}
|
||||
if (base.Password != null)
|
||||
{
|
||||
entry.IsCrypted = true;
|
||||
if (entry.Crc < 0L)
|
||||
{
|
||||
entry.Flags |= 8;
|
||||
}
|
||||
}
|
||||
entry.Offset = this.offset;
|
||||
entry.CompressionMethod = compressionMethod;
|
||||
this.curMethod = compressionMethod;
|
||||
this.sizePatchPos = -1L;
|
||||
if (this.useZip64_ == UseZip64.On || (entry.Size < 0L && this.useZip64_ == UseZip64.Dynamic))
|
||||
{
|
||||
entry.ForceZip64();
|
||||
}
|
||||
this.WriteLeInt(67324752);
|
||||
this.WriteLeShort(entry.Version);
|
||||
this.WriteLeShort(entry.Flags);
|
||||
this.WriteLeShort((int)((byte)entry.CompressionMethodForHeader));
|
||||
this.WriteLeInt((int)entry.DosTime);
|
||||
if (flag)
|
||||
{
|
||||
this.WriteLeInt((int)entry.Crc);
|
||||
if (entry.LocalHeaderRequiresZip64)
|
||||
{
|
||||
this.WriteLeInt(-1);
|
||||
this.WriteLeInt(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLeInt(entry.IsCrypted ? ((int)entry.CompressedSize + 12) : ((int)entry.CompressedSize));
|
||||
this.WriteLeInt((int)entry.Size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.patchEntryHeader)
|
||||
{
|
||||
this.crcPatchPos = this.baseOutputStream_.Position;
|
||||
}
|
||||
this.WriteLeInt(0);
|
||||
if (this.patchEntryHeader)
|
||||
{
|
||||
this.sizePatchPos = this.baseOutputStream_.Position;
|
||||
}
|
||||
if (entry.LocalHeaderRequiresZip64 || this.patchEntryHeader)
|
||||
{
|
||||
this.WriteLeInt(-1);
|
||||
this.WriteLeInt(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLeInt(0);
|
||||
this.WriteLeInt(0);
|
||||
}
|
||||
}
|
||||
byte[] array = ZipConstants.ConvertToArray(entry.Flags, entry.Name);
|
||||
if (array.Length > 65535)
|
||||
{
|
||||
throw new ZipException("Entry name too long.");
|
||||
}
|
||||
ZipExtraData zipExtraData = new ZipExtraData(entry.ExtraData);
|
||||
if (entry.LocalHeaderRequiresZip64)
|
||||
{
|
||||
zipExtraData.StartNewEntry();
|
||||
if (flag)
|
||||
{
|
||||
zipExtraData.AddLeLong(entry.Size);
|
||||
zipExtraData.AddLeLong(entry.CompressedSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
zipExtraData.AddLeLong(-1L);
|
||||
zipExtraData.AddLeLong(-1L);
|
||||
}
|
||||
zipExtraData.AddNewEntry(1);
|
||||
if (!zipExtraData.Find(1))
|
||||
{
|
||||
throw new ZipException("Internal error cant find extra data");
|
||||
}
|
||||
if (this.patchEntryHeader)
|
||||
{
|
||||
this.sizePatchPos = (long)zipExtraData.CurrentReadIndex;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
zipExtraData.Delete(1);
|
||||
}
|
||||
if (entry.AESKeySize > 0)
|
||||
{
|
||||
ZipOutputStream.AddExtraDataAES(entry, zipExtraData);
|
||||
}
|
||||
byte[] entryData = zipExtraData.GetEntryData();
|
||||
this.WriteLeShort(array.Length);
|
||||
this.WriteLeShort(entryData.Length);
|
||||
if (array.Length > 0)
|
||||
{
|
||||
this.baseOutputStream_.Write(array, 0, array.Length);
|
||||
}
|
||||
if (entry.LocalHeaderRequiresZip64 && this.patchEntryHeader)
|
||||
{
|
||||
this.sizePatchPos += this.baseOutputStream_.Position;
|
||||
}
|
||||
if (entryData.Length > 0)
|
||||
{
|
||||
this.baseOutputStream_.Write(entryData, 0, entryData.Length);
|
||||
}
|
||||
this.offset += (long)(30 + array.Length + entryData.Length);
|
||||
if (entry.AESKeySize > 0)
|
||||
{
|
||||
this.offset += (long)entry.AESOverheadSize;
|
||||
}
|
||||
this.curEntry = entry;
|
||||
this.crc.Reset();
|
||||
if (compressionMethod == CompressionMethod.Deflated)
|
||||
{
|
||||
this.deflater_.Reset();
|
||||
this.deflater_.SetLevel(num);
|
||||
}
|
||||
this.size = 0L;
|
||||
if (entry.IsCrypted)
|
||||
{
|
||||
if (entry.AESKeySize > 0)
|
||||
{
|
||||
this.WriteAESHeader(entry);
|
||||
return;
|
||||
}
|
||||
if (entry.Crc < 0L)
|
||||
{
|
||||
this.WriteEncryptionHeader(entry.DosTime << 16);
|
||||
return;
|
||||
}
|
||||
this.WriteEncryptionHeader(entry.Crc);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060004F9 RID: 1273 RVA: 0x000187A0 File Offset: 0x000177A0
|
||||
public void CloseEntry()
|
||||
{
|
||||
if (this.curEntry == null)
|
||||
{
|
||||
throw new InvalidOperationException("No open entry");
|
||||
}
|
||||
long totalOut = this.size;
|
||||
if (this.curMethod == CompressionMethod.Deflated)
|
||||
{
|
||||
if (this.size >= 0L)
|
||||
{
|
||||
base.Finish();
|
||||
totalOut = this.deflater_.TotalOut;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.deflater_.Reset();
|
||||
}
|
||||
}
|
||||
if (this.curEntry.AESKeySize > 0)
|
||||
{
|
||||
this.baseOutputStream_.Write(this.AESAuthCode, 0, 10);
|
||||
}
|
||||
if (this.curEntry.Size < 0L)
|
||||
{
|
||||
this.curEntry.Size = this.size;
|
||||
}
|
||||
else if (this.curEntry.Size != this.size)
|
||||
{
|
||||
throw new ZipException(string.Concat(new object[]
|
||||
{
|
||||
"size was ",
|
||||
this.size,
|
||||
", but I expected ",
|
||||
this.curEntry.Size
|
||||
}));
|
||||
}
|
||||
if (this.curEntry.CompressedSize < 0L)
|
||||
{
|
||||
this.curEntry.CompressedSize = totalOut;
|
||||
}
|
||||
else if (this.curEntry.CompressedSize != totalOut)
|
||||
{
|
||||
throw new ZipException(string.Concat(new object[]
|
||||
{
|
||||
"compressed size was ",
|
||||
totalOut,
|
||||
", but I expected ",
|
||||
this.curEntry.CompressedSize
|
||||
}));
|
||||
}
|
||||
if (this.curEntry.Crc < 0L)
|
||||
{
|
||||
this.curEntry.Crc = this.crc.Value;
|
||||
}
|
||||
else if (this.curEntry.Crc != this.crc.Value)
|
||||
{
|
||||
throw new ZipException(string.Concat(new object[]
|
||||
{
|
||||
"crc was ",
|
||||
this.crc.Value,
|
||||
", but I expected ",
|
||||
this.curEntry.Crc
|
||||
}));
|
||||
}
|
||||
this.offset += totalOut;
|
||||
if (this.curEntry.IsCrypted)
|
||||
{
|
||||
if (this.curEntry.AESKeySize > 0)
|
||||
{
|
||||
this.curEntry.CompressedSize += (long)this.curEntry.AESOverheadSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.curEntry.CompressedSize += 12L;
|
||||
}
|
||||
}
|
||||
if (this.patchEntryHeader)
|
||||
{
|
||||
this.patchEntryHeader = false;
|
||||
long position = this.baseOutputStream_.Position;
|
||||
this.baseOutputStream_.Seek(this.crcPatchPos, SeekOrigin.Begin);
|
||||
this.WriteLeInt((int)this.curEntry.Crc);
|
||||
if (this.curEntry.LocalHeaderRequiresZip64)
|
||||
{
|
||||
if (this.sizePatchPos == -1L)
|
||||
{
|
||||
throw new ZipException("Entry requires zip64 but this has been turned off");
|
||||
}
|
||||
this.baseOutputStream_.Seek(this.sizePatchPos, SeekOrigin.Begin);
|
||||
this.WriteLeLong(this.curEntry.Size);
|
||||
this.WriteLeLong(this.curEntry.CompressedSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLeInt((int)this.curEntry.CompressedSize);
|
||||
this.WriteLeInt((int)this.curEntry.Size);
|
||||
}
|
||||
this.baseOutputStream_.Seek(position, SeekOrigin.Begin);
|
||||
}
|
||||
if ((this.curEntry.Flags & 8) != 0)
|
||||
{
|
||||
this.WriteLeInt(134695760);
|
||||
this.WriteLeInt((int)this.curEntry.Crc);
|
||||
if (this.curEntry.LocalHeaderRequiresZip64)
|
||||
{
|
||||
this.WriteLeLong(this.curEntry.CompressedSize);
|
||||
this.WriteLeLong(this.curEntry.Size);
|
||||
this.offset += 24L;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLeInt((int)this.curEntry.CompressedSize);
|
||||
this.WriteLeInt((int)this.curEntry.Size);
|
||||
this.offset += 16L;
|
||||
}
|
||||
}
|
||||
this.entries.Add(this.curEntry);
|
||||
this.curEntry = null;
|
||||
}
|
||||
|
||||
// Token: 0x060004FA RID: 1274 RVA: 0x00018B78 File Offset: 0x00017B78
|
||||
private void WriteEncryptionHeader(long crcValue)
|
||||
{
|
||||
this.offset += 12L;
|
||||
base.InitializePassword(base.Password);
|
||||
byte[] array = new byte[12];
|
||||
Random random = new Random();
|
||||
random.NextBytes(array);
|
||||
array[11] = (byte)(crcValue >> 24);
|
||||
base.EncryptBlock(array, 0, array.Length);
|
||||
this.baseOutputStream_.Write(array, 0, array.Length);
|
||||
}
|
||||
|
||||
// Token: 0x060004FB RID: 1275 RVA: 0x00018BDA File Offset: 0x00017BDA
|
||||
private static void AddExtraDataAES(ZipEntry entry, ZipExtraData extraData)
|
||||
{
|
||||
extraData.StartNewEntry();
|
||||
extraData.AddLeShort(2);
|
||||
extraData.AddLeShort(17729);
|
||||
extraData.AddData(entry.AESEncryptionStrength);
|
||||
extraData.AddLeShort((int)entry.CompressionMethod);
|
||||
extraData.AddNewEntry(39169);
|
||||
}
|
||||
|
||||
// Token: 0x060004FC RID: 1276 RVA: 0x00018C18 File Offset: 0x00017C18
|
||||
private void WriteAESHeader(ZipEntry entry)
|
||||
{
|
||||
byte[] array;
|
||||
byte[] array2;
|
||||
base.InitializeAESPassword(entry, base.Password, out array, out array2);
|
||||
this.baseOutputStream_.Write(array, 0, array.Length);
|
||||
this.baseOutputStream_.Write(array2, 0, array2.Length);
|
||||
}
|
||||
|
||||
// Token: 0x060004FD RID: 1277 RVA: 0x00018C58 File Offset: 0x00017C58
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (this.curEntry == null)
|
||||
{
|
||||
throw new InvalidOperationException("No open entry.");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "Cannot be negative");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "Cannot be negative");
|
||||
}
|
||||
if (buffer.Length - offset < count)
|
||||
{
|
||||
throw new ArgumentException("Invalid offset/count combination");
|
||||
}
|
||||
this.crc.Update(buffer, offset, count);
|
||||
this.size += (long)count;
|
||||
CompressionMethod compressionMethod = this.curMethod;
|
||||
if (compressionMethod != CompressionMethod.Stored)
|
||||
{
|
||||
if (compressionMethod != CompressionMethod.Deflated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
base.Write(buffer, offset, count);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (base.Password != null)
|
||||
{
|
||||
this.CopyAndEncrypt(buffer, offset, count);
|
||||
return;
|
||||
}
|
||||
this.baseOutputStream_.Write(buffer, offset, count);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060004FE RID: 1278 RVA: 0x00018D18 File Offset: 0x00017D18
|
||||
private void CopyAndEncrypt(byte[] buffer, int offset, int count)
|
||||
{
|
||||
byte[] array = new byte[4096];
|
||||
while (count > 0)
|
||||
{
|
||||
int num = ((count < 4096) ? count : 4096);
|
||||
Array.Copy(buffer, offset, array, 0, num);
|
||||
base.EncryptBlock(array, 0, num);
|
||||
this.baseOutputStream_.Write(array, 0, num);
|
||||
count -= num;
|
||||
offset += num;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060004FF RID: 1279 RVA: 0x00018D74 File Offset: 0x00017D74
|
||||
public override void Finish()
|
||||
{
|
||||
if (this.entries == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.curEntry != null)
|
||||
{
|
||||
this.CloseEntry();
|
||||
}
|
||||
long num = (long)this.entries.Count;
|
||||
long num2 = 0L;
|
||||
foreach (object obj in this.entries)
|
||||
{
|
||||
ZipEntry zipEntry = (ZipEntry)obj;
|
||||
this.WriteLeInt(33639248);
|
||||
this.WriteLeShort(51);
|
||||
this.WriteLeShort(zipEntry.Version);
|
||||
this.WriteLeShort(zipEntry.Flags);
|
||||
this.WriteLeShort((int)((short)zipEntry.CompressionMethodForHeader));
|
||||
this.WriteLeInt((int)zipEntry.DosTime);
|
||||
this.WriteLeInt((int)zipEntry.Crc);
|
||||
if (zipEntry.IsZip64Forced() || zipEntry.CompressedSize >= (long)((ulong)(-1)))
|
||||
{
|
||||
this.WriteLeInt(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLeInt((int)zipEntry.CompressedSize);
|
||||
}
|
||||
if (zipEntry.IsZip64Forced() || zipEntry.Size >= (long)((ulong)(-1)))
|
||||
{
|
||||
this.WriteLeInt(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLeInt((int)zipEntry.Size);
|
||||
}
|
||||
byte[] array = ZipConstants.ConvertToArray(zipEntry.Flags, zipEntry.Name);
|
||||
if (array.Length > 65535)
|
||||
{
|
||||
throw new ZipException("Name too long.");
|
||||
}
|
||||
ZipExtraData zipExtraData = new ZipExtraData(zipEntry.ExtraData);
|
||||
if (zipEntry.CentralHeaderRequiresZip64)
|
||||
{
|
||||
zipExtraData.StartNewEntry();
|
||||
if (zipEntry.IsZip64Forced() || zipEntry.Size >= (long)((ulong)(-1)))
|
||||
{
|
||||
zipExtraData.AddLeLong(zipEntry.Size);
|
||||
}
|
||||
if (zipEntry.IsZip64Forced() || zipEntry.CompressedSize >= (long)((ulong)(-1)))
|
||||
{
|
||||
zipExtraData.AddLeLong(zipEntry.CompressedSize);
|
||||
}
|
||||
if (zipEntry.Offset >= (long)((ulong)(-1)))
|
||||
{
|
||||
zipExtraData.AddLeLong(zipEntry.Offset);
|
||||
}
|
||||
zipExtraData.AddNewEntry(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
zipExtraData.Delete(1);
|
||||
}
|
||||
if (zipEntry.AESKeySize > 0)
|
||||
{
|
||||
ZipOutputStream.AddExtraDataAES(zipEntry, zipExtraData);
|
||||
}
|
||||
byte[] entryData = zipExtraData.GetEntryData();
|
||||
byte[] array2 = ((zipEntry.Comment != null) ? ZipConstants.ConvertToArray(zipEntry.Flags, zipEntry.Comment) : new byte[0]);
|
||||
if (array2.Length > 65535)
|
||||
{
|
||||
throw new ZipException("Comment too long.");
|
||||
}
|
||||
this.WriteLeShort(array.Length);
|
||||
this.WriteLeShort(entryData.Length);
|
||||
this.WriteLeShort(array2.Length);
|
||||
this.WriteLeShort(0);
|
||||
this.WriteLeShort(0);
|
||||
if (zipEntry.ExternalFileAttributes != -1)
|
||||
{
|
||||
this.WriteLeInt(zipEntry.ExternalFileAttributes);
|
||||
}
|
||||
else if (zipEntry.IsDirectory)
|
||||
{
|
||||
this.WriteLeInt(16);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLeInt(0);
|
||||
}
|
||||
if (zipEntry.Offset >= (long)((ulong)(-1)))
|
||||
{
|
||||
this.WriteLeInt(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WriteLeInt((int)zipEntry.Offset);
|
||||
}
|
||||
if (array.Length > 0)
|
||||
{
|
||||
this.baseOutputStream_.Write(array, 0, array.Length);
|
||||
}
|
||||
if (entryData.Length > 0)
|
||||
{
|
||||
this.baseOutputStream_.Write(entryData, 0, entryData.Length);
|
||||
}
|
||||
if (array2.Length > 0)
|
||||
{
|
||||
this.baseOutputStream_.Write(array2, 0, array2.Length);
|
||||
}
|
||||
num2 += (long)(46 + array.Length + entryData.Length + array2.Length);
|
||||
}
|
||||
using (ZipHelperStream zipHelperStream = new ZipHelperStream(this.baseOutputStream_))
|
||||
{
|
||||
zipHelperStream.WriteEndOfCentralDirectory(num, num2, this.offset, this.zipComment);
|
||||
}
|
||||
this.entries = null;
|
||||
}
|
||||
|
||||
// Token: 0x04000320 RID: 800
|
||||
private ArrayList entries = new ArrayList();
|
||||
|
||||
// Token: 0x04000321 RID: 801
|
||||
private Crc32 crc = new Crc32();
|
||||
|
||||
// Token: 0x04000322 RID: 802
|
||||
private ZipEntry curEntry;
|
||||
|
||||
// Token: 0x04000323 RID: 803
|
||||
private int defaultCompressionLevel = -1;
|
||||
|
||||
// Token: 0x04000324 RID: 804
|
||||
private CompressionMethod curMethod = CompressionMethod.Deflated;
|
||||
|
||||
// Token: 0x04000325 RID: 805
|
||||
private long size;
|
||||
|
||||
// Token: 0x04000326 RID: 806
|
||||
private long offset;
|
||||
|
||||
// Token: 0x04000327 RID: 807
|
||||
private byte[] zipComment = new byte[0];
|
||||
|
||||
// Token: 0x04000328 RID: 808
|
||||
private bool patchEntryHeader;
|
||||
|
||||
// Token: 0x04000329 RID: 809
|
||||
private long crcPatchPos = -1L;
|
||||
|
||||
// Token: 0x0400032A RID: 810
|
||||
private long sizePatchPos = -1L;
|
||||
|
||||
// Token: 0x0400032B RID: 811
|
||||
private UseZip64 useZip64_ = UseZip64.Dynamic;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Zip
|
||||
{
|
||||
// Token: 0x02000066 RID: 102
|
||||
// (Invoke) Token: 0x060003D6 RID: 982
|
||||
public delegate void ZipTestResultHandler(TestStatus status, string message);
|
||||
}
|
||||
Reference in New Issue
Block a user