Decompiled source of LocalStuff v1.1.0

plugins/LocalStuff/LocalStuff.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Sources;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.NET.Common;
using BepInExResoniteShim;
using BepisModSettings.ConfigAttributes;
using BepisResoniteWrapper;
using Elements.Core;
using FrooxEngine;
using FrooxEngine.UIX;
using HarmonyLib;
using SkyFrost.Base;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v11.0", FrameworkDisplayName = ".NET 11.0")]
[assembly: AssemblyCompany("art0007i")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+f703ef8ece1d658bf4d7d406cf1bafe5b2081022")]
[assembly: AssemblyProduct("LocalStuff")]
[assembly: AssemblyTitle("LocalStuff")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/art0007i/LocalStuff")]
[assembly: AssemblyVersion("1.1.0.0")]
[module: RefSafetyRules(11)]
namespace LocalStuff;

public static class ModSettings
{
	private enum SaveState
	{
		NotSaved,
		Saved,
		Saving,
		NotSavable
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass2_0
	{
		public Workspace space;

		public string txt;

		public IField<string> label;

		public IField<bool> enabled;

		public Action <>9__4;

		public ButtonEventHandler <>9__3;

		internal void <EnumerateWorskpaceDataFeed>b__0(IField<string> field)
		{
			((IValue<string>)(object)field).Value = txt;
			label = field;
		}

		internal void <EnumerateWorskpaceDataFeed>b__1(IField<bool> x)
		{
			enabled = x;
		}

		internal void <EnumerateWorskpaceDataFeed>b__2(SyncDelegate<Action> x)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_002b: Expected O, but got Unknown
			Button component = ((ContainerWorker<Component>)(object)((SyncElement)x).Slot).GetComponent<Button>((Predicate<Button>)null, false);
			ButtonEventHandler obj = <>9__3;
			if (obj == null)
			{
				ButtonEventHandler val = delegate
				{
					//IL_0035: Unknown result type (might be due to invalid IL or missing references)
					//IL_003a: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Expected O, but got Unknown
					//IL_0041: Expected O, but got Unknown
					((IValue<string>)(object)label).Value = GetStatusText(SaveState.Saving);
					((IValue<bool>)(object)enabled).Value = false;
					Workspace obj2 = space;
					Action obj3 = <>9__4;
					if (obj3 == null)
					{
						Action val3 = delegate
						{
							((IValue<string>)(object)label).Value = GetStatusText(SaveState.Saved);
							((IValue<bool>)(object)enabled).Value = true;
						};
						Action val4 = val3;
						<>9__4 = val3;
						obj3 = val4;
					}
					Plugin.SaveWorkspaceLocally(obj2, obj3);
				};
				ButtonEventHandler val2 = val;
				<>9__3 = val;
				obj = val2;
			}
			component.LocalPressed += obj;
		}

		internal void <EnumerateWorskpaceDataFeed>b__3(IButton _, ButtonEventData _)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0041: Expected O, but got Unknown
			((IValue<string>)(object)label).Value = GetStatusText(SaveState.Saving);
			((IValue<bool>)(object)enabled).Value = false;
			Workspace obj = space;
			Action obj2 = <>9__4;
			if (obj2 == null)
			{
				Action val = delegate
				{
					((IValue<string>)(object)label).Value = GetStatusText(SaveState.Saved);
					((IValue<bool>)(object)enabled).Value = true;
				};
				Action val2 = val;
				<>9__4 = val;
				obj2 = val2;
			}
			Plugin.SaveWorkspaceLocally(obj, obj2);
		}

		internal void <EnumerateWorskpaceDataFeed>b__4()
		{
			((IValue<string>)(object)label).Value = GetStatusText(SaveState.Saved);
			((IValue<bool>)(object)enabled).Value = true;
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass3_0
	{
		public string txt;

		public IField<string> label;

		public SaveState status;

		public IField<bool> enabled;

		public FavoriteEntity entity;

		public Action <>9__4;

		public ButtonEventHandler <>9__3;

		internal void <EnumerateEntityInterfaceDataFeed>b__0(IField<string> field)
		{
			((IValue<string>)(object)field).Value = txt;
			label = field;
		}

		internal void <EnumerateEntityInterfaceDataFeed>b__1(IField<bool> x)
		{
			((IValue<bool>)(object)x).Value = status != SaveState.NotSavable;
			enabled = x;
		}

		internal void <EnumerateEntityInterfaceDataFeed>b__2(SyncDelegate<Action> x)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_002b: Expected O, but got Unknown
			Button component = ((ContainerWorker<Component>)(object)((SyncElement)x).Slot).GetComponent<Button>((Predicate<Button>)null, false);
			ButtonEventHandler obj = <>9__3;
			if (obj == null)
			{
				ButtonEventHandler val = delegate
				{
					//IL_001e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0035: Unknown result type (might be due to invalid IL or missing references)
					//IL_003a: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Expected O, but got Unknown
					//IL_0041: Expected O, but got Unknown
					((IValue<string>)(object)label).Value = GetStatusText(SaveState.Saving);
					((IValue<bool>)(object)enabled).Value = false;
					FavoriteEntity val3 = entity;
					Action obj2 = <>9__4;
					if (obj2 == null)
					{
						Action val4 = delegate
						{
							((IValue<string>)(object)label).Value = GetStatusText(SaveState.Saved);
							((IValue<bool>)(object)enabled).Value = true;
						};
						Action val5 = val4;
						<>9__4 = val4;
						obj2 = val5;
					}
					Plugin.SaveFavoriteEntityLocally(val3, obj2);
				};
				ButtonEventHandler val2 = val;
				<>9__3 = val;
				obj = val2;
			}
			component.LocalPressed += obj;
		}

		internal void <EnumerateEntityInterfaceDataFeed>b__3(IButton _, ButtonEventData _)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0041: Expected O, but got Unknown
			((IValue<string>)(object)label).Value = GetStatusText(SaveState.Saving);
			((IValue<bool>)(object)enabled).Value = false;
			FavoriteEntity val = entity;
			Action obj = <>9__4;
			if (obj == null)
			{
				Action val2 = delegate
				{
					((IValue<string>)(object)label).Value = GetStatusText(SaveState.Saved);
					((IValue<bool>)(object)enabled).Value = true;
				};
				Action val3 = val2;
				<>9__4 = val2;
				obj = val3;
			}
			Plugin.SaveFavoriteEntityLocally(val, obj);
		}

		internal void <EnumerateEntityInterfaceDataFeed>b__4()
		{
			((IValue<string>)(object)label).Value = GetStatusText(SaveState.Saved);
			((IValue<bool>)(object)enabled).Value = true;
		}
	}

	[CompilerGenerated]
	private sealed class <EnumerateEntityInterfaceDataFeed>d__3 : global::System.Collections.Generic.IAsyncEnumerable<DataFeedItem>, global::System.Collections.Generic.IAsyncEnumerator<DataFeedItem>, global::System.IAsyncDisposable, IValueTaskSource<bool>, IValueTaskSource, IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncIteratorMethodBuilder <>t__builder;

		public ManualResetValueTaskSourceCore<bool> <>v__promiseOfValueOrEnd;

		private DataFeedItem <>2__current;

		private bool <>w__disposeMode;

		private int <>l__initialThreadId;

		private global::System.Collections.Generic.IReadOnlyList<string> path;

		public global::System.Collections.Generic.IReadOnlyList<string> <>3__path;

		private global::System.Collections.Generic.IReadOnlyList<string> groupingKeys;

		public global::System.Collections.Generic.IReadOnlyList<string> <>3__groupingKeys;

		private <>c__DisplayClass3_0 <>8__1;

		private global::System.Collections.IEnumerator <>7__wrap1;

		private string <spacePath>5__3;

		DataFeedItem global::System.Collections.Generic.IAsyncEnumerator<DataFeedItem>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <EnumerateEntityInterfaceDataFeed>d__3(int <>1__state)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			<>t__builder = AsyncIteratorMethodBuilder.Create();
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		private void MoveNext()
		{
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Expected O, but got Unknown
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Invalid comparison between Unknown and I4
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Invalid comparison between Unknown and I4
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			try
			{
				if ((uint)(num - -5) <= 1u)
				{
					goto IL_0044;
				}
				_ = -3;
				if (!<>w__disposeMode)
				{
					num = (<>1__state = -1);
					<>7__wrap1 = global::System.Enum.GetValues(typeof(FavoriteEntity)).GetEnumerator();
					goto IL_0044;
				}
				goto end_IL_0007;
				IL_0044:
				try
				{
					switch (num)
					{
					case -4:
						num = (<>1__state = -1);
						if (!<>w__disposeMode)
						{
							DataFeedAction val = new DataFeedAction();
							<>8__1.enabled = null;
							((DataFeedItem)val).InitBase(<spacePath>5__3 + "_Button", path, groupingKeys, LocaleString.op_Implicit("Save '" + <spacePath>5__3 + "'"), (Uri)null, (Action<IField<bool>>)null, (Action<IField<bool>>)null, (global::System.Collections.Generic.IReadOnlyList<DataFeedItem>)null, (object)null);
							((DataFeedItem)val).InitEnabled((Action<IField<bool>>)delegate(IField<bool> x)
							{
								((IValue<bool>)(object)x).Value = <>8__1.status != SaveState.NotSavable;
								<>8__1.enabled = x;
							});
							val.InitAction((Action<SyncDelegate<Action>>)delegate(SyncDelegate<Action> x)
							{
								//IL_001f: Unknown result type (might be due to invalid IL or missing references)
								//IL_0024: Unknown result type (might be due to invalid IL or missing references)
								//IL_0026: Expected O, but got Unknown
								//IL_002b: Expected O, but got Unknown
								Button component = ((ContainerWorker<Component>)(object)((SyncElement)x).Slot).GetComponent<Button>((Predicate<Button>)null, false);
								ButtonEventHandler obj = <>8__1.<>9__3;
								if (obj == null)
								{
									ButtonEventHandler val3 = delegate
									{
										//IL_001e: Unknown result type (might be due to invalid IL or missing references)
										//IL_0035: Unknown result type (might be due to invalid IL or missing references)
										//IL_003a: Unknown result type (might be due to invalid IL or missing references)
										//IL_003c: Expected O, but got Unknown
										//IL_0041: Expected O, but got Unknown
										((IValue<string>)(object)<>8__1.label).Value = GetStatusText(SaveState.Saving);
										((IValue<bool>)(object)<>8__1.enabled).Value = false;
										FavoriteEntity entity = <>8__1.entity;
										Action obj2 = <>8__1.<>9__4;
										if (obj2 == null)
										{
											Action val5 = delegate
											{
												((IValue<string>)(object)<>8__1.label).Value = GetStatusText(SaveState.Saved);
												((IValue<bool>)(object)<>8__1.enabled).Value = true;
											};
											Action val6 = val5;
											<>8__1.<>9__4 = val5;
											obj2 = val6;
										}
										Plugin.SaveFavoriteEntityLocally(entity, obj2);
									};
									ButtonEventHandler val4 = val3;
									<>8__1.<>9__3 = val3;
									obj = val4;
								}
								component.LocalPressed += obj;
							});
							<>2__current = (DataFeedItem)(object)val;
							num = (<>1__state = -5);
							goto IL_0356;
						}
						goto end_IL_0044;
					case -5:
						num = (<>1__state = -1);
						if (!<>w__disposeMode)
						{
							<>8__1 = null;
							<spacePath>5__3 = null;
							break;
						}
						goto end_IL_0044;
					}
					while (<>7__wrap1.MoveNext())
					{
						object current = <>7__wrap1.Current;
						<>8__1 = new <>c__DisplayClass3_0();
						<>8__1.entity = (FavoriteEntity)current;
						if ((int)<>8__1.entity == 0 || (int)<>8__1.entity == 3 || (int)<>8__1.entity == 12)
						{
							continue;
						}
						<spacePath>5__3 = ((object)global::System.Runtime.CompilerServices.Unsafe.As<FavoriteEntity, FavoriteEntity>(ref <>8__1.entity)/*cast due to .constrained prefix*/).ToString();
						string entityFilePath = Plugin.GetEntityFilePath(<>8__1.entity);
						<>8__1.status = SaveState.Saved;
						if (!File.Exists(entityFilePath))
						{
							if (((SkyFrostInterface)Engine.Current.Cloud).Profile.GetCurrentFavorite(<>8__1.entity) == (Uri)null)
							{
								<>8__1.status = SaveState.NotSavable;
							}
							else
							{
								<>8__1.status = SaveState.NotSaved;
							}
						}
						<>8__1.txt = GetStatusText(<>8__1.status);
						DataFeedIndicator<string> val2 = new DataFeedIndicator<string>();
						<>8__1.label = null;
						((DataFeedItem)val2).InitBase(<spacePath>5__3 + "_Label", path, groupingKeys, LocaleString.op_Implicit(<spacePath>5__3 ?? ""), (Uri)null, (Action<IField<bool>>)null, (Action<IField<bool>>)null, (global::System.Collections.Generic.IReadOnlyList<DataFeedItem>)null, (object)null);
						val2.InitSetupValue((Action<IField<string>>)delegate(IField<string> field)
						{
							((IValue<string>)(object)field).Value = <>8__1.txt;
							<>8__1.label = field;
						}, (string)null);
						<>2__current = (DataFeedItem)(object)val2;
						num = (<>1__state = -4);
						goto IL_0356;
					}
					end_IL_0044:;
				}
				finally
				{
					if (num == -1 && <>7__wrap1 is global::System.IDisposable disposable)
					{
						disposable.Dispose();
					}
				}
				if (!<>w__disposeMode)
				{
					<>7__wrap1 = null;
				}
				end_IL_0007:;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<>8__1 = null;
				<>7__wrap1 = null;
				<spacePath>5__3 = null;
				<>2__current = null;
				((AsyncIteratorMethodBuilder)(ref <>t__builder)).Complete();
				<>v__promiseOfValueOrEnd.SetException(exception);
				return;
			}
			<>1__state = -2;
			<>8__1 = null;
			<>7__wrap1 = null;
			<spacePath>5__3 = null;
			<>2__current = null;
			((AsyncIteratorMethodBuilder)(ref <>t__builder)).Complete();
			<>v__promiseOfValueOrEnd.SetResult(false);
			return;
			IL_0356:
			<>v__promiseOfValueOrEnd.SetResult(true);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
		}

		[DebuggerHidden]
		global::System.Collections.Generic.IAsyncEnumerator<DataFeedItem> global::System.Collections.Generic.IAsyncEnumerable<DataFeedItem>.GetAsyncEnumerator(CancellationToken cancellationToken = default(CancellationToken))
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			<EnumerateEntityInterfaceDataFeed>d__3 <EnumerateEntityInterfaceDataFeed>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = -3;
				<>t__builder = AsyncIteratorMethodBuilder.Create();
				<>w__disposeMode = false;
				<EnumerateEntityInterfaceDataFeed>d__ = this;
			}
			else
			{
				<EnumerateEntityInterfaceDataFeed>d__ = new <EnumerateEntityInterfaceDataFeed>d__3(-3);
			}
			<EnumerateEntityInterfaceDataFeed>d__.path = <>3__path;
			<EnumerateEntityInterfaceDataFeed>d__.groupingKeys = <>3__groupingKeys;
			return <EnumerateEntityInterfaceDataFeed>d__;
		}

		[DebuggerHidden]
		global::System.Threading.Tasks.ValueTask<bool> global::System.Collections.Generic.IAsyncEnumerator<DataFeedItem>.MoveNextAsync()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Invalid comparison between Unknown and I4
			if (<>1__state == -2)
			{
				return default(global::System.Threading.Tasks.ValueTask<bool>);
			}
			<>v__promiseOfValueOrEnd.Reset();
			<EnumerateEntityInterfaceDataFeed>d__3 <EnumerateEntityInterfaceDataFeed>d__ = this;
			((AsyncIteratorMethodBuilder)(ref <>t__builder)).MoveNext<<EnumerateEntityInterfaceDataFeed>d__3>(ref <EnumerateEntityInterfaceDataFeed>d__);
			short version = <>v__promiseOfValueOrEnd.Version;
			if ((int)<>v__promiseOfValueOrEnd.GetStatus(version) == 1)
			{
				return new global::System.Threading.Tasks.ValueTask<bool>(<>v__promiseOfValueOrEnd.GetResult(version));
			}
			return new global::System.Threading.Tasks.ValueTask<bool>((IValueTaskSource<bool>)this, version);
		}

		[DebuggerHidden]
		bool IValueTaskSource<bool>.GetResult(short token)
		{
			return <>v__promiseOfValueOrEnd.GetResult(token);
		}

		[DebuggerHidden]
		ValueTaskSourceStatus IValueTaskSource<bool>.GetStatus(short token)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return <>v__promiseOfValueOrEnd.GetStatus(token);
		}

		[DebuggerHidden]
		void IValueTaskSource<bool>.OnCompleted(Action<object?> continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			<>v__promiseOfValueOrEnd.OnCompleted(continuation, state, token, flags);
		}

		[DebuggerHidden]
		void IValueTaskSource.GetResult(short token)
		{
			<>v__promiseOfValueOrEnd.GetResult(token);
		}

		[DebuggerHidden]
		ValueTaskSourceStatus IValueTaskSource.GetStatus(short token)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return <>v__promiseOfValueOrEnd.GetStatus(token);
		}

		[DebuggerHidden]
		void IValueTaskSource.OnCompleted(Action<object?> continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			<>v__promiseOfValueOrEnd.OnCompleted(continuation, state, token, flags);
		}

		[DebuggerHidden]
		global::System.Threading.Tasks.ValueTask global::System.IAsyncDisposable.DisposeAsync()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (<>1__state >= -1)
			{
				throw new NotSupportedException();
			}
			if (<>1__state == -2)
			{
				return default(global::System.Threading.Tasks.ValueTask);
			}
			<>w__disposeMode = true;
			<>v__promiseOfValueOrEnd.Reset();
			<EnumerateEntityInterfaceDataFeed>d__3 <EnumerateEntityInterfaceDataFeed>d__ = this;
			((AsyncIteratorMethodBuilder)(ref <>t__builder)).MoveNext<<EnumerateEntityInterfaceDataFeed>d__3>(ref <EnumerateEntityInterfaceDataFeed>d__);
			return new global::System.Threading.Tasks.ValueTask((IValueTaskSource)(object)this, <>v__promiseOfValueOrEnd.Version);
		}
	}

	[CompilerGenerated]
	private sealed class <EnumerateWorskpaceDataFeed>d__2 : global::System.Collections.Generic.IAsyncEnumerable<DataFeedItem>, global::System.Collections.Generic.IAsyncEnumerator<DataFeedItem>, global::System.IAsyncDisposable, IValueTaskSource<bool>, IValueTaskSource, IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncIteratorMethodBuilder <>t__builder;

		public ManualResetValueTaskSourceCore<bool> <>v__promiseOfValueOrEnd;

		private DataFeedItem <>2__current;

		private bool <>w__disposeMode;

		private int <>l__initialThreadId;

		private global::System.Collections.Generic.IReadOnlyList<string> path;

		public global::System.Collections.Generic.IReadOnlyList<string> <>3__path;

		private global::System.Collections.Generic.IReadOnlyList<string> groupingKeys;

		public global::System.Collections.Generic.IReadOnlyList<string> <>3__groupingKeys;

		private <>c__DisplayClass2_0 <>8__1;

		private Enumerator<Workspace> <>7__wrap1;

		private string <spacePath>5__3;

		DataFeedItem global::System.Collections.Generic.IAsyncEnumerator<DataFeedItem>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <EnumerateWorskpaceDataFeed>d__2(int <>1__state)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			<>t__builder = AsyncIteratorMethodBuilder.Create();
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		private void MoveNext()
		{
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			try
			{
				if ((uint)(num - -5) <= 1u)
				{
					goto IL_004a;
				}
				_ = -3;
				if (!<>w__disposeMode)
				{
					num = (<>1__state = -1);
					List<Workspace> componentsInChildren = Userspace.UserspaceWorld.RootSlot.GetComponentsInChildren<Workspace>((Predicate<Workspace>)null, false, false, (Predicate<Slot>)null);
					<>7__wrap1 = componentsInChildren.GetEnumerator();
					goto IL_004a;
				}
				goto end_IL_0007;
				IL_004a:
				try
				{
					switch (num)
					{
					case -4:
						num = (<>1__state = -1);
						if (!<>w__disposeMode)
						{
							DataFeedAction val = new DataFeedAction();
							<>8__1.enabled = null;
							((DataFeedItem)val).InitBase(<spacePath>5__3 + "_Button", path, groupingKeys, LocaleString.op_Implicit("Save '" + <spacePath>5__3 + "'"), (Uri)null, (Action<IField<bool>>)null, (Action<IField<bool>>)null, (global::System.Collections.Generic.IReadOnlyList<DataFeedItem>)null, (object)null);
							((DataFeedItem)val).InitEnabled((Action<IField<bool>>)delegate(IField<bool> x)
							{
								<>8__1.enabled = x;
							});
							val.InitAction((Action<SyncDelegate<Action>>)delegate(SyncDelegate<Action> x)
							{
								//IL_001f: Unknown result type (might be due to invalid IL or missing references)
								//IL_0024: Unknown result type (might be due to invalid IL or missing references)
								//IL_0026: Expected O, but got Unknown
								//IL_002b: Expected O, but got Unknown
								Button component = ((ContainerWorker<Component>)(object)((SyncElement)x).Slot).GetComponent<Button>((Predicate<Button>)null, false);
								ButtonEventHandler obj = <>8__1.<>9__3;
								if (obj == null)
								{
									ButtonEventHandler val3 = delegate
									{
										//IL_0035: Unknown result type (might be due to invalid IL or missing references)
										//IL_003a: Unknown result type (might be due to invalid IL or missing references)
										//IL_003c: Expected O, but got Unknown
										//IL_0041: Expected O, but got Unknown
										((IValue<string>)(object)<>8__1.label).Value = GetStatusText(SaveState.Saving);
										((IValue<bool>)(object)<>8__1.enabled).Value = false;
										Workspace space = <>8__1.space;
										Action obj2 = <>8__1.<>9__4;
										if (obj2 == null)
										{
											Action val5 = delegate
											{
												((IValue<string>)(object)<>8__1.label).Value = GetStatusText(SaveState.Saved);
												((IValue<bool>)(object)<>8__1.enabled).Value = true;
											};
											Action val6 = val5;
											<>8__1.<>9__4 = val5;
											obj2 = val6;
										}
										Plugin.SaveWorkspaceLocally(space, obj2);
									};
									ButtonEventHandler val4 = val3;
									<>8__1.<>9__3 = val3;
									obj = val4;
								}
								component.LocalPressed += obj;
							});
							<>2__current = (DataFeedItem)(object)val;
							num = (<>1__state = -5);
							goto IL_02e6;
						}
						goto end_IL_004a;
					case -5:
						num = (<>1__state = -1);
						if (!<>w__disposeMode)
						{
							<spacePath>5__3 = null;
							<>8__1 = null;
							break;
						}
						goto end_IL_004a;
					}
					if (<>7__wrap1.MoveNext())
					{
						<>8__1 = new <>c__DisplayClass2_0();
						<>8__1.space = <>7__wrap1.Current;
						<spacePath>5__3 = ((SyncField<string>)(object)<>8__1.space.WorkspacePath).Value;
						string workspaceFilePath = Plugin.GetWorkspaceFilePath(((SyncField<string>)(object)<>8__1.space.WorkspacePath).Value);
						<>8__1.txt = GetStatusText(File.Exists(workspaceFilePath) ? SaveState.Saved : SaveState.NotSaved);
						DataFeedIndicator<string> val2 = new DataFeedIndicator<string>();
						<>8__1.label = null;
						((DataFeedItem)val2).InitBase(<spacePath>5__3 + "_Label", path, groupingKeys, LocaleString.op_Implicit(<spacePath>5__3 ?? ""), (Uri)null, (Action<IField<bool>>)null, (Action<IField<bool>>)null, (global::System.Collections.Generic.IReadOnlyList<DataFeedItem>)null, (object)null);
						val2.InitSetupValue((Action<IField<string>>)delegate(IField<string> field)
						{
							((IValue<string>)(object)field).Value = <>8__1.txt;
							<>8__1.label = field;
						}, (string)null);
						<>2__current = (DataFeedItem)(object)val2;
						num = (<>1__state = -4);
						goto IL_02e6;
					}
					end_IL_004a:;
				}
				finally
				{
					if (num == -1)
					{
						((global::System.IDisposable)<>7__wrap1/*cast due to .constrained prefix*/).Dispose();
					}
				}
				if (!<>w__disposeMode)
				{
					<>7__wrap1 = default(Enumerator<Workspace>);
				}
				end_IL_0007:;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<>8__1 = null;
				<>7__wrap1 = default(Enumerator<Workspace>);
				<spacePath>5__3 = null;
				<>2__current = null;
				((AsyncIteratorMethodBuilder)(ref <>t__builder)).Complete();
				<>v__promiseOfValueOrEnd.SetException(exception);
				return;
			}
			<>1__state = -2;
			<>8__1 = null;
			<>7__wrap1 = default(Enumerator<Workspace>);
			<spacePath>5__3 = null;
			<>2__current = null;
			((AsyncIteratorMethodBuilder)(ref <>t__builder)).Complete();
			<>v__promiseOfValueOrEnd.SetResult(false);
			return;
			IL_02e6:
			<>v__promiseOfValueOrEnd.SetResult(true);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
		}

		[DebuggerHidden]
		global::System.Collections.Generic.IAsyncEnumerator<DataFeedItem> global::System.Collections.Generic.IAsyncEnumerable<DataFeedItem>.GetAsyncEnumerator(CancellationToken cancellationToken = default(CancellationToken))
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			<EnumerateWorskpaceDataFeed>d__2 <EnumerateWorskpaceDataFeed>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = -3;
				<>t__builder = AsyncIteratorMethodBuilder.Create();
				<>w__disposeMode = false;
				<EnumerateWorskpaceDataFeed>d__ = this;
			}
			else
			{
				<EnumerateWorskpaceDataFeed>d__ = new <EnumerateWorskpaceDataFeed>d__2(-3);
			}
			<EnumerateWorskpaceDataFeed>d__.path = <>3__path;
			<EnumerateWorskpaceDataFeed>d__.groupingKeys = <>3__groupingKeys;
			return <EnumerateWorskpaceDataFeed>d__;
		}

		[DebuggerHidden]
		global::System.Threading.Tasks.ValueTask<bool> global::System.Collections.Generic.IAsyncEnumerator<DataFeedItem>.MoveNextAsync()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Invalid comparison between Unknown and I4
			if (<>1__state == -2)
			{
				return default(global::System.Threading.Tasks.ValueTask<bool>);
			}
			<>v__promiseOfValueOrEnd.Reset();
			<EnumerateWorskpaceDataFeed>d__2 <EnumerateWorskpaceDataFeed>d__ = this;
			((AsyncIteratorMethodBuilder)(ref <>t__builder)).MoveNext<<EnumerateWorskpaceDataFeed>d__2>(ref <EnumerateWorskpaceDataFeed>d__);
			short version = <>v__promiseOfValueOrEnd.Version;
			if ((int)<>v__promiseOfValueOrEnd.GetStatus(version) == 1)
			{
				return new global::System.Threading.Tasks.ValueTask<bool>(<>v__promiseOfValueOrEnd.GetResult(version));
			}
			return new global::System.Threading.Tasks.ValueTask<bool>((IValueTaskSource<bool>)this, version);
		}

		[DebuggerHidden]
		bool IValueTaskSource<bool>.GetResult(short token)
		{
			return <>v__promiseOfValueOrEnd.GetResult(token);
		}

		[DebuggerHidden]
		ValueTaskSourceStatus IValueTaskSource<bool>.GetStatus(short token)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return <>v__promiseOfValueOrEnd.GetStatus(token);
		}

		[DebuggerHidden]
		void IValueTaskSource<bool>.OnCompleted(Action<object?> continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			<>v__promiseOfValueOrEnd.OnCompleted(continuation, state, token, flags);
		}

		[DebuggerHidden]
		void IValueTaskSource.GetResult(short token)
		{
			<>v__promiseOfValueOrEnd.GetResult(token);
		}

		[DebuggerHidden]
		ValueTaskSourceStatus IValueTaskSource.GetStatus(short token)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return <>v__promiseOfValueOrEnd.GetStatus(token);
		}

		[DebuggerHidden]
		void IValueTaskSource.OnCompleted(Action<object?> continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			<>v__promiseOfValueOrEnd.OnCompleted(continuation, state, token, flags);
		}

		[DebuggerHidden]
		global::System.Threading.Tasks.ValueTask global::System.IAsyncDisposable.DisposeAsync()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (<>1__state >= -1)
			{
				throw new NotSupportedException();
			}
			if (<>1__state == -2)
			{
				return default(global::System.Threading.Tasks.ValueTask);
			}
			<>w__disposeMode = true;
			<>v__promiseOfValueOrEnd.Reset();
			<EnumerateWorskpaceDataFeed>d__2 <EnumerateWorskpaceDataFeed>d__ = this;
			((AsyncIteratorMethodBuilder)(ref <>t__builder)).MoveNext<<EnumerateWorskpaceDataFeed>d__2>(ref <EnumerateWorskpaceDataFeed>d__);
			return new global::System.Threading.Tasks.ValueTask((IValueTaskSource)(object)this, <>v__promiseOfValueOrEnd.Version);
		}
	}

	private static string GetStatusText(SaveState state)
	{
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		string text = "<align=right>";
		return string.Concat(text + state switch
		{
			SaveState.NotSaved => "<alpha=hero.red>Not saved.", 
			SaveState.Saved => "<alpha=hero.green>Saved!", 
			SaveState.Saving => "<alpha=hero.orange>Saving...", 
			SaveState.NotSavable => "<alpha=hero.yellow>Not favorited.", 
			_ => throw new ArgumentOutOfRangeException("state", (object)state, (string)null), 
		}, "</align></alpha>");
	}

	[AsyncIteratorStateMachine(typeof(<EnumerateWorskpaceDataFeed>d__2))]
	public static global::System.Collections.Generic.IAsyncEnumerable<DataFeedItem> EnumerateWorskpaceDataFeed(global::System.Collections.Generic.IReadOnlyList<string> path, global::System.Collections.Generic.IReadOnlyList<string> groupingKeys)
	{
		return new <EnumerateWorskpaceDataFeed>d__2(-2)
		{
			<>3__path = path,
			<>3__groupingKeys = groupingKeys
		};
	}

	[AsyncIteratorStateMachine(typeof(<EnumerateEntityInterfaceDataFeed>d__3))]
	public static global::System.Collections.Generic.IAsyncEnumerable<DataFeedItem> EnumerateEntityInterfaceDataFeed(global::System.Collections.Generic.IReadOnlyList<string> path, global::System.Collections.Generic.IReadOnlyList<string> groupingKeys)
	{
		return new <EnumerateEntityInterfaceDataFeed>d__3(-2)
		{
			<>3__path = path,
			<>3__groupingKeys = groupingKeys
		};
	}
}
[ResonitePlugin("art0007i.LocalStuff", "LocalStuff", "1.1.0", "art0007i", "https://github.com/art0007i/LocalStuff")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
	[HarmonyPatch(typeof(Workspace), "SaveChanges")]
	private class DisableAutosavePatch
	{
		public static bool Prefix(ref global::System.Threading.Tasks.Task __result)
		{
			__result = global::System.Threading.Tasks.Task.CompletedTask;
			return !BlockWorkspaceSave.Value;
		}
	}

	[HarmonyPatch(typeof(Workspace), "OnChanges")]
	private class LocalWorkspacePatch
	{
		public static bool Prefix(Workspace __instance)
		{
			string filePath = GetWorkspaceFilePath(((SyncField<string>)(object)__instance.WorkspacePath).Value);
			if (!File.Exists(filePath))
			{
				return true;
			}
			Traverse traverse = Traverse.Create((object)__instance);
			if (((Worker)__instance).World != Userspace.UserspaceWorld || __instance.User.Target != ((Worker)__instance).LocalUser || __instance.IsLoadingWorkspace || ((SyncField<bool>)(object)__instance.SuspendUpdates).Value)
			{
				return false;
			}
			if (!string.IsNullOrEmpty(__instance.CurrentWorkspacePath) && __instance.CurrentWorkspaceOwnerId != ((SkyFrostInterface)((Worker)__instance).Cloud).CurrentUserID)
			{
				traverse.Field("_currentOwnerId").SetValue((object)((SkyFrostInterface)((Worker)__instance).Cloud).CurrentUserID);
			}
			string path = ((SyncField<string>)(object)__instance.WorkspacePath).Value;
			if (path == __instance.CurrentWorkspacePath)
			{
				return false;
			}
			((Worker)__instance).StartTask((Func<global::System.Threading.Tasks.Task>)([MethodImpl((MethodImplOptions)8192)] () =>
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				traverse.Field("_loadingWorkspace").SetValue((object)true);
				traverse.Method("Clear", global::System.Array.Empty<object>()).GetValue();
				ToBackground val = default(ToBackground);
				ToBackground awaiter = ((ToBackground)(ref val)).GetAwaiter();
				if (!((ToBackground)(ref awaiter)).IsCompleted)
				{
					AsyncHelpers.AwaitAwaiter<ToBackground>(awaiter);
				}
				((ToBackground)(ref awaiter)).GetResult();
				FileStream val2 = File.OpenRead(filePath);
				try
				{
					DataTreeDictionary val3 = DataTreeConverter.LoadAuto((Stream)(object)val2);
					ToWorld val4 = default(ToWorld);
					ToWorld awaiter2 = ((ToWorld)(ref val4)).GetAwaiter();
					if (!((ToWorld)(ref awaiter2)).IsCompleted)
					{
						AsyncHelpers.AwaitAwaiter<ToWorld>(awaiter2);
					}
					((ToWorld)(ref awaiter2)).GetResult();
					((Component)__instance).Slot.LoadObject(val3, (IRecord)null, (Slot)null, (Predicate<global::System.Type>)null, (ReferenceTranslator)null, (Func<DataTreeNode, DataTreeNode>)null);
					traverse.Field("_currentPath").SetValue((object)path);
					traverse.Field("_currentRecord").SetValue((object)null);
					traverse.Field("_currentOwnerId").SetValue((object)((SkyFrostInterface)((Worker)__instance).Cloud).CurrentUserID);
					traverse.Field("_loadingWorkspace").SetValue((object)false);
					((ComponentBase<Component>)(object)__instance).MarkChangeDirty();
				}
				finally
				{
					((global::System.IDisposable)val2)?.Dispose();
				}
				return (global::System.Threading.Tasks.Task)/*Error near IL_0139: Stack underflow*/;
			}));
			return false;
		}
	}

	[HarmonyPatch(typeof(EntityHelper), "LocalStuff_SpawnEntityPatch")]
	private class LocalEntityPatch
	{
		public static bool Prefix(ref global::System.Threading.Tasks.Task<object> __result, Slot slot, FavoriteEntity favorite, global::System.Delegate fallback, global::System.Type type)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			string entityFilePath = GetEntityFilePath(favorite);
			if (!File.Exists(entityFilePath))
			{
				return true;
			}
			__result = (global::System.Threading.Tasks.Task<object>)((MethodBase)typeof(LocalEntityPatch).GetMethod("SpawnEntityPatched").MakeGenericMethod(new global::System.Type[1] { type })).Invoke((object)null, new object[3] { slot, entityFilePath, fallback });
			return false;
		}

		[MethodImpl((MethodImplOptions)8192)]
		public static global::System.Threading.Tasks.Task<object> SpawnEntityPatched<T>(Slot slot, string filePath, global::System.Delegate _fallback) where T : class
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			ToBackground val = default(ToBackground);
			ToBackground awaiter = ((ToBackground)(ref val)).GetAwaiter();
			if (!((ToBackground)(ref awaiter)).IsCompleted)
			{
				AsyncHelpers.AwaitAwaiter<ToBackground>(awaiter);
			}
			((ToBackground)(ref awaiter)).GetResult();
			FileStream val2 = File.OpenRead(filePath);
			try
			{
				DataTreeDictionary val3 = DataTreeConverter.LoadAuto((Stream)(object)val2);
				ToWorld val4 = default(ToWorld);
				ToWorld awaiter2 = ((ToWorld)(ref val4)).GetAwaiter();
				if (!((ToWorld)(ref awaiter2)).IsCompleted)
				{
					AsyncHelpers.AwaitAwaiter<ToWorld>(awaiter2);
				}
				((ToWorld)(ref awaiter2)).GetResult();
				float3 localPosition = slot.LocalPosition;
				floatQ localRotation = slot.LocalRotation;
				float3 localScale = slot.LocalScale;
				slot.LoadObject(val3, (IRecord)null, (Slot)null, (Predicate<global::System.Type>)null, (ReferenceTranslator)null, (Func<DataTreeNode, DataTreeNode>)null);
				slot.LocalPosition = localPosition;
				slot.LocalRotation = localRotation;
				slot.LocalScale = localScale;
				slot = InventoryItemExtensions.UnpackInventoryItem(slot, true);
				T componentInChildren = slot.GetComponentInChildren<T>((Predicate<T>)null, false, false);
				EntityInterface val5 = (EntityInterface)(object)((componentInChildren is EntityInterface) ? componentInChildren : null);
				if (val5 != null)
				{
					val5.MarkInstance();
				}
				return (global::System.Threading.Tasks.Task<object>)(object)componentInChildren;
			}
			finally
			{
				((global::System.IDisposable)val2)?.Dispose();
			}
		}
	}

	[CompilerGenerated]
	private static class <>O
	{
		public static DataFeedMethod <0>__EnumerateWorskpaceDataFeed;

		public static DataFeedMethod <1>__EnumerateEntityInterfaceDataFeed;
	}

	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static Action <>9__8_0;

		internal void <Load>b__8_0()
		{
			if (!Directory.Exists(ModDir))
			{
				Directory.CreateDirectory(ModDir);
			}
			if (!Directory.Exists(WorkspaceDir))
			{
				Directory.CreateDirectory(WorkspaceDir);
			}
			if (!Directory.Exists(EntityDir))
			{
				Directory.CreateDirectory(EntityDir);
			}
		}
	}

	internal static ManualLogSource Log;

	internal static ConfigEntry<bool> BlockWorkspaceSave;

	public static string ModDir => Path.Combine(Engine.Current.LocalDB.PermanentPath, "LocalStuff");

	public static string WorkspaceDir => Path.Combine(ModDir, "Workspaces");

	public static string EntityDir => Path.Combine(ModDir, "Entities");

	public override void Load()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Expected O, but got Unknown
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Expected O, but got Unknown
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Expected O, but got Unknown
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Expected O, but got Unknown
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Expected O, but got Unknown
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Expected O, but got Unknown
		Log = ((BasePlugin)this).Log;
		BlockWorkspaceSave = ((BasePlugin)this).Config.Bind<bool>("General", "BlockWorkspaceSave", true, "Prevents saving of the dashboard and facet anchors.");
		ConfigFile config = ((BasePlugin)this).Config;
		object[] array = new object[1];
		object obj = <>O.<0>__EnumerateWorskpaceDataFeed;
		if (obj == null)
		{
			DataFeedMethod val = ModSettings.EnumerateWorskpaceDataFeed;
			<>O.<0>__EnumerateWorskpaceDataFeed = val;
			obj = (object)val;
		}
		array[0] = (object)new CustomDataFeed((DataFeedMethod)obj);
		config.Bind<dummy>("Workspaces", "Workspaces", default(dummy), new ConfigDescription("", (AcceptableValueBase)null, array));
		ConfigFile config2 = ((BasePlugin)this).Config;
		object[] array2 = new object[1];
		object obj2 = <>O.<1>__EnumerateEntityInterfaceDataFeed;
		if (obj2 == null)
		{
			DataFeedMethod val2 = ModSettings.EnumerateEntityInterfaceDataFeed;
			<>O.<1>__EnumerateEntityInterfaceDataFeed = val2;
			obj2 = (object)val2;
		}
		array2[0] = (object)new CustomDataFeed((DataFeedMethod)obj2);
		config2.Bind<dummy>("Entity Interfaces", "Entity Interfaces", default(dummy), new ConfigDescription("", (AcceptableValueBase)null, array2));
		((BasePlugin)this).HarmonyInstance.PatchAll();
		object obj3 = <>c.<>9__8_0;
		if (obj3 == null)
		{
			Action val3 = delegate
			{
				if (!Directory.Exists(ModDir))
				{
					Directory.CreateDirectory(ModDir);
				}
				if (!Directory.Exists(WorkspaceDir))
				{
					Directory.CreateDirectory(WorkspaceDir);
				}
				if (!Directory.Exists(EntityDir))
				{
					Directory.CreateDirectory(EntityDir);
				}
			};
			<>c.<>9__8_0 = val3;
			obj3 = (object)val3;
		}
		ResoniteHooks.OnEngineReady += (Action)obj3;
	}

	public static string GetWorkspaceFilePath(string workspacePath)
	{
		return Path.Combine(WorkspaceDir, workspacePath.Replace('/', '_') + ".bin");
	}

	public unsafe static string GetEntityFilePath(FavoriteEntity entity)
	{
		return Path.Combine(EntityDir, ((object)(*(FavoriteEntity*)(&entity))/*cast due to .constrained prefix*/).ToString() + ".bin");
	}

	public static void SaveWorkspaceLocally(Workspace space, Action onDone)
	{
		((Worker)space).StartGlobalTask((Func<global::System.Threading.Tasks.Task>)([MethodImpl((MethodImplOptions)8192)] () =>
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			string workspaceFilePath = GetWorkspaceFilePath(((SyncField<string>)(object)space.WorkspacePath).Value);
			bool persistent = ((ComponentBase<Component>)(object)space).Persistent;
			((ComponentBase<Component>)(object)space).Persistent = false;
			SavedGraph val = ((Component)space).Slot.SaveObject((DependencyHandling)1, false, (ReferenceTranslator)null);
			((ComponentBase<Component>)(object)space).Persistent = persistent;
			ToBackground val2 = default(ToBackground);
			ToBackground awaiter = ((ToBackground)(ref val2)).GetAwaiter();
			if (!((ToBackground)(ref awaiter)).IsCompleted)
			{
				AsyncHelpers.AwaitAwaiter<ToBackground>(awaiter);
			}
			((ToBackground)(ref awaiter)).GetResult();
			FileStream val3 = File.OpenWrite(workspaceFilePath);
			object obj = null;
			int num = 0;
			try
			{
				DataTreeConverter.ToBRSON(val.Root, (Stream)(object)val3, 9);
				ToWorld val4 = default(ToWorld);
				ToWorld awaiter2 = ((ToWorld)(ref val4)).GetAwaiter();
				if (!((ToWorld)(ref awaiter2)).IsCompleted)
				{
					AsyncHelpers.AwaitAwaiter<ToWorld>(awaiter2);
				}
				((ToWorld)(ref awaiter2)).GetResult();
				onDone.Invoke();
				num = 1;
			}
			catch (object obj2)
			{
				obj = obj2;
			}
			if (val3 != null)
			{
				AsyncHelpers.Await(((Stream)val3).DisposeAsync());
			}
			if (obj != null)
			{
				ExceptionDispatchInfo.Capture((obj as global::System.Exception) ?? throw obj).Throw();
			}
			if (num == 1)
			{
				return (global::System.Threading.Tasks.Task)/*Error near IL_00f6: Stack underflow*/;
			}
			throw null;
		}));
	}

	public static void SaveFavoriteEntityLocally(FavoriteEntity entity, Action onDone)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		((Worker)Userspace.UserspaceWorld.RootSlot).StartGlobalTask((Func<global::System.Threading.Tasks.Task>)([MethodImpl((MethodImplOptions)8192)] () =>
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			string entityFilePath = GetEntityFilePath(entity);
			Uri val = ((SkyFrostInterface)Engine.Current.Cloud).Profile.GetCurrentFavorite(entity);
			if (val == (Uri)null)
			{
				return (global::System.Threading.Tasks.Task)/*Error near IL_0031: Stack underflow*/;
			}
			ToBackground val2 = default(ToBackground);
			ToBackground awaiter = ((ToBackground)(ref val2)).GetAwaiter();
			if (!((ToBackground)(ref awaiter)).IsCompleted)
			{
				AsyncHelpers.AwaitAwaiter<ToBackground>(awaiter);
			}
			((ToBackground)(ref awaiter)).GetResult();
			Record val3 = null;
			if (val != (Uri)null && val.Scheme == ((SkyFrostInterface)Engine.Current.Cloud).Platform.RecordScheme)
			{
				CloudResult<Record> val4 = AsyncHelpers.Await<CloudResult<Record>>(((SkyFrostInterface)Engine.Current.Cloud).Records.GetRecordCached<Record>(val, (string)null).ConfigureAwait(false));
				if (((CloudResult)val4).IsError)
				{
					return (global::System.Threading.Tasks.Task)/*Error near IL_00b1: Stack underflow*/;
				}
				val3 = val4.Entity;
			}
			if (val3 != null)
			{
				val = new Uri(val3.AssetURI);
			}
			string text = AsyncHelpers.Await<string>(Engine.Current.AssetManager.GatherAssetFile(val, 0f, (DB_Endpoint?)null));
			if (text == null || !File.Exists(text))
			{
				return (global::System.Threading.Tasks.Task)/*Error near IL_00f9: Stack underflow*/;
			}
			File.WriteAllBytes(entityFilePath, File.ReadAllBytes(text));
			ToWorld val5 = default(ToWorld);
			ToWorld awaiter2 = ((ToWorld)(ref val5)).GetAwaiter();
			if (!((ToWorld)(ref awaiter2)).IsCompleted)
			{
				AsyncHelpers.AwaitAwaiter<ToWorld>(awaiter2);
			}
			((ToWorld)(ref awaiter2)).GetResult();
			onDone.Invoke();
			return (global::System.Threading.Tasks.Task)/*Error near IL_0138: Stack underflow*/;
		}));
	}
}
public static class PluginMetadata
{
	public const string GUID = "art0007i.LocalStuff";

	public const string NAME = "LocalStuff";

	public const string VERSION = "1.1.0";

	public const string AUTHORS = "art0007i";

	public const string REPOSITORY_URL = "https://github.com/art0007i/LocalStuff";
}

patchers/LocalStuff/LocalStuffPatcher.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx.Preloader.Core.Patching;
using HarmonyLib;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Cecil.Rocks;
using Mono.Collections.Generic;
using MonoMod.Utils;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v11.0", FrameworkDisplayName = ".NET 11.0")]
[assembly: AssemblyCompany("LocalStuffPatcher")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f703ef8ece1d658bf4d7d406cf1bafe5b2081022")]
[assembly: AssemblyProduct("LocalStuffPatcher")]
[assembly: AssemblyTitle("LocalStuffPatcher")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[DebuggerDisplay("Count = {System.Collections.ICollection.Count}")]
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : global::System.Collections.IEnumerable, global::System.Collections.ICollection, global::System.Collections.IList, global::System.Collections.Generic.IEnumerable<T>, global::System.Collections.Generic.IReadOnlyCollection<T>, global::System.Collections.Generic.IReadOnlyList<T>, global::System.Collections.Generic.ICollection<T>, global::System.Collections.Generic.IList<T>
{
	int global::System.Collections.ICollection.Count => _items.Length;

	bool global::System.Collections.ICollection.IsSynchronized => false;

	object global::System.Collections.ICollection.SyncRoot => this;

	object? global::System.Collections.IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}
	}

	bool global::System.Collections.IList.IsFixedSize => true;

	bool global::System.Collections.IList.IsReadOnly => true;

	int global::System.Collections.Generic.IReadOnlyCollection<T>.Count => _items.Length;

	T global::System.Collections.Generic.IReadOnlyList<T>.this[int index] => _items[index];

	int global::System.Collections.Generic.ICollection<T>.Count => _items.Length;

	bool global::System.Collections.Generic.ICollection<T>.IsReadOnly => true;

	T global::System.Collections.Generic.IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
	{
		return ((global::System.Collections.IEnumerable)(object)_items).GetEnumerator();
	}

	void global::System.Collections.ICollection.CopyTo(global::System.Array array, int index)
	{
		((global::System.Collections.ICollection)(object)_items).CopyTo(array, index);
	}

	int global::System.Collections.IList.Add(object? value)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	void global::System.Collections.IList.Clear()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	bool global::System.Collections.IList.Contains(object? value)
	{
		return ((global::System.Collections.IList)(object)_items).Contains(value);
	}

	int global::System.Collections.IList.IndexOf(object? value)
	{
		return ((global::System.Collections.IList)(object)_items).IndexOf(value);
	}

	void global::System.Collections.IList.Insert(int index, object? value)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	void global::System.Collections.IList.Remove(object? value)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	void global::System.Collections.IList.RemoveAt(int index)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	global::System.Collections.Generic.IEnumerator<T> global::System.Collections.Generic.IEnumerable<T>.GetEnumerator()
	{
		return ((global::System.Collections.Generic.IEnumerable<T>)_items).GetEnumerator();
	}

	void global::System.Collections.Generic.ICollection<T>.Add(T item)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	void global::System.Collections.Generic.ICollection<T>.Clear()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	bool global::System.Collections.Generic.ICollection<T>.Contains(T item)
	{
		return ((global::System.Collections.Generic.ICollection<T>)_items).Contains(item);
	}

	void global::System.Collections.Generic.ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((global::System.Collections.Generic.ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool global::System.Collections.Generic.ICollection<T>.Remove(T item)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	int global::System.Collections.Generic.IList<T>.IndexOf(T item)
	{
		return ((global::System.Collections.Generic.IList<T>)_items).IndexOf(item);
	}

	void global::System.Collections.Generic.IList<T>.Insert(int index, T item)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}

	void global::System.Collections.Generic.IList<T>.RemoveAt(int index)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		throw new NotSupportedException();
	}
}
namespace LocalStuff;

[PatcherPluginInfo("art0007i.LocalStuff", "Local Stuff", "1.1.0")]
public class Patcher : BasePatcher
{
	public const string GUID = "art0007i.LocalStuff";

	public const string Name = "Local Stuff";

	public const string Version = "1.1.0";

	[TargetAssembly("FrooxEngine.dll")]
	[Experimental("SYSLIB5007")]
	public bool PatchEntityHelper(ref AssemblyDefinition assembly, string filename)
	{
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Expected O, but got Unknown
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Expected O, but got Unknown
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Expected O, but got Unknown
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Expected O, but got Unknown
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Expected O, but got Unknown
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Expected O, but got Unknown
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_0259: Expected O, but got Unknown
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Expected O, but got Unknown
		//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ba: Expected O, but got Unknown
		//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_0311: Unknown result type (might be due to invalid IL or missing references)
		//IL_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0325: Unknown result type (might be due to invalid IL or missing references)
		//IL_0328: Unknown result type (might be due to invalid IL or missing references)
		//IL_0334: Expected O, but got Unknown
		//IL_033b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0340: Unknown result type (might be due to invalid IL or missing references)
		//IL_035d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Expected O, but got Unknown
		//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d4: Expected O, but got Unknown
		//IL_03db: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e2: Expected O, but got Unknown
		//IL_0425: Unknown result type (might be due to invalid IL or missing references)
		//IL_042c: Expected O, but got Unknown
		//IL_043c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0443: Expected O, but got Unknown
		//IL_0460: Unknown result type (might be due to invalid IL or missing references)
		//IL_0482: Unknown result type (might be due to invalid IL or missing references)
		//IL_048f: Unknown result type (might be due to invalid IL or missing references)
		//IL_049c: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0505: Unknown result type (might be due to invalid IL or missing references)
		//IL_0512: Unknown result type (might be due to invalid IL or missing references)
		//IL_0522: Unknown result type (might be due to invalid IL or missing references)
		//IL_0532: Unknown result type (might be due to invalid IL or missing references)
		((BasePatcher)this).Log.LogInfo((object)"The patcher the running");
		TypeDefinition type = assembly.MainModule.GetType("FrooxEngine.EntityHelper");
		TypeDefinition type2 = assembly.MainModule.GetType("FrooxEngine.Slot");
		AssemblyNameReference val = Enumerable.Single<AssemblyNameReference>((global::System.Collections.Generic.IEnumerable<AssemblyNameReference>)assembly.MainModule.AssemblyReferences, (Func<AssemblyNameReference, bool>)((AssemblyNameReference x) => x.Name == "SkyFrost.Base.Models"));
		AssemblyDefinition val2 = assembly.MainModule.AssemblyResolver.Resolve(val);
		TypeReference val3 = assembly.MainModule.ImportReference((TypeReference)(object)val2.MainModule.GetType("SkyFrost.Base.FavoriteEntity"));
		MethodDefinition val4 = Enumerable.Single<MethodDefinition>((global::System.Collections.Generic.IEnumerable<MethodDefinition>)type.Methods, (Func<MethodDefinition, bool>)((MethodDefinition x) => ((MemberReference)x).Name == "SpawnEntity" && ((MethodReference)x).GenericParameters.Count == 1));
		GenericParameter val5 = Enumerable.First<GenericParameter>((global::System.Collections.Generic.IEnumerable<GenericParameter>)((MethodReference)val4).GenericParameters);
		TypeReferenceRocks.MakeGenericInstanceType(assembly.MainModule.ImportReference(typeof(Func<, >)), (TypeReference[])(object)new TypeReference[2]
		{
			(TypeReference)type2,
			(TypeReference)val5
		});
		MethodDefinition val6 = new MethodDefinition("LocalStuff_SpawnEntityPatch", (MethodAttributes)145, (TypeReference)(object)TypeReferenceRocks.MakeGenericInstanceType(assembly.MainModule.ImportReference(typeof(global::System.Threading.Tasks.Task<>)), (TypeReference[])(object)new TypeReference[1] { assembly.MainModule.TypeSystem.Object }));
		type.Methods.Add(val6);
		val6.Body.InitLocals = true;
		ParameterDefinition val7 = new ParameterDefinition("slot", (ParameterAttributes)0, (TypeReference)(object)type2);
		ParameterDefinition val8 = new ParameterDefinition("favorite", (ParameterAttributes)0, val3);
		ParameterDefinition val9 = new ParameterDefinition("fallback", (ParameterAttributes)0, assembly.MainModule.ImportReference(typeof(global::System.Delegate)));
		ParameterDefinition val10 = new ParameterDefinition("type", (ParameterAttributes)0, assembly.MainModule.ImportReference(typeof(global::System.Type)));
		Extensions.AddRange<ParameterDefinition>(((MethodReference)val6).Parameters, (global::System.Collections.Generic.IEnumerable<ParameterDefinition>)new <>z__ReadOnlyArray<ParameterDefinition>((ParameterDefinition[])(object)new ParameterDefinition[4] { val7, val8, val9, val10 }));
		ILProcessor iLProcessor = val6.Body.GetILProcessor();
		iLProcessor.Emit(OpCodes.Ldnull);
		MethodReference val11 = new MethodReference("FromResult", assembly.MainModule.TypeSystem.Void, assembly.MainModule.ImportReference(typeof(global::System.Threading.Tasks.Task)))
		{
			HasThis = false,
			ExplicitThis = false,
			CallingConvention = (MethodCallingConvention)0
		};
		GenericParameter val12 = new GenericParameter("TResult", (IGenericParameterProvider)(object)val11);
		val11.GenericParameters.Add(val12);
		val11.ReturnType = (TypeReference)(object)TypeReferenceRocks.MakeGenericInstanceType(assembly.MainModule.ImportReference(typeof(global::System.Threading.Tasks.Task<>)), (TypeReference[])(object)new TypeReference[1] { (TypeReference)val12 });
		ParameterDefinition val13 = new ParameterDefinition("result", (ParameterAttributes)0, (TypeReference)(object)val12);
		val11.Parameters.Add(val13);
		GenericInstanceMethod val14 = new GenericInstanceMethod(val11);
		val14.GenericArguments.Add(assembly.MainModule.TypeSystem.Object);
		iLProcessor.Emit(OpCodes.Call, (MethodReference)(object)val14);
		iLProcessor.Emit(OpCodes.Ret);
		MethodReference val15 = new MethodReference(((MemberReference)val6).Name, ((MethodReference)val6).ReturnType)
		{
			HasThis = ((MethodReference)val6).HasThis,
			ExplicitThis = ((MethodReference)val6).ExplicitThis,
			DeclaringType = (TypeReference)(object)type,
			CallingConvention = ((MethodReference)val6).CallingConvention
		};
		Enumerator<ParameterDefinition> enumerator = ((MethodReference)val6).Parameters.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				ParameterDefinition current = enumerator.Current;
				val15.Parameters.Add(new ParameterDefinition(((ParameterReference)current).Name, current.Attributes, ((ParameterReference)current).ParameterType));
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
		}
		MethodReference val16 = new MethodReference("Await", assembly.MainModule.TypeSystem.Void, assembly.MainModule.ImportReference(typeof(AsyncHelpers)))
		{
			HasThis = false,
			ExplicitThis = false,
			CallingConvention = (MethodCallingConvention)0
		};
		GenericParameter val17 = new GenericParameter("T", (IGenericParameterProvider)(object)val16);
		val16.GenericParameters.Add(val17);
		val16.ReturnType = (TypeReference)(object)val17;
		ParameterDefinition val18 = new ParameterDefinition("result", (ParameterAttributes)0, (TypeReference)(object)TypeReferenceRocks.MakeGenericInstanceType(assembly.MainModule.ImportReference(typeof(global::System.Threading.Tasks.Task<>)), (TypeReference[])(object)new TypeReference[1] { (TypeReference)val17 }));
		val16.Parameters.Add(val18);
		GenericInstanceMethod val19 = new GenericInstanceMethod(val16);
		val19.GenericArguments.Add(assembly.MainModule.TypeSystem.Object);
		Instruction val20 = Instruction.Create(OpCodes.Pop);
		Extensions.InsertRange<Instruction>(val4.Body.Instructions, 0, (global::System.Collections.Generic.IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[12]
		{
			Instruction.Create(OpCodes.Ldarg_0),
			Instruction.Create(OpCodes.Ldarg_1),
			Instruction.Create(OpCodes.Ldarg_2),
			Instruction.Create(OpCodes.Ldtoken, (TypeReference)(object)val5),
			Instruction.Create(OpCodes.Call, assembly.MainModule.ImportReference((MethodBase)(object)AccessTools.Method(typeof(global::System.Type), "GetTypeFromHandle", (global::System.Type[])null, (global::System.Type[])null))),
			Instruction.Create(OpCodes.Call, val15),
			Instruction.Create(OpCodes.Call, (MethodReference)(object)val19),
			Instruction.Create(OpCodes.Dup),
			Instruction.Create(OpCodes.Brfalse, val20),
			Instruction.Create(OpCodes.Unbox_Any, (TypeReference)(object)val5),
			Instruction.Create(OpCodes.Ret),
			val20
		}));
		return true;
	}
}