Files
27Aug2021-Cpp2IL-Dump/Assembly-CSharp/BestHTTP/Decompression/Zlib/ZTree.cs
T
niko c12fbe3fc6 m
2026-04-12 16:51:38 +02:00

348 lines
9.3 KiB
C#

using System;
using System.Runtime.CompilerServices;
using Cpp2IlInjected;
namespace BestHTTP.Decompression.Zlib
{
// Token: 0x0200208E RID: 8334
[Token(Token = "0x200208E")]
internal sealed class ZTree
{
// Token: 0x0600D179 RID: 53625 RVA: 0x002FCB08 File Offset: 0x002FAD08
[Token(Token = "0x600D179")]
[Address(RVA = "0x241CEC0", Offset = "0x241BEC0", VA = "0x18241CEC0")]
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: 0x0600D17A RID: 53626 RVA: 0x002FCB30 File Offset: 0x002FAD30
[Token(Token = "0x600D17A")]
[Address(RVA = "0x241D8E0", Offset = "0x241C8E0", VA = "0x18241D8E0")]
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: 0x0600D17B RID: 53627 RVA: 0x002FCCD0 File Offset: 0x002FAED0
[Token(Token = "0x600D17B")]
[Address(RVA = "0x241D1E0", Offset = "0x241C1E0", VA = "0x18241D1E0")]
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: 0x0600D17C RID: 53628 RVA: 0x002FCF74 File Offset: 0x002FB174
[Token(Token = "0x600D17C")]
[Address(RVA = "0x241DE00", Offset = "0x241CE00", VA = "0x18241DE00")]
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: 0x0600D17D RID: 53629 RVA: 0x002FCFDC File Offset: 0x002FB1DC
[Token(Token = "0x600D17D")]
[Address(RVA = "0x427250", Offset = "0x426250", VA = "0x180427250")]
internal static int bi_reverse(int code, int len)
{
int num = 0;
int num2 = len - 1;
return num + num;
}
// Token: 0x0600D17E RID: 53630 RVA: 0x002FCFF4 File Offset: 0x002FB1F4
[Token(Token = "0x600D17E")]
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
public ZTree()
{
}
// Token: 0x0600D17F RID: 53631 RVA: 0x002FD008 File Offset: 0x002FB208
// Note: this type is marked as 'beforefieldinit'.
[Token(Token = "0x600D17F")]
[Address(RVA = "0x241CFB0", Offset = "0x241BFB0", VA = "0x18241CFB0")]
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: 0x0400851A RID: 34074
[Token(Token = "0x400851A")]
private static readonly int HEAP_SIZE;
// Token: 0x0400851B RID: 34075
[Token(Token = "0x400851B")]
internal static readonly int[] ExtraLengthBits;
// Token: 0x0400851C RID: 34076
[Token(Token = "0x400851C")]
internal static readonly int[] ExtraDistanceBits;
// Token: 0x0400851D RID: 34077
[Token(Token = "0x400851D")]
internal static readonly int[] extra_blbits;
// Token: 0x0400851E RID: 34078
[Token(Token = "0x400851E")]
internal static readonly sbyte[] bl_order;
// Token: 0x0400851F RID: 34079
[Token(Token = "0x400851F")]
internal const int Buf_size = 16;
// Token: 0x04008520 RID: 34080
[Token(Token = "0x4008520")]
private static readonly sbyte[] _dist_code;
// Token: 0x04008521 RID: 34081
[Token(Token = "0x4008521")]
internal static readonly sbyte[] LengthCode;
// Token: 0x04008522 RID: 34082
[Token(Token = "0x4008522")]
internal static readonly int[] LengthBase;
// Token: 0x04008523 RID: 34083
[Token(Token = "0x4008523")]
internal static readonly int[] DistanceBase;
// Token: 0x04008524 RID: 34084
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4008524")]
internal short[] dyn_tree;
// Token: 0x04008525 RID: 34085
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4008525")]
internal int max_code;
// Token: 0x04008526 RID: 34086
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4008526")]
internal StaticTree staticTree;
}
}