scripts
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using ICSharpCode.SharpZipLib.Core;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.BZip2
|
||||
{
|
||||
// Token: 0x02000002 RID: 2
|
||||
public static class BZip2
|
||||
{
|
||||
// Token: 0x06000001 RID: 1 RVA: 0x000020D0 File Offset: 0x000010D0
|
||||
public static void Decompress(Stream inStream, Stream outStream, bool isStreamOwner)
|
||||
{
|
||||
if (inStream == null || outStream == null)
|
||||
{
|
||||
throw new Exception("Null Stream");
|
||||
}
|
||||
try
|
||||
{
|
||||
using (BZip2InputStream bzip2InputStream = new BZip2InputStream(inStream))
|
||||
{
|
||||
bzip2InputStream.IsStreamOwner = isStreamOwner;
|
||||
StreamUtils.Copy(bzip2InputStream, outStream, new byte[4096]);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (isStreamOwner)
|
||||
{
|
||||
outStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000002 RID: 2 RVA: 0x00002144 File Offset: 0x00001144
|
||||
public static void Compress(Stream inStream, Stream outStream, bool isStreamOwner, int level)
|
||||
{
|
||||
if (inStream == null || outStream == null)
|
||||
{
|
||||
throw new Exception("Null Stream");
|
||||
}
|
||||
try
|
||||
{
|
||||
using (BZip2OutputStream bzip2OutputStream = new BZip2OutputStream(outStream, level))
|
||||
{
|
||||
bzip2OutputStream.IsStreamOwner = isStreamOwner;
|
||||
StreamUtils.Copy(inStream, bzip2OutputStream, new byte[4096]);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (isStreamOwner)
|
||||
{
|
||||
inStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.BZip2
|
||||
{
|
||||
// Token: 0x02000003 RID: 3
|
||||
internal sealed class BZip2Constants
|
||||
{
|
||||
// Token: 0x06000003 RID: 3 RVA: 0x000021B8 File Offset: 0x000011B8
|
||||
private BZip2Constants()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x04000001 RID: 1
|
||||
public const int BaseBlockSize = 100000;
|
||||
|
||||
// Token: 0x04000002 RID: 2
|
||||
public const int MaximumAlphaSize = 258;
|
||||
|
||||
// Token: 0x04000003 RID: 3
|
||||
public const int MaximumCodeLength = 23;
|
||||
|
||||
// Token: 0x04000004 RID: 4
|
||||
public const int RunA = 0;
|
||||
|
||||
// Token: 0x04000005 RID: 5
|
||||
public const int RunB = 1;
|
||||
|
||||
// Token: 0x04000006 RID: 6
|
||||
public const int GroupCount = 6;
|
||||
|
||||
// Token: 0x04000007 RID: 7
|
||||
public const int GroupSize = 50;
|
||||
|
||||
// Token: 0x04000008 RID: 8
|
||||
public const int NumberOfIterations = 4;
|
||||
|
||||
// Token: 0x04000009 RID: 9
|
||||
public const int MaximumSelectors = 18002;
|
||||
|
||||
// Token: 0x0400000A RID: 10
|
||||
public const int OvershootBytes = 20;
|
||||
|
||||
// Token: 0x0400000B RID: 11
|
||||
public static readonly int[] RandomNumbers = new int[]
|
||||
{
|
||||
619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
|
||||
985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
|
||||
733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
|
||||
419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
|
||||
878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
|
||||
862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
|
||||
150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
|
||||
170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
|
||||
73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
|
||||
909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
|
||||
641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
|
||||
161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
|
||||
382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
|
||||
98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
|
||||
227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
|
||||
469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
|
||||
184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
|
||||
715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
|
||||
951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
|
||||
652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
|
||||
645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
|
||||
609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
|
||||
653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
|
||||
411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
|
||||
170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
|
||||
857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
|
||||
669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
|
||||
944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
|
||||
344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
|
||||
897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
|
||||
433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
|
||||
686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
|
||||
946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
|
||||
978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
|
||||
680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
|
||||
707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
|
||||
297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
|
||||
134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
|
||||
343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
|
||||
140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
|
||||
170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
|
||||
369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
|
||||
804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
|
||||
896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
|
||||
661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
|
||||
768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
|
||||
61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
|
||||
372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
|
||||
780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
|
||||
920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
|
||||
645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
|
||||
936, 638
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.BZip2
|
||||
{
|
||||
// Token: 0x02000005 RID: 5
|
||||
[Serializable]
|
||||
public class BZip2Exception : SharpZipBaseException
|
||||
{
|
||||
// Token: 0x06000009 RID: 9 RVA: 0x00002A01 File Offset: 0x00001A01
|
||||
protected BZip2Exception(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600000A RID: 10 RVA: 0x00002A0B File Offset: 0x00001A0B
|
||||
public BZip2Exception()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600000B RID: 11 RVA: 0x00002A13 File Offset: 0x00001A13
|
||||
public BZip2Exception(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600000C RID: 12 RVA: 0x00002A1C File Offset: 0x00001A1C
|
||||
public BZip2Exception(string message, Exception exception)
|
||||
: base(message, exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,945 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using ICSharpCode.SharpZipLib.Checksums;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.BZip2
|
||||
{
|
||||
// Token: 0x02000006 RID: 6
|
||||
public class BZip2InputStream : Stream
|
||||
{
|
||||
// Token: 0x0600000D RID: 13 RVA: 0x00002A28 File Offset: 0x00001A28
|
||||
public BZip2InputStream(Stream stream)
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
this.limit[i] = new int[258];
|
||||
this.baseArray[i] = new int[258];
|
||||
this.perm[i] = new int[258];
|
||||
}
|
||||
this.BsSetStream(stream);
|
||||
this.Initialize();
|
||||
this.InitBlock();
|
||||
this.SetupBlock();
|
||||
}
|
||||
|
||||
// Token: 0x17000001 RID: 1
|
||||
// (get) Token: 0x0600000E RID: 14 RVA: 0x00002B46 File Offset: 0x00001B46
|
||||
// (set) Token: 0x0600000F RID: 15 RVA: 0x00002B4E File Offset: 0x00001B4E
|
||||
public bool IsStreamOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isStreamOwner;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.isStreamOwner = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000002 RID: 2
|
||||
// (get) Token: 0x06000010 RID: 16 RVA: 0x00002B57 File Offset: 0x00001B57
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseStream.CanRead;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000003 RID: 3
|
||||
// (get) Token: 0x06000011 RID: 17 RVA: 0x00002B64 File Offset: 0x00001B64
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseStream.CanSeek;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000004 RID: 4
|
||||
// (get) Token: 0x06000012 RID: 18 RVA: 0x00002B71 File Offset: 0x00001B71
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000005 RID: 5
|
||||
// (get) Token: 0x06000013 RID: 19 RVA: 0x00002B74 File Offset: 0x00001B74
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseStream.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000006 RID: 6
|
||||
// (get) Token: 0x06000014 RID: 20 RVA: 0x00002B81 File Offset: 0x00001B81
|
||||
// (set) Token: 0x06000015 RID: 21 RVA: 0x00002B8E File Offset: 0x00001B8E
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseStream.Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotSupportedException("BZip2InputStream position cannot be set");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000016 RID: 22 RVA: 0x00002B9A File Offset: 0x00001B9A
|
||||
public override void Flush()
|
||||
{
|
||||
if (this.baseStream != null)
|
||||
{
|
||||
this.baseStream.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000017 RID: 23 RVA: 0x00002BAF File Offset: 0x00001BAF
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotSupportedException("BZip2InputStream Seek not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000018 RID: 24 RVA: 0x00002BBB File Offset: 0x00001BBB
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException("BZip2InputStream SetLength not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000019 RID: 25 RVA: 0x00002BC7 File Offset: 0x00001BC7
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException("BZip2InputStream Write not supported");
|
||||
}
|
||||
|
||||
// Token: 0x0600001A RID: 26 RVA: 0x00002BD3 File Offset: 0x00001BD3
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
throw new NotSupportedException("BZip2InputStream WriteByte not supported");
|
||||
}
|
||||
|
||||
// Token: 0x0600001B RID: 27 RVA: 0x00002BE0 File Offset: 0x00001BE0
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
int num = this.ReadByte();
|
||||
if (num == -1)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
buffer[offset + i] = (byte)num;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// Token: 0x0600001C RID: 28 RVA: 0x00002C1C File Offset: 0x00001C1C
|
||||
public override void Close()
|
||||
{
|
||||
if (this.IsStreamOwner && this.baseStream != null)
|
||||
{
|
||||
this.baseStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600001D RID: 29 RVA: 0x00002C3C File Offset: 0x00001C3C
|
||||
public override int ReadByte()
|
||||
{
|
||||
if (this.streamEnd)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int num = this.currentChar;
|
||||
switch (this.currentState)
|
||||
{
|
||||
case 3:
|
||||
this.SetupRandPartB();
|
||||
break;
|
||||
case 4:
|
||||
this.SetupRandPartC();
|
||||
break;
|
||||
case 6:
|
||||
this.SetupNoRandPartB();
|
||||
break;
|
||||
case 7:
|
||||
this.SetupNoRandPartC();
|
||||
break;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x0600001E RID: 30 RVA: 0x00002CA8 File Offset: 0x00001CA8
|
||||
private void MakeMaps()
|
||||
{
|
||||
this.nInUse = 0;
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
if (this.inUse[i])
|
||||
{
|
||||
this.seqToUnseq[this.nInUse] = (byte)i;
|
||||
this.unseqToSeq[i] = (byte)this.nInUse;
|
||||
this.nInUse++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600001F RID: 31 RVA: 0x00002D04 File Offset: 0x00001D04
|
||||
private void Initialize()
|
||||
{
|
||||
char c = this.BsGetUChar();
|
||||
char c2 = this.BsGetUChar();
|
||||
char c3 = this.BsGetUChar();
|
||||
char c4 = this.BsGetUChar();
|
||||
if (c != 'B' || c2 != 'Z' || c3 != 'h' || c4 < '1' || c4 > '9')
|
||||
{
|
||||
this.streamEnd = true;
|
||||
return;
|
||||
}
|
||||
this.SetDecompressStructureSizes((int)(c4 - '0'));
|
||||
this.computedCombinedCRC = 0U;
|
||||
}
|
||||
|
||||
// Token: 0x06000020 RID: 32 RVA: 0x00002D60 File Offset: 0x00001D60
|
||||
private void InitBlock()
|
||||
{
|
||||
char c = this.BsGetUChar();
|
||||
char c2 = this.BsGetUChar();
|
||||
char c3 = this.BsGetUChar();
|
||||
char c4 = this.BsGetUChar();
|
||||
char c5 = this.BsGetUChar();
|
||||
char c6 = this.BsGetUChar();
|
||||
if (c == '\u0017' && c2 == 'r' && c3 == 'E' && c4 == '8' && c5 == 'P' && c6 == '\u0090')
|
||||
{
|
||||
this.Complete();
|
||||
return;
|
||||
}
|
||||
if (c != '1' || c2 != 'A' || c3 != 'Y' || c4 != '&' || c5 != 'S' || c6 != 'Y')
|
||||
{
|
||||
BZip2InputStream.BadBlockHeader();
|
||||
this.streamEnd = true;
|
||||
return;
|
||||
}
|
||||
this.storedBlockCRC = this.BsGetInt32();
|
||||
this.blockRandomised = this.BsR(1) == 1;
|
||||
this.GetAndMoveToFrontDecode();
|
||||
this.mCrc.Reset();
|
||||
this.currentState = 1;
|
||||
}
|
||||
|
||||
// Token: 0x06000021 RID: 33 RVA: 0x00002E24 File Offset: 0x00001E24
|
||||
private void EndBlock()
|
||||
{
|
||||
this.computedBlockCRC = (int)this.mCrc.Value;
|
||||
if (this.storedBlockCRC != this.computedBlockCRC)
|
||||
{
|
||||
BZip2InputStream.CrcError();
|
||||
}
|
||||
this.computedCombinedCRC = ((this.computedCombinedCRC << 1) & uint.MaxValue) | (this.computedCombinedCRC >> 31);
|
||||
this.computedCombinedCRC ^= (uint)this.computedBlockCRC;
|
||||
}
|
||||
|
||||
// Token: 0x06000022 RID: 34 RVA: 0x00002E83 File Offset: 0x00001E83
|
||||
private void Complete()
|
||||
{
|
||||
this.storedCombinedCRC = this.BsGetInt32();
|
||||
if (this.storedCombinedCRC != (int)this.computedCombinedCRC)
|
||||
{
|
||||
BZip2InputStream.CrcError();
|
||||
}
|
||||
this.streamEnd = true;
|
||||
}
|
||||
|
||||
// Token: 0x06000023 RID: 35 RVA: 0x00002EAB File Offset: 0x00001EAB
|
||||
private void BsSetStream(Stream stream)
|
||||
{
|
||||
this.baseStream = stream;
|
||||
this.bsLive = 0;
|
||||
this.bsBuff = 0;
|
||||
}
|
||||
|
||||
// Token: 0x06000024 RID: 36 RVA: 0x00002EC4 File Offset: 0x00001EC4
|
||||
private void FillBuffer()
|
||||
{
|
||||
int num = 0;
|
||||
try
|
||||
{
|
||||
num = this.baseStream.ReadByte();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
BZip2InputStream.CompressedStreamEOF();
|
||||
}
|
||||
if (num == -1)
|
||||
{
|
||||
BZip2InputStream.CompressedStreamEOF();
|
||||
}
|
||||
this.bsBuff = (this.bsBuff << 8) | (num & 255);
|
||||
this.bsLive += 8;
|
||||
}
|
||||
|
||||
// Token: 0x06000025 RID: 37 RVA: 0x00002F28 File Offset: 0x00001F28
|
||||
private int BsR(int n)
|
||||
{
|
||||
while (this.bsLive < n)
|
||||
{
|
||||
this.FillBuffer();
|
||||
}
|
||||
int num = (this.bsBuff >> this.bsLive - n) & ((1 << n) - 1);
|
||||
this.bsLive -= n;
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000026 RID: 38 RVA: 0x00002F71 File Offset: 0x00001F71
|
||||
private char BsGetUChar()
|
||||
{
|
||||
return (char)this.BsR(8);
|
||||
}
|
||||
|
||||
// Token: 0x06000027 RID: 39 RVA: 0x00002F7B File Offset: 0x00001F7B
|
||||
private int BsGetIntVS(int numBits)
|
||||
{
|
||||
return this.BsR(numBits);
|
||||
}
|
||||
|
||||
// Token: 0x06000028 RID: 40 RVA: 0x00002F84 File Offset: 0x00001F84
|
||||
private int BsGetInt32()
|
||||
{
|
||||
int num = this.BsR(8);
|
||||
num = (num << 8) | this.BsR(8);
|
||||
num = (num << 8) | this.BsR(8);
|
||||
return (num << 8) | this.BsR(8);
|
||||
}
|
||||
|
||||
// Token: 0x06000029 RID: 41 RVA: 0x00002FC0 File Offset: 0x00001FC0
|
||||
private void RecvDecodingTables()
|
||||
{
|
||||
char[][] array = new char[6][];
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
array[i] = new char[258];
|
||||
}
|
||||
bool[] array2 = new bool[16];
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
array2[j] = this.BsR(1) == 1;
|
||||
}
|
||||
for (int k = 0; k < 16; k++)
|
||||
{
|
||||
if (array2[k])
|
||||
{
|
||||
for (int l = 0; l < 16; l++)
|
||||
{
|
||||
this.inUse[k * 16 + l] = this.BsR(1) == 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int m = 0; m < 16; m++)
|
||||
{
|
||||
this.inUse[k * 16 + m] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.MakeMaps();
|
||||
int num = this.nInUse + 2;
|
||||
int num2 = this.BsR(3);
|
||||
int num3 = this.BsR(15);
|
||||
for (int n = 0; n < num3; n++)
|
||||
{
|
||||
int num4 = 0;
|
||||
while (this.BsR(1) == 1)
|
||||
{
|
||||
num4++;
|
||||
}
|
||||
this.selectorMtf[n] = (byte)num4;
|
||||
}
|
||||
byte[] array3 = new byte[6];
|
||||
for (int num5 = 0; num5 < num2; num5++)
|
||||
{
|
||||
array3[num5] = (byte)num5;
|
||||
}
|
||||
for (int num6 = 0; num6 < num3; num6++)
|
||||
{
|
||||
int num7 = (int)this.selectorMtf[num6];
|
||||
byte b = array3[num7];
|
||||
while (num7 > 0)
|
||||
{
|
||||
array3[num7] = array3[num7 - 1];
|
||||
num7--;
|
||||
}
|
||||
array3[0] = b;
|
||||
this.selector[num6] = b;
|
||||
}
|
||||
for (int num8 = 0; num8 < num2; num8++)
|
||||
{
|
||||
int num9 = this.BsR(5);
|
||||
for (int num10 = 0; num10 < num; num10++)
|
||||
{
|
||||
while (this.BsR(1) == 1)
|
||||
{
|
||||
if (this.BsR(1) == 0)
|
||||
{
|
||||
num9++;
|
||||
}
|
||||
else
|
||||
{
|
||||
num9--;
|
||||
}
|
||||
}
|
||||
array[num8][num10] = (char)num9;
|
||||
}
|
||||
}
|
||||
for (int num11 = 0; num11 < num2; num11++)
|
||||
{
|
||||
int num12 = 32;
|
||||
int num13 = 0;
|
||||
for (int num14 = 0; num14 < num; num14++)
|
||||
{
|
||||
num13 = Math.Max(num13, (int)array[num11][num14]);
|
||||
num12 = Math.Min(num12, (int)array[num11][num14]);
|
||||
}
|
||||
BZip2InputStream.HbCreateDecodeTables(this.limit[num11], this.baseArray[num11], this.perm[num11], array[num11], num12, num13, num);
|
||||
this.minLens[num11] = num12;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600002A RID: 42 RVA: 0x0000320C File Offset: 0x0000220C
|
||||
private void GetAndMoveToFrontDecode()
|
||||
{
|
||||
byte[] array = new byte[256];
|
||||
int num = 100000 * this.blockSize100k;
|
||||
this.origPtr = this.BsGetIntVS(24);
|
||||
this.RecvDecodingTables();
|
||||
int num2 = this.nInUse + 1;
|
||||
int num3 = -1;
|
||||
int num4 = 0;
|
||||
for (int i = 0; i <= 255; i++)
|
||||
{
|
||||
this.unzftab[i] = 0;
|
||||
}
|
||||
for (int j = 0; j <= 255; j++)
|
||||
{
|
||||
array[j] = (byte)j;
|
||||
}
|
||||
this.last = -1;
|
||||
if (num4 == 0)
|
||||
{
|
||||
num3++;
|
||||
num4 = 50;
|
||||
}
|
||||
num4--;
|
||||
int num5 = (int)this.selector[num3];
|
||||
int num6 = this.minLens[num5];
|
||||
int k;
|
||||
int num7;
|
||||
for (k = this.BsR(num6); k > this.limit[num5][num6]; k = (k << 1) | num7)
|
||||
{
|
||||
if (num6 > 20)
|
||||
{
|
||||
throw new BZip2Exception("Bzip data error");
|
||||
}
|
||||
num6++;
|
||||
while (this.bsLive < 1)
|
||||
{
|
||||
this.FillBuffer();
|
||||
}
|
||||
num7 = (this.bsBuff >> this.bsLive - 1) & 1;
|
||||
this.bsLive--;
|
||||
}
|
||||
if (k - this.baseArray[num5][num6] < 0 || k - this.baseArray[num5][num6] >= 258)
|
||||
{
|
||||
throw new BZip2Exception("Bzip data error");
|
||||
}
|
||||
int num8 = this.perm[num5][k - this.baseArray[num5][num6]];
|
||||
while (num8 != num2)
|
||||
{
|
||||
if (num8 == 0 || num8 == 1)
|
||||
{
|
||||
int l = -1;
|
||||
int num9 = 1;
|
||||
do
|
||||
{
|
||||
if (num8 == 0)
|
||||
{
|
||||
l += num9;
|
||||
}
|
||||
else if (num8 == 1)
|
||||
{
|
||||
l += 2 * num9;
|
||||
}
|
||||
num9 <<= 1;
|
||||
if (num4 == 0)
|
||||
{
|
||||
num3++;
|
||||
num4 = 50;
|
||||
}
|
||||
num4--;
|
||||
num5 = (int)this.selector[num3];
|
||||
num6 = this.minLens[num5];
|
||||
for (k = this.BsR(num6); k > this.limit[num5][num6]; k = (k << 1) | num7)
|
||||
{
|
||||
num6++;
|
||||
while (this.bsLive < 1)
|
||||
{
|
||||
this.FillBuffer();
|
||||
}
|
||||
num7 = (this.bsBuff >> this.bsLive - 1) & 1;
|
||||
this.bsLive--;
|
||||
}
|
||||
num8 = this.perm[num5][k - this.baseArray[num5][num6]];
|
||||
}
|
||||
while (num8 == 0 || num8 == 1);
|
||||
l++;
|
||||
byte b = this.seqToUnseq[(int)array[0]];
|
||||
this.unzftab[(int)b] += l;
|
||||
while (l > 0)
|
||||
{
|
||||
this.last++;
|
||||
this.ll8[this.last] = b;
|
||||
l--;
|
||||
}
|
||||
if (this.last >= num)
|
||||
{
|
||||
BZip2InputStream.BlockOverrun();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.last++;
|
||||
if (this.last >= num)
|
||||
{
|
||||
BZip2InputStream.BlockOverrun();
|
||||
}
|
||||
byte b2 = array[num8 - 1];
|
||||
this.unzftab[(int)this.seqToUnseq[(int)b2]]++;
|
||||
this.ll8[this.last] = this.seqToUnseq[(int)b2];
|
||||
for (int m = num8 - 1; m > 0; m--)
|
||||
{
|
||||
array[m] = array[m - 1];
|
||||
}
|
||||
array[0] = b2;
|
||||
if (num4 == 0)
|
||||
{
|
||||
num3++;
|
||||
num4 = 50;
|
||||
}
|
||||
num4--;
|
||||
num5 = (int)this.selector[num3];
|
||||
num6 = this.minLens[num5];
|
||||
for (k = this.BsR(num6); k > this.limit[num5][num6]; k = (k << 1) | num7)
|
||||
{
|
||||
num6++;
|
||||
while (this.bsLive < 1)
|
||||
{
|
||||
this.FillBuffer();
|
||||
}
|
||||
num7 = (this.bsBuff >> this.bsLive - 1) & 1;
|
||||
this.bsLive--;
|
||||
}
|
||||
num8 = this.perm[num5][k - this.baseArray[num5][num6]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600002B RID: 43 RVA: 0x000035F4 File Offset: 0x000025F4
|
||||
private void SetupBlock()
|
||||
{
|
||||
int[] array = new int[257];
|
||||
array[0] = 0;
|
||||
Array.Copy(this.unzftab, 0, array, 1, 256);
|
||||
for (int i = 1; i <= 256; i++)
|
||||
{
|
||||
array[i] += array[i - 1];
|
||||
}
|
||||
for (int j = 0; j <= this.last; j++)
|
||||
{
|
||||
byte b = this.ll8[j];
|
||||
this.tt[array[(int)b]] = j;
|
||||
array[(int)b]++;
|
||||
}
|
||||
this.tPos = this.tt[this.origPtr];
|
||||
this.count = 0;
|
||||
this.i2 = 0;
|
||||
this.ch2 = 256;
|
||||
if (this.blockRandomised)
|
||||
{
|
||||
this.rNToGo = 0;
|
||||
this.rTPos = 0;
|
||||
this.SetupRandPartA();
|
||||
return;
|
||||
}
|
||||
this.SetupNoRandPartA();
|
||||
}
|
||||
|
||||
// Token: 0x0600002C RID: 44 RVA: 0x000036D8 File Offset: 0x000026D8
|
||||
private void SetupRandPartA()
|
||||
{
|
||||
if (this.i2 <= this.last)
|
||||
{
|
||||
this.chPrev = this.ch2;
|
||||
this.ch2 = (int)this.ll8[this.tPos];
|
||||
this.tPos = this.tt[this.tPos];
|
||||
if (this.rNToGo == 0)
|
||||
{
|
||||
this.rNToGo = BZip2Constants.RandomNumbers[this.rTPos];
|
||||
this.rTPos++;
|
||||
if (this.rTPos == 512)
|
||||
{
|
||||
this.rTPos = 0;
|
||||
}
|
||||
}
|
||||
this.rNToGo--;
|
||||
this.ch2 ^= ((this.rNToGo == 1) ? 1 : 0);
|
||||
this.i2++;
|
||||
this.currentChar = this.ch2;
|
||||
this.currentState = 3;
|
||||
this.mCrc.Update(this.ch2);
|
||||
return;
|
||||
}
|
||||
this.EndBlock();
|
||||
this.InitBlock();
|
||||
this.SetupBlock();
|
||||
}
|
||||
|
||||
// Token: 0x0600002D RID: 45 RVA: 0x000037D4 File Offset: 0x000027D4
|
||||
private void SetupNoRandPartA()
|
||||
{
|
||||
if (this.i2 <= this.last)
|
||||
{
|
||||
this.chPrev = this.ch2;
|
||||
this.ch2 = (int)this.ll8[this.tPos];
|
||||
this.tPos = this.tt[this.tPos];
|
||||
this.i2++;
|
||||
this.currentChar = this.ch2;
|
||||
this.currentState = 6;
|
||||
this.mCrc.Update(this.ch2);
|
||||
return;
|
||||
}
|
||||
this.EndBlock();
|
||||
this.InitBlock();
|
||||
this.SetupBlock();
|
||||
}
|
||||
|
||||
// Token: 0x0600002E RID: 46 RVA: 0x00003868 File Offset: 0x00002868
|
||||
private void SetupRandPartB()
|
||||
{
|
||||
if (this.ch2 != this.chPrev)
|
||||
{
|
||||
this.currentState = 2;
|
||||
this.count = 1;
|
||||
this.SetupRandPartA();
|
||||
return;
|
||||
}
|
||||
this.count++;
|
||||
if (this.count >= 4)
|
||||
{
|
||||
this.z = this.ll8[this.tPos];
|
||||
this.tPos = this.tt[this.tPos];
|
||||
if (this.rNToGo == 0)
|
||||
{
|
||||
this.rNToGo = BZip2Constants.RandomNumbers[this.rTPos];
|
||||
this.rTPos++;
|
||||
if (this.rTPos == 512)
|
||||
{
|
||||
this.rTPos = 0;
|
||||
}
|
||||
}
|
||||
this.rNToGo--;
|
||||
this.z ^= ((this.rNToGo == 1) ? 1 : 0);
|
||||
this.j2 = 0;
|
||||
this.currentState = 4;
|
||||
this.SetupRandPartC();
|
||||
return;
|
||||
}
|
||||
this.currentState = 2;
|
||||
this.SetupRandPartA();
|
||||
}
|
||||
|
||||
// Token: 0x0600002F RID: 47 RVA: 0x00003960 File Offset: 0x00002960
|
||||
private void SetupRandPartC()
|
||||
{
|
||||
if (this.j2 < (int)this.z)
|
||||
{
|
||||
this.currentChar = this.ch2;
|
||||
this.mCrc.Update(this.ch2);
|
||||
this.j2++;
|
||||
return;
|
||||
}
|
||||
this.currentState = 2;
|
||||
this.i2++;
|
||||
this.count = 0;
|
||||
this.SetupRandPartA();
|
||||
}
|
||||
|
||||
// Token: 0x06000030 RID: 48 RVA: 0x000039CC File Offset: 0x000029CC
|
||||
private void SetupNoRandPartB()
|
||||
{
|
||||
if (this.ch2 != this.chPrev)
|
||||
{
|
||||
this.currentState = 5;
|
||||
this.count = 1;
|
||||
this.SetupNoRandPartA();
|
||||
return;
|
||||
}
|
||||
this.count++;
|
||||
if (this.count >= 4)
|
||||
{
|
||||
this.z = this.ll8[this.tPos];
|
||||
this.tPos = this.tt[this.tPos];
|
||||
this.currentState = 7;
|
||||
this.j2 = 0;
|
||||
this.SetupNoRandPartC();
|
||||
return;
|
||||
}
|
||||
this.currentState = 5;
|
||||
this.SetupNoRandPartA();
|
||||
}
|
||||
|
||||
// Token: 0x06000031 RID: 49 RVA: 0x00003A5C File Offset: 0x00002A5C
|
||||
private void SetupNoRandPartC()
|
||||
{
|
||||
if (this.j2 < (int)this.z)
|
||||
{
|
||||
this.currentChar = this.ch2;
|
||||
this.mCrc.Update(this.ch2);
|
||||
this.j2++;
|
||||
return;
|
||||
}
|
||||
this.currentState = 5;
|
||||
this.i2++;
|
||||
this.count = 0;
|
||||
this.SetupNoRandPartA();
|
||||
}
|
||||
|
||||
// Token: 0x06000032 RID: 50 RVA: 0x00003AC8 File Offset: 0x00002AC8
|
||||
private void SetDecompressStructureSizes(int newSize100k)
|
||||
{
|
||||
if (0 > newSize100k || newSize100k > 9 || 0 > this.blockSize100k || this.blockSize100k > 9)
|
||||
{
|
||||
throw new BZip2Exception("Invalid block size");
|
||||
}
|
||||
this.blockSize100k = newSize100k;
|
||||
if (newSize100k == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int num = 100000 * newSize100k;
|
||||
this.ll8 = new byte[num];
|
||||
this.tt = new int[num];
|
||||
}
|
||||
|
||||
// Token: 0x06000033 RID: 51 RVA: 0x00003B27 File Offset: 0x00002B27
|
||||
private static void CompressedStreamEOF()
|
||||
{
|
||||
throw new EndOfStreamException("BZip2 input stream end of compressed stream");
|
||||
}
|
||||
|
||||
// Token: 0x06000034 RID: 52 RVA: 0x00003B33 File Offset: 0x00002B33
|
||||
private static void BlockOverrun()
|
||||
{
|
||||
throw new BZip2Exception("BZip2 input stream block overrun");
|
||||
}
|
||||
|
||||
// Token: 0x06000035 RID: 53 RVA: 0x00003B3F File Offset: 0x00002B3F
|
||||
private static void BadBlockHeader()
|
||||
{
|
||||
throw new BZip2Exception("BZip2 input stream bad block header");
|
||||
}
|
||||
|
||||
// Token: 0x06000036 RID: 54 RVA: 0x00003B4B File Offset: 0x00002B4B
|
||||
private static void CrcError()
|
||||
{
|
||||
throw new BZip2Exception("BZip2 input stream crc error");
|
||||
}
|
||||
|
||||
// Token: 0x06000037 RID: 55 RVA: 0x00003B58 File Offset: 0x00002B58
|
||||
private static void HbCreateDecodeTables(int[] limit, int[] baseArray, int[] perm, char[] length, int minLen, int maxLen, int alphaSize)
|
||||
{
|
||||
int num = 0;
|
||||
for (int i = minLen; i <= maxLen; i++)
|
||||
{
|
||||
for (int j = 0; j < alphaSize; j++)
|
||||
{
|
||||
if ((int)length[j] == i)
|
||||
{
|
||||
perm[num] = j;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < 23; k++)
|
||||
{
|
||||
baseArray[k] = 0;
|
||||
}
|
||||
for (int l = 0; l < alphaSize; l++)
|
||||
{
|
||||
baseArray[(int)(length[l] + '\u0001')]++;
|
||||
}
|
||||
for (int m = 1; m < 23; m++)
|
||||
{
|
||||
baseArray[m] += baseArray[m - 1];
|
||||
}
|
||||
for (int n = 0; n < 23; n++)
|
||||
{
|
||||
limit[n] = 0;
|
||||
}
|
||||
int num2 = 0;
|
||||
for (int num3 = minLen; num3 <= maxLen; num3++)
|
||||
{
|
||||
num2 += baseArray[num3 + 1] - baseArray[num3];
|
||||
limit[num3] = num2 - 1;
|
||||
num2 <<= 1;
|
||||
}
|
||||
for (int num4 = minLen + 1; num4 <= maxLen; num4++)
|
||||
{
|
||||
baseArray[num4] = (limit[num4 - 1] + 1 << 1) - baseArray[num4];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400000C RID: 12
|
||||
private const int START_BLOCK_STATE = 1;
|
||||
|
||||
// Token: 0x0400000D RID: 13
|
||||
private const int RAND_PART_A_STATE = 2;
|
||||
|
||||
// Token: 0x0400000E RID: 14
|
||||
private const int RAND_PART_B_STATE = 3;
|
||||
|
||||
// Token: 0x0400000F RID: 15
|
||||
private const int RAND_PART_C_STATE = 4;
|
||||
|
||||
// Token: 0x04000010 RID: 16
|
||||
private const int NO_RAND_PART_A_STATE = 5;
|
||||
|
||||
// Token: 0x04000011 RID: 17
|
||||
private const int NO_RAND_PART_B_STATE = 6;
|
||||
|
||||
// Token: 0x04000012 RID: 18
|
||||
private const int NO_RAND_PART_C_STATE = 7;
|
||||
|
||||
// Token: 0x04000013 RID: 19
|
||||
private int last;
|
||||
|
||||
// Token: 0x04000014 RID: 20
|
||||
private int origPtr;
|
||||
|
||||
// Token: 0x04000015 RID: 21
|
||||
private int blockSize100k;
|
||||
|
||||
// Token: 0x04000016 RID: 22
|
||||
private bool blockRandomised;
|
||||
|
||||
// Token: 0x04000017 RID: 23
|
||||
private int bsBuff;
|
||||
|
||||
// Token: 0x04000018 RID: 24
|
||||
private int bsLive;
|
||||
|
||||
// Token: 0x04000019 RID: 25
|
||||
private IChecksum mCrc = new StrangeCRC();
|
||||
|
||||
// Token: 0x0400001A RID: 26
|
||||
private bool[] inUse = new bool[256];
|
||||
|
||||
// Token: 0x0400001B RID: 27
|
||||
private int nInUse;
|
||||
|
||||
// Token: 0x0400001C RID: 28
|
||||
private byte[] seqToUnseq = new byte[256];
|
||||
|
||||
// Token: 0x0400001D RID: 29
|
||||
private byte[] unseqToSeq = new byte[256];
|
||||
|
||||
// Token: 0x0400001E RID: 30
|
||||
private byte[] selector = new byte[18002];
|
||||
|
||||
// Token: 0x0400001F RID: 31
|
||||
private byte[] selectorMtf = new byte[18002];
|
||||
|
||||
// Token: 0x04000020 RID: 32
|
||||
private int[] tt;
|
||||
|
||||
// Token: 0x04000021 RID: 33
|
||||
private byte[] ll8;
|
||||
|
||||
// Token: 0x04000022 RID: 34
|
||||
private int[] unzftab = new int[256];
|
||||
|
||||
// Token: 0x04000023 RID: 35
|
||||
private int[][] limit = new int[6][];
|
||||
|
||||
// Token: 0x04000024 RID: 36
|
||||
private int[][] baseArray = new int[6][];
|
||||
|
||||
// Token: 0x04000025 RID: 37
|
||||
private int[][] perm = new int[6][];
|
||||
|
||||
// Token: 0x04000026 RID: 38
|
||||
private int[] minLens = new int[6];
|
||||
|
||||
// Token: 0x04000027 RID: 39
|
||||
private Stream baseStream;
|
||||
|
||||
// Token: 0x04000028 RID: 40
|
||||
private bool streamEnd;
|
||||
|
||||
// Token: 0x04000029 RID: 41
|
||||
private int currentChar = -1;
|
||||
|
||||
// Token: 0x0400002A RID: 42
|
||||
private int currentState = 1;
|
||||
|
||||
// Token: 0x0400002B RID: 43
|
||||
private int storedBlockCRC;
|
||||
|
||||
// Token: 0x0400002C RID: 44
|
||||
private int storedCombinedCRC;
|
||||
|
||||
// Token: 0x0400002D RID: 45
|
||||
private int computedBlockCRC;
|
||||
|
||||
// Token: 0x0400002E RID: 46
|
||||
private uint computedCombinedCRC;
|
||||
|
||||
// Token: 0x0400002F RID: 47
|
||||
private int count;
|
||||
|
||||
// Token: 0x04000030 RID: 48
|
||||
private int chPrev;
|
||||
|
||||
// Token: 0x04000031 RID: 49
|
||||
private int ch2;
|
||||
|
||||
// Token: 0x04000032 RID: 50
|
||||
private int tPos;
|
||||
|
||||
// Token: 0x04000033 RID: 51
|
||||
private int rNToGo;
|
||||
|
||||
// Token: 0x04000034 RID: 52
|
||||
private int rTPos;
|
||||
|
||||
// Token: 0x04000035 RID: 53
|
||||
private int i2;
|
||||
|
||||
// Token: 0x04000036 RID: 54
|
||||
private int j2;
|
||||
|
||||
// Token: 0x04000037 RID: 55
|
||||
private byte z;
|
||||
|
||||
// Token: 0x04000038 RID: 56
|
||||
private bool isStreamOwner = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1761 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using ICSharpCode.SharpZipLib.Checksums;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.BZip2
|
||||
{
|
||||
// Token: 0x02000007 RID: 7
|
||||
public class BZip2OutputStream : Stream
|
||||
{
|
||||
// Token: 0x06000038 RID: 56 RVA: 0x00003C66 File Offset: 0x00002C66
|
||||
public BZip2OutputStream(Stream stream)
|
||||
: this(stream, 9)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000039 RID: 57 RVA: 0x00003CB0 File Offset: 0x00002CB0
|
||||
public BZip2OutputStream(Stream stream, int blockSize)
|
||||
{
|
||||
this.BsSetStream(stream);
|
||||
this.workFactor = 50;
|
||||
if (blockSize > 9)
|
||||
{
|
||||
blockSize = 9;
|
||||
}
|
||||
if (blockSize < 1)
|
||||
{
|
||||
blockSize = 1;
|
||||
}
|
||||
this.blockSize100k = blockSize;
|
||||
this.AllocateCompressStructures();
|
||||
this.Initialize();
|
||||
this.InitBlock();
|
||||
}
|
||||
|
||||
// Token: 0x0600003A RID: 58 RVA: 0x00003D8C File Offset: 0x00002D8C
|
||||
~BZip2OutputStream()
|
||||
{
|
||||
this.Dispose(false);
|
||||
}
|
||||
|
||||
// Token: 0x17000007 RID: 7
|
||||
// (get) Token: 0x0600003B RID: 59 RVA: 0x00003DBC File Offset: 0x00002DBC
|
||||
// (set) Token: 0x0600003C RID: 60 RVA: 0x00003DC4 File Offset: 0x00002DC4
|
||||
public bool IsStreamOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isStreamOwner;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.isStreamOwner = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000008 RID: 8
|
||||
// (get) Token: 0x0600003D RID: 61 RVA: 0x00003DCD File Offset: 0x00002DCD
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000009 RID: 9
|
||||
// (get) Token: 0x0600003E RID: 62 RVA: 0x00003DD0 File Offset: 0x00002DD0
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000A RID: 10
|
||||
// (get) Token: 0x0600003F RID: 63 RVA: 0x00003DD3 File Offset: 0x00002DD3
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseStream.CanWrite;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000B RID: 11
|
||||
// (get) Token: 0x06000040 RID: 64 RVA: 0x00003DE0 File Offset: 0x00002DE0
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseStream.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000C RID: 12
|
||||
// (get) Token: 0x06000041 RID: 65 RVA: 0x00003DED File Offset: 0x00002DED
|
||||
// (set) Token: 0x06000042 RID: 66 RVA: 0x00003DFA File Offset: 0x00002DFA
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseStream.Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotSupportedException("BZip2OutputStream position cannot be set");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000043 RID: 67 RVA: 0x00003E06 File Offset: 0x00002E06
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotSupportedException("BZip2OutputStream Seek not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000044 RID: 68 RVA: 0x00003E12 File Offset: 0x00002E12
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException("BZip2OutputStream SetLength not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000045 RID: 69 RVA: 0x00003E1E File Offset: 0x00002E1E
|
||||
public override int ReadByte()
|
||||
{
|
||||
throw new NotSupportedException("BZip2OutputStream ReadByte not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000046 RID: 70 RVA: 0x00003E2A File Offset: 0x00002E2A
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException("BZip2OutputStream Read not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000047 RID: 71 RVA: 0x00003E38 File Offset: 0x00002E38
|
||||
public override void Write(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 (buffer.Length - offset < count)
|
||||
{
|
||||
throw new ArgumentException("Offset/count out of range");
|
||||
}
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
this.WriteByte(buffer[offset + i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000048 RID: 72 RVA: 0x00003E9C File Offset: 0x00002E9C
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
int num = (256 + (int)value) % 256;
|
||||
if (this.currentChar != -1)
|
||||
{
|
||||
if (this.currentChar != num)
|
||||
{
|
||||
this.WriteRun();
|
||||
this.runLength = 1;
|
||||
this.currentChar = num;
|
||||
return;
|
||||
}
|
||||
this.runLength++;
|
||||
if (this.runLength > 254)
|
||||
{
|
||||
this.WriteRun();
|
||||
this.currentChar = -1;
|
||||
this.runLength = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.currentChar = num;
|
||||
this.runLength++;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000049 RID: 73 RVA: 0x00003F23 File Offset: 0x00002F23
|
||||
public override void Close()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Token: 0x0600004A RID: 74 RVA: 0x00003F34 File Offset: 0x00002F34
|
||||
private void MakeMaps()
|
||||
{
|
||||
this.nInUse = 0;
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
if (this.inUse[i])
|
||||
{
|
||||
this.seqToUnseq[this.nInUse] = (char)i;
|
||||
this.unseqToSeq[i] = (char)this.nInUse;
|
||||
this.nInUse++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600004B RID: 75 RVA: 0x00003F90 File Offset: 0x00002F90
|
||||
private void WriteRun()
|
||||
{
|
||||
if (this.last >= this.allowableBlockSize)
|
||||
{
|
||||
this.EndBlock();
|
||||
this.InitBlock();
|
||||
this.WriteRun();
|
||||
return;
|
||||
}
|
||||
this.inUse[this.currentChar] = true;
|
||||
for (int i = 0; i < this.runLength; i++)
|
||||
{
|
||||
this.mCrc.Update(this.currentChar);
|
||||
}
|
||||
switch (this.runLength)
|
||||
{
|
||||
case 1:
|
||||
this.last++;
|
||||
this.block[this.last + 1] = (byte)this.currentChar;
|
||||
return;
|
||||
case 2:
|
||||
this.last++;
|
||||
this.block[this.last + 1] = (byte)this.currentChar;
|
||||
this.last++;
|
||||
this.block[this.last + 1] = (byte)this.currentChar;
|
||||
return;
|
||||
case 3:
|
||||
this.last++;
|
||||
this.block[this.last + 1] = (byte)this.currentChar;
|
||||
this.last++;
|
||||
this.block[this.last + 1] = (byte)this.currentChar;
|
||||
this.last++;
|
||||
this.block[this.last + 1] = (byte)this.currentChar;
|
||||
return;
|
||||
default:
|
||||
this.inUse[this.runLength - 4] = true;
|
||||
this.last++;
|
||||
this.block[this.last + 1] = (byte)this.currentChar;
|
||||
this.last++;
|
||||
this.block[this.last + 1] = (byte)this.currentChar;
|
||||
this.last++;
|
||||
this.block[this.last + 1] = (byte)this.currentChar;
|
||||
this.last++;
|
||||
this.block[this.last + 1] = (byte)this.currentChar;
|
||||
this.last++;
|
||||
this.block[this.last + 1] = (byte)(this.runLength - 4);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000D RID: 13
|
||||
// (get) Token: 0x0600004C RID: 76 RVA: 0x000041B2 File Offset: 0x000031B2
|
||||
public int BytesWritten
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bytesOut;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600004D RID: 77 RVA: 0x000041BC File Offset: 0x000031BC
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if (!this.disposed_)
|
||||
{
|
||||
this.disposed_ = true;
|
||||
if (this.runLength > 0)
|
||||
{
|
||||
this.WriteRun();
|
||||
}
|
||||
this.currentChar = -1;
|
||||
this.EndBlock();
|
||||
this.EndCompression();
|
||||
this.Flush();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (disposing && this.IsStreamOwner)
|
||||
{
|
||||
this.baseStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600004E RID: 78 RVA: 0x00004230 File Offset: 0x00003230
|
||||
public override void Flush()
|
||||
{
|
||||
this.baseStream.Flush();
|
||||
}
|
||||
|
||||
// Token: 0x0600004F RID: 79 RVA: 0x0000423D File Offset: 0x0000323D
|
||||
private void Initialize()
|
||||
{
|
||||
this.bytesOut = 0;
|
||||
this.nBlocksRandomised = 0;
|
||||
this.BsPutUChar(66);
|
||||
this.BsPutUChar(90);
|
||||
this.BsPutUChar(104);
|
||||
this.BsPutUChar(48 + this.blockSize100k);
|
||||
this.combinedCRC = 0U;
|
||||
}
|
||||
|
||||
// Token: 0x06000050 RID: 80 RVA: 0x0000427C File Offset: 0x0000327C
|
||||
private void InitBlock()
|
||||
{
|
||||
this.mCrc.Reset();
|
||||
this.last = -1;
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
this.inUse[i] = false;
|
||||
}
|
||||
this.allowableBlockSize = 100000 * this.blockSize100k - 20;
|
||||
}
|
||||
|
||||
// Token: 0x06000051 RID: 81 RVA: 0x000042CC File Offset: 0x000032CC
|
||||
private void EndBlock()
|
||||
{
|
||||
if (this.last < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.blockCRC = (uint)this.mCrc.Value;
|
||||
this.combinedCRC = (this.combinedCRC << 1) | (this.combinedCRC >> 31);
|
||||
this.combinedCRC ^= this.blockCRC;
|
||||
this.DoReversibleTransformation();
|
||||
this.BsPutUChar(49);
|
||||
this.BsPutUChar(65);
|
||||
this.BsPutUChar(89);
|
||||
this.BsPutUChar(38);
|
||||
this.BsPutUChar(83);
|
||||
this.BsPutUChar(89);
|
||||
this.BsPutint((int)this.blockCRC);
|
||||
if (this.blockRandomised)
|
||||
{
|
||||
this.BsW(1, 1);
|
||||
this.nBlocksRandomised++;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.BsW(1, 0);
|
||||
}
|
||||
this.MoveToFrontCodeAndSend();
|
||||
}
|
||||
|
||||
// Token: 0x06000052 RID: 82 RVA: 0x00004390 File Offset: 0x00003390
|
||||
private void EndCompression()
|
||||
{
|
||||
this.BsPutUChar(23);
|
||||
this.BsPutUChar(114);
|
||||
this.BsPutUChar(69);
|
||||
this.BsPutUChar(56);
|
||||
this.BsPutUChar(80);
|
||||
this.BsPutUChar(144);
|
||||
this.BsPutint((int)this.combinedCRC);
|
||||
this.BsFinishedWithStream();
|
||||
}
|
||||
|
||||
// Token: 0x06000053 RID: 83 RVA: 0x000043E2 File Offset: 0x000033E2
|
||||
private void BsSetStream(Stream stream)
|
||||
{
|
||||
this.baseStream = stream;
|
||||
this.bsLive = 0;
|
||||
this.bsBuff = 0;
|
||||
this.bytesOut = 0;
|
||||
}
|
||||
|
||||
// Token: 0x06000054 RID: 84 RVA: 0x00004400 File Offset: 0x00003400
|
||||
private void BsFinishedWithStream()
|
||||
{
|
||||
while (this.bsLive > 0)
|
||||
{
|
||||
int num = this.bsBuff >> 24;
|
||||
this.baseStream.WriteByte((byte)num);
|
||||
this.bsBuff <<= 8;
|
||||
this.bsLive -= 8;
|
||||
this.bytesOut++;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000055 RID: 85 RVA: 0x0000445C File Offset: 0x0000345C
|
||||
private void BsW(int n, int v)
|
||||
{
|
||||
while (this.bsLive >= 8)
|
||||
{
|
||||
int num = this.bsBuff >> 24;
|
||||
this.baseStream.WriteByte((byte)num);
|
||||
this.bsBuff <<= 8;
|
||||
this.bsLive -= 8;
|
||||
this.bytesOut++;
|
||||
}
|
||||
this.bsBuff |= v << 32 - this.bsLive - n;
|
||||
this.bsLive += n;
|
||||
}
|
||||
|
||||
// Token: 0x06000056 RID: 86 RVA: 0x000044E0 File Offset: 0x000034E0
|
||||
private void BsPutUChar(int c)
|
||||
{
|
||||
this.BsW(8, c);
|
||||
}
|
||||
|
||||
// Token: 0x06000057 RID: 87 RVA: 0x000044EC File Offset: 0x000034EC
|
||||
private void BsPutint(int u)
|
||||
{
|
||||
this.BsW(8, (u >> 24) & 255);
|
||||
this.BsW(8, (u >> 16) & 255);
|
||||
this.BsW(8, (u >> 8) & 255);
|
||||
this.BsW(8, u & 255);
|
||||
}
|
||||
|
||||
// Token: 0x06000058 RID: 88 RVA: 0x00004539 File Offset: 0x00003539
|
||||
private void BsPutIntVS(int numBits, int c)
|
||||
{
|
||||
this.BsW(numBits, c);
|
||||
}
|
||||
|
||||
// Token: 0x06000059 RID: 89 RVA: 0x00004544 File Offset: 0x00003544
|
||||
private void SendMTFValues()
|
||||
{
|
||||
char[][] array = new char[6][];
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
array[i] = new char[258];
|
||||
}
|
||||
int num = 0;
|
||||
int num2 = this.nInUse + 2;
|
||||
for (int j = 0; j < 6; j++)
|
||||
{
|
||||
for (int k = 0; k < num2; k++)
|
||||
{
|
||||
array[j][k] = '\u000f';
|
||||
}
|
||||
}
|
||||
if (this.nMTF <= 0)
|
||||
{
|
||||
BZip2OutputStream.Panic();
|
||||
}
|
||||
int num3;
|
||||
if (this.nMTF < 200)
|
||||
{
|
||||
num3 = 2;
|
||||
}
|
||||
else if (this.nMTF < 600)
|
||||
{
|
||||
num3 = 3;
|
||||
}
|
||||
else if (this.nMTF < 1200)
|
||||
{
|
||||
num3 = 4;
|
||||
}
|
||||
else if (this.nMTF < 2400)
|
||||
{
|
||||
num3 = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
num3 = 6;
|
||||
}
|
||||
int l = num3;
|
||||
int num4 = this.nMTF;
|
||||
int m = 0;
|
||||
while (l > 0)
|
||||
{
|
||||
int num5 = num4 / l;
|
||||
int num6 = 0;
|
||||
int num7 = m - 1;
|
||||
while (num6 < num5 && num7 < num2 - 1)
|
||||
{
|
||||
num7++;
|
||||
num6 += this.mtfFreq[num7];
|
||||
}
|
||||
if (num7 > m && l != num3 && l != 1 && (num3 - l) % 2 == 1)
|
||||
{
|
||||
num6 -= this.mtfFreq[num7];
|
||||
num7--;
|
||||
}
|
||||
for (int n = 0; n < num2; n++)
|
||||
{
|
||||
if (n >= m && n <= num7)
|
||||
{
|
||||
array[l - 1][n] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
array[l - 1][n] = '\u000f';
|
||||
}
|
||||
}
|
||||
l--;
|
||||
m = num7 + 1;
|
||||
num4 -= num6;
|
||||
}
|
||||
int[][] array2 = new int[6][];
|
||||
for (int num8 = 0; num8 < 6; num8++)
|
||||
{
|
||||
array2[num8] = new int[258];
|
||||
}
|
||||
int[] array3 = new int[6];
|
||||
short[] array4 = new short[6];
|
||||
for (int num9 = 0; num9 < 4; num9++)
|
||||
{
|
||||
for (int num10 = 0; num10 < num3; num10++)
|
||||
{
|
||||
array3[num10] = 0;
|
||||
}
|
||||
for (int num11 = 0; num11 < num3; num11++)
|
||||
{
|
||||
for (int num12 = 0; num12 < num2; num12++)
|
||||
{
|
||||
array2[num11][num12] = 0;
|
||||
}
|
||||
}
|
||||
num = 0;
|
||||
int num13 = 0;
|
||||
int num7;
|
||||
for (m = 0; m < this.nMTF; m = num7 + 1)
|
||||
{
|
||||
num7 = m + 50 - 1;
|
||||
if (num7 >= this.nMTF)
|
||||
{
|
||||
num7 = this.nMTF - 1;
|
||||
}
|
||||
for (int num14 = 0; num14 < num3; num14++)
|
||||
{
|
||||
array4[num14] = 0;
|
||||
}
|
||||
if (num3 == 6)
|
||||
{
|
||||
short num20;
|
||||
short num19;
|
||||
short num18;
|
||||
short num17;
|
||||
short num16;
|
||||
short num15 = (num16 = (num17 = (num18 = (num19 = (num20 = 0)))));
|
||||
for (int num21 = m; num21 <= num7; num21++)
|
||||
{
|
||||
short num22 = this.szptr[num21];
|
||||
num16 += (short)array[0][(int)num22];
|
||||
num15 += (short)array[1][(int)num22];
|
||||
num17 += (short)array[2][(int)num22];
|
||||
num18 += (short)array[3][(int)num22];
|
||||
num19 += (short)array[4][(int)num22];
|
||||
num20 += (short)array[5][(int)num22];
|
||||
}
|
||||
array4[0] = num16;
|
||||
array4[1] = num15;
|
||||
array4[2] = num17;
|
||||
array4[3] = num18;
|
||||
array4[4] = num19;
|
||||
array4[5] = num20;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int num23 = m; num23 <= num7; num23++)
|
||||
{
|
||||
short num24 = this.szptr[num23];
|
||||
for (int num25 = 0; num25 < num3; num25++)
|
||||
{
|
||||
short[] array5 = array4;
|
||||
int num26 = num25;
|
||||
array5[num26] += (short)array[num25][(int)num24];
|
||||
}
|
||||
}
|
||||
}
|
||||
int num27 = 999999999;
|
||||
int num28 = -1;
|
||||
for (int num29 = 0; num29 < num3; num29++)
|
||||
{
|
||||
if ((int)array4[num29] < num27)
|
||||
{
|
||||
num27 = (int)array4[num29];
|
||||
num28 = num29;
|
||||
}
|
||||
}
|
||||
num13 += num27;
|
||||
array3[num28]++;
|
||||
this.selector[num] = (char)num28;
|
||||
num++;
|
||||
for (int num30 = m; num30 <= num7; num30++)
|
||||
{
|
||||
array2[num28][(int)this.szptr[num30]]++;
|
||||
}
|
||||
}
|
||||
for (int num31 = 0; num31 < num3; num31++)
|
||||
{
|
||||
BZip2OutputStream.HbMakeCodeLengths(array[num31], array2[num31], num2, 20);
|
||||
}
|
||||
}
|
||||
if (num3 >= 8)
|
||||
{
|
||||
BZip2OutputStream.Panic();
|
||||
}
|
||||
if (num >= 32768 || num > 18002)
|
||||
{
|
||||
BZip2OutputStream.Panic();
|
||||
}
|
||||
char[] array6 = new char[6];
|
||||
for (int num32 = 0; num32 < num3; num32++)
|
||||
{
|
||||
array6[num32] = (char)num32;
|
||||
}
|
||||
for (int num33 = 0; num33 < num; num33++)
|
||||
{
|
||||
char c = this.selector[num33];
|
||||
int num34 = 0;
|
||||
char c2 = array6[num34];
|
||||
while (c != c2)
|
||||
{
|
||||
num34++;
|
||||
char c3 = c2;
|
||||
c2 = array6[num34];
|
||||
array6[num34] = c3;
|
||||
}
|
||||
array6[0] = c2;
|
||||
this.selectorMtf[num33] = (char)num34;
|
||||
}
|
||||
int[][] array7 = new int[6][];
|
||||
for (int num35 = 0; num35 < 6; num35++)
|
||||
{
|
||||
array7[num35] = new int[258];
|
||||
}
|
||||
for (int num36 = 0; num36 < num3; num36++)
|
||||
{
|
||||
int num37 = 32;
|
||||
int num38 = 0;
|
||||
for (int num39 = 0; num39 < num2; num39++)
|
||||
{
|
||||
if ((int)array[num36][num39] > num38)
|
||||
{
|
||||
num38 = (int)array[num36][num39];
|
||||
}
|
||||
if ((int)array[num36][num39] < num37)
|
||||
{
|
||||
num37 = (int)array[num36][num39];
|
||||
}
|
||||
}
|
||||
if (num38 > 20)
|
||||
{
|
||||
BZip2OutputStream.Panic();
|
||||
}
|
||||
if (num37 < 1)
|
||||
{
|
||||
BZip2OutputStream.Panic();
|
||||
}
|
||||
BZip2OutputStream.HbAssignCodes(array7[num36], array[num36], num37, num38, num2);
|
||||
}
|
||||
bool[] array8 = new bool[16];
|
||||
for (int num40 = 0; num40 < 16; num40++)
|
||||
{
|
||||
array8[num40] = false;
|
||||
for (int num41 = 0; num41 < 16; num41++)
|
||||
{
|
||||
if (this.inUse[num40 * 16 + num41])
|
||||
{
|
||||
array8[num40] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int num42 = 0; num42 < 16; num42++)
|
||||
{
|
||||
if (array8[num42])
|
||||
{
|
||||
this.BsW(1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.BsW(1, 0);
|
||||
}
|
||||
}
|
||||
for (int num43 = 0; num43 < 16; num43++)
|
||||
{
|
||||
if (array8[num43])
|
||||
{
|
||||
for (int num44 = 0; num44 < 16; num44++)
|
||||
{
|
||||
if (this.inUse[num43 * 16 + num44])
|
||||
{
|
||||
this.BsW(1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.BsW(1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.BsW(3, num3);
|
||||
this.BsW(15, num);
|
||||
for (int num45 = 0; num45 < num; num45++)
|
||||
{
|
||||
for (int num46 = 0; num46 < (int)this.selectorMtf[num45]; num46++)
|
||||
{
|
||||
this.BsW(1, 1);
|
||||
}
|
||||
this.BsW(1, 0);
|
||||
}
|
||||
for (int num47 = 0; num47 < num3; num47++)
|
||||
{
|
||||
int num48 = (int)array[num47][0];
|
||||
this.BsW(5, num48);
|
||||
for (int num49 = 0; num49 < num2; num49++)
|
||||
{
|
||||
while (num48 < (int)array[num47][num49])
|
||||
{
|
||||
this.BsW(2, 2);
|
||||
num48++;
|
||||
}
|
||||
while (num48 > (int)array[num47][num49])
|
||||
{
|
||||
this.BsW(2, 3);
|
||||
num48--;
|
||||
}
|
||||
this.BsW(1, 0);
|
||||
}
|
||||
}
|
||||
int num50 = 0;
|
||||
m = 0;
|
||||
while (m < this.nMTF)
|
||||
{
|
||||
int num7 = m + 50 - 1;
|
||||
if (num7 >= this.nMTF)
|
||||
{
|
||||
num7 = this.nMTF - 1;
|
||||
}
|
||||
for (int num51 = m; num51 <= num7; num51++)
|
||||
{
|
||||
this.BsW((int)array[(int)this.selector[num50]][(int)this.szptr[num51]], array7[(int)this.selector[num50]][(int)this.szptr[num51]]);
|
||||
}
|
||||
m = num7 + 1;
|
||||
num50++;
|
||||
}
|
||||
if (num50 != num)
|
||||
{
|
||||
BZip2OutputStream.Panic();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600005A RID: 90 RVA: 0x00004C73 File Offset: 0x00003C73
|
||||
private void MoveToFrontCodeAndSend()
|
||||
{
|
||||
this.BsPutIntVS(24, this.origPtr);
|
||||
this.GenerateMTFValues();
|
||||
this.SendMTFValues();
|
||||
}
|
||||
|
||||
// Token: 0x0600005B RID: 91 RVA: 0x00004C90 File Offset: 0x00003C90
|
||||
private void SimpleSort(int lo, int hi, int d)
|
||||
{
|
||||
int num = hi - lo + 1;
|
||||
if (num < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int i = 0;
|
||||
while (this.increments[i] < num)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
for (i--; i >= 0; i--)
|
||||
{
|
||||
int num2 = this.increments[i];
|
||||
int j = lo + num2;
|
||||
while (j <= hi)
|
||||
{
|
||||
int num3 = this.zptr[j];
|
||||
int num4 = j;
|
||||
while (this.FullGtU(this.zptr[num4 - num2] + d, num3 + d))
|
||||
{
|
||||
this.zptr[num4] = this.zptr[num4 - num2];
|
||||
num4 -= num2;
|
||||
if (num4 <= lo + num2 - 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.zptr[num4] = num3;
|
||||
j++;
|
||||
if (j > hi)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num3 = this.zptr[j];
|
||||
num4 = j;
|
||||
while (this.FullGtU(this.zptr[num4 - num2] + d, num3 + d))
|
||||
{
|
||||
this.zptr[num4] = this.zptr[num4 - num2];
|
||||
num4 -= num2;
|
||||
if (num4 <= lo + num2 - 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.zptr[num4] = num3;
|
||||
j++;
|
||||
if (j > hi)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num3 = this.zptr[j];
|
||||
num4 = j;
|
||||
while (this.FullGtU(this.zptr[num4 - num2] + d, num3 + d))
|
||||
{
|
||||
this.zptr[num4] = this.zptr[num4 - num2];
|
||||
num4 -= num2;
|
||||
if (num4 <= lo + num2 - 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.zptr[num4] = num3;
|
||||
j++;
|
||||
if (this.workDone > this.workLimit && this.firstAttempt)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600005C RID: 92 RVA: 0x00004E0C File Offset: 0x00003E0C
|
||||
private void Vswap(int p1, int p2, int n)
|
||||
{
|
||||
while (n > 0)
|
||||
{
|
||||
int num = this.zptr[p1];
|
||||
this.zptr[p1] = this.zptr[p2];
|
||||
this.zptr[p2] = num;
|
||||
p1++;
|
||||
p2++;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600005D RID: 93 RVA: 0x00004E54 File Offset: 0x00003E54
|
||||
private void QSort3(int loSt, int hiSt, int dSt)
|
||||
{
|
||||
BZip2OutputStream.StackElement[] array = new BZip2OutputStream.StackElement[1000];
|
||||
int i = 0;
|
||||
array[i].ll = loSt;
|
||||
array[i].hh = hiSt;
|
||||
array[i].dd = dSt;
|
||||
i++;
|
||||
while (i > 0)
|
||||
{
|
||||
if (i >= 1000)
|
||||
{
|
||||
BZip2OutputStream.Panic();
|
||||
}
|
||||
i--;
|
||||
int ll = array[i].ll;
|
||||
int hh = array[i].hh;
|
||||
int dd = array[i].dd;
|
||||
if (hh - ll < 20 || dd > 10)
|
||||
{
|
||||
this.SimpleSort(ll, hh, dd);
|
||||
if (this.workDone > this.workLimit && this.firstAttempt)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = (int)BZip2OutputStream.Med3(this.block[this.zptr[ll] + dd + 1], this.block[this.zptr[hh] + dd + 1], this.block[this.zptr[ll + hh >> 1] + dd + 1]);
|
||||
int j;
|
||||
int num2 = (j = ll);
|
||||
int num4;
|
||||
int num3 = (num4 = hh);
|
||||
for (;;)
|
||||
{
|
||||
if (j <= num4)
|
||||
{
|
||||
int num5 = (int)this.block[this.zptr[j] + dd + 1] - num;
|
||||
if (num5 == 0)
|
||||
{
|
||||
int num6 = this.zptr[j];
|
||||
this.zptr[j] = this.zptr[num2];
|
||||
this.zptr[num2] = num6;
|
||||
num2++;
|
||||
j++;
|
||||
continue;
|
||||
}
|
||||
if (num5 <= 0)
|
||||
{
|
||||
j++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
while (j <= num4)
|
||||
{
|
||||
int num5 = (int)this.block[this.zptr[num4] + dd + 1] - num;
|
||||
if (num5 == 0)
|
||||
{
|
||||
int num7 = this.zptr[num4];
|
||||
this.zptr[num4] = this.zptr[num3];
|
||||
this.zptr[num3] = num7;
|
||||
num3--;
|
||||
num4--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num5 < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num4--;
|
||||
}
|
||||
}
|
||||
if (j > num4)
|
||||
{
|
||||
break;
|
||||
}
|
||||
int num8 = this.zptr[j];
|
||||
this.zptr[j] = this.zptr[num4];
|
||||
this.zptr[num4] = num8;
|
||||
j++;
|
||||
num4--;
|
||||
}
|
||||
if (num3 < num2)
|
||||
{
|
||||
array[i].ll = ll;
|
||||
array[i].hh = hh;
|
||||
array[i].dd = dd + 1;
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num5 = ((num2 - ll < j - num2) ? (num2 - ll) : (j - num2));
|
||||
this.Vswap(ll, j - num5, num5);
|
||||
int num9 = ((hh - num3 < num3 - num4) ? (hh - num3) : (num3 - num4));
|
||||
this.Vswap(j, hh - num9 + 1, num9);
|
||||
num5 = ll + j - num2 - 1;
|
||||
num9 = hh - (num3 - num4) + 1;
|
||||
array[i].ll = ll;
|
||||
array[i].hh = num5;
|
||||
array[i].dd = dd;
|
||||
i++;
|
||||
array[i].ll = num5 + 1;
|
||||
array[i].hh = num9 - 1;
|
||||
array[i].dd = dd + 1;
|
||||
i++;
|
||||
array[i].ll = num9;
|
||||
array[i].hh = hh;
|
||||
array[i].dd = dd;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600005E RID: 94 RVA: 0x000051B0 File Offset: 0x000041B0
|
||||
private void MainSort()
|
||||
{
|
||||
int[] array = new int[256];
|
||||
int[] array2 = new int[256];
|
||||
bool[] array3 = new bool[256];
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
this.block[this.last + i + 2] = this.block[i % (this.last + 1) + 1];
|
||||
}
|
||||
for (int i = 0; i <= this.last + 20; i++)
|
||||
{
|
||||
this.quadrant[i] = 0;
|
||||
}
|
||||
this.block[0] = this.block[this.last + 1];
|
||||
if (this.last < 4000)
|
||||
{
|
||||
for (int i = 0; i <= this.last; i++)
|
||||
{
|
||||
this.zptr[i] = i;
|
||||
}
|
||||
this.firstAttempt = false;
|
||||
this.workDone = (this.workLimit = 0);
|
||||
this.SimpleSort(0, this.last, 0);
|
||||
return;
|
||||
}
|
||||
int num = 0;
|
||||
for (int i = 0; i <= 255; i++)
|
||||
{
|
||||
array3[i] = false;
|
||||
}
|
||||
for (int i = 0; i <= 65536; i++)
|
||||
{
|
||||
this.ftab[i] = 0;
|
||||
}
|
||||
int num2 = (int)this.block[0];
|
||||
for (int i = 0; i <= this.last; i++)
|
||||
{
|
||||
int num3 = (int)this.block[i + 1];
|
||||
this.ftab[(num2 << 8) + num3]++;
|
||||
num2 = num3;
|
||||
}
|
||||
for (int i = 1; i <= 65536; i++)
|
||||
{
|
||||
this.ftab[i] += this.ftab[i - 1];
|
||||
}
|
||||
num2 = (int)this.block[1];
|
||||
int j;
|
||||
for (int i = 0; i < this.last; i++)
|
||||
{
|
||||
int num3 = (int)this.block[i + 2];
|
||||
j = (num2 << 8) + num3;
|
||||
num2 = num3;
|
||||
this.ftab[j]--;
|
||||
this.zptr[this.ftab[j]] = i;
|
||||
}
|
||||
j = ((int)this.block[this.last + 1] << 8) + (int)this.block[1];
|
||||
this.ftab[j]--;
|
||||
this.zptr[this.ftab[j]] = this.last;
|
||||
for (int i = 0; i <= 255; i++)
|
||||
{
|
||||
array[i] = i;
|
||||
}
|
||||
int num4 = 1;
|
||||
do
|
||||
{
|
||||
num4 = 3 * num4 + 1;
|
||||
}
|
||||
while (num4 <= 256);
|
||||
do
|
||||
{
|
||||
num4 /= 3;
|
||||
for (int i = num4; i <= 255; i++)
|
||||
{
|
||||
int num5 = array[i];
|
||||
j = i;
|
||||
while (this.ftab[array[j - num4] + 1 << 8] - this.ftab[array[j - num4] << 8] > this.ftab[num5 + 1 << 8] - this.ftab[num5 << 8])
|
||||
{
|
||||
array[j] = array[j - num4];
|
||||
j -= num4;
|
||||
if (j <= num4 - 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
array[j] = num5;
|
||||
}
|
||||
}
|
||||
while (num4 != 1);
|
||||
for (int i = 0; i <= 255; i++)
|
||||
{
|
||||
int num6 = array[i];
|
||||
for (j = 0; j <= 255; j++)
|
||||
{
|
||||
int num7 = (num6 << 8) + j;
|
||||
if ((this.ftab[num7] & 2097152) != 2097152)
|
||||
{
|
||||
int num8 = this.ftab[num7] & -2097153;
|
||||
int num9 = (this.ftab[num7 + 1] & -2097153) - 1;
|
||||
if (num9 > num8)
|
||||
{
|
||||
this.QSort3(num8, num9, 2);
|
||||
num += num9 - num8 + 1;
|
||||
if (this.workDone > this.workLimit && this.firstAttempt)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.ftab[num7] |= 2097152;
|
||||
}
|
||||
}
|
||||
array3[num6] = true;
|
||||
if (i < 255)
|
||||
{
|
||||
int num10 = this.ftab[num6 << 8] & -2097153;
|
||||
int num11 = (this.ftab[num6 + 1 << 8] & -2097153) - num10;
|
||||
int num12 = 0;
|
||||
while (num11 >> num12 > 65534)
|
||||
{
|
||||
num12++;
|
||||
}
|
||||
for (j = 0; j < num11; j++)
|
||||
{
|
||||
int num13 = this.zptr[num10 + j];
|
||||
int num14 = j >> num12;
|
||||
this.quadrant[num13] = num14;
|
||||
if (num13 < 20)
|
||||
{
|
||||
this.quadrant[num13 + this.last + 1] = num14;
|
||||
}
|
||||
}
|
||||
if (num11 - 1 >> num12 > 65535)
|
||||
{
|
||||
BZip2OutputStream.Panic();
|
||||
}
|
||||
}
|
||||
for (j = 0; j <= 255; j++)
|
||||
{
|
||||
array2[j] = this.ftab[(j << 8) + num6] & -2097153;
|
||||
}
|
||||
for (j = this.ftab[num6 << 8] & -2097153; j < (this.ftab[num6 + 1 << 8] & -2097153); j++)
|
||||
{
|
||||
num2 = (int)this.block[this.zptr[j]];
|
||||
if (!array3[num2])
|
||||
{
|
||||
this.zptr[array2[num2]] = ((this.zptr[j] == 0) ? this.last : (this.zptr[j] - 1));
|
||||
array2[num2]++;
|
||||
}
|
||||
}
|
||||
for (j = 0; j <= 255; j++)
|
||||
{
|
||||
this.ftab[(j << 8) + num6] |= 2097152;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600005F RID: 95 RVA: 0x000056E0 File Offset: 0x000046E0
|
||||
private void RandomiseBlock()
|
||||
{
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
this.inUse[i] = false;
|
||||
}
|
||||
for (int i = 0; i <= this.last; i++)
|
||||
{
|
||||
if (num == 0)
|
||||
{
|
||||
num = BZip2Constants.RandomNumbers[num2];
|
||||
num2++;
|
||||
if (num2 == 512)
|
||||
{
|
||||
num2 = 0;
|
||||
}
|
||||
}
|
||||
num--;
|
||||
byte[] array = this.block;
|
||||
int num3 = i + 1;
|
||||
array[num3] ^= ((num == 1) ? 1 : 0);
|
||||
byte[] array2 = this.block;
|
||||
int num4 = i + 1;
|
||||
array2[num4] &= byte.MaxValue;
|
||||
this.inUse[(int)this.block[i + 1]] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000060 RID: 96 RVA: 0x00005790 File Offset: 0x00004790
|
||||
private void DoReversibleTransformation()
|
||||
{
|
||||
this.workLimit = this.workFactor * this.last;
|
||||
this.workDone = 0;
|
||||
this.blockRandomised = false;
|
||||
this.firstAttempt = true;
|
||||
this.MainSort();
|
||||
if (this.workDone > this.workLimit && this.firstAttempt)
|
||||
{
|
||||
this.RandomiseBlock();
|
||||
this.workLimit = (this.workDone = 0);
|
||||
this.blockRandomised = true;
|
||||
this.firstAttempt = false;
|
||||
this.MainSort();
|
||||
}
|
||||
this.origPtr = -1;
|
||||
for (int i = 0; i <= this.last; i++)
|
||||
{
|
||||
if (this.zptr[i] == 0)
|
||||
{
|
||||
this.origPtr = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (this.origPtr == -1)
|
||||
{
|
||||
BZip2OutputStream.Panic();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000061 RID: 97 RVA: 0x00005844 File Offset: 0x00004844
|
||||
private bool FullGtU(int i1, int i2)
|
||||
{
|
||||
byte b = this.block[i1 + 1];
|
||||
byte b2 = this.block[i2 + 1];
|
||||
if (b != b2)
|
||||
{
|
||||
return b > b2;
|
||||
}
|
||||
i1++;
|
||||
i2++;
|
||||
b = this.block[i1 + 1];
|
||||
b2 = this.block[i2 + 1];
|
||||
if (b != b2)
|
||||
{
|
||||
return b > b2;
|
||||
}
|
||||
i1++;
|
||||
i2++;
|
||||
b = this.block[i1 + 1];
|
||||
b2 = this.block[i2 + 1];
|
||||
if (b != b2)
|
||||
{
|
||||
return b > b2;
|
||||
}
|
||||
i1++;
|
||||
i2++;
|
||||
b = this.block[i1 + 1];
|
||||
b2 = this.block[i2 + 1];
|
||||
if (b != b2)
|
||||
{
|
||||
return b > b2;
|
||||
}
|
||||
i1++;
|
||||
i2++;
|
||||
b = this.block[i1 + 1];
|
||||
b2 = this.block[i2 + 1];
|
||||
if (b != b2)
|
||||
{
|
||||
return b > b2;
|
||||
}
|
||||
i1++;
|
||||
i2++;
|
||||
b = this.block[i1 + 1];
|
||||
b2 = this.block[i2 + 1];
|
||||
if (b != b2)
|
||||
{
|
||||
return b > b2;
|
||||
}
|
||||
i1++;
|
||||
i2++;
|
||||
int num = this.last + 1;
|
||||
int num2;
|
||||
int num3;
|
||||
for (;;)
|
||||
{
|
||||
b = this.block[i1 + 1];
|
||||
b2 = this.block[i2 + 1];
|
||||
if (b != b2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num2 = this.quadrant[i1];
|
||||
num3 = this.quadrant[i2];
|
||||
if (num2 != num3)
|
||||
{
|
||||
goto Block_8;
|
||||
}
|
||||
i1++;
|
||||
i2++;
|
||||
b = this.block[i1 + 1];
|
||||
b2 = this.block[i2 + 1];
|
||||
if (b != b2)
|
||||
{
|
||||
goto Block_9;
|
||||
}
|
||||
num2 = this.quadrant[i1];
|
||||
num3 = this.quadrant[i2];
|
||||
if (num2 != num3)
|
||||
{
|
||||
goto Block_10;
|
||||
}
|
||||
i1++;
|
||||
i2++;
|
||||
b = this.block[i1 + 1];
|
||||
b2 = this.block[i2 + 1];
|
||||
if (b != b2)
|
||||
{
|
||||
goto Block_11;
|
||||
}
|
||||
num2 = this.quadrant[i1];
|
||||
num3 = this.quadrant[i2];
|
||||
if (num2 != num3)
|
||||
{
|
||||
goto Block_12;
|
||||
}
|
||||
i1++;
|
||||
i2++;
|
||||
b = this.block[i1 + 1];
|
||||
b2 = this.block[i2 + 1];
|
||||
if (b != b2)
|
||||
{
|
||||
goto Block_13;
|
||||
}
|
||||
num2 = this.quadrant[i1];
|
||||
num3 = this.quadrant[i2];
|
||||
if (num2 != num3)
|
||||
{
|
||||
goto Block_14;
|
||||
}
|
||||
i1++;
|
||||
i2++;
|
||||
if (i1 > this.last)
|
||||
{
|
||||
i1 -= this.last;
|
||||
i1--;
|
||||
}
|
||||
if (i2 > this.last)
|
||||
{
|
||||
i2 -= this.last;
|
||||
i2--;
|
||||
}
|
||||
num -= 4;
|
||||
this.workDone++;
|
||||
if (num < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return b > b2;
|
||||
Block_8:
|
||||
return num2 > num3;
|
||||
Block_9:
|
||||
return b > b2;
|
||||
Block_10:
|
||||
return num2 > num3;
|
||||
Block_11:
|
||||
return b > b2;
|
||||
Block_12:
|
||||
return num2 > num3;
|
||||
Block_13:
|
||||
return b > b2;
|
||||
Block_14:
|
||||
return num2 > num3;
|
||||
}
|
||||
|
||||
// Token: 0x06000062 RID: 98 RVA: 0x00005AB8 File Offset: 0x00004AB8
|
||||
private void AllocateCompressStructures()
|
||||
{
|
||||
int num = 100000 * this.blockSize100k;
|
||||
this.block = new byte[num + 1 + 20];
|
||||
this.quadrant = new int[num + 20];
|
||||
this.zptr = new int[num];
|
||||
this.ftab = new int[65537];
|
||||
if (this.block != null && this.quadrant != null && this.zptr != null)
|
||||
{
|
||||
int[] array = this.ftab;
|
||||
}
|
||||
this.szptr = new short[2 * num];
|
||||
}
|
||||
|
||||
// Token: 0x06000063 RID: 99 RVA: 0x00005B3C File Offset: 0x00004B3C
|
||||
private void GenerateMTFValues()
|
||||
{
|
||||
char[] array = new char[256];
|
||||
this.MakeMaps();
|
||||
int num = this.nInUse + 1;
|
||||
for (int i = 0; i <= num; i++)
|
||||
{
|
||||
this.mtfFreq[i] = 0;
|
||||
}
|
||||
int num2 = 0;
|
||||
int num3 = 0;
|
||||
for (int i = 0; i < this.nInUse; i++)
|
||||
{
|
||||
array[i] = (char)i;
|
||||
}
|
||||
for (int i = 0; i <= this.last; i++)
|
||||
{
|
||||
char c = this.unseqToSeq[(int)this.block[this.zptr[i]]];
|
||||
int num4 = 0;
|
||||
char c2 = array[num4];
|
||||
while (c != c2)
|
||||
{
|
||||
num4++;
|
||||
char c3 = c2;
|
||||
c2 = array[num4];
|
||||
array[num4] = c3;
|
||||
}
|
||||
array[0] = c2;
|
||||
if (num4 == 0)
|
||||
{
|
||||
num3++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num3 > 0)
|
||||
{
|
||||
num3--;
|
||||
for (;;)
|
||||
{
|
||||
switch (num3 % 2)
|
||||
{
|
||||
case 0:
|
||||
this.szptr[num2] = 0;
|
||||
num2++;
|
||||
this.mtfFreq[0]++;
|
||||
break;
|
||||
case 1:
|
||||
this.szptr[num2] = 1;
|
||||
num2++;
|
||||
this.mtfFreq[1]++;
|
||||
break;
|
||||
}
|
||||
if (num3 < 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num3 = (num3 - 2) / 2;
|
||||
}
|
||||
num3 = 0;
|
||||
}
|
||||
this.szptr[num2] = (short)(num4 + 1);
|
||||
num2++;
|
||||
this.mtfFreq[num4 + 1]++;
|
||||
}
|
||||
}
|
||||
if (num3 > 0)
|
||||
{
|
||||
num3--;
|
||||
for (;;)
|
||||
{
|
||||
switch (num3 % 2)
|
||||
{
|
||||
case 0:
|
||||
this.szptr[num2] = 0;
|
||||
num2++;
|
||||
this.mtfFreq[0]++;
|
||||
break;
|
||||
case 1:
|
||||
this.szptr[num2] = 1;
|
||||
num2++;
|
||||
this.mtfFreq[1]++;
|
||||
break;
|
||||
}
|
||||
if (num3 < 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num3 = (num3 - 2) / 2;
|
||||
}
|
||||
}
|
||||
this.szptr[num2] = (short)num;
|
||||
num2++;
|
||||
this.mtfFreq[num]++;
|
||||
this.nMTF = num2;
|
||||
}
|
||||
|
||||
// Token: 0x06000064 RID: 100 RVA: 0x00005D69 File Offset: 0x00004D69
|
||||
private static void Panic()
|
||||
{
|
||||
throw new BZip2Exception("BZip2 output stream panic");
|
||||
}
|
||||
|
||||
// Token: 0x06000065 RID: 101 RVA: 0x00005D78 File Offset: 0x00004D78
|
||||
private static void HbMakeCodeLengths(char[] len, int[] freq, int alphaSize, int maxLen)
|
||||
{
|
||||
int[] array = new int[260];
|
||||
int[] array2 = new int[516];
|
||||
int[] array3 = new int[516];
|
||||
for (int i = 0; i < alphaSize; i++)
|
||||
{
|
||||
array2[i + 1] = ((freq[i] == 0) ? 1 : freq[i]) << 8;
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
int num = alphaSize;
|
||||
int j = 0;
|
||||
array[0] = 0;
|
||||
array2[0] = 0;
|
||||
array3[0] = -2;
|
||||
for (int k = 1; k <= alphaSize; k++)
|
||||
{
|
||||
array3[k] = -1;
|
||||
j++;
|
||||
array[j] = k;
|
||||
int num2 = j;
|
||||
int num3 = array[num2];
|
||||
while (array2[num3] < array2[array[num2 >> 1]])
|
||||
{
|
||||
array[num2] = array[num2 >> 1];
|
||||
num2 >>= 1;
|
||||
}
|
||||
array[num2] = num3;
|
||||
}
|
||||
if (j >= 260)
|
||||
{
|
||||
BZip2OutputStream.Panic();
|
||||
}
|
||||
while (j > 1)
|
||||
{
|
||||
int num4 = array[1];
|
||||
array[1] = array[j];
|
||||
j--;
|
||||
int num5 = 1;
|
||||
int num6 = array[num5];
|
||||
for (;;)
|
||||
{
|
||||
int num7 = num5 << 1;
|
||||
if (num7 > j)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (num7 < j && array2[array[num7 + 1]] < array2[array[num7]])
|
||||
{
|
||||
num7++;
|
||||
}
|
||||
if (array2[num6] < array2[array[num7]])
|
||||
{
|
||||
break;
|
||||
}
|
||||
array[num5] = array[num7];
|
||||
num5 = num7;
|
||||
}
|
||||
array[num5] = num6;
|
||||
int num8 = array[1];
|
||||
array[1] = array[j];
|
||||
j--;
|
||||
num5 = 1;
|
||||
num6 = array[num5];
|
||||
for (;;)
|
||||
{
|
||||
int num7 = num5 << 1;
|
||||
if (num7 > j)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (num7 < j && array2[array[num7 + 1]] < array2[array[num7]])
|
||||
{
|
||||
num7++;
|
||||
}
|
||||
if (array2[num6] < array2[array[num7]])
|
||||
{
|
||||
break;
|
||||
}
|
||||
array[num5] = array[num7];
|
||||
num5 = num7;
|
||||
}
|
||||
array[num5] = num6;
|
||||
num++;
|
||||
array3[num4] = (array3[num8] = num);
|
||||
array2[num] = (int)(((long)array2[num4] & (long)((ulong)(-256))) + ((long)array2[num8] & (long)((ulong)(-256)))) | (1 + (((array2[num4] & 255) > (array2[num8] & 255)) ? (array2[num4] & 255) : (array2[num8] & 255)));
|
||||
array3[num] = -1;
|
||||
j++;
|
||||
array[j] = num;
|
||||
num5 = j;
|
||||
num6 = array[num5];
|
||||
while (array2[num6] < array2[array[num5 >> 1]])
|
||||
{
|
||||
array[num5] = array[num5 >> 1];
|
||||
num5 >>= 1;
|
||||
}
|
||||
array[num5] = num6;
|
||||
}
|
||||
if (num >= 516)
|
||||
{
|
||||
BZip2OutputStream.Panic();
|
||||
}
|
||||
bool flag = false;
|
||||
for (int l = 1; l <= alphaSize; l++)
|
||||
{
|
||||
int num9 = 0;
|
||||
int num10 = l;
|
||||
while (array3[num10] >= 0)
|
||||
{
|
||||
num10 = array3[num10];
|
||||
num9++;
|
||||
}
|
||||
len[l - 1] = (char)num9;
|
||||
if (num9 > maxLen)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
break;
|
||||
}
|
||||
for (int m = 1; m < alphaSize; m++)
|
||||
{
|
||||
int num9 = array2[m] >> 8;
|
||||
num9 = 1 + num9 / 2;
|
||||
array2[m] = num9 << 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000066 RID: 102 RVA: 0x00006058 File Offset: 0x00005058
|
||||
private static void HbAssignCodes(int[] code, char[] length, int minLen, int maxLen, int alphaSize)
|
||||
{
|
||||
int num = 0;
|
||||
for (int i = minLen; i <= maxLen; i++)
|
||||
{
|
||||
for (int j = 0; j < alphaSize; j++)
|
||||
{
|
||||
if ((int)length[j] == i)
|
||||
{
|
||||
code[j] = num;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
num <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000067 RID: 103 RVA: 0x00006094 File Offset: 0x00005094
|
||||
private static byte Med3(byte a, byte b, byte c)
|
||||
{
|
||||
if (a > b)
|
||||
{
|
||||
byte b2 = a;
|
||||
a = b;
|
||||
b = b2;
|
||||
}
|
||||
if (b > c)
|
||||
{
|
||||
byte b2 = b;
|
||||
b = c;
|
||||
c = b2;
|
||||
}
|
||||
if (a > b)
|
||||
{
|
||||
b = a;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
// Token: 0x04000039 RID: 57
|
||||
private const int SETMASK = 2097152;
|
||||
|
||||
// Token: 0x0400003A RID: 58
|
||||
private const int CLEARMASK = -2097153;
|
||||
|
||||
// Token: 0x0400003B RID: 59
|
||||
private const int GREATER_ICOST = 15;
|
||||
|
||||
// Token: 0x0400003C RID: 60
|
||||
private const int LESSER_ICOST = 0;
|
||||
|
||||
// Token: 0x0400003D RID: 61
|
||||
private const int SMALL_THRESH = 20;
|
||||
|
||||
// Token: 0x0400003E RID: 62
|
||||
private const int DEPTH_THRESH = 10;
|
||||
|
||||
// Token: 0x0400003F RID: 63
|
||||
private const int QSORT_STACK_SIZE = 1000;
|
||||
|
||||
// Token: 0x04000040 RID: 64
|
||||
private readonly int[] increments = new int[]
|
||||
{
|
||||
1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29524,
|
||||
88573, 265720, 797161, 2391484
|
||||
};
|
||||
|
||||
// Token: 0x04000041 RID: 65
|
||||
private bool isStreamOwner = true;
|
||||
|
||||
// Token: 0x04000042 RID: 66
|
||||
private int last;
|
||||
|
||||
// Token: 0x04000043 RID: 67
|
||||
private int origPtr;
|
||||
|
||||
// Token: 0x04000044 RID: 68
|
||||
private int blockSize100k;
|
||||
|
||||
// Token: 0x04000045 RID: 69
|
||||
private bool blockRandomised;
|
||||
|
||||
// Token: 0x04000046 RID: 70
|
||||
private int bytesOut;
|
||||
|
||||
// Token: 0x04000047 RID: 71
|
||||
private int bsBuff;
|
||||
|
||||
// Token: 0x04000048 RID: 72
|
||||
private int bsLive;
|
||||
|
||||
// Token: 0x04000049 RID: 73
|
||||
private IChecksum mCrc = new StrangeCRC();
|
||||
|
||||
// Token: 0x0400004A RID: 74
|
||||
private bool[] inUse = new bool[256];
|
||||
|
||||
// Token: 0x0400004B RID: 75
|
||||
private int nInUse;
|
||||
|
||||
// Token: 0x0400004C RID: 76
|
||||
private char[] seqToUnseq = new char[256];
|
||||
|
||||
// Token: 0x0400004D RID: 77
|
||||
private char[] unseqToSeq = new char[256];
|
||||
|
||||
// Token: 0x0400004E RID: 78
|
||||
private char[] selector = new char[18002];
|
||||
|
||||
// Token: 0x0400004F RID: 79
|
||||
private char[] selectorMtf = new char[18002];
|
||||
|
||||
// Token: 0x04000050 RID: 80
|
||||
private byte[] block;
|
||||
|
||||
// Token: 0x04000051 RID: 81
|
||||
private int[] quadrant;
|
||||
|
||||
// Token: 0x04000052 RID: 82
|
||||
private int[] zptr;
|
||||
|
||||
// Token: 0x04000053 RID: 83
|
||||
private short[] szptr;
|
||||
|
||||
// Token: 0x04000054 RID: 84
|
||||
private int[] ftab;
|
||||
|
||||
// Token: 0x04000055 RID: 85
|
||||
private int nMTF;
|
||||
|
||||
// Token: 0x04000056 RID: 86
|
||||
private int[] mtfFreq = new int[258];
|
||||
|
||||
// Token: 0x04000057 RID: 87
|
||||
private int workFactor;
|
||||
|
||||
// Token: 0x04000058 RID: 88
|
||||
private int workDone;
|
||||
|
||||
// Token: 0x04000059 RID: 89
|
||||
private int workLimit;
|
||||
|
||||
// Token: 0x0400005A RID: 90
|
||||
private bool firstAttempt;
|
||||
|
||||
// Token: 0x0400005B RID: 91
|
||||
private int nBlocksRandomised;
|
||||
|
||||
// Token: 0x0400005C RID: 92
|
||||
private int currentChar = -1;
|
||||
|
||||
// Token: 0x0400005D RID: 93
|
||||
private int runLength;
|
||||
|
||||
// Token: 0x0400005E RID: 94
|
||||
private uint blockCRC;
|
||||
|
||||
// Token: 0x0400005F RID: 95
|
||||
private uint combinedCRC;
|
||||
|
||||
// Token: 0x04000060 RID: 96
|
||||
private int allowableBlockSize;
|
||||
|
||||
// Token: 0x04000061 RID: 97
|
||||
private Stream baseStream;
|
||||
|
||||
// Token: 0x04000062 RID: 98
|
||||
private bool disposed_;
|
||||
|
||||
// Token: 0x02000008 RID: 8
|
||||
private struct StackElement
|
||||
{
|
||||
// Token: 0x04000063 RID: 99
|
||||
public int ll;
|
||||
|
||||
// Token: 0x04000064 RID: 100
|
||||
public int hh;
|
||||
|
||||
// Token: 0x04000065 RID: 101
|
||||
public int dd;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Checksums
|
||||
{
|
||||
// Token: 0x0200000A RID: 10
|
||||
public sealed class Adler32 : IChecksum
|
||||
{
|
||||
// Token: 0x1700000F RID: 15
|
||||
// (get) Token: 0x0600006D RID: 109 RVA: 0x000060C1 File Offset: 0x000050C1
|
||||
public long Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return (long)((ulong)this.checksum);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600006E RID: 110 RVA: 0x000060CA File Offset: 0x000050CA
|
||||
public Adler32()
|
||||
{
|
||||
this.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x0600006F RID: 111 RVA: 0x000060D8 File Offset: 0x000050D8
|
||||
public void Reset()
|
||||
{
|
||||
this.checksum = 1U;
|
||||
}
|
||||
|
||||
// Token: 0x06000070 RID: 112 RVA: 0x000060E4 File Offset: 0x000050E4
|
||||
public void Update(int value)
|
||||
{
|
||||
uint num = this.checksum & 65535U;
|
||||
uint num2 = this.checksum >> 16;
|
||||
num = (num + (uint)(value & 255)) % 65521U;
|
||||
num2 = (num + num2) % 65521U;
|
||||
this.checksum = (num2 << 16) + num;
|
||||
}
|
||||
|
||||
// Token: 0x06000071 RID: 113 RVA: 0x0000612E File Offset: 0x0000512E
|
||||
public void Update(byte[] buffer)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
this.Update(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
// Token: 0x06000072 RID: 114 RVA: 0x0000614C File Offset: 0x0000514C
|
||||
public void Update(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 (offset >= buffer.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "not a valid index into buffer");
|
||||
}
|
||||
if (offset + count > buffer.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "exceeds buffer size");
|
||||
}
|
||||
uint num = this.checksum & 65535U;
|
||||
uint num2 = this.checksum >> 16;
|
||||
while (count > 0)
|
||||
{
|
||||
int num3 = 3800;
|
||||
if (num3 > count)
|
||||
{
|
||||
num3 = count;
|
||||
}
|
||||
count -= num3;
|
||||
while (--num3 >= 0)
|
||||
{
|
||||
num += (uint)(buffer[offset++] & byte.MaxValue);
|
||||
num2 += num;
|
||||
}
|
||||
num %= 65521U;
|
||||
num2 %= 65521U;
|
||||
}
|
||||
this.checksum = (num2 << 16) | num;
|
||||
}
|
||||
|
||||
// Token: 0x04000066 RID: 102
|
||||
private const uint BASE = 65521U;
|
||||
|
||||
// Token: 0x04000067 RID: 103
|
||||
private uint checksum;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Checksums
|
||||
{
|
||||
// Token: 0x0200000B RID: 11
|
||||
public sealed class Crc32 : IChecksum
|
||||
{
|
||||
// Token: 0x06000073 RID: 115 RVA: 0x00006226 File Offset: 0x00005226
|
||||
internal static uint ComputeCrc32(uint oldCrc, byte value)
|
||||
{
|
||||
return Crc32.CrcTable[(int)((UIntPtr)((oldCrc ^ (uint)value) & 255U))] ^ (oldCrc >> 8);
|
||||
}
|
||||
|
||||
// Token: 0x17000010 RID: 16
|
||||
// (get) Token: 0x06000074 RID: 116 RVA: 0x0000623C File Offset: 0x0000523C
|
||||
// (set) Token: 0x06000075 RID: 117 RVA: 0x00006245 File Offset: 0x00005245
|
||||
public long Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return (long)((ulong)this.crc);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.crc = (uint)value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000076 RID: 118 RVA: 0x0000624F File Offset: 0x0000524F
|
||||
public void Reset()
|
||||
{
|
||||
this.crc = 0U;
|
||||
}
|
||||
|
||||
// Token: 0x06000077 RID: 119 RVA: 0x00006258 File Offset: 0x00005258
|
||||
public void Update(int value)
|
||||
{
|
||||
this.crc ^= uint.MaxValue;
|
||||
checked
|
||||
{
|
||||
this.crc = Crc32.CrcTable[(int)((IntPtr)(unchecked((ulong)this.crc ^ (ulong)((long)value)) & 255UL))] ^ (this.crc >> 8);
|
||||
this.crc ^= uint.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000078 RID: 120 RVA: 0x000062A8 File Offset: 0x000052A8
|
||||
public void Update(byte[] buffer)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
this.Update(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
// Token: 0x06000079 RID: 121 RVA: 0x000062C4 File Offset: 0x000052C4
|
||||
public void Update(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "Count cannot be less than zero");
|
||||
}
|
||||
if (offset < 0 || offset + count > buffer.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset");
|
||||
}
|
||||
this.crc ^= uint.MaxValue;
|
||||
while (--count >= 0)
|
||||
{
|
||||
this.crc = Crc32.CrcTable[(int)((UIntPtr)((this.crc ^ (uint)buffer[offset++]) & 255U))] ^ (this.crc >> 8);
|
||||
}
|
||||
this.crc ^= uint.MaxValue;
|
||||
}
|
||||
|
||||
// Token: 0x04000068 RID: 104
|
||||
private const uint CrcSeed = 4294967295U;
|
||||
|
||||
// Token: 0x04000069 RID: 105
|
||||
private static readonly uint[] CrcTable = new uint[]
|
||||
{
|
||||
0U, 1996959894U, 3993919788U, 2567524794U, 124634137U, 1886057615U, 3915621685U, 2657392035U, 249268274U, 2044508324U,
|
||||
3772115230U, 2547177864U, 162941995U, 2125561021U, 3887607047U, 2428444049U, 498536548U, 1789927666U, 4089016648U, 2227061214U,
|
||||
450548861U, 1843258603U, 4107580753U, 2211677639U, 325883990U, 1684777152U, 4251122042U, 2321926636U, 335633487U, 1661365465U,
|
||||
4195302755U, 2366115317U, 997073096U, 1281953886U, 3579855332U, 2724688242U, 1006888145U, 1258607687U, 3524101629U, 2768942443U,
|
||||
901097722U, 1119000684U, 3686517206U, 2898065728U, 853044451U, 1172266101U, 3705015759U, 2882616665U, 651767980U, 1373503546U,
|
||||
3369554304U, 3218104598U, 565507253U, 1454621731U, 3485111705U, 3099436303U, 671266974U, 1594198024U, 3322730930U, 2970347812U,
|
||||
795835527U, 1483230225U, 3244367275U, 3060149565U, 1994146192U, 31158534U, 2563907772U, 4023717930U, 1907459465U, 112637215U,
|
||||
2680153253U, 3904427059U, 2013776290U, 251722036U, 2517215374U, 3775830040U, 2137656763U, 141376813U, 2439277719U, 3865271297U,
|
||||
1802195444U, 476864866U, 2238001368U, 4066508878U, 1812370925U, 453092731U, 2181625025U, 4111451223U, 1706088902U, 314042704U,
|
||||
2344532202U, 4240017532U, 1658658271U, 366619977U, 2362670323U, 4224994405U, 1303535960U, 984961486U, 2747007092U, 3569037538U,
|
||||
1256170817U, 1037604311U, 2765210733U, 3554079995U, 1131014506U, 879679996U, 2909243462U, 3663771856U, 1141124467U, 855842277U,
|
||||
2852801631U, 3708648649U, 1342533948U, 654459306U, 3188396048U, 3373015174U, 1466479909U, 544179635U, 3110523913U, 3462522015U,
|
||||
1591671054U, 702138776U, 2966460450U, 3352799412U, 1504918807U, 783551873U, 3082640443U, 3233442989U, 3988292384U, 2596254646U,
|
||||
62317068U, 1957810842U, 3939845945U, 2647816111U, 81470997U, 1943803523U, 3814918930U, 2489596804U, 225274430U, 2053790376U,
|
||||
3826175755U, 2466906013U, 167816743U, 2097651377U, 4027552580U, 2265490386U, 503444072U, 1762050814U, 4150417245U, 2154129355U,
|
||||
426522225U, 1852507879U, 4275313526U, 2312317920U, 282753626U, 1742555852U, 4189708143U, 2394877945U, 397917763U, 1622183637U,
|
||||
3604390888U, 2714866558U, 953729732U, 1340076626U, 3518719985U, 2797360999U, 1068828381U, 1219638859U, 3624741850U, 2936675148U,
|
||||
906185462U, 1090812512U, 3747672003U, 2825379669U, 829329135U, 1181335161U, 3412177804U, 3160834842U, 628085408U, 1382605366U,
|
||||
3423369109U, 3138078467U, 570562233U, 1426400815U, 3317316542U, 2998733608U, 733239954U, 1555261956U, 3268935591U, 3050360625U,
|
||||
752459403U, 1541320221U, 2607071920U, 3965973030U, 1969922972U, 40735498U, 2617837225U, 3943577151U, 1913087877U, 83908371U,
|
||||
2512341634U, 3803740692U, 2075208622U, 213261112U, 2463272603U, 3855990285U, 2094854071U, 198958881U, 2262029012U, 4057260610U,
|
||||
1759359992U, 534414190U, 2176718541U, 4139329115U, 1873836001U, 414664567U, 2282248934U, 4279200368U, 1711684554U, 285281116U,
|
||||
2405801727U, 4167216745U, 1634467795U, 376229701U, 2685067896U, 3608007406U, 1308918612U, 956543938U, 2808555105U, 3495958263U,
|
||||
1231636301U, 1047427035U, 2932959818U, 3654703836U, 1088359270U, 936918000U, 2847714899U, 3736837829U, 1202900863U, 817233897U,
|
||||
3183342108U, 3401237130U, 1404277552U, 615818150U, 3134207493U, 3453421203U, 1423857449U, 601450431U, 3009837614U, 3294710456U,
|
||||
1567103746U, 711928724U, 3020668471U, 3272380065U, 1510334235U, 755167117U
|
||||
};
|
||||
|
||||
// Token: 0x0400006A RID: 106
|
||||
private uint crc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Checksums
|
||||
{
|
||||
// Token: 0x02000009 RID: 9
|
||||
public interface IChecksum
|
||||
{
|
||||
// Token: 0x1700000E RID: 14
|
||||
// (get) Token: 0x06000068 RID: 104
|
||||
long Value { get; }
|
||||
|
||||
// Token: 0x06000069 RID: 105
|
||||
void Reset();
|
||||
|
||||
// Token: 0x0600006A RID: 106
|
||||
void Update(int value);
|
||||
|
||||
// Token: 0x0600006B RID: 107
|
||||
void Update(byte[] buffer);
|
||||
|
||||
// Token: 0x0600006C RID: 108
|
||||
void Update(byte[] buffer, int offset, int count);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Checksums
|
||||
{
|
||||
// Token: 0x0200000C RID: 12
|
||||
public class StrangeCRC : IChecksum
|
||||
{
|
||||
// Token: 0x0600007C RID: 124 RVA: 0x00006784 File Offset: 0x00005784
|
||||
public StrangeCRC()
|
||||
{
|
||||
this.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x0600007D RID: 125 RVA: 0x00006792 File Offset: 0x00005792
|
||||
public void Reset()
|
||||
{
|
||||
this.globalCrc = -1;
|
||||
}
|
||||
|
||||
// Token: 0x17000011 RID: 17
|
||||
// (get) Token: 0x0600007E RID: 126 RVA: 0x0000679B File Offset: 0x0000579B
|
||||
public long Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return (long)(~(long)this.globalCrc);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600007F RID: 127 RVA: 0x000067A8 File Offset: 0x000057A8
|
||||
public void Update(int value)
|
||||
{
|
||||
int num = (this.globalCrc >> 24) ^ value;
|
||||
if (num < 0)
|
||||
{
|
||||
num = 256 + num;
|
||||
}
|
||||
this.globalCrc = (int)((long)((long)this.globalCrc << 8) ^ (long)((ulong)StrangeCRC.crc32Table[num]));
|
||||
}
|
||||
|
||||
// Token: 0x06000080 RID: 128 RVA: 0x000067E6 File Offset: 0x000057E6
|
||||
public void Update(byte[] buffer)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
this.Update(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
// Token: 0x06000081 RID: 129 RVA: 0x00006804 File Offset: 0x00005804
|
||||
public void Update(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "cannot be less than zero");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "cannot be less than zero");
|
||||
}
|
||||
if (offset + count > buffer.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
this.Update((int)buffer[offset++]);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400006B RID: 107
|
||||
private static readonly uint[] crc32Table = new uint[]
|
||||
{
|
||||
0U, 79764919U, 159529838U, 222504665U, 319059676U, 398814059U, 445009330U, 507990021U, 638119352U, 583659535U,
|
||||
797628118U, 726387553U, 890018660U, 835552979U, 1015980042U, 944750013U, 1276238704U, 1221641927U, 1167319070U, 1095957929U,
|
||||
1595256236U, 1540665371U, 1452775106U, 1381403509U, 1780037320U, 1859660671U, 1671105958U, 1733955601U, 2031960084U, 2111593891U,
|
||||
1889500026U, 1952343757U, 2552477408U, 2632100695U, 2443283854U, 2506133561U, 2334638140U, 2414271883U, 2191915858U, 2254759653U,
|
||||
3190512472U, 3135915759U, 3081330742U, 3009969537U, 2905550212U, 2850959411U, 2762807018U, 2691435357U, 3560074640U, 3505614887U,
|
||||
3719321342U, 3648080713U, 3342211916U, 3287746299U, 3467911202U, 3396681109U, 4063920168U, 4143685023U, 4223187782U, 4286162673U,
|
||||
3779000052U, 3858754371U, 3904687514U, 3967668269U, 881225847U, 809987520U, 1023691545U, 969234094U, 662832811U, 591600412U,
|
||||
771767749U, 717299826U, 311336399U, 374308984U, 453813921U, 533576470U, 25881363U, 88864420U, 134795389U, 214552010U,
|
||||
2023205639U, 2086057648U, 1897238633U, 1976864222U, 1804852699U, 1867694188U, 1645340341U, 1724971778U, 1587496639U, 1516133128U,
|
||||
1461550545U, 1406951526U, 1302016099U, 1230646740U, 1142491917U, 1087903418U, 2896545431U, 2825181984U, 2770861561U, 2716262478U,
|
||||
3215044683U, 3143675388U, 3055782693U, 3001194130U, 2326604591U, 2389456536U, 2200899649U, 2280525302U, 2578013683U, 2640855108U,
|
||||
2418763421U, 2498394922U, 3769900519U, 3832873040U, 3912640137U, 3992402750U, 4088425275U, 4151408268U, 4197601365U, 4277358050U,
|
||||
3334271071U, 3263032808U, 3476998961U, 3422541446U, 3585640067U, 3514407732U, 3694837229U, 3640369242U, 1762451694U, 1842216281U,
|
||||
1619975040U, 1682949687U, 2047383090U, 2127137669U, 1938468188U, 2001449195U, 1325665622U, 1271206113U, 1183200824U, 1111960463U,
|
||||
1543535498U, 1489069629U, 1434599652U, 1363369299U, 622672798U, 568075817U, 748617968U, 677256519U, 907627842U, 853037301U,
|
||||
1067152940U, 995781531U, 51762726U, 131386257U, 177728840U, 240578815U, 269590778U, 349224269U, 429104020U, 491947555U,
|
||||
4046411278U, 4126034873U, 4172115296U, 4234965207U, 3794477266U, 3874110821U, 3953728444U, 4016571915U, 3609705398U, 3555108353U,
|
||||
3735388376U, 3664026991U, 3290680682U, 3236090077U, 3449943556U, 3378572211U, 3174993278U, 3120533705U, 3032266256U, 2961025959U,
|
||||
2923101090U, 2868635157U, 2813903052U, 2742672763U, 2604032198U, 2683796849U, 2461293480U, 2524268063U, 2284983834U, 2364738477U,
|
||||
2175806836U, 2238787779U, 1569362073U, 1498123566U, 1409854455U, 1355396672U, 1317987909U, 1246755826U, 1192025387U, 1137557660U,
|
||||
2072149281U, 2135122070U, 1912620623U, 1992383480U, 1753615357U, 1816598090U, 1627664531U, 1707420964U, 295390185U, 358241886U,
|
||||
404320391U, 483945776U, 43990325U, 106832002U, 186451547U, 266083308U, 932423249U, 861060070U, 1041341759U, 986742920U,
|
||||
613929101U, 542559546U, 756411363U, 701822548U, 3316196985U, 3244833742U, 3425377559U, 3370778784U, 3601682597U, 3530312978U,
|
||||
3744426955U, 3689838204U, 3819031489U, 3881883254U, 3928223919U, 4007849240U, 4037393693U, 4100235434U, 4180117107U, 4259748804U,
|
||||
2310601993U, 2373574846U, 2151335527U, 2231098320U, 2596047829U, 2659030626U, 2470359227U, 2550115596U, 2947551409U, 2876312838U,
|
||||
2788305887U, 2733848168U, 3165939309U, 3094707162U, 3040238851U, 2985771188U
|
||||
};
|
||||
|
||||
// Token: 0x0400006C RID: 108
|
||||
private int globalCrc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x02000014 RID: 20
|
||||
// (Invoke) Token: 0x060000A2 RID: 162
|
||||
public delegate void CompletedFileHandler(object sender, ScanEventArgs e);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x0200000F RID: 15
|
||||
public class DirectoryEventArgs : ScanEventArgs
|
||||
{
|
||||
// Token: 0x0600008E RID: 142 RVA: 0x00006D46 File Offset: 0x00005D46
|
||||
public DirectoryEventArgs(string name, bool hasMatchingFiles)
|
||||
: base(name)
|
||||
{
|
||||
this.hasMatchingFiles_ = hasMatchingFiles;
|
||||
}
|
||||
|
||||
// Token: 0x17000019 RID: 25
|
||||
// (get) Token: 0x0600008F RID: 143 RVA: 0x00006D56 File Offset: 0x00005D56
|
||||
public bool HasMatchingFiles
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.hasMatchingFiles_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000073 RID: 115
|
||||
private bool hasMatchingFiles_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x02000015 RID: 21
|
||||
// (Invoke) Token: 0x060000A6 RID: 166
|
||||
public delegate void DirectoryFailureHandler(object sender, ScanFailureEventArgs e);
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x0200001C RID: 28
|
||||
public class ExtendedPathFilter : PathFilter
|
||||
{
|
||||
// Token: 0x060000C6 RID: 198 RVA: 0x00007493 File Offset: 0x00006493
|
||||
public ExtendedPathFilter(string filter, long minSize, long maxSize)
|
||||
: base(filter)
|
||||
{
|
||||
this.MinSize = minSize;
|
||||
this.MaxSize = maxSize;
|
||||
}
|
||||
|
||||
// Token: 0x060000C7 RID: 199 RVA: 0x000074CF File Offset: 0x000064CF
|
||||
public ExtendedPathFilter(string filter, DateTime minDate, DateTime maxDate)
|
||||
: base(filter)
|
||||
{
|
||||
this.MinDate = minDate;
|
||||
this.MaxDate = maxDate;
|
||||
}
|
||||
|
||||
// Token: 0x060000C8 RID: 200 RVA: 0x0000750C File Offset: 0x0000650C
|
||||
public ExtendedPathFilter(string filter, long minSize, long maxSize, DateTime minDate, DateTime maxDate)
|
||||
: base(filter)
|
||||
{
|
||||
this.MinSize = minSize;
|
||||
this.MaxSize = maxSize;
|
||||
this.MinDate = minDate;
|
||||
this.MaxDate = maxDate;
|
||||
}
|
||||
|
||||
// Token: 0x060000C9 RID: 201 RVA: 0x00007564 File Offset: 0x00006564
|
||||
public override bool IsMatch(string name)
|
||||
{
|
||||
bool flag = base.IsMatch(name);
|
||||
if (flag)
|
||||
{
|
||||
FileInfo fileInfo = new FileInfo(name);
|
||||
flag = this.MinSize <= fileInfo.Length && this.MaxSize >= fileInfo.Length && this.MinDate <= fileInfo.LastWriteTime && this.MaxDate >= fileInfo.LastWriteTime;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x1700001D RID: 29
|
||||
// (get) Token: 0x060000CA RID: 202 RVA: 0x000075C8 File Offset: 0x000065C8
|
||||
// (set) Token: 0x060000CB RID: 203 RVA: 0x000075D0 File Offset: 0x000065D0
|
||||
public long MinSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.minSize_;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0L || this.maxSize_ < value)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
this.minSize_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700001E RID: 30
|
||||
// (get) Token: 0x060000CC RID: 204 RVA: 0x000075F2 File Offset: 0x000065F2
|
||||
// (set) Token: 0x060000CD RID: 205 RVA: 0x000075FA File Offset: 0x000065FA
|
||||
public long MaxSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.maxSize_;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0L || this.minSize_ > value)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
this.maxSize_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700001F RID: 31
|
||||
// (get) Token: 0x060000CE RID: 206 RVA: 0x0000761C File Offset: 0x0000661C
|
||||
// (set) Token: 0x060000CF RID: 207 RVA: 0x00007624 File Offset: 0x00006624
|
||||
public DateTime MinDate
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.minDate_;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > this.maxDate_)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "Exceeds MaxDate");
|
||||
}
|
||||
this.minDate_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000020 RID: 32
|
||||
// (get) Token: 0x060000D0 RID: 208 RVA: 0x0000764B File Offset: 0x0000664B
|
||||
// (set) Token: 0x060000D1 RID: 209 RVA: 0x00007653 File Offset: 0x00006653
|
||||
public DateTime MaxDate
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.maxDate_;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.minDate_ > value)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "Exceeds MinDate");
|
||||
}
|
||||
this.maxDate_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000083 RID: 131
|
||||
private long minSize_;
|
||||
|
||||
// Token: 0x04000084 RID: 132
|
||||
private long maxSize_ = long.MaxValue;
|
||||
|
||||
// Token: 0x04000085 RID: 133
|
||||
private DateTime minDate_ = DateTime.MinValue;
|
||||
|
||||
// Token: 0x04000086 RID: 134
|
||||
private DateTime maxDate_ = DateTime.MaxValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x02000016 RID: 22
|
||||
// (Invoke) Token: 0x060000AA RID: 170
|
||||
public delegate void FileFailureHandler(object sender, ScanFailureEventArgs e);
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x02000017 RID: 23
|
||||
public class FileSystemScanner
|
||||
{
|
||||
// Token: 0x060000AD RID: 173 RVA: 0x00006D9C File Offset: 0x00005D9C
|
||||
public FileSystemScanner(string filter)
|
||||
{
|
||||
this.fileFilter_ = new PathFilter(filter);
|
||||
}
|
||||
|
||||
// Token: 0x060000AE RID: 174 RVA: 0x00006DB0 File Offset: 0x00005DB0
|
||||
public FileSystemScanner(string fileFilter, string directoryFilter)
|
||||
{
|
||||
this.fileFilter_ = new PathFilter(fileFilter);
|
||||
this.directoryFilter_ = new PathFilter(directoryFilter);
|
||||
}
|
||||
|
||||
// Token: 0x060000AF RID: 175 RVA: 0x00006DD0 File Offset: 0x00005DD0
|
||||
public FileSystemScanner(IScanFilter fileFilter)
|
||||
{
|
||||
this.fileFilter_ = fileFilter;
|
||||
}
|
||||
|
||||
// Token: 0x060000B0 RID: 176 RVA: 0x00006DDF File Offset: 0x00005DDF
|
||||
public FileSystemScanner(IScanFilter fileFilter, IScanFilter directoryFilter)
|
||||
{
|
||||
this.fileFilter_ = fileFilter;
|
||||
this.directoryFilter_ = directoryFilter;
|
||||
}
|
||||
|
||||
// Token: 0x060000B1 RID: 177 RVA: 0x00006DF8 File Offset: 0x00005DF8
|
||||
private bool OnDirectoryFailure(string directory, Exception e)
|
||||
{
|
||||
DirectoryFailureHandler directoryFailure = this.DirectoryFailure;
|
||||
bool flag = directoryFailure != null;
|
||||
if (flag)
|
||||
{
|
||||
ScanFailureEventArgs scanFailureEventArgs = new ScanFailureEventArgs(directory, e);
|
||||
directoryFailure(this, scanFailureEventArgs);
|
||||
this.alive_ = scanFailureEventArgs.ContinueRunning;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060000B2 RID: 178 RVA: 0x00006E34 File Offset: 0x00005E34
|
||||
private bool OnFileFailure(string file, Exception e)
|
||||
{
|
||||
FileFailureHandler fileFailure = this.FileFailure;
|
||||
bool flag = fileFailure != null;
|
||||
if (flag)
|
||||
{
|
||||
ScanFailureEventArgs scanFailureEventArgs = new ScanFailureEventArgs(file, e);
|
||||
this.FileFailure(this, scanFailureEventArgs);
|
||||
this.alive_ = scanFailureEventArgs.ContinueRunning;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060000B3 RID: 179 RVA: 0x00006E78 File Offset: 0x00005E78
|
||||
private void OnProcessFile(string file)
|
||||
{
|
||||
ProcessFileHandler processFile = this.ProcessFile;
|
||||
if (processFile != null)
|
||||
{
|
||||
ScanEventArgs scanEventArgs = new ScanEventArgs(file);
|
||||
processFile(this, scanEventArgs);
|
||||
this.alive_ = scanEventArgs.ContinueRunning;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000B4 RID: 180 RVA: 0x00006EAC File Offset: 0x00005EAC
|
||||
private void OnCompleteFile(string file)
|
||||
{
|
||||
CompletedFileHandler completedFile = this.CompletedFile;
|
||||
if (completedFile != null)
|
||||
{
|
||||
ScanEventArgs scanEventArgs = new ScanEventArgs(file);
|
||||
completedFile(this, scanEventArgs);
|
||||
this.alive_ = scanEventArgs.ContinueRunning;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000B5 RID: 181 RVA: 0x00006EE0 File Offset: 0x00005EE0
|
||||
private void OnProcessDirectory(string directory, bool hasMatchingFiles)
|
||||
{
|
||||
ProcessDirectoryHandler processDirectory = this.ProcessDirectory;
|
||||
if (processDirectory != null)
|
||||
{
|
||||
DirectoryEventArgs directoryEventArgs = new DirectoryEventArgs(directory, hasMatchingFiles);
|
||||
processDirectory(this, directoryEventArgs);
|
||||
this.alive_ = directoryEventArgs.ContinueRunning;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000B6 RID: 182 RVA: 0x00006F13 File Offset: 0x00005F13
|
||||
public void Scan(string directory, bool recurse)
|
||||
{
|
||||
this.alive_ = true;
|
||||
this.ScanDir(directory, recurse);
|
||||
}
|
||||
|
||||
// Token: 0x060000B7 RID: 183 RVA: 0x00006F24 File Offset: 0x00005F24
|
||||
private void ScanDir(string directory, bool recurse)
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] files = Directory.GetFiles(directory);
|
||||
bool flag = false;
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
if (!this.fileFilter_.IsMatch(files[i]))
|
||||
{
|
||||
files[i] = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
this.OnProcessDirectory(directory, flag);
|
||||
if (this.alive_ && flag)
|
||||
{
|
||||
foreach (string text in files)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (text != null)
|
||||
{
|
||||
this.OnProcessFile(text);
|
||||
if (!this.alive_)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!this.OnFileFailure(text, ex))
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
if (!this.OnDirectoryFailure(directory, ex2))
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
if (this.alive_ && recurse)
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] directories = Directory.GetDirectories(directory);
|
||||
foreach (string text2 in directories)
|
||||
{
|
||||
if (this.directoryFilter_ == null || this.directoryFilter_.IsMatch(text2))
|
||||
{
|
||||
this.ScanDir(text2, true);
|
||||
if (!this.alive_)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex3)
|
||||
{
|
||||
if (!this.OnDirectoryFailure(directory, ex3))
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000077 RID: 119
|
||||
public ProcessDirectoryHandler ProcessDirectory;
|
||||
|
||||
// Token: 0x04000078 RID: 120
|
||||
public ProcessFileHandler ProcessFile;
|
||||
|
||||
// Token: 0x04000079 RID: 121
|
||||
public CompletedFileHandler CompletedFile;
|
||||
|
||||
// Token: 0x0400007A RID: 122
|
||||
public DirectoryFailureHandler DirectoryFailure;
|
||||
|
||||
// Token: 0x0400007B RID: 123
|
||||
public FileFailureHandler FileFailure;
|
||||
|
||||
// Token: 0x0400007C RID: 124
|
||||
private IScanFilter fileFilter_;
|
||||
|
||||
// Token: 0x0400007D RID: 125
|
||||
private IScanFilter directoryFilter_;
|
||||
|
||||
// Token: 0x0400007E RID: 126
|
||||
private bool alive_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x02000018 RID: 24
|
||||
public interface INameTransform
|
||||
{
|
||||
// Token: 0x060000B8 RID: 184
|
||||
string TransformFile(string name);
|
||||
|
||||
// Token: 0x060000B9 RID: 185
|
||||
string TransformDirectory(string name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x02000019 RID: 25
|
||||
public interface IScanFilter
|
||||
{
|
||||
// Token: 0x060000BA RID: 186
|
||||
bool IsMatch(string name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x0200001D RID: 29
|
||||
[Obsolete("Use ExtendedPathFilter instead")]
|
||||
public class NameAndSizeFilter : PathFilter
|
||||
{
|
||||
// Token: 0x060000D2 RID: 210 RVA: 0x0000767A File Offset: 0x0000667A
|
||||
public NameAndSizeFilter(string filter, long minSize, long maxSize)
|
||||
: base(filter)
|
||||
{
|
||||
this.MinSize = minSize;
|
||||
this.MaxSize = maxSize;
|
||||
}
|
||||
|
||||
// Token: 0x060000D3 RID: 211 RVA: 0x000076A0 File Offset: 0x000066A0
|
||||
public override bool IsMatch(string name)
|
||||
{
|
||||
bool flag = base.IsMatch(name);
|
||||
if (flag)
|
||||
{
|
||||
FileInfo fileInfo = new FileInfo(name);
|
||||
long length = fileInfo.Length;
|
||||
flag = this.MinSize <= length && this.MaxSize >= length;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x17000021 RID: 33
|
||||
// (get) Token: 0x060000D4 RID: 212 RVA: 0x000076E0 File Offset: 0x000066E0
|
||||
// (set) Token: 0x060000D5 RID: 213 RVA: 0x000076E8 File Offset: 0x000066E8
|
||||
public long MinSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.minSize_;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0L || this.maxSize_ < value)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
this.minSize_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000022 RID: 34
|
||||
// (get) Token: 0x060000D6 RID: 214 RVA: 0x0000770A File Offset: 0x0000670A
|
||||
// (set) Token: 0x060000D7 RID: 215 RVA: 0x00007712 File Offset: 0x00006712
|
||||
public long MaxSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.maxSize_;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0L || this.minSize_ > value)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
this.maxSize_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000087 RID: 135
|
||||
private long minSize_;
|
||||
|
||||
// Token: 0x04000088 RID: 136
|
||||
private long maxSize_ = long.MaxValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x0200001A RID: 26
|
||||
public class NameFilter : IScanFilter
|
||||
{
|
||||
// Token: 0x060000BB RID: 187 RVA: 0x00007060 File Offset: 0x00006060
|
||||
public NameFilter(string filter)
|
||||
{
|
||||
this.filter_ = filter;
|
||||
this.inclusions_ = new ArrayList();
|
||||
this.exclusions_ = new ArrayList();
|
||||
this.Compile();
|
||||
}
|
||||
|
||||
// Token: 0x060000BC RID: 188 RVA: 0x0000708C File Offset: 0x0000608C
|
||||
public static bool IsValidExpression(string expression)
|
||||
{
|
||||
bool flag = true;
|
||||
try
|
||||
{
|
||||
new Regex(expression, RegexOptions.IgnoreCase | RegexOptions.Singleline);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060000BD RID: 189 RVA: 0x000070BC File Offset: 0x000060BC
|
||||
public static bool IsValidFilterExpression(string toTest)
|
||||
{
|
||||
if (toTest == null)
|
||||
{
|
||||
throw new ArgumentNullException("toTest");
|
||||
}
|
||||
bool flag = true;
|
||||
try
|
||||
{
|
||||
string[] array = NameFilter.SplitQuoted(toTest);
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
if (array[i] != null && array[i].Length > 0)
|
||||
{
|
||||
string text;
|
||||
if (array[i][0] == '+')
|
||||
{
|
||||
text = array[i].Substring(1, array[i].Length - 1);
|
||||
}
|
||||
else if (array[i][0] == '-')
|
||||
{
|
||||
text = array[i].Substring(1, array[i].Length - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
text = array[i];
|
||||
}
|
||||
new Regex(text, RegexOptions.IgnoreCase | RegexOptions.Singleline);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060000BE RID: 190 RVA: 0x0000716C File Offset: 0x0000616C
|
||||
public static string[] SplitQuoted(string original)
|
||||
{
|
||||
char c = '\\';
|
||||
char[] array = new char[] { ';' };
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (original != null && original.Length > 0)
|
||||
{
|
||||
int i = -1;
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
while (i < original.Length)
|
||||
{
|
||||
i++;
|
||||
if (i >= original.Length)
|
||||
{
|
||||
arrayList.Add(stringBuilder.ToString());
|
||||
}
|
||||
else if (original[i] == c)
|
||||
{
|
||||
i++;
|
||||
if (i >= original.Length)
|
||||
{
|
||||
throw new ArgumentException("Missing terminating escape character", "original");
|
||||
}
|
||||
if (Array.IndexOf<char>(array, original[i]) < 0)
|
||||
{
|
||||
stringBuilder.Append(c);
|
||||
}
|
||||
stringBuilder.Append(original[i]);
|
||||
}
|
||||
else if (Array.IndexOf<char>(array, original[i]) >= 0)
|
||||
{
|
||||
arrayList.Add(stringBuilder.ToString());
|
||||
stringBuilder.Length = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
stringBuilder.Append(original[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (string[])arrayList.ToArray(typeof(string));
|
||||
}
|
||||
|
||||
// Token: 0x060000BF RID: 191 RVA: 0x0000727C File Offset: 0x0000627C
|
||||
public override string ToString()
|
||||
{
|
||||
return this.filter_;
|
||||
}
|
||||
|
||||
// Token: 0x060000C0 RID: 192 RVA: 0x00007284 File Offset: 0x00006284
|
||||
public bool IsIncluded(string name)
|
||||
{
|
||||
bool flag = false;
|
||||
if (this.inclusions_.Count == 0)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (object obj in this.inclusions_)
|
||||
{
|
||||
Regex regex = (Regex)obj;
|
||||
if (regex.IsMatch(name))
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060000C1 RID: 193 RVA: 0x000072F8 File Offset: 0x000062F8
|
||||
public bool IsExcluded(string name)
|
||||
{
|
||||
bool flag = false;
|
||||
foreach (object obj in this.exclusions_)
|
||||
{
|
||||
Regex regex = (Regex)obj;
|
||||
if (regex.IsMatch(name))
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060000C2 RID: 194 RVA: 0x0000735C File Offset: 0x0000635C
|
||||
public bool IsMatch(string name)
|
||||
{
|
||||
return this.IsIncluded(name) && !this.IsExcluded(name);
|
||||
}
|
||||
|
||||
// Token: 0x060000C3 RID: 195 RVA: 0x00007374 File Offset: 0x00006374
|
||||
private void Compile()
|
||||
{
|
||||
if (this.filter_ == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string[] array = NameFilter.SplitQuoted(this.filter_);
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
if (array[i] != null && array[i].Length > 0)
|
||||
{
|
||||
bool flag = array[i][0] != '-';
|
||||
string text;
|
||||
if (array[i][0] == '+')
|
||||
{
|
||||
text = array[i].Substring(1, array[i].Length - 1);
|
||||
}
|
||||
else if (array[i][0] == '-')
|
||||
{
|
||||
text = array[i].Substring(1, array[i].Length - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
text = array[i];
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
this.inclusions_.Add(new Regex(text, (RegexOptions)25));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.exclusions_.Add(new Regex(text, (RegexOptions)25));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400007F RID: 127
|
||||
private string filter_;
|
||||
|
||||
// Token: 0x04000080 RID: 128
|
||||
private ArrayList inclusions_;
|
||||
|
||||
// Token: 0x04000081 RID: 129
|
||||
private ArrayList exclusions_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x0200001B RID: 27
|
||||
public class PathFilter : IScanFilter
|
||||
{
|
||||
// Token: 0x060000C4 RID: 196 RVA: 0x00007448 File Offset: 0x00006448
|
||||
public PathFilter(string filter)
|
||||
{
|
||||
this.nameFilter_ = new NameFilter(filter);
|
||||
}
|
||||
|
||||
// Token: 0x060000C5 RID: 197 RVA: 0x0000745C File Offset: 0x0000645C
|
||||
public virtual bool IsMatch(string name)
|
||||
{
|
||||
bool flag = false;
|
||||
if (name != null)
|
||||
{
|
||||
string text = ((name.Length > 0) ? Path.GetFullPath(name) : "");
|
||||
flag = this.nameFilter_.IsMatch(text);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x04000082 RID: 130
|
||||
private NameFilter nameFilter_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x02000011 RID: 17
|
||||
// (Invoke) Token: 0x06000096 RID: 150
|
||||
public delegate void ProcessDirectoryHandler(object sender, DirectoryEventArgs e);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x02000012 RID: 18
|
||||
// (Invoke) Token: 0x0600009A RID: 154
|
||||
public delegate void ProcessFileHandler(object sender, ScanEventArgs e);
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x0200000E RID: 14
|
||||
public class ProgressEventArgs : EventArgs
|
||||
{
|
||||
// Token: 0x06000087 RID: 135 RVA: 0x00006CC3 File Offset: 0x00005CC3
|
||||
public ProgressEventArgs(string name, long processed, long target)
|
||||
{
|
||||
this.name_ = name;
|
||||
this.processed_ = processed;
|
||||
this.target_ = target;
|
||||
}
|
||||
|
||||
// Token: 0x17000014 RID: 20
|
||||
// (get) Token: 0x06000088 RID: 136 RVA: 0x00006CE7 File Offset: 0x00005CE7
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000015 RID: 21
|
||||
// (get) Token: 0x06000089 RID: 137 RVA: 0x00006CEF File Offset: 0x00005CEF
|
||||
// (set) Token: 0x0600008A RID: 138 RVA: 0x00006CF7 File Offset: 0x00005CF7
|
||||
public bool ContinueRunning
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.continueRunning_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.continueRunning_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000016 RID: 22
|
||||
// (get) Token: 0x0600008B RID: 139 RVA: 0x00006D00 File Offset: 0x00005D00
|
||||
public float PercentComplete
|
||||
{
|
||||
get
|
||||
{
|
||||
float num;
|
||||
if (this.target_ <= 0L)
|
||||
{
|
||||
num = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = (float)this.processed_ / (float)this.target_ * 100f;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000017 RID: 23
|
||||
// (get) Token: 0x0600008C RID: 140 RVA: 0x00006D36 File Offset: 0x00005D36
|
||||
public long Processed
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.processed_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000018 RID: 24
|
||||
// (get) Token: 0x0600008D RID: 141 RVA: 0x00006D3E File Offset: 0x00005D3E
|
||||
public long Target
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.target_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400006F RID: 111
|
||||
private string name_;
|
||||
|
||||
// Token: 0x04000070 RID: 112
|
||||
private long processed_;
|
||||
|
||||
// Token: 0x04000071 RID: 113
|
||||
private long target_;
|
||||
|
||||
// Token: 0x04000072 RID: 114
|
||||
private bool continueRunning_ = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x02000013 RID: 19
|
||||
// (Invoke) Token: 0x0600009E RID: 158
|
||||
public delegate void ProgressHandler(object sender, ProgressEventArgs e);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x0200000D RID: 13
|
||||
public class ScanEventArgs : EventArgs
|
||||
{
|
||||
// Token: 0x06000083 RID: 131 RVA: 0x00006C94 File Offset: 0x00005C94
|
||||
public ScanEventArgs(string name)
|
||||
{
|
||||
this.name_ = name;
|
||||
}
|
||||
|
||||
// Token: 0x17000012 RID: 18
|
||||
// (get) Token: 0x06000084 RID: 132 RVA: 0x00006CAA File Offset: 0x00005CAA
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000013 RID: 19
|
||||
// (get) Token: 0x06000085 RID: 133 RVA: 0x00006CB2 File Offset: 0x00005CB2
|
||||
// (set) Token: 0x06000086 RID: 134 RVA: 0x00006CBA File Offset: 0x00005CBA
|
||||
public bool ContinueRunning
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.continueRunning_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.continueRunning_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400006D RID: 109
|
||||
private string name_;
|
||||
|
||||
// Token: 0x0400006E RID: 110
|
||||
private bool continueRunning_ = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x02000010 RID: 16
|
||||
public class ScanFailureEventArgs : EventArgs
|
||||
{
|
||||
// Token: 0x06000090 RID: 144 RVA: 0x00006D5E File Offset: 0x00005D5E
|
||||
public ScanFailureEventArgs(string name, Exception e)
|
||||
{
|
||||
this.name_ = name;
|
||||
this.exception_ = e;
|
||||
this.continueRunning_ = true;
|
||||
}
|
||||
|
||||
// Token: 0x1700001A RID: 26
|
||||
// (get) Token: 0x06000091 RID: 145 RVA: 0x00006D7B File Offset: 0x00005D7B
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700001B RID: 27
|
||||
// (get) Token: 0x06000092 RID: 146 RVA: 0x00006D83 File Offset: 0x00005D83
|
||||
public Exception Exception
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.exception_;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700001C RID: 28
|
||||
// (get) Token: 0x06000093 RID: 147 RVA: 0x00006D8B File Offset: 0x00005D8B
|
||||
// (set) Token: 0x06000094 RID: 148 RVA: 0x00006D93 File Offset: 0x00005D93
|
||||
public bool ContinueRunning
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.continueRunning_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.continueRunning_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000074 RID: 116
|
||||
private string name_;
|
||||
|
||||
// Token: 0x04000075 RID: 117
|
||||
private Exception exception_;
|
||||
|
||||
// Token: 0x04000076 RID: 118
|
||||
private bool continueRunning_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x0200001E RID: 30
|
||||
public sealed class StreamUtils
|
||||
{
|
||||
// Token: 0x060000D8 RID: 216 RVA: 0x00007734 File Offset: 0x00006734
|
||||
public static void ReadFully(Stream stream, byte[] buffer)
|
||||
{
|
||||
StreamUtils.ReadFully(stream, buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
// Token: 0x060000D9 RID: 217 RVA: 0x00007744 File Offset: 0x00006744
|
||||
public static void ReadFully(Stream stream, byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ArgumentNullException("stream");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (offset < 0 || offset > buffer.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset");
|
||||
}
|
||||
if (count < 0 || offset + count > buffer.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
while (count > 0)
|
||||
{
|
||||
int num = stream.Read(buffer, offset, count);
|
||||
if (num <= 0)
|
||||
{
|
||||
throw new EndOfStreamException();
|
||||
}
|
||||
offset += num;
|
||||
count -= num;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000DA RID: 218 RVA: 0x000077BC File Offset: 0x000067BC
|
||||
public static void Copy(Stream source, Stream destination, byte[] buffer)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (destination == null)
|
||||
{
|
||||
throw new ArgumentNullException("destination");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (buffer.Length < 128)
|
||||
{
|
||||
throw new ArgumentException("Buffer is too small", "buffer");
|
||||
}
|
||||
bool flag = true;
|
||||
while (flag)
|
||||
{
|
||||
int num = source.Read(buffer, 0, buffer.Length);
|
||||
if (num > 0)
|
||||
{
|
||||
destination.Write(buffer, 0, num);
|
||||
}
|
||||
else
|
||||
{
|
||||
destination.Flush();
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000DB RID: 219 RVA: 0x00007837 File Offset: 0x00006837
|
||||
public static void Copy(Stream source, Stream destination, byte[] buffer, ProgressHandler progressHandler, TimeSpan updateInterval, object sender, string name)
|
||||
{
|
||||
StreamUtils.Copy(source, destination, buffer, progressHandler, updateInterval, sender, name, -1L);
|
||||
}
|
||||
|
||||
// Token: 0x060000DC RID: 220 RVA: 0x0000784C File Offset: 0x0000684C
|
||||
public static void Copy(Stream source, Stream destination, byte[] buffer, ProgressHandler progressHandler, TimeSpan updateInterval, object sender, string name, long fixedTarget)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (destination == null)
|
||||
{
|
||||
throw new ArgumentNullException("destination");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (buffer.Length < 128)
|
||||
{
|
||||
throw new ArgumentException("Buffer is too small", "buffer");
|
||||
}
|
||||
if (progressHandler == null)
|
||||
{
|
||||
throw new ArgumentNullException("progressHandler");
|
||||
}
|
||||
bool flag = true;
|
||||
DateTime dateTime = DateTime.Now;
|
||||
long num = 0L;
|
||||
long num2 = 0L;
|
||||
if (fixedTarget >= 0L)
|
||||
{
|
||||
num2 = fixedTarget;
|
||||
}
|
||||
else if (source.CanSeek)
|
||||
{
|
||||
num2 = source.Length - source.Position;
|
||||
}
|
||||
ProgressEventArgs progressEventArgs = new ProgressEventArgs(name, num, num2);
|
||||
progressHandler(sender, progressEventArgs);
|
||||
bool flag2 = true;
|
||||
while (flag)
|
||||
{
|
||||
int num3 = source.Read(buffer, 0, buffer.Length);
|
||||
if (num3 > 0)
|
||||
{
|
||||
num += (long)num3;
|
||||
flag2 = false;
|
||||
destination.Write(buffer, 0, num3);
|
||||
}
|
||||
else
|
||||
{
|
||||
destination.Flush();
|
||||
flag = false;
|
||||
}
|
||||
if (DateTime.Now - dateTime > updateInterval)
|
||||
{
|
||||
flag2 = true;
|
||||
dateTime = DateTime.Now;
|
||||
progressEventArgs = new ProgressEventArgs(name, num, num2);
|
||||
progressHandler(sender, progressEventArgs);
|
||||
flag = progressEventArgs.ContinueRunning;
|
||||
}
|
||||
}
|
||||
if (!flag2)
|
||||
{
|
||||
progressEventArgs = new ProgressEventArgs(name, num, num2);
|
||||
progressHandler(sender, progressEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000DD RID: 221 RVA: 0x00007979 File Offset: 0x00006979
|
||||
private StreamUtils()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Core
|
||||
{
|
||||
// Token: 0x0200001F RID: 31
|
||||
public abstract class WindowsPathUtils
|
||||
{
|
||||
// Token: 0x060000DE RID: 222 RVA: 0x00007981 File Offset: 0x00006981
|
||||
internal WindowsPathUtils()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060000DF RID: 223 RVA: 0x0000798C File Offset: 0x0000698C
|
||||
public static string DropPathRoot(string path)
|
||||
{
|
||||
string text = path;
|
||||
if (path != null && path.Length > 0)
|
||||
{
|
||||
if (path[0] == '\\' || path[0] == '/')
|
||||
{
|
||||
if (path.Length > 1 && (path[1] == '\\' || path[1] == '/'))
|
||||
{
|
||||
int num = 2;
|
||||
int num2 = 2;
|
||||
while (num <= path.Length && ((path[num] != '\\' && path[num] != '/') || --num2 > 0))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
num++;
|
||||
if (num < path.Length)
|
||||
{
|
||||
text = path.Substring(num);
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (path.Length > 1 && path[1] == ':')
|
||||
{
|
||||
int num3 = 2;
|
||||
if (path.Length > 2 && (path[2] == '\\' || path[2] == '/'))
|
||||
{
|
||||
num3 = 3;
|
||||
}
|
||||
text = text.Remove(0, num3);
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using ICSharpCode.SharpZipLib.Checksums;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Encryption
|
||||
{
|
||||
// Token: 0x02000020 RID: 32
|
||||
public abstract class PkzipClassic : SymmetricAlgorithm
|
||||
{
|
||||
// Token: 0x060000E0 RID: 224 RVA: 0x00007A8C File Offset: 0x00006A8C
|
||||
public static byte[] GenerateKeys(byte[] seed)
|
||||
{
|
||||
if (seed == null)
|
||||
{
|
||||
throw new ArgumentNullException("seed");
|
||||
}
|
||||
if (seed.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("Length is zero", "seed");
|
||||
}
|
||||
uint[] array = new uint[] { 305419896U, 591751049U, 878082192U };
|
||||
for (int i = 0; i < seed.Length; i++)
|
||||
{
|
||||
array[0] = Crc32.ComputeCrc32(array[0], seed[i]);
|
||||
array[1] = array[1] + (uint)((byte)array[0]);
|
||||
array[1] = array[1] * 134775813U + 1U;
|
||||
array[2] = Crc32.ComputeCrc32(array[2], (byte)(array[1] >> 24));
|
||||
}
|
||||
return new byte[]
|
||||
{
|
||||
(byte)(array[0] & 255U),
|
||||
(byte)((array[0] >> 8) & 255U),
|
||||
(byte)((array[0] >> 16) & 255U),
|
||||
(byte)((array[0] >> 24) & 255U),
|
||||
(byte)(array[1] & 255U),
|
||||
(byte)((array[1] >> 8) & 255U),
|
||||
(byte)((array[1] >> 16) & 255U),
|
||||
(byte)((array[1] >> 24) & 255U),
|
||||
(byte)(array[2] & 255U),
|
||||
(byte)((array[2] >> 8) & 255U),
|
||||
(byte)((array[2] >> 16) & 255U),
|
||||
(byte)((array[2] >> 24) & 255U)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using ICSharpCode.SharpZipLib.Checksums;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Encryption
|
||||
{
|
||||
// Token: 0x02000021 RID: 33
|
||||
internal class PkzipClassicCryptoBase
|
||||
{
|
||||
// Token: 0x060000E2 RID: 226 RVA: 0x00007BE0 File Offset: 0x00006BE0
|
||||
protected byte TransformByte()
|
||||
{
|
||||
uint num = (this.keys[2] & 65535U) | 2U;
|
||||
return (byte)(num * (num ^ 1U) >> 8);
|
||||
}
|
||||
|
||||
// Token: 0x060000E3 RID: 227 RVA: 0x00007C08 File Offset: 0x00006C08
|
||||
protected void SetKeys(byte[] keyData)
|
||||
{
|
||||
if (keyData == null)
|
||||
{
|
||||
throw new ArgumentNullException("keyData");
|
||||
}
|
||||
if (keyData.Length != 12)
|
||||
{
|
||||
throw new InvalidOperationException("Key length is not valid");
|
||||
}
|
||||
this.keys = new uint[3];
|
||||
this.keys[0] = (uint)(((int)keyData[3] << 24) | ((int)keyData[2] << 16) | ((int)keyData[1] << 8) | (int)keyData[0]);
|
||||
this.keys[1] = (uint)(((int)keyData[7] << 24) | ((int)keyData[6] << 16) | ((int)keyData[5] << 8) | (int)keyData[4]);
|
||||
this.keys[2] = (uint)(((int)keyData[11] << 24) | ((int)keyData[10] << 16) | ((int)keyData[9] << 8) | (int)keyData[8]);
|
||||
}
|
||||
|
||||
// Token: 0x060000E4 RID: 228 RVA: 0x00007CA4 File Offset: 0x00006CA4
|
||||
protected void UpdateKeys(byte ch)
|
||||
{
|
||||
this.keys[0] = Crc32.ComputeCrc32(this.keys[0], ch);
|
||||
this.keys[1] = this.keys[1] + (uint)((byte)this.keys[0]);
|
||||
this.keys[1] = this.keys[1] * 134775813U + 1U;
|
||||
this.keys[2] = Crc32.ComputeCrc32(this.keys[2], (byte)(this.keys[1] >> 24));
|
||||
}
|
||||
|
||||
// Token: 0x060000E5 RID: 229 RVA: 0x00007D1A File Offset: 0x00006D1A
|
||||
protected void Reset()
|
||||
{
|
||||
this.keys[0] = 0U;
|
||||
this.keys[1] = 0U;
|
||||
this.keys[2] = 0U;
|
||||
}
|
||||
|
||||
// Token: 0x04000089 RID: 137
|
||||
private uint[] keys;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Encryption
|
||||
{
|
||||
// Token: 0x02000023 RID: 35
|
||||
internal class PkzipClassicDecryptCryptoTransform : PkzipClassicCryptoBase, ICryptoTransform, IDisposable
|
||||
{
|
||||
// Token: 0x060000EF RID: 239 RVA: 0x00007DC4 File Offset: 0x00006DC4
|
||||
internal PkzipClassicDecryptCryptoTransform(byte[] keyBlock)
|
||||
{
|
||||
base.SetKeys(keyBlock);
|
||||
}
|
||||
|
||||
// Token: 0x060000F0 RID: 240 RVA: 0x00007DD4 File Offset: 0x00006DD4
|
||||
public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
{
|
||||
byte[] array = new byte[inputCount];
|
||||
this.TransformBlock(inputBuffer, inputOffset, inputCount, array, 0);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060000F1 RID: 241 RVA: 0x00007DF8 File Offset: 0x00006DF8
|
||||
public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
|
||||
{
|
||||
for (int i = inputOffset; i < inputOffset + inputCount; i++)
|
||||
{
|
||||
byte b = inputBuffer[i] ^ base.TransformByte();
|
||||
outputBuffer[outputOffset++] = b;
|
||||
base.UpdateKeys(b);
|
||||
}
|
||||
return inputCount;
|
||||
}
|
||||
|
||||
// Token: 0x17000027 RID: 39
|
||||
// (get) Token: 0x060000F2 RID: 242 RVA: 0x00007E32 File Offset: 0x00006E32
|
||||
public bool CanReuseTransform
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000028 RID: 40
|
||||
// (get) Token: 0x060000F3 RID: 243 RVA: 0x00007E35 File Offset: 0x00006E35
|
||||
public int InputBlockSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000029 RID: 41
|
||||
// (get) Token: 0x060000F4 RID: 244 RVA: 0x00007E38 File Offset: 0x00006E38
|
||||
public int OutputBlockSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700002A RID: 42
|
||||
// (get) Token: 0x060000F5 RID: 245 RVA: 0x00007E3B File Offset: 0x00006E3B
|
||||
public bool CanTransformMultipleBlocks
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000F6 RID: 246 RVA: 0x00007E3E File Offset: 0x00006E3E
|
||||
public void Dispose()
|
||||
{
|
||||
base.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Encryption
|
||||
{
|
||||
// Token: 0x02000022 RID: 34
|
||||
internal class PkzipClassicEncryptCryptoTransform : PkzipClassicCryptoBase, ICryptoTransform, IDisposable
|
||||
{
|
||||
// Token: 0x060000E7 RID: 231 RVA: 0x00007D3F File Offset: 0x00006D3F
|
||||
internal PkzipClassicEncryptCryptoTransform(byte[] keyBlock)
|
||||
{
|
||||
base.SetKeys(keyBlock);
|
||||
}
|
||||
|
||||
// Token: 0x060000E8 RID: 232 RVA: 0x00007D50 File Offset: 0x00006D50
|
||||
public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
{
|
||||
byte[] array = new byte[inputCount];
|
||||
this.TransformBlock(inputBuffer, inputOffset, inputCount, array, 0);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060000E9 RID: 233 RVA: 0x00007D74 File Offset: 0x00006D74
|
||||
public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
|
||||
{
|
||||
for (int i = inputOffset; i < inputOffset + inputCount; i++)
|
||||
{
|
||||
byte b = inputBuffer[i];
|
||||
outputBuffer[outputOffset++] = inputBuffer[i] ^ base.TransformByte();
|
||||
base.UpdateKeys(b);
|
||||
}
|
||||
return inputCount;
|
||||
}
|
||||
|
||||
// Token: 0x17000023 RID: 35
|
||||
// (get) Token: 0x060000EA RID: 234 RVA: 0x00007DB0 File Offset: 0x00006DB0
|
||||
public bool CanReuseTransform
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000024 RID: 36
|
||||
// (get) Token: 0x060000EB RID: 235 RVA: 0x00007DB3 File Offset: 0x00006DB3
|
||||
public int InputBlockSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000025 RID: 37
|
||||
// (get) Token: 0x060000EC RID: 236 RVA: 0x00007DB6 File Offset: 0x00006DB6
|
||||
public int OutputBlockSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000026 RID: 38
|
||||
// (get) Token: 0x060000ED RID: 237 RVA: 0x00007DB9 File Offset: 0x00006DB9
|
||||
public bool CanTransformMultipleBlocks
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000EE RID: 238 RVA: 0x00007DBC File Offset: 0x00006DBC
|
||||
public void Dispose()
|
||||
{
|
||||
base.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Encryption
|
||||
{
|
||||
// Token: 0x02000024 RID: 36
|
||||
public sealed class PkzipClassicManaged : PkzipClassic
|
||||
{
|
||||
// Token: 0x1700002B RID: 43
|
||||
// (get) Token: 0x060000F7 RID: 247 RVA: 0x00007E46 File Offset: 0x00006E46
|
||||
// (set) Token: 0x060000F8 RID: 248 RVA: 0x00007E49 File Offset: 0x00006E49
|
||||
public override int BlockSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != 8)
|
||||
{
|
||||
throw new CryptographicException("Block size is invalid");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700002C RID: 44
|
||||
// (get) Token: 0x060000F9 RID: 249 RVA: 0x00007E5C File Offset: 0x00006E5C
|
||||
public override KeySizes[] LegalKeySizes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new KeySizes[]
|
||||
{
|
||||
new KeySizes(96, 96, 0)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000FA RID: 250 RVA: 0x00007E7E File Offset: 0x00006E7E
|
||||
public override void GenerateIV()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x1700002D RID: 45
|
||||
// (get) Token: 0x060000FB RID: 251 RVA: 0x00007E80 File Offset: 0x00006E80
|
||||
public override KeySizes[] LegalBlockSizes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new KeySizes[]
|
||||
{
|
||||
new KeySizes(8, 8, 0)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700002E RID: 46
|
||||
// (get) Token: 0x060000FC RID: 252 RVA: 0x00007EA0 File Offset: 0x00006EA0
|
||||
// (set) Token: 0x060000FD RID: 253 RVA: 0x00007EC0 File Offset: 0x00006EC0
|
||||
public override byte[] Key
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.key_ == null)
|
||||
{
|
||||
this.GenerateKey();
|
||||
}
|
||||
return (byte[])this.key_.Clone();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
if (value.Length != 12)
|
||||
{
|
||||
throw new CryptographicException("Key size is illegal");
|
||||
}
|
||||
this.key_ = (byte[])value.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000FE RID: 254 RVA: 0x00007EF4 File Offset: 0x00006EF4
|
||||
public override void GenerateKey()
|
||||
{
|
||||
this.key_ = new byte[12];
|
||||
Random random = new Random();
|
||||
random.NextBytes(this.key_);
|
||||
}
|
||||
|
||||
// Token: 0x060000FF RID: 255 RVA: 0x00007F20 File Offset: 0x00006F20
|
||||
public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV)
|
||||
{
|
||||
this.key_ = rgbKey;
|
||||
return new PkzipClassicEncryptCryptoTransform(this.Key);
|
||||
}
|
||||
|
||||
// Token: 0x06000100 RID: 256 RVA: 0x00007F34 File Offset: 0x00006F34
|
||||
public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV)
|
||||
{
|
||||
this.key_ = rgbKey;
|
||||
return new PkzipClassicDecryptCryptoTransform(this.Key);
|
||||
}
|
||||
|
||||
// Token: 0x0400008A RID: 138
|
||||
private byte[] key_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Encryption
|
||||
{
|
||||
// Token: 0x02000025 RID: 37
|
||||
internal class ZipAESStream : CryptoStream
|
||||
{
|
||||
// Token: 0x06000102 RID: 258 RVA: 0x00007F50 File Offset: 0x00006F50
|
||||
public ZipAESStream(Stream stream, ZipAESTransform transform, CryptoStreamMode mode)
|
||||
: base(stream, transform, mode)
|
||||
{
|
||||
this._stream = stream;
|
||||
this._transform = transform;
|
||||
this._slideBuffer = new byte[1024];
|
||||
this._blockAndAuth = 26;
|
||||
if (mode != CryptoStreamMode.Read)
|
||||
{
|
||||
throw new Exception("ZipAESStream only for read");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000103 RID: 259 RVA: 0x00007F90 File Offset: 0x00006F90
|
||||
public override int Read(byte[] outBuffer, int offset, int count)
|
||||
{
|
||||
int i = 0;
|
||||
while (i < count)
|
||||
{
|
||||
int num = this._slideBufFreePos - this._slideBufStartPos;
|
||||
int num2 = this._blockAndAuth - num;
|
||||
if (this._slideBuffer.Length - this._slideBufFreePos < num2)
|
||||
{
|
||||
int num3 = 0;
|
||||
int j = this._slideBufStartPos;
|
||||
while (j < this._slideBufFreePos)
|
||||
{
|
||||
this._slideBuffer[num3] = this._slideBuffer[j];
|
||||
j++;
|
||||
num3++;
|
||||
}
|
||||
this._slideBufFreePos -= this._slideBufStartPos;
|
||||
this._slideBufStartPos = 0;
|
||||
}
|
||||
int num4 = this._stream.Read(this._slideBuffer, this._slideBufFreePos, num2);
|
||||
this._slideBufFreePos += num4;
|
||||
num = this._slideBufFreePos - this._slideBufStartPos;
|
||||
if (num < this._blockAndAuth)
|
||||
{
|
||||
if (num > 10)
|
||||
{
|
||||
int num5 = num - 10;
|
||||
this._transform.TransformBlock(this._slideBuffer, this._slideBufStartPos, num5, outBuffer, offset);
|
||||
i += num5;
|
||||
this._slideBufStartPos += num5;
|
||||
}
|
||||
else if (num < 10)
|
||||
{
|
||||
throw new Exception("Internal error missed auth code");
|
||||
}
|
||||
byte[] authCode = this._transform.GetAuthCode();
|
||||
for (int k = 0; k < 10; k++)
|
||||
{
|
||||
if (authCode[k] != this._slideBuffer[this._slideBufStartPos + k])
|
||||
{
|
||||
throw new Exception("AES Authentication Code does not match. This is a super-CRC check on the data in the file after compression and encryption. \r\nThe file may be damaged.");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
this._transform.TransformBlock(this._slideBuffer, this._slideBufStartPos, 16, outBuffer, offset);
|
||||
i += 16;
|
||||
offset += 16;
|
||||
this._slideBufStartPos += 16;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
// Token: 0x06000104 RID: 260 RVA: 0x0000812A File Offset: 0x0000712A
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Token: 0x0400008B RID: 139
|
||||
private const int AUTH_CODE_LENGTH = 10;
|
||||
|
||||
// Token: 0x0400008C RID: 140
|
||||
private const int CRYPTO_BLOCK_SIZE = 16;
|
||||
|
||||
// Token: 0x0400008D RID: 141
|
||||
private Stream _stream;
|
||||
|
||||
// Token: 0x0400008E RID: 142
|
||||
private ZipAESTransform _transform;
|
||||
|
||||
// Token: 0x0400008F RID: 143
|
||||
private byte[] _slideBuffer;
|
||||
|
||||
// Token: 0x04000090 RID: 144
|
||||
private int _slideBufStartPos;
|
||||
|
||||
// Token: 0x04000091 RID: 145
|
||||
private int _slideBufFreePos;
|
||||
|
||||
// Token: 0x04000092 RID: 146
|
||||
private int _blockAndAuth;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Encryption
|
||||
{
|
||||
// Token: 0x02000026 RID: 38
|
||||
internal class ZipAESTransform : ICryptoTransform, IDisposable
|
||||
{
|
||||
// Token: 0x06000105 RID: 261 RVA: 0x00008134 File Offset: 0x00007134
|
||||
public ZipAESTransform(string key, byte[] saltBytes, int blockSize, bool writeMode)
|
||||
{
|
||||
if (blockSize != 16 && blockSize != 32)
|
||||
{
|
||||
throw new Exception("Invalid blocksize " + blockSize + ". Must be 16 or 32.");
|
||||
}
|
||||
if (saltBytes.Length != blockSize / 2)
|
||||
{
|
||||
throw new Exception(string.Concat(new object[]
|
||||
{
|
||||
"Invalid salt len. Must be ",
|
||||
blockSize / 2,
|
||||
" for blocksize ",
|
||||
blockSize
|
||||
}));
|
||||
}
|
||||
this._blockSize = blockSize;
|
||||
this._encryptBuffer = new byte[this._blockSize];
|
||||
this._encrPos = 16;
|
||||
Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(key, saltBytes, 1000);
|
||||
RijndaelManaged rijndaelManaged = new RijndaelManaged();
|
||||
rijndaelManaged.Mode = CipherMode.ECB;
|
||||
this._counterNonce = new byte[this._blockSize];
|
||||
byte[] bytes = rfc2898DeriveBytes.GetBytes(this._blockSize);
|
||||
byte[] bytes2 = rfc2898DeriveBytes.GetBytes(this._blockSize);
|
||||
this._encryptor = rijndaelManaged.CreateEncryptor(bytes, bytes2);
|
||||
this._pwdVerifier = rfc2898DeriveBytes.GetBytes(2);
|
||||
this._hmacsha1 = new HMACSHA1(bytes2);
|
||||
this._writeMode = writeMode;
|
||||
}
|
||||
|
||||
// Token: 0x06000106 RID: 262 RVA: 0x00008248 File Offset: 0x00007248
|
||||
public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
|
||||
{
|
||||
if (!this._writeMode)
|
||||
{
|
||||
this._hmacsha1.TransformBlock(inputBuffer, inputOffset, inputCount, inputBuffer, inputOffset);
|
||||
}
|
||||
for (int i = 0; i < inputCount; i++)
|
||||
{
|
||||
if (this._encrPos == 16)
|
||||
{
|
||||
int num = 0;
|
||||
for (;;)
|
||||
{
|
||||
byte[] counterNonce = this._counterNonce;
|
||||
int num2 = num;
|
||||
if ((counterNonce[num2] += 1) != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
this._encryptor.TransformBlock(this._counterNonce, 0, this._blockSize, this._encryptBuffer, 0);
|
||||
this._encrPos = 0;
|
||||
}
|
||||
outputBuffer[i + outputOffset] = inputBuffer[i + inputOffset] ^ this._encryptBuffer[this._encrPos++];
|
||||
}
|
||||
if (this._writeMode)
|
||||
{
|
||||
this._hmacsha1.TransformBlock(outputBuffer, outputOffset, inputCount, outputBuffer, outputOffset);
|
||||
}
|
||||
return inputCount;
|
||||
}
|
||||
|
||||
// Token: 0x1700002F RID: 47
|
||||
// (get) Token: 0x06000107 RID: 263 RVA: 0x0000831C File Offset: 0x0000731C
|
||||
public byte[] PwdVerifier
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._pwdVerifier;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000108 RID: 264 RVA: 0x00008324 File Offset: 0x00007324
|
||||
public byte[] GetAuthCode()
|
||||
{
|
||||
if (!this._finalised)
|
||||
{
|
||||
byte[] array = new byte[0];
|
||||
this._hmacsha1.TransformFinalBlock(array, 0, 0);
|
||||
this._finalised = true;
|
||||
}
|
||||
return this._hmacsha1.Hash;
|
||||
}
|
||||
|
||||
// Token: 0x06000109 RID: 265 RVA: 0x00008361 File Offset: 0x00007361
|
||||
public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
{
|
||||
throw new NotImplementedException("ZipAESTransform.TransformFinalBlock");
|
||||
}
|
||||
|
||||
// Token: 0x17000030 RID: 48
|
||||
// (get) Token: 0x0600010A RID: 266 RVA: 0x0000836D File Offset: 0x0000736D
|
||||
public int InputBlockSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._blockSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000031 RID: 49
|
||||
// (get) Token: 0x0600010B RID: 267 RVA: 0x00008375 File Offset: 0x00007375
|
||||
public int OutputBlockSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._blockSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000032 RID: 50
|
||||
// (get) Token: 0x0600010C RID: 268 RVA: 0x0000837D File Offset: 0x0000737D
|
||||
public bool CanTransformMultipleBlocks
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000033 RID: 51
|
||||
// (get) Token: 0x0600010D RID: 269 RVA: 0x00008380 File Offset: 0x00007380
|
||||
public bool CanReuseTransform
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600010E RID: 270 RVA: 0x00008383 File Offset: 0x00007383
|
||||
public void Dispose()
|
||||
{
|
||||
this._encryptor.Dispose();
|
||||
}
|
||||
|
||||
// Token: 0x04000093 RID: 147
|
||||
private const int PWD_VER_LENGTH = 2;
|
||||
|
||||
// Token: 0x04000094 RID: 148
|
||||
private const int KEY_ROUNDS = 1000;
|
||||
|
||||
// Token: 0x04000095 RID: 149
|
||||
private const int ENCRYPT_BLOCK = 16;
|
||||
|
||||
// Token: 0x04000096 RID: 150
|
||||
private int _blockSize;
|
||||
|
||||
// Token: 0x04000097 RID: 151
|
||||
private ICryptoTransform _encryptor;
|
||||
|
||||
// Token: 0x04000098 RID: 152
|
||||
private readonly byte[] _counterNonce;
|
||||
|
||||
// Token: 0x04000099 RID: 153
|
||||
private byte[] _encryptBuffer;
|
||||
|
||||
// Token: 0x0400009A RID: 154
|
||||
private int _encrPos;
|
||||
|
||||
// Token: 0x0400009B RID: 155
|
||||
private byte[] _pwdVerifier;
|
||||
|
||||
// Token: 0x0400009C RID: 156
|
||||
private HMACSHA1 _hmacsha1;
|
||||
|
||||
// Token: 0x0400009D RID: 157
|
||||
private bool _finalised;
|
||||
|
||||
// Token: 0x0400009E RID: 158
|
||||
private bool _writeMode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.GZip
|
||||
{
|
||||
// Token: 0x02000027 RID: 39
|
||||
public sealed class GZipConstants
|
||||
{
|
||||
// Token: 0x0600010F RID: 271 RVA: 0x00008390 File Offset: 0x00007390
|
||||
private GZipConstants()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0400009F RID: 159
|
||||
public const int GZIP_MAGIC = 8075;
|
||||
|
||||
// Token: 0x040000A0 RID: 160
|
||||
public const int FTEXT = 1;
|
||||
|
||||
// Token: 0x040000A1 RID: 161
|
||||
public const int FHCRC = 2;
|
||||
|
||||
// Token: 0x040000A2 RID: 162
|
||||
public const int FEXTRA = 4;
|
||||
|
||||
// Token: 0x040000A3 RID: 163
|
||||
public const int FNAME = 8;
|
||||
|
||||
// Token: 0x040000A4 RID: 164
|
||||
public const int FCOMMENT = 16;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.GZip
|
||||
{
|
||||
// Token: 0x02000028 RID: 40
|
||||
[Serializable]
|
||||
public class GZipException : SharpZipBaseException
|
||||
{
|
||||
// Token: 0x06000110 RID: 272 RVA: 0x00008398 File Offset: 0x00007398
|
||||
protected GZipException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000111 RID: 273 RVA: 0x000083A2 File Offset: 0x000073A2
|
||||
public GZipException()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000112 RID: 274 RVA: 0x000083AA File Offset: 0x000073AA
|
||||
public GZipException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000113 RID: 275 RVA: 0x000083B3 File Offset: 0x000073B3
|
||||
public GZipException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using ICSharpCode.SharpZipLib.Checksums;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.GZip
|
||||
{
|
||||
// Token: 0x0200002A RID: 42
|
||||
public class GZipInputStream : InflaterInputStream
|
||||
{
|
||||
// Token: 0x0600012B RID: 299 RVA: 0x00008661 File Offset: 0x00007661
|
||||
public GZipInputStream(Stream baseInputStream)
|
||||
: this(baseInputStream, 4096)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600012C RID: 300 RVA: 0x0000866F File Offset: 0x0000766F
|
||||
public GZipInputStream(Stream baseInputStream, int size)
|
||||
: base(baseInputStream, new Inflater(true), size)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600012D RID: 301 RVA: 0x00008680 File Offset: 0x00007680
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
while (this.readGZIPHeader || this.ReadHeader())
|
||||
{
|
||||
int num = base.Read(buffer, offset, count);
|
||||
if (num > 0)
|
||||
{
|
||||
this.crc.Update(buffer, offset, num);
|
||||
}
|
||||
if (this.inf.IsFinished)
|
||||
{
|
||||
this.ReadFooter();
|
||||
}
|
||||
if (num > 0)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Token: 0x0600012E RID: 302 RVA: 0x000086D4 File Offset: 0x000076D4
|
||||
private bool ReadHeader()
|
||||
{
|
||||
this.crc = new Crc32();
|
||||
if (this.inputBuffer.Available <= 0)
|
||||
{
|
||||
this.inputBuffer.Fill();
|
||||
if (this.inputBuffer.Available <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Crc32 crc = new Crc32();
|
||||
int num = this.inputBuffer.ReadLeByte();
|
||||
if (num < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
crc.Update(num);
|
||||
if (num != 31)
|
||||
{
|
||||
throw new GZipException("Error GZIP header, first magic byte doesn't match");
|
||||
}
|
||||
num = this.inputBuffer.ReadLeByte();
|
||||
if (num < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
if (num != 139)
|
||||
{
|
||||
throw new GZipException("Error GZIP header, second magic byte doesn't match");
|
||||
}
|
||||
crc.Update(num);
|
||||
int num2 = this.inputBuffer.ReadLeByte();
|
||||
if (num2 < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
if (num2 != 8)
|
||||
{
|
||||
throw new GZipException("Error GZIP header, data not in deflate format");
|
||||
}
|
||||
crc.Update(num2);
|
||||
int num3 = this.inputBuffer.ReadLeByte();
|
||||
if (num3 < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
crc.Update(num3);
|
||||
if ((num3 & 224) != 0)
|
||||
{
|
||||
throw new GZipException("Reserved flag bits in GZIP header != 0");
|
||||
}
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
int num4 = this.inputBuffer.ReadLeByte();
|
||||
if (num4 < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
crc.Update(num4);
|
||||
}
|
||||
if ((num3 & 4) != 0)
|
||||
{
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
int num5 = this.inputBuffer.ReadLeByte();
|
||||
if (num5 < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
crc.Update(num5);
|
||||
}
|
||||
if (this.inputBuffer.ReadLeByte() < 0 || this.inputBuffer.ReadLeByte() < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
int num6 = this.inputBuffer.ReadLeByte();
|
||||
int num7 = this.inputBuffer.ReadLeByte();
|
||||
if (num6 < 0 || num7 < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
crc.Update(num6);
|
||||
crc.Update(num7);
|
||||
int num8 = (num6 << 8) | num7;
|
||||
for (int k = 0; k < num8; k++)
|
||||
{
|
||||
int num9 = this.inputBuffer.ReadLeByte();
|
||||
if (num9 < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
crc.Update(num9);
|
||||
}
|
||||
}
|
||||
if ((num3 & 8) != 0)
|
||||
{
|
||||
int num10;
|
||||
while ((num10 = this.inputBuffer.ReadLeByte()) > 0)
|
||||
{
|
||||
crc.Update(num10);
|
||||
}
|
||||
if (num10 < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
crc.Update(num10);
|
||||
}
|
||||
if ((num3 & 16) != 0)
|
||||
{
|
||||
int num11;
|
||||
while ((num11 = this.inputBuffer.ReadLeByte()) > 0)
|
||||
{
|
||||
crc.Update(num11);
|
||||
}
|
||||
if (num11 < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
crc.Update(num11);
|
||||
}
|
||||
if ((num3 & 2) != 0)
|
||||
{
|
||||
int num12 = this.inputBuffer.ReadLeByte();
|
||||
if (num12 < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
int num13 = this.inputBuffer.ReadLeByte();
|
||||
if (num13 < 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP header");
|
||||
}
|
||||
num12 = (num12 << 8) | num13;
|
||||
if (num12 != ((int)crc.Value & 65535))
|
||||
{
|
||||
throw new GZipException("Header CRC value mismatch");
|
||||
}
|
||||
}
|
||||
this.readGZIPHeader = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x0600012F RID: 303 RVA: 0x000089E0 File Offset: 0x000079E0
|
||||
private void ReadFooter()
|
||||
{
|
||||
byte[] array = new byte[8];
|
||||
long num = this.inf.TotalOut & (long)((ulong)(-1));
|
||||
this.inputBuffer.Available += this.inf.RemainingInput;
|
||||
this.inf.Reset();
|
||||
int num2;
|
||||
for (int i = 8; i > 0; i -= num2)
|
||||
{
|
||||
num2 = this.inputBuffer.ReadClearTextBuffer(array, 8 - i, i);
|
||||
if (num2 <= 0)
|
||||
{
|
||||
throw new EndOfStreamException("EOS reading GZIP footer");
|
||||
}
|
||||
}
|
||||
int num3 = (int)(array[0] & byte.MaxValue) | ((int)(array[1] & byte.MaxValue) << 8) | ((int)(array[2] & byte.MaxValue) << 16) | ((int)array[3] << 24);
|
||||
if (num3 != (int)this.crc.Value)
|
||||
{
|
||||
throw new GZipException(string.Concat(new object[]
|
||||
{
|
||||
"GZIP crc sum mismatch, theirs \"",
|
||||
num3,
|
||||
"\" and ours \"",
|
||||
(int)this.crc.Value
|
||||
}));
|
||||
}
|
||||
uint num4 = (uint)((int)(array[4] & byte.MaxValue) | ((int)(array[5] & byte.MaxValue) << 8) | ((int)(array[6] & byte.MaxValue) << 16) | ((int)array[7] << 24));
|
||||
if (num != (long)((ulong)num4))
|
||||
{
|
||||
throw new GZipException("Number of bytes mismatch in footer");
|
||||
}
|
||||
this.readGZIPHeader = false;
|
||||
}
|
||||
|
||||
// Token: 0x040000AB RID: 171
|
||||
protected Crc32 crc;
|
||||
|
||||
// Token: 0x040000AC RID: 172
|
||||
private bool readGZIPHeader;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using ICSharpCode.SharpZipLib.Checksums;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.GZip
|
||||
{
|
||||
// Token: 0x0200002C RID: 44
|
||||
public class GZipOutputStream : DeflaterOutputStream
|
||||
{
|
||||
// Token: 0x0600014E RID: 334 RVA: 0x00008F57 File Offset: 0x00007F57
|
||||
public GZipOutputStream(Stream baseOutputStream)
|
||||
: this(baseOutputStream, 4096)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600014F RID: 335 RVA: 0x00008F65 File Offset: 0x00007F65
|
||||
public GZipOutputStream(Stream baseOutputStream, int size)
|
||||
: base(baseOutputStream, new Deflater(-1, true), size)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000150 RID: 336 RVA: 0x00008F81 File Offset: 0x00007F81
|
||||
public void SetLevel(int level)
|
||||
{
|
||||
if (level < 1)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("level");
|
||||
}
|
||||
this.deflater_.SetLevel(level);
|
||||
}
|
||||
|
||||
// Token: 0x06000151 RID: 337 RVA: 0x00008F9E File Offset: 0x00007F9E
|
||||
public int GetLevel()
|
||||
{
|
||||
return this.deflater_.GetLevel();
|
||||
}
|
||||
|
||||
// Token: 0x06000152 RID: 338 RVA: 0x00008FAB File Offset: 0x00007FAB
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (this.state_ == GZipOutputStream.OutputState.Header)
|
||||
{
|
||||
this.WriteHeader();
|
||||
}
|
||||
if (this.state_ != GZipOutputStream.OutputState.Footer)
|
||||
{
|
||||
throw new InvalidOperationException("Write not permitted in current state");
|
||||
}
|
||||
this.crc.Update(buffer, offset, count);
|
||||
base.Write(buffer, offset, count);
|
||||
}
|
||||
|
||||
// Token: 0x06000153 RID: 339 RVA: 0x00008FE8 File Offset: 0x00007FE8
|
||||
public override void Close()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Finish();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (this.state_ != GZipOutputStream.OutputState.Closed)
|
||||
{
|
||||
this.state_ = GZipOutputStream.OutputState.Closed;
|
||||
if (base.IsStreamOwner)
|
||||
{
|
||||
this.baseOutputStream_.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000154 RID: 340 RVA: 0x00009034 File Offset: 0x00008034
|
||||
public override void Finish()
|
||||
{
|
||||
if (this.state_ == GZipOutputStream.OutputState.Header)
|
||||
{
|
||||
this.WriteHeader();
|
||||
}
|
||||
if (this.state_ == GZipOutputStream.OutputState.Footer)
|
||||
{
|
||||
this.state_ = GZipOutputStream.OutputState.Finished;
|
||||
base.Finish();
|
||||
uint num = (uint)(this.deflater_.TotalIn & (long)((ulong)(-1)));
|
||||
uint num2 = (uint)(this.crc.Value & (long)((ulong)(-1)));
|
||||
byte[] array = new byte[]
|
||||
{
|
||||
(byte)num2,
|
||||
(byte)(num2 >> 8),
|
||||
(byte)(num2 >> 16),
|
||||
(byte)(num2 >> 24),
|
||||
(byte)num,
|
||||
(byte)(num >> 8),
|
||||
(byte)(num >> 16),
|
||||
(byte)(num >> 24)
|
||||
};
|
||||
this.baseOutputStream_.Write(array, 0, array.Length);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000155 RID: 341 RVA: 0x000090E4 File Offset: 0x000080E4
|
||||
private void WriteHeader()
|
||||
{
|
||||
if (this.state_ == GZipOutputStream.OutputState.Header)
|
||||
{
|
||||
this.state_ = GZipOutputStream.OutputState.Footer;
|
||||
int num = (int)((DateTime.Now.Ticks - new DateTime(1970, 1, 1).Ticks) / 10000000L);
|
||||
byte[] array = new byte[] { 31, 139, 8, 0, 0, 0, 0, 0, 0, byte.MaxValue };
|
||||
array[4] = (byte)num;
|
||||
array[5] = (byte)(num >> 8);
|
||||
array[6] = (byte)(num >> 16);
|
||||
array[7] = (byte)(num >> 24);
|
||||
byte[] array2 = array;
|
||||
this.baseOutputStream_.Write(array2, 0, array2.Length);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000B6 RID: 182
|
||||
protected Crc32 crc = new Crc32();
|
||||
|
||||
// Token: 0x040000B7 RID: 183
|
||||
private GZipOutputStream.OutputState state_;
|
||||
|
||||
// Token: 0x0200002D RID: 45
|
||||
private enum OutputState
|
||||
{
|
||||
// Token: 0x040000B9 RID: 185
|
||||
Header,
|
||||
// Token: 0x040000BA RID: 186
|
||||
Footer,
|
||||
// Token: 0x040000BB RID: 187
|
||||
Finished,
|
||||
// Token: 0x040000BC RID: 188
|
||||
Closed
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{99604A24-13D0-4C83-A3AA-9A315339FA47}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>ICSharpCode.SharpZipLib</RootNamespace>
|
||||
<AssemblyName>ICSharpCode.SharpZipLib</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
</PropertyGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BZip2\BZip2.cs" />
|
||||
<Compile Include="BZip2\BZip2Constants.cs" />
|
||||
<Compile Include="BZip2\BZip2Exception.cs" />
|
||||
<Compile Include="BZip2\BZip2InputStream.cs" />
|
||||
<Compile Include="BZip2\BZip2OutputStream.cs" />
|
||||
<Compile Include="Checksums\Adler32.cs" />
|
||||
<Compile Include="Checksums\Crc32.cs" />
|
||||
<Compile Include="Checksums\IChecksum.cs" />
|
||||
<Compile Include="Checksums\StrangeCRC.cs" />
|
||||
<Compile Include="Core\CompletedFileHandler.cs" />
|
||||
<Compile Include="Core\DirectoryEventArgs.cs" />
|
||||
<Compile Include="Core\DirectoryFailureHandler.cs" />
|
||||
<Compile Include="Core\ExtendedPathFilter.cs" />
|
||||
<Compile Include="Core\FileFailureHandler.cs" />
|
||||
<Compile Include="Core\FileSystemScanner.cs" />
|
||||
<Compile Include="Core\INameTransform.cs" />
|
||||
<Compile Include="Core\IScanFilter.cs" />
|
||||
<Compile Include="Core\NameAndSizeFilter.cs" />
|
||||
<Compile Include="Core\NameFilter.cs" />
|
||||
<Compile Include="Core\PathFilter.cs" />
|
||||
<Compile Include="Core\ProcessDirectoryHandler.cs" />
|
||||
<Compile Include="Core\ProcessFileHandler.cs" />
|
||||
<Compile Include="Core\ProgressEventArgs.cs" />
|
||||
<Compile Include="Core\ProgressHandler.cs" />
|
||||
<Compile Include="Core\ScanEventArgs.cs" />
|
||||
<Compile Include="Core\ScanFailureEventArgs.cs" />
|
||||
<Compile Include="Core\StreamUtils.cs" />
|
||||
<Compile Include="Core\WindowsPathUtils.cs" />
|
||||
<Compile Include="Encryption\PkzipClassic.cs" />
|
||||
<Compile Include="Encryption\PkzipClassicCryptoBase.cs" />
|
||||
<Compile Include="Encryption\PkzipClassicDecryptCryptoTransform.cs" />
|
||||
<Compile Include="Encryption\PkzipClassicEncryptCryptoTransform.cs" />
|
||||
<Compile Include="Encryption\PkzipClassicManaged.cs" />
|
||||
<Compile Include="Encryption\ZipAESStream.cs" />
|
||||
<Compile Include="Encryption\ZipAESTransform.cs" />
|
||||
<Compile Include="GZip\GZipConstants.cs" />
|
||||
<Compile Include="GZip\GZipException.cs" />
|
||||
<Compile Include="GZip\GZipInputStream.cs" />
|
||||
<Compile Include="GZip\GZipOutputStream.cs" />
|
||||
<Compile Include="LZW\LzwConstants.cs" />
|
||||
<Compile Include="LZW\LzwException.cs" />
|
||||
<Compile Include="LZW\LzwInputStream.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SharpZipBaseException.cs" />
|
||||
<Compile Include="Tar\InvalidHeaderException.cs" />
|
||||
<Compile Include="Tar\ProgressMessageHandler.cs" />
|
||||
<Compile Include="Tar\TarArchive.cs" />
|
||||
<Compile Include="Tar\TarBuffer.cs" />
|
||||
<Compile Include="Tar\TarEntry.cs" />
|
||||
<Compile Include="Tar\TarException.cs" />
|
||||
<Compile Include="Tar\TarHeader.cs" />
|
||||
<Compile Include="Tar\TarInputStream.cs" />
|
||||
<Compile Include="Tar\TarOutputStream.cs" />
|
||||
<Compile Include="Zip\BaseArchiveStorage.cs" />
|
||||
<Compile Include="Zip\CompressionMethod.cs" />
|
||||
<Compile Include="Zip\Compression\Deflater.cs" />
|
||||
<Compile Include="Zip\Compression\DeflaterConstants.cs" />
|
||||
<Compile Include="Zip\Compression\DeflaterEngine.cs" />
|
||||
<Compile Include="Zip\Compression\DeflaterHuffman.cs" />
|
||||
<Compile Include="Zip\Compression\DeflaterPending.cs" />
|
||||
<Compile Include="Zip\Compression\DeflateStrategy.cs" />
|
||||
<Compile Include="Zip\Compression\Inflater.cs" />
|
||||
<Compile Include="Zip\Compression\InflaterDynHeader.cs" />
|
||||
<Compile Include="Zip\Compression\InflaterHuffmanTree.cs" />
|
||||
<Compile Include="Zip\Compression\PendingBuffer.cs" />
|
||||
<Compile Include="Zip\Compression\Streams\DeflaterOutputStream.cs" />
|
||||
<Compile Include="Zip\Compression\Streams\InflaterInputBuffer.cs" />
|
||||
<Compile Include="Zip\Compression\Streams\InflaterInputStream.cs" />
|
||||
<Compile Include="Zip\Compression\Streams\OutputWindow.cs" />
|
||||
<Compile Include="Zip\Compression\Streams\StreamManipulator.cs" />
|
||||
<Compile Include="Zip\DescriptorData.cs" />
|
||||
<Compile Include="Zip\DiskArchiveStorage.cs" />
|
||||
<Compile Include="Zip\DynamicDiskDataSource.cs" />
|
||||
<Compile Include="Zip\EncryptionAlgorithm.cs" />
|
||||
<Compile Include="Zip\EntryPatchData.cs" />
|
||||
<Compile Include="Zip\ExtendedUnixData.cs" />
|
||||
<Compile Include="Zip\FastZip.cs" />
|
||||
<Compile Include="Zip\FastZipEvents.cs" />
|
||||
<Compile Include="Zip\FileUpdateMode.cs" />
|
||||
<Compile Include="Zip\GeneralBitFlags.cs" />
|
||||
<Compile Include="Zip\HostSystemID.cs" />
|
||||
<Compile Include="Zip\IArchiveStorage.cs" />
|
||||
<Compile Include="Zip\IDynamicDataSource.cs" />
|
||||
<Compile Include="Zip\IEntryFactory.cs" />
|
||||
<Compile Include="Zip\IStaticDataSource.cs" />
|
||||
<Compile Include="Zip\ITaggedData.cs" />
|
||||
<Compile Include="Zip\ITaggedDataFactory.cs" />
|
||||
<Compile Include="Zip\KeysRequiredEventArgs.cs" />
|
||||
<Compile Include="Zip\MemoryArchiveStorage.cs" />
|
||||
<Compile Include="Zip\NTTaggedData.cs" />
|
||||
<Compile Include="Zip\RawTaggedData.cs" />
|
||||
<Compile Include="Zip\StaticDiskDataSource.cs" />
|
||||
<Compile Include="Zip\TestOperation.cs" />
|
||||
<Compile Include="Zip\TestStatus.cs" />
|
||||
<Compile Include="Zip\TestStrategy.cs" />
|
||||
<Compile Include="Zip\UseZip64.cs" />
|
||||
<Compile Include="Zip\WindowsNameTransform.cs" />
|
||||
<Compile Include="Zip\ZipConstants.cs" />
|
||||
<Compile Include="Zip\ZipEntry.cs" />
|
||||
<Compile Include="Zip\ZipEntryFactory.cs" />
|
||||
<Compile Include="Zip\ZipException.cs" />
|
||||
<Compile Include="Zip\ZipExtraData.cs" />
|
||||
<Compile Include="Zip\ZipFile.cs" />
|
||||
<Compile Include="Zip\ZipHelperStream.cs" />
|
||||
<Compile Include="Zip\ZipInputStream.cs" />
|
||||
<Compile Include="Zip\ZipNameTransform.cs" />
|
||||
<Compile Include="Zip\ZipOutputStream.cs" />
|
||||
<Compile Include="Zip\ZipTestResultHandler.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\mscorlib\mscorlib.csproj">
|
||||
<Project>{99604a24-13d0-4c83-a3aa-9a315339fa4c}</Project>
|
||||
<Name>mscorlib</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\System\System.csproj">
|
||||
<Project>{99604a24-13d0-4c83-a3aa-9a315339fa56}</Project>
|
||||
<Name>System</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.LZW
|
||||
{
|
||||
// Token: 0x0200002E RID: 46
|
||||
public sealed class LzwConstants
|
||||
{
|
||||
// Token: 0x06000156 RID: 342 RVA: 0x00009172 File Offset: 0x00008172
|
||||
private LzwConstants()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x040000BD RID: 189
|
||||
public const int MAGIC = 8093;
|
||||
|
||||
// Token: 0x040000BE RID: 190
|
||||
public const int MAX_BITS = 16;
|
||||
|
||||
// Token: 0x040000BF RID: 191
|
||||
public const int BIT_MASK = 31;
|
||||
|
||||
// Token: 0x040000C0 RID: 192
|
||||
public const int EXTENDED_MASK = 32;
|
||||
|
||||
// Token: 0x040000C1 RID: 193
|
||||
public const int RESERVED_MASK = 96;
|
||||
|
||||
// Token: 0x040000C2 RID: 194
|
||||
public const int BLOCK_MODE_MASK = 128;
|
||||
|
||||
// Token: 0x040000C3 RID: 195
|
||||
public const int HDR_SIZE = 3;
|
||||
|
||||
// Token: 0x040000C4 RID: 196
|
||||
public const int INIT_BITS = 9;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.LZW
|
||||
{
|
||||
// Token: 0x0200002F RID: 47
|
||||
[Serializable]
|
||||
public class LzwException : SharpZipBaseException
|
||||
{
|
||||
// Token: 0x06000157 RID: 343 RVA: 0x0000917A File Offset: 0x0000817A
|
||||
protected LzwException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000158 RID: 344 RVA: 0x00009184 File Offset: 0x00008184
|
||||
public LzwException()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000159 RID: 345 RVA: 0x0000918C File Offset: 0x0000818C
|
||||
public LzwException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600015A RID: 346 RVA: 0x00009195 File Offset: 0x00008195
|
||||
public LzwException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,459 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.LZW
|
||||
{
|
||||
// Token: 0x02000030 RID: 48
|
||||
public class LzwInputStream : Stream
|
||||
{
|
||||
// Token: 0x17000043 RID: 67
|
||||
// (get) Token: 0x0600015B RID: 347 RVA: 0x0000919F File Offset: 0x0000819F
|
||||
// (set) Token: 0x0600015C RID: 348 RVA: 0x000091A7 File Offset: 0x000081A7
|
||||
public bool IsStreamOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isStreamOwner;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.isStreamOwner = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600015D RID: 349 RVA: 0x000091B0 File Offset: 0x000081B0
|
||||
public LzwInputStream(Stream baseInputStream)
|
||||
{
|
||||
this.baseInputStream = baseInputStream;
|
||||
}
|
||||
|
||||
// Token: 0x0600015E RID: 350 RVA: 0x00009200 File Offset: 0x00008200
|
||||
public override int ReadByte()
|
||||
{
|
||||
int num = this.Read(this.one, 0, 1);
|
||||
if (num == 1)
|
||||
{
|
||||
return (int)(this.one[0] & byte.MaxValue);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x0600015F RID: 351 RVA: 0x00009230 File Offset: 0x00008230
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (!this.headerParsed)
|
||||
{
|
||||
this.ParseHeader();
|
||||
}
|
||||
if (this.eof)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int num = offset;
|
||||
int[] array = this.tabPrefix;
|
||||
byte[] array2 = this.tabSuffix;
|
||||
byte[] array3 = this.stack;
|
||||
int num2 = this.nBits;
|
||||
int num3 = this.maxCode;
|
||||
int num4 = this.maxMaxCode;
|
||||
int num5 = this.bitMask;
|
||||
int num6 = this.oldCode;
|
||||
byte b = this.finChar;
|
||||
int num7 = this.stackP;
|
||||
int num8 = this.freeEnt;
|
||||
byte[] array4 = this.data;
|
||||
int i = this.bitPos;
|
||||
int num9 = array3.Length - num7;
|
||||
if (num9 > 0)
|
||||
{
|
||||
int num10 = ((num9 >= count) ? count : num9);
|
||||
Array.Copy(array3, num7, buffer, offset, num10);
|
||||
offset += num10;
|
||||
count -= num10;
|
||||
num7 += num10;
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
this.stackP = num7;
|
||||
return offset - num;
|
||||
}
|
||||
int j;
|
||||
for (;;)
|
||||
{
|
||||
IL_C6:
|
||||
if (this.end < 64)
|
||||
{
|
||||
this.Fill();
|
||||
}
|
||||
int num11 = ((this.got > 0) ? (this.end - this.end % num2 << 3) : ((this.end << 3) - (num2 - 1)));
|
||||
while (i < num11)
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
goto Block_8;
|
||||
}
|
||||
if (num8 > num3)
|
||||
{
|
||||
int num12 = num2 << 3;
|
||||
i = i - 1 + num12 - (i - 1 + num12) % num12;
|
||||
num2++;
|
||||
num3 = ((num2 == this.maxBits) ? num4 : ((1 << num2) - 1));
|
||||
num5 = (1 << num2) - 1;
|
||||
i = this.ResetBuf(i);
|
||||
goto IL_C6;
|
||||
}
|
||||
int num13 = i >> 3;
|
||||
j = (((int)(array4[num13] & byte.MaxValue) | ((int)(array4[num13 + 1] & byte.MaxValue) << 8) | ((int)(array4[num13 + 2] & byte.MaxValue) << 16)) >> (i & 7)) & num5;
|
||||
i += num2;
|
||||
if (num6 == -1)
|
||||
{
|
||||
if (j >= 256)
|
||||
{
|
||||
goto Block_12;
|
||||
}
|
||||
b = (byte)(num6 = j);
|
||||
buffer[offset++] = b;
|
||||
count--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (j == 256 && this.blockMode)
|
||||
{
|
||||
Array.Copy(this.zeros, 0, array, 0, this.zeros.Length);
|
||||
num8 = 256;
|
||||
int num14 = num2 << 3;
|
||||
i = i - 1 + num14 - (i - 1 + num14) % num14;
|
||||
num2 = 9;
|
||||
num3 = (1 << num2) - 1;
|
||||
num5 = num3;
|
||||
i = this.ResetBuf(i);
|
||||
goto IL_C6;
|
||||
}
|
||||
int num15 = j;
|
||||
num7 = array3.Length;
|
||||
if (j >= num8)
|
||||
{
|
||||
if (j > num8)
|
||||
{
|
||||
goto Block_16;
|
||||
}
|
||||
array3[--num7] = b;
|
||||
j = num6;
|
||||
}
|
||||
while (j >= 256)
|
||||
{
|
||||
array3[--num7] = array2[j];
|
||||
j = array[j];
|
||||
}
|
||||
b = array2[j];
|
||||
buffer[offset++] = b;
|
||||
count--;
|
||||
num9 = array3.Length - num7;
|
||||
int num16 = ((num9 >= count) ? count : num9);
|
||||
Array.Copy(array3, num7, buffer, offset, num16);
|
||||
offset += num16;
|
||||
count -= num16;
|
||||
num7 += num16;
|
||||
if (num8 < num4)
|
||||
{
|
||||
array[num8] = num6;
|
||||
array2[num8] = b;
|
||||
num8++;
|
||||
}
|
||||
num6 = num15;
|
||||
if (count == 0)
|
||||
{
|
||||
goto Block_20;
|
||||
}
|
||||
}
|
||||
}
|
||||
i = this.ResetBuf(i);
|
||||
if (this.got <= 0)
|
||||
{
|
||||
goto Block_22;
|
||||
}
|
||||
}
|
||||
Block_8:
|
||||
this.nBits = num2;
|
||||
this.maxCode = num3;
|
||||
this.maxMaxCode = num4;
|
||||
this.bitMask = num5;
|
||||
this.oldCode = num6;
|
||||
this.finChar = b;
|
||||
this.stackP = num7;
|
||||
this.freeEnt = num8;
|
||||
this.bitPos = i;
|
||||
return offset - num;
|
||||
Block_12:
|
||||
throw new LzwException("corrupt input: " + j + " > 255");
|
||||
Block_16:
|
||||
throw new LzwException(string.Concat(new object[] { "corrupt input: code=", j, ", freeEnt=", num8 }));
|
||||
Block_20:
|
||||
this.nBits = num2;
|
||||
this.maxCode = num3;
|
||||
this.bitMask = num5;
|
||||
this.oldCode = num6;
|
||||
this.finChar = b;
|
||||
this.stackP = num7;
|
||||
this.freeEnt = num8;
|
||||
this.bitPos = i;
|
||||
return offset - num;
|
||||
Block_22:
|
||||
this.nBits = num2;
|
||||
this.maxCode = num3;
|
||||
this.bitMask = num5;
|
||||
this.oldCode = num6;
|
||||
this.finChar = b;
|
||||
this.stackP = num7;
|
||||
this.freeEnt = num8;
|
||||
this.bitPos = i;
|
||||
this.eof = true;
|
||||
return offset - num;
|
||||
}
|
||||
|
||||
// Token: 0x06000160 RID: 352 RVA: 0x00009678 File Offset: 0x00008678
|
||||
private int ResetBuf(int bitPosition)
|
||||
{
|
||||
int num = bitPosition >> 3;
|
||||
Array.Copy(this.data, num, this.data, 0, this.end - num);
|
||||
this.end -= num;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Token: 0x06000161 RID: 353 RVA: 0x000096B4 File Offset: 0x000086B4
|
||||
private void Fill()
|
||||
{
|
||||
this.got = this.baseInputStream.Read(this.data, this.end, this.data.Length - 1 - this.end);
|
||||
if (this.got > 0)
|
||||
{
|
||||
this.end += this.got;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000162 RID: 354 RVA: 0x0000970C File Offset: 0x0000870C
|
||||
private void ParseHeader()
|
||||
{
|
||||
this.headerParsed = true;
|
||||
byte[] array = new byte[3];
|
||||
int num = this.baseInputStream.Read(array, 0, array.Length);
|
||||
if (num < 0)
|
||||
{
|
||||
throw new LzwException("Failed to read LZW header");
|
||||
}
|
||||
if (array[0] != 31 || array[1] != 157)
|
||||
{
|
||||
throw new LzwException(string.Format("Wrong LZW header. Magic bytes don't match. 0x{0:x2} 0x{1:x2}", array[0], array[1]));
|
||||
}
|
||||
this.blockMode = (array[2] & 128) > 0;
|
||||
this.maxBits = (int)(array[2] & 31);
|
||||
if (this.maxBits > 16)
|
||||
{
|
||||
throw new LzwException(string.Concat(new object[] { "Stream compressed with ", this.maxBits, " bits, but decompression can only handle ", 16, " bits." }));
|
||||
}
|
||||
if ((array[2] & 96) > 0)
|
||||
{
|
||||
throw new LzwException("Unsupported bits set in the header.");
|
||||
}
|
||||
this.maxMaxCode = 1 << this.maxBits;
|
||||
this.nBits = 9;
|
||||
this.maxCode = (1 << this.nBits) - 1;
|
||||
this.bitMask = this.maxCode;
|
||||
this.oldCode = -1;
|
||||
this.finChar = 0;
|
||||
this.freeEnt = (this.blockMode ? 257 : 256);
|
||||
this.tabPrefix = new int[1 << this.maxBits];
|
||||
this.tabSuffix = new byte[1 << this.maxBits];
|
||||
this.stack = new byte[1 << this.maxBits];
|
||||
this.stackP = this.stack.Length;
|
||||
for (int i = 255; i >= 0; i--)
|
||||
{
|
||||
this.tabSuffix[i] = (byte)i;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000044 RID: 68
|
||||
// (get) Token: 0x06000163 RID: 355 RVA: 0x000098C1 File Offset: 0x000088C1
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseInputStream.CanRead;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000045 RID: 69
|
||||
// (get) Token: 0x06000164 RID: 356 RVA: 0x000098CE File Offset: 0x000088CE
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000046 RID: 70
|
||||
// (get) Token: 0x06000165 RID: 357 RVA: 0x000098D1 File Offset: 0x000088D1
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000047 RID: 71
|
||||
// (get) Token: 0x06000166 RID: 358 RVA: 0x000098D4 File Offset: 0x000088D4
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return (long)this.got;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000048 RID: 72
|
||||
// (get) Token: 0x06000167 RID: 359 RVA: 0x000098DD File Offset: 0x000088DD
|
||||
// (set) Token: 0x06000168 RID: 360 RVA: 0x000098EA File Offset: 0x000088EA
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.baseInputStream.Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotSupportedException("InflaterInputStream Position not supported");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000169 RID: 361 RVA: 0x000098F6 File Offset: 0x000088F6
|
||||
public override void Flush()
|
||||
{
|
||||
this.baseInputStream.Flush();
|
||||
}
|
||||
|
||||
// Token: 0x0600016A RID: 362 RVA: 0x00009903 File Offset: 0x00008903
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotSupportedException("Seek not supported");
|
||||
}
|
||||
|
||||
// Token: 0x0600016B RID: 363 RVA: 0x0000990F File Offset: 0x0000890F
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException("InflaterInputStream SetLength not supported");
|
||||
}
|
||||
|
||||
// Token: 0x0600016C RID: 364 RVA: 0x0000991B File Offset: 0x0000891B
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException("InflaterInputStream Write not supported");
|
||||
}
|
||||
|
||||
// Token: 0x0600016D RID: 365 RVA: 0x00009927 File Offset: 0x00008927
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
throw new NotSupportedException("InflaterInputStream WriteByte not supported");
|
||||
}
|
||||
|
||||
// Token: 0x0600016E RID: 366 RVA: 0x00009933 File Offset: 0x00008933
|
||||
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
|
||||
{
|
||||
throw new NotSupportedException("InflaterInputStream BeginWrite not supported");
|
||||
}
|
||||
|
||||
// Token: 0x0600016F RID: 367 RVA: 0x0000993F File Offset: 0x0000893F
|
||||
public override void Close()
|
||||
{
|
||||
if (!this.isClosed)
|
||||
{
|
||||
this.isClosed = true;
|
||||
if (this.isStreamOwner)
|
||||
{
|
||||
this.baseInputStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000C5 RID: 197
|
||||
private const int TBL_CLEAR = 256;
|
||||
|
||||
// Token: 0x040000C6 RID: 198
|
||||
private const int TBL_FIRST = 257;
|
||||
|
||||
// Token: 0x040000C7 RID: 199
|
||||
private const int EXTRA = 64;
|
||||
|
||||
// Token: 0x040000C8 RID: 200
|
||||
private Stream baseInputStream;
|
||||
|
||||
// Token: 0x040000C9 RID: 201
|
||||
private bool isStreamOwner = true;
|
||||
|
||||
// Token: 0x040000CA RID: 202
|
||||
private bool isClosed;
|
||||
|
||||
// Token: 0x040000CB RID: 203
|
||||
private readonly byte[] one = new byte[1];
|
||||
|
||||
// Token: 0x040000CC RID: 204
|
||||
private bool headerParsed;
|
||||
|
||||
// Token: 0x040000CD RID: 205
|
||||
private int[] tabPrefix;
|
||||
|
||||
// Token: 0x040000CE RID: 206
|
||||
private byte[] tabSuffix;
|
||||
|
||||
// Token: 0x040000CF RID: 207
|
||||
private readonly int[] zeros = new int[256];
|
||||
|
||||
// Token: 0x040000D0 RID: 208
|
||||
private byte[] stack;
|
||||
|
||||
// Token: 0x040000D1 RID: 209
|
||||
private bool blockMode;
|
||||
|
||||
// Token: 0x040000D2 RID: 210
|
||||
private int nBits;
|
||||
|
||||
// Token: 0x040000D3 RID: 211
|
||||
private int maxBits;
|
||||
|
||||
// Token: 0x040000D4 RID: 212
|
||||
private int maxMaxCode;
|
||||
|
||||
// Token: 0x040000D5 RID: 213
|
||||
private int maxCode;
|
||||
|
||||
// Token: 0x040000D6 RID: 214
|
||||
private int bitMask;
|
||||
|
||||
// Token: 0x040000D7 RID: 215
|
||||
private int oldCode;
|
||||
|
||||
// Token: 0x040000D8 RID: 216
|
||||
private byte finChar;
|
||||
|
||||
// Token: 0x040000D9 RID: 217
|
||||
private int stackP;
|
||||
|
||||
// Token: 0x040000DA RID: 218
|
||||
private int freeEnt;
|
||||
|
||||
// Token: 0x040000DB RID: 219
|
||||
private readonly byte[] data = new byte[8192];
|
||||
|
||||
// Token: 0x040000DC RID: 220
|
||||
private int bitPos;
|
||||
|
||||
// Token: 0x040000DD RID: 221
|
||||
private int end;
|
||||
|
||||
// Token: 0x040000DE RID: 222
|
||||
private int got;
|
||||
|
||||
// Token: 0x040000DF RID: 223
|
||||
private bool eof;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
[assembly: AssemblyVersion("0.86.0.518")]
|
||||
[assembly: AssemblyDescription("A free C# compression library")]
|
||||
[assembly: AssemblyTitle("SharpZipLib for .NET Framework 2.0")]
|
||||
[assembly: AssemblyDefaultAlias("SharpZipLib")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: AssemblyConfiguration("Release")]
|
||||
[assembly: AssemblyProduct("#ZipLibrary")]
|
||||
[assembly: AssemblyInformationalVersion("0.86.0")]
|
||||
[assembly: AssemblyCompany("ICSharpCode.net")]
|
||||
[assembly: CLSCompliant(true)]
|
||||
[assembly: AllowPartiallyTrustedCallers]
|
||||
[assembly: AssemblyTrademark("Copyright 2001-2010 Mike Krueger, John Reilly")]
|
||||
[assembly: AssemblyCopyright("Copyright 2001-2010 Mike Krueger, John Reilly")]
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib
|
||||
{
|
||||
// Token: 0x02000004 RID: 4
|
||||
[Serializable]
|
||||
public class SharpZipBaseException : ApplicationException
|
||||
{
|
||||
// Token: 0x06000005 RID: 5 RVA: 0x000029DC File Offset: 0x000019DC
|
||||
protected SharpZipBaseException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000006 RID: 6 RVA: 0x000029E6 File Offset: 0x000019E6
|
||||
public SharpZipBaseException()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000007 RID: 7 RVA: 0x000029EE File Offset: 0x000019EE
|
||||
public SharpZipBaseException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000008 RID: 8 RVA: 0x000029F7 File Offset: 0x000019F7
|
||||
public SharpZipBaseException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Tar
|
||||
{
|
||||
// Token: 0x02000032 RID: 50
|
||||
[Serializable]
|
||||
public class InvalidHeaderException : TarException
|
||||
{
|
||||
// Token: 0x06000174 RID: 372 RVA: 0x00009988 File Offset: 0x00008988
|
||||
protected InvalidHeaderException(SerializationInfo information, StreamingContext context)
|
||||
: base(information, context)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000175 RID: 373 RVA: 0x00009992 File Offset: 0x00008992
|
||||
public InvalidHeaderException()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000176 RID: 374 RVA: 0x0000999A File Offset: 0x0000899A
|
||||
public InvalidHeaderException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000177 RID: 375 RVA: 0x000099A3 File Offset: 0x000089A3
|
||||
public InvalidHeaderException(string message, Exception exception)
|
||||
: base(message, exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Tar
|
||||
{
|
||||
// Token: 0x02000033 RID: 51
|
||||
// (Invoke) Token: 0x06000179 RID: 377
|
||||
public delegate void ProgressMessageHandler(TarArchive archive, TarEntry entry, string message);
|
||||
}
|
||||
@@ -0,0 +1,689 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Tar
|
||||
{
|
||||
// Token: 0x02000034 RID: 52
|
||||
public class TarArchive : IDisposable
|
||||
{
|
||||
// Token: 0x14000001 RID: 1
|
||||
// (add) Token: 0x0600017C RID: 380 RVA: 0x000099AD File Offset: 0x000089AD
|
||||
// (remove) Token: 0x0600017D RID: 381 RVA: 0x000099C6 File Offset: 0x000089C6
|
||||
public event ProgressMessageHandler ProgressMessageEvent;
|
||||
|
||||
// Token: 0x0600017E RID: 382 RVA: 0x000099E0 File Offset: 0x000089E0
|
||||
protected virtual void OnProgressMessageEvent(TarEntry entry, string message)
|
||||
{
|
||||
ProgressMessageHandler progressMessageEvent = this.ProgressMessageEvent;
|
||||
if (progressMessageEvent != null)
|
||||
{
|
||||
progressMessageEvent(this, entry, message);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600017F RID: 383 RVA: 0x00009A00 File Offset: 0x00008A00
|
||||
protected TarArchive()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000180 RID: 384 RVA: 0x00009A1E File Offset: 0x00008A1E
|
||||
protected TarArchive(TarInputStream stream)
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ArgumentNullException("stream");
|
||||
}
|
||||
this.tarIn = stream;
|
||||
}
|
||||
|
||||
// Token: 0x06000181 RID: 385 RVA: 0x00009A51 File Offset: 0x00008A51
|
||||
protected TarArchive(TarOutputStream stream)
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ArgumentNullException("stream");
|
||||
}
|
||||
this.tarOut = stream;
|
||||
}
|
||||
|
||||
// Token: 0x06000182 RID: 386 RVA: 0x00009A84 File Offset: 0x00008A84
|
||||
public static TarArchive CreateInputTarArchive(Stream inputStream)
|
||||
{
|
||||
if (inputStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("inputStream");
|
||||
}
|
||||
TarInputStream tarInputStream = inputStream as TarInputStream;
|
||||
TarArchive tarArchive;
|
||||
if (tarInputStream != null)
|
||||
{
|
||||
tarArchive = new TarArchive(tarInputStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
tarArchive = TarArchive.CreateInputTarArchive(inputStream, 20);
|
||||
}
|
||||
return tarArchive;
|
||||
}
|
||||
|
||||
// Token: 0x06000183 RID: 387 RVA: 0x00009ABC File Offset: 0x00008ABC
|
||||
public static TarArchive CreateInputTarArchive(Stream inputStream, int blockFactor)
|
||||
{
|
||||
if (inputStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("inputStream");
|
||||
}
|
||||
if (inputStream is TarInputStream)
|
||||
{
|
||||
throw new ArgumentException("TarInputStream not valid");
|
||||
}
|
||||
return new TarArchive(new TarInputStream(inputStream, blockFactor));
|
||||
}
|
||||
|
||||
// Token: 0x06000184 RID: 388 RVA: 0x00009AEC File Offset: 0x00008AEC
|
||||
public static TarArchive CreateOutputTarArchive(Stream outputStream)
|
||||
{
|
||||
if (outputStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("outputStream");
|
||||
}
|
||||
TarOutputStream tarOutputStream = outputStream as TarOutputStream;
|
||||
TarArchive tarArchive;
|
||||
if (tarOutputStream != null)
|
||||
{
|
||||
tarArchive = new TarArchive(tarOutputStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
tarArchive = TarArchive.CreateOutputTarArchive(outputStream, 20);
|
||||
}
|
||||
return tarArchive;
|
||||
}
|
||||
|
||||
// Token: 0x06000185 RID: 389 RVA: 0x00009B24 File Offset: 0x00008B24
|
||||
public static TarArchive CreateOutputTarArchive(Stream outputStream, int blockFactor)
|
||||
{
|
||||
if (outputStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("outputStream");
|
||||
}
|
||||
if (outputStream is TarOutputStream)
|
||||
{
|
||||
throw new ArgumentException("TarOutputStream is not valid");
|
||||
}
|
||||
return new TarArchive(new TarOutputStream(outputStream, blockFactor));
|
||||
}
|
||||
|
||||
// Token: 0x06000186 RID: 390 RVA: 0x00009B53 File Offset: 0x00008B53
|
||||
public void SetKeepOldFiles(bool keepExistingFiles)
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
this.keepOldFiles = keepExistingFiles;
|
||||
}
|
||||
|
||||
// Token: 0x17000049 RID: 73
|
||||
// (get) Token: 0x06000187 RID: 391 RVA: 0x00009B6F File Offset: 0x00008B6F
|
||||
// (set) Token: 0x06000188 RID: 392 RVA: 0x00009B8A File Offset: 0x00008B8A
|
||||
public bool AsciiTranslate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
return this.asciiTranslate;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
this.asciiTranslate = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000189 RID: 393 RVA: 0x00009BA6 File Offset: 0x00008BA6
|
||||
[Obsolete("Use the AsciiTranslate property")]
|
||||
public void SetAsciiTranslation(bool translateAsciiFiles)
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
this.asciiTranslate = translateAsciiFiles;
|
||||
}
|
||||
|
||||
// Token: 0x1700004A RID: 74
|
||||
// (get) Token: 0x0600018A RID: 394 RVA: 0x00009BC2 File Offset: 0x00008BC2
|
||||
// (set) Token: 0x0600018B RID: 395 RVA: 0x00009BDD File Offset: 0x00008BDD
|
||||
public string PathPrefix
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
return this.pathPrefix;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
this.pathPrefix = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700004B RID: 75
|
||||
// (get) Token: 0x0600018C RID: 396 RVA: 0x00009BF9 File Offset: 0x00008BF9
|
||||
// (set) Token: 0x0600018D RID: 397 RVA: 0x00009C14 File Offset: 0x00008C14
|
||||
public string RootPath
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
return this.rootPath;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
this.rootPath = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600018E RID: 398 RVA: 0x00009C30 File Offset: 0x00008C30
|
||||
public void SetUserInfo(int userId, string userName, int groupId, string groupName)
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
this.userId = userId;
|
||||
this.userName = userName;
|
||||
this.groupId = groupId;
|
||||
this.groupName = groupName;
|
||||
this.applyUserInfoOverrides = true;
|
||||
}
|
||||
|
||||
// Token: 0x1700004C RID: 76
|
||||
// (get) Token: 0x0600018F RID: 399 RVA: 0x00009C69 File Offset: 0x00008C69
|
||||
// (set) Token: 0x06000190 RID: 400 RVA: 0x00009C84 File Offset: 0x00008C84
|
||||
public bool ApplyUserInfoOverrides
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
return this.applyUserInfoOverrides;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
this.applyUserInfoOverrides = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700004D RID: 77
|
||||
// (get) Token: 0x06000191 RID: 401 RVA: 0x00009CA0 File Offset: 0x00008CA0
|
||||
public int UserId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
return this.userId;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700004E RID: 78
|
||||
// (get) Token: 0x06000192 RID: 402 RVA: 0x00009CBB File Offset: 0x00008CBB
|
||||
public string UserName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
return this.userName;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700004F RID: 79
|
||||
// (get) Token: 0x06000193 RID: 403 RVA: 0x00009CD6 File Offset: 0x00008CD6
|
||||
public int GroupId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
return this.groupId;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000050 RID: 80
|
||||
// (get) Token: 0x06000194 RID: 404 RVA: 0x00009CF1 File Offset: 0x00008CF1
|
||||
public string GroupName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
return this.groupName;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000051 RID: 81
|
||||
// (get) Token: 0x06000195 RID: 405 RVA: 0x00009D0C File Offset: 0x00008D0C
|
||||
public int RecordSize
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
if (this.tarIn != null)
|
||||
{
|
||||
return this.tarIn.RecordSize;
|
||||
}
|
||||
if (this.tarOut != null)
|
||||
{
|
||||
return this.tarOut.RecordSize;
|
||||
}
|
||||
return 10240;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000052 RID: 82
|
||||
// (set) Token: 0x06000196 RID: 406 RVA: 0x00009D59 File Offset: 0x00008D59
|
||||
public bool IsStreamOwner
|
||||
{
|
||||
set
|
||||
{
|
||||
if (this.tarIn != null)
|
||||
{
|
||||
this.tarIn.IsStreamOwner = value;
|
||||
return;
|
||||
}
|
||||
this.tarOut.IsStreamOwner = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000197 RID: 407 RVA: 0x00009D7C File Offset: 0x00008D7C
|
||||
[Obsolete("Use Close instead")]
|
||||
public void CloseArchive()
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Token: 0x06000198 RID: 408 RVA: 0x00009D84 File Offset: 0x00008D84
|
||||
public void ListContents()
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
TarEntry nextEntry = this.tarIn.GetNextEntry();
|
||||
if (nextEntry == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
this.OnProgressMessageEvent(nextEntry, null);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000199 RID: 409 RVA: 0x00009DC0 File Offset: 0x00008DC0
|
||||
public void ExtractContents(string destinationDirectory)
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
TarEntry nextEntry = this.tarIn.GetNextEntry();
|
||||
if (nextEntry == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
this.ExtractEntry(destinationDirectory, nextEntry);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600019A RID: 410 RVA: 0x00009DFC File Offset: 0x00008DFC
|
||||
private void ExtractEntry(string destDir, TarEntry entry)
|
||||
{
|
||||
this.OnProgressMessageEvent(entry, null);
|
||||
string text = entry.Name;
|
||||
if (Path.IsPathRooted(text))
|
||||
{
|
||||
text = text.Substring(Path.GetPathRoot(text).Length);
|
||||
}
|
||||
text = text.Replace('/', Path.DirectorySeparatorChar);
|
||||
string text2 = Path.Combine(destDir, text);
|
||||
if (entry.IsDirectory)
|
||||
{
|
||||
TarArchive.EnsureDirectoryExists(text2);
|
||||
return;
|
||||
}
|
||||
string directoryName = Path.GetDirectoryName(text2);
|
||||
TarArchive.EnsureDirectoryExists(directoryName);
|
||||
bool flag = true;
|
||||
FileInfo fileInfo = new FileInfo(text2);
|
||||
if (fileInfo.Exists)
|
||||
{
|
||||
if (this.keepOldFiles)
|
||||
{
|
||||
this.OnProgressMessageEvent(entry, "Destination file already exists");
|
||||
flag = false;
|
||||
}
|
||||
else if ((fileInfo.Attributes & FileAttributes.ReadOnly) != (FileAttributes)0)
|
||||
{
|
||||
this.OnProgressMessageEvent(entry, "Destination file already exists, and is read-only");
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = false;
|
||||
Stream stream = File.Create(text2);
|
||||
if (this.asciiTranslate)
|
||||
{
|
||||
flag2 = !TarArchive.IsBinary(text2);
|
||||
}
|
||||
StreamWriter streamWriter = null;
|
||||
if (flag2)
|
||||
{
|
||||
streamWriter = new StreamWriter(stream);
|
||||
}
|
||||
byte[] array = new byte[32768];
|
||||
for (;;)
|
||||
{
|
||||
int num = this.tarIn.Read(array, 0, array.Length);
|
||||
if (num <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (flag2)
|
||||
{
|
||||
int num2 = 0;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
if (array[i] == 10)
|
||||
{
|
||||
string @string = Encoding.ASCII.GetString(array, num2, i - num2);
|
||||
streamWriter.WriteLine(@string);
|
||||
num2 = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stream.Write(array, 0, num);
|
||||
}
|
||||
}
|
||||
if (flag2)
|
||||
{
|
||||
streamWriter.Close();
|
||||
return;
|
||||
}
|
||||
stream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600019B RID: 411 RVA: 0x00009F6C File Offset: 0x00008F6C
|
||||
public void WriteEntry(TarEntry sourceEntry, bool recurse)
|
||||
{
|
||||
if (sourceEntry == null)
|
||||
{
|
||||
throw new ArgumentNullException("sourceEntry");
|
||||
}
|
||||
if (this.isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("TarArchive");
|
||||
}
|
||||
try
|
||||
{
|
||||
if (recurse)
|
||||
{
|
||||
TarHeader.SetValueDefaults(sourceEntry.UserId, sourceEntry.UserName, sourceEntry.GroupId, sourceEntry.GroupName);
|
||||
}
|
||||
this.WriteEntryCore(sourceEntry, recurse);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (recurse)
|
||||
{
|
||||
TarHeader.RestoreSetValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600019C RID: 412 RVA: 0x00009FE0 File Offset: 0x00008FE0
|
||||
private void WriteEntryCore(TarEntry sourceEntry, bool recurse)
|
||||
{
|
||||
string text = null;
|
||||
string text2 = sourceEntry.File;
|
||||
TarEntry tarEntry = (TarEntry)sourceEntry.Clone();
|
||||
if (this.applyUserInfoOverrides)
|
||||
{
|
||||
tarEntry.GroupId = this.groupId;
|
||||
tarEntry.GroupName = this.groupName;
|
||||
tarEntry.UserId = this.userId;
|
||||
tarEntry.UserName = this.userName;
|
||||
}
|
||||
this.OnProgressMessageEvent(tarEntry, null);
|
||||
if (this.asciiTranslate && !tarEntry.IsDirectory && !TarArchive.IsBinary(text2))
|
||||
{
|
||||
text = Path.GetTempFileName();
|
||||
using (StreamReader streamReader = File.OpenText(text2))
|
||||
{
|
||||
using (Stream stream = File.Create(text))
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
string text3 = streamReader.ReadLine();
|
||||
if (text3 == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
byte[] bytes = Encoding.ASCII.GetBytes(text3);
|
||||
stream.Write(bytes, 0, bytes.Length);
|
||||
stream.WriteByte(10);
|
||||
}
|
||||
stream.Flush();
|
||||
}
|
||||
}
|
||||
tarEntry.Size = new FileInfo(text).Length;
|
||||
text2 = text;
|
||||
}
|
||||
string text4 = null;
|
||||
if (this.rootPath != null && tarEntry.Name.StartsWith(this.rootPath))
|
||||
{
|
||||
text4 = tarEntry.Name.Substring(this.rootPath.Length + 1);
|
||||
}
|
||||
if (this.pathPrefix != null)
|
||||
{
|
||||
text4 = ((text4 == null) ? (this.pathPrefix + "/" + tarEntry.Name) : (this.pathPrefix + "/" + text4));
|
||||
}
|
||||
if (text4 != null)
|
||||
{
|
||||
tarEntry.Name = text4;
|
||||
}
|
||||
this.tarOut.PutNextEntry(tarEntry);
|
||||
if (tarEntry.IsDirectory)
|
||||
{
|
||||
if (recurse)
|
||||
{
|
||||
TarEntry[] directoryEntries = tarEntry.GetDirectoryEntries();
|
||||
for (int i = 0; i < directoryEntries.Length; i++)
|
||||
{
|
||||
this.WriteEntryCore(directoryEntries[i], recurse);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Stream stream2 = File.OpenRead(text2))
|
||||
{
|
||||
byte[] array = new byte[32768];
|
||||
for (;;)
|
||||
{
|
||||
int num = stream2.Read(array, 0, array.Length);
|
||||
if (num <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
this.tarOut.Write(array, 0, num);
|
||||
}
|
||||
}
|
||||
if (text != null && text.Length > 0)
|
||||
{
|
||||
File.Delete(text);
|
||||
}
|
||||
this.tarOut.CloseEntry();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600019D RID: 413 RVA: 0x0000A228 File Offset: 0x00009228
|
||||
public void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Token: 0x0600019E RID: 414 RVA: 0x0000A238 File Offset: 0x00009238
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this.isDisposed)
|
||||
{
|
||||
this.isDisposed = true;
|
||||
if (disposing)
|
||||
{
|
||||
if (this.tarOut != null)
|
||||
{
|
||||
this.tarOut.Flush();
|
||||
this.tarOut.Close();
|
||||
}
|
||||
if (this.tarIn != null)
|
||||
{
|
||||
this.tarIn.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600019F RID: 415 RVA: 0x0000A288 File Offset: 0x00009288
|
||||
public virtual void Close()
|
||||
{
|
||||
this.Dispose(true);
|
||||
}
|
||||
|
||||
// Token: 0x060001A0 RID: 416 RVA: 0x0000A294 File Offset: 0x00009294
|
||||
~TarArchive()
|
||||
{
|
||||
this.Dispose(false);
|
||||
}
|
||||
|
||||
// Token: 0x060001A1 RID: 417 RVA: 0x0000A2C4 File Offset: 0x000092C4
|
||||
private static void EnsureDirectoryExists(string directoryName)
|
||||
{
|
||||
if (!Directory.Exists(directoryName))
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(directoryName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new TarException("Exception creating directory '" + directoryName + "', " + ex.Message, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001A2 RID: 418 RVA: 0x0000A310 File Offset: 0x00009310
|
||||
private static bool IsBinary(string filename)
|
||||
{
|
||||
using (FileStream fileStream = File.OpenRead(filename))
|
||||
{
|
||||
int num = Math.Min(4096, (int)fileStream.Length);
|
||||
byte[] array = new byte[num];
|
||||
int num2 = fileStream.Read(array, 0, num);
|
||||
for (int i = 0; i < num2; i++)
|
||||
{
|
||||
byte b = array[i];
|
||||
if (b < 8 || (b > 13 && b < 32) || b == 255)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x040000E1 RID: 225
|
||||
private bool keepOldFiles;
|
||||
|
||||
// Token: 0x040000E2 RID: 226
|
||||
private bool asciiTranslate;
|
||||
|
||||
// Token: 0x040000E3 RID: 227
|
||||
private int userId;
|
||||
|
||||
// Token: 0x040000E4 RID: 228
|
||||
private string userName = string.Empty;
|
||||
|
||||
// Token: 0x040000E5 RID: 229
|
||||
private int groupId;
|
||||
|
||||
// Token: 0x040000E6 RID: 230
|
||||
private string groupName = string.Empty;
|
||||
|
||||
// Token: 0x040000E7 RID: 231
|
||||
private string rootPath;
|
||||
|
||||
// Token: 0x040000E8 RID: 232
|
||||
private string pathPrefix;
|
||||
|
||||
// Token: 0x040000E9 RID: 233
|
||||
private bool applyUserInfoOverrides;
|
||||
|
||||
// Token: 0x040000EA RID: 234
|
||||
private TarInputStream tarIn;
|
||||
|
||||
// Token: 0x040000EB RID: 235
|
||||
private TarOutputStream tarOut;
|
||||
|
||||
// Token: 0x040000EC RID: 236
|
||||
private bool isDisposed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,403 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Tar
|
||||
{
|
||||
// Token: 0x02000035 RID: 53
|
||||
public class TarBuffer
|
||||
{
|
||||
// Token: 0x17000053 RID: 83
|
||||
// (get) Token: 0x060001A3 RID: 419 RVA: 0x0000A39C File Offset: 0x0000939C
|
||||
public int RecordSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.recordSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001A4 RID: 420 RVA: 0x0000A3A4 File Offset: 0x000093A4
|
||||
[Obsolete("Use RecordSize property instead")]
|
||||
public int GetRecordSize()
|
||||
{
|
||||
return this.recordSize;
|
||||
}
|
||||
|
||||
// Token: 0x17000054 RID: 84
|
||||
// (get) Token: 0x060001A5 RID: 421 RVA: 0x0000A3AC File Offset: 0x000093AC
|
||||
public int BlockFactor
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.blockFactor;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001A6 RID: 422 RVA: 0x0000A3B4 File Offset: 0x000093B4
|
||||
[Obsolete("Use BlockFactor property instead")]
|
||||
public int GetBlockFactor()
|
||||
{
|
||||
return this.blockFactor;
|
||||
}
|
||||
|
||||
// Token: 0x060001A7 RID: 423 RVA: 0x0000A3BC File Offset: 0x000093BC
|
||||
protected TarBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060001A8 RID: 424 RVA: 0x0000A3DE File Offset: 0x000093DE
|
||||
public static TarBuffer CreateInputTarBuffer(Stream inputStream)
|
||||
{
|
||||
if (inputStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("inputStream");
|
||||
}
|
||||
return TarBuffer.CreateInputTarBuffer(inputStream, 20);
|
||||
}
|
||||
|
||||
// Token: 0x060001A9 RID: 425 RVA: 0x0000A3F8 File Offset: 0x000093F8
|
||||
public static TarBuffer CreateInputTarBuffer(Stream inputStream, int blockFactor)
|
||||
{
|
||||
if (inputStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("inputStream");
|
||||
}
|
||||
if (blockFactor <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("blockFactor", "Factor cannot be negative");
|
||||
}
|
||||
TarBuffer tarBuffer = new TarBuffer();
|
||||
tarBuffer.inputStream = inputStream;
|
||||
tarBuffer.outputStream = null;
|
||||
tarBuffer.Initialize(blockFactor);
|
||||
return tarBuffer;
|
||||
}
|
||||
|
||||
// Token: 0x060001AA RID: 426 RVA: 0x0000A443 File Offset: 0x00009443
|
||||
public static TarBuffer CreateOutputTarBuffer(Stream outputStream)
|
||||
{
|
||||
if (outputStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("outputStream");
|
||||
}
|
||||
return TarBuffer.CreateOutputTarBuffer(outputStream, 20);
|
||||
}
|
||||
|
||||
// Token: 0x060001AB RID: 427 RVA: 0x0000A45C File Offset: 0x0000945C
|
||||
public static TarBuffer CreateOutputTarBuffer(Stream outputStream, int blockFactor)
|
||||
{
|
||||
if (outputStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("outputStream");
|
||||
}
|
||||
if (blockFactor <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("blockFactor", "Factor cannot be negative");
|
||||
}
|
||||
TarBuffer tarBuffer = new TarBuffer();
|
||||
tarBuffer.inputStream = null;
|
||||
tarBuffer.outputStream = outputStream;
|
||||
tarBuffer.Initialize(blockFactor);
|
||||
return tarBuffer;
|
||||
}
|
||||
|
||||
// Token: 0x060001AC RID: 428 RVA: 0x0000A4A8 File Offset: 0x000094A8
|
||||
private void Initialize(int archiveBlockFactor)
|
||||
{
|
||||
this.blockFactor = archiveBlockFactor;
|
||||
this.recordSize = archiveBlockFactor * 512;
|
||||
this.recordBuffer = new byte[this.RecordSize];
|
||||
if (this.inputStream != null)
|
||||
{
|
||||
this.currentRecordIndex = -1;
|
||||
this.currentBlockIndex = this.BlockFactor;
|
||||
return;
|
||||
}
|
||||
this.currentRecordIndex = 0;
|
||||
this.currentBlockIndex = 0;
|
||||
}
|
||||
|
||||
// Token: 0x060001AD RID: 429 RVA: 0x0000A504 File Offset: 0x00009504
|
||||
[Obsolete("Use IsEndOfArchiveBlock instead")]
|
||||
public bool IsEOFBlock(byte[] block)
|
||||
{
|
||||
if (block == null)
|
||||
{
|
||||
throw new ArgumentNullException("block");
|
||||
}
|
||||
if (block.Length != 512)
|
||||
{
|
||||
throw new ArgumentException("block length is invalid");
|
||||
}
|
||||
for (int i = 0; i < 512; i++)
|
||||
{
|
||||
if (block[i] != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x060001AE RID: 430 RVA: 0x0000A54C File Offset: 0x0000954C
|
||||
public static bool IsEndOfArchiveBlock(byte[] block)
|
||||
{
|
||||
if (block == null)
|
||||
{
|
||||
throw new ArgumentNullException("block");
|
||||
}
|
||||
if (block.Length != 512)
|
||||
{
|
||||
throw new ArgumentException("block length is invalid");
|
||||
}
|
||||
for (int i = 0; i < 512; i++)
|
||||
{
|
||||
if (block[i] != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x060001AF RID: 431 RVA: 0x0000A594 File Offset: 0x00009594
|
||||
public void SkipBlock()
|
||||
{
|
||||
if (this.inputStream == null)
|
||||
{
|
||||
throw new TarException("no input stream defined");
|
||||
}
|
||||
if (this.currentBlockIndex >= this.BlockFactor && !this.ReadRecord())
|
||||
{
|
||||
throw new TarException("Failed to read a record");
|
||||
}
|
||||
this.currentBlockIndex++;
|
||||
}
|
||||
|
||||
// Token: 0x060001B0 RID: 432 RVA: 0x0000A5E4 File Offset: 0x000095E4
|
||||
public byte[] ReadBlock()
|
||||
{
|
||||
if (this.inputStream == null)
|
||||
{
|
||||
throw new TarException("TarBuffer.ReadBlock - no input stream defined");
|
||||
}
|
||||
if (this.currentBlockIndex >= this.BlockFactor && !this.ReadRecord())
|
||||
{
|
||||
throw new TarException("Failed to read a record");
|
||||
}
|
||||
byte[] array = new byte[512];
|
||||
Array.Copy(this.recordBuffer, this.currentBlockIndex * 512, array, 0, 512);
|
||||
this.currentBlockIndex++;
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060001B1 RID: 433 RVA: 0x0000A660 File Offset: 0x00009660
|
||||
private bool ReadRecord()
|
||||
{
|
||||
if (this.inputStream == null)
|
||||
{
|
||||
throw new TarException("no input stream stream defined");
|
||||
}
|
||||
this.currentBlockIndex = 0;
|
||||
int num = 0;
|
||||
long num2;
|
||||
for (int i = this.RecordSize; i > 0; i -= (int)num2)
|
||||
{
|
||||
num2 = (long)this.inputStream.Read(this.recordBuffer, num, i);
|
||||
if (num2 <= 0L)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num += (int)num2;
|
||||
}
|
||||
this.currentRecordIndex++;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x17000055 RID: 85
|
||||
// (get) Token: 0x060001B2 RID: 434 RVA: 0x0000A6C9 File Offset: 0x000096C9
|
||||
public int CurrentBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.currentBlockIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000056 RID: 86
|
||||
// (get) Token: 0x060001B3 RID: 435 RVA: 0x0000A6D1 File Offset: 0x000096D1
|
||||
// (set) Token: 0x060001B4 RID: 436 RVA: 0x0000A6D9 File Offset: 0x000096D9
|
||||
public bool IsStreamOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isStreamOwner_;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.isStreamOwner_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001B5 RID: 437 RVA: 0x0000A6E2 File Offset: 0x000096E2
|
||||
[Obsolete("Use CurrentBlock property instead")]
|
||||
public int GetCurrentBlockNum()
|
||||
{
|
||||
return this.currentBlockIndex;
|
||||
}
|
||||
|
||||
// Token: 0x17000057 RID: 87
|
||||
// (get) Token: 0x060001B6 RID: 438 RVA: 0x0000A6EA File Offset: 0x000096EA
|
||||
public int CurrentRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.currentRecordIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001B7 RID: 439 RVA: 0x0000A6F2 File Offset: 0x000096F2
|
||||
[Obsolete("Use CurrentRecord property instead")]
|
||||
public int GetCurrentRecordNum()
|
||||
{
|
||||
return this.currentRecordIndex;
|
||||
}
|
||||
|
||||
// Token: 0x060001B8 RID: 440 RVA: 0x0000A6FC File Offset: 0x000096FC
|
||||
public void WriteBlock(byte[] block)
|
||||
{
|
||||
if (block == null)
|
||||
{
|
||||
throw new ArgumentNullException("block");
|
||||
}
|
||||
if (this.outputStream == null)
|
||||
{
|
||||
throw new TarException("TarBuffer.WriteBlock - no output stream defined");
|
||||
}
|
||||
if (block.Length != 512)
|
||||
{
|
||||
string text = string.Format("TarBuffer.WriteBlock - block to write has length '{0}' which is not the block size of '{1}'", block.Length, 512);
|
||||
throw new TarException(text);
|
||||
}
|
||||
if (this.currentBlockIndex >= this.BlockFactor)
|
||||
{
|
||||
this.WriteRecord();
|
||||
}
|
||||
Array.Copy(block, 0, this.recordBuffer, this.currentBlockIndex * 512, 512);
|
||||
this.currentBlockIndex++;
|
||||
}
|
||||
|
||||
// Token: 0x060001B9 RID: 441 RVA: 0x0000A798 File Offset: 0x00009798
|
||||
public void WriteBlock(byte[] buffer, int offset)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (this.outputStream == null)
|
||||
{
|
||||
throw new TarException("TarBuffer.WriteBlock - no output stream stream defined");
|
||||
}
|
||||
if (offset < 0 || offset >= buffer.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset");
|
||||
}
|
||||
if (offset + 512 > buffer.Length)
|
||||
{
|
||||
string text = string.Format("TarBuffer.WriteBlock - record has length '{0}' with offset '{1}' which is less than the record size of '{2}'", buffer.Length, offset, this.recordSize);
|
||||
throw new TarException(text);
|
||||
}
|
||||
if (this.currentBlockIndex >= this.BlockFactor)
|
||||
{
|
||||
this.WriteRecord();
|
||||
}
|
||||
Array.Copy(buffer, offset, this.recordBuffer, this.currentBlockIndex * 512, 512);
|
||||
this.currentBlockIndex++;
|
||||
}
|
||||
|
||||
// Token: 0x060001BA RID: 442 RVA: 0x0000A854 File Offset: 0x00009854
|
||||
private void WriteRecord()
|
||||
{
|
||||
if (this.outputStream == null)
|
||||
{
|
||||
throw new TarException("TarBuffer.WriteRecord no output stream defined");
|
||||
}
|
||||
this.outputStream.Write(this.recordBuffer, 0, this.RecordSize);
|
||||
this.outputStream.Flush();
|
||||
this.currentBlockIndex = 0;
|
||||
this.currentRecordIndex++;
|
||||
}
|
||||
|
||||
// Token: 0x060001BB RID: 443 RVA: 0x0000A8AC File Offset: 0x000098AC
|
||||
private void WriteFinalRecord()
|
||||
{
|
||||
if (this.outputStream == null)
|
||||
{
|
||||
throw new TarException("TarBuffer.WriteFinalRecord no output stream defined");
|
||||
}
|
||||
if (this.currentBlockIndex > 0)
|
||||
{
|
||||
int num = this.currentBlockIndex * 512;
|
||||
Array.Clear(this.recordBuffer, num, this.RecordSize - num);
|
||||
this.WriteRecord();
|
||||
}
|
||||
this.outputStream.Flush();
|
||||
}
|
||||
|
||||
// Token: 0x060001BC RID: 444 RVA: 0x0000A908 File Offset: 0x00009908
|
||||
public void Close()
|
||||
{
|
||||
if (this.outputStream != null)
|
||||
{
|
||||
this.WriteFinalRecord();
|
||||
if (this.isStreamOwner_)
|
||||
{
|
||||
this.outputStream.Close();
|
||||
}
|
||||
this.outputStream = null;
|
||||
return;
|
||||
}
|
||||
if (this.inputStream != null)
|
||||
{
|
||||
if (this.isStreamOwner_)
|
||||
{
|
||||
this.inputStream.Close();
|
||||
}
|
||||
this.inputStream = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000ED RID: 237
|
||||
public const int BlockSize = 512;
|
||||
|
||||
// Token: 0x040000EE RID: 238
|
||||
public const int DefaultBlockFactor = 20;
|
||||
|
||||
// Token: 0x040000EF RID: 239
|
||||
public const int DefaultRecordSize = 10240;
|
||||
|
||||
// Token: 0x040000F0 RID: 240
|
||||
private Stream inputStream;
|
||||
|
||||
// Token: 0x040000F1 RID: 241
|
||||
private Stream outputStream;
|
||||
|
||||
// Token: 0x040000F2 RID: 242
|
||||
private byte[] recordBuffer;
|
||||
|
||||
// Token: 0x040000F3 RID: 243
|
||||
private int currentBlockIndex;
|
||||
|
||||
// Token: 0x040000F4 RID: 244
|
||||
private int currentRecordIndex;
|
||||
|
||||
// Token: 0x040000F5 RID: 245
|
||||
private int recordSize = 10240;
|
||||
|
||||
// Token: 0x040000F6 RID: 246
|
||||
private int blockFactor = 20;
|
||||
|
||||
// Token: 0x040000F7 RID: 247
|
||||
private bool isStreamOwner_ = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,340 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Tar
|
||||
{
|
||||
// Token: 0x02000036 RID: 54
|
||||
public class TarEntry : ICloneable
|
||||
{
|
||||
// Token: 0x060001BD RID: 445 RVA: 0x0000A960 File Offset: 0x00009960
|
||||
private TarEntry()
|
||||
{
|
||||
this.header = new TarHeader();
|
||||
}
|
||||
|
||||
// Token: 0x060001BE RID: 446 RVA: 0x0000A973 File Offset: 0x00009973
|
||||
public TarEntry(byte[] headerBuffer)
|
||||
{
|
||||
this.header = new TarHeader();
|
||||
this.header.ParseBuffer(headerBuffer);
|
||||
}
|
||||
|
||||
// Token: 0x060001BF RID: 447 RVA: 0x0000A992 File Offset: 0x00009992
|
||||
public TarEntry(TarHeader header)
|
||||
{
|
||||
if (header == null)
|
||||
{
|
||||
throw new ArgumentNullException("header");
|
||||
}
|
||||
this.header = (TarHeader)header.Clone();
|
||||
}
|
||||
|
||||
// Token: 0x060001C0 RID: 448 RVA: 0x0000A9BC File Offset: 0x000099BC
|
||||
public object Clone()
|
||||
{
|
||||
return new TarEntry
|
||||
{
|
||||
file = this.file,
|
||||
header = (TarHeader)this.header.Clone(),
|
||||
Name = this.Name
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x060001C1 RID: 449 RVA: 0x0000AA00 File Offset: 0x00009A00
|
||||
public static TarEntry CreateTarEntry(string name)
|
||||
{
|
||||
TarEntry tarEntry = new TarEntry();
|
||||
TarEntry.NameTarHeader(tarEntry.header, name);
|
||||
return tarEntry;
|
||||
}
|
||||
|
||||
// Token: 0x060001C2 RID: 450 RVA: 0x0000AA20 File Offset: 0x00009A20
|
||||
public static TarEntry CreateEntryFromFile(string fileName)
|
||||
{
|
||||
TarEntry tarEntry = new TarEntry();
|
||||
tarEntry.GetFileTarHeader(tarEntry.header, fileName);
|
||||
return tarEntry;
|
||||
}
|
||||
|
||||
// Token: 0x060001C3 RID: 451 RVA: 0x0000AA44 File Offset: 0x00009A44
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
TarEntry tarEntry = obj as TarEntry;
|
||||
return tarEntry != null && this.Name.Equals(tarEntry.Name);
|
||||
}
|
||||
|
||||
// Token: 0x060001C4 RID: 452 RVA: 0x0000AA6E File Offset: 0x00009A6E
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.Name.GetHashCode();
|
||||
}
|
||||
|
||||
// Token: 0x060001C5 RID: 453 RVA: 0x0000AA7B File Offset: 0x00009A7B
|
||||
public bool IsDescendent(TarEntry toTest)
|
||||
{
|
||||
if (toTest == null)
|
||||
{
|
||||
throw new ArgumentNullException("toTest");
|
||||
}
|
||||
return toTest.Name.StartsWith(this.Name);
|
||||
}
|
||||
|
||||
// Token: 0x17000058 RID: 88
|
||||
// (get) Token: 0x060001C6 RID: 454 RVA: 0x0000AA9C File Offset: 0x00009A9C
|
||||
public TarHeader TarHeader
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.header;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000059 RID: 89
|
||||
// (get) Token: 0x060001C7 RID: 455 RVA: 0x0000AAA4 File Offset: 0x00009AA4
|
||||
// (set) Token: 0x060001C8 RID: 456 RVA: 0x0000AAB1 File Offset: 0x00009AB1
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.header.Name;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.header.Name = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005A RID: 90
|
||||
// (get) Token: 0x060001C9 RID: 457 RVA: 0x0000AABF File Offset: 0x00009ABF
|
||||
// (set) Token: 0x060001CA RID: 458 RVA: 0x0000AACC File Offset: 0x00009ACC
|
||||
public int UserId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.header.UserId;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.header.UserId = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005B RID: 91
|
||||
// (get) Token: 0x060001CB RID: 459 RVA: 0x0000AADA File Offset: 0x00009ADA
|
||||
// (set) Token: 0x060001CC RID: 460 RVA: 0x0000AAE7 File Offset: 0x00009AE7
|
||||
public int GroupId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.header.GroupId;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.header.GroupId = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005C RID: 92
|
||||
// (get) Token: 0x060001CD RID: 461 RVA: 0x0000AAF5 File Offset: 0x00009AF5
|
||||
// (set) Token: 0x060001CE RID: 462 RVA: 0x0000AB02 File Offset: 0x00009B02
|
||||
public string UserName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.header.UserName;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.header.UserName = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005D RID: 93
|
||||
// (get) Token: 0x060001CF RID: 463 RVA: 0x0000AB10 File Offset: 0x00009B10
|
||||
// (set) Token: 0x060001D0 RID: 464 RVA: 0x0000AB1D File Offset: 0x00009B1D
|
||||
public string GroupName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.header.GroupName;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.header.GroupName = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001D1 RID: 465 RVA: 0x0000AB2B File Offset: 0x00009B2B
|
||||
public void SetIds(int userId, int groupId)
|
||||
{
|
||||
this.UserId = userId;
|
||||
this.GroupId = groupId;
|
||||
}
|
||||
|
||||
// Token: 0x060001D2 RID: 466 RVA: 0x0000AB3B File Offset: 0x00009B3B
|
||||
public void SetNames(string userName, string groupName)
|
||||
{
|
||||
this.UserName = userName;
|
||||
this.GroupName = groupName;
|
||||
}
|
||||
|
||||
// Token: 0x1700005E RID: 94
|
||||
// (get) Token: 0x060001D3 RID: 467 RVA: 0x0000AB4B File Offset: 0x00009B4B
|
||||
// (set) Token: 0x060001D4 RID: 468 RVA: 0x0000AB58 File Offset: 0x00009B58
|
||||
public DateTime ModTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.header.ModTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.header.ModTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005F RID: 95
|
||||
// (get) Token: 0x060001D5 RID: 469 RVA: 0x0000AB66 File Offset: 0x00009B66
|
||||
public string File
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.file;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000060 RID: 96
|
||||
// (get) Token: 0x060001D6 RID: 470 RVA: 0x0000AB6E File Offset: 0x00009B6E
|
||||
// (set) Token: 0x060001D7 RID: 471 RVA: 0x0000AB7B File Offset: 0x00009B7B
|
||||
public long Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.header.Size;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.header.Size = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000061 RID: 97
|
||||
// (get) Token: 0x060001D8 RID: 472 RVA: 0x0000AB8C File Offset: 0x00009B8C
|
||||
public bool IsDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.file != null)
|
||||
{
|
||||
return Directory.Exists(this.file);
|
||||
}
|
||||
return this.header != null && (this.header.TypeFlag == 53 || this.Name.EndsWith("/"));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001D9 RID: 473 RVA: 0x0000ABDC File Offset: 0x00009BDC
|
||||
public void GetFileTarHeader(TarHeader header, string file)
|
||||
{
|
||||
if (header == null)
|
||||
{
|
||||
throw new ArgumentNullException("header");
|
||||
}
|
||||
if (file == null)
|
||||
{
|
||||
throw new ArgumentNullException("file");
|
||||
}
|
||||
this.file = file;
|
||||
string text = file;
|
||||
if (text.IndexOf(Environment.CurrentDirectory) == 0)
|
||||
{
|
||||
text = text.Substring(Environment.CurrentDirectory.Length);
|
||||
}
|
||||
text = text.Replace(Path.DirectorySeparatorChar, '/');
|
||||
while (text.StartsWith("/"))
|
||||
{
|
||||
text = text.Substring(1);
|
||||
}
|
||||
header.LinkName = string.Empty;
|
||||
header.Name = text;
|
||||
if (Directory.Exists(file))
|
||||
{
|
||||
header.Mode = 1003;
|
||||
header.TypeFlag = 53;
|
||||
if (header.Name.Length == 0 || header.Name[header.Name.Length - 1] != '/')
|
||||
{
|
||||
header.Name += "/";
|
||||
}
|
||||
header.Size = 0L;
|
||||
}
|
||||
else
|
||||
{
|
||||
header.Mode = 33216;
|
||||
header.TypeFlag = 48;
|
||||
header.Size = new FileInfo(file.Replace('/', Path.DirectorySeparatorChar)).Length;
|
||||
}
|
||||
header.ModTime = global::System.IO.File.GetLastWriteTime(file.Replace('/', Path.DirectorySeparatorChar)).ToUniversalTime();
|
||||
header.DevMajor = 0;
|
||||
header.DevMinor = 0;
|
||||
}
|
||||
|
||||
// Token: 0x060001DA RID: 474 RVA: 0x0000AD28 File Offset: 0x00009D28
|
||||
public TarEntry[] GetDirectoryEntries()
|
||||
{
|
||||
if (this.file == null || !Directory.Exists(this.file))
|
||||
{
|
||||
return new TarEntry[0];
|
||||
}
|
||||
string[] fileSystemEntries = Directory.GetFileSystemEntries(this.file);
|
||||
TarEntry[] array = new TarEntry[fileSystemEntries.Length];
|
||||
for (int i = 0; i < fileSystemEntries.Length; i++)
|
||||
{
|
||||
array[i] = TarEntry.CreateEntryFromFile(fileSystemEntries[i]);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060001DB RID: 475 RVA: 0x0000AD80 File Offset: 0x00009D80
|
||||
public void WriteEntryHeader(byte[] outBuffer)
|
||||
{
|
||||
this.header.WriteHeader(outBuffer);
|
||||
}
|
||||
|
||||
// Token: 0x060001DC RID: 476 RVA: 0x0000AD8E File Offset: 0x00009D8E
|
||||
public static void AdjustEntryName(byte[] buffer, string newName)
|
||||
{
|
||||
TarHeader.GetNameBytes(newName, buffer, 0, 100);
|
||||
}
|
||||
|
||||
// Token: 0x060001DD RID: 477 RVA: 0x0000AD9C File Offset: 0x00009D9C
|
||||
public static void NameTarHeader(TarHeader header, string name)
|
||||
{
|
||||
if (header == null)
|
||||
{
|
||||
throw new ArgumentNullException("header");
|
||||
}
|
||||
if (name == null)
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
bool flag = name.EndsWith("/");
|
||||
header.Name = name;
|
||||
header.Mode = (flag ? 1003 : 33216);
|
||||
header.UserId = 0;
|
||||
header.GroupId = 0;
|
||||
header.Size = 0L;
|
||||
header.ModTime = DateTime.UtcNow;
|
||||
header.TypeFlag = (flag ? 53 : 48);
|
||||
header.LinkName = string.Empty;
|
||||
header.UserName = string.Empty;
|
||||
header.GroupName = string.Empty;
|
||||
header.DevMajor = 0;
|
||||
header.DevMinor = 0;
|
||||
}
|
||||
|
||||
// Token: 0x040000F8 RID: 248
|
||||
private string file;
|
||||
|
||||
// Token: 0x040000F9 RID: 249
|
||||
private TarHeader header;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Tar
|
||||
{
|
||||
// Token: 0x02000031 RID: 49
|
||||
[Serializable]
|
||||
public class TarException : SharpZipBaseException
|
||||
{
|
||||
// Token: 0x06000170 RID: 368 RVA: 0x00009963 File Offset: 0x00008963
|
||||
protected TarException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000171 RID: 369 RVA: 0x0000996D File Offset: 0x0000896D
|
||||
public TarException()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000172 RID: 370 RVA: 0x00009975 File Offset: 0x00008975
|
||||
public TarException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000173 RID: 371 RVA: 0x0000997E File Offset: 0x0000897E
|
||||
public TarException(string message, Exception exception)
|
||||
: base(message, exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,855 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Tar
|
||||
{
|
||||
// Token: 0x02000037 RID: 55
|
||||
public class TarHeader : ICloneable
|
||||
{
|
||||
// Token: 0x060001DE RID: 478 RVA: 0x0000AE4C File Offset: 0x00009E4C
|
||||
public TarHeader()
|
||||
{
|
||||
this.Magic = "ustar ";
|
||||
this.Version = " ";
|
||||
this.Name = "";
|
||||
this.LinkName = "";
|
||||
this.UserId = TarHeader.defaultUserId;
|
||||
this.GroupId = TarHeader.defaultGroupId;
|
||||
this.UserName = TarHeader.defaultUser;
|
||||
this.GroupName = TarHeader.defaultGroupName;
|
||||
this.Size = 0L;
|
||||
}
|
||||
|
||||
// Token: 0x17000062 RID: 98
|
||||
// (get) Token: 0x060001DF RID: 479 RVA: 0x0000AEBF File Offset: 0x00009EBF
|
||||
// (set) Token: 0x060001E0 RID: 480 RVA: 0x0000AEC7 File Offset: 0x00009EC7
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
this.name = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001E1 RID: 481 RVA: 0x0000AEDE File Offset: 0x00009EDE
|
||||
[Obsolete("Use the Name property instead", true)]
|
||||
public string GetName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
// Token: 0x17000063 RID: 99
|
||||
// (get) Token: 0x060001E2 RID: 482 RVA: 0x0000AEE6 File Offset: 0x00009EE6
|
||||
// (set) Token: 0x060001E3 RID: 483 RVA: 0x0000AEEE File Offset: 0x00009EEE
|
||||
public int Mode
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mode;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.mode = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000064 RID: 100
|
||||
// (get) Token: 0x060001E4 RID: 484 RVA: 0x0000AEF7 File Offset: 0x00009EF7
|
||||
// (set) Token: 0x060001E5 RID: 485 RVA: 0x0000AEFF File Offset: 0x00009EFF
|
||||
public int UserId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.userId;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.userId = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000065 RID: 101
|
||||
// (get) Token: 0x060001E6 RID: 486 RVA: 0x0000AF08 File Offset: 0x00009F08
|
||||
// (set) Token: 0x060001E7 RID: 487 RVA: 0x0000AF10 File Offset: 0x00009F10
|
||||
public int GroupId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.groupId;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.groupId = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000066 RID: 102
|
||||
// (get) Token: 0x060001E8 RID: 488 RVA: 0x0000AF19 File Offset: 0x00009F19
|
||||
// (set) Token: 0x060001E9 RID: 489 RVA: 0x0000AF21 File Offset: 0x00009F21
|
||||
public long Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.size;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "Cannot be less than zero");
|
||||
}
|
||||
this.size = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000067 RID: 103
|
||||
// (get) Token: 0x060001EA RID: 490 RVA: 0x0000AF3F File Offset: 0x00009F3F
|
||||
// (set) Token: 0x060001EB RID: 491 RVA: 0x0000AF48 File Offset: 0x00009F48
|
||||
public DateTime ModTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.modTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < TarHeader.dateTime1970)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "ModTime cannot be before Jan 1st 1970");
|
||||
}
|
||||
this.modTime = new DateTime(value.Year, value.Month, value.Day, value.Hour, value.Minute, value.Second);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000068 RID: 104
|
||||
// (get) Token: 0x060001EC RID: 492 RVA: 0x0000AFA7 File Offset: 0x00009FA7
|
||||
public int Checksum
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.checksum;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000069 RID: 105
|
||||
// (get) Token: 0x060001ED RID: 493 RVA: 0x0000AFAF File Offset: 0x00009FAF
|
||||
public bool IsChecksumValid
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.isChecksumValid;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700006A RID: 106
|
||||
// (get) Token: 0x060001EE RID: 494 RVA: 0x0000AFB7 File Offset: 0x00009FB7
|
||||
// (set) Token: 0x060001EF RID: 495 RVA: 0x0000AFBF File Offset: 0x00009FBF
|
||||
public byte TypeFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.typeFlag;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.typeFlag = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700006B RID: 107
|
||||
// (get) Token: 0x060001F0 RID: 496 RVA: 0x0000AFC8 File Offset: 0x00009FC8
|
||||
// (set) Token: 0x060001F1 RID: 497 RVA: 0x0000AFD0 File Offset: 0x00009FD0
|
||||
public string LinkName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.linkName;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
this.linkName = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700006C RID: 108
|
||||
// (get) Token: 0x060001F2 RID: 498 RVA: 0x0000AFE7 File Offset: 0x00009FE7
|
||||
// (set) Token: 0x060001F3 RID: 499 RVA: 0x0000AFEF File Offset: 0x00009FEF
|
||||
public string Magic
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.magic;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
this.magic = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700006D RID: 109
|
||||
// (get) Token: 0x060001F4 RID: 500 RVA: 0x0000B006 File Offset: 0x0000A006
|
||||
// (set) Token: 0x060001F5 RID: 501 RVA: 0x0000B00E File Offset: 0x0000A00E
|
||||
public string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.version;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
this.version = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700006E RID: 110
|
||||
// (get) Token: 0x060001F6 RID: 502 RVA: 0x0000B025 File Offset: 0x0000A025
|
||||
// (set) Token: 0x060001F7 RID: 503 RVA: 0x0000B030 File Offset: 0x0000A030
|
||||
public string UserName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.userName;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
this.userName = value.Substring(0, Math.Min(32, value.Length));
|
||||
return;
|
||||
}
|
||||
string text = Environment.UserName;
|
||||
if (text.Length > 32)
|
||||
{
|
||||
text = text.Substring(0, 32);
|
||||
}
|
||||
this.userName = text;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700006F RID: 111
|
||||
// (get) Token: 0x060001F8 RID: 504 RVA: 0x0000B07C File Offset: 0x0000A07C
|
||||
// (set) Token: 0x060001F9 RID: 505 RVA: 0x0000B084 File Offset: 0x0000A084
|
||||
public string GroupName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.groupName;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
this.groupName = "None";
|
||||
return;
|
||||
}
|
||||
this.groupName = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000070 RID: 112
|
||||
// (get) Token: 0x060001FA RID: 506 RVA: 0x0000B09C File Offset: 0x0000A09C
|
||||
// (set) Token: 0x060001FB RID: 507 RVA: 0x0000B0A4 File Offset: 0x0000A0A4
|
||||
public int DevMajor
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.devMajor;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.devMajor = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000071 RID: 113
|
||||
// (get) Token: 0x060001FC RID: 508 RVA: 0x0000B0AD File Offset: 0x0000A0AD
|
||||
// (set) Token: 0x060001FD RID: 509 RVA: 0x0000B0B5 File Offset: 0x0000A0B5
|
||||
public int DevMinor
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.devMinor;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.devMinor = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001FE RID: 510 RVA: 0x0000B0BE File Offset: 0x0000A0BE
|
||||
public object Clone()
|
||||
{
|
||||
return base.MemberwiseClone();
|
||||
}
|
||||
|
||||
// Token: 0x060001FF RID: 511 RVA: 0x0000B0C8 File Offset: 0x0000A0C8
|
||||
public void ParseBuffer(byte[] header)
|
||||
{
|
||||
if (header == null)
|
||||
{
|
||||
throw new ArgumentNullException("header");
|
||||
}
|
||||
int num = 0;
|
||||
this.name = TarHeader.ParseName(header, num, 100).ToString();
|
||||
num += 100;
|
||||
this.mode = (int)TarHeader.ParseOctal(header, num, 8);
|
||||
num += 8;
|
||||
this.UserId = (int)TarHeader.ParseOctal(header, num, 8);
|
||||
num += 8;
|
||||
this.GroupId = (int)TarHeader.ParseOctal(header, num, 8);
|
||||
num += 8;
|
||||
this.Size = TarHeader.ParseOctal(header, num, 12);
|
||||
num += 12;
|
||||
this.ModTime = TarHeader.GetDateTimeFromCTime(TarHeader.ParseOctal(header, num, 12));
|
||||
num += 12;
|
||||
this.checksum = (int)TarHeader.ParseOctal(header, num, 8);
|
||||
num += 8;
|
||||
this.TypeFlag = header[num++];
|
||||
this.LinkName = TarHeader.ParseName(header, num, 100).ToString();
|
||||
num += 100;
|
||||
this.Magic = TarHeader.ParseName(header, num, 6).ToString();
|
||||
num += 6;
|
||||
this.Version = TarHeader.ParseName(header, num, 2).ToString();
|
||||
num += 2;
|
||||
this.UserName = TarHeader.ParseName(header, num, 32).ToString();
|
||||
num += 32;
|
||||
this.GroupName = TarHeader.ParseName(header, num, 32).ToString();
|
||||
num += 32;
|
||||
this.DevMajor = (int)TarHeader.ParseOctal(header, num, 8);
|
||||
num += 8;
|
||||
this.DevMinor = (int)TarHeader.ParseOctal(header, num, 8);
|
||||
this.isChecksumValid = this.Checksum == TarHeader.MakeCheckSum(header);
|
||||
}
|
||||
|
||||
// Token: 0x06000200 RID: 512 RVA: 0x0000B234 File Offset: 0x0000A234
|
||||
public void WriteHeader(byte[] outBuffer)
|
||||
{
|
||||
if (outBuffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("outBuffer");
|
||||
}
|
||||
int i = 0;
|
||||
i = TarHeader.GetNameBytes(this.Name, outBuffer, i, 100);
|
||||
i = TarHeader.GetOctalBytes((long)this.mode, outBuffer, i, 8);
|
||||
i = TarHeader.GetOctalBytes((long)this.UserId, outBuffer, i, 8);
|
||||
i = TarHeader.GetOctalBytes((long)this.GroupId, outBuffer, i, 8);
|
||||
i = TarHeader.GetLongOctalBytes(this.Size, outBuffer, i, 12);
|
||||
i = TarHeader.GetLongOctalBytes((long)TarHeader.GetCTime(this.ModTime), outBuffer, i, 12);
|
||||
int num = i;
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
outBuffer[i++] = 32;
|
||||
}
|
||||
outBuffer[i++] = this.TypeFlag;
|
||||
i = TarHeader.GetNameBytes(this.LinkName, outBuffer, i, 100);
|
||||
i = TarHeader.GetAsciiBytes(this.Magic, 0, outBuffer, i, 6);
|
||||
i = TarHeader.GetNameBytes(this.Version, outBuffer, i, 2);
|
||||
i = TarHeader.GetNameBytes(this.UserName, outBuffer, i, 32);
|
||||
i = TarHeader.GetNameBytes(this.GroupName, outBuffer, i, 32);
|
||||
if (this.TypeFlag == 51 || this.TypeFlag == 52)
|
||||
{
|
||||
i = TarHeader.GetOctalBytes((long)this.DevMajor, outBuffer, i, 8);
|
||||
i = TarHeader.GetOctalBytes((long)this.DevMinor, outBuffer, i, 8);
|
||||
}
|
||||
while (i < outBuffer.Length)
|
||||
{
|
||||
outBuffer[i++] = 0;
|
||||
}
|
||||
this.checksum = TarHeader.ComputeCheckSum(outBuffer);
|
||||
TarHeader.GetCheckSumOctalBytes((long)this.checksum, outBuffer, num, 8);
|
||||
this.isChecksumValid = true;
|
||||
}
|
||||
|
||||
// Token: 0x06000201 RID: 513 RVA: 0x0000B391 File Offset: 0x0000A391
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.Name.GetHashCode();
|
||||
}
|
||||
|
||||
// Token: 0x06000202 RID: 514 RVA: 0x0000B3A0 File Offset: 0x0000A3A0
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
TarHeader tarHeader = obj as TarHeader;
|
||||
return tarHeader != null && (this.name == tarHeader.name && this.mode == tarHeader.mode && this.UserId == tarHeader.UserId && this.GroupId == tarHeader.GroupId && this.Size == tarHeader.Size && this.ModTime == tarHeader.ModTime && this.Checksum == tarHeader.Checksum && this.TypeFlag == tarHeader.TypeFlag && this.LinkName == tarHeader.LinkName && this.Magic == tarHeader.Magic && this.Version == tarHeader.Version && this.UserName == tarHeader.UserName && this.GroupName == tarHeader.GroupName && this.DevMajor == tarHeader.DevMajor) && this.DevMinor == tarHeader.DevMinor;
|
||||
}
|
||||
|
||||
// Token: 0x06000203 RID: 515 RVA: 0x0000B4CD File Offset: 0x0000A4CD
|
||||
internal static void SetValueDefaults(int userId, string userName, int groupId, string groupName)
|
||||
{
|
||||
TarHeader.userIdAsSet = userId;
|
||||
TarHeader.defaultUserId = userId;
|
||||
TarHeader.userNameAsSet = userName;
|
||||
TarHeader.defaultUser = userName;
|
||||
TarHeader.groupIdAsSet = groupId;
|
||||
TarHeader.defaultGroupId = groupId;
|
||||
TarHeader.groupNameAsSet = groupName;
|
||||
TarHeader.defaultGroupName = groupName;
|
||||
}
|
||||
|
||||
// Token: 0x06000204 RID: 516 RVA: 0x0000B4FF File Offset: 0x0000A4FF
|
||||
internal static void RestoreSetValues()
|
||||
{
|
||||
TarHeader.defaultUserId = TarHeader.userIdAsSet;
|
||||
TarHeader.defaultUser = TarHeader.userNameAsSet;
|
||||
TarHeader.defaultGroupId = TarHeader.groupIdAsSet;
|
||||
TarHeader.defaultGroupName = TarHeader.groupNameAsSet;
|
||||
}
|
||||
|
||||
// Token: 0x06000205 RID: 517 RVA: 0x0000B52C File Offset: 0x0000A52C
|
||||
public static long ParseOctal(byte[] header, int offset, int length)
|
||||
{
|
||||
if (header == null)
|
||||
{
|
||||
throw new ArgumentNullException("header");
|
||||
}
|
||||
long num = 0L;
|
||||
bool flag = true;
|
||||
int num2 = offset + length;
|
||||
int num3 = offset;
|
||||
while (num3 < num2 && header[num3] != 0)
|
||||
{
|
||||
if (header[num3] != 32 && header[num3] != 48)
|
||||
{
|
||||
goto IL_38;
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
if (header[num3] != 32)
|
||||
{
|
||||
goto IL_38;
|
||||
}
|
||||
break;
|
||||
}
|
||||
IL_46:
|
||||
num3++;
|
||||
continue;
|
||||
IL_38:
|
||||
flag = false;
|
||||
num = (num << 3) + (long)(header[num3] - 48);
|
||||
goto IL_46;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000206 RID: 518 RVA: 0x0000B588 File Offset: 0x0000A588
|
||||
public static StringBuilder ParseName(byte[] header, int offset, int length)
|
||||
{
|
||||
if (header == null)
|
||||
{
|
||||
throw new ArgumentNullException("header");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "Cannot be less than zero");
|
||||
}
|
||||
if (length < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("length", "Cannot be less than zero");
|
||||
}
|
||||
if (offset + length > header.Length)
|
||||
{
|
||||
throw new ArgumentException("Exceeds header size", "length");
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder(length);
|
||||
int num = offset;
|
||||
while (num < offset + length && header[num] != 0)
|
||||
{
|
||||
stringBuilder.Append((char)header[num]);
|
||||
num++;
|
||||
}
|
||||
return stringBuilder;
|
||||
}
|
||||
|
||||
// Token: 0x06000207 RID: 519 RVA: 0x0000B608 File Offset: 0x0000A608
|
||||
public static int GetNameBytes(StringBuilder name, int nameOffset, byte[] buffer, int bufferOffset, int length)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
return TarHeader.GetNameBytes(name.ToString(), nameOffset, buffer, bufferOffset, length);
|
||||
}
|
||||
|
||||
// Token: 0x06000208 RID: 520 RVA: 0x0000B638 File Offset: 0x0000A638
|
||||
public static int GetNameBytes(string name, int nameOffset, byte[] buffer, int bufferOffset, int length)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
int i;
|
||||
for (i = 0; i < length - 1; i++)
|
||||
{
|
||||
if (nameOffset + i >= name.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
buffer[bufferOffset + i] = (byte)name[nameOffset + i];
|
||||
}
|
||||
while (i < length)
|
||||
{
|
||||
buffer[bufferOffset + i] = 0;
|
||||
i++;
|
||||
}
|
||||
return bufferOffset + length;
|
||||
}
|
||||
|
||||
// Token: 0x06000209 RID: 521 RVA: 0x0000B69F File Offset: 0x0000A69F
|
||||
public static int GetNameBytes(StringBuilder name, byte[] buffer, int offset, int length)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
return TarHeader.GetNameBytes(name.ToString(), 0, buffer, offset, length);
|
||||
}
|
||||
|
||||
// Token: 0x0600020A RID: 522 RVA: 0x0000B6CC File Offset: 0x0000A6CC
|
||||
public static int GetNameBytes(string name, byte[] buffer, int offset, int length)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
return TarHeader.GetNameBytes(name, 0, buffer, offset, length);
|
||||
}
|
||||
|
||||
// Token: 0x0600020B RID: 523 RVA: 0x0000B6F4 File Offset: 0x0000A6F4
|
||||
public static int GetAsciiBytes(string toAdd, int nameOffset, byte[] buffer, int bufferOffset, int length)
|
||||
{
|
||||
if (toAdd == null)
|
||||
{
|
||||
throw new ArgumentNullException("toAdd");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
int num = 0;
|
||||
while (num < length && nameOffset + num < toAdd.Length)
|
||||
{
|
||||
buffer[bufferOffset + num] = (byte)toAdd[nameOffset + num];
|
||||
num++;
|
||||
}
|
||||
return bufferOffset + length;
|
||||
}
|
||||
|
||||
// Token: 0x0600020C RID: 524 RVA: 0x0000B748 File Offset: 0x0000A748
|
||||
public static int GetOctalBytes(long value, byte[] buffer, int offset, int length)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
int i = length - 1;
|
||||
buffer[offset + i] = 0;
|
||||
i--;
|
||||
if (value > 0L)
|
||||
{
|
||||
long num = value;
|
||||
while (i >= 0)
|
||||
{
|
||||
if (num <= 0L)
|
||||
{
|
||||
break;
|
||||
}
|
||||
buffer[offset + i] = 48 + (byte)(num & 7L);
|
||||
num >>= 3;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
while (i >= 0)
|
||||
{
|
||||
buffer[offset + i] = 48;
|
||||
i--;
|
||||
}
|
||||
return offset + length;
|
||||
}
|
||||
|
||||
// Token: 0x0600020D RID: 525 RVA: 0x0000B7AD File Offset: 0x0000A7AD
|
||||
public static int GetLongOctalBytes(long value, byte[] buffer, int offset, int length)
|
||||
{
|
||||
return TarHeader.GetOctalBytes(value, buffer, offset, length);
|
||||
}
|
||||
|
||||
// Token: 0x0600020E RID: 526 RVA: 0x0000B7B8 File Offset: 0x0000A7B8
|
||||
private static int GetCheckSumOctalBytes(long value, byte[] buffer, int offset, int length)
|
||||
{
|
||||
TarHeader.GetOctalBytes(value, buffer, offset, length - 1);
|
||||
return offset + length;
|
||||
}
|
||||
|
||||
// Token: 0x0600020F RID: 527 RVA: 0x0000B7CC File Offset: 0x0000A7CC
|
||||
private static int ComputeCheckSum(byte[] buffer)
|
||||
{
|
||||
int num = 0;
|
||||
for (int i = 0; i < buffer.Length; i++)
|
||||
{
|
||||
num += (int)buffer[i];
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000210 RID: 528 RVA: 0x0000B7F0 File Offset: 0x0000A7F0
|
||||
private static int MakeCheckSum(byte[] buffer)
|
||||
{
|
||||
int num = 0;
|
||||
for (int i = 0; i < 148; i++)
|
||||
{
|
||||
num += (int)buffer[i];
|
||||
}
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
num += 32;
|
||||
}
|
||||
for (int k = 156; k < buffer.Length; k++)
|
||||
{
|
||||
num += (int)buffer[k];
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000211 RID: 529 RVA: 0x0000B840 File Offset: 0x0000A840
|
||||
private static int GetCTime(DateTime dateTime)
|
||||
{
|
||||
return (int)((dateTime.Ticks - TarHeader.dateTime1970.Ticks) / 10000000L);
|
||||
}
|
||||
|
||||
// Token: 0x06000212 RID: 530 RVA: 0x0000B86C File Offset: 0x0000A86C
|
||||
private static DateTime GetDateTimeFromCTime(long ticks)
|
||||
{
|
||||
DateTime dateTime;
|
||||
try
|
||||
{
|
||||
dateTime = new DateTime(TarHeader.dateTime1970.Ticks + ticks * 10000000L);
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
dateTime = TarHeader.dateTime1970;
|
||||
}
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
// Token: 0x040000FA RID: 250
|
||||
public const int NAMELEN = 100;
|
||||
|
||||
// Token: 0x040000FB RID: 251
|
||||
public const int MODELEN = 8;
|
||||
|
||||
// Token: 0x040000FC RID: 252
|
||||
public const int UIDLEN = 8;
|
||||
|
||||
// Token: 0x040000FD RID: 253
|
||||
public const int GIDLEN = 8;
|
||||
|
||||
// Token: 0x040000FE RID: 254
|
||||
public const int CHKSUMLEN = 8;
|
||||
|
||||
// Token: 0x040000FF RID: 255
|
||||
public const int CHKSUMOFS = 148;
|
||||
|
||||
// Token: 0x04000100 RID: 256
|
||||
public const int SIZELEN = 12;
|
||||
|
||||
// Token: 0x04000101 RID: 257
|
||||
public const int MAGICLEN = 6;
|
||||
|
||||
// Token: 0x04000102 RID: 258
|
||||
public const int VERSIONLEN = 2;
|
||||
|
||||
// Token: 0x04000103 RID: 259
|
||||
public const int MODTIMELEN = 12;
|
||||
|
||||
// Token: 0x04000104 RID: 260
|
||||
public const int UNAMELEN = 32;
|
||||
|
||||
// Token: 0x04000105 RID: 261
|
||||
public const int GNAMELEN = 32;
|
||||
|
||||
// Token: 0x04000106 RID: 262
|
||||
public const int DEVLEN = 8;
|
||||
|
||||
// Token: 0x04000107 RID: 263
|
||||
public const byte LF_OLDNORM = 0;
|
||||
|
||||
// Token: 0x04000108 RID: 264
|
||||
public const byte LF_NORMAL = 48;
|
||||
|
||||
// Token: 0x04000109 RID: 265
|
||||
public const byte LF_LINK = 49;
|
||||
|
||||
// Token: 0x0400010A RID: 266
|
||||
public const byte LF_SYMLINK = 50;
|
||||
|
||||
// Token: 0x0400010B RID: 267
|
||||
public const byte LF_CHR = 51;
|
||||
|
||||
// Token: 0x0400010C RID: 268
|
||||
public const byte LF_BLK = 52;
|
||||
|
||||
// Token: 0x0400010D RID: 269
|
||||
public const byte LF_DIR = 53;
|
||||
|
||||
// Token: 0x0400010E RID: 270
|
||||
public const byte LF_FIFO = 54;
|
||||
|
||||
// Token: 0x0400010F RID: 271
|
||||
public const byte LF_CONTIG = 55;
|
||||
|
||||
// Token: 0x04000110 RID: 272
|
||||
public const byte LF_GHDR = 103;
|
||||
|
||||
// Token: 0x04000111 RID: 273
|
||||
public const byte LF_XHDR = 120;
|
||||
|
||||
// Token: 0x04000112 RID: 274
|
||||
public const byte LF_ACL = 65;
|
||||
|
||||
// Token: 0x04000113 RID: 275
|
||||
public const byte LF_GNU_DUMPDIR = 68;
|
||||
|
||||
// Token: 0x04000114 RID: 276
|
||||
public const byte LF_EXTATTR = 69;
|
||||
|
||||
// Token: 0x04000115 RID: 277
|
||||
public const byte LF_META = 73;
|
||||
|
||||
// Token: 0x04000116 RID: 278
|
||||
public const byte LF_GNU_LONGLINK = 75;
|
||||
|
||||
// Token: 0x04000117 RID: 279
|
||||
public const byte LF_GNU_LONGNAME = 76;
|
||||
|
||||
// Token: 0x04000118 RID: 280
|
||||
public const byte LF_GNU_MULTIVOL = 77;
|
||||
|
||||
// Token: 0x04000119 RID: 281
|
||||
public const byte LF_GNU_NAMES = 78;
|
||||
|
||||
// Token: 0x0400011A RID: 282
|
||||
public const byte LF_GNU_SPARSE = 83;
|
||||
|
||||
// Token: 0x0400011B RID: 283
|
||||
public const byte LF_GNU_VOLHDR = 86;
|
||||
|
||||
// Token: 0x0400011C RID: 284
|
||||
public const string TMAGIC = "ustar ";
|
||||
|
||||
// Token: 0x0400011D RID: 285
|
||||
public const string GNU_TMAGIC = "ustar ";
|
||||
|
||||
// Token: 0x0400011E RID: 286
|
||||
private const long timeConversionFactor = 10000000L;
|
||||
|
||||
// Token: 0x0400011F RID: 287
|
||||
private static readonly DateTime dateTime1970 = new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||
|
||||
// Token: 0x04000120 RID: 288
|
||||
private string name;
|
||||
|
||||
// Token: 0x04000121 RID: 289
|
||||
private int mode;
|
||||
|
||||
// Token: 0x04000122 RID: 290
|
||||
private int userId;
|
||||
|
||||
// Token: 0x04000123 RID: 291
|
||||
private int groupId;
|
||||
|
||||
// Token: 0x04000124 RID: 292
|
||||
private long size;
|
||||
|
||||
// Token: 0x04000125 RID: 293
|
||||
private DateTime modTime;
|
||||
|
||||
// Token: 0x04000126 RID: 294
|
||||
private int checksum;
|
||||
|
||||
// Token: 0x04000127 RID: 295
|
||||
private bool isChecksumValid;
|
||||
|
||||
// Token: 0x04000128 RID: 296
|
||||
private byte typeFlag;
|
||||
|
||||
// Token: 0x04000129 RID: 297
|
||||
private string linkName;
|
||||
|
||||
// Token: 0x0400012A RID: 298
|
||||
private string magic;
|
||||
|
||||
// Token: 0x0400012B RID: 299
|
||||
private string version;
|
||||
|
||||
// Token: 0x0400012C RID: 300
|
||||
private string userName;
|
||||
|
||||
// Token: 0x0400012D RID: 301
|
||||
private string groupName;
|
||||
|
||||
// Token: 0x0400012E RID: 302
|
||||
private int devMajor;
|
||||
|
||||
// Token: 0x0400012F RID: 303
|
||||
private int devMinor;
|
||||
|
||||
// Token: 0x04000130 RID: 304
|
||||
internal static int userIdAsSet;
|
||||
|
||||
// Token: 0x04000131 RID: 305
|
||||
internal static int groupIdAsSet;
|
||||
|
||||
// Token: 0x04000132 RID: 306
|
||||
internal static string userNameAsSet;
|
||||
|
||||
// Token: 0x04000133 RID: 307
|
||||
internal static string groupNameAsSet = "None";
|
||||
|
||||
// Token: 0x04000134 RID: 308
|
||||
internal static int defaultUserId;
|
||||
|
||||
// Token: 0x04000135 RID: 309
|
||||
internal static int defaultGroupId;
|
||||
|
||||
// Token: 0x04000136 RID: 310
|
||||
internal static string defaultGroupName = "None";
|
||||
|
||||
// Token: 0x04000137 RID: 311
|
||||
internal static string defaultUser;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,461 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Tar
|
||||
{
|
||||
// Token: 0x02000038 RID: 56
|
||||
public class TarInputStream : Stream
|
||||
{
|
||||
// Token: 0x06000214 RID: 532 RVA: 0x0000B8DF File Offset: 0x0000A8DF
|
||||
public TarInputStream(Stream inputStream)
|
||||
: this(inputStream, 20)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000215 RID: 533 RVA: 0x0000B8EA File Offset: 0x0000A8EA
|
||||
public TarInputStream(Stream inputStream, int blockFactor)
|
||||
{
|
||||
this.inputStream = inputStream;
|
||||
this.tarBuffer = TarBuffer.CreateInputTarBuffer(inputStream, blockFactor);
|
||||
}
|
||||
|
||||
// Token: 0x17000072 RID: 114
|
||||
// (get) Token: 0x06000216 RID: 534 RVA: 0x0000B906 File Offset: 0x0000A906
|
||||
// (set) Token: 0x06000217 RID: 535 RVA: 0x0000B913 File Offset: 0x0000A913
|
||||
public bool IsStreamOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.tarBuffer.IsStreamOwner;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.tarBuffer.IsStreamOwner = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000073 RID: 115
|
||||
// (get) Token: 0x06000218 RID: 536 RVA: 0x0000B921 File Offset: 0x0000A921
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.inputStream.CanRead;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000074 RID: 116
|
||||
// (get) Token: 0x06000219 RID: 537 RVA: 0x0000B92E File Offset: 0x0000A92E
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000075 RID: 117
|
||||
// (get) Token: 0x0600021A RID: 538 RVA: 0x0000B931 File Offset: 0x0000A931
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000076 RID: 118
|
||||
// (get) Token: 0x0600021B RID: 539 RVA: 0x0000B934 File Offset: 0x0000A934
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.inputStream.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000077 RID: 119
|
||||
// (get) Token: 0x0600021C RID: 540 RVA: 0x0000B941 File Offset: 0x0000A941
|
||||
// (set) Token: 0x0600021D RID: 541 RVA: 0x0000B94E File Offset: 0x0000A94E
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.inputStream.Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotSupportedException("TarInputStream Seek not supported");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600021E RID: 542 RVA: 0x0000B95A File Offset: 0x0000A95A
|
||||
public override void Flush()
|
||||
{
|
||||
this.inputStream.Flush();
|
||||
}
|
||||
|
||||
// Token: 0x0600021F RID: 543 RVA: 0x0000B967 File Offset: 0x0000A967
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotSupportedException("TarInputStream Seek not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000220 RID: 544 RVA: 0x0000B973 File Offset: 0x0000A973
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException("TarInputStream SetLength not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000221 RID: 545 RVA: 0x0000B97F File Offset: 0x0000A97F
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException("TarInputStream Write not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000222 RID: 546 RVA: 0x0000B98B File Offset: 0x0000A98B
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
throw new NotSupportedException("TarInputStream WriteByte not supported");
|
||||
}
|
||||
|
||||
// Token: 0x06000223 RID: 547 RVA: 0x0000B998 File Offset: 0x0000A998
|
||||
public override int ReadByte()
|
||||
{
|
||||
byte[] array = new byte[1];
|
||||
int num = this.Read(array, 0, 1);
|
||||
if (num <= 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return (int)array[0];
|
||||
}
|
||||
|
||||
// Token: 0x06000224 RID: 548 RVA: 0x0000B9C0 File Offset: 0x0000A9C0
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
int num = 0;
|
||||
if (this.entryOffset >= this.entrySize)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
long num2 = (long)count;
|
||||
if (num2 + this.entryOffset > this.entrySize)
|
||||
{
|
||||
num2 = this.entrySize - this.entryOffset;
|
||||
}
|
||||
if (this.readBuffer != null)
|
||||
{
|
||||
int num3 = ((num2 > (long)this.readBuffer.Length) ? this.readBuffer.Length : ((int)num2));
|
||||
Array.Copy(this.readBuffer, 0, buffer, offset, num3);
|
||||
if (num3 >= this.readBuffer.Length)
|
||||
{
|
||||
this.readBuffer = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num4 = this.readBuffer.Length - num3;
|
||||
byte[] array = new byte[num4];
|
||||
Array.Copy(this.readBuffer, num3, array, 0, num4);
|
||||
this.readBuffer = array;
|
||||
}
|
||||
num += num3;
|
||||
num2 -= (long)num3;
|
||||
offset += num3;
|
||||
}
|
||||
while (num2 > 0L)
|
||||
{
|
||||
byte[] array2 = this.tarBuffer.ReadBlock();
|
||||
if (array2 == null)
|
||||
{
|
||||
throw new TarException("unexpected EOF with " + num2 + " bytes unread");
|
||||
}
|
||||
int num5 = (int)num2;
|
||||
int num6 = array2.Length;
|
||||
if (num6 > num5)
|
||||
{
|
||||
Array.Copy(array2, 0, buffer, offset, num5);
|
||||
this.readBuffer = new byte[num6 - num5];
|
||||
Array.Copy(array2, num5, this.readBuffer, 0, num6 - num5);
|
||||
}
|
||||
else
|
||||
{
|
||||
num5 = num6;
|
||||
Array.Copy(array2, 0, buffer, offset, num6);
|
||||
}
|
||||
num += num5;
|
||||
num2 -= (long)num5;
|
||||
offset += num5;
|
||||
}
|
||||
this.entryOffset += (long)num;
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000225 RID: 549 RVA: 0x0000BB3B File Offset: 0x0000AB3B
|
||||
public override void Close()
|
||||
{
|
||||
this.tarBuffer.Close();
|
||||
}
|
||||
|
||||
// Token: 0x06000226 RID: 550 RVA: 0x0000BB48 File Offset: 0x0000AB48
|
||||
public void SetEntryFactory(TarInputStream.IEntryFactory factory)
|
||||
{
|
||||
this.entryFactory = factory;
|
||||
}
|
||||
|
||||
// Token: 0x17000078 RID: 120
|
||||
// (get) Token: 0x06000227 RID: 551 RVA: 0x0000BB51 File Offset: 0x0000AB51
|
||||
public int RecordSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.tarBuffer.RecordSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000228 RID: 552 RVA: 0x0000BB5E File Offset: 0x0000AB5E
|
||||
[Obsolete("Use RecordSize property instead")]
|
||||
public int GetRecordSize()
|
||||
{
|
||||
return this.tarBuffer.RecordSize;
|
||||
}
|
||||
|
||||
// Token: 0x17000079 RID: 121
|
||||
// (get) Token: 0x06000229 RID: 553 RVA: 0x0000BB6B File Offset: 0x0000AB6B
|
||||
public long Available
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.entrySize - this.entryOffset;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600022A RID: 554 RVA: 0x0000BB7C File Offset: 0x0000AB7C
|
||||
public void Skip(long skipCount)
|
||||
{
|
||||
byte[] array = new byte[8192];
|
||||
int num3;
|
||||
for (long num = skipCount; num > 0L; num -= (long)num3)
|
||||
{
|
||||
int num2 = ((num > (long)array.Length) ? array.Length : ((int)num));
|
||||
num3 = this.Read(array, 0, num2);
|
||||
if (num3 == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007A RID: 122
|
||||
// (get) Token: 0x0600022B RID: 555 RVA: 0x0000BBC0 File Offset: 0x0000ABC0
|
||||
public bool IsMarkSupported
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600022C RID: 556 RVA: 0x0000BBC3 File Offset: 0x0000ABC3
|
||||
public void Mark(int markLimit)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600022D RID: 557 RVA: 0x0000BBC5 File Offset: 0x0000ABC5
|
||||
public void Reset()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600022E RID: 558 RVA: 0x0000BBC8 File Offset: 0x0000ABC8
|
||||
public TarEntry GetNextEntry()
|
||||
{
|
||||
if (this.hasHitEOF)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (this.currentEntry != null)
|
||||
{
|
||||
this.SkipToNextEntry();
|
||||
}
|
||||
byte[] array = this.tarBuffer.ReadBlock();
|
||||
if (array == null)
|
||||
{
|
||||
this.hasHitEOF = true;
|
||||
}
|
||||
else if (TarBuffer.IsEndOfArchiveBlock(array))
|
||||
{
|
||||
this.hasHitEOF = true;
|
||||
}
|
||||
if (this.hasHitEOF)
|
||||
{
|
||||
this.currentEntry = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
TarHeader tarHeader = new TarHeader();
|
||||
tarHeader.ParseBuffer(array);
|
||||
if (!tarHeader.IsChecksumValid)
|
||||
{
|
||||
throw new TarException("Header checksum is invalid");
|
||||
}
|
||||
this.entryOffset = 0L;
|
||||
this.entrySize = tarHeader.Size;
|
||||
StringBuilder stringBuilder = null;
|
||||
if (tarHeader.TypeFlag == 76)
|
||||
{
|
||||
byte[] array2 = new byte[512];
|
||||
long num = this.entrySize;
|
||||
stringBuilder = new StringBuilder();
|
||||
while (num > 0L)
|
||||
{
|
||||
int num2 = this.Read(array2, 0, (num > (long)array2.Length) ? array2.Length : ((int)num));
|
||||
if (num2 == -1)
|
||||
{
|
||||
throw new InvalidHeaderException("Failed to read long name entry");
|
||||
}
|
||||
stringBuilder.Append(TarHeader.ParseName(array2, 0, num2).ToString());
|
||||
num -= (long)num2;
|
||||
}
|
||||
this.SkipToNextEntry();
|
||||
array = this.tarBuffer.ReadBlock();
|
||||
}
|
||||
else if (tarHeader.TypeFlag == 103)
|
||||
{
|
||||
this.SkipToNextEntry();
|
||||
array = this.tarBuffer.ReadBlock();
|
||||
}
|
||||
else if (tarHeader.TypeFlag == 120)
|
||||
{
|
||||
this.SkipToNextEntry();
|
||||
array = this.tarBuffer.ReadBlock();
|
||||
}
|
||||
else if (tarHeader.TypeFlag == 86)
|
||||
{
|
||||
this.SkipToNextEntry();
|
||||
array = this.tarBuffer.ReadBlock();
|
||||
}
|
||||
else if (tarHeader.TypeFlag != 48 && tarHeader.TypeFlag != 0 && tarHeader.TypeFlag != 53)
|
||||
{
|
||||
this.SkipToNextEntry();
|
||||
array = this.tarBuffer.ReadBlock();
|
||||
}
|
||||
if (this.entryFactory == null)
|
||||
{
|
||||
this.currentEntry = new TarEntry(array);
|
||||
if (stringBuilder != null)
|
||||
{
|
||||
this.currentEntry.Name = stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.currentEntry = this.entryFactory.CreateEntry(array);
|
||||
}
|
||||
this.entryOffset = 0L;
|
||||
this.entrySize = this.currentEntry.Size;
|
||||
}
|
||||
catch (InvalidHeaderException ex)
|
||||
{
|
||||
this.entrySize = 0L;
|
||||
this.entryOffset = 0L;
|
||||
this.currentEntry = null;
|
||||
string text = string.Format("Bad header in record {0} block {1} {2}", this.tarBuffer.CurrentRecord, this.tarBuffer.CurrentBlock, ex.Message);
|
||||
throw new InvalidHeaderException(text);
|
||||
}
|
||||
}
|
||||
return this.currentEntry;
|
||||
}
|
||||
|
||||
// Token: 0x0600022F RID: 559 RVA: 0x0000BE3C File Offset: 0x0000AE3C
|
||||
public void CopyEntryContents(Stream outputStream)
|
||||
{
|
||||
byte[] array = new byte[32768];
|
||||
for (;;)
|
||||
{
|
||||
int num = this.Read(array, 0, array.Length);
|
||||
if (num <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
outputStream.Write(array, 0, num);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000230 RID: 560 RVA: 0x0000BE70 File Offset: 0x0000AE70
|
||||
private void SkipToNextEntry()
|
||||
{
|
||||
long num = this.entrySize - this.entryOffset;
|
||||
if (num > 0L)
|
||||
{
|
||||
this.Skip(num);
|
||||
}
|
||||
this.readBuffer = null;
|
||||
}
|
||||
|
||||
// Token: 0x04000138 RID: 312
|
||||
protected bool hasHitEOF;
|
||||
|
||||
// Token: 0x04000139 RID: 313
|
||||
protected long entrySize;
|
||||
|
||||
// Token: 0x0400013A RID: 314
|
||||
protected long entryOffset;
|
||||
|
||||
// Token: 0x0400013B RID: 315
|
||||
protected byte[] readBuffer;
|
||||
|
||||
// Token: 0x0400013C RID: 316
|
||||
protected TarBuffer tarBuffer;
|
||||
|
||||
// Token: 0x0400013D RID: 317
|
||||
private TarEntry currentEntry;
|
||||
|
||||
// Token: 0x0400013E RID: 318
|
||||
protected TarInputStream.IEntryFactory entryFactory;
|
||||
|
||||
// Token: 0x0400013F RID: 319
|
||||
private readonly Stream inputStream;
|
||||
|
||||
// Token: 0x02000039 RID: 57
|
||||
public interface IEntryFactory
|
||||
{
|
||||
// Token: 0x06000231 RID: 561
|
||||
TarEntry CreateEntry(string name);
|
||||
|
||||
// Token: 0x06000232 RID: 562
|
||||
TarEntry CreateEntryFromFile(string fileName);
|
||||
|
||||
// Token: 0x06000233 RID: 563
|
||||
TarEntry CreateEntry(byte[] headerBuffer);
|
||||
}
|
||||
|
||||
// Token: 0x0200003A RID: 58
|
||||
public class EntryFactoryAdapter : TarInputStream.IEntryFactory
|
||||
{
|
||||
// Token: 0x06000234 RID: 564 RVA: 0x0000BE9E File Offset: 0x0000AE9E
|
||||
public TarEntry CreateEntry(string name)
|
||||
{
|
||||
return TarEntry.CreateTarEntry(name);
|
||||
}
|
||||
|
||||
// Token: 0x06000235 RID: 565 RVA: 0x0000BEA6 File Offset: 0x0000AEA6
|
||||
public TarEntry CreateEntryFromFile(string fileName)
|
||||
{
|
||||
return TarEntry.CreateEntryFromFile(fileName);
|
||||
}
|
||||
|
||||
// Token: 0x06000236 RID: 566 RVA: 0x0000BEAE File Offset: 0x0000AEAE
|
||||
public TarEntry CreateEntry(byte[] headerBuffer)
|
||||
{
|
||||
return new TarEntry(headerBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,326 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib.Tar
|
||||
{
|
||||
// Token: 0x0200003B RID: 59
|
||||
public class TarOutputStream : Stream
|
||||
{
|
||||
// Token: 0x06000238 RID: 568 RVA: 0x0000BEBE File Offset: 0x0000AEBE
|
||||
public TarOutputStream(Stream outputStream)
|
||||
: this(outputStream, 20)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000239 RID: 569 RVA: 0x0000BECC File Offset: 0x0000AECC
|
||||
public TarOutputStream(Stream outputStream, int blockFactor)
|
||||
{
|
||||
if (outputStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("outputStream");
|
||||
}
|
||||
this.outputStream = outputStream;
|
||||
this.buffer = TarBuffer.CreateOutputTarBuffer(outputStream, blockFactor);
|
||||
this.assemblyBuffer = new byte[512];
|
||||
this.blockBuffer = new byte[512];
|
||||
}
|
||||
|
||||
// Token: 0x1700007B RID: 123
|
||||
// (get) Token: 0x0600023A RID: 570 RVA: 0x0000BF21 File Offset: 0x0000AF21
|
||||
// (set) Token: 0x0600023B RID: 571 RVA: 0x0000BF2E File Offset: 0x0000AF2E
|
||||
public bool IsStreamOwner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.buffer.IsStreamOwner;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.buffer.IsStreamOwner = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007C RID: 124
|
||||
// (get) Token: 0x0600023C RID: 572 RVA: 0x0000BF3C File Offset: 0x0000AF3C
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.outputStream.CanRead;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007D RID: 125
|
||||
// (get) Token: 0x0600023D RID: 573 RVA: 0x0000BF49 File Offset: 0x0000AF49
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.outputStream.CanSeek;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007E RID: 126
|
||||
// (get) Token: 0x0600023E RID: 574 RVA: 0x0000BF56 File Offset: 0x0000AF56
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.outputStream.CanWrite;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700007F RID: 127
|
||||
// (get) Token: 0x0600023F RID: 575 RVA: 0x0000BF63 File Offset: 0x0000AF63
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.outputStream.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000080 RID: 128
|
||||
// (get) Token: 0x06000240 RID: 576 RVA: 0x0000BF70 File Offset: 0x0000AF70
|
||||
// (set) Token: 0x06000241 RID: 577 RVA: 0x0000BF7D File Offset: 0x0000AF7D
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.outputStream.Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.outputStream.Position = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000242 RID: 578 RVA: 0x0000BF8B File Offset: 0x0000AF8B
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
return this.outputStream.Seek(offset, origin);
|
||||
}
|
||||
|
||||
// Token: 0x06000243 RID: 579 RVA: 0x0000BF9A File Offset: 0x0000AF9A
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
this.outputStream.SetLength(value);
|
||||
}
|
||||
|
||||
// Token: 0x06000244 RID: 580 RVA: 0x0000BFA8 File Offset: 0x0000AFA8
|
||||
public override int ReadByte()
|
||||
{
|
||||
return this.outputStream.ReadByte();
|
||||
}
|
||||
|
||||
// Token: 0x06000245 RID: 581 RVA: 0x0000BFB5 File Offset: 0x0000AFB5
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
return this.outputStream.Read(buffer, offset, count);
|
||||
}
|
||||
|
||||
// Token: 0x06000246 RID: 582 RVA: 0x0000BFC5 File Offset: 0x0000AFC5
|
||||
public override void Flush()
|
||||
{
|
||||
this.outputStream.Flush();
|
||||
}
|
||||
|
||||
// Token: 0x06000247 RID: 583 RVA: 0x0000BFD2 File Offset: 0x0000AFD2
|
||||
public void Finish()
|
||||
{
|
||||
if (this.IsEntryOpen)
|
||||
{
|
||||
this.CloseEntry();
|
||||
}
|
||||
this.WriteEofBlock();
|
||||
}
|
||||
|
||||
// Token: 0x06000248 RID: 584 RVA: 0x0000BFE8 File Offset: 0x0000AFE8
|
||||
public override void Close()
|
||||
{
|
||||
if (!this.isClosed)
|
||||
{
|
||||
this.isClosed = true;
|
||||
this.Finish();
|
||||
this.buffer.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000081 RID: 129
|
||||
// (get) Token: 0x06000249 RID: 585 RVA: 0x0000C00A File Offset: 0x0000B00A
|
||||
public int RecordSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.buffer.RecordSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600024A RID: 586 RVA: 0x0000C017 File Offset: 0x0000B017
|
||||
[Obsolete("Use RecordSize property instead")]
|
||||
public int GetRecordSize()
|
||||
{
|
||||
return this.buffer.RecordSize;
|
||||
}
|
||||
|
||||
// Token: 0x17000082 RID: 130
|
||||
// (get) Token: 0x0600024B RID: 587 RVA: 0x0000C024 File Offset: 0x0000B024
|
||||
private bool IsEntryOpen
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.currBytes < this.currSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600024C RID: 588 RVA: 0x0000C034 File Offset: 0x0000B034
|
||||
public void PutNextEntry(TarEntry entry)
|
||||
{
|
||||
if (entry == null)
|
||||
{
|
||||
throw new ArgumentNullException("entry");
|
||||
}
|
||||
if (entry.TarHeader.Name.Length >= 100)
|
||||
{
|
||||
TarHeader tarHeader = new TarHeader();
|
||||
tarHeader.TypeFlag = 76;
|
||||
tarHeader.Name += "././@LongLink";
|
||||
tarHeader.UserId = 0;
|
||||
tarHeader.GroupId = 0;
|
||||
tarHeader.GroupName = "";
|
||||
tarHeader.UserName = "";
|
||||
tarHeader.LinkName = "";
|
||||
tarHeader.Size = (long)entry.TarHeader.Name.Length;
|
||||
tarHeader.WriteHeader(this.blockBuffer);
|
||||
this.buffer.WriteBlock(this.blockBuffer);
|
||||
int i = 0;
|
||||
while (i < entry.TarHeader.Name.Length)
|
||||
{
|
||||
Array.Clear(this.blockBuffer, 0, this.blockBuffer.Length);
|
||||
TarHeader.GetAsciiBytes(entry.TarHeader.Name, i, this.blockBuffer, 0, 512);
|
||||
i += 512;
|
||||
this.buffer.WriteBlock(this.blockBuffer);
|
||||
}
|
||||
}
|
||||
entry.WriteEntryHeader(this.blockBuffer);
|
||||
this.buffer.WriteBlock(this.blockBuffer);
|
||||
this.currBytes = 0L;
|
||||
this.currSize = (entry.IsDirectory ? 0L : entry.Size);
|
||||
}
|
||||
|
||||
// Token: 0x0600024D RID: 589 RVA: 0x0000C18C File Offset: 0x0000B18C
|
||||
public void CloseEntry()
|
||||
{
|
||||
if (this.assemblyBufferLength > 0)
|
||||
{
|
||||
Array.Clear(this.assemblyBuffer, this.assemblyBufferLength, this.assemblyBuffer.Length - this.assemblyBufferLength);
|
||||
this.buffer.WriteBlock(this.assemblyBuffer);
|
||||
this.currBytes += (long)this.assemblyBufferLength;
|
||||
this.assemblyBufferLength = 0;
|
||||
}
|
||||
if (this.currBytes < this.currSize)
|
||||
{
|
||||
string text = string.Format("Entry closed at '{0}' before the '{1}' bytes specified in the header were written", this.currBytes, this.currSize);
|
||||
throw new TarException(text);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600024E RID: 590 RVA: 0x0000C224 File Offset: 0x0000B224
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
this.Write(new byte[] { value }, 0, 1);
|
||||
}
|
||||
|
||||
// Token: 0x0600024F RID: 591 RVA: 0x0000C248 File Offset: 0x0000B248
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "Cannot be negative");
|
||||
}
|
||||
if (buffer.Length - offset < count)
|
||||
{
|
||||
throw new ArgumentException("offset and count combination is invalid");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "Cannot be negative");
|
||||
}
|
||||
if (this.currBytes + (long)count > this.currSize)
|
||||
{
|
||||
string text = string.Format("request to write '{0}' bytes exceeds size in header of '{1}' bytes", count, this.currSize);
|
||||
throw new ArgumentOutOfRangeException("count", text);
|
||||
}
|
||||
if (this.assemblyBufferLength > 0)
|
||||
{
|
||||
if (this.assemblyBufferLength + count >= this.blockBuffer.Length)
|
||||
{
|
||||
int num = this.blockBuffer.Length - this.assemblyBufferLength;
|
||||
Array.Copy(this.assemblyBuffer, 0, this.blockBuffer, 0, this.assemblyBufferLength);
|
||||
Array.Copy(buffer, offset, this.blockBuffer, this.assemblyBufferLength, num);
|
||||
this.buffer.WriteBlock(this.blockBuffer);
|
||||
this.currBytes += (long)this.blockBuffer.Length;
|
||||
offset += num;
|
||||
count -= num;
|
||||
this.assemblyBufferLength = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Array.Copy(buffer, offset, this.assemblyBuffer, this.assemblyBufferLength, count);
|
||||
offset += count;
|
||||
this.assemblyBufferLength += count;
|
||||
count -= count;
|
||||
}
|
||||
}
|
||||
while (count > 0)
|
||||
{
|
||||
if (count < this.blockBuffer.Length)
|
||||
{
|
||||
Array.Copy(buffer, offset, this.assemblyBuffer, this.assemblyBufferLength, count);
|
||||
this.assemblyBufferLength += count;
|
||||
return;
|
||||
}
|
||||
this.buffer.WriteBlock(buffer, offset);
|
||||
int num2 = this.blockBuffer.Length;
|
||||
this.currBytes += (long)num2;
|
||||
count -= num2;
|
||||
offset += num2;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000250 RID: 592 RVA: 0x0000C3FE File Offset: 0x0000B3FE
|
||||
private void WriteEofBlock()
|
||||
{
|
||||
Array.Clear(this.blockBuffer, 0, this.blockBuffer.Length);
|
||||
this.buffer.WriteBlock(this.blockBuffer);
|
||||
}
|
||||
|
||||
// Token: 0x04000140 RID: 320
|
||||
private long currBytes;
|
||||
|
||||
// Token: 0x04000141 RID: 321
|
||||
private int assemblyBufferLength;
|
||||
|
||||
// Token: 0x04000142 RID: 322
|
||||
private bool isClosed;
|
||||
|
||||
// Token: 0x04000143 RID: 323
|
||||
protected long currSize;
|
||||
|
||||
// Token: 0x04000144 RID: 324
|
||||
protected byte[] blockBuffer;
|
||||
|
||||
// Token: 0x04000145 RID: 325
|
||||
protected byte[] assemblyBuffer;
|
||||
|
||||
// Token: 0x04000146 RID: 326
|
||||
protected TarBuffer buffer;
|
||||
|
||||
// Token: 0x04000147 RID: 327
|
||||
protected Stream outputStream;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user