Decompiled source of ShowDriveSource v2.0.2

plugins/ShowDriveSource/ShowDriveSource.dll

Decompiled a day ago
using System;
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 Elements.Core;
using FrooxEngine;
using FrooxEngine.UIX;
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.2.0")]
[assembly: AssemblyInformationalVersion("2.0.2+9c55aa5b066cf3415263131b9e9ce245f18d68fd")]
[assembly: AssemblyProduct("ShowDriveSource")]
[assembly: AssemblyTitle("ShowDriveSource")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/art0007i/ShowDriveSource")]
[assembly: AssemblyVersion("2.0.2.0")]
[module: RefSafetyRules(11)]
namespace ShowDriveSource;

[ResonitePlugin("art0007i.ShowDriveSource", "ShowDriveSource", "2.0.2", "art0007i", "https://github.com/art0007i/ShowDriveSource")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
	[HarmonyPatch(typeof(Button))]
	[HarmonyPatch("RunPressed")]
	private class SyncMemberEditorBuilder_GenerateMemberField_Patch
	{
		public static void Postfix(Button __instance)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			ReferenceProxySource component = ((ContainerWorker<Component>)(object)((Component)__instance).Slot).GetComponent<ReferenceProxySource>((Predicate<ReferenceProxySource>)null, false);
			if (component == null)
			{
				return;
			}
			IWorldElement target = ((SyncRef<IWorldElement>)(object)component.Reference).Target;
			IField val = (IField)(object)((target is IField) ? target : null);
			if (val != null && (((ILinkable)val).IsDriven || ((ILinkable)val).IsLinked))
			{
				ILinkRef activeLink = ((ILinkable)val).ActiveLink;
				SyncElement val2 = (SyncElement)(object)((activeLink is SyncElement) ? activeLink : null);
				InspectorHelper.OpenInspectorForTarget((IWorldElement)(object)val2.Component, Pushback.Value ? ((Component)__instance).Slot : null, true);
				colorX value = TextColor.Value;
				if (!MathX.Approximately(((colorX)(ref value)).a, 0f, 1E-06f))
				{
					float3 val3 = default(float3);
					floatQ val4 = default(floatQ);
					SlotPositioning.GetPointInFrontOfUser(((Worker)__instance).LocalUser, ref val3, ref val4, (float3?)null, (float3?)new float3(0f, 0f, -0.1f), 0.7f, true);
					NotificationMessage.SpawnTextMessage(((Worker)__instance).World, val3, LocaleString.op_Implicit(val2.Name), value, 3f, 0.35f, 0.5f, 0.15f, 0.2f);
				}
			}
		}
	}

	internal static ManualLogSource Log;

	internal static ConfigEntry<bool> Pushback;

	internal static ConfigEntry<colorX> TextColor;

	public override void Load()
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		Log = ((BasePlugin)this).Log;
		Pushback = ((BasePlugin)this).Config.Bind<bool>("General", "Pushback", false, "If true, clicking on a field will make the new inspector push back the original one.");
		TextColor = ((BasePlugin)this).Config.Bind<colorX>("General", "TextColor", colorX.Magenta, "Color of the text that pops up when you click a field. (Set alpha to 0 to disable the text)");
		((BasePlugin)this).HarmonyInstance.PatchAll();
	}
}
public static class PluginMetadata
{
	public const string GUID = "art0007i.ShowDriveSource";

	public const string NAME = "ShowDriveSource";

	public const string VERSION = "2.0.2";

	public const string AUTHORS = "art0007i";

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