225 lines
10 KiB
C#
225 lines
10 KiB
C#
using System;
|
|
using System.IO;
|
|
using BestHTTP.Logger;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.Extensions
|
|
{
|
|
// Token: 0x0200207F RID: 8319
|
|
[Token(Token = "0x200207F")]
|
|
public sealed class WriteOnlyBufferedStream : Stream
|
|
{
|
|
// Token: 0x17002138 RID: 8504
|
|
// (get) Token: 0x0600D0E6 RID: 53478 RVA: 0x002F7430 File Offset: 0x002F5630
|
|
[Token(Token = "0x17002138")]
|
|
public override bool CanRead
|
|
{
|
|
[Token(Token = "0x600D0E6")]
|
|
[Address(RVA = "0x424690", Offset = "0x423690", VA = "0x180424690", Slot = "7")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x17002139 RID: 8505
|
|
// (get) Token: 0x0600D0E7 RID: 53479 RVA: 0x002F7440 File Offset: 0x002F5640
|
|
[Token(Token = "0x17002139")]
|
|
public override bool CanSeek
|
|
{
|
|
[Token(Token = "0x600D0E7")]
|
|
[Address(RVA = "0x424690", Offset = "0x423690", VA = "0x180424690", Slot = "8")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700213A RID: 8506
|
|
// (get) Token: 0x0600D0E8 RID: 53480 RVA: 0x002F7450 File Offset: 0x002F5650
|
|
[Token(Token = "0x1700213A")]
|
|
public override bool CanWrite
|
|
{
|
|
[Token(Token = "0x600D0E8")]
|
|
[Address(RVA = "0x4246A0", Offset = "0x4236A0", VA = "0x1804246A0", Slot = "9")]
|
|
get
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700213B RID: 8507
|
|
// (get) Token: 0x0600D0E9 RID: 53481 RVA: 0x002F7460 File Offset: 0x002F5660
|
|
[Token(Token = "0x1700213B")]
|
|
public override long Length
|
|
{
|
|
[Token(Token = "0x600D0E9")]
|
|
[Address(RVA = "0x2A83770", Offset = "0x2A82770", VA = "0x182A83770", Slot = "10")]
|
|
get
|
|
{
|
|
int length = this.buffer.Length;
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700213C RID: 8508
|
|
// (get) Token: 0x0600D0EA RID: 53482 RVA: 0x002F7480 File Offset: 0x002F5680
|
|
// (set) Token: 0x0600D0EB RID: 53483 RVA: 0x002F7494 File Offset: 0x002F5694
|
|
[Token(Token = "0x1700213C")]
|
|
public override long Position
|
|
{
|
|
[Token(Token = "0x600D0EA")]
|
|
[Address(RVA = "0x2A83790", Offset = "0x2A82790", VA = "0x182A83790", Slot = "11")]
|
|
get
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600D0EA)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int64 BestHTTP.Extensions.WriteOnlyBufferedStream::get_Position()
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
Block_0:
|
|
stloc:int32(var_0_06, ldfld:int32(WriteOnlyBufferedStream::_position, ldloc:WriteOnlyBufferedStream(this)))
|
|
}
|
|
|
|
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(Token = "0x600D0EB")]
|
|
[Address(RVA = "0x2A837A0", Offset = "0x2A827A0", VA = "0x182A837A0", Slot = "12")]
|
|
set
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600D0EB)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.Extensions.WriteOnlyBufferedStream::set_Position(System.Int64)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
Block_0:
|
|
stloc:NotImplementedException(var_0_0A, newobj:NotImplementedException(NotImplementedException::.ctor, ldstr:string("Position set")))
|
|
}
|
|
|
|
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: 0x0600D0EC RID: 53484 RVA: 0x002F74AC File Offset: 0x002F56AC
|
|
[Token(Token = "0x600D0EC")]
|
|
[Address(RVA = "0x2A836C0", Offset = "0x2A826C0", VA = "0x182A836C0")]
|
|
public WriteOnlyBufferedStream(Stream stream, int bufferSize)
|
|
{
|
|
this.stream = stream;
|
|
byte[] array = VariableSizedBufferPool.Get((long)bufferSize, true);
|
|
this.buffer = array;
|
|
this._position = (int)((ulong)0L);
|
|
}
|
|
|
|
// Token: 0x0600D0ED RID: 53485 RVA: 0x002F74E0 File Offset: 0x002F56E0
|
|
[Token(Token = "0x600D0ED")]
|
|
[Address(RVA = "0x2A83470", Offset = "0x2A82470", VA = "0x182A83470", Slot = "17")]
|
|
public override void Flush()
|
|
{
|
|
if (this._position > 0)
|
|
{
|
|
if (HTTPManager.Logger == 0)
|
|
{
|
|
ILogger logger = HTTPManager.Logger;
|
|
int position = this._position;
|
|
}
|
|
int num = this.stream.ReadByte();
|
|
this._position = (int)((ulong)0L);
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600D0EE RID: 53486 RVA: 0x002F752C File Offset: 0x002F572C
|
|
[Token(Token = "0x600D0EE")]
|
|
[Address(RVA = "0x2A835B0", Offset = "0x2A825B0", VA = "0x182A835B0", Slot = "29")]
|
|
public override void Write(byte[] bufferFrom, int offset, int count)
|
|
{
|
|
if (count > 0)
|
|
{
|
|
byte[] array = this.buffer;
|
|
int position = this._position;
|
|
int num = array.Length;
|
|
num -= position;
|
|
int num2 = Math.Min(count, num);
|
|
int position2 = this._position;
|
|
byte[] array2 = this.buffer;
|
|
Array.Copy(bufferFrom, offset, array2, position2, num2);
|
|
int num3 = this._position;
|
|
byte[] array3 = this.buffer;
|
|
num3 += num2;
|
|
this._position = num3;
|
|
if (num3 == array3.Length)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600D0EF RID: 53487 RVA: 0x002F75B0 File Offset: 0x002F57B0
|
|
[Token(Token = "0x600D0EF")]
|
|
[Address(RVA = "0x4242C0", Offset = "0x4232C0", VA = "0x1804242C0", Slot = "27")]
|
|
public override int Read(byte[] buffer, int offset, int count)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
// Token: 0x0600D0F0 RID: 53488 RVA: 0x002F75C0 File Offset: 0x002F57C0
|
|
[Token(Token = "0x600D0F0")]
|
|
[Address(RVA = "0x4242C0", Offset = "0x4232C0", VA = "0x1804242C0", Slot = "25")]
|
|
public override long Seek(long offset, SeekOrigin origin)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600D0F1 RID: 53489 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x600D0F1")]
|
|
[Address(RVA = "0x4242D0", Offset = "0x4232D0", VA = "0x1804242D0", Slot = "26")]
|
|
public override void SetLength(long value)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x0600D0F2 RID: 53490 RVA: 0x002F75D0 File Offset: 0x002F57D0
|
|
[Token(Token = "0x600D0F2")]
|
|
[Address(RVA = "0x2A833F0", Offset = "0x2A823F0", VA = "0x182A833F0", Slot = "16")]
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
this.SetLength(disposing ? 1L : 0L);
|
|
byte[] array = this.buffer;
|
|
if (array != 0)
|
|
{
|
|
VariableSizedBufferPool.Release(array);
|
|
}
|
|
this.buffer = (ulong)0L;
|
|
}
|
|
|
|
// Token: 0x04008443 RID: 33859
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4008443")]
|
|
private int _position;
|
|
|
|
// Token: 0x04008444 RID: 33860
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4008444")]
|
|
private byte[] buffer;
|
|
|
|
// Token: 0x04008445 RID: 33861
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4008445")]
|
|
private Stream stream;
|
|
}
|
|
}
|