Decompiled source of FishGoBrrr v1.0.2

GDWeave/mods/FishGoBrrr/Buttplug.Net.dll

Decompiled 3 weeks ago
using System;
using System.Buffers;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Net.WebSockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Sources;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("Yoooi")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © Yoooi 2023")]
[assembly: AssemblyDescription("Buttplug.Net is a buttplug client library written in modern .Net")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0-ci.94.8be7539+8be7539450ae54727802d192fe440545ca1644c8")]
[assembly: AssemblyProduct("Buttplug.Net")]
[assembly: AssemblyTitle("Buttplug.Net")]
[assembly: AssemblyMetadata("RepositoryUrl", "git://github.com/Yoooi0/Buttplug.Net")]
[assembly: InternalsVisibleTo("Buttplug.Net.Tests")]
[assembly: InternalsVisibleTo("Buttplug.Net.NewtonsoftJson.Tests")]
[assembly: InternalsVisibleTo("Buttplug.Net.SystemTextJson.Tests")]
[assembly: AssemblyVersion("0.1.0.0")]
[module: RefSafetyRules(11)]
namespace Buttplug;

public class ButtplugClient : global::System.IAsyncDisposable
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass33_0
	{
		public SemaphoreSlim connectionSemaphore;

		public ButtplugClient <>4__this;

		internal global::System.Threading.Tasks.Task? <ConnectAsync>b__0()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			return <>4__this.RunAsync(connectionSemaphore, <>4__this._cancellationSource.Token);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <ConnectAsync>d__33 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public ButtplugClient <>4__this;

		public Uri uri;

		public CancellationToken cancellationToken;

		private <>c__DisplayClass33_0 <>8__1;

		private object <>7__wrap1;

		private int <>7__wrap2;

		private ConfiguredTaskAwaiter <>u__1;

		private global::System.Exception <e>5__4;

		private void MoveNext()
		{
			//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_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//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_008c: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugClient CS$<>8__locals0 = <>4__this;
			try
			{
				ConfiguredTaskAwaiter awaiter;
				if ((uint)num > 1u)
				{
					if (num == 2)
					{
						awaiter = <>u__1;
						<>u__1 = default(ConfiguredTaskAwaiter);
						num = (<>1__state = -1);
						goto IL_0282;
					}
					if (CS$<>8__locals0._cancellationSource != null)
					{
						throw new ButtplugException("The client is already connected");
					}
					<>7__wrap2 = 0;
				}
				ConfiguredTaskAwaitable val;
				try
				{
					if (num != 0)
					{
						if (num == 1)
						{
							goto IL_00f7;
						}
						<>8__1 = new <>c__DisplayClass33_0();
						<>8__1.<>4__this = CS$<>8__locals0;
						CS$<>8__locals0._connector = new ButtplugWebsocketConnector(CS$<>8__locals0.<converter>P, CS$<>8__locals0._taskManager);
						val = CS$<>8__locals0._connector.ConnectAsync(uri, cancellationToken).ConfigureAwait(false);
						awaiter = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();
						if (!((ConfiguredTaskAwaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <ConnectAsync>d__33>(ref awaiter, ref this);
							return;
						}
					}
					else
					{
						awaiter = <>u__1;
						<>u__1 = default(ConfiguredTaskAwaiter);
						num = (<>1__state = -1);
					}
					((ConfiguredTaskAwaiter)(ref awaiter)).GetResult();
					<>8__1.connectionSemaphore = new SemaphoreSlim(0, 1);
					goto IL_00f7;
					IL_00f7:
					try
					{
						if (num != 1)
						{
							CS$<>8__locals0._cancellationSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
							CS$<>8__locals0._task = global::System.Threading.Tasks.Task.Run((Func<global::System.Threading.Tasks.Task>)(() => <>8__1.<>4__this.RunAsync(<>8__1.connectionSemaphore, <>8__1.<>4__this._cancellationSource.Token)), CS$<>8__locals0._cancellationSource.Token);
							CS$<>8__locals0._task.ContinueWith<global::System.Threading.Tasks.Task>((Func<global::System.Threading.Tasks.Task, global::System.Threading.Tasks.Task>)([CompilerGenerated] (global::System.Threading.Tasks.Task _) => CS$<>8__locals0.DisconnectAsync()));
							val = <>8__1.connectionSemaphore.WaitAsync(CS$<>8__locals0._cancellationSource.Token).ConfigureAwait(false);
							awaiter = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();
							if (!((ConfiguredTaskAwaiter)(ref awaiter)).IsCompleted)
							{
								num = (<>1__state = 1);
								<>u__1 = awaiter;
								((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <ConnectAsync>d__33>(ref awaiter, ref this);
								return;
							}
						}
						else
						{
							awaiter = <>u__1;
							<>u__1 = default(ConfiguredTaskAwaiter);
							num = (<>1__state = -1);
						}
						((ConfiguredTaskAwaiter)(ref awaiter)).GetResult();
					}
					finally
					{
						if (num < 0 && <>8__1.connectionSemaphore != null)
						{
							((global::System.IDisposable)<>8__1.connectionSemaphore).Dispose();
						}
					}
					<>8__1 = null;
				}
				catch (global::System.Exception ex)
				{
					<>7__wrap1 = ex;
					<>7__wrap2 = 1;
				}
				int num2 = <>7__wrap2;
				if (num2 == 1)
				{
					<e>5__4 = (global::System.Exception)<>7__wrap1;
					val = CS$<>8__locals0.DisconnectAsync().ConfigureAwait(false);
					awaiter = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();
					if (!((ConfiguredTaskAwaiter)(ref awaiter)).IsCompleted)
					{
						num = (<>1__state = 2);
						<>u__1 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <ConnectAsync>d__33>(ref awaiter, ref this);
						return;
					}
					goto IL_0282;
				}
				goto IL_029b;
				IL_0282:
				((ConfiguredTaskAwaiter)(ref awaiter)).GetResult();
				<e>5__4.Throw();
				<e>5__4 = null;
				goto IL_029b;
				IL_029b:
				<>7__wrap1 = null;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <DisconnectAsync>d__37 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public ButtplugClient <>4__this;

		private ConfiguredTaskAwaiter <>u__1;

		private ConfiguredValueTaskAwaiter <>u__2;

		private void MoveNext()
		{
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugClient buttplugClient = <>4__this;
			try
			{
				if (num == 0)
				{
					goto IL_003e;
				}
				ConfiguredValueTaskAwaiter awaiter;
				if (num == 1)
				{
					awaiter = <>u__2;
					<>u__2 = default(ConfiguredValueTaskAwaiter);
					num = (<>1__state = -1);
					goto IL_013c;
				}
				if (Interlocked.CompareExchange(ref buttplugClient._isDisconnectingFlag, 1, 0) == 0)
				{
					CancellationTokenSource? cancellationSource = buttplugClient._cancellationSource;
					if (cancellationSource != null)
					{
						cancellationSource.Cancel();
					}
					goto IL_003e;
				}
				goto end_IL_000e;
				IL_0143:
				buttplugClient._connector = null;
				buttplugClient._taskManager.CancelPendingTasks();
				global::System.Collections.Generic.IEnumerator<KeyValuePair<uint, ButtplugDevice>> enumerator = buttplugClient._devices.GetEnumerator();
				try
				{
					uint num2 = default(uint);
					ButtplugDevice buttplugDevice = default(ButtplugDevice);
					while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
					{
						enumerator.Current.Deconstruct(ref num2, ref buttplugDevice);
						ButtplugDevice buttplugDevice2 = buttplugDevice;
						buttplugDevice2.Dispose();
						buttplugClient.DeviceRemoved?.Invoke((object)buttplugClient, buttplugDevice2);
					}
				}
				finally
				{
					if (num < 0)
					{
						((global::System.IDisposable)enumerator)?.Dispose();
					}
				}
				buttplugClient._devices.Clear();
				Interlocked.Decrement(ref buttplugClient._isDisconnectingFlag);
				goto end_IL_000e;
				IL_003e:
				try
				{
					ConfiguredTaskAwaiter awaiter2;
					if (num == 0)
					{
						awaiter2 = <>u__1;
						<>u__1 = default(ConfiguredTaskAwaiter);
						num = (<>1__state = -1);
						goto IL_00a6;
					}
					if (buttplugClient._task != null)
					{
						ConfiguredTaskAwaitable val = buttplugClient._task.ConfigureAwait(false);
						awaiter2 = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();
						if (!((ConfiguredTaskAwaiter)(ref awaiter2)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter2;
							((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <DisconnectAsync>d__37>(ref awaiter2, ref this);
							return;
						}
						goto IL_00a6;
					}
					goto end_IL_003e;
					IL_00a6:
					((ConfiguredTaskAwaiter)(ref awaiter2)).GetResult();
					end_IL_003e:;
				}
				catch
				{
				}
				CancellationTokenSource? cancellationSource2 = buttplugClient._cancellationSource;
				if (cancellationSource2 != null)
				{
					cancellationSource2.Dispose();
				}
				buttplugClient._cancellationSource = null;
				if (buttplugClient._connector != null)
				{
					ConfiguredValueTaskAwaitable val2 = buttplugClient._connector.DisposeAsync().ConfigureAwait(false);
					awaiter = ((ConfiguredValueTaskAwaitable)(ref val2)).GetAwaiter();
					if (!((ConfiguredValueTaskAwaiter)(ref awaiter)).IsCompleted)
					{
						num = (<>1__state = 1);
						<>u__2 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter, <DisconnectAsync>d__37>(ref awaiter, ref this);
						return;
					}
					goto IL_013c;
				}
				goto IL_0143;
				IL_013c:
				((ConfiguredValueTaskAwaiter)(ref awaiter)).GetResult();
				goto IL_0143;
				end_IL_000e:;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <DisposeAsync>d__44 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncValueTaskMethodBuilder <>t__builder;

		public ButtplugClient <>4__this;

		private ConfiguredTaskAwaiter <>u__1;

		private void MoveNext()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0039: 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)
			int num = <>1__state;
			ButtplugClient buttplugClient = <>4__this;
			try
			{
				ConfiguredTaskAwaiter awaiter;
				if (num != 0)
				{
					ConfiguredTaskAwaitable val = buttplugClient.DisconnectAsync().ConfigureAwait(false);
					awaiter = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();
					if (!((ConfiguredTaskAwaiter)(ref awaiter)).IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncValueTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <DisposeAsync>d__44>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter);
					num = (<>1__state = -1);
				}
				((ConfiguredTaskAwaiter)(ref awaiter)).GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncValueTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncValueTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncValueTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <DisposeAsync>d__45 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncValueTaskMethodBuilder <>t__builder;

		public ButtplugClient <>4__this;

		private ConfiguredValueTaskAwaiter <>u__1;

		private void MoveNext()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0021: 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)
			//IL_002a: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugClient buttplugClient = <>4__this;
			try
			{
				ConfiguredValueTaskAwaiter awaiter;
				if (num != 0)
				{
					ConfiguredValueTaskAwaitable val = buttplugClient.DisposeAsync(disposing: true).ConfigureAwait(false);
					awaiter = ((ConfiguredValueTaskAwaitable)(ref val)).GetAwaiter();
					if (!((ConfiguredValueTaskAwaiter)(ref awaiter)).IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncValueTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter, <DisposeAsync>d__45>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredValueTaskAwaiter);
					num = (<>1__state = -1);
				}
				((ConfiguredValueTaskAwaiter)(ref awaiter)).GetResult();
				GC.SuppressFinalize((object)buttplugClient);
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncValueTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncValueTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncValueTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <ReadAsync>d__35 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public ButtplugClient <>4__this;

		public CancellationToken cancellationToken;

		private Enumerator<IButtplugMessage> <>7__wrap1;

		private object <>7__wrap2;

		private int <>7__wrap3;

		private ConfiguredValueTaskAwaiter<bool> <>u__1;

		private ConfiguredValueTaskAwaiter <>u__2;

		private void MoveNext()
		{
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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)
			//IL_0030: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugClient buttplugClient = <>4__this;
			try
			{
				_ = 1;
				try
				{
					ConfiguredValueTaskAwaiter awaiter;
					if (num != 0)
					{
						if (num == 1)
						{
							awaiter = <>u__2;
							<>u__2 = default(ConfiguredValueTaskAwaiter);
							num = (<>1__state = -1);
							goto IL_0159;
						}
						<>7__wrap1 = TaskAsyncEnumerableExtensions.ConfigureAwait<IButtplugMessage>(buttplugClient._connector.RecieveMessagesAsync(cancellationToken), false).GetAsyncEnumerator();
						<>7__wrap2 = null;
						<>7__wrap3 = 0;
					}
					try
					{
						if (num != 0)
						{
							goto IL_007f;
						}
						ConfiguredValueTaskAwaiter<bool> awaiter2 = <>u__1;
						<>u__1 = default(ConfiguredValueTaskAwaiter<bool>);
						num = (<>1__state = -1);
						goto IL_00df;
						IL_007f:
						awaiter2 = <>7__wrap1.MoveNextAsync().GetAwaiter();
						if (!awaiter2.IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter2;
							((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<bool>, <ReadAsync>d__35>(ref awaiter2, ref this);
							return;
						}
						goto IL_00df;
						IL_00df:
						if (awaiter2.GetResult())
						{
							IButtplugMessage current = <>7__wrap1.Current;
							if (current.Id == 0)
							{
								buttplugClient.<ReadAsync>g__HandleSystemMessage|35_0(current);
							}
							else
							{
								buttplugClient._taskManager.FinishTask(current);
							}
							goto IL_007f;
						}
					}
					catch (object obj)
					{
						<>7__wrap2 = obj;
					}
					ConfiguredValueTaskAwaitable val = <>7__wrap1.DisposeAsync();
					awaiter = ((ConfiguredValueTaskAwaitable)(ref val)).GetAwaiter();
					if (!((ConfiguredValueTaskAwaiter)(ref awaiter)).IsCompleted)
					{
						num = (<>1__state = 1);
						<>u__2 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter, <ReadAsync>d__35>(ref awaiter, ref this);
						return;
					}
					goto IL_0159;
					IL_0159:
					((ConfiguredValueTaskAwaiter)(ref awaiter)).GetResult();
					object obj2 = <>7__wrap2;
					if (obj2 != null)
					{
						ExceptionDispatchInfo.Capture((obj2 as global::System.Exception) ?? throw obj2).Throw();
					}
					<>7__wrap2 = null;
					<>7__wrap1 = default(Enumerator<IButtplugMessage>);
				}
				catch (OperationCanceledException)
				{
				}
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <RunAsync>d__34 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public CancellationToken cancellationToken;

		public ButtplugClient <>4__this;

		public SemaphoreSlim connectionSemaphore;

		private CancellationTokenSource <cancellationSource>5__2;

		private List<global::System.Threading.Tasks.Task> <tasks>5__3;

		private ServerInfoButtplugMessage <serverInfo>5__4;

		private ConfiguredTaskAwaiter<ServerInfoButtplugMessage> <>u__1;

		private ConfiguredTaskAwaiter<DeviceListButtplugMessage> <>u__2;

		private ConfiguredTaskAwaiter<global::System.Threading.Tasks.Task> <>u__3;

		private void MoveNext()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugClient buttplugClient = <>4__this;
			try
			{
				_ = 2;
				try
				{
					if ((uint)num > 2u)
					{
						<cancellationSource>5__2 = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
					}
					try
					{
						ConfiguredTaskAwaiter<ServerInfoButtplugMessage> awaiter3;
						ConfiguredTaskAwaiter<DeviceListButtplugMessage> awaiter2;
						ConfiguredTaskAwaiter<global::System.Threading.Tasks.Task> awaiter;
						Enumerator<ButtplugDeviceInfo> enumerator;
						ServerInfoButtplugMessage result;
						switch (num)
						{
						default:
						{
							List<global::System.Threading.Tasks.Task> obj = new List<global::System.Threading.Tasks.Task>();
							obj.Add(buttplugClient.ReadAsync(<cancellationSource>5__2.Token));
							<tasks>5__3 = obj;
							awaiter3 = buttplugClient.SendMessageExpectTAsync<ServerInfoButtplugMessage>(new RequestServerInfoButtplugMessage(buttplugClient.Name), cancellationToken).ConfigureAwait(false).GetAwaiter();
							if (!awaiter3.IsCompleted)
							{
								num = (<>1__state = 0);
								<>u__1 = awaiter3;
								((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<ServerInfoButtplugMessage>, <RunAsync>d__34>(ref awaiter3, ref this);
								return;
							}
							goto IL_00cd;
						}
						case 0:
							awaiter3 = <>u__1;
							<>u__1 = default(ConfiguredTaskAwaiter<ServerInfoButtplugMessage>);
							num = (<>1__state = -1);
							goto IL_00cd;
						case 1:
							awaiter2 = <>u__2;
							<>u__2 = default(ConfiguredTaskAwaiter<DeviceListButtplugMessage>);
							num = (<>1__state = -1);
							goto IL_01ab;
						case 2:
							{
								awaiter = <>u__3;
								<>u__3 = default(ConfiguredTaskAwaiter<global::System.Threading.Tasks.Task>);
								num = (<>1__state = -1);
								break;
							}
							IL_01ab:
							enumerator = awaiter2.GetResult().Devices.GetEnumerator();
							while (enumerator.MoveNext())
							{
								ButtplugDeviceInfo current = enumerator.Current;
								if (!buttplugClient._devices.ContainsKey(current.DeviceIndex))
								{
									ButtplugDevice buttplugDevice = new ButtplugDevice(buttplugClient._connector, current);
									buttplugClient._devices.TryAdd(current.DeviceIndex, buttplugDevice);
									buttplugClient.DeviceAdded?.Invoke((object)buttplugClient, buttplugDevice);
								}
							}
							if (<serverInfo>5__4.MaxPingTime != 0)
							{
								<tasks>5__3.Add(buttplugClient.WriteAsync(<serverInfo>5__4.MaxPingTime, <cancellationSource>5__2.Token));
							}
							buttplugClient.IsConnected = true;
							connectionSemaphore.Release();
							awaiter = global::System.Threading.Tasks.Task.WhenAny((global::System.Collections.Generic.IEnumerable<global::System.Threading.Tasks.Task>)<tasks>5__3).ConfigureAwait(false).GetAwaiter();
							if (!awaiter.IsCompleted)
							{
								num = (<>1__state = 2);
								<>u__3 = awaiter;
								((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<global::System.Threading.Tasks.Task>, <RunAsync>d__34>(ref awaiter, ref this);
								return;
							}
							break;
							IL_00cd:
							result = awaiter3.GetResult();
							<serverInfo>5__4 = result;
							if (<serverInfo>5__4.MessageVersion < 3)
							{
								throw new ButtplugException($"A newer server is required ({<serverInfo>5__4.MessageVersion} < {3})");
							}
							awaiter2 = buttplugClient.SendMessageExpectTAsync<DeviceListButtplugMessage>(new RequestDeviceListButtplugMessage(), cancellationToken).ConfigureAwait(false).GetAwaiter();
							if (!awaiter2.IsCompleted)
							{
								num = (<>1__state = 1);
								<>u__2 = awaiter2;
								((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<DeviceListButtplugMessage>, <RunAsync>d__34>(ref awaiter2, ref this);
								return;
							}
							goto IL_01ab;
						}
						global::System.Threading.Tasks.Task result2 = awaiter.GetResult();
						<cancellationSource>5__2.Cancel();
						result2.ThrowIfFaulted();
					}
					finally
					{
						if (num < 0 && <cancellationSource>5__2 != null)
						{
							((global::System.IDisposable)<cancellationSource>5__2).Dispose();
						}
					}
					<cancellationSource>5__2 = null;
					<tasks>5__3 = null;
					<serverInfo>5__4 = null;
				}
				catch (OperationCanceledException)
				{
				}
				catch (global::System.Exception ex)
				{
					buttplugClient.UnhandledException?.Invoke((object)buttplugClient, ex);
					ex.Throw();
				}
				finally
				{
					if (num < 0)
					{
						buttplugClient.IsConnected = false;
						EventHandler? disconnected = buttplugClient.Disconnected;
						if (disconnected != null)
						{
							disconnected.Invoke((object)buttplugClient, EventArgs.Empty);
						}
					}
				}
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <SendMessageExpectTAsync>d__41<T> : IAsyncStateMachine where T : notnull, IButtplugMessage
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder<T> <>t__builder;

		public ButtplugClient <>4__this;

		public IButtplugMessage message;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter<T> <>u__1;

		private void MoveNext()
		{
			//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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugClient buttplugClient = <>4__this;
			T result2;
			try
			{
				ConfiguredTaskAwaiter<T> awaiter;
				if (num != 0)
				{
					if (buttplugClient._connector == null)
					{
						throw new ObjectDisposedException("_connector");
					}
					awaiter = buttplugClient._connector.SendMessageExpectTAsync<T>(message, cancellationToken).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<T>, <SendMessageExpectTAsync>d__41<T>>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<T>);
					num = (<>1__state = -1);
				}
				T result = awaiter.GetResult();
				result2 = result;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<>t__builder.SetResult(result2);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <StartScanningAsync>d__38 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public ButtplugClient <>4__this;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter<OkButtplugMessage> <>u__1;

		private void MoveNext()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugClient buttplugClient = <>4__this;
			try
			{
				ConfiguredTaskAwaiter<OkButtplugMessage> awaiter;
				if (num != 0)
				{
					awaiter = buttplugClient.SendMessageExpectTAsync<OkButtplugMessage>(new StartScanningButtplugMessage(), cancellationToken).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<OkButtplugMessage>, <StartScanningAsync>d__38>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<OkButtplugMessage>);
					num = (<>1__state = -1);
				}
				awaiter.GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <StopAllDevicesAsync>d__40 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public ButtplugClient <>4__this;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter<OkButtplugMessage> <>u__1;

		private void MoveNext()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugClient buttplugClient = <>4__this;
			try
			{
				ConfiguredTaskAwaiter<OkButtplugMessage> awaiter;
				if (num != 0)
				{
					awaiter = buttplugClient.SendMessageExpectTAsync<OkButtplugMessage>(new StopAllDevicesButtplugMessage(), cancellationToken).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<OkButtplugMessage>, <StopAllDevicesAsync>d__40>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<OkButtplugMessage>);
					num = (<>1__state = -1);
				}
				awaiter.GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <StopScanningAsync>d__39 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public ButtplugClient <>4__this;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter<OkButtplugMessage> <>u__1;

		private void MoveNext()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugClient buttplugClient = <>4__this;
			try
			{
				ConfiguredTaskAwaiter<OkButtplugMessage> awaiter;
				if (num != 0)
				{
					awaiter = buttplugClient.SendMessageExpectTAsync<OkButtplugMessage>(new StopScanningButtplugMessage(), cancellationToken).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<OkButtplugMessage>, <StopScanningAsync>d__39>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<OkButtplugMessage>);
					num = (<>1__state = -1);
				}
				awaiter.GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <WriteAsync>d__36 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public uint maxPingTime;

		public ButtplugClient <>4__this;

		public CancellationToken cancellationToken;

		private PeriodicTimer <timer>5__2;

		private ConfiguredTaskAwaiter<OkButtplugMessage> <>u__1;

		private ConfiguredValueTaskAwaiter<bool> <>u__2;

		private void MoveNext()
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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)
			int num = <>1__state;
			ButtplugClient buttplugClient = <>4__this;
			try
			{
				_ = 1;
				try
				{
					ConfiguredValueTaskAwaiter<bool> awaiter;
					if (num != 0)
					{
						if (num != 1)
						{
							<timer>5__2 = new PeriodicTimer(TimeSpan.FromMilliseconds((double)(maxPingTime / 2)));
							goto IL_00a9;
						}
						awaiter = <>u__2;
						<>u__2 = default(ConfiguredValueTaskAwaiter<bool>);
						num = (<>1__state = -1);
						goto IL_0116;
					}
					ConfiguredTaskAwaiter<OkButtplugMessage> awaiter2 = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<OkButtplugMessage>);
					num = (<>1__state = -1);
					goto IL_00a1;
					IL_00a1:
					awaiter2.GetResult();
					goto IL_00a9;
					IL_00a9:
					awaiter = <timer>5__2.WaitForNextTickAsync(cancellationToken).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 1);
						<>u__2 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<bool>, <WriteAsync>d__36>(ref awaiter, ref this);
						return;
					}
					goto IL_0116;
					IL_0116:
					if (awaiter.GetResult() && !((CancellationToken)(ref cancellationToken)).IsCancellationRequested)
					{
						awaiter2 = buttplugClient.SendMessageExpectTAsync<OkButtplugMessage>(new PingButtplugMessage(), cancellationToken).ConfigureAwait(false).GetAwaiter();
						if (!awaiter2.IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter2;
							((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<OkButtplugMessage>, <WriteAsync>d__36>(ref awaiter2, ref this);
							return;
						}
						goto IL_00a1;
					}
					<timer>5__2 = null;
				}
				catch (OperationCanceledException)
				{
				}
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[CompilerGenerated]
	private IButtplugMessageJsonConverter <converter>P;

	internal const uint MessageVersion = 3u;

	private readonly ButtplugMessageTaskManager _taskManager;

	private readonly ConcurrentDictionary<uint, ButtplugDevice> _devices;

	private ButtplugWebsocketConnector? _connector;

	private CancellationTokenSource? _cancellationSource;

	private global::System.Threading.Tasks.Task? _task;

	private int _isDisconnectingFlag;

	[CompilerGenerated]
	private EventHandler<ButtplugDevice>? m_DeviceAdded;

	[CompilerGenerated]
	private EventHandler<ButtplugDevice>? m_DeviceRemoved;

	[CompilerGenerated]
	private EventHandler<global::System.Exception>? m_UnhandledException;

	[CompilerGenerated]
	private EventHandler? m_ScanningFinished;

	[CompilerGenerated]
	private EventHandler? m_Disconnected;

	[field: CompilerGenerated]
	public string Name
	{
		[CompilerGenerated]
		get;
	}

	[field: CompilerGenerated]
	public bool IsConnected
	{
		[CompilerGenerated]
		get;
		[CompilerGenerated]
		private set;
	}

	public global::System.Collections.Generic.ICollection<ButtplugDevice> Devices => _devices.Values;

	public event EventHandler<ButtplugDevice>? DeviceAdded
	{
		[CompilerGenerated]
		add
		{
			EventHandler<ButtplugDevice> val = this.m_DeviceAdded;
			EventHandler<ButtplugDevice> val2;
			do
			{
				val2 = val;
				EventHandler<ButtplugDevice> val3 = (EventHandler<ButtplugDevice>)(object)global::System.Delegate.Combine((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value);
				val = Interlocked.CompareExchange<EventHandler<ButtplugDevice>>(ref this.m_DeviceAdded, val3, val2);
			}
			while (val != val2);
		}
		[CompilerGenerated]
		remove
		{
			EventHandler<ButtplugDevice> val = this.m_DeviceAdded;
			EventHandler<ButtplugDevice> val2;
			do
			{
				val2 = val;
				EventHandler<ButtplugDevice> val3 = (EventHandler<ButtplugDevice>)(object)global::System.Delegate.Remove((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value);
				val = Interlocked.CompareExchange<EventHandler<ButtplugDevice>>(ref this.m_DeviceAdded, val3, val2);
			}
			while (val != val2);
		}
	}

	public event EventHandler<ButtplugDevice>? DeviceRemoved
	{
		[CompilerGenerated]
		add
		{
			EventHandler<ButtplugDevice> val = this.m_DeviceRemoved;
			EventHandler<ButtplugDevice> val2;
			do
			{
				val2 = val;
				EventHandler<ButtplugDevice> val3 = (EventHandler<ButtplugDevice>)(object)global::System.Delegate.Combine((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value);
				val = Interlocked.CompareExchange<EventHandler<ButtplugDevice>>(ref this.m_DeviceRemoved, val3, val2);
			}
			while (val != val2);
		}
		[CompilerGenerated]
		remove
		{
			EventHandler<ButtplugDevice> val = this.m_DeviceRemoved;
			EventHandler<ButtplugDevice> val2;
			do
			{
				val2 = val;
				EventHandler<ButtplugDevice> val3 = (EventHandler<ButtplugDevice>)(object)global::System.Delegate.Remove((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value);
				val = Interlocked.CompareExchange<EventHandler<ButtplugDevice>>(ref this.m_DeviceRemoved, val3, val2);
			}
			while (val != val2);
		}
	}

	public event EventHandler<global::System.Exception>? UnhandledException
	{
		[CompilerGenerated]
		add
		{
			EventHandler<global::System.Exception> val = this.m_UnhandledException;
			EventHandler<global::System.Exception> val2;
			do
			{
				val2 = val;
				EventHandler<global::System.Exception> val3 = (EventHandler<global::System.Exception>)(object)global::System.Delegate.Combine((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value);
				val = Interlocked.CompareExchange<EventHandler<global::System.Exception>>(ref this.m_UnhandledException, val3, val2);
			}
			while (val != val2);
		}
		[CompilerGenerated]
		remove
		{
			EventHandler<global::System.Exception> val = this.m_UnhandledException;
			EventHandler<global::System.Exception> val2;
			do
			{
				val2 = val;
				EventHandler<global::System.Exception> val3 = (EventHandler<global::System.Exception>)(object)global::System.Delegate.Remove((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value);
				val = Interlocked.CompareExchange<EventHandler<global::System.Exception>>(ref this.m_UnhandledException, val3, val2);
			}
			while (val != val2);
		}
	}

	public event EventHandler ScanningFinished
	{
		[CompilerGenerated]
		add
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			EventHandler val = this.m_ScanningFinished;
			EventHandler val2;
			do
			{
				val2 = val;
				EventHandler val3 = (EventHandler)global::System.Delegate.Combine((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value);
				val = Interlocked.CompareExchange<EventHandler>(ref this.m_ScanningFinished, val3, val2);
			}
			while (val != val2);
		}
		[CompilerGenerated]
		remove
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			EventHandler val = this.m_ScanningFinished;
			EventHandler val2;
			do
			{
				val2 = val;
				EventHandler val3 = (EventHandler)global::System.Delegate.Remove((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value);
				val = Interlocked.CompareExchange<EventHandler>(ref this.m_ScanningFinished, val3, val2);
			}
			while (val != val2);
		}
	}

	public event EventHandler Disconnected
	{
		[CompilerGenerated]
		add
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			EventHandler val = this.m_Disconnected;
			EventHandler val2;
			do
			{
				val2 = val;
				EventHandler val3 = (EventHandler)global::System.Delegate.Combine((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value);
				val = Interlocked.CompareExchange<EventHandler>(ref this.m_Disconnected, val3, val2);
			}
			while (val != val2);
		}
		[CompilerGenerated]
		remove
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			EventHandler val = this.m_Disconnected;
			EventHandler val2;
			do
			{
				val2 = val;
				EventHandler val3 = (EventHandler)global::System.Delegate.Remove((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value);
				val = Interlocked.CompareExchange<EventHandler>(ref this.m_Disconnected, val3, val2);
			}
			while (val != val2);
		}
	}

	public ButtplugClient(string name, IButtplugMessageJsonConverter converter)
	{
		<converter>P = converter;
		_taskManager = new ButtplugMessageTaskManager();
		_devices = new ConcurrentDictionary<uint, ButtplugDevice>();
		Name = name;
		base..ctor();
	}

	[AsyncStateMachine(typeof(<ConnectAsync>d__33))]
	public global::System.Threading.Tasks.Task ConnectAsync(Uri uri, CancellationToken cancellationToken)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		<ConnectAsync>d__33 <ConnectAsync>d__ = default(<ConnectAsync>d__33);
		<ConnectAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
		<ConnectAsync>d__.<>4__this = this;
		<ConnectAsync>d__.uri = uri;
		<ConnectAsync>d__.cancellationToken = cancellationToken;
		<ConnectAsync>d__.<>1__state = -1;
		((AsyncTaskMethodBuilder)(ref <ConnectAsync>d__.<>t__builder)).Start<<ConnectAsync>d__33>(ref <ConnectAsync>d__);
		return ((AsyncTaskMethodBuilder)(ref <ConnectAsync>d__.<>t__builder)).Task;
	}

	[AsyncStateMachine(typeof(<RunAsync>d__34))]
	private global::System.Threading.Tasks.Task RunAsync(SemaphoreSlim connectionSemaphore, CancellationToken cancellationToken)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		<RunAsync>d__34 <RunAsync>d__ = default(<RunAsync>d__34);
		<RunAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
		<RunAsync>d__.<>4__this = this;
		<RunAsync>d__.connectionSemaphore = connectionSemaphore;
		<RunAsync>d__.cancellationToken = cancellationToken;
		<RunAsync>d__.<>1__state = -1;
		((AsyncTaskMethodBuilder)(ref <RunAsync>d__.<>t__builder)).Start<<RunAsync>d__34>(ref <RunAsync>d__);
		return ((AsyncTaskMethodBuilder)(ref <RunAsync>d__.<>t__builder)).Task;
	}

	[AsyncStateMachine(typeof(<ReadAsync>d__35))]
	private global::System.Threading.Tasks.Task ReadAsync(CancellationToken cancellationToken)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		<ReadAsync>d__35 <ReadAsync>d__ = default(<ReadAsync>d__35);
		<ReadAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
		<ReadAsync>d__.<>4__this = this;
		<ReadAsync>d__.cancellationToken = cancellationToken;
		<ReadAsync>d__.<>1__state = -1;
		((AsyncTaskMethodBuilder)(ref <ReadAsync>d__.<>t__builder)).Start<<ReadAsync>d__35>(ref <ReadAsync>d__);
		return ((AsyncTaskMethodBuilder)(ref <ReadAsync>d__.<>t__builder)).Task;
	}

	[AsyncStateMachine(typeof(<WriteAsync>d__36))]
	private global::System.Threading.Tasks.Task WriteAsync(uint maxPingTime, CancellationToken cancellationToken)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		<WriteAsync>d__36 <WriteAsync>d__ = default(<WriteAsync>d__36);
		<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
		<WriteAsync>d__.<>4__this = this;
		<WriteAsync>d__.maxPingTime = maxPingTime;
		<WriteAsync>d__.cancellationToken = cancellationToken;
		<WriteAsync>d__.<>1__state = -1;
		((AsyncTaskMethodBuilder)(ref <WriteAsync>d__.<>t__builder)).Start<<WriteAsync>d__36>(ref <WriteAsync>d__);
		return ((AsyncTaskMethodBuilder)(ref <WriteAsync>d__.<>t__builder)).Task;
	}

	[AsyncStateMachine(typeof(<DisconnectAsync>d__37))]
	public global::System.Threading.Tasks.Task DisconnectAsync()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		<DisconnectAsync>d__37 <DisconnectAsync>d__ = default(<DisconnectAsync>d__37);
		<DisconnectAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
		<DisconnectAsync>d__.<>4__this = this;
		<DisconnectAsync>d__.<>1__state = -1;
		((AsyncTaskMethodBuilder)(ref <DisconnectAsync>d__.<>t__builder)).Start<<DisconnectAsync>d__37>(ref <DisconnectAsync>d__);
		return ((AsyncTaskMethodBuilder)(ref <DisconnectAsync>d__.<>t__builder)).Task;
	}

	[AsyncStateMachine(typeof(<StartScanningAsync>d__38))]
	public global::System.Threading.Tasks.Task StartScanningAsync(CancellationToken cancellationToken)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		<StartScanningAsync>d__38 <StartScanningAsync>d__ = default(<StartScanningAsync>d__38);
		<StartScanningAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
		<StartScanningAsync>d__.<>4__this = this;
		<StartScanningAsync>d__.cancellationToken = cancellationToken;
		<StartScanningAsync>d__.<>1__state = -1;
		((AsyncTaskMethodBuilder)(ref <StartScanningAsync>d__.<>t__builder)).Start<<StartScanningAsync>d__38>(ref <StartScanningAsync>d__);
		return ((AsyncTaskMethodBuilder)(ref <StartScanningAsync>d__.<>t__builder)).Task;
	}

	[AsyncStateMachine(typeof(<StopScanningAsync>d__39))]
	public global::System.Threading.Tasks.Task StopScanningAsync(CancellationToken cancellationToken)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		<StopScanningAsync>d__39 <StopScanningAsync>d__ = default(<StopScanningAsync>d__39);
		<StopScanningAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
		<StopScanningAsync>d__.<>4__this = this;
		<StopScanningAsync>d__.cancellationToken = cancellationToken;
		<StopScanningAsync>d__.<>1__state = -1;
		((AsyncTaskMethodBuilder)(ref <StopScanningAsync>d__.<>t__builder)).Start<<StopScanningAsync>d__39>(ref <StopScanningAsync>d__);
		return ((AsyncTaskMethodBuilder)(ref <StopScanningAsync>d__.<>t__builder)).Task;
	}

	[AsyncStateMachine(typeof(<StopAllDevicesAsync>d__40))]
	public global::System.Threading.Tasks.Task StopAllDevicesAsync(CancellationToken cancellationToken)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		<StopAllDevicesAsync>d__40 <StopAllDevicesAsync>d__ = default(<StopAllDevicesAsync>d__40);
		<StopAllDevicesAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
		<StopAllDevicesAsync>d__.<>4__this = this;
		<StopAllDevicesAsync>d__.cancellationToken = cancellationToken;
		<StopAllDevicesAsync>d__.<>1__state = -1;
		((AsyncTaskMethodBuilder)(ref <StopAllDevicesAsync>d__.<>t__builder)).Start<<StopAllDevicesAsync>d__40>(ref <StopAllDevicesAsync>d__);
		return ((AsyncTaskMethodBuilder)(ref <StopAllDevicesAsync>d__.<>t__builder)).Task;
	}

	[AsyncStateMachine(typeof(<SendMessageExpectTAsync>d__41<>))]
	private async global::System.Threading.Tasks.Task<T> SendMessageExpectTAsync<T>(IButtplugMessage message, CancellationToken cancellationToken) where T : IButtplugMessage
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		if (_connector == null)
		{
			throw new ObjectDisposedException("_connector");
		}
		return await _connector.SendMessageExpectTAsync<T>(message, cancellationToken).ConfigureAwait(false);
	}

	public virtual string ToString()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Expected O, but got Unknown
		StringBuilder val = new StringBuilder();
		val.Append("ButtplugClient");
		val.Append(" { ");
		if (PrintMembers(val))
		{
			val.Append(' ');
		}
		val.Append('}');
		return ((object)val).ToString();
	}

	protected virtual bool PrintMembers(StringBuilder builder)
	{
		RuntimeHelpers.EnsureSufficientExecutionStack();
		builder.Append("Name = ");
		builder.Append(Name);
		builder.Append(", Devices = ");
		builder.Append(_devices.Count);
		return true;
	}

	[AsyncStateMachine(typeof(<DisposeAsync>d__44))]
	protected virtual global::System.Threading.Tasks.ValueTask DisposeAsync(bool disposing)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		<DisposeAsync>d__44 <DisposeAsync>d__ = default(<DisposeAsync>d__44);
		<DisposeAsync>d__.<>t__builder = AsyncValueTaskMethodBuilder.Create();
		<DisposeAsync>d__.<>4__this = this;
		<DisposeAsync>d__.<>1__state = -1;
		((AsyncValueTaskMethodBuilder)(ref <DisposeAsync>d__.<>t__builder)).Start<<DisposeAsync>d__44>(ref <DisposeAsync>d__);
		return ((AsyncValueTaskMethodBuilder)(ref <DisposeAsync>d__.<>t__builder)).Task;
	}

	[AsyncStateMachine(typeof(<DisposeAsync>d__45))]
	public global::System.Threading.Tasks.ValueTask DisposeAsync()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		<DisposeAsync>d__45 <DisposeAsync>d__ = default(<DisposeAsync>d__45);
		<DisposeAsync>d__.<>t__builder = AsyncValueTaskMethodBuilder.Create();
		<DisposeAsync>d__.<>4__this = this;
		<DisposeAsync>d__.<>1__state = -1;
		((AsyncValueTaskMethodBuilder)(ref <DisposeAsync>d__.<>t__builder)).Start<<DisposeAsync>d__45>(ref <DisposeAsync>d__);
		return ((AsyncValueTaskMethodBuilder)(ref <DisposeAsync>d__.<>t__builder)).Task;
	}

	[CompilerGenerated]
	private void <ReadAsync>g__HandleSystemMessage|35_0(IButtplugMessage message)
	{
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		if (message is DeviceAddedButtplugMessage deviceAddedButtplugMessage)
		{
			ButtplugDevice buttplugDevice = new ButtplugDevice(_connector, deviceAddedButtplugMessage);
			if (_devices.TryAdd(buttplugDevice.Index, buttplugDevice))
			{
				this.DeviceAdded?.Invoke((object)this, buttplugDevice);
				return;
			}
			this.UnhandledException?.Invoke((object)this, (global::System.Exception)new ButtplugException($"Found existing device for event \"{deviceAddedButtplugMessage}\""));
			return;
		}
		if (message is DeviceRemovedButtplugMessage deviceRemovedButtplugMessage)
		{
			ButtplugDevice buttplugDevice2 = default(ButtplugDevice);
			if (_devices.TryRemove(deviceRemovedButtplugMessage.DeviceIndex, ref buttplugDevice2))
			{
				buttplugDevice2.Dispose();
				this.DeviceRemoved?.Invoke((object)this, buttplugDevice2);
				return;
			}
			this.UnhandledException?.Invoke((object)this, (global::System.Exception)new ButtplugException($"Unable to find matching device for event \"{deviceRemovedButtplugMessage}\""));
			return;
		}
		if (message is ScanningFinishedButtplugMessage)
		{
			EventHandler? scanningFinished = this.ScanningFinished;
			if (scanningFinished != null)
			{
				scanningFinished.Invoke((object)this, EventArgs.Empty);
			}
			return;
		}
		if (message is SensorReadingButtplugMessage sensorReadingButtplugMessage)
		{
			ButtplugDevice buttplugDevice3 = default(ButtplugDevice);
			if (!_devices.TryGetValue(sensorReadingButtplugMessage.DeviceIndex, ref buttplugDevice3))
			{
				throw new ButtplugException("Received sensor reading for missing device");
			}
			buttplugDevice3.HandleSubscribeSensorReading(sensorReadingButtplugMessage.SensorIndex, sensorReadingButtplugMessage.SensorType, sensorReadingButtplugMessage.Data);
			return;
		}
		if (message is EndpointReadingButtplugMessage endpointReadingButtplugMessage)
		{
			ButtplugDevice buttplugDevice4 = default(ButtplugDevice);
			if (!_devices.TryGetValue(endpointReadingButtplugMessage.DeviceIndex, ref buttplugDevice4))
			{
				throw new ButtplugException("Received endpoint reading for missing device");
			}
			buttplugDevice4.HandleSubscribeEndpointReading(endpointReadingButtplugMessage.Endpoint, endpointReadingButtplugMessage.Data);
			return;
		}
		if (message is ErrorButtplugMessage errorButtplugMessage)
		{
			if (errorButtplugMessage.ErrorCode == ErrorButtplugMessageCode.Ping)
			{
				throw new TimeoutException("Ping timeout", (global::System.Exception)new ButtplugException(errorButtplugMessage));
			}
			throw new ButtplugException(errorButtplugMessage);
		}
		throw new ButtplugException($"Unexpected message: {((MemberInfo)((object)message).GetType()).Name}({message.Id})");
	}
}
public interface IUnsafeButtplugDevice
{
	global::System.Collections.Generic.IReadOnlyList<string> ReadEndpoints { get; }

	global::System.Collections.Generic.IReadOnlyList<string> WriteEndpoints { get; }

	global::System.Collections.Generic.IReadOnlyList<string> SubscribeEndpoints { get; }

	global::System.Collections.Generic.IReadOnlyList<ButtplugDeviceEndpointSubscription> EndpointSubscriptions { get; }

	global::System.Threading.Tasks.Task EndpointWriteAsync(string endpoint, global::System.Collections.Generic.IEnumerable<byte> data, bool writeWithResponse, CancellationToken cancellationToken);

	global::System.Threading.Tasks.Task<ImmutableArray<byte>> EndpointReadAsync(string endpoint, uint expectedLength, bool waitForData, CancellationToken cancellationToken);

	global::System.Threading.Tasks.Task<ButtplugDeviceEndpointSubscription> EndpointSubscribeAsync(string endpoint, ButtplugDeviceEndpointSubscriptionReadingCallback readingCallback, CancellationToken cancellationToken);

	global::System.Threading.Tasks.Task EndpointUnsubscribeAsync(string endpoint, CancellationToken cancellationToken);
}
public class ButtplugDevice : IUnsafeButtplugDevice, IEquatable<ButtplugDevice>, global::System.IDisposable
{
	[CompilerGenerated]
	private sealed class <>c__DisplayClass69_0
	{
		public double scalar;

		public ActuatorType actuatorType;

		internal ScalarCommand <ScalarAsync>b__0(ButtplugDeviceScalarActuator a)
		{
			return new ScalarCommand(a.Index, scalar, actuatorType);
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass73_0
	{
		public double speed;

		public bool clockwise;

		internal RotateCommand <RotateAsync>b__0(ButtplugDeviceRotateActuator a)
		{
			return new RotateCommand(a.Index, speed, clockwise);
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass77_0
	{
		public uint duration;

		public double position;

		internal LinearCommand <LinearAsync>b__0(ButtplugDeviceLinearActuator a)
		{
			return new LinearCommand(a.Index, duration, position);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <Buttplug-IUnsafeButtplugDevice-EndpointReadAsync>d__92 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder<ImmutableArray<byte>> <>t__builder;

		public ButtplugDevice <>4__this;

		public string endpoint;

		public uint expectedLength;

		public bool waitForData;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter<EndpointReadingButtplugMessage> <>u__1;

		private void MoveNext()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_009b: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugDevice buttplugDevice = <>4__this;
			ImmutableArray<byte> data;
			try
			{
				ConfiguredTaskAwaiter<EndpointReadingButtplugMessage> awaiter;
				if (num != 0)
				{
					awaiter = buttplugDevice.SendMessageExpectTAsync<EndpointReadingButtplugMessage>(new EndpointReadCommandButtplugMessage(buttplugDevice.Index, endpoint, expectedLength, waitForData), cancellationToken).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<EndpointReadingButtplugMessage>, <Buttplug-IUnsafeButtplugDevice-EndpointReadAsync>d__92>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<EndpointReadingButtplugMessage>);
					num = (<>1__state = -1);
				}
				data = awaiter.GetResult().Data;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<>t__builder.SetResult(data);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <Buttplug-IUnsafeButtplugDevice-EndpointSubscribeAsync>d__93 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder<ButtplugDeviceEndpointSubscription> <>t__builder;

		public ButtplugDevice <>4__this;

		public string endpoint;

		public CancellationToken cancellationToken;

		public ButtplugDeviceEndpointSubscriptionReadingCallback readingCallback;

		private ConfiguredTaskAwaiter<OkButtplugMessage> <>u__1;

		private void MoveNext()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0070: 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)
			int num = <>1__state;
			ButtplugDevice buttplugDevice = <>4__this;
			ButtplugDeviceEndpointSubscription result;
			try
			{
				ConfiguredTaskAwaiter<OkButtplugMessage> awaiter;
				if (num != 0)
				{
					if (buttplugDevice._endpointSubscriptions.ContainsKey(endpoint))
					{
						throw new ButtplugException("Cannot subscribe to the same endpoint multiple times");
					}
					awaiter = buttplugDevice.SendMessageExpectTAsync<OkButtplugMessage>(new EndpointSubscribeCommandButtplugMessage(buttplugDevice.Index, endpoint), cancellationToken).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<OkButtplugMessage>, <Buttplug-IUnsafeButtplugDevice-EndpointSubscribeAsync>d__93>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<OkButtplugMessage>);
					num = (<>1__state = -1);
				}
				awaiter.GetResult();
				ButtplugDeviceEndpointSubscription buttplugDeviceEndpointSubscription = new ButtplugDeviceEndpointSubscription(buttplugDevice, endpoint, readingCallback);
				if (!buttplugDevice._endpointSubscriptions.TryAdd(endpoint, buttplugDeviceEndpointSubscription))
				{
					throw new ButtplugException("Cannot subscribe to the same endpoint multiple times");
				}
				result = buttplugDeviceEndpointSubscription;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<>t__builder.SetResult(result);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <Buttplug-IUnsafeButtplugDevice-EndpointUnsubscribeAsync>d__94 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public ButtplugDevice <>4__this;

		public string endpoint;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter<OkButtplugMessage> <>u__1;

		private void MoveNext()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_002f: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugDevice buttplugDevice = <>4__this;
			try
			{
				ConfiguredTaskAwaiter<OkButtplugMessage> awaiter;
				if (num != 0)
				{
					awaiter = buttplugDevice.SendMessageExpectTAsync<OkButtplugMessage>(new EndpointUnsubscribeCommandButtplugMessage(buttplugDevice.Index, endpoint), cancellationToken).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<OkButtplugMessage>, <Buttplug-IUnsafeButtplugDevice-EndpointUnsubscribeAsync>d__94>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<OkButtplugMessage>);
					num = (<>1__state = -1);
				}
				awaiter.GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <Buttplug-IUnsafeButtplugDevice-EndpointWriteAsync>d__91 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public ButtplugDevice <>4__this;

		public string endpoint;

		public global::System.Collections.Generic.IEnumerable<byte> data;

		public bool writeWithResponse;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter<OkButtplugMessage> <>u__1;

		private void MoveNext()
		{
			//IL_0073: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			int num = <>1__state;
			ButtplugDevice buttplugDevice = <>4__this;
			try
			{
				ConfiguredTaskAwaiter<OkButtplugMessage> awaiter;
				if (num != 0)
				{
					awaiter = buttplugDevice.SendMessageExpectTAsync<OkButtplugMessage>(new EndpointWriteCommandButtplugMessage(buttplugDevice.Index, endpoint, data, writeWithResponse), cancellationToken).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<OkButtplugMessage>, <Buttplug-IUnsafeButtplugDevice-EndpointWriteAsync>d__91>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<OkButtplugMessage>);
					num = (<>1__state = -1);
				}
				awaiter.GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <LinearAsync>d__77 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public uint duration;

		public double position;

		public ButtplugDevice <>4__this;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter <>u__1;

		private void MoveNext()
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugDevice buttplugDevice = <>4__this;
			try
			{
				ConfiguredTaskAwaiter awaiter;
				if (num != 0)
				{
					<>c__DisplayClass77_0 CS$<>8__locals0 = new <>c__DisplayClass77_0
					{
						duration = duration,
						position = position
					};
					ConfiguredTaskAwaitable val = buttplugDevice.LinearAsync(Enumerable.Select<ButtplugDeviceLinearActuator, LinearCommand>((global::System.Collections.Generic.IEnumerable<ButtplugDeviceLinearActuator>)buttplugDevice.LinearActuators, (Func<ButtplugDeviceLinearActuator, LinearCommand>)((ButtplugDeviceLinearActuator a) => new LinearCommand(a.Index, CS$<>8__locals0.duration, CS$<>8__locals0.position))), cancellationToken).ConfigureAwait(false);
					awaiter = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();
					if (!((ConfiguredTaskAwaiter)(ref awaiter)).IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <LinearAsync>d__77>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter);
					num = (<>1__state = -1);
				}
				((ConfiguredTaskAwaiter)(ref awaiter)).GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <LinearAsync>d__78 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public ButtplugDevice <>4__this;

		public uint actuatorIndex;

		public uint duration;

		public double position;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter <>u__1;

		private void MoveNext()
		{
			//IL_006d: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugDevice buttplugDevice = <>4__this;
			try
			{
				ConfiguredTaskAwaiter awaiter;
				if (num != 0)
				{
					ConfiguredTaskAwaitable val = buttplugDevice.LinearAsync(new LinearCommand(actuatorIndex, duration, position), cancellationToken).ConfigureAwait(false);
					awaiter = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();
					if (!((ConfiguredTaskAwaiter)(ref awaiter)).IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <LinearAsync>d__78>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter);
					num = (<>1__state = -1);
				}
				((ConfiguredTaskAwaiter)(ref awaiter)).GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <LinearAsync>d__79 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public ButtplugDevice <>4__this;

		public LinearCommand linearCommand;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter <>u__1;

		private void MoveNext()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugDevice buttplugDevice = <>4__this;
			try
			{
				ConfiguredTaskAwaiter awaiter;
				if (num != 0)
				{
					ConfiguredTaskAwaitable val = buttplugDevice.LinearAsync(new <>z__ReadOnlySingleElementList<LinearCommand>(linearCommand), cancellationToken).ConfigureAwait(false);
					awaiter = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();
					if (!((ConfiguredTaskAwaiter)(ref awaiter)).IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <LinearAsync>d__79>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter);
					num = (<>1__state = -1);
				}
				((ConfiguredTaskAwaiter)(ref awaiter)).GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <LinearAsync>d__80 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public ButtplugDevice <>4__this;

		public global::System.Collections.Generic.IEnumerable<LinearCommand> linearCommands;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter<OkButtplugMessage> <>u__1;

		private void MoveNext()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_002f: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugDevice buttplugDevice = <>4__this;
			try
			{
				ConfiguredTaskAwaiter<OkButtplugMessage> awaiter;
				if (num != 0)
				{
					awaiter = buttplugDevice.SendMessageExpectTAsync<OkButtplugMessage>(new LinearCommandButtplugMessage(buttplugDevice.Index, linearCommands), cancellationToken).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<OkButtplugMessage>, <LinearAsync>d__80>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<OkButtplugMessage>);
					num = (<>1__state = -1);
				}
				awaiter.GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <ReadSensorAsync>d__81 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder<ImmutableArray<int>> <>t__builder;

		public ButtplugDevice <>4__this;

		public SensorType sensorType;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter<ImmutableArray<int>> <>u__1;

		private void MoveNext()
		{
			//IL_0073: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_005c: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugDevice buttplugDevice = <>4__this;
			ImmutableArray<int> result;
			try
			{
				ConfiguredTaskAwaiter<ImmutableArray<int>> awaiter;
				if (num != 0)
				{
					awaiter = buttplugDevice.ReadSensorAsync(Enumerable.First<ButtplugDeviceReadSensor>(buttplugDevice.GetSensors<ButtplugDeviceReadSensor>(sensorType)).Index, sensorType, cancellationToken).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<ImmutableArray<int>>, <ReadSensorAsync>d__81>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<ImmutableArray<int>>);
					num = (<>1__state = -1);
				}
				result = awaiter.GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<>t__builder.SetResult(result);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <ReadSensorAsync>d__82 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder<ImmutableArray<int>> <>t__builder;

		public ButtplugDevice <>4__this;

		public uint sensorIndex;

		public SensorType sensorType;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter<SensorReadingButtplugMessage> <>u__1;

		private void MoveNext()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_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_0090: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugDevice buttplugDevice = <>4__this;
			ImmutableArray<int> data;
			try
			{
				ConfiguredTaskAwaiter<SensorReadingButtplugMessage> awaiter;
				if (num != 0)
				{
					awaiter = buttplugDevice.SendMessageExpectTAsync<SensorReadingButtplugMessage>(new SensorReadCommandButtplugMessage(buttplugDevice.Index, sensorIndex, sensorType), cancellationToken).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<SensorReadingButtplugMessage>, <ReadSensorAsync>d__82>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<SensorReadingButtplugMessage>);
					num = (<>1__state = -1);
				}
				data = awaiter.GetResult().Data;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<>t__builder.SetResult(data);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <RotateAsync>d__73 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public double speed;

		public bool clockwise;

		public ButtplugDevice <>4__this;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter <>u__1;

		private void MoveNext()
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			ButtplugDevice buttplugDevice = <>4__this;
			try
			{
				ConfiguredTaskAwaiter awaiter;
				if (num != 0)
				{
					<>c__DisplayClass73_0 CS$<>8__locals0 = new <>c__DisplayClass73_0
					{
						speed = speed,
						clockwise = clockwise
					};
					ConfiguredTaskAwaitable val = buttplugDevice.RotateAsync(Enumerable.Select<ButtplugDeviceRotateActuator, RotateCommand>((global::System.Collections.Generic.IEnumerable<ButtplugDeviceRotateActuator>)buttplugDevice.RotateActuators, (Func<ButtplugDeviceRotateActuator, RotateCommand>)((ButtplugDeviceRotateActuator a) => new RotateCommand(a.Index, CS$<>8__locals0.speed, CS$<>8__locals0.clockwise))), cancellationToken).ConfigureAwait(false);
					awaiter = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();
					if (!((ConfiguredTaskAwaiter)(ref awaiter)).IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <RotateAsync>d__73>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter);
					num = (<>1__state = -1);
				}
				((ConfiguredTaskAwaiter)(ref awaiter)).GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <RotateAsync>d__74 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		public ButtplugDevice <>4__this;

		public uint actuatorIndex;

		public double speed;

		public bool clockwise;

		public CancellationToken cancellationToken;

		private ConfiguredTaskAwaiter <>u__1;

		private void MoveNext()
		{
			//IL_006d: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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

GDWeave/mods/FishGoBrrr/Buttplug.Net.SystemTextJson.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("Yoooi")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © Yoooi 2023")]
[assembly: AssemblyDescription("System.Text.Json based converter for Buttplug.Net")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0-ci.94.8be7539+8be7539450ae54727802d192fe440545ca1644c8")]
[assembly: AssemblyProduct("Buttplug.Net.SystemTextJson")]
[assembly: AssemblyTitle("Buttplug.Net.SystemTextJson")]
[assembly: AssemblyMetadata("RepositoryUrl", "git://github.com/Yoooi0/Buttplug.Net")]
[assembly: InternalsVisibleTo("Buttplug.Net.SystemTextJson.Tests")]
[assembly: AssemblyVersion("0.1.0.0")]
[module: RefSafetyRules(11)]
namespace Buttplug.SystemTextJson;

public class ButtplugSystemTextJsonConverter : ButtplugMessageJsonConverter
{
	[CompilerGenerated]
	private sealed class <Deserialize>d__6 : global::System.Collections.Generic.IEnumerable<IButtplugMessage>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<IButtplugMessage>, global::System.Collections.IEnumerator, global::System.IDisposable
	{
		private int <>1__state;

		private IButtplugMessage <>2__current;

		private int <>l__initialThreadId;

		private string json;

		public string <>3__json;

		public ButtplugSystemTextJsonConverter <>4__this;

		private MemoryStream <stream>5__2;

		private global::System.Collections.Generic.IEnumerator<JsonObject> <>7__wrap2;

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

		object global::System.Collections.IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Deserialize>d__6(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if ((uint)(num - -4) > 1u && num != 1)
			{
				return;
			}
			try
			{
				if (num != -4 && num != 1)
				{
					return;
				}
				try
				{
				}
				finally
				{
					<>m__Finally2();
				}
			}
			finally
			{
				<>m__Finally1();
			}
		}

		private bool MoveNext()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			bool result;
			try
			{
				int num = <>1__state;
				ButtplugSystemTextJsonConverter buttplugSystemTextJsonConverter = <>4__this;
				if (num == 0)
				{
					<>1__state = -1;
					<stream>5__2 = new MemoryStream(Encoding.UTF8.GetBytes(json));
					<>1__state = -3;
					JsonNode obj = JsonNode.Parse((Stream)(object)<stream>5__2, buttplugSystemTextJsonConverter._nodeOptions, buttplugSystemTextJsonConverter._documentOptions.GetValueOrDefault());
					JsonArray val = ((obj != null) ? obj.AsArray() : null);
					if (val == null)
					{
						result = false;
						goto IL_0169;
					}
					<>7__wrap2 = Enumerable.Where<JsonObject>(Enumerable.Select<JsonNode, JsonObject>((global::System.Collections.Generic.IEnumerable<JsonNode>)val, (Func<JsonNode, JsonObject>)((JsonNode o) => (o == null) ? null : o.AsObject())), (Func<JsonObject, bool>)((JsonObject o) => o != null)).GetEnumerator();
					<>1__state = -4;
					goto IL_014d;
				}
				if (num == 1)
				{
					<>1__state = -4;
					goto IL_014d;
				}
				result = false;
				goto end_IL_0000;
				IL_0169:
				<>m__Finally1();
				goto end_IL_0000;
				IL_014d:
				string text = default(string);
				JsonNode val2 = default(JsonNode);
				while (true)
				{
					if (!((global::System.Collections.IEnumerator)<>7__wrap2).MoveNext())
					{
						<>m__Finally2();
						<>7__wrap2 = null;
						result = false;
						break;
					}
					Enumerable.FirstOrDefault<KeyValuePair<string, JsonNode>>((global::System.Collections.Generic.IEnumerable<KeyValuePair<string, JsonNode>>)<>7__wrap2.Current).Deconstruct(ref text, ref val2);
					string text2 = text;
					JsonNode obj2 = val2;
					JsonObject val3 = ((obj2 != null) ? obj2.AsObject() : null);
					if (obj2 == null)
					{
						continue;
					}
					global::System.Type messageType = ((ButtplugMessageJsonConverter)buttplugSystemTextJsonConverter).GetMessageType(text2);
					object obj3 = JsonSerializer.Deserialize((JsonNode)(object)val3, messageType, buttplugSystemTextJsonConverter._serializerOptions);
					IButtplugMessage val4 = (IButtplugMessage)((obj3 is IButtplugMessage) ? obj3 : null);
					if (val4 == null)
					{
						continue;
					}
					<>2__current = val4;
					<>1__state = 1;
					result = true;
					goto end_IL_0000;
				}
				goto IL_0169;
				end_IL_0000:;
			}
			catch
			{
				//try-fault
				((global::System.IDisposable)this).Dispose();
				throw;
			}
			return result;
		}

		bool global::System.Collections.IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<stream>5__2 != null)
			{
				((global::System.IDisposable)<stream>5__2).Dispose();
			}
		}

		private void <>m__Finally2()
		{
			<>1__state = -3;
			if (<>7__wrap2 != null)
			{
				((global::System.IDisposable)<>7__wrap2).Dispose();
			}
		}

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

		[DebuggerHidden]
		global::System.Collections.Generic.IEnumerator<IButtplugMessage> global::System.Collections.Generic.IEnumerable<IButtplugMessage>.GetEnumerator()
		{
			<Deserialize>d__6 <Deserialize>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Deserialize>d__ = this;
			}
			else
			{
				<Deserialize>d__ = new <Deserialize>d__6(0)
				{
					<>4__this = <>4__this
				};
			}
			<Deserialize>d__.json = <>3__json;
			return <Deserialize>d__;
		}

		[DebuggerHidden]
		global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
		{
			return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<IButtplugMessage>)this).GetEnumerator();
		}
	}

	private readonly JsonSerializerOptions? _serializerOptions;

	private readonly JsonNodeOptions? _nodeOptions;

	private readonly JsonDocumentOptions? _documentOptions;

	public ButtplugSystemTextJsonConverter(JsonSerializerOptions? serializerOptions = null, JsonNodeOptions? nodeOptions = null, JsonDocumentOptions? documentOptions = null)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Expected O, but got Unknown
		_serializerOptions = (JsonSerializerOptions?)(((object)serializerOptions) ?? ((object)new JsonSerializerOptions(JsonSerializerOptions.Default)));
		_nodeOptions = nodeOptions;
		_documentOptions = documentOptions;
		if (!Enumerable.Any<JsonStringEnumConverter>(Enumerable.OfType<JsonStringEnumConverter>((global::System.Collections.IEnumerable)_serializerOptions.Converters)))
		{
			((global::System.Collections.Generic.ICollection<JsonConverter>)_serializerOptions.Converters).Add((JsonConverter)new JsonStringEnumConverter());
		}
	}

	public override string Serialize(IButtplugMessage message)
	{
		return ((ButtplugMessageJsonConverter)this).Serialize((global::System.Collections.Generic.IEnumerable<IButtplugMessage>)new <>z__ReadOnlySingleElementList<IButtplugMessage>(message));
	}

	public override string Serialize(global::System.Collections.Generic.IEnumerable<IButtplugMessage> messages)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		JsonArray val = new JsonArray(_nodeOptions);
		global::System.Collections.Generic.IEnumerator<JsonObject> enumerator = Enumerable.Select<IButtplugMessage, JsonObject>(messages, (Func<IButtplugMessage, JsonObject>)ToJsonObject).GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				JsonObject current = enumerator.Current;
				val.Add<JsonObject>(current);
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
		return JsonSerializer.Serialize<JsonArray>(val, _serializerOptions);
		[CompilerGenerated]
		JsonObject ToJsonObject(IButtplugMessage message)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			return new JsonObject((JsonNodeOptions?)null) { [((ButtplugMessageJsonConverter)this).GetMessageName(message)] = JsonSerializer.SerializeToNode((object)message, ((object)message).GetType(), _serializerOptions) };
		}
	}

	[IteratorStateMachine(typeof(<Deserialize>d__6))]
	public override global::System.Collections.Generic.IEnumerable<IButtplugMessage> Deserialize(string json)
	{
		MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(json));
		try
		{
			JsonNode obj = JsonNode.Parse((Stream)(object)stream, _nodeOptions, _documentOptions.GetValueOrDefault());
			JsonArray val = ((obj != null) ? obj.AsArray() : null);
			if (val == null)
			{
				yield break;
			}
			global::System.Collections.Generic.IEnumerator<JsonObject> enumerator = Enumerable.Where<JsonObject>(Enumerable.Select<JsonNode, JsonObject>((global::System.Collections.Generic.IEnumerable<JsonNode>)val, (Func<JsonNode, JsonObject>)((JsonNode o) => (o == null) ? null : o.AsObject())), (Func<JsonObject, bool>)((JsonObject o) => o != null)).GetEnumerator();
			try
			{
				string text = default(string);
				JsonNode val2 = default(JsonNode);
				while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
				{
					Enumerable.FirstOrDefault<KeyValuePair<string, JsonNode>>((global::System.Collections.Generic.IEnumerable<KeyValuePair<string, JsonNode>>)enumerator.Current).Deconstruct(ref text, ref val2);
					string text2 = text;
					JsonNode obj2 = val2;
					JsonObject val3 = ((obj2 != null) ? obj2.AsObject() : null);
					if (obj2 != null)
					{
						global::System.Type messageType = ((ButtplugMessageJsonConverter)this).GetMessageType(text2);
						object obj3 = JsonSerializer.Deserialize((JsonNode)(object)val3, messageType, _serializerOptions);
						IButtplugMessage val4 = (IButtplugMessage)((obj3 is IButtplugMessage) ? obj3 : null);
						if (val4 != null)
						{
							yield return val4;
						}
					}
				}
			}
			finally
			{
				((global::System.IDisposable)enumerator)?.Dispose();
			}
		}
		finally
		{
			((global::System.IDisposable)stream)?.Dispose();
		}
	}
}
internal sealed class <>z__ReadOnlySingleElementList<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>
{
	private sealed class Enumerator : global::System.IDisposable, global::System.Collections.IEnumerator, global::System.Collections.Generic.IEnumerator<T>
	{
		object global::System.Collections.IEnumerator.Current => _item;

		T global::System.Collections.Generic.IEnumerator<T>.Current => _item;

		public Enumerator(T item)
		{
			_item = item;
		}

		bool global::System.Collections.IEnumerator.MoveNext()
		{
			if (!_moveNextCalled)
			{
				return _moveNextCalled = true;
			}
			return false;
		}

		void global::System.Collections.IEnumerator.Reset()
		{
			_moveNextCalled = false;
		}

		void global::System.IDisposable.Dispose()
		{
		}
	}

	int global::System.Collections.ICollection.Count => 1;

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

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

	object global::System.Collections.IList.this[int index]
	{
		get
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		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 => 1;

	T global::System.Collections.Generic.IReadOnlyList<T>.this[int index]
	{
		get
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
	}

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

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

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

	public <>z__ReadOnlySingleElementList(T item)
	{
		_item = item;
	}

	global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void global::System.Collections.ICollection.CopyTo(global::System.Array array, int index)
	{
		array.SetValue((object)_item, 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 EqualityComparer<T>.Default.Equals(_item, (T)value);
	}

	int global::System.Collections.IList.IndexOf(object? value)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, (T)value))
		{
			return -1;
		}
		return 0;
	}

	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 new Enumerator(_item);
	}

	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 EqualityComparer<T>.Default.Equals(_item, item);
	}

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

	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)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, item))
		{
			return -1;
		}
		return 0;
	}

	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();
	}
}

GDWeave/mods/FishGoBrrr/FishGoBrrr.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Buttplug;
using Buttplug.SystemTextJson;
using FishGoBrrr.Patches;
using GDWeave;
using GDWeave.Godot;
using GDWeave.Godot.Variants;
using GDWeave.Modding;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("FishGoBrrr")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0+abd4a0d3d59d678c7643dc797daecb342612557f")]
[assembly: AssemblyProduct("FishGoBrrr")]
[assembly: AssemblyTitle("FishGoBrrr")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace FishGoBrrr
{
	public class Bridge
	{
		[CompilerGenerated]
		private sealed class <HandleClient>d__5 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncVoidMethodBuilder <>t__builder;

			public TcpClient client;

			public Bridge <>4__this;

			private TcpClient <>s__1;

			private NetworkStream <stream>5__2;

			private byte[] <buffer>5__3;

			private int <bytesRead>5__4;

			private string <clientMessage>5__5;

			private int <>s__6;

			private BridgeMessage <message>5__7;

			private global::System.Exception <e>5__8;

			private ValueTaskAwaiter<int> <>u__1;

			private void MoveNext()
			{
				//IL_006c: 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_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				try
				{
					if (num != 0)
					{
						Mod.LogInformation("Client connected to bridge!");
						<>s__1 = client;
					}
					try
					{
						if (num != 0)
						{
							<stream>5__2 = client.GetStream();
							<buffer>5__3 = new byte[1024];
							goto IL_017c;
						}
						ValueTaskAwaiter<int> awaiter = <>u__1;
						<>u__1 = default(ValueTaskAwaiter<int>);
						num = (<>1__state = -1);
						goto IL_00ce;
						IL_0174:
						<clientMessage>5__5 = null;
						goto IL_017c;
						IL_017c:
						if (client.Connected)
						{
							awaiter = ((Stream)<stream>5__2).ReadAsync(global::System.Memory<byte>.op_Implicit(<buffer>5__3), default(CancellationToken)).GetAwaiter();
							if (!awaiter.IsCompleted)
							{
								num = (<>1__state = 0);
								<>u__1 = awaiter;
								<HandleClient>d__5 <HandleClient>d__ = this;
								((AsyncVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ValueTaskAwaiter<int>, <HandleClient>d__5>(ref awaiter, ref <HandleClient>d__);
								return;
							}
							goto IL_00ce;
						}
						<stream>5__2 = null;
						<buffer>5__3 = null;
						goto end_IL_0027;
						IL_00ce:
						<>s__6 = awaiter.GetResult();
						<bytesRead>5__4 = <>s__6;
						<clientMessage>5__5 = Encoding.UTF8.GetString(<buffer>5__3, 0, <bytesRead>5__4);
						try
						{
							<message>5__7 = JsonSerializer.Deserialize<BridgeMessage>(<clientMessage>5__5, (JsonSerializerOptions)null);
							if (<message>5__7 != null)
							{
								<>4__this.HandleMessage(<message>5__7);
								<message>5__7 = null;
								goto IL_0174;
							}
							Mod.LogInformation("Received null message");
						}
						catch (global::System.Exception ex)
						{
							<e>5__8 = ex;
							Mod.LogInformation("Received message error: " + <clientMessage>5__5);
							goto IL_0174;
						}
						goto IL_017c;
						end_IL_0027:;
					}
					finally
					{
						if (num < 0 && <>s__1 != null)
						{
							((global::System.IDisposable)<>s__1).Dispose();
						}
					}
					<>s__1 = null;
				}
				catch (global::System.Exception ex)
				{
					<>1__state = -2;
					((AsyncVoidMethodBuilder)(ref <>t__builder)).SetException(ex);
					return;
				}
				<>1__state = -2;
				((AsyncVoidMethodBuilder)(ref <>t__builder)).SetResult();
			}

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

		[CompilerGenerated]
		private sealed class <HandleMessage>d__6 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncVoidMethodBuilder <>t__builder;

			public BridgeMessage message;

			public Bridge <>4__this;

			private ButtAction <>s__1;

			private TaskAwaiter <>u__1;

			private void MoveNext()
			{
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0158: Unknown result type (might be due to invalid IL or missing references)
				//IL_015d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0165: Unknown result type (might be due to invalid IL or missing references)
				//IL_01df: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_0263: Unknown result type (might be due to invalid IL or missing references)
				//IL_0268: Unknown result type (might be due to invalid IL or missing references)
				//IL_0270: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: 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)
				//IL_0123: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_022c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_013a: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0246: Unknown result type (might be due to invalid IL or missing references)
				//IL_0248: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				try
				{
					TaskAwaiter awaiter4;
					TaskAwaiter awaiter3;
					TaskAwaiter awaiter2;
					TaskAwaiter awaiter;
					switch (num)
					{
					default:
						if (<>4__this.Client.IsConnected)
						{
							ButtAction action = message.Action;
							<>s__1 = action;
							switch (<>s__1)
							{
							case ButtAction.Vibrate:
								break;
							case ButtAction.StopAll:
								goto IL_010e;
							case ButtAction.Hover:
								goto IL_0181;
							case ButtAction.Click:
								goto IL_0208;
							default:
								Mod.LogInformation("Received invalid message");
								goto end_IL_0007;
							}
							awaiter4 = <>4__this.Client.Vibrate(message.Value, message.Duration).GetAwaiter();
							if (!((TaskAwaiter)(ref awaiter4)).IsCompleted)
							{
								num = (<>1__state = 0);
								<>u__1 = awaiter4;
								<HandleMessage>d__6 <HandleMessage>d__ = this;
								((AsyncVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <HandleMessage>d__6>(ref awaiter4, ref <HandleMessage>d__);
								return;
							}
							goto IL_0101;
						}
						goto end_IL_0007;
					case 0:
						awaiter4 = <>u__1;
						<>u__1 = default(TaskAwaiter);
						num = (<>1__state = -1);
						goto IL_0101;
					case 1:
						awaiter3 = <>u__1;
						<>u__1 = default(TaskAwaiter);
						num = (<>1__state = -1);
						goto IL_0174;
					case 2:
						awaiter2 = <>u__1;
						<>u__1 = default(TaskAwaiter);
						num = (<>1__state = -1);
						goto IL_01fb;
					case 3:
						{
							awaiter = <>u__1;
							<>u__1 = default(TaskAwaiter);
							num = (<>1__state = -1);
							break;
						}
						IL_010e:
						awaiter3 = <>4__this.Client.StopAll().GetAwaiter();
						if (!((TaskAwaiter)(ref awaiter3)).IsCompleted)
						{
							num = (<>1__state = 1);
							<>u__1 = awaiter3;
							<HandleMessage>d__6 <HandleMessage>d__ = this;
							((AsyncVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <HandleMessage>d__6>(ref awaiter3, ref <HandleMessage>d__);
							return;
						}
						goto IL_0174;
						IL_0208:
						awaiter = <>4__this.Client.Vibrate(Mod.Config.UiClickVibrate, Mod.Config.UiClickDuration).GetAwaiter();
						if (!((TaskAwaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 3);
							<>u__1 = awaiter;
							<HandleMessage>d__6 <HandleMessage>d__ = this;
							((AsyncVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <HandleMessage>d__6>(ref awaiter, ref <HandleMessage>d__);
							return;
						}
						break;
						IL_0101:
						((TaskAwaiter)(ref awaiter4)).GetResult();
						goto end_IL_0007;
						IL_0181:
						awaiter2 = <>4__this.Client.Vibrate(Mod.Config.UiHoverVibrate, Mod.Config.UiHoverDuration).GetAwaiter();
						if (!((TaskAwaiter)(ref awaiter2)).IsCompleted)
						{
							num = (<>1__state = 2);
							<>u__1 = awaiter2;
							<HandleMessage>d__6 <HandleMessage>d__ = this;
							((AsyncVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <HandleMessage>d__6>(ref awaiter2, ref <HandleMessage>d__);
							return;
						}
						goto IL_01fb;
						IL_0174:
						((TaskAwaiter)(ref awaiter3)).GetResult();
						goto end_IL_0007;
						IL_01fb:
						((TaskAwaiter)(ref awaiter2)).GetResult();
						goto end_IL_0007;
					}
					((TaskAwaiter)(ref awaiter)).GetResult();
					end_IL_0007:;
				}
				catch (global::System.Exception exception)
				{
					<>1__state = -2;
					((AsyncVoidMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((AsyncVoidMethodBuilder)(ref <>t__builder)).SetResult();
			}

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

		[CompilerGenerated]
		private sealed class <Run>d__4 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncVoidMethodBuilder <>t__builder;

			public Bridge <>4__this;

			private TcpClient <client>5__1;

			private TcpClient <>s__2;

			private TaskAwaiter<TcpClient> <>u__1;

			private void MoveNext()
			{
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				try
				{
					TaskAwaiter<TcpClient> awaiter;
					if (num != 0)
					{
						Mod.LogInformation("Starting bridge");
						<>4__this._tcpListener.Start();
						Mod.LogInformation("Bridge started");
						awaiter = <>4__this._tcpListener.AcceptTcpClientAsync().GetAwaiter();
						if (!awaiter.IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							<Run>d__4 <Run>d__ = this;
							((AsyncVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter<TcpClient>, <Run>d__4>(ref awaiter, ref <Run>d__);
							return;
						}
					}
					else
					{
						awaiter = <>u__1;
						<>u__1 = default(TaskAwaiter<TcpClient>);
						num = (<>1__state = -1);
					}
					<>s__2 = awaiter.GetResult();
					<client>5__1 = <>s__2;
					<>s__2 = null;
					Mod.LogInformation("Client connected");
					<>4__this.HandleClient(<client>5__1);
				}
				catch (global::System.Exception exception)
				{
					<>1__state = -2;
					<client>5__1 = null;
					((AsyncVoidMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				<client>5__1 = null;
				((AsyncVoidMethodBuilder)(ref <>t__builder)).SetResult();
			}

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

		private readonly TcpListener _tcpListener = new TcpListener(IPAddress.Parse("127.0.0.1"), 7345);

		private ButtClient Client => Mod.ButtClient;

		public Bridge()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			Run();
		}

		[AsyncStateMachine(typeof(<Run>d__4))]
		[DebuggerStepThrough]
		private void Run()
		{
			//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)
			<Run>d__4 <Run>d__ = new <Run>d__4();
			<Run>d__.<>t__builder = AsyncVoidMethodBuilder.Create();
			<Run>d__.<>4__this = this;
			<Run>d__.<>1__state = -1;
			((AsyncVoidMethodBuilder)(ref <Run>d__.<>t__builder)).Start<<Run>d__4>(ref <Run>d__);
		}

		[AsyncStateMachine(typeof(<HandleClient>d__5))]
		[DebuggerStepThrough]
		private void HandleClient(TcpClient client)
		{
			//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)
			<HandleClient>d__5 <HandleClient>d__ = new <HandleClient>d__5();
			<HandleClient>d__.<>t__builder = AsyncVoidMethodBuilder.Create();
			<HandleClient>d__.<>4__this = this;
			<HandleClient>d__.client = client;
			<HandleClient>d__.<>1__state = -1;
			((AsyncVoidMethodBuilder)(ref <HandleClient>d__.<>t__builder)).Start<<HandleClient>d__5>(ref <HandleClient>d__);
		}

		[AsyncStateMachine(typeof(<HandleMessage>d__6))]
		[DebuggerStepThrough]
		private void HandleMessage(BridgeMessage message)
		{
			//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)
			<HandleMessage>d__6 <HandleMessage>d__ = new <HandleMessage>d__6();
			<HandleMessage>d__.<>t__builder = AsyncVoidMethodBuilder.Create();
			<HandleMessage>d__.<>4__this = this;
			<HandleMessage>d__.message = message;
			<HandleMessage>d__.<>1__state = -1;
			((AsyncVoidMethodBuilder)(ref <HandleMessage>d__.<>t__builder)).Start<<HandleMessage>d__6>(ref <HandleMessage>d__);
		}
	}
	public enum ButtAction
	{
		Vibrate,
		StopAll,
		Hover,
		Click
	}
	[Serializable]
	public class BridgeMessage
	{
		[field: CompilerGenerated]
		[field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		public ButtAction Action
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		[field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		public double Value
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		[field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		public double Duration
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}
	}
	public class ButtClient
	{
		[CompilerGenerated]
		private sealed class <Setup>d__6 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncTaskMethodBuilder <>t__builder;

			public ButtClient <>4__this;

			private TaskAwaiter <>u__1;

			private void MoveNext()
			{
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: 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)
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: Unknown result type (might be due to invalid IL or missing references)
				//IL_014d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0152: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: 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_009f: Expected O, but got Unknown
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				try
				{
					TaskAwaiter awaiter;
					TaskAwaiter awaiter2;
					if (num != 0)
					{
						if (num == 1)
						{
							awaiter = <>u__1;
							<>u__1 = default(TaskAwaiter);
							num = (<>1__state = -1);
							goto IL_0168;
						}
						<>4__this._buttplugClient.DeviceAdded += <>4__this.HandleDeviceAdded;
						<>4__this._buttplugClient.DeviceRemoved += <>4__this.HandleDeviceRemoved;
						Mod.LogInformation("Connecting to Intiface at " + Mod.Config.URL);
						awaiter2 = <>4__this._buttplugClient.ConnectAsync(new Uri(Mod.Config.URL), CancellationToken).GetAwaiter();
						if (!((TaskAwaiter)(ref awaiter2)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter2;
							<Setup>d__6 <Setup>d__ = this;
							((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <Setup>d__6>(ref awaiter2, ref <Setup>d__);
							return;
						}
					}
					else
					{
						awaiter2 = <>u__1;
						<>u__1 = default(TaskAwaiter);
						num = (<>1__state = -1);
					}
					((TaskAwaiter)(ref awaiter2)).GetResult();
					Mod.LogInformation("Connected to Intiface!");
					awaiter = <>4__this._buttplugClient.StartScanningAsync(CancellationToken).GetAwaiter();
					if (!((TaskAwaiter)(ref awaiter)).IsCompleted)
					{
						num = (<>1__state = 1);
						<>u__1 = awaiter;
						<Setup>d__6 <Setup>d__ = this;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <Setup>d__6>(ref awaiter, ref <Setup>d__);
						return;
					}
					goto IL_0168;
					IL_0168:
					((TaskAwaiter)(ref awaiter)).GetResult();
				}
				catch (global::System.Exception exception)
				{
					<>1__state = -2;
					((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

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

		[CompilerGenerated]
		private sealed class <StopAll>d__11 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncTaskMethodBuilder <>t__builder;

			public ButtClient <>4__this;

			private TaskAwaiter <>u__1;

			private void MoveNext()
			{
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: 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_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				try
				{
					TaskAwaiter awaiter;
					if (num == 0)
					{
						awaiter = <>u__1;
						<>u__1 = default(TaskAwaiter);
						num = (<>1__state = -1);
						goto IL_008f;
					}
					if (<>4__this._buttplugClient.IsConnected)
					{
						awaiter = <>4__this._buttplugClient.StopAllDevicesAsync(CancellationToken).GetAwaiter();
						if (!((TaskAwaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							<StopAll>d__11 <StopAll>d__ = this;
							((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <StopAll>d__11>(ref awaiter, ref <StopAll>d__);
							return;
						}
						goto IL_008f;
					}
					goto end_IL_0007;
					IL_008f:
					((TaskAwaiter)(ref awaiter)).GetResult();
					end_IL_0007:;
				}
				catch (global::System.Exception exception)
				{
					<>1__state = -2;
					((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

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

		[CompilerGenerated]
		private sealed class <StopAllIn>d__9 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncTaskMethodBuilder <>t__builder;

			public double seconds;

			public ButtClient <>4__this;

			private TaskAwaiter <>u__1;

			private void MoveNext()
			{
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: 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_011b: 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_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				try
				{
					TaskAwaiter awaiter;
					if (num == 0)
					{
						awaiter = <>u__1;
						<>u__1 = default(TaskAwaiter);
						num = (<>1__state = -1);
						goto IL_00c4;
					}
					TaskAwaiter awaiter2;
					if (num == 1)
					{
						awaiter2 = <>u__1;
						<>u__1 = default(TaskAwaiter);
						num = (<>1__state = -1);
						goto IL_012a;
					}
					if (<>4__this._buttplugClient.IsConnected && !(seconds <= 0.0))
					{
						awaiter = global::System.Threading.Tasks.Task.Delay((int)(seconds * 1000.0), CancellationToken).GetAwaiter();
						if (!((TaskAwaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							<StopAllIn>d__9 <StopAllIn>d__ = this;
							((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <StopAllIn>d__9>(ref awaiter, ref <StopAllIn>d__);
							return;
						}
						goto IL_00c4;
					}
					goto end_IL_0007;
					IL_00c4:
					((TaskAwaiter)(ref awaiter)).GetResult();
					awaiter2 = <>4__this.StopAll().GetAwaiter();
					if (!((TaskAwaiter)(ref awaiter2)).IsCompleted)
					{
						num = (<>1__state = 1);
						<>u__1 = awaiter2;
						<StopAllIn>d__9 <StopAllIn>d__ = this;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <StopAllIn>d__9>(ref awaiter2, ref <StopAllIn>d__);
						return;
					}
					goto IL_012a;
					IL_012a:
					((TaskAwaiter)(ref awaiter2)).GetResult();
					end_IL_0007:;
				}
				catch (global::System.Exception exception)
				{
					<>1__state = -2;
					((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

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

		[CompilerGenerated]
		private sealed class <Vibrate>d__10 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncTaskMethodBuilder <>t__builder;

			public double scalar;

			public double time;

			public ButtClient <>4__this;

			private global::System.Collections.Generic.IEnumerator<ButtplugDevice> <>s__1;

			private ButtplugDevice <device>5__2;

			private TaskAwaiter <>u__1;

			private void MoveNext()
			{
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: 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_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				try
				{
					if (num == 0)
					{
						goto IL_0062;
					}
					if (<>4__this._buttplugClient.IsConnected && !(scalar < 0.01))
					{
						<>s__1 = ((global::System.Collections.Generic.IEnumerable<ButtplugDevice>)<>4__this._buttplugClient.Devices).GetEnumerator();
						goto IL_0062;
					}
					goto end_IL_0007;
					IL_0062:
					try
					{
						if (num != 0)
						{
							goto IL_00f8;
						}
						TaskAwaiter awaiter = <>u__1;
						<>u__1 = default(TaskAwaiter);
						num = (<>1__state = -1);
						goto IL_00e9;
						IL_00f8:
						if (((global::System.Collections.IEnumerator)<>s__1).MoveNext())
						{
							<device>5__2 = <>s__1.Current;
							awaiter = <device>5__2.ScalarAsync(scalar, (ActuatorType)1, CancellationToken).GetAwaiter();
							if (!((TaskAwaiter)(ref awaiter)).IsCompleted)
							{
								num = (<>1__state = 0);
								<>u__1 = awaiter;
								<Vibrate>d__10 <Vibrate>d__ = this;
								((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <Vibrate>d__10>(ref awaiter, ref <Vibrate>d__);
								return;
							}
							goto IL_00e9;
						}
						goto end_IL_0062;
						IL_00e9:
						((TaskAwaiter)(ref awaiter)).GetResult();
						<device>5__2 = null;
						goto IL_00f8;
						end_IL_0062:;
					}
					finally
					{
						if (num < 0 && <>s__1 != null)
						{
							((global::System.IDisposable)<>s__1).Dispose();
						}
					}
					<>s__1 = null;
					<>4__this.StopAllIn(time);
					end_IL_0007:;
				}
				catch (global::System.Exception exception)
				{
					<>1__state = -2;
					((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

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

		private static readonly CancellationToken CancellationToken = CancellationToken.None;

		private readonly ButtplugSystemTextJsonConverter _converter = new ButtplugSystemTextJsonConverter((JsonSerializerOptions)null, (JsonNodeOptions?)null, (JsonDocumentOptions?)null);

		private readonly ButtplugClient _buttplugClient;

		public bool IsConnected => _buttplugClient.IsConnected;

		public ButtClient()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			_buttplugClient = new ButtplugClient("WebFishing", (IButtplugMessageJsonConverter)(object)_converter);
			Setup();
		}

		[AsyncStateMachine(typeof(<Setup>d__6))]
		[DebuggerStepThrough]
		private global::System.Threading.Tasks.Task Setup()
		{
			//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)
			<Setup>d__6 <Setup>d__ = new <Setup>d__6();
			<Setup>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
			<Setup>d__.<>4__this = this;
			<Setup>d__.<>1__state = -1;
			((AsyncTaskMethodBuilder)(ref <Setup>d__.<>t__builder)).Start<<Setup>d__6>(ref <Setup>d__);
			return ((AsyncTaskMethodBuilder)(ref <Setup>d__.<>t__builder)).Task;
		}

		private void HandleDeviceAdded(object? sender, ButtplugDevice buttplugDevice)
		{
			Mod.Interface.Logger.Information($"Device Added: {buttplugDevice}");
		}

		private void HandleDeviceRemoved(object? sender, ButtplugDevice buttplugDevice)
		{
			Mod.Interface.Logger.Information($"Device Removed: {buttplugDevice}");
		}

		[AsyncStateMachine(typeof(<StopAllIn>d__9))]
		[DebuggerStepThrough]
		public global::System.Threading.Tasks.Task StopAllIn(double seconds)
		{
			//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)
			<StopAllIn>d__9 <StopAllIn>d__ = new <StopAllIn>d__9();
			<StopAllIn>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
			<StopAllIn>d__.<>4__this = this;
			<StopAllIn>d__.seconds = seconds;
			<StopAllIn>d__.<>1__state = -1;
			((AsyncTaskMethodBuilder)(ref <StopAllIn>d__.<>t__builder)).Start<<StopAllIn>d__9>(ref <StopAllIn>d__);
			return ((AsyncTaskMethodBuilder)(ref <StopAllIn>d__.<>t__builder)).Task;
		}

		[AsyncStateMachine(typeof(<Vibrate>d__10))]
		[DebuggerStepThrough]
		public global::System.Threading.Tasks.Task Vibrate(double scalar, double time)
		{
			//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)
			<Vibrate>d__10 <Vibrate>d__ = new <Vibrate>d__10();
			<Vibrate>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
			<Vibrate>d__.<>4__this = this;
			<Vibrate>d__.scalar = scalar;
			<Vibrate>d__.time = time;
			<Vibrate>d__.<>1__state = -1;
			((AsyncTaskMethodBuilder)(ref <Vibrate>d__.<>t__builder)).Start<<Vibrate>d__10>(ref <Vibrate>d__);
			return ((AsyncTaskMethodBuilder)(ref <Vibrate>d__.<>t__builder)).Task;
		}

		[AsyncStateMachine(typeof(<StopAll>d__11))]
		[DebuggerStepThrough]
		public global::System.Threading.Tasks.Task StopAll()
		{
			//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)
			<StopAll>d__11 <StopAll>d__ = new <StopAll>d__11();
			<StopAll>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
			<StopAll>d__.<>4__this = this;
			<StopAll>d__.<>1__state = -1;
			((AsyncTaskMethodBuilder)(ref <StopAll>d__.<>t__builder)).Start<<StopAll>d__11>(ref <StopAll>d__);
			return ((AsyncTaskMethodBuilder)(ref <StopAll>d__.<>t__builder)).Task;
		}
	}
	public class Config
	{
		[JsonInclude]
		public string URL = "ws://127.0.0.1:12345";

		[JsonInclude]
		public double UiHoverVibrate = 0.075;

		[JsonInclude]
		public double UiHoverDuration = 0.075;

		[JsonInclude]
		public double UiClickVibrate = 0.1;

		[JsonInclude]
		public double UiClickDuration = 0.1;

		[JsonInclude]
		public double JumpVibrate = 0.1;

		[JsonInclude]
		public double JumpDuration = 0.1;

		[JsonInclude]
		public double MushroomVibrate = 0.5;

		[JsonInclude]
		public double MushroomDuration = 0.2;

		[JsonInclude]
		public double DieVibrate = 0.5;

		[JsonInclude]
		public double DieDuration = 0.2;

		[JsonInclude]
		public double ChalkVibrate = 0.01;

		[JsonInclude]
		public double PunchedVibrate = 0.5;

		[JsonInclude]
		public double PunchedDuration = 0.2;

		[JsonInclude]
		public double ScratchGamblingVibrate = 0.002;

		[JsonInclude]
		public double WinGamblingVibrate = 0.5;

		[JsonInclude]
		public double WinGamblingDuration = 0.2;

		[JsonInclude]
		public double LoseGamblingVibrate = 0.1;

		[JsonInclude]
		public double LoseGamblingDuration = 0.3;

		[JsonInclude]
		public double BiteVibrate = 0.5;

		[JsonInclude]
		public double BiteDuration = 0.3;

		[JsonInclude]
		public double MashVibrate = 0.1;

		[JsonInclude]
		public double BadProgressVibrate = 0.005;
	}
	public static class Helpers
	{
		[CompilerGenerated]
		private sealed class <GetMain>d__1 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
		{
			private int <>1__state;

			private Token <>2__current;

			private int <>l__initialThreadId;

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

			object global::System.Collections.IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetMain>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void global::System.IDisposable.Dispose()
			{
			}

			private bool MoveNext()
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Expected O, but got Unknown
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Expected O, but got Unknown
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Expected O, but got Unknown
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Expected O, but got Unknown
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (Token)new IdentifierToken("get_node");
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = new Token((TokenType)80, (uint?)null);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = (Token)new ConstantToken((Variant)new StringVariant("/root/deltaneverusedfishgobrrr"));
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>2__current = new Token((TokenType)81, (uint?)null);
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -1;
					return false;
				}
			}

			bool global::System.Collections.IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

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

			[DebuggerHidden]
			global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
			{
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					return this;
				}
				return new <GetMain>d__1(0);
			}

			[DebuggerHidden]
			global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
			{
				return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
			}
		}

		[CompilerGenerated]
		private sealed class <VibrateConstants>d__0 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
		{
			private int <>1__state;

			private Token <>2__current;

			private int <>l__initialThreadId;

			private double scaler;

			public double <>3__scaler;

			private double duration;

			public double <>3__duration;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__1;

			private Token <token>5__2;

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

			object global::System.Collections.IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <VibrateConstants>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void global::System.IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num != -3 && num != 1)
				{
					return;
				}
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}

			private bool MoveNext()
			{
				//IL_010a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Expected O, but got Unknown
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_013f: Expected O, but got Unknown
				//IL_015c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0166: Expected O, but got Unknown
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_016b: Expected O, but got Unknown
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0196: Expected O, but got Unknown
				//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ba: Expected O, but got Unknown
				//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bf: Expected O, but got Unknown
				//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e7: Expected O, but got Unknown
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ef: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>s__1 = GetMain().GetEnumerator();
						<>1__state = -3;
						goto IL_00be;
					case 1:
						<>1__state = -3;
						<token>5__2 = null;
						goto IL_00be;
					case 2:
						<>1__state = -1;
						<>2__current = (Token)new IdentifierToken("vibrate");
						<>1__state = 3;
						return true;
					case 3:
						<>1__state = -1;
						<>2__current = new Token((TokenType)80, (uint?)null);
						<>1__state = 4;
						return true;
					case 4:
						<>1__state = -1;
						<>2__current = (Token)new ConstantToken((Variant)new RealVariant(scaler, false));
						<>1__state = 5;
						return true;
					case 5:
						<>1__state = -1;
						<>2__current = new Token((TokenType)82, (uint?)null);
						<>1__state = 6;
						return true;
					case 6:
						<>1__state = -1;
						<>2__current = (Token)new ConstantToken((Variant)new RealVariant(duration, false));
						<>1__state = 7;
						return true;
					case 7:
						<>1__state = -1;
						<>2__current = new Token((TokenType)81, (uint?)null);
						<>1__state = 8;
						return true;
					case 8:
						{
							<>1__state = -1;
							return false;
						}
						IL_00be:
						if (((global::System.Collections.IEnumerator)<>s__1).MoveNext())
						{
							<token>5__2 = <>s__1.Current;
							<>2__current = <token>5__2;
							<>1__state = 1;
							return true;
						}
						<>m__Finally1();
						<>s__1 = null;
						<>2__current = new Token((TokenType)84, (uint?)null);
						<>1__state = 2;
						return true;
					}
				}
				catch
				{
					//try-fault
					((global::System.IDisposable)this).Dispose();
					throw;
				}
			}

			bool global::System.Collections.IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>s__1 != null)
				{
					((global::System.IDisposable)<>s__1).Dispose();
				}
			}

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

			[DebuggerHidden]
			global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
			{
				<VibrateConstants>d__0 <VibrateConstants>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<VibrateConstants>d__ = this;
				}
				else
				{
					<VibrateConstants>d__ = new <VibrateConstants>d__0(0);
				}
				<VibrateConstants>d__.scaler = <>3__scaler;
				<VibrateConstants>d__.duration = <>3__duration;
				return <VibrateConstants>d__;
			}

			[DebuggerHidden]
			global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
			{
				return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
			}
		}

		[IteratorStateMachine(typeof(<VibrateConstants>d__0))]
		public static global::System.Collections.Generic.IEnumerable<Token> VibrateConstants(double scaler, double duration)
		{
			global::System.Collections.Generic.IEnumerator<Token> enumerator = GetMain().GetEnumerator();
			try
			{
				while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
				{
					yield return enumerator.Current;
				}
			}
			finally
			{
				((global::System.IDisposable)enumerator)?.Dispose();
			}
			yield return new Token((TokenType)84, (uint?)null);
			yield return (Token)new IdentifierToken("vibrate");
			yield return new Token((TokenType)80, (uint?)null);
			yield return (Token)new ConstantToken((Variant)new RealVariant(scaler, false));
			yield return new Token((TokenType)82, (uint?)null);
			yield return (Token)new ConstantToken((Variant)new RealVariant(duration, false));
			yield return new Token((TokenType)81, (uint?)null);
		}

		[IteratorStateMachine(typeof(<GetMain>d__1))]
		public static global::System.Collections.Generic.IEnumerable<Token> GetMain()
		{
			yield return (Token)new IdentifierToken("get_node");
			yield return new Token((TokenType)80, (uint?)null);
			yield return (Token)new ConstantToken((Variant)new StringVariant("/root/deltaneverusedfishgobrrr"));
			yield return new Token((TokenType)81, (uint?)null);
		}
	}
	public class Mod : IMod, global::System.IDisposable
	{
		public static Config Config;

		public static IModInterface Interface;

		public static ButtClient ButtClient;

		public static Bridge Bridge;

		public static void LogInformation(object msg)
		{
			Interface.Logger.Information("FishGoBrrr: " + msg);
		}

		public Mod(IModInterface modInterface)
		{
			Interface = modInterface;
			Config = modInterface.ReadConfig<Config>();
			ButtClient = new ButtClient();
			Bridge = new Bridge();
			Interface.RegisterScriptMod((IScriptMod)(object)new PlayerPatcher());
			Interface.RegisterScriptMod((IScriptMod)(object)new Fishing3Patcher());
			Interface.RegisterScriptMod((IScriptMod)(object)new ChalkCanvasPatcher());
			Interface.RegisterScriptMod((IScriptMod)(object)new ScratchTicketPatcher());
		}

		public void Dispose()
		{
		}
	}
}
namespace FishGoBrrr.Patches
{
	public class ChalkCanvasPatcher : IScriptMod
	{
		[CompilerGenerated]
		private sealed class <Modify>d__1 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
		{
			private int <>1__state;

			private Token <>2__current;

			private int <>l__initialThreadId;

			private string path;

			public string <>3__path;

			private global::System.Collections.Generic.IEnumerable<Token> tokens;

			public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

			public ChalkCanvasPatcher <>4__this;

			private MultiTokenWaiter <addBrushWaiter>5__1;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__2;

			private Token <token>5__3;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__4;

			private Token <t>5__5;

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

			object global::System.Collections.IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Modify>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void global::System.IDisposable.Dispose()
			{
				int num = <>1__state;
				if ((uint)(num - -4) > 1u && (uint)(num - 1) > 15u)
				{
					return;
				}
				try
				{
					if (num != -4 && num != 2)
					{
						return;
					}
					try
					{
					}
					finally
					{
						<>m__Finally2();
					}
				}
				finally
				{
					<>m__Finally1();
				}
			}

			private bool MoveNext()
			{
				//IL_034e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0358: Expected O, but got Unknown
				//IL_037a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0384: Expected O, but got Unknown
				//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_03aa: Expected O, but got Unknown
				//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d6: Expected O, but got Unknown
				//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_03fc: Expected O, but got Unknown
				//IL_041e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0428: Expected O, but got Unknown
				//IL_0445: Unknown result type (might be due to invalid IL or missing references)
				//IL_044f: Expected O, but got Unknown
				//IL_0472: Unknown result type (might be due to invalid IL or missing references)
				//IL_047c: Expected O, but got Unknown
				//IL_049f: Unknown result type (might be due to invalid IL or missing references)
				//IL_04a9: Expected O, but got Unknown
				//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_04d6: Expected O, but got Unknown
				//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_04db: Expected O, but got Unknown
				//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0508: Expected O, but got Unknown
				//IL_0528: Unknown result type (might be due to invalid IL or missing references)
				//IL_0532: Expected O, but got Unknown
				//IL_0328: Unknown result type (might be due to invalid IL or missing references)
				//IL_0332: Expected O, but got Unknown
				//IL_0236: Unknown result type (might be due to invalid IL or missing references)
				//IL_0240: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<addBrushWaiter>5__1 = new MultiTokenWaiter(new Func<Token, bool>[11]
						{
							(Token t) => (int)t.Type == 48,
							delegate(Token t)
							{
								IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val4 != null && val4.Name == "_add_brush";
							},
							(Token t) => (int)t.Type == 80,
							delegate(Token t)
							{
								IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val3 != null && val3.Name == "grid_pos";
							},
							(Token t) => (int)t.Type == 82,
							delegate(Token t)
							{
								IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val2 != null && val2.Name == "type";
							},
							(Token t) => (int)t.Type == 82,
							delegate(Token t)
							{
								IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val != null && val.Name == "from";
							},
							(Token t) => (int)t.Type == 81,
							(Token t) => (int)t.Type == 86,
							(Token t) => (int)t.Type == 89
						}, false, false);
						<>s__2 = tokens.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<>s__4 = Helpers.GetMain().GetEnumerator();
						<>1__state = -4;
						goto IL_0301;
					case 2:
						<>1__state = -4;
						<t>5__5 = null;
						goto IL_0301;
					case 3:
						<>1__state = -3;
						<>2__current = (Token)new IdentifierToken("continues_vibrate");
						<>1__state = 4;
						return true;
					case 4:
						<>1__state = -3;
						<>2__current = new Token((TokenType)80, (uint?)null);
						<>1__state = 5;
						return true;
					case 5:
						<>1__state = -3;
						<>2__current = (Token)new IdentifierToken("from");
						<>1__state = 6;
						return true;
					case 6:
						<>1__state = -3;
						<>2__current = new Token((TokenType)84, (uint?)null);
						<>1__state = 7;
						return true;
					case 7:
						<>1__state = -3;
						<>2__current = (Token)new IdentifierToken("distance_to");
						<>1__state = 8;
						return true;
					case 8:
						<>1__state = -3;
						<>2__current = new Token((TokenType)80, (uint?)null);
						<>1__state = 9;
						return true;
					case 9:
						<>1__state = -3;
						<>2__current = (Token)new IdentifierToken("grid_pos");
						<>1__state = 10;
						return true;
					case 10:
						<>1__state = -3;
						<>2__current = new Token((TokenType)81, (uint?)null);
						<>1__state = 11;
						return true;
					case 11:
						<>1__state = -3;
						<>2__current = new Token((TokenType)18, (uint?)null);
						<>1__state = 12;
						return true;
					case 12:
						<>1__state = -3;
						<>2__current = (Token)new ConstantToken((Variant)new RealVariant(Mod.Config.ChalkVibrate, false));
						<>1__state = 13;
						return true;
					case 13:
						<>1__state = -3;
						<>2__current = new Token((TokenType)81, (uint?)null);
						<>1__state = 14;
						return true;
					case 14:
						<>1__state = -3;
						<>2__current = new Token((TokenType)89, (uint?)1u);
						<>1__state = 15;
						return true;
					case 15:
						<>1__state = -3;
						goto IL_056b;
					case 16:
						{
							<>1__state = -3;
							goto IL_056b;
						}
						IL_056b:
						<token>5__3 = null;
						break;
						IL_0301:
						if (((global::System.Collections.IEnumerator)<>s__4).MoveNext())
						{
							<t>5__5 = <>s__4.Current;
							<>2__current = <t>5__5;
							<>1__state = 2;
							return true;
						}
						<>m__Finally2();
						<>s__4 = null;
						<>2__current = new Token((TokenType)84, (uint?)null);
						<>1__state = 3;
						return true;
					}
					if (((global::System.Collections.IEnumerator)<>s__2).MoveNext())
					{
						<token>5__3 = <>s__2.Current;
						if (<addBrushWaiter>5__1.Check(<token>5__3))
						{
							<>2__current = <token>5__3;
							<>1__state = 1;
							return true;
						}
						<>2__current = <token>5__3;
						<>1__state = 16;
						return true;
					}
					<>m__Finally1();
					<>s__2 = null;
					return false;
				}
				catch
				{
					//try-fault
					((global::System.IDisposable)this).Dispose();
					throw;
				}
			}

			bool global::System.Collections.IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>s__2 != null)
				{
					((global::System.IDisposable)<>s__2).Dispose();
				}
			}

			private void <>m__Finally2()
			{
				<>1__state = -3;
				if (<>s__4 != null)
				{
					((global::System.IDisposable)<>s__4).Dispose();
				}
			}

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

			[DebuggerHidden]
			global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
			{
				<Modify>d__1 <Modify>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Modify>d__ = this;
				}
				else
				{
					<Modify>d__ = new <Modify>d__1(0)
					{
						<>4__this = <>4__this
					};
				}
				<Modify>d__.path = <>3__path;
				<Modify>d__.tokens = <>3__tokens;
				return <Modify>d__;
			}

			[DebuggerHidden]
			global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
			{
				return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
			}
		}

		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Entities/ChalkCanvas/chalk_canvas.gdc";
		}

		[IteratorStateMachine(typeof(<Modify>d__1))]
		public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
		{
			MultiTokenWaiter addBrushWaiter = new MultiTokenWaiter(new Func<Token, bool>[11]
			{
				(Token t) => (int)t.Type == 48,
				delegate(Token t)
				{
					IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val4 != null && val4.Name == "_add_brush";
				},
				(Token t) => (int)t.Type == 80,
				delegate(Token t)
				{
					IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val3 != null && val3.Name == "grid_pos";
				},
				(Token t) => (int)t.Type == 82,
				delegate(Token t)
				{
					IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val2 != null && val2.Name == "type";
				},
				(Token t) => (int)t.Type == 82,
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "from";
				},
				(Token t) => (int)t.Type == 81,
				(Token t) => (int)t.Type == 86,
				(Token t) => (int)t.Type == 89
			}, false, false);
			global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
			try
			{
				while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
				{
					Token token = enumerator.Current;
					if (addBrushWaiter.Check(token))
					{
						yield return token;
						global::System.Collections.Generic.IEnumerator<Token> enumerator2 = Helpers.GetMain().GetEnumerator();
						try
						{
							while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
							{
								yield return enumerator2.Current;
							}
						}
						finally
						{
							((global::System.IDisposable)enumerator2)?.Dispose();
						}
						yield return new Token((TokenType)84, (uint?)null);
						yield return (Token)new IdentifierToken("continues_vibrate");
						yield return new Token((TokenType)80, (uint?)null);
						yield return (Token)new IdentifierToken("from");
						yield return new Token((TokenType)84, (uint?)null);
						yield return (Token)new IdentifierToken("distance_to");
						yield return new Token((TokenType)80, (uint?)null);
						yield return (Token)new IdentifierToken("grid_pos");
						yield return new Token((TokenType)81, (uint?)null);
						yield return new Token((TokenType)18, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new RealVariant(Mod.Config.ChalkVibrate, false));
						yield return new Token((TokenType)81, (uint?)null);
						yield return new Token((TokenType)89, (uint?)1u);
					}
					else
					{
						yield return token;
					}
				}
			}
			finally
			{
				((global::System.IDisposable)enumerator)?.Dispose();
			}
		}
	}
	public class Fishing3Patcher : IScriptMod
	{
		[CompilerGenerated]
		private sealed class <Modify>d__1 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
		{
			private int <>1__state;

			private Token <>2__current;

			private int <>l__initialThreadId;

			private string path;

			public string <>3__path;

			private global::System.Collections.Generic.IEnumerable<Token> tokens;

			public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

			public Fishing3Patcher <>4__this;

			private MultiTokenWaiter <ysHealthWaiter>5__1;

			private MultiTokenWaiter <badProgressWaiter>5__2;

			private MultiTokenWaiter <reachedEndWaiter>5__3;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__4;

			private Token <token>5__5;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__6;

			private Token <t>5__7;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__8;

			private Token <t>5__9;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__10;

			private Token <t>5__11;

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

			object global::System.Collections.IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Modify>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void global::System.IDisposable.Dispose()
			{
				int num = <>1__state;
				if ((uint)(num - -6) > 3u && (uint)(num - 1) > 31u)
				{
					return;
				}
				try
				{
					switch (num)
					{
					case -4:
					case 2:
						try
						{
							break;
						}
						finally
						{
							<>m__Finally2();
						}
					case -5:
					case 14:
						try
						{
							break;
						}
						finally
						{
							<>m__Finally3();
						}
					case -6:
					case 26:
						try
						{
							break;
						}
						finally
						{
							<>m__Finally4();
						}
					}
				}
				finally
				{
					<>m__Finally1();
				}
			}

			private bool MoveNext()
			{
				//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_04dd: Expected O, but got Unknown
				//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0509: Expected O, but got Unknown
				//IL_052b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0535: Expected O, but got Unknown
				//IL_0530: Unknown result type (might be due to invalid IL or missing references)
				//IL_053a: Expected O, but got Unknown
				//IL_055c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0566: Expected O, but got Unknown
				//IL_0585: Unknown result type (might be due to invalid IL or missing references)
				//IL_058f: Expected O, but got Unknown
				//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ff: Expected O, but got Unknown
				//IL_0622: Unknown result type (might be due to invalid IL or missing references)
				//IL_062c: Expected O, but got Unknown
				//IL_0649: Unknown result type (might be due to invalid IL or missing references)
				//IL_0653: Expected O, but got Unknown
				//IL_0676: Unknown result type (might be due to invalid IL or missing references)
				//IL_0680: Expected O, but got Unknown
				//IL_073b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0745: Expected O, but got Unknown
				//IL_0768: Unknown result type (might be due to invalid IL or missing references)
				//IL_0772: Expected O, but got Unknown
				//IL_078f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0799: Expected O, but got Unknown
				//IL_07bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_07c6: Expected O, but got Unknown
				//IL_07e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_07f3: Expected O, but got Unknown
				//IL_07ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_07f8: Expected O, but got Unknown
				//IL_081b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0825: Expected O, but got Unknown
				//IL_0847: Unknown result type (might be due to invalid IL or missing references)
				//IL_0851: Expected O, but got Unknown
				//IL_084c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0856: Expected O, but got Unknown
				//IL_0879: Unknown result type (might be due to invalid IL or missing references)
				//IL_0883: Expected O, but got Unknown
				//IL_08a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_08ad: Expected O, but got Unknown
				//IL_09ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_09b6: Expected O, but got Unknown
				//IL_09d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_09e3: Expected O, but got Unknown
				//IL_0a06: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a10: Expected O, but got Unknown
				//IL_0a30: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a3a: Expected O, but got Unknown
				//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_04b7: Expected O, but got Unknown
				//IL_0714: Unknown result type (might be due to invalid IL or missing references)
				//IL_071e: Expected O, but got Unknown
				//IL_0985: Unknown result type (might be due to invalid IL or missing references)
				//IL_098f: Expected O, but got Unknown
				//IL_021f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0229: Expected O, but got Unknown
				//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c4: Expected O, but got Unknown
				//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c5: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<ysHealthWaiter>5__1 = new MultiTokenWaiter(new Func<Token, bool>[6]
						{
							(Token t) => (int)t.Type == 25,
							delegate(Token t)
							{
								IdentifierToken val7 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val7 != null && val7.Name == "params";
							},
							(Token t) => (int)t.Type == 76,
							delegate(Token t)
							{
								ConstantToken val5 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
								int result;
								if (val5 != null)
								{
									Variant value = val5.Value;
									StringVariant val6 = (StringVariant)(object)((value is StringVariant) ? value : null);
									if (val6 != null)
									{
										result = ((val6.Value == "damage") ? 1 : 0);
										goto IL_002c;
									}
								}
								result = 0;
								goto IL_002c;
								IL_002c:
								return (byte)result != 0;
							},
							(Token t) => (int)t.Type == 77,
							(Token t) => (int)t.Type == 89
						}, false, false);
						<badProgressWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[4]
						{
							delegate(Token t)
							{
								IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val4 != null && val4.Name == "value";
							},
							(Token t) => (int)t.Type == 23,
							delegate(Token t)
							{
								IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val3 != null && val3.Name == "bad_progress";
							},
							(Token t) => (int)t.Type == 89
						}, false, false);
						<reachedEndWaiter>5__3 = new MultiTokenWaiter(new Func<Token, bool>[7]
						{
							(Token t) => (int)t.Type == 48,
							delegate(Token t)
							{
								IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val2 != null && val2.Name == "_reached_end";
							},
							(Token t) => (int)t.Type == 80,
							delegate(Token t)
							{
								IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val != null && val.Name == "win";
							},
							(Token t) => (int)t.Type == 81,
							(Token t) => (int)t.Type == 86,
							(Token t) => (int)t.Type == 89
						}, false, false);
						<>s__4 = tokens.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<>s__6 = Helpers.GetMain().GetEnumerator();
						<>1__state = -4;
						goto IL_0486;
					case 2:
						<>1__state = -4;
						<t>5__7 = null;
						goto IL_0486;
					case 3:
						<>1__state = -3;
						<>2__current = (Token)new IdentifierToken("continues_vibrate");
						<>1__state = 4;
						return true;
					case 4:
						<>1__state = -3;
						<>2__current = new Token((TokenType)80, (uint?)null);
						<>1__state = 5;
						return true;
					case 5:
						<>1__state = -3;
						<>2__current = (Token)new ConstantToken((Variant)new RealVariant(Mod.Config.MashVibrate, false));
						<>1__state = 6;
						return true;
					case 6:
						<>1__state = -3;
						<>2__current = new Token((TokenType)81, (uint?)null);
						<>1__state = 7;
						return true;
					case 7:
						<>1__state = -3;
						<>2__current = new Token((TokenType)89, (uint?)1u);
						<>1__state = 8;
						return true;
					case 8:
						<>1__state = -3;
						goto IL_0a73;
					case 9:
						<>1__state = -3;
						<>2__current = new Token((TokenType)38, (uint?)null);
						<>1__state = 10;
						return true;
					case 10:
						<>1__state = -3;
						<>2__current = new Token((TokenType)15, (uint?)null);
						<>1__state = 11;
						return true;
					case 11:
						<>1__state = -3;
						<>2__current = (Token)new IdentifierToken("over");
						<>1__state = 12;
						return true;
					case 12:
						<>1__state = -3;
						<>2__current = new Token((TokenType)86, (uint?)null);
						<>1__state = 13;
						return true;
					case 13:
						<>1__state = -3;
						<>s__8 = Helpers.GetMain().GetEnumerator();
						<>1__state = -5;
						goto IL_06ed;
					case 14:
						<>1__state = -5;
						<t>5__9 = null;
						goto IL_06ed;
					case 15:
						<>1__state = -3;
						<>2__current = (Token)new IdentifierToken("vibrate");
						<>1__state = 16;
						return true;
					case 16:
						<>1__state = -3;
						<>2__current = new Token((TokenType)80, (uint?)null);
						<>1__state = 17;
						return true;
					case 17:
						<>1__state = -3;
						<>2__current = (Token)new IdentifierToken("bad_progress");
						<>1__state = 18;
						return true;
					case 18:
						<>1__state = -3;
						<>2__current = new Token((TokenType)18, (uint?)null);
						<>1__state = 19;
						return true;
					case 19:
						<>1__state = -3;
						<>2__current = (Token)new ConstantToken((Variant)new RealVariant(Mod.Config.BadProgressVibrate, false));
						<>1__state = 20;
						return true;
					case 20:
						<>1__state = -3;
						<>2__current = new Token((TokenType)82, (uint?)null);
						<>1__state = 21;
						return true;
					case 21:
						<>1__state = -3;
						<>2__current = (Token)new ConstantToken((Variant)new RealVariant(-1.0, false));
						<>1__state = 22;
						return true;
					case 22:
						<>1__state = -3;
						<>2__current = new Token((TokenType)81, (uint?)null);
						<>1__state = 23;
						return true;
					case 23:
						<>1__state = -3;
						<>2__current = new Token((TokenType)89, (uint?)1u);
						<>1__state = 24;
						return true;
					case 24:
						<>1__state = -3;
						goto IL_0a73;
					case 25:
						<>1__state = -3;
						<>s__10 = Helpers.GetMain().GetEnumerator();
						<>1__state = -6;
						goto IL_095e;
					case 26:
						<>1__state = -6;
						<t>5__11 = null;
						goto IL_095e;
					case 27:
						<>1__state = -3;
						<>2__current = (Token)new IdentifierToken("stop");
						<>1__state = 28;
						return true;
					case 28:
						<>1__state = -3;
						<>2__current = new Token((TokenType)80, (uint?)null);
						<>1__state = 29;
						return true;
					case 29:
						<>1__state = -3;
						<>2__current = new Token((TokenType)81, (uint?)null);
						<>1__state = 30;
						return true;
					case 30:
						<>1__state = -3;
						<>2__current = new Token((TokenType)89, (uint?)1u);
						<>1__state = 31;
						return true;
					case 31:
						<>1__state = -3;
						goto IL_0a73;
					case 32:
						{
							<>1__state = -3;
							goto IL_0a73;
						}
						IL_095e:
						if (((global::System.Collections.IEnumerator)<>s__10).MoveNext())
						{
							<t>5__11 = <>s__10.Current;
							<>2__current = <t>5__11;
							<>1__state = 26;
							return true;
						}
						<>m__Finally4();
						<>s__10 = null;
						<>2__current = new Token((TokenType)84, (uint?)null);
						<>1__state = 27;
						return true;
						IL_0486:
						if (((global::System.Collections.IEnumerator)<>s__6).MoveNext())
						{
							<t>5__7 = <>s__6.Current;
							<>2__current = <t>5__7;
							<>1__state = 2;
							return true;
						}
						<>m__Finally2();
						<>s__6 = null;
						<>2__current = new Token((TokenType)84, (uint?)null);
						<>1__state = 3;
						return true;
						IL_06ed:
						if (((global::System.Collections.IEnumerator)<>s__8).MoveNext())
						{
							<t>5__9 = <>s__8.Current;
							<>2__current = <t>5__9;
							<>1__state = 14;
							return true;
						}
						<>m__Finally3();
						<>s__8 = null;
						<>2__current = new Token((TokenType)84, (uint?)null);
						<>1__state = 15;
						return true;
						IL_0a73:
						<token>5__5 = null;
						break;
					}
					if (((global::System.Collections.IEnumerator)<>s__4).MoveNext())
					{
						<token>5__5 = <>s__4.Current;
						if (<ysHealthWaiter>5__1.Check(<token>5__5))
						{
							<>2__current = <token>5__5;
							<>1__state = 1;
							return true;
						}
						if (<badProgressWaiter>5__2.Check(<token>5__5))
						{
							<>2__current = <token>5__5;
							<>1__state = 9;
							return true;
						}
						if (<reachedEndWaiter>5__3.Check(<token>5__5))
						{
							<>2__current = <token>5__5;
							<>1__state = 25;
							return true;
						}
						<>2__current = <token>5__5;
						<>1__state = 32;
						return true;
					}
					<>m__Finally1();
					<>s__4 = null;
					return false;
				}
				catch
				{
					//try-fault
					((global::System.IDisposable)this).Dispose();
					throw;
				}
			}

			bool global::System.Collections.IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>s__4 != null)
				{
					((global::System.IDisposable)<>s__4).Dispose();
				}
			}

			private void <>m__Finally2()
			{
				<>1__state = -3;
				if (<>s__6 != null)
				{
					((global::System.IDisposable)<>s__6).Dispose();
				}
			}

			private void <>m__Finally3()
			{
				<>1__state = -3;
				if (<>s__8 != null)
				{
					((global::System.IDisposable)<>s__8).Dispose();
				}
			}

			private void <>m__Finally4()
			{
				<>1__state = -3;
				if (<>s__10 != null)
				{
					((global::System.IDisposable)<>s__10).Dispose();
				}
			}

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

			[DebuggerHidden]
			global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
			{
				<Modify>d__1 <Modify>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Modify>d__ = this;
				}
				else
				{
					<Modify>d__ = new <Modify>d__1(0)
					{
						<>4__this = <>4__this
					};
				}
				<Modify>d__.path = <>3__path;
				<Modify>d__.tokens = <>3__tokens;
				return <Modify>d__;
			}

			[DebuggerHidden]
			global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
			{
				return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
			}
		}

		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Minigames/Fishing3/fishing3.gdc";
		}

		[IteratorStateMachine(typeof(<Modify>d__1))]
		public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
		{
			MultiTokenWaiter ysHealthWaiter = new MultiTokenWaiter(new Func<Token, bool>[6]
			{
				(Token t) => (int)t.Type == 25,
				delegate(Token t)
				{
					IdentifierToken val7 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val7 != null && val7.Name == "params";
				},
				(Token t) => (int)t.Type == 76,
				delegate(Token t)
				{
					ConstantToken val5 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
					int result;
					if (val5 != null)
					{
						Variant value = val5.Value;
						StringVariant val6 = (StringVariant)(object)((value is StringVariant) ? value : null);
						if (val6 != null)
						{
							result = ((val6.Value == "damage") ? 1 : 0);
							goto IL_002c;
						}
					}
					result = 0;
					goto IL_002c;
					IL_002c:
					return (byte)result != 0;
				},
				(Token t) => (int)t.Type == 77,
				(Token t) => (int)t.Type == 89
			}, false, false);
			MultiTokenWaiter badProgressWaiter = new MultiTokenWaiter(new Func<Token, bool>[4]
			{
				delegate(Token t)
				{
					IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val4 != null && val4.Name == "value";
				},
				(Token t) => (int)t.Type == 23,
				delegate(Token t)
				{
					IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val3 != null && val3.Name == "bad_progress";
				},
				(Token t) => (int)t.Type == 89
			}, false, false);
			MultiTokenWaiter reachedEndWaiter = new MultiTokenWaiter(new Func<Token, bool>[7]
			{
				(Token t) => (int)t.Type == 48,
				delegate(Token t)
				{
					IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val2 != null && val2.Name == "_reached_end";
				},
				(Token t) => (int)t.Type == 80,
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "win";
				},
				(Token t) => (int)t.Type == 81,
				(Token t) => (int)t.Type == 86,
				(Token t) => (int)t.Type == 89
			}, false, false);
			global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
			try
			{
				while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
				{
					Token token = enumerator.Current;
					if (ysHealthWaiter.Check(token))
					{
						yield return token;
						global::System.Collections.Generic.IEnumerator<Token> enumerator2 = Helpers.GetMain().GetEnumerator();
						try
						{
							while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
							{
								yield return enumerator2.Current;
							}
						}
						finally
						{
							((global::System.IDisposable)enumerator2)?.Dispose();
						}
						yield return new Token((TokenType)84, (uint?)null);
						yield return (Token)new IdentifierToken("continues_vibrate");
						yield return new Token((TokenType)80, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new RealVariant(Mod.Config.MashVibrate, false));
						yield return new Token((TokenType)81, (uint?)null);
						yield return new Token((TokenType)89, (uint?)1u);
					}
					else if (badProgressWaiter.Check(token))
					{
						yield return token;
						yield return new Token((TokenType)38, (uint?)null);
						yield return new Token((TokenType)15, (uint?)null);
						yield return (Token)new IdentifierToken("over");
						yield return new Token((TokenType)86, (uint?)null);
						global::System.Collections.Generic.IEnumerator<Token> enumerator3 = Helpers.GetMain().GetEnumerator();
						try
						{
							while (((global::System.Collections.IEnumerator)enumerator3).MoveNext())
							{
								yield return enumerator3.Current;
							}
						}
						finally
						{
							((global::System.IDisposable)enumerator3)?.Dispose();
						}
						yield return new Token((TokenType)84, (uint?)null);
						yield return (Token)new IdentifierToken("vibrate");
						yield return new Token((TokenType)80, (uint?)null);
						yield return (Token)new IdentifierToken("bad_progress");
						yield return new Token((TokenType)18, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new RealVariant(Mod.Config.BadProgressVibrate, false));
						yield return new Token((TokenType)82, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new RealVariant(-1.0, false));
						yield return new Token((TokenType)81, (uint?)null);
						yield return new Token((TokenType)89, (uint?)1u);
					}
					else if (reachedEndWaiter.Check(token))
					{
						yield return token;
						global::System.Collections.Generic.IEnumerator<Token> enumerator4 = Helpers.GetMain().GetEnumerator();
						try
						{
							while (((global::System.Collections.IEnumerator)enumerator4).MoveNext())
							{
								yield return enumerator4.Current;
							}
						}
						finally
						{
							((global::System.IDisposable)enumerator4)?.Dispose();
						}
						yield return new Token((TokenType)84, (uint?)null);
						yield return (Token)new IdentifierToken("stop");
						yield return new Token((TokenType)80, (uint?)null);
						yield return new Token((TokenType)81, (uint?)null);
						yield return new Token((TokenType)89, (uint?)1u);
					}
					else
					{
						yield return token;
					}
				}
			}
			finally
			{
				((global::System.IDisposable)enumerator)?.Dispose();
			}
		}
	}
	public class PlayerPatcher : IScriptMod
	{
		[CompilerGenerated]
		private sealed class <Modify>d__1 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
		{
			private int <>1__state;

			private Token <>2__current;

			private int <>l__initialThreadId;

			private string path;

			public string <>3__path;

			private global::System.Collections.Generic.IEnumerable<Token> tokens;

			public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

			public PlayerPatcher <>4__this;

			private MultiTokenWaiter <fishingStartWaiter>5__1;

			private MultiTokenWaiter <jumpWaiter>5__2;

			private MultiTokenWaiter <mushroomWaiter>5__3;

			private MultiTokenWaiter <punchedWaiter>5__4;

			private MultiTokenWaiter <killWaiter>5__5;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__6;

			private Token <token>5__7;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__8;

			private Token <t>5__9;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__10;

			private Token <t>5__11;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__12;

			private Token <t>5__13;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__14;

			private Token <t>5__15;

			private global::System.Collections.Generic.IEnumerator<Token> <>s__16;

			private Token <t>5__17;

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

			object global::System.Collections.IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Modify>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void global::System.IDisposable.Dispose()
			{
				int num = <>1__state;
				if ((uint)(num - -8) > 5u && (uint)(num - 1) > 15u)
				{
					return;
				}
				try
				{
					switch (num)
					{
					case -4:
					case 2:
						try
						{
							break;
						}
						finally
						{
							<>m__Finally2();
						}
					case -5:
					case 5:
						try
						{
							break;
						}
						finally
						{
							<>m__Finally3();
						}
					case -6:
					case 8:
						try
						{
							break;
						}
						finally
						{
							<>m__Finally4();
						}
					case -7:
					case 11:
						try
						{
							break;
						}
						finally
						{
							<>m__Finally5();
						}
					case -8:
					case 14:
						try
						{
							break;
						}
						finally
						{
							<>m__Finally6();
						}
					}
				}
				finally
				{
					<>m__Finally1();
				}
			}

			private bool MoveNext()
			{
				//IL_0926: Unknown result type (might be due to invalid IL or missing references)
				//IL_0930: Expected O, but got Unknown
				//IL_0a14: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a1e: Expected O, but got Unknown
				//IL_0b04: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b0e: Expected O, but got Unknown
				//IL_0bf7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c01: Expected O, but got Unknown
				//IL_0cea: Unknown result type (might be due to invalid IL or missing references)
				//IL_0cf4: Expected O, but got Unknown
				//IL_0167: Unknown result type (might be due to invalid IL or missing references)
				//IL_0171: Expected O, but got Unknown
				//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ac: Expected O, but got Unknown
				//IL_0551: Unknown result type (might be due to invalid IL or missing references)
				//IL_055b: Expected O, but got Unknown
				//IL_06dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_06e7: Expected O, but got Unknown
				//IL_0823: Unknown result type (might be due to invalid IL or missing references)
				//IL_082d: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<fishingStartWaiter>5__1 = new MultiTokenWaiter(new Func<Token, bool>[5]
						{
							(Token t) => (int)t.Type == 89,
							delegate(Token t)
							{
								IdentifierToken val16 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val16 != null && val16.Name == "failed_casts";
							},
							(Token t) => (int)t.Type == 23,
							delegate(Token t)
							{
								ConstantToken val14 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
								int result2;
								if (val14 != null)
								{
									Variant value2 = val14.Value;
									RealVariant val15 = (RealVariant)(object)((value2 is RealVariant) ? value2 : null);
									if (val15 != null)
									{
										result2 = ((val15.Value == 0.0) ? 1 : 0);
										goto IL_002d;
									}
								}
								result2 = 0;
								goto IL_002d;
								IL_002d:
								return (byte)result2 != 0;
							},
							(Token t) => (int)t.Type == 89
						}, false, false);
						<jumpWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[16]
						{
							delegate(Token t)
							{
								IdentifierToken val13 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val13 != null && val13.Name == "request_jump";
							},
							(Token t) => (int)t.Type == 23,
							delegate(Token t)
							{
								ConstantToken val11 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
								int result;
								if (val11 != null)
								{
									Variant value = val11.Value;
									BoolVariant val12 = (BoolVariant)(object)((value is BoolVariant) ? value : null);
									if (val12 != null)
									{
										result = ((!val12.Value) ? 1 : 0);
										goto IL_0025;
									}
								}
								result = 0;
								goto IL_0025;
								IL_0025:
								return (byte)result != 0;
							},
							(Token t) => (int)t.Type == 89,
							delegate(Token t)
							{
								IdentifierToken val10 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val10 != null && val10.Name == "snap_vec";
							},
							(Token t) => (int)t.Type == 23,
							(Token t) => (int)t.Type == 4,
							(Token t) => (int)t.Type == 84,
							delegate(Token t)
							{
								IdentifierToken val9 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val9 != null && val9.Name == "ZERO";
							},
							(Token t) => (int)t.Type == 89,
							(Token t) => t != null && (int)t.Type == 38,
							delegate(Token t)
							{
								IdentifierToken val8 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val8 != null && val8.Name == "is_on_floor";
							},
							(Token t) => (int)t.Type == 80,
							(Token t) => (int)t.Type == 81,
							(Token t) => (int)t.Type == 86,
							(Token t) => (int)t.Type == 89
						}, false, false);
						<mushroomWaiter>5__3 = new MultiTokenWaiter(new Func<Token, bool>[12]
						{
							(Token t) => (int)t.Type == 48,
							delegate(Token t)
							{
								IdentifierToken val7 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val7 != null && val7.Name == "_mushroom_bounce";
							},
							(Token t) => (int)t.Type == 80,
							(Token t) => (int)t.Type == 81,
							(Token t) => (int)t.Type == 86,
							(Token t) => (int)t.Type == 89,
							(Token t) => (int)t.Type == 38,
							(Token t) => (int)t.Type == 15,
							delegate(Token t)
							{
								IdentifierToken val6 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val6 != null && val6.Name == "controlled";
							},
							(Token t) => (int)t.Type == 86,
							(Token t) => (int)t.Type == 46,
							(Token t) => (int)t.Type == 89
						}, false, true);
						<punchedWaiter>5__4 = new MultiTokenWaiter(new Func<Token, bool>[11]
						{
							delegate(Token t)
							{
								IdentifierToken val5 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val5 != null && val5.Name == "bounce_vert";
							},
							(Token t) => (int)t.Type == 23,
							(Token t) => t is ConstantToken,
							(Token t) => (int)t.Type == 89,
							(Token t) => (int)t.Type == 89,
							delegate(Token t)
							{
								IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val4 != null && val4.Name == "gravity_vec";
							},
							(Token t) => (int)t.Type == 23,
							(Token t) => (int)t.Type == 4,
							(Token t) => (int)t.Type == 84,
							delegate(Token t)
							{
								IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val3 != null && val3.Name == "ZERO";
							},
							(Token t) => (int)t.Type == 89
						}, false, true);
						<killWaiter>5__5 = new MultiTokenWaiter(new Func<Token, bool>[9]
						{
							(Token t) => (int)t.Type == 48,
							delegate(Token t)
							{
								IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val2 != null && val2.Name == "_kill";
							},
							(Token t) => (int)t.Type == 80,
							delegate(Token t)
							{
								IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val != null && val.Name == "skip_anim";
							},
							(Token t) => (int)t.Type == 23,
							(Token t) => (int)t.Type == 2,
							(Token t) => (int)t.Type == 81,
							(Token t) => (int)t.Type == 86,
							(Token t) => (int)t.Type == 89
						}, false, false);
						<>s__6 = tokens.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<>s__8 = Helpers.VibrateConstants(Mod.Config.BiteVibrate, Mod.Config.BiteDuration).GetEnumerator();
						<>1__state = -4;
						goto IL_0902;
					case 2:
						<>1__state = -4;
						<t>5__9 = null;
						goto IL_0902;
					case 3:
						<>1__state = -3;
						goto IL_0d2d;
					case 4:
						<>1__state = -3;
						<>s__10 = Helpers.VibrateConstants(Mod.Config.JumpVibrate, Mod.Config.JumpDuration).GetEnumerator();
						<>1__state = -5;
						goto IL_09f0;
					case 5:
						<>1__state = -5;
						<t>5__11 = null;
						goto IL_09f0;
					case 6:
						<>1__state = -3;
						goto IL_0d2d;
					case 7:
						<>1__state = -3;
						<>s__12 = Helpers.VibrateConstants(Mod.Config.MushroomVibrate, Mod.Config.MushroomDuration).GetEnumerator();
						<>1__state = -6;
						goto IL_0ae0;
					case 8:
						<>1__state = -6;
						<t>5__13 = null;
						goto IL_0ae0;
					case 9:
						<>1__state = -3;
						goto IL_0d2d;
					case 10:
						<>1__state = -3;
						<>s__14 = Helpers.VibrateConstants(Mod.Config.PunchedVibrate, Mod.Config.PunchedDuration).GetEnumerator();
						<>1__state = -7;
						goto IL_0bd3;
					case 11:
						<>1__state = -7;
						<t>5__15 = null;
						goto IL_0bd3;
					case 12:
						<>1__state = -3;
						goto IL_0d2d;
					case 13:
						<>1__state = -3;
						<>s__16 = Helpers.VibrateConstants(Mod.Config.DieVibrate, Mod.Config.DieVibrate).GetEnumerator();
						<>1__state = -8;
						goto IL_0cc6;
					case 14:
						<>1__state = -8;
						<t>5__17 = null;
						goto IL_0cc6;
					case 15:
						<>1__state = -3;
						goto IL_0d2d;
					case 16:
						{
							<>1__state = -3;
							goto IL_0d2d;
						}
						IL_0cc6:
						if (((global::System.Collections.IEnumerator)<>s__16).MoveNext())
						{
							<t>5__17 = <>s__16.Current;
							<>2__current = <t>5__17;
							<>1__state = 14;
							return true;
						}
						<>m__Finally6();
						<>s__16 = null;
						<>2__current = new Token((TokenType)89, (uint?)1u);
						<>1__state = 15;
						return true;
						IL_0bd3:
						if (((global::System.Collections.IEnumerator)<>s__14).MoveNext())
						{
							<t>5__15 = <>s__14.Current;
							<>2__current = <t>5__15;
							<>1__state = 11;
							return true;
						}
						<>m__Finally5();
						<>s__14 = null;
						<>2__current = new Token((TokenType)89, (uint?)1u);
						<>1__state = 12;
						return true;
						IL_0d2d:
						<token>5__7 = null;
						break;
						IL_0ae0:
						if (((global::System.Collections.IEnumerator)<>s__12).MoveNext())
						{
							<t>5__13 = <>s__12.Current;
							<>2__current = <t>5__13;
							<>1__state = 8;
							return true;
						}
						<>m__Finally4();
						<>s__12 = null;
						<>2__current = new Token((TokenType)89, (uint?)1u);
						<>1__state = 9;
						return true;
						IL_0902:
						if (((global::System.Collections.IEnumerator)<>s__8).MoveNext())
						{
							<t>5__9 = <>s__8.Current;
							<>2__current = <t>5__9;
							<>1__state = 2;
							return true;
						}
						<>m__Finally2();
						<>s__8 = null;
						<>2__current = new Token((TokenType)89, (uint?)1u);
						<>1__state = 3;
						return true;
						IL_09f0:
						if (((global::System.Collections.IEnumerator)<>s__10).MoveNext())
						{
							<t>5__11 = <>s__10.Current;
							<>2__current = <t>5__11;
							<>1__state = 5;
							return true;
						}
						<>m__Finally3();
						<>s__10 = null;
						<>2__current = new Token((TokenType)89, (uint?)3u);
						<>1__state = 6;
						return true;
					}
					if (((global::System.Collections.IEnumerator)<>s__6).MoveNext())
					{
						<token>5__7 = <>s__6.Current;
						if (<fishingStartWaiter>5__1.Check(<token>5__7))
						{
							<>2__current = <token>5__7;
							<>1__state = 1;
							return true;
						}
						if (<jumpWaiter>5__2.Check(<token>5__7))
						{
							<>2__current = <token>5__7;
							<>1__state = 4;
							return true;
						}
						if (<mushroomWaiter>5__3.Check(<token>5__7))
						{
							<>2__current = <token>5__7;
							<>1__state = 7;
							return true;
						}
						if (<punchedWaiter>5__4.Check(<token>5__7))
						{
							<>2__current = <token>5__7;
							<>1__state = 10;
							return true;
						}
						if (<killWaiter>5__5.Check(<token>5__7))
						{
							<>2__current = <token>5__7;
							<>1__state = 13;
							return true;
						}
						<>2__current = <token>5__7;
						<>1__state = 16;
						return true;
					}
					<>m__Finally1();
					<>s__6 = null;
					return false;
				}
				catch
				{
					//try-fault
					((global::System.IDisposable)this).Dispose();
					throw;
				}
			}

			bool global::System.Collections.IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>s__6 != null)
				{
					((global::System.IDisposable)<>s__6).Dispose();
				}
			}

			private void <>m__Finally2()
			{
				<>1__state = -3;
				if (<>s__8 != null)
				{
					((global::System.IDisposable)<>s__8).Dispose();
				}
			}

			private void <>m__Finally3()
			{
				<>1__state = -3;
				if (<>s__10 != null)
				{
					((global::System.IDisposable)<>s__10).Dispose();
				}
			}

			private void <>m__Finally4()
			{
				<>1__state = -3;
				if (<>s__12 != null)
				{
					((global::System.IDisposable)<>s__12).Dispose();
				}
			}

			private void <>m__Finally5()
			{
				<>1__state = -3;
				if (<>s__14 != null)
				{
					((global::System.IDisposable)<>s__14).Dispose();
				}
			}

			private void <>m__Finally6()
			{
				<>1__state = -3;
				if (<>s__16 != null)
				{
					((global::System.IDisposable)<>s__16).Dispose();
				}
			}

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

			[DebuggerHidden]
			global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
			{
				<Modify>d__1 <Modify>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Modify>d__ = this;
				}
				else
				{
					<Modify>d__ = new <Modify>d__1(0)
					{
						<>4__this = <>4__this
					};
				}
				<Modify>d__.path = <>3__path;
				<Modify>d__.tokens = <>3__tokens;
				return <Modify>d__;
			}

			[DebuggerHidden]
			global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
			{
				return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
			}
		}

		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Entities/Player/player.gdc";
		}

		[IteratorStateMachine(typeof(<Modify>d__1))]
		public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
		{
			MultiTokenWaiter fishingStartWaiter = new MultiTokenWaiter(new Func<Token, bool>[5]
			{
				(Token t) => (int)t.Type == 89,
				delegate(Token t)
				{
					IdentifierToken val16 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val16 != null && val16.Name == "failed_casts";
				},
				(Token t) => (int)t.Type == 23,
				delegate(Token t)
				{
					ConstantToken val14 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
					int result2;
					if (val14 != null)
					{
						Variant value2 = val14.Value;
						RealVariant val15 = (RealVariant)(object)((value2 is RealVariant) ? value2 : null);
						if (val15 != null)
						{
							result2 = ((val15.Value == 0.0) ? 1 : 0);
							goto IL_002d;
						}
					}
					result2 = 0;
					goto IL_002d;
					IL_002d:
					return (byte)result2 != 0;
				},
				(Token t) => (int)t.Type == 89
			}, false, false);
			MultiTokenWaiter jumpWaiter = new MultiTokenWaiter(new Func<Token, bool>[16]
			{
				delegate(Token t)
				{
					IdentifierToken val13 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val13 != null && val13.Name == "request_jump";
				},
				(Token t) => (int)t.Type == 23,
				delegate(Token t)
				{
					ConstantToken val11 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
					int result;
					if (val11 != null)
					{
						Variant value = val11.Value;
						BoolVariant val12 = (BoolVariant)(object)((value is BoolVariant) ? value : null);
						if (val12 != null)
						{
							result = ((!val12.Value) ? 1 : 0);
							goto IL_0025;
						}
					}
					result = 0;
					goto IL_0025;
					IL_0025:
					return (byte)result != 0;
				},
				(Token t) => (int)t.Type == 89,
				delegate(Token t)
				{
					IdentifierToken val10 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val10 != null && val10.Name == "snap_vec";
				},
				(Token t) => (int)t.Type == 23,
				(Token t) => (int)t.Type == 4,
				(Token t) => (int)t.Type == 84,
				delegate(Token t)
				{
					IdentifierToken val9 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val9 != null && val9.Name == "ZERO";
				},
				(Token t) => (int)t.Type == 89,
				(Token t) => t != null && (int)t.Type == 38,
				delegate(Token t)
				{
					IdentifierToken val8 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val8 != null && val8.Name == "is_on_floor";
				},
				(Token t) => (int)t.Type == 80,
				(Token t) => (int)t.Type == 81,
				(Token t) => (int)t.Type == 86,
				(Token t) => (int)t.Type == 89
			}, false, false);
			MultiTokenWaiter mushroomWaiter = new MultiTokenWaiter(new Func<Token, bool>[12]
			{
				(Token t) => (int)t.Type == 48,
				delegate(Token t)
				{
					IdentifierToken val7 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val7 != null && val7.Name == "_mushroom_bounce";
				},
				(Token t) => (int)t.Type == 80,
				(Token t) => (int)t.Type == 81,
				(Token t) => (int)t.Type == 86,
				(Token t) => (int)t.Type == 89,
				(Token t) => (int)t.Type == 38,
				(Token t) => (int)t.Type == 15,
				delegate(Token t)
				{
					IdentifierToken val6 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val6 != null && val6.Name == "controlled";
				},
				(Token t) => (int)t.Type == 86,
				(Token t) => (int)t.Type == 46,
				(Token t) => (int)t.Type == 89
			}, false, true);
			MultiTokenWaiter punchedWaiter = new MultiTokenWaiter(new Func<Token, bool>[11]
			{
				delegate(Token t)
				{
					IdentifierToken val5 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val5 != null && val5.Name == "bounce_vert";
				},
				(Token t) => (int)t.Type == 23,
				(Token t) => t is ConstantToken,
				(Token t) => (int)t.Type == 89,
				(Token t) => (int)t.Type == 89,
				delegate(Token t)
				{
					IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val4 != null && val4.Name == "gravity_vec";
				},
				(Token t) => (int)t.Type == 23,
				(Token t) => (int)t.Type == 4,
				(Token t) => (int)t.Type == 84,
				delegate(Token t)
				{
					IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val3 != null && val3.Name == "ZERO";
				},
				(Token t) => (int)t.Type == 89
			}, false, true);
			MultiTokenWaiter killWaiter = new MultiTokenWaiter(new Func<Token, bool>[9]
			{
				(Token t) => (int)t.Type == 48,
				delegate(Token t)
				{
					IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val2 != null && val2.Name == "_kill";
				},
				(Token t) => (int)t.Type == 80,
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "skip_anim";
				},
				(Token t) => (int)t.Type == 23,
				(Token t) => (int)t.Type == 2,
				(Token t) => (int)t.Type == 81,
				(Token t) => (int)t.Type == 86,
				(Token t) => (int)t.Type == 89
			}, false, false);
			global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
			try
			{
				while (((global::Syst