Decompiled source of Caseboard Expanded v1.4.12

plugins/SoDCaseboardExpanded/SoDCaseboardExpanded.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Reflection;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SoDCaseboardExpanded")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("SoDCaseboardExpanded")]
[assembly: AssemblyTitle("SoDCaseboardExpanded")]
[assembly: AssemblyVersion("0.1.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SoDCaseboardExpanded
{
	public class BoardSizer : MonoBehaviour
	{
		private float next;

		private readonly HashSet<IntPtr> logged = new HashSet<IntPtr>();

		private readonly HashSet<IntPtr> scaled = new HashSet<IntPtr>();

		internal static ZoomContent? Board;

		internal static PinnedItemController? dropped;

		internal static Vector2 droppedAt;

		private static float droppedTime;

		private static int step;

		public BoardSizer(IntPtr ptr)
			: base(ptr)
		{
		}

		internal static void Dropped(PinnedItemController p)
		{
			//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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			dropped = p;
			droppedTime = Time.unscaledTime;
			step = 0;
			try
			{
				droppedAt = p.rect.anchoredPosition;
				StringBuilder stringBuilder = new StringBuilder();
				foreach (Component component in ((Component)p).gameObject.GetComponents<Component>())
				{
					stringBuilder.Append(((MemberInfo)((Object)component).GetIl2CppType()).Name).Append(' ');
				}
				Transform parent = ((Transform)p.rect).parent;
				RectTransform val = ((parent != null) ? ((Il2CppObjectBase)parent).TryCast<RectTransform>() : null);
				ManualLogSource l = Plugin.L;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(56, 6, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[DRAG] dropped '");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)p).name);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' at ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Vector2>(p.rect.anchoredPosition);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (local ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Vector3>(((Transform)p.rect).localPosition);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("), parent '");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>((val != null) ? ((Object)val).name : null);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' size ");
					object obj;
					if (!((Object)(object)val != (Object)null))
					{
						obj = "-";
					}
					else
					{
						Rect rect = val.rect;
						obj = ((object)((Rect)(ref rect)).size/*cast due to .constrained prefix*/).ToString();
					}
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>((string)obj);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("; parts: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<StringBuilder>(stringBuilder);
				}
				l.LogInfo(val2);
			}
			catch (Exception ex)
			{
				Plugin.L.LogInfo((object)("[DRAG] " + ex.Message));
			}
		}

		private void LateUpdate()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PinDrag.Guard();
			}
			catch
			{
			}
			if ((Object)(object)dropped == (Object)null)
			{
				return;
			}
			float num = Time.unscaledTime - droppedTime;
			float[] array = new float[4] { 0.05f, 0.3f, 1f, 3f };
			if (step >= array.Length)
			{
				dropped = null;
			}
			else
			{
				if (num < array[step])
				{
					return;
				}
				try
				{
					ManualLogSource l = Plugin.L;
					bool flag = default(bool);
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 4, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[DRAG] +");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(array[step]);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("s '");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)dropped).name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' at ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Vector2>(dropped.rect.anchoredPosition);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", moved ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Vector2>(dropped.rect.anchoredPosition - droppedAt);
					}
					l.LogInfo(val);
				}
				catch
				{
					dropped = null;
					return;
				}
				step++;
			}
		}

		private void Update()
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			//IL_00fa: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: 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_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Expected O, but got Unknown
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: 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_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Expected O, but got Unknown
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0428: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Expected O, but got Unknown
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_049f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Expected O, but got Unknown
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0528: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PinDrag.RestoreLoaded();
			}
			catch
			{
			}
			try
			{
				PinDrag.Guard();
			}
			catch
			{
			}
			if (Time.unscaledTime < next)
			{
				return;
			}
			next = Time.unscaledTime + 1f;
			try
			{
				bool flag = default(bool);
				for (int num = ZoomWatch.All.Count - 1; num >= 0; num--)
				{
					ZoomContent val = ZoomWatch.All[num];
					if ((Object)(object)val == (Object)null)
					{
						ZoomWatch.All.RemoveAt(num);
					}
					else if (((Component)val).gameObject.activeInHierarchy)
					{
						string text = val.zoomAxis ?? "";
						Rect rect;
						if (logged.Add(((Il2CppObjectBase)val).Pointer))
						{
							ManualLogSource l = Plugin.L;
							BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(79, 6, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BOARD] zoom panel '");
								((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)((Component)val).gameObject).name);
								((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' axis '");
								((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
								((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("', normal size ");
								((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Vector2>(val.normalSize);
								((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", zoom limit ");
								((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Vector2>(val.zoomLimit);
								((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", ");
								((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("container ");
								BepInExInfoLogInterpolatedStringHandler obj3 = val2;
								object obj4;
								if (!((Object)(object)val.containerRect != (Object)null))
								{
									obj4 = "none";
								}
								else
								{
									rect = val.containerRect.rect;
									obj4 = ((object)((Rect)(ref rect)).size/*cast due to .constrained prefix*/).ToString();
								}
								((BepInExLogInterpolatedStringHandler)obj3).AppendFormatted<string>((string)obj4);
								((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", window '");
								((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)(object)val.window != (Object)null) ? ((Object)val.window).name : "");
								((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'");
							}
							l.LogInfo(val2);
						}
						float value = Plugin.BoardScale.Value;
						if (!(value <= 1.001f) && !scaled.Contains(((Il2CppObjectBase)val).Pointer) && IsBoard(val, text))
						{
							scaled.Add(((Il2CppObjectBase)val).Pointer);
							Board = val;
							val.normalSize *= value;
							if ((Object)(object)val.containerRect != (Object)null)
							{
								RectTransform containerRect = val.containerRect;
								containerRect.sizeDelta *= value;
							}
							float num2 = 1f + 2f * Mathf.Max(0f, Plugin.ZoomMargin.Value);
							BepInExInfoLogInterpolatedStringHandler val2;
							if ((Object)(object)val.containerRect != (Object)null && num2 > 1.001f)
							{
								RectTransform containerRect2 = val.containerRect;
								containerRect2.sizeDelta *= num2;
								ManualLogSource l2 = Plugin.L;
								val2 = new BepInExInfoLogInterpolatedStringHandler(49, 2, ref flag);
								if (flag)
								{
									((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BOARD] room around the board: container now ");
									BepInExInfoLogInterpolatedStringHandler obj5 = val2;
									rect = val.containerRect.rect;
									((BepInExLogInterpolatedStringHandler)obj5).AppendFormatted<Vector2>(((Rect)(ref rect)).size);
									((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (");
									((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(num2);
									((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("x)");
								}
								l2.LogInfo(val2);
							}
							val.zoomLimit = new Vector2(val.zoomLimit.x / value, val.zoomLimit.y);
							ManualLogSource l3 = Plugin.L;
							val2 = new BepInExInfoLogInterpolatedStringHandler(52, 3, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BOARD] case board made ");
								((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(value);
								((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("x: normal size ");
								((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Vector2>(val.normalSize);
								((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", zoom limit ");
								((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Vector2>(val.zoomLimit);
							}
							l3.LogInfo(val2);
							Transform val3 = ((Component)val).transform.Find("Strings");
							if ((Object)(object)val3 != (Object)null)
							{
								float num3 = val.normalSize.x / value * (value * num2 - 1f) / 2f;
								for (int i = 0; i < val3.childCount; i++)
								{
									RectTransform val4 = ((Il2CppObjectBase)val3.GetChild(i)).TryCast<RectTransform>();
									if ((Object)(object)val4 != (Object)null && val4.anchorMin.x < 0.01f)
									{
										val4.anchoredPosition += new Vector2(num3, 0f);
									}
								}
								ManualLogSource l4 = Plugin.L;
								val2 = new BepInExInfoLogInterpolatedStringHandler(26, 2, ref flag);
								if (flag)
								{
									((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BOARD] moved ");
									((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(val3.childCount);
									((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" strings by ");
									((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(num3);
								}
								l4.LogInfo(val2);
							}
							Transform obj6 = ((Component)val).transform.Find("BG");
							RectTransform val5 = ((obj6 != null) ? ((Il2CppObjectBase)obj6).TryCast<RectTransform>() : null);
							if ((Object)(object)val5 != (Object)null)
							{
								rect = val5.rect;
								PinDrag.Edge = ((Rect)(ref rect)).size / 2f;
								val5.sizeDelta *= value;
								Image component = ((Component)val5).GetComponent<Image>();
								ManualLogSource l5 = Plugin.L;
								val2 = new BepInExInfoLogInterpolatedStringHandler(36, 2, ref flag);
								if (flag)
								{
									((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BOARD] background now ");
									BepInExInfoLogInterpolatedStringHandler obj7 = val2;
									rect = val5.rect;
									((BepInExLogInterpolatedStringHandler)obj7).AppendFormatted<Vector2>(((Rect)(ref rect)).size);
									((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", image type ");
									((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)(object)component != (Object)null) ? ((object)component.type/*cast due to .constrained prefix*/).ToString() : "none");
								}
								l5.LogInfo(val2);
							}
							CasePanelController instance = CasePanelController.Instance;
							if ((Object)(object)instance != (Object)null)
							{
								Grow(instance.corkBoard, "cork board", value, val5, val.containerRect);
								Grow(instance.pinnedContainer, "pinned container", value, val5, val.containerRect);
							}
						}
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.L.LogWarning((object)("[BOARD] " + ex.Message));
			}
		}

		private static void Grow(RectTransform? rt, string what, float s, RectTransform? done, RectTransform? board)
		{
			//IL_0047: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0065: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_00d0: 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_010e: Expected O, but got Unknown
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: 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_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Expected O, but got Unknown
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Expected O, but got Unknown
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Expected O, but got Unknown
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val;
			if ((Object)(object)rt == (Object)null)
			{
				ManualLogSource l = Plugin.L;
				val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BOARD] ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(what);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": none");
				}
				l.LogInfo(val);
				return;
			}
			bool flag2 = rt.anchorMax.x - rt.anchorMin.x > 0.5f || rt.anchorMax.y - rt.anchorMin.y > 0.5f;
			object[] obj = new object[5]
			{
				((Object)rt).name,
				null,
				null,
				null,
				null
			};
			Rect rect = rt.rect;
			obj[1] = ((Rect)(ref rect)).size;
			obj[2] = rt.anchorMin;
			obj[3] = rt.anchorMax;
			obj[4] = rt.pivot;
			string text = string.Format("'{0}' size {1}, anchors {2}-{3}, pivot {4}", obj);
			if ((Object)(object)done != (Object)null && ((Il2CppObjectBase)rt).Pointer == ((Il2CppObjectBase)done).Pointer)
			{
				ManualLogSource l2 = Plugin.L;
				val = new BepInExInfoLogInterpolatedStringHandler(43, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BOARD] ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(what);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is the background, already grown: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
				}
				l2.LogInfo(val);
				return;
			}
			if ((Object)(object)board != (Object)null && (((Il2CppObjectBase)rt).Pointer == ((Il2CppObjectBase)board).Pointer || ((Object)((Component)rt).gameObject).name == "ContentContainer"))
			{
				ManualLogSource l3 = Plugin.L;
				val = new BepInExInfoLogInterpolatedStringHandler(45, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BOARD] ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(what);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is the board itself, already grown: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
				}
				l3.LogInfo(val);
				return;
			}
			if (flag2)
			{
				ManualLogSource l4 = Plugin.L;
				val = new BepInExInfoLogInterpolatedStringHandler(35, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BOARD] ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(what);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" stretches with the board: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
				}
				l4.LogInfo(val);
				return;
			}
			rect = rt.rect;
			Vector2 size = ((Rect)(ref rect)).size;
			rt.sizeDelta *= s;
			rect = rt.rect;
			Vector2 val2 = ((Rect)(ref rect)).size - size;
			int num = 0;
			Vector2 val5 = default(Vector2);
			for (int i = 0; i < ((Transform)rt).childCount; i++)
			{
				RectTransform val3 = ((Il2CppObjectBase)((Transform)rt).GetChild(i)).TryCast<RectTransform>();
				if (!((Object)(object)val3 == (Object)null))
				{
					Vector2 val4 = (val3.anchorMin + val3.anchorMax) / 2f - rt.pivot;
					((Vector2)(ref val5))..ctor(val4.x * val2.x, val4.y * val2.y);
					if (!(((Vector2)(ref val5)).sqrMagnitude < 0.01f))
					{
						val3.anchoredPosition -= val5;
						num++;
					}
				}
			}
			ManualLogSource l5 = Plugin.L;
			val = new BepInExInfoLogInterpolatedStringHandler(45, 4, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BOARD] ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(what);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" grown: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
				BepInExInfoLogInterpolatedStringHandler obj2 = val;
				rect = rt.rect;
				((BepInExLogInterpolatedStringHandler)obj2).AppendFormatted<Vector2>(((Rect)(ref rect)).size);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" children kept in place");
			}
			l5.LogInfo(val);
		}

		private static void Tree(Transform t, int depth)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			if (depth > 3)
			{
				return;
			}
			bool flag = default(bool);
			for (int i = 0; i < t.childCount && i < 40; i++)
			{
				Transform child = t.GetChild(i);
				RectTransform val = ((Il2CppObjectBase)child).TryCast<RectTransform>();
				Graphic component = ((Component)child).GetComponent<Graphic>();
				ManualLogSource l = Plugin.L;
				BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(50, 6, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BOARD] tree ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(new string(' ', depth * 2));
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)child).name);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' size ");
					object obj;
					if (!((Object)(object)val != (Object)null))
					{
						obj = "-";
					}
					else
					{
						Rect rect = val.rect;
						obj = ((object)((Rect)(ref rect)).size/*cast due to .constrained prefix*/).ToString();
					}
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>((string)obj);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", ");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("anchors ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)(object)val != (Object)null) ? (((object)val.anchorMin/*cast due to .constrained prefix*/).ToString() + "-" + ((object)val.anchorMax/*cast due to .constrained prefix*/).ToString()) : "-");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", graphic ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)(object)component != (Object)null) ? ((MemberInfo)((Object)component).GetIl2CppType()).Name : "none");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", active ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<bool>(((Component)child).gameObject.activeSelf);
				}
				l.LogInfo(val2);
				if (!((Object)child).name.StartsWith("Pin") && !((Object)child).name.Contains("Clone"))
				{
					Tree(child, depth + 1);
				}
			}
		}

		private static bool IsBoard(ZoomContent z, string axis)
		{
			if (axis.IndexOf("CaseBoard", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return ((Object)((Component)z).gameObject).name == "ContentContainer";
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(PinnedItemController), "OnEndDrag")]
	internal static class DragProbePatch
	{
		private static void Postfix(PinnedItemController __instance)
		{
			if (Plugin.DragProbe.Value)
			{
				BoardSizer.Dropped(__instance);
			}
		}
	}
	internal static class PinDrag
	{
		internal static Vector2 Edge = new Vector2(2000f, 1500f);

		private static readonly Dictionary<IntPtr, Vector2> offsets = new Dictionary<IntPtr, Vector2>();

		internal static Camera? Cam;

		private static int moved;

		private static readonly Dictionary<IntPtr, Vector2> outside = new Dictionary<IntPtr, Vector2>();

		private static Vector2 grabbedAt;

		private static bool grabbedOutside;

		private static RectTransform? grabbedRect;

		private static int placedLogs;

		private static readonly List<(PinnedItemController pic, Vector2 want, float until)> loaded = new List<(PinnedItemController, Vector2, float)>();

		private static readonly Dictionary<IntPtr, float> fresh = new Dictionary<IntPtr, float>();

		internal static bool DirectOn;

		private static int directLogs;

		private static int autoLogs;

		private static int autoN;

		private static float autoAt;

		private static readonly List<(PinnedItemController pic, float until)> watched = new List<(PinnedItemController, float)>();

		private static int guardLogs;

		private static bool Local(RectTransform cont, Vector2 screen, out Vector2 local)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_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_0090: Unknown result type (might be due to invalid IL or missing references)
			local = Vector2.zero;
			Vector3 point = default(Vector3);
			if ((Object)(object)Cam == (Object)null)
			{
				((Vector3)(ref point))..ctor(screen.x, screen.y, ((Transform)cont).position.z);
			}
			else
			{
				Ray val = Cam.ScreenPointToRay(new Vector3(screen.x, screen.y, 0f));
				Plane val2 = default(Plane);
				((Plane)(ref val2))..ctor(((Transform)cont).forward, ((Transform)cont).position);
				float num = default(float);
				if (!((Plane)(ref val2)).Raycast(val, ref num))
				{
					return false;
				}
				point = ((Ray)(ref val)).GetPoint(num);
			}
			local = Vector2.op_Implicit(((Transform)cont).InverseTransformPoint(point));
			return true;
		}

		internal static void BeforeDown(DragCasePanel d)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			grabbedOutside = false;
			RestoreOne(d.itemController);
			Forget(d.itemController);
			object obj = d.panelRect;
			if (obj == null)
			{
				PinnedItemController itemController = d.itemController;
				obj = ((itemController != null) ? itemController.rect : null);
			}
			RectTransform val = (RectTransform)obj;
			if (!((Object)(object)val == (Object)null))
			{
				grabbedRect = val;
				grabbedAt = val.anchoredPosition;
				grabbedOutside = Mathf.Abs(grabbedAt.x) > Edge.x + 0.5f || Mathf.Abs(grabbedAt.y) > Edge.y + 0.5f;
			}
		}

		internal static void Begin(DragCasePanel d, Vector2 screen)
		{
			//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_0041: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_00a3: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			offsets.Clear();
			if (!grabbedOutside || (Object)(object)grabbedRect == (Object)null || Plugin.BoardScale.Value <= 1.001f)
			{
				return;
			}
			RectTransform val = grabbedRect;
			Vector2 val2 = val.anchoredPosition - grabbedAt;
			if (((Vector2)(ref val2)).sqrMagnitude > 0.25f)
			{
				ManualLogSource l = Plugin.L;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(53, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[BOARD] grabbed pin was pulled back to ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Vector2>(val.anchoredPosition);
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", put back at ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Vector2>(grabbedAt);
				}
				l.LogInfo(val3);
				val.anchoredPosition = grabbedAt;
				Strings(d.itemController, val);
			}
			object obj = d.pinnedContainer;
			if (obj == null)
			{
				Transform parent = ((Transform)val).parent;
				obj = ((parent != null) ? ((Il2CppObjectBase)parent).TryCast<RectTransform>() : null);
			}
			RectTransform val4 = (RectTransform)obj;
			if ((Object)(object)val4 != (Object)null && Local(val4, screen, out var local))
			{
				offsets[((Il2CppObjectBase)d).Pointer] = grabbedAt - local;
			}
		}

		private static void Store(PinnedItemController? pic, Vector2 pos)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				CaseElement val = (((Object)(object)pic != (Object)null) ? pic.caseElement : null);
				if (val != null)
				{
					val.v = pos;
				}
			}
			catch
			{
			}
		}

		internal static void StoreSelected(PinnedItemController? dropped)
		{
			//IL_0030: 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)
			if (Plugin.BoardScale.Value <= 1.001f)
			{
				return;
			}
			if ((Object)(object)dropped != (Object)null && (Object)(object)dropped.rect != (Object)null)
			{
				Store(dropped, dropped.rect.anchoredPosition);
			}
			List<PinnedItemController> val = (((Object)(object)InterfaceController.Instance != (Object)null) ? InterfaceController.Instance.selectedPinned : null);
			if (val == null || val.Count < 2)
			{
				return;
			}
			Enumerator<PinnedItemController> enumerator = val.GetEnumerator();
			while (enumerator.MoveNext())
			{
				PinnedItemController current = enumerator.Current;
				if ((Object)(object)current != (Object)null && (Object)(object)current.rect != (Object)null)
				{
					Store(current, current.rect.anchoredPosition);
				}
			}
		}

		private static bool Past(Vector2 p)
		{
			//IL_0000: 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)
			if (!(Mathf.Abs(p.x) > Edge.x + 0.5f))
			{
				return Mathf.Abs(p.y) > Edge.y + 0.5f;
			}
			return true;
		}

		internal static void Keep(PinnedItemController pic)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			if (!(Plugin.BoardScale.Value <= 1.001f) && !((Object)(object)pic == (Object)null) && !((Object)(object)pic.rect == (Object)null) && outside.TryGetValue(((Il2CppObjectBase)pic.rect).Pointer, out var value))
			{
				Vector2 val = pic.rect.anchoredPosition - value;
				if (((Vector2)(ref val)).sqrMagnitude > 0.25f)
				{
					pic.rect.anchoredPosition = value;
					Strings(pic, pic.rect);
				}
				Store(pic, value);
			}
		}

		internal static void Placed(PinnedItemController pic, Vector2 newPos)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_003e: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			float value = Plugin.BoardScale.Value;
			if (value <= 1.001f || (Object)(object)pic == (Object)null || (Object)(object)pic.rect == (Object)null || !Past(newPos))
			{
				return;
			}
			Vector2 val = Edge * value;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(Mathf.Clamp(newPos.x, 0f - val.x, val.x), Mathf.Clamp(newPos.y, 0f - val.y, val.y));
			outside[((Il2CppObjectBase)pic.rect).Pointer] = val2;
			Watch(pic);
			Vector2 val3 = pic.rect.anchoredPosition - val2;
			if (((Vector2)(ref val3)).sqrMagnitude > 0.25f)
			{
				pic.rect.anchoredPosition = val2;
				Strings(pic, pic.rect);
			}
			Store(pic, val2);
			if (placedLogs++ < 30)
			{
				ManualLogSource l = Plugin.L;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(45, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[BOARD] pin '");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(((Object)pic).name);
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("' put back past the old edge at ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<Vector2>(val2);
				}
				l.LogInfo(val4);
			}
		}

		internal static bool TakeNew(PinnedItemController pic)
		{
			if (!fresh.TryGetValue(((Il2CppObjectBase)pic).Pointer, out var value))
			{
				return false;
			}
			fresh.Remove(((Il2CppObjectBase)pic).Pointer);
			return Time.unscaledTime - value < 10f;
		}

		internal static void Loading(PinnedItemController pic, CaseElement ce)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)pic != (Object)null)
			{
				fresh[((Il2CppObjectBase)pic).Pointer] = Time.unscaledTime;
			}
			if ((Object)(object)pic == (Object)null || ce == null)
			{
				return;
			}
			if (!Past(ce.v))
			{
				if ((Object)(object)pic.rect != (Object)null)
				{
					outside.Remove(((Il2CppObjectBase)pic.rect).Pointer);
				}
			}
			else
			{
				loaded.Add((pic, ce.v, Time.unscaledTime + 15f));
			}
		}

		internal static void Forget(PinnedItemController? pic)
		{
			if (!((Object)(object)pic == (Object)null))
			{
				loaded.RemoveAll(((PinnedItemController pic, Vector2 want, float until) x) => (Object)(object)x.pic == (Object)null || ((Il2CppObjectBase)x.pic).Pointer == ((Il2CppObjectBase)pic).Pointer);
			}
		}

		internal static void RestoreLoaded()
		{
			//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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00af: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			if (loaded.Count == 0)
			{
				return;
			}
			float value = Plugin.BoardScale.Value;
			Vector2 val4 = default(Vector2);
			bool flag = default(bool);
			for (int num = loaded.Count - 1; num >= 0; num--)
			{
				var (val, val2, num2) = loaded[num];
				if (Time.unscaledTime > num2)
				{
					loaded.RemoveAt(num);
				}
				else
				{
					try
					{
						if ((Object)(object)val == (Object)null || (Object)(object)val.rect == (Object)null)
						{
							loaded.RemoveAt(num);
						}
						else if (!(value <= 1.001f) && !val.isDragging)
						{
							Vector2 val3 = Edge * value;
							((Vector2)(ref val4))..ctor(Mathf.Clamp(val2.x, 0f - val3.x, val3.x), Mathf.Clamp(val2.y, 0f - val3.y, val3.y));
							outside[((Il2CppObjectBase)val.rect).Pointer] = val4;
							Watch(val);
							Store(val, val4);
							Vector2 val5 = val.rect.anchoredPosition - val4;
							if (!(((Vector2)(ref val5)).sqrMagnitude <= 0.25f))
							{
								val.rect.anchoredPosition = val4;
								Strings(val, val.rect);
								if (placedLogs++ < 60)
								{
									ManualLogSource l = Plugin.L;
									BepInExInfoLogInterpolatedStringHandler val6 = new BepInExInfoLogInterpolatedStringHandler(52, 2, ref flag);
									if (flag)
									{
										((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[BOARD] loaded pin '");
										((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>(((Object)val).name);
										((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("' put back past the old edge at ");
										((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<Vector2>(val4);
									}
									l.LogInfo(val6);
								}
							}
						}
					}
					catch
					{
						loaded.RemoveAt(num);
					}
				}
			}
		}

		private static void RedrawStrings(RectTransform rt)
		{
			try
			{
				foreach (StringController item in Object.FindObjectsOfType<StringController>())
				{
					if (!((Object)(object)item == (Object)null) && (((Object)(object)item.fromRect != (Object)null && (((Il2CppObjectBase)item.fromRect).Pointer == ((Il2CppObjectBase)rt).Pointer || ((Transform)item.fromRect).IsChildOf((Transform)(object)rt))) || ((Object)(object)item.toRect != (Object)null && (((Il2CppObjectBase)item.toRect).Pointer == ((Il2CppObjectBase)rt).Pointer || ((Transform)item.toRect).IsChildOf((Transform)(object)rt)))))
					{
						item.UpdatePosition();
					}
				}
			}
			catch
			{
			}
		}

		internal static void Direct(DragCasePanel d, Vector2 asked)
		{
			//IL_0044: 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_004f: 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_0058: 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_006a: 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_0077: 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_009a: 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_00d2: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			float value = Plugin.BoardScale.Value;
			if (value <= 1.001f || (Object)(object)d == (Object)null)
			{
				return;
			}
			object obj = d.panelRect;
			if (obj == null)
			{
				PinnedItemController itemController = d.itemController;
				obj = ((itemController != null) ? itemController.rect : null);
			}
			RectTransform val = (RectTransform)obj;
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Vector2 val2 = Edge * value;
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(Mathf.Clamp(asked.x, 0f - val2.x, val2.x), Mathf.Clamp(asked.y, 0f - val2.y, val2.y));
			if (Past(val3))
			{
				outside[((Il2CppObjectBase)val).Pointer] = val3;
				if ((Object)(object)d.itemController != (Object)null)
				{
					Watch(d.itemController);
				}
			}
			else
			{
				outside.Remove(((Il2CppObjectBase)val).Pointer);
			}
			Vector2 anchoredPosition = val.anchoredPosition;
			Store(d.itemController, val3);
			Vector2 val4 = val3 - anchoredPosition;
			if (((Vector2)(ref val4)).sqrMagnitude < 0.25f)
			{
				return;
			}
			val.anchoredPosition = val3;
			Strings(d.itemController, val);
			if (directLogs++ % 120 == 0)
			{
				ManualLogSource l = Plugin.L;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val5 = new BepInExInfoLogInterpolatedStringHandler(64, 4, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[BOARD] drag step past the old frame (");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<int>(directLogs);
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("): game put ");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Vector2>(anchoredPosition);
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(", asked ");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Vector2>(asked);
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(", now ");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Vector2>(val3);
				}
				l.LogInfo(val5);
			}
		}

		private static Vector2 RingSpot(int n)
		{
			//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_0032: 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_0048: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//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_008a: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00d2: 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_00e2: 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_0004: Unknown result type (might be due to invalid IL or missing references)
			if (n <= 0)
			{
				return Vector2.zero;
			}
			Vector2[] obj = new Vector2[8]
			{
				new Vector2(1f, 0f),
				new Vector2(-1f, 0f),
				new Vector2(0f, 1f),
				new Vector2(0f, -1f),
				new Vector2(1f, 1f),
				new Vector2(-1f, 1f),
				new Vector2(1f, -1f),
				new Vector2(-1f, -1f)
			};
			int num = (n - 1) / 8 + 1;
			Vector2 val = obj[(n - 1) % 8];
			return new Vector2(val.x * 230f * (float)num, val.y * 200f * (float)num);
		}

		internal static void AutoPinned(PinnedItemController pic)
		{
			//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_0087: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00ae: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_0100: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: 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_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: 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_0171: 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_019c: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Expected O, but got Unknown
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.BoardScale.Value <= 1.001f || (Object)(object)pic == (Object)null || (Object)(object)pic.rect == (Object)null)
			{
				return;
			}
			Vector2 val = pic.rect.anchoredPosition;
			if (((Vector2)(ref val)).sqrMagnitude > 1f)
			{
				return;
			}
			Transform parent = ((Transform)pic.rect).parent;
			RectTransform val2 = ((parent != null) ? ((Il2CppObjectBase)parent).TryCast<RectTransform>() : null);
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			Vector2 screen = default(Vector2);
			((Vector2)(ref screen))..ctor((float)Screen.width / 2f, (float)Screen.height / 2f);
			if (!Local(val2, screen, out var local))
			{
				return;
			}
			Vector2 val3 = local - (Vector2.op_Implicit(((Transform)pic.rect).localPosition) - pic.rect.anchoredPosition);
			if (Time.unscaledTime - autoAt > 2f)
			{
				autoN = 0;
			}
			autoAt = Time.unscaledTime;
			val3 += RingSpot(autoN++);
			float value = Plugin.BoardScale.Value;
			Vector2 val4 = Edge * value;
			((Vector2)(ref val3))..ctor(Mathf.Clamp(val3.x, 0f - val4.x, val4.x), Mathf.Clamp(val3.y, 0f - val4.y, val4.y));
			val = val3 - pic.rect.anchoredPosition;
			if (((Vector2)(ref val)).sqrMagnitude < 4f)
			{
				return;
			}
			pic.rect.anchoredPosition = val3;
			if (Past(val3))
			{
				outside[((Il2CppObjectBase)pic.rect).Pointer] = val3;
				Watch(pic);
			}
			Store(pic, val3);
			Strings(pic, pic.rect);
			if (autoLogs++ < 20)
			{
				ManualLogSource l = Plugin.L;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val5 = new BepInExInfoLogInterpolatedStringHandler(52, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[BOARD] new pin '");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(((Object)pic).name);
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("' put in the middle of the view at ");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Vector2>(val3);
				}
				l.LogInfo(val5);
			}
		}

		internal static void Watch(PinnedItemController pic)
		{
			if (!((Object)(object)pic == (Object)null) && !(Plugin.BoardScale.Value <= 1.001f))
			{
				watched.RemoveAll(((PinnedItemController pic, float until) x) => (Object)(object)x.pic == (Object)null || ((Il2CppObjectBase)x.pic).Pointer == ((Il2CppObjectBase)pic).Pointer);
				watched.Add((pic, Time.unscaledTime + 5f));
			}
		}

		internal static void RestoreOne(PinnedItemController? pic)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)pic == (Object)null) && !((Object)(object)pic.rect == (Object)null) && outside.TryGetValue(((Il2CppObjectBase)pic.rect).Pointer, out var value) && Past(value))
			{
				Vector2 anchoredPosition = pic.rect.anchoredPosition;
				if (!(Mathf.Abs(Mathf.Abs(anchoredPosition.x) - Edge.x) >= 1f) || !(Mathf.Abs(Mathf.Abs(anchoredPosition.y) - Edge.y) >= 1f))
				{
					pic.rect.anchoredPosition = value;
					Store(pic, value);
					Strings(pic, pic.rect);
				}
			}
		}

		internal static void Guard()
		{
			//IL_006c: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			bool flag2 = default(bool);
			for (int num = watched.Count - 1; num >= 0; num--)
			{
				var (val, num2) = watched[num];
				try
				{
					RectTransform rect;
					Vector2 value;
					bool flag;
					Vector2 anchoredPosition;
					if ((Object)(object)val == (Object)null || (Object)(object)val.rect == (Object)null)
					{
						watched.RemoveAt(num);
					}
					else
					{
						rect = val.rect;
						if (!outside.TryGetValue(((Il2CppObjectBase)rect).Pointer, out value) || !Past(value))
						{
							watched.RemoveAt(num);
						}
						else
						{
							flag = Time.unscaledTime > num2;
							anchoredPosition = rect.anchoredPosition;
							if (Mathf.Abs(Mathf.Abs(anchoredPosition.x) - Edge.x) < 1f || Mathf.Abs(Mathf.Abs(anchoredPosition.y) - Edge.y) < 1f)
							{
								goto IL_0114;
							}
							if (!(val.isDragging || flag))
							{
								Vector2 val2 = anchoredPosition - value;
								if (!(((Vector2)(ref val2)).sqrMagnitude <= 1600f) && !Past(anchoredPosition))
								{
									goto IL_0114;
								}
							}
						}
					}
					goto end_IL_002a;
					IL_0114:
					rect.anchoredPosition = value;
					Store(val, value);
					Strings(val, rect);
					if (guardLogs++ < 80)
					{
						ManualLogSource l = Plugin.L;
						BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(42, 4, ref flag2);
						if (flag2)
						{
							((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[BOARD] pin '");
							((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(((Object)val).name);
							((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("'");
							((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(val.isDragging ? " (carried)" : (flag ? " (at rest)" : ""));
							((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" was moved to ");
							((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Vector2>(anchoredPosition);
							((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", put back at ");
							((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Vector2>(value);
						}
						l.LogInfo(val3);
					}
					end_IL_002a:;
				}
				catch
				{
					watched.RemoveAt(num);
				}
			}
		}

		private static void Strings(PinnedItemController? pic, RectTransform rt)
		{
			try
			{
				List<StringController> val = ((pic != null) ? pic.connectedStrings : null);
				if (val == null)
				{
					RedrawStrings(rt);
					return;
				}
				Enumerator<StringController> enumerator = val.GetEnumerator();
				while (enumerator.MoveNext())
				{
					StringController current = enumerator.Current;
					if ((Object)(object)current != (Object)null)
					{
						current.UpdatePosition();
					}
				}
			}
			catch
			{
				RedrawStrings(rt);
			}
		}

		internal static void After(DragCasePanel d, Vector2 screen, bool isLocal)
		{
			//IL_0077: 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_0089: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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_014b: 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_0153: 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_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: 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_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: 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_01c4: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Expected O, but got Unknown
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			float value = Plugin.BoardScale.Value;
			if (value <= 1.001f || (Object)(object)d == (Object)null || DirectOn)
			{
				return;
			}
			object obj = d.panelRect;
			if (obj == null)
			{
				PinnedItemController itemController = d.itemController;
				obj = ((itemController != null) ? itemController.rect : null);
			}
			RectTransform val = (RectTransform)obj;
			object obj2 = d.pinnedContainer;
			if (obj2 == null)
			{
				if (val == null)
				{
					obj2 = null;
				}
				else
				{
					Transform parent = ((Transform)val).parent;
					obj2 = ((parent != null) ? ((Il2CppObjectBase)parent).TryCast<RectTransform>() : null);
				}
			}
			RectTransform val2 = (RectTransform)obj2;
			if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
			{
				return;
			}
			Vector2 local = screen;
			if (!isLocal && !Local(val2, screen, out local))
			{
				return;
			}
			Vector2 anchoredPosition = val.anchoredPosition;
			if (!(Mathf.Abs(anchoredPosition.x) >= Edge.x - 0.5f) && !(Mathf.Abs(anchoredPosition.y) >= Edge.y - 0.5f))
			{
				offsets[((Il2CppObjectBase)d).Pointer] = anchoredPosition - local;
				outside.Remove(((Il2CppObjectBase)val).Pointer);
				return;
			}
			if (!offsets.TryGetValue(((Il2CppObjectBase)d).Pointer, out var value2))
			{
				if (!outside.TryGetValue(((Il2CppObjectBase)val).Pointer, out var value3))
				{
					return;
				}
				value2 = value3 - local;
				offsets[((Il2CppObjectBase)d).Pointer] = value2;
			}
			Vector2 val3 = local + value2;
			Vector2 val4 = Edge * value;
			((Vector2)(ref val3))..ctor(Mathf.Clamp(val3.x, 0f - val4.x, val4.x), Mathf.Clamp(val3.y, 0f - val4.y, val4.y));
			Vector2 val5 = val3 - anchoredPosition;
			if (((Vector2)(ref val5)).sqrMagnitude < 0.25f)
			{
				return;
			}
			val.anchoredPosition = val3;
			outside[((Il2CppObjectBase)val).Pointer] = val3;
			if ((Object)(object)d.itemController != (Object)null)
			{
				Watch(d.itemController);
			}
			Store(d.itemController, val3);
			Strings(d.itemController, val);
			if (moved++ % 60 == 0)
			{
				ManualLogSource l = Plugin.L;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val6 = new BepInExInfoLogInterpolatedStringHandler(44, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[BOARD] pin past the old edge (");
					((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<int>(moved);
					((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" steps): ");
					((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<Vector2>(anchoredPosition);
					((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" -> ");
					((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<Vector2>(val3);
				}
				l.LogInfo(val6);
			}
		}
	}
	[HarmonyPatch]
	internal static class PinDragPatches
	{
		private struct Grip
		{
			public Vector2 off;

			public float at;

			public RectTransform? rt;

			public PinnedItemController? pic;
		}

		private static int cursorLogs;

		private static int gapLogs;

		private static int gripLogs;

		private static Vector2 lastLocal;

		private static float lastAt = -1f;

		private static readonly Dictionary<IntPtr, Grip> grips = new Dictionary<IntPtr, Grip>();

		[HarmonyPatch(typeof(PinnedItemController), "Setup")]
		[HarmonyPrefix]
		private static void Setup(PinnedItemController __instance, CaseElement newElement)
		{
			try
			{
				PinDrag.Loading(__instance, newElement);
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(PinnedItemController), "SetPostion")]
		[HarmonyPostfix]
		private static void Placed(PinnedItemController __instance, Vector2 newPos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PinDrag.Placed(__instance, newPos);
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(PinnedItemController), "OnEndDrag")]
		[HarmonyPostfix]
		private static void EndDrag(PinnedItemController __instance)
		{
			try
			{
				Settle();
				PinDrag.Keep(__instance);
				PinDrag.Watch(__instance);
				PinDrag.StoreSelected(__instance);
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(PinnedItemController), "ForcePointerUp")]
		[HarmonyPostfix]
		private static void PadDrop(PinnedItemController __instance)
		{
			try
			{
				Settle();
				PinDrag.Keep(__instance);
				PinDrag.Watch(__instance);
				PinDrag.StoreSelected(__instance);
				if (Plugin.DragProbe.Value)
				{
					BoardSizer.Dropped(__instance);
				}
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(PinnedItemController), "OnMoveThis")]
		[HarmonyPostfix]
		private static void Moved(PinnedItemController __instance)
		{
			try
			{
				PinDrag.Keep(__instance);
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(DragCasePanel), "OnPointerDown")]
		[HarmonyPrefix]
		private static void BeforeDown(DragCasePanel __instance)
		{
			try
			{
				PinDrag.BeforeDown(__instance);
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(DragCasePanel), "OnPointerDown")]
		[HarmonyPostfix]
		private static void Down(DragCasePanel __instance, PointerEventData data)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PinDrag.Cam = data.pressEventCamera;
				PinDrag.Begin(__instance, data.position);
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(DragCasePanel), "OnDrag")]
		[HarmonyPostfix]
		private static void Drag(DragCasePanel __instance, PointerEventData data)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PinDrag.Cam = data.pressEventCamera;
				PinDrag.After(__instance, data.position, isLocal: false);
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(DragCasePanel), "ForceDrag")]
		[HarmonyPostfix]
		private static void Force(DragCasePanel __instance, Vector2 cursorPosition)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PinDrag.After(__instance, cursorPosition, isLocal: false);
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(DragCasePanel), "SetPositionCursor")]
		[HarmonyPrefix]
		private static bool Cursor(DragCasePanel __instance, Vector2 pointerPosition)
		{
			//IL_001a: 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)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: 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_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Expected O, but got Unknown
			//IL_0294: 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_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Expected O, but got Unknown
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: 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_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Expected O, but got Unknown
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (Plugin.BoardScale.Value <= 1.001f)
				{
					return true;
				}
				Vector2 pointerOffset = __instance.pointerOffset;
				object obj = __instance.panelRect;
				if (obj == null)
				{
					PinnedItemController itemController = __instance.itemController;
					obj = ((itemController != null) ? itemController.rect : null);
				}
				RectTransform val = (RectTransform)obj;
				bool flag = (Object)(object)val != (Object)null && (Mathf.Abs(Mathf.Abs(val.anchoredPosition.x) - PinDrag.Edge.x) < 2f || Mathf.Abs(Mathf.Abs(val.anchoredPosition.y) - PinDrag.Edge.y) < 2f);
				PinnedItemController itemController2 = __instance.itemController;
				List<PinnedItemController> val2 = (((Object)(object)InterfaceController.Instance != (Object)null) ? InterfaceController.Instance.selectedPinned : null);
				bool flag2 = default(bool);
				if ((val2 == null || val2.Count <= 1) && flag && ((Vector2)(ref pointerOffset)).sqrMagnitude > 250000f && (Object)(object)itemController2 != (Object)null && !itemController2.isSelected && PinDrag.TakeNew(itemController2))
				{
					__instance.pointerOffset = new Vector2(0f, 80f);
					if (gapLogs++ < 20)
					{
						ManualLogSource l = Plugin.L;
						BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(51, 3, ref flag2);
						if (flag2)
						{
							((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[BOARD] carried pin '");
							((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(((Object)(object)__instance.itemController != (Object)null) ? ((Object)__instance.itemController).name : "?");
							((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("' hung ");
							((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Vector2>(pointerOffset);
							((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" from the pointer, now ");
							((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Vector2>(__instance.pointerOffset);
						}
						l.LogInfo(val3);
					}
				}
				RectTransform pinnedContainer = __instance.pinnedContainer;
				if ((Object)(object)pinnedContainer == (Object)null)
				{
					return true;
				}
				Ray val4 = default(Ray);
				((Ray)(ref val4))..ctor(new Vector3(pointerPosition.x, pointerPosition.y, -100f), Vector3.forward);
				Plane val5 = default(Plane);
				((Plane)(ref val5))..ctor(((Transform)pinnedContainer).rotation * Vector3.back, ((Transform)pinnedContainer).position);
				float num = default(float);
				if (!((Plane)(ref val5)).Raycast(val4, ref num))
				{
					return true;
				}
				Vector2 val6 = Vector2.op_Implicit(((Transform)pinnedContainer).InverseTransformPoint(((Ray)(ref val4)).GetPoint(num)));
				if ((Object)(object)val != (Object)null)
				{
					float unscaledTime = Time.unscaledTime;
					if (!grips.TryGetValue(((Il2CppObjectBase)__instance).Pointer, out var value) || unscaledTime - value.at > 0.3f)
					{
						bool flag3 = pointerOffset != __instance.pointerOffset;
						value.off = (flag3 ? __instance.pointerOffset : (val6 - val.anchoredPosition));
						if (gripLogs++ < 10)
						{
							ManualLogSource l2 = Plugin.L;
							BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(42, 3, ref flag2);
							if (flag2)
							{
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[BOARD] drag grip for '");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(((Object)(object)itemController2 != (Object)null) ? ((Object)itemController2).name : "?");
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("': ");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Vector2>(value.off);
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" (the game had ");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Vector2>(pointerOffset);
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(")");
							}
							l2.LogInfo(val3);
						}
					}
					value.at = unscaledTime;
					value.rt = val;
					value.pic = itemController2;
					grips[((Il2CppObjectBase)__instance).Pointer] = value;
					Vector2 val7 = PinDrag.Edge * Mathf.Max(1f, Plugin.BoardScale.Value);
					float num2 = 0f - val7.x;
					float num3 = val7.x;
					float num4 = 0f - val7.y;
					float num5 = val7.y;
					foreach (KeyValuePair<IntPtr, Grip> grip in grips)
					{
						if (!(unscaledTime - grip.Value.at > 0.3f))
						{
							Vector2 off = grip.Value.off;
							num2 = Mathf.Max(num2, 0f - val7.x + off.x);
							num3 = Mathf.Min(num3, val7.x + off.x);
							num4 = Mathf.Max(num4, 0f - val7.y + off.y);
							num5 = Mathf.Min(num5, val7.y + off.y);
						}
					}
					if (num2 <= num3)
					{
						val6.x = Mathf.Clamp(val6.x, num2, num3);
					}
					if (num4 <= num5)
					{
						val6.y = Mathf.Clamp(val6.y, num4, num5);
					}
					lastLocal = val6;
					lastAt = unscaledTime;
					__instance.pointerOffset = value.off;
					__instance.SetPositionDirect(val6 - value.off);
					return false;
				}
				Rect rect = pinnedContainer.rect;
				if (((Rect)(ref rect)).Contains(val6))
				{
					return true;
				}
				__instance.SetPositionDirect(val6 - __instance.pointerOffset);
				if (cursorLogs++ < 20)
				{
					ManualLogSource l3 = Plugin.L;
					BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(78, 2, ref flag2);
					if (flag2)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[BOARD] carried new pin follows the pointer past the old edge at ");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Vector2>(val6);
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", board part ");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Rect>(pinnedContainer.rect);
					}
					l3.LogInfo(val3);
				}
				return false;
			}
			catch
			{
				return true;
			}
		}

		private static void Settle()
		{
			//IL_0054: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0075: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			float unscaledTime = Time.unscaledTime;
			if (unscaledTime - lastAt > 0.5f)
			{
				return;
			}
			int num = 0;
			foreach (KeyValuePair<IntPtr, Grip> grip in grips)
			{
				Grip value = grip.Value;
				if (!(unscaledTime - value.at > 0.5f) && !((Object)(object)value.rt == (Object)null))
				{
					Vector2 val = lastLocal - value.off;
					Vector2 val2 = value.rt.anchoredPosition - val;
					if (((Vector2)(ref val2)).sqrMagnitude > 0.25f)
					{
						value.rt.anchoredPosition = val;
						num++;
					}
				}
			}
			lastAt = -1f;
			if (num > 0 && gripLogs++ < 40)
			{
				ManualLogSource l = Plugin.L;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(54, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[BOARD] drop: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(num);
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" card(s) put back in line with the group");
				}
				l.LogInfo(val3);
			}
		}

		[HarmonyPatch(typeof(PinnedItemController), "AutoPinPostion")]
		[HarmonyPostfix]
		private static void AutoPin(PinnedItemController __instance)
		{
			try
			{
				PinDrag.AutoPinned(__instance);
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(PinnedItemController), "ForceDrag")]
		[HarmonyPrefix]
		private static void BeforeStep()
		{
			try
			{
				PinDrag.Guard();
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(DragCasePanel), "SetPositionDirect")]
		[HarmonyPostfix]
		private static void Direct(DragCasePanel __instance, object[] __args)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (__args != null && __args.Length != 0 && __args[0] is Vector2 asked)
				{
					PinDrag.Direct(__instance, asked);
				}
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(DragCasePanel), "ForceDragController")]
		[HarmonyPrefix]
		private static void PadSpeed(DragCasePanel __instance, ref Vector2 newLocalPosition)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00b3: 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_00ba: 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)
			try
			{
				float num = Plugin.PadMoveSpeed.Value;
				try
				{
					ZoomContent board = BoardSizer.Board;
					if ((Object)(object)board != (Object)null && board.zoom > 0.01f)
					{
						num *= Mathf.Clamp(1f / board.zoom, 1f, 6f);
					}
				}
				catch
				{
				}
				if (num <= 1.001f)
				{
					return;
				}
				object obj2 = __instance.panelRect;
				if (obj2 == null)
				{
					PinnedItemController itemController = __instance.itemController;
					obj2 = ((itemController != null) ? itemController.rect : null);
				}
				RectTransform val = (RectTransform)obj2;
				if (!((Object)(object)val == (Object)null))
				{
					Vector2 val2 = newLocalPosition - val.anchoredPosition;
					if (!(((Vector2)(ref val2)).sqrMagnitude < 0.0001f) && !(((Vector2)(ref val2)).magnitude > 60f))
					{
						newLocalPosition = val.anchoredPosition + val2 * num;
					}
				}
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(DragCasePanel), "ForceDragController")]
		[HarmonyPostfix]
		private static void Pad(DragCasePanel __instance, Vector2 newLocalPosition)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PinDrag.After(__instance, newLocalPosition, isLocal: true);
			}
			catch
			{
			}
		}
	}
	[HarmonyPatch(typeof(ZoomContent), "Awake")]
	internal static class ZoomWatch
	{
		internal static readonly List<ZoomContent> All = new List<ZoomContent>();

		private static void Postfix(ZoomContent __instance)
		{
			try
			{
				All.Add(__instance);
			}
			catch
			{
			}
		}
	}
	internal static class CarryProbe
	{
		private static string file = "";

		private static int lines;

		private static int depth;

		private static float start;

		private static readonly StringBuilder buf = new StringBuilder();

		private static readonly (Type type, string name, bool vec)[] Targets = new(Type, string, bool)[17]
		{
			(typeof(DragCasePanel), "OnPointerDown", false),
			(typeof(DragCasePanel), "OnDrag", false),
			(typeof(DragCasePanel), "ForceDrag", false),
			(typeof(DragCasePanel), "ForceDragController", false),
			(typeof(DragCasePanel), "ClampCursor", true),
			(typeof(DragCasePanel), "SetPositionCursor", false),
			(typeof(DragCasePanel), "SetPositionDirect", false),
			(typeof(DragCasePanel), "ClampToCorkboard", true),
			(typeof(DragCasePanel), "RadiusClamp", true),
			(typeof(PinnedItemController), "AutoPinPostion", false),
			(typeof(PinnedItemController), "SetPostion", false),
			(typeof(PinnedItemController), "ForceDrag", false),
			(typeof(PinnedItemController), "OnPointerDown", false),
			(typeof(PinnedItemController), "OnPointerUp", false),
			(typeof(PinnedItemController), "OnEndDrag", false),
			(typeof(PinnedItemController), "ForcePointerUp", false),
			(typeof(PinnedItemController), "ForceCancelDrag", false)
		};

		private static readonly StringBuilder pending = new StringBuilder();

		private static float flushedAt;

		internal static void Install(Harmony h)
		{
			//IL_0026: 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_0037: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			file = Path.Combine(Paths.BepInExRootPath, "caseboard-carry-finds.log");
			int num = 0;
			HarmonyMethod val = new HarmonyMethod(typeof(CarryProbe), "Pre", (Type[])null)
			{
				priority = 800
			};
			HarmonyMethod val2 = new HarmonyMethod(typeof(CarryProbe), "PostV", (Type[])null)
			{
				priority = 0
			};
			HarmonyMethod val3 = new HarmonyMethod(typeof(CarryProbe), "Post", (Type[])null)
			{
				priority = 0
			};
			(Type, string, bool)[] targets = Targets;
			bool flag2 = default(bool);
			for (int i = 0; i < targets.Length; i++)
			{
				var (type, text, flag) = targets[i];
				try
				{
					MethodInfo methodInfo = AccessTools.Method(type, text, (Type[])null, (Type[])null);
					if (methodInfo == null)
					{
						ManualLogSource l = Plugin.L;
						BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(19, 2, ref flag2);
						if (flag2)
						{
							((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[CARRY] ");
							((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(type.Name);
							((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(".");
							((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(text);
							((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" not found");
						}
						l.LogWarning(val4);
					}
					else
					{
						h.Patch((MethodBase)methodInfo, val, flag ? val2 : val3, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						num++;
					}
				}
				catch (Exception ex)
				{
					ManualLogSource l2 = Plugin.L;
					BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(11, 3, ref flag2);
					if (flag2)
					{
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[CARRY] ");
						((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(type.Name);
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(".");
						((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(text);
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(": ");
						((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message);
					}
					l2.LogWarning(val4);
				}
			}
			Write(string.Format("=== Caseboard Expanded {0} carry probe, {1} of {2} hooks, {3:yyyy-MM-dd HH:mm} ===", "1.4.12", num, Targets.Length, DateTime.Now));
			ManualLogSource l3 = Plugin.L;
			BepInExInfoLogInterpolatedStringHandler val5 = new BepInExInfoLogInterpolatedStringHandler(66, 2, ref flag2);
			if (flag2)
			{
				((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[CARRY] probe on, ");
				((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<int>(num);
				((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" of ");
				((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<int>(Targets.Length);
				((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" hooks, writing to caseboard-carry-finds.log");
			}
			l3.LogInfo(val5);
		}

		private static void Write(string s)
		{
			if (lines++ <= 12000)
			{
				pending.Append(s).Append('\n');
				if (pending.Length > 16000 || Time.unscaledTime - flushedAt > 2f)
				{
					Flush();
				}
			}
		}

		internal static void Flush()
		{
			flushedAt = Time.unscaledTime;
			if (pending.Length != 0)
			{
				try
				{
					File.AppendAllText(file, pending.ToString());
				}
				catch
				{
				}
				pending.Clear();
			}
		}

		private static RectTransform? Rect(object o)
		{
			try
			{
				DragCasePanel val = (DragCasePanel)((o is DragCasePanel) ? o : null);
				if (val != null)
				{
					object obj = val.panelRect;
					if (obj == null)
					{
						PinnedItemController itemController = val.itemController;
						obj = ((itemController != null) ? itemController.rect : null);
					}
					return (RectTransform?)obj;
				}
				PinnedItemController val2 = (PinnedItemController)((o is PinnedItemController) ? o : null);
				if (val2 != null)
				{
					return val2.rect;
				}
			}
			catch
			{
			}
			return null;
		}

		private static string Name(object o)
		{
			try
			{
				DragCasePanel val = (DragCasePanel)((o is DragCasePanel) ? o : null);
				if (val != null)
				{
					return "D:" + (((Object)(object)val.itemController != (Object)null) ? ((Object)val.itemController).name : ((Object)val).name);
				}
				PinnedItemController val2 = (PinnedItemController)((o is PinnedItemController) ? o : null);
				if (val2 != null)
				{
					return "P:" + ((Object)val2).name;
				}
			}
			catch
			{
			}
			return "?";
		}

		private static string V(Vector2 v)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			return $"({v.x:0},{v.y:0})";
		}

		private static string Args(object[] a)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			if (a == null || a.Length == 0)
			{
				return "";
			}
			StringBuilder stringBuilder = new StringBuilder();
			foreach (object obj in a)
			{
				if (stringBuilder.Length > 0)
				{
					stringBuilder.Append(", ");
				}
				string value;
				if (!(obj is Vector2 v))
				{
					if (!(obj is Vector3 val))
					{
						if (!(obj is float num))
						{
							PointerEventData val2 = (PointerEventData)((obj is PointerEventData) ? obj : null);
							value = ((val2 != null) ? ("ptr " + V(val2.position) + " delta " + V(val2.delta)) : ((obj != null) ? obj.GetType().Name : "null"));
						}
						else
						{
							value = num.ToString("0.##");
						}
					}
					else
					{
						value = V(Vector2.op_Implicit(val));
					}
				}
				else
				{
					value = V(v);
				}
				stringBuilder.Append(value);
			}
			return stringBuilder.ToString();
		}

		private static string Board()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ZoomContent board = BoardSizer.Board;
				if ((Object)(object)board == (Object)null)
				{
					return "";
				}
				return string.Format(" | zoom {0:0.###} view {1}", board.zoom, ((Object)(object)board.conta