public static byte[] Unzip(byte[] buffer)
{
Assembly callingAssembly = Assembly.GetCallingAssembly();
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if ((callingAssembly != executingAssembly) && !PublicKeysMatch(executingAssembly, callingAssembly))
{
return null;
}
ZipStream stream = new ZipStream(buffer);
byte[] buf = new byte[0];
int num = stream.ReadInt();
if (num == 0x4034b50)
{
short num2 = (short) stream.ReadShort();
int num3 = stream.ReadShort();
int num4 = stream.ReadShort();
if (((num != 0x4034b50) || (num2 != 20)) || ((num3 != 0) || (num4 != 8)))
{
throw new FormatException("Wrong Header Signature");
}
stream.ReadInt();
stream.ReadInt();
stream.ReadInt();
int num5 = stream.ReadInt();
int count = stream.ReadShort();
int num7 = stream.ReadShort();
if (count > 0)
{
byte[] buffer3 = new byte[count];
stream.Read(buffer3, 0, count);
}
if (num7 > 0)
{
byte[] buffer4 = new byte[num7];
stream.Read(buffer4, 0, num7);
}
byte[] buffer5 = new byte[stream.Length - stream.Position];
stream.Read(buffer5, 0, buffer5.Length);
Inflater inflater = new Inflater(buffer5);
buf = new byte[num5];
inflater.Inflate(buf, 0, buf.Length);
buffer5 = null;
}
else
{
int num8 = num >> 0x18;
num -= num8 << 0x18;
if (num == 0x7d7a7b)
{
switch (num8)
{
case 1:
{
int num12;
int num9 = stream.ReadInt();
buf = new byte[num9];
for (int i = 0; i < num9; i += num12)
{
int num11 = stream.ReadInt();
num12 = stream.ReadInt();
byte[] buffer6 = new byte[num11];
stream.Read(buffer6, 0, buffer6.Length);
new Inflater(buffer6).Inflate(buf, i, num12);
}
break;
}
case 2:
{
byte[] buffer7 = new byte[] { 0x94, 0xad, 0xc3, 0x85, 0xa5, 0x2a, 0xbd, 9 };
byte[] buffer8 = new byte[] { 0xbf, 0x45, 3, 0x1a, 0x41, 80, 14, 0xbf };
using (ICryptoTransform transform = GetDesTransform(buffer7, buffer8, true))
{
buf = Unzip(transform.TransformFinalBlock(buffer, 4, buffer.Length - 4));
}
break;
}
}
if (num8 != 3)
{
goto Label_026B;
}
byte[] key = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
byte[] iv = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
using (ICryptoTransform transform2 = GetAesTransform(key, iv, true))
{
buf = Unzip(transform2.TransformFinalBlock(buffer, 4, buffer.Length - 4));
goto Label_026B;
}
}
throw new FormatException("Unknown Header");
}
Label_026B:
stream.Close();
stream = null;
return buf;
}
// Token: 0x060002CA RID: 714 RVA: 0x0002807C File Offset: 0x0002627C public static byte[] Unzip(byte[] byte_0) { Assembly callingAssembly = Assembly.GetCallingAssembly(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); if (callingAssembly != executingAssembly && !SimpleZip.PublicKeysMatch(executingAssembly, callingAssembly)) { return(null); } SimpleZip.ZipStream zipStream = new SimpleZip.ZipStream(byte_0); byte[] array = new byte[0]; int num = zipStream.ReadInt(); if (num == 67324752) { short num2 = (short)zipStream.ReadShort(); int num3 = zipStream.ReadShort(); int num4 = zipStream.ReadShort(); if (num == 67324752 && num2 == 20 && num3 == 0) { if (num4 == 8) { zipStream.ReadInt(); zipStream.ReadInt(); zipStream.ReadInt(); int num5 = zipStream.ReadInt(); int num6 = zipStream.ReadShort(); int num7 = zipStream.ReadShort(); if (num6 > 0) { byte[] buffer = new byte[num6]; zipStream.Read(buffer, 0, num6); } if (num7 > 0) { byte[] buffer2 = new byte[num7]; zipStream.Read(buffer2, 0, num7); } byte[] array2 = new byte[zipStream.Length - zipStream.Position]; zipStream.Read(array2, 0, array2.Length); SimpleZip.Inflater inflater = new SimpleZip.Inflater(array2); array = new byte[num5]; inflater.Inflate(array, 0, array.Length); goto IL_265; } } throw new FormatException("Wrong Header Signature"); } int num8 = num >> 24; num -= num8 << 24; if (num == 8223355) { if (num8 == 1) { int num9 = zipStream.ReadInt(); array = new byte[num9]; int num11; for (int i = 0; i < num9; i += num11) { int num10 = zipStream.ReadInt(); num11 = zipStream.ReadInt(); byte[] array3 = new byte[num10]; zipStream.Read(array3, 0, array3.Length); new SimpleZip.Inflater(array3).Inflate(array, i, num11); } } if (num8 == 2) { byte[] byte_ = new byte[] { 72, 196, 226, 220, 77, 90, 77, 41 }; byte[] byte_2 = new byte[] { 17, 242, 176, 1, 248, 117, 118, 164 }; using (ICryptoTransform desTransform = SimpleZip.GetDesTransform(byte_, byte_2, true)) { array = SimpleZip.Unzip(desTransform.TransformFinalBlock(byte_0, 4, byte_0.Length - 4)); } } if (num8 != 3) { goto IL_265; } byte[] byte_3 = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; byte[] byte_4 = new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; using (ICryptoTransform aesTransform = SimpleZip.GetAesTransform(byte_3, byte_4, true)) { array = SimpleZip.Unzip(aesTransform.TransformFinalBlock(byte_0, 4, byte_0.Length - 4)); goto IL_265; } } throw new FormatException("Unknown Header"); IL_265: zipStream.Close(); zipStream = null; return(array); }