Files
Aug2021-Cpp2IL-Dump/Assembly-CSharp/BestHTTP/Decompression/Zlib/InflateBlocks.cs
T
2026-04-10 22:50:51 +02:00

353 lines
13 KiB
C#

using System;
using System.Runtime.CompilerServices;
using BestHTTP.Extensions;
using Cpp2IlInjected;
namespace BestHTTP.Decompression.Zlib
{
// Token: 0x02001FA8 RID: 8104
[Token(Token = "0x2001FA8")]
internal sealed class InflateBlocks
{
// Token: 0x0600CD92 RID: 52626 RVA: 0x002F2710 File Offset: 0x002F0910
[Token(Token = "0x600CD92")]
[Address(RVA = "0x1971390", Offset = "0x1970190", VA = "0x181971390")]
internal InflateBlocks(ZlibCodec codec, object checkfn, int w)
{
int[] array = new int[1];
this.bb = array;
int[] array2 = new int[1];
this.tb = array2;
InflateCodes inflateCodes = new InflateCodes();
this.codes = inflateCodes;
InfTree infTree = new InfTree();
this.inftree = infTree;
base..ctor();
this._codec = codec;
int[] array3 = new int[4320];
this.hufts = array3;
byte[] array4 = VariableSizedBufferPool.Get((long)w, true);
this.window = array4;
this.end = w;
this.checkfn = checkfn;
this.mode = (InflateBlocks.InflateBlockMode)((ulong)0L);
uint num = this.Reset();
}
// Token: 0x0600CD93 RID: 52627 RVA: 0x002F27A4 File Offset: 0x002F09A4
[Token(Token = "0x600CD93")]
[Address(RVA = "0x1971220", Offset = "0x1970020", VA = "0x181971220")]
internal uint Reset()
{
uint num = this.check;
int num2 = 0;
this.mode = (InflateBlocks.InflateBlockMode)num2;
this.bitk = num2;
this.readAt = num2;
if (this.checkfn != num2)
{
ZlibCodec codec = this._codec;
this.check = (uint)((ulong)1L);
codec._Adler32 = (uint)((ulong)1L);
}
return num;
}
// Token: 0x0600CD94 RID: 52628 RVA: 0x002F27F8 File Offset: 0x002F09F8
[Token(Token = "0x600CD94")]
[Address(RVA = "0x196FBA0", Offset = "0x196E9A0", VA = "0x18196FBA0")]
internal int Process(int r)
{
/*
An exception occurred when decompiling this method (0600CD94)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.Decompression.Zlib.InflateBlocks::Process(System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_B98:
stloc:ZlibCodec(var_179_B9E, ldfld:ZlibCodec(InflateBlocks::_codec, ldloc:InflateBlocks(this)))
stfld:int32(InflateBlocks::bitb, ldloc:InflateBlocks(this), ldc.i4:int32(0))
stfld:int32(InflateBlocks::bitk, ldloc:InflateBlocks(this), ldc.i4:int32(0))
stfld:int32(ZlibCodec::AvailableBytesIn, ldloc:ZlibCodec(var_179_B9E), ldc.i4:int32(0))
}
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
*/;
}
// Token: 0x0600CD95 RID: 52629 RVA: 0x002F33BC File Offset: 0x002F15BC
[Token(Token = "0x600CD95")]
[Address(RVA = "0x196FB20", Offset = "0x196E920", VA = "0x18196FB20")]
internal void Free()
{
uint num = this.Reset();
VariableSizedBufferPool.Release(this.window);
int num2 = 0;
this.window = num2;
this.hufts = num2;
}
// Token: 0x0600CD96 RID: 52630 RVA: 0x002F33EC File Offset: 0x002F15EC
[Token(Token = "0x600CD96")]
[Address(RVA = "0x19712E0", Offset = "0x19700E0", VA = "0x1819712E0")]
internal void SetDictionary(byte[] d, int start, int n)
{
byte[] array = this.window;
int num = 0;
Array.Copy(d, start, array, num, n);
this.writeAt = n;
this.readAt = n;
}
// Token: 0x0600CD97 RID: 52631 RVA: 0x002F341C File Offset: 0x002F161C
[Token(Token = "0x600CD97")]
[Address(RVA = "0x18E13F0", Offset = "0x18E01F0", VA = "0x1818E13F0")]
internal int SyncPoint()
{
/*
An exception occurred when decompiling this method (0600CD97)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.Decompression.Zlib.InflateBlocks::SyncPoint()
---> System.Exception: Basic block has to end with unconditional control flow.
{
Block_0:
stloc:bool(var_0_09, ceq:bool(ldfld:InflateBlockMode(InflateBlocks::mode, ldloc:InflateBlocks(this)), ldc.i4:InflateBlockMode(1)))
}
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
*/;
}
// Token: 0x0600CD98 RID: 52632 RVA: 0x002F3434 File Offset: 0x002F1634
[Token(Token = "0x600CD98")]
[Address(RVA = "0x196F970", Offset = "0x196E770", VA = "0x18196F970")]
internal int Flush(int r)
{
int num = this.readAt;
int num2 = 0;
int num3 = this.writeAt;
if (num2 != 0 || num > num3)
{
}
num3 -= num;
if (num3 != 0)
{
ZlibCodec codec = this._codec;
int num4 = codec.AvailableBytesOut;
if (num3 > num4)
{
num3 = num4;
}
if (num3 != 0)
{
}
num4 -= num3;
codec.AvailableBytesOut = num4;
ZlibCodec codec2 = this._codec;
if (this.checkfn != num2)
{
int num5 = this.readAt;
ZlibCodec codec3 = this._codec;
uint num6 = this.check;
byte[] array = this.window;
uint num7 = Adler.Adler32(num6, array, num5, num3);
this.check = num7;
codec3._Adler32 = num7;
}
ZlibCodec codec4 = this._codec;
int nextOut = codec4.NextOut;
byte[] outputBuffer = codec4.OutputBuffer;
int num8 = this.readAt;
Array.Copy(this.window, num8, outputBuffer, nextOut, num3);
ZlibCodec codec5 = this._codec;
int num9 = this.readAt;
int num10 = this.end;
num9 += num3;
this.readAt = num9;
if (num9 == num10 && num2 == 0)
{
this.readAt = num2;
if (this.writeAt != num10)
{
goto IL_11C;
}
this.writeAt = num2;
}
num2++;
IL_11C:
num2++;
}
return num2;
}
// Token: 0x0600CD99 RID: 52633 RVA: 0x002F3568 File Offset: 0x002F1768
// Note: this type is marked as 'beforefieldinit'.
[Token(Token = "0x600CD99")]
[Address(RVA = "0x1971330", Offset = "0x1970130", VA = "0x181971330")]
static InflateBlocks()
{
int[] array = new int[19];
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.1FDC8DB567F5AAA7068D0D2A601CD71657CBDF38).FieldHandle);
InflateBlocks.border = array;
}
// Token: 0x0400830C RID: 33548
[Token(Token = "0x400830C")]
private const int MANY = 1440;
// Token: 0x0400830D RID: 33549
[Token(Token = "0x400830D")]
internal static readonly int[] border;
// Token: 0x0400830E RID: 33550
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x400830E")]
private InflateBlocks.InflateBlockMode mode;
// Token: 0x0400830F RID: 33551
[FieldOffset(Offset = "0x14")]
[Token(Token = "0x400830F")]
internal int left;
// Token: 0x04008310 RID: 33552
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4008310")]
internal int table;
// Token: 0x04008311 RID: 33553
[FieldOffset(Offset = "0x1C")]
[Token(Token = "0x4008311")]
internal int index;
// Token: 0x04008312 RID: 33554
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4008312")]
internal int[] blens;
// Token: 0x04008313 RID: 33555
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4008313")]
internal int[] bb;
// Token: 0x04008314 RID: 33556
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4008314")]
internal int[] tb;
// Token: 0x04008315 RID: 33557
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x4008315")]
internal InflateCodes codes;
// Token: 0x04008316 RID: 33558
[FieldOffset(Offset = "0x40")]
[Token(Token = "0x4008316")]
internal int last;
// Token: 0x04008317 RID: 33559
[FieldOffset(Offset = "0x48")]
[Token(Token = "0x4008317")]
internal ZlibCodec _codec;
// Token: 0x04008318 RID: 33560
[FieldOffset(Offset = "0x50")]
[Token(Token = "0x4008318")]
internal int bitk;
// Token: 0x04008319 RID: 33561
[FieldOffset(Offset = "0x54")]
[Token(Token = "0x4008319")]
internal int bitb;
// Token: 0x0400831A RID: 33562
[FieldOffset(Offset = "0x58")]
[Token(Token = "0x400831A")]
internal int[] hufts;
// Token: 0x0400831B RID: 33563
[FieldOffset(Offset = "0x60")]
[Token(Token = "0x400831B")]
internal byte[] window;
// Token: 0x0400831C RID: 33564
[FieldOffset(Offset = "0x68")]
[Token(Token = "0x400831C")]
internal int end;
// Token: 0x0400831D RID: 33565
[FieldOffset(Offset = "0x6C")]
[Token(Token = "0x400831D")]
internal int readAt;
// Token: 0x0400831E RID: 33566
[FieldOffset(Offset = "0x70")]
[Token(Token = "0x400831E")]
internal int writeAt;
// Token: 0x0400831F RID: 33567
[FieldOffset(Offset = "0x78")]
[Token(Token = "0x400831F")]
internal object checkfn;
// Token: 0x04008320 RID: 33568
[FieldOffset(Offset = "0x80")]
[Token(Token = "0x4008320")]
internal uint check;
// Token: 0x04008321 RID: 33569
[FieldOffset(Offset = "0x88")]
[Token(Token = "0x4008321")]
internal InfTree inftree;
// Token: 0x02001FA9 RID: 8105
[Token(Token = "0x2001FA9")]
private enum InflateBlockMode
{
// Token: 0x04008323 RID: 33571
[Token(Token = "0x4008323")]
TYPE,
// Token: 0x04008324 RID: 33572
[Token(Token = "0x4008324")]
LENS,
// Token: 0x04008325 RID: 33573
[Token(Token = "0x4008325")]
STORED,
// Token: 0x04008326 RID: 33574
[Token(Token = "0x4008326")]
TABLE,
// Token: 0x04008327 RID: 33575
[Token(Token = "0x4008327")]
BTREE,
// Token: 0x04008328 RID: 33576
[Token(Token = "0x4008328")]
DTREE,
// Token: 0x04008329 RID: 33577
[Token(Token = "0x4008329")]
CODES,
// Token: 0x0400832A RID: 33578
[Token(Token = "0x400832A")]
DRY,
// Token: 0x0400832B RID: 33579
[Token(Token = "0x400832B")]
DONE,
// Token: 0x0400832C RID: 33580
[Token(Token = "0x400832C")]
BAD
}
}
}