350 lines
9.4 KiB
C#
350 lines
9.4 KiB
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.Decompression.Zlib
|
|
{
|
|
// Token: 0x020019D1 RID: 6609
|
|
[Token(Token = "0x20019D1")]
|
|
[StructLayout(3)]
|
|
internal sealed class ZTree
|
|
{
|
|
// Token: 0x0600B1D1 RID: 45521 RVA: 0x0029BD94 File Offset: 0x00299F94
|
|
[Token(Token = "0x600B1D1")]
|
|
[Address(RVA = "0x1E6DC30", Offset = "0x1E6C630", VA = "0x181E6DC30")]
|
|
internal static int DistanceCode(int dist)
|
|
{
|
|
if (dist < 256)
|
|
{
|
|
sbyte[] dist_code = ZTree._dist_code;
|
|
return dist;
|
|
}
|
|
sbyte[] dist_code2 = ZTree._dist_code;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600B1D2 RID: 45522 RVA: 0x0029BDBC File Offset: 0x00299FBC
|
|
[Token(Token = "0x600B1D2")]
|
|
[Address(RVA = "0x1E6E650", Offset = "0x1E6D050", VA = "0x181E6E650")]
|
|
internal void gen_bitlen(DeflateManager s)
|
|
{
|
|
StaticTree staticTree = this.staticTree;
|
|
short[] array = this.dyn_tree;
|
|
short[] treeCodes = staticTree.treeCodes;
|
|
int num = 0;
|
|
int[] extraBits = staticTree.extraBits;
|
|
int extraBase = staticTree.extraBase;
|
|
int num2 = staticTree.maxLength;
|
|
int num3 = 0;
|
|
short[] bl_count = s.bl_count;
|
|
num++;
|
|
bl_count[0] = (short)num3;
|
|
int[] heap = s.heap;
|
|
int num4 = s.heap_max;
|
|
num4++;
|
|
array[0] = (short)num3;
|
|
int num5 = s.heap_max;
|
|
num5++;
|
|
int[] heap2 = s.heap;
|
|
int num6 = array.Length;
|
|
int num7 = heap2[num5];
|
|
num5 += num5;
|
|
num5++;
|
|
num5++;
|
|
num6 = num2;
|
|
if (num5 <= num2)
|
|
{
|
|
num6 = num5;
|
|
}
|
|
array[0] = (short)num6;
|
|
short[] bl_count2 = s.bl_count;
|
|
num5 = num6;
|
|
num7 -= extraBase;
|
|
int num8 = extraBits[num7];
|
|
int num9 = num7 * num7;
|
|
while (treeCodes == 0)
|
|
{
|
|
}
|
|
num9 += num8;
|
|
if (num != 0)
|
|
{
|
|
short[] bl_count3 = s.bl_count;
|
|
int num10 = num2 - 1;
|
|
short num11 = bl_count3[num10];
|
|
bl_count3[0] = num11;
|
|
short[] bl_count4 = s.bl_count;
|
|
num10++;
|
|
short[] bl_count5 = s.bl_count;
|
|
if (num2 != 0)
|
|
{
|
|
short[] bl_count6 = s.bl_count;
|
|
if (num10 != 0)
|
|
{
|
|
int[] heap3 = s.heap;
|
|
num2 = num5;
|
|
int num12 = heap3[num2];
|
|
int num13 = array.Length;
|
|
num12 += num12;
|
|
int num14 = num12 + 1;
|
|
if (num6 != num2)
|
|
{
|
|
num13 = num2;
|
|
num13 -= num6;
|
|
array[0] = (short)num2;
|
|
}
|
|
while (num10 != 0)
|
|
{
|
|
}
|
|
}
|
|
while (num10 != 0)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B1D3 RID: 45523 RVA: 0x0029BF5C File Offset: 0x0029A15C
|
|
[Token(Token = "0x600B1D3")]
|
|
[Address(RVA = "0x1E6DF50", Offset = "0x1E6C950", VA = "0x181E6DF50")]
|
|
internal void build_tree(DeflateManager s)
|
|
{
|
|
StaticTree staticTree = this.staticTree;
|
|
short[] array = this.dyn_tree;
|
|
short[] treeCodes = staticTree.treeCodes;
|
|
int num = staticTree.elems;
|
|
int num2 = 0;
|
|
s.heap_len = num2;
|
|
int heap_SIZE = ZTree.HEAP_SIZE;
|
|
s.heap_max = heap_SIZE;
|
|
if (num > 0)
|
|
{
|
|
int length = array.Length;
|
|
if ("{il2cpp array field local3->}" == num2)
|
|
{
|
|
num2++;
|
|
array[0] = (short)num2;
|
|
}
|
|
int heap_len = s.heap_len;
|
|
int[] heap = s.heap;
|
|
int num3 = heap_len + 1;
|
|
s.heap_len = num3;
|
|
int num4 = heap_len + 1;
|
|
heap[0] = num2;
|
|
sbyte[] depth = s.depth;
|
|
num2++;
|
|
num2 += 2;
|
|
}
|
|
int num5 = s.heap_len;
|
|
if (num5 < 2)
|
|
{
|
|
int[] heap2 = s.heap;
|
|
int num6 = num5 + 1;
|
|
s.heap_len = num6;
|
|
if (num2 < 2)
|
|
{
|
|
}
|
|
num5++;
|
|
heap2[0] = num2;
|
|
uint num7;
|
|
array[0] = (short)num7;
|
|
sbyte[] depth2 = s.depth;
|
|
while (treeCodes == 0)
|
|
{
|
|
}
|
|
}
|
|
this.max_code = 1;
|
|
int i = s.heap_len;
|
|
i -= 0;
|
|
s.pqdownheap(array, i);
|
|
while (i >= 1)
|
|
{
|
|
}
|
|
int[] heap3 = s.heap;
|
|
int heap_len2 = s.heap_len;
|
|
int num8 = heap3[0];
|
|
int num9 = heap_len2 - 1;
|
|
s.heap_len = num9;
|
|
int length2 = heap3.Length;
|
|
int num10 = heap3[heap_len2];
|
|
heap3[0] = num10;
|
|
uint num11;
|
|
s.pqdownheap(array, (int)num11);
|
|
int[] heap4 = s.heap;
|
|
int heap_max = s.heap_max;
|
|
int num12 = heap4[0];
|
|
int num13 = heap_max - 1;
|
|
s.heap_max = num13;
|
|
int num14 = heap_max - 1;
|
|
heap4[0] = num8;
|
|
int heap_max2 = s.heap_max;
|
|
int[] heap5 = s.heap;
|
|
int num15 = heap_max2 - 1;
|
|
s.heap_max = num15;
|
|
int num16 = heap_max2 - 1;
|
|
heap5[0] = num12;
|
|
int length3 = array.Length;
|
|
short num17 = array[heap5];
|
|
array[0] = num17;
|
|
int length4 = s.depth.Length;
|
|
sbyte b2;
|
|
sbyte b3;
|
|
byte b = Math.Max((byte)b2, (byte)b3);
|
|
array[0] = (short)num;
|
|
int num18 = heap_max2 + 1;
|
|
array[0] = (short)num;
|
|
i += 2;
|
|
int[] heap6 = s.heap;
|
|
num++;
|
|
heap6[0] = num;
|
|
s.pqdownheap(array, 1);
|
|
while (s.heap_len >= 2)
|
|
{
|
|
}
|
|
int heap_max3 = s.heap_max;
|
|
int[] heap7 = s.heap;
|
|
int num19 = heap_max3 - 1;
|
|
s.heap_max = num19;
|
|
int num20 = s.heap[0];
|
|
int num21 = heap_max3 - 1;
|
|
heap7[0] = num20;
|
|
short[] bl_count = s.bl_count;
|
|
int num22;
|
|
ZTree.gen_codes(array, num22, bl_count);
|
|
}
|
|
|
|
// Token: 0x0600B1D4 RID: 45524 RVA: 0x0029C200 File Offset: 0x0029A400
|
|
[Token(Token = "0x600B1D4")]
|
|
[Address(RVA = "0x1E6EB70", Offset = "0x1E6D570", VA = "0x181E6EB70")]
|
|
internal static void gen_codes(short[] tree, int max_code, short[] bl_count)
|
|
{
|
|
int num = InternalConstants.MAX_BITS;
|
|
num++;
|
|
short[] array = new short[num];
|
|
int i = 0;
|
|
short num2;
|
|
i += (int)num2;
|
|
i += i;
|
|
array[0] = (short)i;
|
|
if (1 != 0)
|
|
{
|
|
short num4;
|
|
short num3 = num4 + 1;
|
|
array[0] = num3;
|
|
int num5 = 0;
|
|
num5 += num5;
|
|
tree[0] = (short)num5;
|
|
}
|
|
i++;
|
|
i += 2;
|
|
while (i <= max_code)
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B1D5 RID: 45525 RVA: 0x0029C268 File Offset: 0x0029A468
|
|
[Token(Token = "0x600B1D5")]
|
|
[Address(RVA = "0xE33D40", Offset = "0xE32740", VA = "0x180E33D40")]
|
|
internal static int bi_reverse(int code, int len)
|
|
{
|
|
int num = 0;
|
|
int num2 = len - 1;
|
|
return num + num;
|
|
}
|
|
|
|
// Token: 0x0600B1D6 RID: 45526 RVA: 0x0029C280 File Offset: 0x0029A480
|
|
[Token(Token = "0x600B1D6")]
|
|
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
|
|
public ZTree()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600B1D7 RID: 45527 RVA: 0x0029C294 File Offset: 0x0029A494
|
|
// Note: this type is marked as 'beforefieldinit'.
|
|
[Token(Token = "0x600B1D7")]
|
|
[Address(RVA = "0x1E6DD20", Offset = "0x1E6C720", VA = "0x181E6DD20")]
|
|
static ZTree()
|
|
{
|
|
int[] array = new int[29];
|
|
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.67C0E784F3654B008A81E2988588CF4956CCF3DA).FieldHandle);
|
|
ZTree.ExtraLengthBits = array;
|
|
int[] array2 = new int[30];
|
|
RuntimeHelpers.InitializeArray(array2, fieldof(<PrivateImplementationDetails>.79D521E6E3E55103005E9CC3FA43B3174FAF090F).FieldHandle);
|
|
ZTree.ExtraDistanceBits = array2;
|
|
int[] array3 = new int[19];
|
|
RuntimeHelpers.InitializeArray(array3, fieldof(<PrivateImplementationDetails>.8457F44B035C9073EE2D1F132D0A8AF5631DCDC8).FieldHandle);
|
|
ZTree.extra_blbits = array3;
|
|
sbyte[] array4 = new sbyte[19];
|
|
RuntimeHelpers.InitializeArray(array4, fieldof(<PrivateImplementationDetails>.9F8365E9D6C62D3B47026EC465B05A7B5526B5CD).FieldHandle);
|
|
ZTree.bl_order = array4;
|
|
sbyte[] array5 = new sbyte[512];
|
|
RuntimeHelpers.InitializeArray(array5, fieldof(<PrivateImplementationDetails>.3544182260B8A15D332367E48C7530FC0E901FD3).FieldHandle);
|
|
ZTree._dist_code = array5;
|
|
sbyte[] array6 = new sbyte[256];
|
|
RuntimeHelpers.InitializeArray(array6, fieldof(<PrivateImplementationDetails>.6A316789EED01119DE92841832701A40AB0CABD6).FieldHandle);
|
|
ZTree.LengthCode = array6;
|
|
int[] array7 = new int[29];
|
|
RuntimeHelpers.InitializeArray(array7, fieldof(<PrivateImplementationDetails>.2E868D9F2085DF93F11F58DE61C05E0D8A8F4A71).FieldHandle);
|
|
ZTree.LengthBase = array7;
|
|
int[] array8 = new int[30];
|
|
RuntimeHelpers.InitializeArray(array8, fieldof(<PrivateImplementationDetails>.5581A70566F03554D8048EDBFC6E6B399AF9BCB1).FieldHandle);
|
|
ZTree.DistanceBase = array8;
|
|
}
|
|
|
|
// Token: 0x0400751E RID: 29982
|
|
[Token(Token = "0x400751E")]
|
|
private static readonly int HEAP_SIZE;
|
|
|
|
// Token: 0x0400751F RID: 29983
|
|
[Token(Token = "0x400751F")]
|
|
internal static readonly int[] ExtraLengthBits;
|
|
|
|
// Token: 0x04007520 RID: 29984
|
|
[Token(Token = "0x4007520")]
|
|
internal static readonly int[] ExtraDistanceBits;
|
|
|
|
// Token: 0x04007521 RID: 29985
|
|
[Token(Token = "0x4007521")]
|
|
internal static readonly int[] extra_blbits;
|
|
|
|
// Token: 0x04007522 RID: 29986
|
|
[Token(Token = "0x4007522")]
|
|
internal static readonly sbyte[] bl_order;
|
|
|
|
// Token: 0x04007523 RID: 29987
|
|
[Token(Token = "0x4007523")]
|
|
internal const int Buf_size = 16;
|
|
|
|
// Token: 0x04007524 RID: 29988
|
|
[Token(Token = "0x4007524")]
|
|
private static readonly sbyte[] _dist_code;
|
|
|
|
// Token: 0x04007525 RID: 29989
|
|
[Token(Token = "0x4007525")]
|
|
internal static readonly sbyte[] LengthCode;
|
|
|
|
// Token: 0x04007526 RID: 29990
|
|
[Token(Token = "0x4007526")]
|
|
internal static readonly int[] LengthBase;
|
|
|
|
// Token: 0x04007527 RID: 29991
|
|
[Token(Token = "0x4007527")]
|
|
internal static readonly int[] DistanceBase;
|
|
|
|
// Token: 0x04007528 RID: 29992
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007528")]
|
|
internal short[] dyn_tree;
|
|
|
|
// Token: 0x04007529 RID: 29993
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007529")]
|
|
internal int max_code;
|
|
|
|
// Token: 0x0400752A RID: 29994
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400752A")]
|
|
internal StaticTree staticTree;
|
|
}
|
|
}
|