using System;
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.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=v9.0", FrameworkDisplayName = ".NET 9.0")]
[assembly: AssemblyCompany("eia485")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+d9e4ed48826133e752655fe3f9cdb6cc2e9b3ed5")]
[assembly: AssemblyProduct("ExposeEditorlessMembers")]
[assembly: AssemblyTitle("ExposeEditorlessMembers")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/EIA485/NeosExposeEditorlessMembers")]
[assembly: AssemblyVersion("1.0.1.0")]
[module: RefSafetyRules(11)]
namespace ExposeEditorlessMembers;
[ResonitePlugin("net.eia485.ExposeEditorlessMembers", "ExposeEditorlessMembers", "1.0.1", "eia485", "https://github.com/EIA485/NeosExposeEditorlessMembers")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ExposeEditorlessMembers : BasePlugin
{
[HarmonyPatch(typeof(SyncMemberEditorBuilder), "Build")]
private class SyncMemberEditorBuilderPatch
{
private static global::System.Collections.Generic.IEnumerable<CodeInstruction> Transpiler(global::System.Collections.Generic.IEnumerable<CodeInstruction> codes)
{
//IL_0016: 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)
//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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: 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_00f3: Expected O, but got Unknown
List<CodeInstruction> val = new List<CodeInstruction>(codes);
int num = -1;
object obj = null;
for (int i = 1; i < val.Count - 1; i++)
{
if (val[i].opcode == OpCodes.Isinst && val[i].operand == typeof(EmptySyncElement) && val[i - 1].opcode == OpCodes.Ldarg_0 && val[i + 1].opcode == OpCodes.Stloc_S)
{
obj = val[i + 1].operand;
num = i - 1;
break;
}
}
if (obj != null)
{
val.RemoveAt(num);
val.RemoveAt(num);
val.RemoveAt(num);
for (int j = 0; j < val.Count; j++)
{
if (val[j].opcode == OpCodes.Ldloc_S && val[j].operand == obj)
{
val[j] = new CodeInstruction(OpCodes.Ldarg_0, (object)null);
}
}
}
else
{
log.Log((LogLevel)2, (object)"SyncMemberEditorBuilder.Build Transpiler Failed");
}
return (global::System.Collections.Generic.IEnumerable<CodeInstruction>)val;
}
}
[HarmonyPatchCategory("HiddenToggle")]
[HarmonyPatch(typeof(WorkerInspector), "BuildInspectorUI")]
private class WorkerInspectorPatch
{
private static global::System.Collections.Generic.IEnumerable<CodeInstruction> Transpiler(global::System.Collections.Generic.IEnumerable<CodeInstruction> codes)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
List<CodeInstruction> val = new List<CodeInstruction>(codes);
int num = -1;
for (int i = 2; i < val.Count - 1; i++)
{
if (val[i - 2].opcode == OpCodes.Ldarg_0 && val[i].opcode == OpCodes.Callvirt && val[i + 1].opcode == OpCodes.Call)
{
object operand = val[i + 1].operand;
object obj = ((operand is MethodInfo) ? operand : null);
if (((obj != null) ? ((MemberInfo)obj).Name : null) == "GetCustomAttribute")
{
num = i - 2;
break;
}
}
}
if (num > -1)
{
val.RemoveAt(num);
val.RemoveAt(num);
val.RemoveAt(num);
val.RemoveAt(num);
val.RemoveAt(num);
}
else
{
log.Log((LogLevel)2, (object)"WorkerInspector.BuildInspectorUI Transpiler Failed");
}
return (global::System.Collections.Generic.IEnumerable<CodeInstruction>)val;
}
}
private static ManualLogSource log;
private static ConfigEntry<bool> ShowHidden;
private static bool HiddenPatched;
private const string HiddenCat = "HiddenToggle";
public override void Load()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
ShowHidden = ((BasePlugin)this).Config.Bind<bool>("ExposeEditorlessMembers", "Ignore HideInInspectorAttribute", true, (ConfigDescription)null);
log = ((BasePlugin)this).Log;
((BasePlugin)this).HarmonyInstance.PatchAllUncategorized();
ShowHidden.SettingChanged += new EventHandler(ShowHidden_SettingChanged);
ShowHidden_SettingChanged();
}
private void ShowHidden_SettingChanged(object? sender = null, EventArgs e = null)
{
if (ShowHidden.Value != HiddenPatched)
{
if (ShowHidden.Value)
{
((BasePlugin)this).HarmonyInstance.PatchCategory("HiddenToggle");
}
else
{
((BasePlugin)this).HarmonyInstance.UnpatchCategory("HiddenToggle");
}
HiddenPatched = ShowHidden.Value;
}
}
}
public static class PluginMetadata
{
public const string GUID = "net.eia485.ExposeEditorlessMembers";
public const string NAME = "ExposeEditorlessMembers";
public const string VERSION = "1.0.1";
public const string AUTHORS = "eia485";
public const string REPOSITORY_URL = "https://github.com/EIA485/NeosExposeEditorlessMembers";
}