Decompiled source of ParentalIssues v2.0.1

plugins/ParentalIssues/ParentalIssues.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BepInEx.NET.Common;
using BepInExResoniteShim;
using Elements.Core;
using FrooxEngine;
using HarmonyLib;

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

[ResonitePlugin("art0007i.ParentalIssues", "ParentalIssues", "2.0.1", "art0007i", "https://github.com/art0007i/ParentalIssues")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
	[HarmonyPatch]
	private class ParentalIssuesPatch
	{
		[CompilerGenerated]
		private sealed class <TargetMethods>d__0 : global::System.Collections.Generic.IEnumerable<MethodBase>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<MethodBase>, global::System.Collections.IEnumerator, global::System.IDisposable
		{
			private int <>1__state;

			private MethodBase <>2__current;

			private int <>l__initialThreadId;

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

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

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

			[DebuggerHidden]
			void global::System.IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					MethodInfo val = AccessTools.Method(typeof(SceneInspector), "OnInsertParentPressed", (global::System.Type[])null, (global::System.Type[])null);
					<>2__current = (MethodBase)(object)val;
					<>1__state = 1;
					return true;
				}
				case 1:
				{
					<>1__state = -1;
					MethodInfo val = AccessTools.Method(typeof(SceneInspector), "OnAddChildPressed", (global::System.Type[])null, (global::System.Type[])null);
					<>2__current = (MethodBase)(object)val;
					<>1__state = 2;
					return true;
				}
				case 2:
				{
					<>1__state = -1;
					MethodInfo val = AccessTools.Method(typeof(SlotPositioning), "CreatePivotAtCenter", new global::System.Type[3]
					{
						typeof(Slot),
						typeof(BoundingBox).MakeByRefType(),
						typeof(bool)
					}, (global::System.Type[])null);
					<>2__current = (MethodBase)(object)val;
					<>1__state = 3;
					return true;
				}
				case 3:
					<>1__state = -1;
					return false;
				}
			}

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

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

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

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

		[CompilerGenerated]
		private sealed class <Transpiler>d__1 : global::System.Collections.Generic.IEnumerable<CodeInstruction>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<CodeInstruction>, global::System.Collections.IEnumerator, global::System.IDisposable
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private global::System.Collections.Generic.IEnumerable<CodeInstruction> codes;

			public global::System.Collections.Generic.IEnumerable<CodeInstruction> <>3__codes;

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

			private CodeInstruction <code>5__3;

			private string <s>5__4;

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

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

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

			[DebuggerHidden]
			void global::System.IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 1u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<code>5__3 = null;
				<s>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0089: 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_00ac: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>7__wrap1 = codes.GetEnumerator();
						<>1__state = -3;
						goto IL_0104;
					case 1:
						<>1__state = -3;
						<code>5__3.operand = <s>5__4.Remove(0, 2);
						goto IL_00d7;
					case 2:
						{
							<>1__state = -3;
							<s>5__4 = null;
							<code>5__3 = null;
							goto IL_0104;
						}
						IL_0104:
						if (((global::System.Collections.IEnumerator)<>7__wrap1).MoveNext())
						{
							<code>5__3 = <>7__wrap1.Current;
							object operand = <code>5__3.operand;
							<s>5__4 = operand as string;
							if (<s>5__4 != null && <s>5__4.StartsWith(" - "))
							{
								<>2__current = new CodeInstruction(OpCodes.Call, (object)typeof(Plugin).GetMethod("ProcessString"));
								<>1__state = 1;
								return true;
							}
							goto IL_00d7;
						}
						<>m__Finally1();
						<>7__wrap1 = null;
						return false;
						IL_00d7:
						<>2__current = <code>5__3;
						<>1__state = 2;
						return true;
					}
				}
				catch
				{
					//try-fault
					((global::System.IDisposable)this).Dispose();
					throw;
				}
			}

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

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

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

			[DebuggerHidden]
			global::System.Collections.Generic.IEnumerator<CodeInstruction> global::System.Collections.Generic.IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<Transpiler>d__1 <Transpiler>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Transpiler>d__ = this;
				}
				else
				{
					<Transpiler>d__ = new <Transpiler>d__1(0);
				}
				<Transpiler>d__.codes = <>3__codes;
				return <Transpiler>d__;
			}

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

		[IteratorStateMachine(typeof(<TargetMethods>d__0))]
		private static global::System.Collections.Generic.IEnumerable<MethodBase> TargetMethods()
		{
			yield return (MethodBase)(object)AccessTools.Method(typeof(SceneInspector), "OnInsertParentPressed", (global::System.Type[])null, (global::System.Type[])null);
			yield return (MethodBase)(object)AccessTools.Method(typeof(SceneInspector), "OnAddChildPressed", (global::System.Type[])null, (global::System.Type[])null);
			yield return (MethodBase)(object)AccessTools.Method(typeof(SlotPositioning), "CreatePivotAtCenter", new global::System.Type[3]
			{
				typeof(Slot),
				typeof(BoundingBox).MakeByRefType(),
				typeof(bool)
			}, (global::System.Type[])null);
		}

		[IteratorStateMachine(typeof(<Transpiler>d__1))]
		public static global::System.Collections.Generic.IEnumerable<CodeInstruction> Transpiler(global::System.Collections.Generic.IEnumerable<CodeInstruction> codes)
		{
			global::System.Collections.Generic.IEnumerator<CodeInstruction> enumerator = codes.GetEnumerator();
			try
			{
				while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
				{
					CodeInstruction code = enumerator.Current;
					object operand = code.operand;
					if (operand is string s && s.StartsWith(" - "))
					{
						yield return new CodeInstruction(OpCodes.Call, (object)typeof(Plugin).GetMethod("ProcessString"));
						code.operand = s.Remove(0, 2);
					}
					yield return code;
				}
			}
			finally
			{
				((global::System.IDisposable)enumerator)?.Dispose();
			}
		}
	}

	internal static ManualLogSource Log;

	public override void Load()
	{
		Log = ((BasePlugin)this).Log;
		((BasePlugin)this).HarmonyInstance.PatchAll();
	}

	public static string ProcessString(string str)
	{
		if (str.ToLower().EndsWith("s"))
		{
			return str + "'";
		}
		return str + "'s";
	}
}
public static class PluginMetadata
{
	public const string GUID = "art0007i.ParentalIssues";

	public const string NAME = "ParentalIssues";

	public const string VERSION = "2.0.1";

	public const string AUTHORS = "art0007i";

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