359 lines
14 KiB
C#
359 lines
14 KiB
C#
using System;
|
|
using BestHTTP.Extensions;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.Decompression.Zlib
|
|
{
|
|
// Token: 0x02001FAC RID: 8108
|
|
[Token(Token = "0x2001FAC")]
|
|
internal sealed class InflateManager
|
|
{
|
|
// Token: 0x170020B7 RID: 8375
|
|
// (get) Token: 0x0600CD9F RID: 52639 RVA: 0x002F3A70 File Offset: 0x002F1C70
|
|
// (set) Token: 0x0600CDA0 RID: 52640 RVA: 0x002F3A84 File Offset: 0x002F1C84
|
|
[Token(Token = "0x170020B7")]
|
|
internal bool HandleRfc1950HeaderBytes
|
|
{
|
|
[Token(Token = "0x600CD9F")]
|
|
[Address(RVA = "0x4364F0", Offset = "0x4352F0", VA = "0x1804364F0")]
|
|
get
|
|
{
|
|
return this._handleRfc1950HeaderBytes;
|
|
}
|
|
[Token(Token = "0x600CDA0")]
|
|
[Address(RVA = "0x436790", Offset = "0x435590", VA = "0x180436790")]
|
|
set
|
|
{
|
|
this._handleRfc1950HeaderBytes = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600CDA1 RID: 52641 RVA: 0x002F3A98 File Offset: 0x002F1C98
|
|
[Token(Token = "0x600CDA1")]
|
|
[Address(RVA = "0x106D240", Offset = "0x106C040", VA = "0x18106D240")]
|
|
public InflateManager()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600CDA2 RID: 52642 RVA: 0x002F3AB4 File Offset: 0x002F1CB4
|
|
[Token(Token = "0x600CDA2")]
|
|
[Address(RVA = "0x1973E60", Offset = "0x1972C60", VA = "0x181973E60")]
|
|
public InflateManager(bool expectRfc1950HeaderBytes)
|
|
{
|
|
this._handleRfc1950HeaderBytes = expectRfc1950HeaderBytes;
|
|
}
|
|
|
|
// Token: 0x0600CDA3 RID: 52643 RVA: 0x002F3AD8 File Offset: 0x002F1CD8
|
|
[Token(Token = "0x600CDA3")]
|
|
[Address(RVA = "0x1973950", Offset = "0x1972750", VA = "0x181973950")]
|
|
internal int Reset()
|
|
{
|
|
ZlibCodec codec = this._codec;
|
|
int num = 0;
|
|
codec.TotalBytesOut = (long)num;
|
|
codec.TotalBytesIn = (long)num;
|
|
this._codec.Message = num;
|
|
this.mode = (InflateManager.InflateManagerMode)((uint)7);
|
|
uint num2 = this.blocks.Reset();
|
|
return 0;
|
|
}
|
|
|
|
// Token: 0x0600CDA4 RID: 52644 RVA: 0x002F3B24 File Offset: 0x002F1D24
|
|
[Token(Token = "0x600CDA4")]
|
|
[Address(RVA = "0x1972D60", Offset = "0x1971B60", VA = "0x181972D60")]
|
|
internal int End()
|
|
{
|
|
InflateBlocks inflateBlocks = this.blocks;
|
|
if (inflateBlocks != 0)
|
|
{
|
|
uint num = inflateBlocks.Reset();
|
|
VariableSizedBufferPool.Release(inflateBlocks.window);
|
|
int num2 = 0;
|
|
inflateBlocks.window = num2;
|
|
inflateBlocks.hufts = num2;
|
|
this.blocks = num2;
|
|
return num2;
|
|
}
|
|
int num3 = 0;
|
|
this.blocks = num3;
|
|
return num3;
|
|
}
|
|
|
|
// Token: 0x0600CDA5 RID: 52645 RVA: 0x002F3B74 File Offset: 0x002F1D74
|
|
[Token(Token = "0x600CDA5")]
|
|
[Address(RVA = "0x1973730", Offset = "0x1972530", VA = "0x181973730")]
|
|
internal int Initialize(ZlibCodec codec, int w)
|
|
{
|
|
this._codec = codec;
|
|
int num = 0;
|
|
codec.Message = num;
|
|
this.blocks = num;
|
|
this.wbits = w;
|
|
int[] array = new int[1];
|
|
InflateBlocks inflateBlocks;
|
|
inflateBlocks.bb = array;
|
|
int[] array2 = new int[1];
|
|
inflateBlocks.tb = array2;
|
|
InflateCodes inflateCodes = new InflateCodes();
|
|
inflateBlocks.codes = inflateCodes;
|
|
InfTree infTree = new InfTree();
|
|
inflateBlocks.inftree = infTree;
|
|
inflateBlocks._codec = codec;
|
|
int[] array3 = new int[4320];
|
|
inflateBlocks.hufts = array3;
|
|
byte[] array4;
|
|
inflateBlocks.window = array4;
|
|
inflateBlocks.checkfn = num;
|
|
inflateBlocks.mode = (InflateBlocks.InflateBlockMode)num;
|
|
uint num2 = inflateBlocks.Reset();
|
|
this.blocks = inflateBlocks;
|
|
ZlibCodec codec2 = this._codec;
|
|
codec2.TotalBytesOut = (long)num;
|
|
codec2.TotalBytesIn = (long)num;
|
|
this._codec.Message = num;
|
|
this.mode = (InflateManager.InflateManagerMode)((uint)7);
|
|
uint num3 = this.blocks.Reset();
|
|
return 0;
|
|
}
|
|
|
|
// Token: 0x0600CDA6 RID: 52646 RVA: 0x002F3C70 File Offset: 0x002F1E70
|
|
[Token(Token = "0x600CDA6")]
|
|
[Address(RVA = "0x1972E00", Offset = "0x1971C00", VA = "0x181972E00")]
|
|
internal int Inflate(FlushType flush)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600CDA6)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.Decompression.Zlib.InflateManager::Inflate(BestHTTP.Decompression.Zlib.FlushType)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_5BD:
|
|
stloc:ZlibException(var_104_5C7, newobj:ZlibException(ZlibException::.ctor, ldstr:string("Stream error.")))
|
|
}
|
|
|
|
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: 0x0600CDA7 RID: 52647 RVA: 0x002F4248 File Offset: 0x002F2448
|
|
[Token(Token = "0x600CDA7")]
|
|
[Address(RVA = "0x19739A0", Offset = "0x19727A0", VA = "0x1819739A0")]
|
|
internal int SetDictionary(byte[] dictionary)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600CDA7)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.Decompression.Zlib.InflateManager::SetDictionary(System.Byte[])
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_9A:
|
|
stloc:ZlibException(var_14_A4, newobj:ZlibException(ZlibException::.ctor, ldstr:string("Stream error.")))
|
|
}
|
|
|
|
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.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
|
|
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: 0x0600CDA8 RID: 52648 RVA: 0x002F42FC File Offset: 0x002F24FC
|
|
[Token(Token = "0x600CDA8")]
|
|
[Address(RVA = "0x1973B60", Offset = "0x1972960", VA = "0x181973B60")]
|
|
internal int Sync()
|
|
{
|
|
int num = 0;
|
|
if (this.mode != InflateManager.InflateManagerMode.BAD)
|
|
{
|
|
this.mode = (InflateManager.InflateManagerMode)((ulong)13L);
|
|
this.marker = num;
|
|
}
|
|
ZlibCodec codec = this._codec;
|
|
int availableBytesIn = codec.AvailableBytesIn;
|
|
if (availableBytesIn != 0)
|
|
{
|
|
int num2 = codec.NextIn;
|
|
int num3 = this.marker;
|
|
if (num3 < 4)
|
|
{
|
|
byte b = this._codec.InputBuffer[num2];
|
|
byte[] array = InflateManager.mark;
|
|
byte[] inputBuffer = this._codec.InputBuffer;
|
|
if ("{il2cpp array field local11->}" == num)
|
|
{
|
|
uint num4;
|
|
num4 -= (uint)num3;
|
|
}
|
|
num++;
|
|
num2++;
|
|
while ("{il2cpp array field local11->}" != num)
|
|
{
|
|
}
|
|
}
|
|
ZlibCodec codec2 = this._codec;
|
|
this._codec.NextIn = num2;
|
|
this._codec.AvailableBytesIn = availableBytesIn;
|
|
this.marker = num;
|
|
if (num == 4)
|
|
{
|
|
ZlibCodec codec3 = this._codec;
|
|
long totalBytesIn = codec3.TotalBytesIn;
|
|
long totalBytesOut = codec3.TotalBytesOut;
|
|
codec3.TotalBytesOut = (long)num;
|
|
codec3.TotalBytesIn = (long)num;
|
|
this._codec.Message = num;
|
|
uint num5;
|
|
this.mode = (InflateManager.InflateManagerMode)num5;
|
|
uint num6 = this.blocks.Reset();
|
|
this._codec.TotalBytesIn = totalBytesIn;
|
|
this._codec.TotalBytesOut = totalBytesOut;
|
|
int num7 = 0;
|
|
this.mode = (InflateManager.InflateManagerMode)num5;
|
|
return num7;
|
|
}
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600CDA9 RID: 52649 RVA: 0x002F4438 File Offset: 0x002F2638
|
|
[Token(Token = "0x600CDA9")]
|
|
[Address(RVA = "0x1973B30", Offset = "0x1972930", VA = "0x181973B30")]
|
|
internal int SyncPoint(ZlibCodec z)
|
|
{
|
|
bool flag = this.blocks.mode == InflateBlocks.InflateBlockMode.LENS;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600CDAA RID: 52650 RVA: 0x002F445C File Offset: 0x002F265C
|
|
// Note: this type is marked as 'beforefieldinit'.
|
|
[Token(Token = "0x600CDAA")]
|
|
[Address(RVA = "0x1973DD0", Offset = "0x1972BD0", VA = "0x181973DD0")]
|
|
static InflateManager()
|
|
{
|
|
byte[] array = new byte[4];
|
|
array[0] = (byte)((ulong)255L);
|
|
array[0] = (byte)((ulong)255L);
|
|
InflateManager.mark = array;
|
|
}
|
|
|
|
// Token: 0x04008346 RID: 33606
|
|
[Token(Token = "0x4008346")]
|
|
private const int PRESET_DICT = 32;
|
|
|
|
// Token: 0x04008347 RID: 33607
|
|
[Token(Token = "0x4008347")]
|
|
private const int Z_DEFLATED = 8;
|
|
|
|
// Token: 0x04008348 RID: 33608
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4008348")]
|
|
private InflateManager.InflateManagerMode mode;
|
|
|
|
// Token: 0x04008349 RID: 33609
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4008349")]
|
|
internal ZlibCodec _codec;
|
|
|
|
// Token: 0x0400834A RID: 33610
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400834A")]
|
|
internal int method;
|
|
|
|
// Token: 0x0400834B RID: 33611
|
|
[FieldOffset(Offset = "0x24")]
|
|
[Token(Token = "0x400834B")]
|
|
internal uint computedCheck;
|
|
|
|
// Token: 0x0400834C RID: 33612
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400834C")]
|
|
internal uint expectedCheck;
|
|
|
|
// Token: 0x0400834D RID: 33613
|
|
[FieldOffset(Offset = "0x2C")]
|
|
[Token(Token = "0x400834D")]
|
|
internal int marker;
|
|
|
|
// Token: 0x0400834E RID: 33614
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400834E")]
|
|
private bool _handleRfc1950HeaderBytes = true;
|
|
|
|
// Token: 0x0400834F RID: 33615
|
|
[FieldOffset(Offset = "0x34")]
|
|
[Token(Token = "0x400834F")]
|
|
internal int wbits;
|
|
|
|
// Token: 0x04008350 RID: 33616
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4008350")]
|
|
internal InflateBlocks blocks;
|
|
|
|
// Token: 0x04008351 RID: 33617
|
|
[Token(Token = "0x4008351")]
|
|
private static readonly byte[] mark;
|
|
|
|
// Token: 0x02001FAD RID: 8109
|
|
[Token(Token = "0x2001FAD")]
|
|
private enum InflateManagerMode
|
|
{
|
|
// Token: 0x04008353 RID: 33619
|
|
[Token(Token = "0x4008353")]
|
|
METHOD,
|
|
// Token: 0x04008354 RID: 33620
|
|
[Token(Token = "0x4008354")]
|
|
FLAG,
|
|
// Token: 0x04008355 RID: 33621
|
|
[Token(Token = "0x4008355")]
|
|
DICT4,
|
|
// Token: 0x04008356 RID: 33622
|
|
[Token(Token = "0x4008356")]
|
|
DICT3,
|
|
// Token: 0x04008357 RID: 33623
|
|
[Token(Token = "0x4008357")]
|
|
DICT2,
|
|
// Token: 0x04008358 RID: 33624
|
|
[Token(Token = "0x4008358")]
|
|
DICT1,
|
|
// Token: 0x04008359 RID: 33625
|
|
[Token(Token = "0x4008359")]
|
|
DICT0,
|
|
// Token: 0x0400835A RID: 33626
|
|
[Token(Token = "0x400835A")]
|
|
BLOCKS,
|
|
// Token: 0x0400835B RID: 33627
|
|
[Token(Token = "0x400835B")]
|
|
CHECK4,
|
|
// Token: 0x0400835C RID: 33628
|
|
[Token(Token = "0x400835C")]
|
|
CHECK3,
|
|
// Token: 0x0400835D RID: 33629
|
|
[Token(Token = "0x400835D")]
|
|
CHECK2,
|
|
// Token: 0x0400835E RID: 33630
|
|
[Token(Token = "0x400835E")]
|
|
CHECK1,
|
|
// Token: 0x0400835F RID: 33631
|
|
[Token(Token = "0x400835F")]
|
|
DONE,
|
|
// Token: 0x04008360 RID: 33632
|
|
[Token(Token = "0x4008360")]
|
|
BAD
|
|
}
|
|
}
|
|
}
|