348 lines
9.3 KiB
C#
348 lines
9.3 KiB
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.Decompression.Zlib
|
|
{
|
|
// Token: 0x02001FAE RID: 8110
|
|
[Token(Token = "0x2001FAE")]
|
|
internal sealed class ZTree
|
|
{
|
|
// Token: 0x0600CDAB RID: 52651 RVA: 0x002F4498 File Offset: 0x002F2698
|
|
[Token(Token = "0x600CDAB")]
|
|
[Address(RVA = "0x1974E30", Offset = "0x1973C30", VA = "0x181974E30")]
|
|
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: 0x0600CDAC RID: 52652 RVA: 0x002F44C0 File Offset: 0x002F26C0
|
|
[Token(Token = "0x600CDAC")]
|
|
[Address(RVA = "0x1975850", Offset = "0x1974650", VA = "0x181975850")]
|
|
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: 0x0600CDAD RID: 52653 RVA: 0x002F4660 File Offset: 0x002F2860
|
|
[Token(Token = "0x600CDAD")]
|
|
[Address(RVA = "0x1975150", Offset = "0x1973F50", VA = "0x181975150")]
|
|
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: 0x0600CDAE RID: 52654 RVA: 0x002F4904 File Offset: 0x002F2B04
|
|
[Token(Token = "0x600CDAE")]
|
|
[Address(RVA = "0x1975D70", Offset = "0x1974B70", VA = "0x181975D70")]
|
|
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: 0x0600CDAF RID: 52655 RVA: 0x002F496C File Offset: 0x002F2B6C
|
|
[Token(Token = "0x600CDAF")]
|
|
[Address(RVA = "0x1639D80", Offset = "0x1638B80", VA = "0x181639D80")]
|
|
internal static int bi_reverse(int code, int len)
|
|
{
|
|
int num = 0;
|
|
int num2 = len - 1;
|
|
return num + num;
|
|
}
|
|
|
|
// Token: 0x0600CDB0 RID: 52656 RVA: 0x002F4984 File Offset: 0x002F2B84
|
|
[Token(Token = "0x600CDB0")]
|
|
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
|
|
public ZTree()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600CDB1 RID: 52657 RVA: 0x002F4998 File Offset: 0x002F2B98
|
|
// Note: this type is marked as 'beforefieldinit'.
|
|
[Token(Token = "0x600CDB1")]
|
|
[Address(RVA = "0x1974F20", Offset = "0x1973D20", VA = "0x181974F20")]
|
|
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: 0x04008361 RID: 33633
|
|
[Token(Token = "0x4008361")]
|
|
private static readonly int HEAP_SIZE;
|
|
|
|
// Token: 0x04008362 RID: 33634
|
|
[Token(Token = "0x4008362")]
|
|
internal static readonly int[] ExtraLengthBits;
|
|
|
|
// Token: 0x04008363 RID: 33635
|
|
[Token(Token = "0x4008363")]
|
|
internal static readonly int[] ExtraDistanceBits;
|
|
|
|
// Token: 0x04008364 RID: 33636
|
|
[Token(Token = "0x4008364")]
|
|
internal static readonly int[] extra_blbits;
|
|
|
|
// Token: 0x04008365 RID: 33637
|
|
[Token(Token = "0x4008365")]
|
|
internal static readonly sbyte[] bl_order;
|
|
|
|
// Token: 0x04008366 RID: 33638
|
|
[Token(Token = "0x4008366")]
|
|
internal const int Buf_size = 16;
|
|
|
|
// Token: 0x04008367 RID: 33639
|
|
[Token(Token = "0x4008367")]
|
|
private static readonly sbyte[] _dist_code;
|
|
|
|
// Token: 0x04008368 RID: 33640
|
|
[Token(Token = "0x4008368")]
|
|
internal static readonly sbyte[] LengthCode;
|
|
|
|
// Token: 0x04008369 RID: 33641
|
|
[Token(Token = "0x4008369")]
|
|
internal static readonly int[] LengthBase;
|
|
|
|
// Token: 0x0400836A RID: 33642
|
|
[Token(Token = "0x400836A")]
|
|
internal static readonly int[] DistanceBase;
|
|
|
|
// Token: 0x0400836B RID: 33643
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400836B")]
|
|
internal short[] dyn_tree;
|
|
|
|
// Token: 0x0400836C RID: 33644
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400836C")]
|
|
internal int max_code;
|
|
|
|
// Token: 0x0400836D RID: 33645
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400836D")]
|
|
internal StaticTree staticTree;
|
|
}
|
|
}
|