172 lines
9.5 KiB
C#
172 lines
9.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Runtime.InteropServices;
|
|
using Cpp2IlInjected;
|
|
using UnityEngine;
|
|
|
|
namespace BestHTTP.Examples
|
|
{
|
|
// Token: 0x020012BC RID: 4796
|
|
[Token(Token = "0x20012BC")]
|
|
[StructLayout(3)]
|
|
public sealed class AssetBundleSample : MonoBehaviour
|
|
{
|
|
// Token: 0x0600781D RID: 30749 RVA: 0x0018E7CC File Offset: 0x0018C9CC
|
|
[Token(Token = "0x600781D")]
|
|
[Address(RVA = "0x1E61EB0", Offset = "0x1E608B0", VA = "0x181E61EB0")]
|
|
private void OnGUI()
|
|
{
|
|
Rect clientArea = GUIHelper.ClientArea;
|
|
Action action = delegate
|
|
{
|
|
string text = this.status;
|
|
string text2 = "Status: " + text;
|
|
GUILayoutOption[] array = Array.Empty<GUILayoutOption>();
|
|
GUILayout.Label(text2, array);
|
|
Texture2D texture2D = this.texture;
|
|
int num = 0;
|
|
if (texture2D != num)
|
|
{
|
|
Texture2D texture2D2 = this.texture;
|
|
GUILayoutOption[] array2 = new GUILayoutOption[1];
|
|
GUILayoutOption guilayoutOption = GUILayout.MaxHeight(256f);
|
|
if (guilayoutOption != 0)
|
|
{
|
|
}
|
|
array2[0] = guilayoutOption;
|
|
GUILayout.Box(texture2D2, array2);
|
|
}
|
|
if (!this.downloading)
|
|
{
|
|
GUILayoutOption[] array3 = Array.Empty<GUILayoutOption>();
|
|
if (GUILayout.Button("Start Download", array3))
|
|
{
|
|
this.UnloadBundle();
|
|
AssetBundleSample.<DownloadAssetBundle>d__7 <DownloadAssetBundle>d__;
|
|
<DownloadAssetBundle>d__.System.IDisposable.Dispose();
|
|
<DownloadAssetBundle>d__.<>1__state = (int)((ulong)0L);
|
|
<DownloadAssetBundle>d__.<>4__this = this;
|
|
Coroutine coroutine = base.StartCoroutine(<DownloadAssetBundle>d__);
|
|
}
|
|
}
|
|
};
|
|
GUIHelper.DrawArea(clientArea, true, action);
|
|
}
|
|
|
|
// Token: 0x0600781E RID: 30750 RVA: 0x0018E7F4 File Offset: 0x0018C9F4
|
|
[Token(Token = "0x600781E")]
|
|
[Address(RVA = "0x1E61EA0", Offset = "0x1E608A0", VA = "0x181E61EA0")]
|
|
private void OnDestroy()
|
|
{
|
|
this.UnloadBundle();
|
|
}
|
|
|
|
// Token: 0x0600781F RID: 30751 RVA: 0x0018E808 File Offset: 0x0018CA08
|
|
[Token(Token = "0x600781F")]
|
|
[Address(RVA = "0x1E61E40", Offset = "0x1E60840", VA = "0x181E61E40")]
|
|
private IEnumerator DownloadAssetBundle()
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600781F)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Collections.IEnumerator BestHTTP.Examples.AssetBundleSample::DownloadAssetBundle()
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
Block_0:
|
|
call:void('<DownloadAssetBundle>d__7'::System.IDisposable.Dispose, ldloc:'<DownloadAssetBundle>d__7'(var_0))
|
|
stfld:int32('<DownloadAssetBundle>d__7'::<>1__state, ldloc:'<DownloadAssetBundle>d__7'(var_0), conv.u8:uint64[exp:int32](ldc.i8:int64[exp:uint64](0)))
|
|
stfld:AssetBundleSample('<DownloadAssetBundle>d__7'::<>4__this, ldloc:'<DownloadAssetBundle>d__7'(var_0), ldloc:AssetBundleSample(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: 0x06007820 RID: 30752 RVA: 0x0018E82C File Offset: 0x0018CA2C
|
|
[Token(Token = "0x6007820")]
|
|
[Address(RVA = "0x1E61F60", Offset = "0x1E60960", VA = "0x181E61F60")]
|
|
private IEnumerator ProcessAssetBundle(AssetBundle bundle)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06007820)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Collections.IEnumerator BestHTTP.Examples.AssetBundleSample::ProcessAssetBundle(UnityEngine.AssetBundle)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
Block_0:
|
|
call:void('<ProcessAssetBundle>d__8'::System.IDisposable.Dispose, ldloc:'<ProcessAssetBundle>d__8'(var_0))
|
|
stfld:AssetBundleSample('<ProcessAssetBundle>d__8'::<>4__this, ldloc:'<ProcessAssetBundle>d__8'(var_0), ldloc:AssetBundleSample(this))
|
|
stfld:int32('<ProcessAssetBundle>d__8'::<>1__state, ldloc:'<ProcessAssetBundle>d__8'(var_0), conv.u8:uint64[exp:int32](ldc.i8:int64[exp:uint64](0)))
|
|
stfld:AssetBundle('<ProcessAssetBundle>d__8'::bundle, ldloc:'<ProcessAssetBundle>d__8'(var_0), ldloc:AssetBundle(bundle))
|
|
}
|
|
|
|
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: 0x06007821 RID: 30753 RVA: 0x0018E858 File Offset: 0x0018CA58
|
|
[Token(Token = "0x6007821")]
|
|
[Address(RVA = "0x1E62190", Offset = "0x1E60B90", VA = "0x181E62190")]
|
|
private void UnloadBundle()
|
|
{
|
|
AssetBundle assetBundle = this.cachedBundle;
|
|
int num = 0;
|
|
if (assetBundle != num)
|
|
{
|
|
this.cachedBundle.Unload(true);
|
|
this.cachedBundle = (ulong)0L;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06007822 RID: 30754 RVA: 0x0018E894 File Offset: 0x0018CA94
|
|
[Token(Token = "0x6007822")]
|
|
[Address(RVA = "0x1E62220", Offset = "0x1E60C20", VA = "0x181E62220")]
|
|
public AssetBundleSample()
|
|
{
|
|
Uri uri = new Uri(GUIHelper.BaseURL + "/AssetBundles/WebGL/demobundle.assetbundle");
|
|
this.URI = uri;
|
|
this.status = "Waiting for user interaction";
|
|
base..ctor();
|
|
}
|
|
|
|
// Token: 0x040056B2 RID: 22194
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40056B2")]
|
|
private Uri URI;
|
|
|
|
// Token: 0x040056B3 RID: 22195
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40056B3")]
|
|
private string status;
|
|
|
|
// Token: 0x040056B4 RID: 22196
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40056B4")]
|
|
private AssetBundle cachedBundle;
|
|
|
|
// Token: 0x040056B5 RID: 22197
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40056B5")]
|
|
private Texture2D texture;
|
|
|
|
// Token: 0x040056B6 RID: 22198
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x40056B6")]
|
|
private bool downloading;
|
|
}
|
|
}
|