Decompiled source of CapturePrivateUI v2.0.0

plugins/CapturePrivateUI/CapturePrivateUI.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.NET.Common;
using BepInExResoniteShim;
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.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0+d1b9a9ee32b77e965ba96c81e57144ae9f2979c7")]
[assembly: AssemblyProduct("CapturePrivateUI")]
[assembly: AssemblyTitle("CapturePrivateUI")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/art0007i/CapturePrivateUI")]
[assembly: AssemblyVersion("2.0.0.0")]
[module: RefSafetyRules(11)]
namespace CapturePrivateUI;

[ResonitePlugin("art0007i.CapturePrivateUI", "CapturePrivateUI", "2.0.0", "art0007i", "https://github.com/art0007i/CapturePrivateUI")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	private class TagFilterPatch
	{
		public static bool Prefix(Camera __instance, ref bool __result)
		{
			if (!Enabled.Value)
			{
				return true;
			}
			__result = ((Component)__instance).Slot.Tag == TagFilter.Value;
			return false;
		}
	}

	internal static ManualLogSource Log;

	internal static ConfigEntry<bool> Enabled;

	internal static ConfigEntry<string> TagFilter;

	public override void Load()
	{
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Expected O, but got Unknown
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Expected O, but got Unknown
		Log = ((BasePlugin)this).Log;
		Enabled = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", false, "When enabled, all camera components attached to a slot with the specified tag will render private UI.");
		TagFilter = ((BasePlugin)this).Config.Bind<string>("General", "TagFilter", "", "The tag that cameras will require to render private UI. Only works when the above option is enabled.");
		Enabled.SettingChanged += (EventHandler)([CompilerGenerated] (object? _, EventArgs _) =>
		{
			UpdateCameras();
		});
		TagFilter.SettingChanged += (EventHandler)([CompilerGenerated] (object? _, EventArgs _) =>
		{
			UpdateCameras();
		});
		((BasePlugin)this).HarmonyInstance.PatchAll();
	}

	private void UpdateCameras()
	{
		CollectionExtensions.Do<World>(Engine.Current.WorldManager.Worlds, (Action<World>)delegate(World w)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			w.RunSynchronously((Action)delegate
			{
				CollectionExtensions.Do<Camera>((global::System.Collections.Generic.IEnumerable<Camera>)w.RootSlot.GetComponentsInChildren<Camera>((Predicate<Camera>)null, false, false, (Predicate<Slot>)null), (Action<Camera>)delegate(Camera c)
				{
					((ComponentBase<Component>)(object)c).MarkChangeDirty();
				});
			}, false, (IUpdatable)null, false);
		});
	}
}
public static class PluginMetadata
{
	public const string GUID = "art0007i.CapturePrivateUI";

	public const string NAME = "CapturePrivateUI";

	public const string VERSION = "2.0.0";

	public const string AUTHORS = "art0007i";

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