355 lines
14 KiB
C#
355 lines
14 KiB
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.Extensions;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.Decompression.Zlib
|
|
{
|
|
// Token: 0x020019CB RID: 6603
|
|
[Token(Token = "0x20019CB")]
|
|
[StructLayout(3)]
|
|
internal sealed class InflateBlocks
|
|
{
|
|
// Token: 0x0600B1B8 RID: 45496 RVA: 0x0029A0BC File Offset: 0x002982BC
|
|
[Token(Token = "0x600B1B8")]
|
|
[Address(RVA = "0x1F155E0", Offset = "0x1F13FE0", VA = "0x181F155E0")]
|
|
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: 0x0600B1B9 RID: 45497 RVA: 0x0029A150 File Offset: 0x00298350
|
|
[Token(Token = "0x600B1B9")]
|
|
[Address(RVA = "0x1F15460", Offset = "0x1F13E60", VA = "0x181F15460")]
|
|
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: 0x0600B1BA RID: 45498 RVA: 0x0029A1A4 File Offset: 0x002983A4
|
|
[Token(Token = "0x600B1BA")]
|
|
[Address(RVA = "0x1F13DE0", Offset = "0x1F127E0", VA = "0x181F13DE0")]
|
|
internal int Process(int r)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B1BA)
|
|
|
|
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: 0x0600B1BB RID: 45499 RVA: 0x0029AD68 File Offset: 0x00298F68
|
|
[Token(Token = "0x600B1BB")]
|
|
[Address(RVA = "0x1F13D60", Offset = "0x1F12760", VA = "0x181F13D60")]
|
|
internal void Free()
|
|
{
|
|
uint num = this.Reset();
|
|
VariableSizedBufferPool.Release(this.window);
|
|
int num2 = 0;
|
|
this.window = num2;
|
|
this.hufts = num2;
|
|
}
|
|
|
|
// Token: 0x0600B1BC RID: 45500 RVA: 0x0029AD98 File Offset: 0x00298F98
|
|
[Token(Token = "0x600B1BC")]
|
|
[Address(RVA = "0x1F15520", Offset = "0x1F13F20", VA = "0x181F15520")]
|
|
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: 0x0600B1BD RID: 45501 RVA: 0x0029ADC8 File Offset: 0x00298FC8
|
|
[Token(Token = "0x600B1BD")]
|
|
[Address(RVA = "0x1F15570", Offset = "0x1F13F70", VA = "0x181F15570")]
|
|
internal int SyncPoint()
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B1BD)
|
|
|
|
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: 0x0600B1BE RID: 45502 RVA: 0x0029ADE0 File Offset: 0x00298FE0
|
|
[Token(Token = "0x600B1BE")]
|
|
[Address(RVA = "0x1F13BB0", Offset = "0x1F125B0", VA = "0x181F13BB0")]
|
|
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: 0x0600B1BF RID: 45503 RVA: 0x0029AF14 File Offset: 0x00299114
|
|
// Note: this type is marked as 'beforefieldinit'.
|
|
[Token(Token = "0x600B1BF")]
|
|
[Address(RVA = "0x1F15580", Offset = "0x1F13F80", VA = "0x181F15580")]
|
|
static InflateBlocks()
|
|
{
|
|
int[] array = new int[19];
|
|
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.1FDC8DB567F5AAA7068D0D2A601CD71657CBDF38).FieldHandle);
|
|
InflateBlocks.border = array;
|
|
}
|
|
|
|
// Token: 0x040074C9 RID: 29897
|
|
[Token(Token = "0x40074C9")]
|
|
private const int MANY = 1440;
|
|
|
|
// Token: 0x040074CA RID: 29898
|
|
[Token(Token = "0x40074CA")]
|
|
internal static readonly int[] border;
|
|
|
|
// Token: 0x040074CB RID: 29899
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40074CB")]
|
|
private InflateBlocks.InflateBlockMode mode;
|
|
|
|
// Token: 0x040074CC RID: 29900
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x14")]
|
|
[Token(Token = "0x40074CC")]
|
|
internal int left;
|
|
|
|
// Token: 0x040074CD RID: 29901
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40074CD")]
|
|
internal int table;
|
|
|
|
// Token: 0x040074CE RID: 29902
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x1C")]
|
|
[Token(Token = "0x40074CE")]
|
|
internal int index;
|
|
|
|
// Token: 0x040074CF RID: 29903
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40074CF")]
|
|
internal int[] blens;
|
|
|
|
// Token: 0x040074D0 RID: 29904
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40074D0")]
|
|
internal int[] bb;
|
|
|
|
// Token: 0x040074D1 RID: 29905
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40074D1")]
|
|
internal int[] tb;
|
|
|
|
// Token: 0x040074D2 RID: 29906
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x40074D2")]
|
|
internal InflateCodes codes;
|
|
|
|
// Token: 0x040074D3 RID: 29907
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x40074D3")]
|
|
internal int last;
|
|
|
|
// Token: 0x040074D4 RID: 29908
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x40074D4")]
|
|
internal ZlibCodec _codec;
|
|
|
|
// Token: 0x040074D5 RID: 29909
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x50")]
|
|
[Token(Token = "0x40074D5")]
|
|
internal int bitk;
|
|
|
|
// Token: 0x040074D6 RID: 29910
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x54")]
|
|
[Token(Token = "0x40074D6")]
|
|
internal int bitb;
|
|
|
|
// Token: 0x040074D7 RID: 29911
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x58")]
|
|
[Token(Token = "0x40074D7")]
|
|
internal int[] hufts;
|
|
|
|
// Token: 0x040074D8 RID: 29912
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x60")]
|
|
[Token(Token = "0x40074D8")]
|
|
internal byte[] window;
|
|
|
|
// Token: 0x040074D9 RID: 29913
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x68")]
|
|
[Token(Token = "0x40074D9")]
|
|
internal int end;
|
|
|
|
// Token: 0x040074DA RID: 29914
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x6C")]
|
|
[Token(Token = "0x40074DA")]
|
|
internal int readAt;
|
|
|
|
// Token: 0x040074DB RID: 29915
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x70")]
|
|
[Token(Token = "0x40074DB")]
|
|
internal int writeAt;
|
|
|
|
// Token: 0x040074DC RID: 29916
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x78")]
|
|
[Token(Token = "0x40074DC")]
|
|
internal object checkfn;
|
|
|
|
// Token: 0x040074DD RID: 29917
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x80")]
|
|
[Token(Token = "0x40074DD")]
|
|
internal uint check;
|
|
|
|
// Token: 0x040074DE RID: 29918
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x88")]
|
|
[Token(Token = "0x40074DE")]
|
|
internal InfTree inftree;
|
|
|
|
// Token: 0x020019CC RID: 6604
|
|
[Token(Token = "0x20019CC")]
|
|
private enum InflateBlockMode
|
|
{
|
|
// Token: 0x040074E0 RID: 29920
|
|
[Token(Token = "0x40074E0")]
|
|
TYPE,
|
|
// Token: 0x040074E1 RID: 29921
|
|
[Token(Token = "0x40074E1")]
|
|
LENS,
|
|
// Token: 0x040074E2 RID: 29922
|
|
[Token(Token = "0x40074E2")]
|
|
STORED,
|
|
// Token: 0x040074E3 RID: 29923
|
|
[Token(Token = "0x40074E3")]
|
|
TABLE,
|
|
// Token: 0x040074E4 RID: 29924
|
|
[Token(Token = "0x40074E4")]
|
|
BTREE,
|
|
// Token: 0x040074E5 RID: 29925
|
|
[Token(Token = "0x40074E5")]
|
|
DTREE,
|
|
// Token: 0x040074E6 RID: 29926
|
|
[Token(Token = "0x40074E6")]
|
|
CODES,
|
|
// Token: 0x040074E7 RID: 29927
|
|
[Token(Token = "0x40074E7")]
|
|
DRY,
|
|
// Token: 0x040074E8 RID: 29928
|
|
[Token(Token = "0x40074E8")]
|
|
DONE,
|
|
// Token: 0x040074E9 RID: 29929
|
|
[Token(Token = "0x40074E9")]
|
|
BAD
|
|
}
|
|
}
|
|
}
|