using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Threading; using System.Threading.Tasks; using System.Threading.Tasks.Sources; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.NET.Common; using BepInExResoniteShim; using BepisLocaleLoader; using BepisModSettings; using BepisModSettings.DataFeeds; using BepisResoniteWrapper; using Elements.Core; using FrooxEngine; using FrooxEngine.UIX; using FrooxEngine.Weaver; using HarmonyLib; using ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Variables; using Renderite.Shared; using ResoniteModLoader; [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("NepuShiro")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.3.2.0")] [assembly: AssemblyInformationalVersion("1.3.2+395eab44af828acc4856fa7e257a830d437ae02a")] [assembly: AssemblyProduct("RML Mod Settings")] [assembly: AssemblyTitle("RMLModSettings")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/NepuShiro/RMLModSettings")] [assembly: AssemblyVersion("1.3.2.0")] [module: RefSafetyRules(11)] namespace RMLModSettings; public static class ConfigHelpers { [CompilerGenerated] private sealed class <>c__DisplayClass9_0 where T : unmanaged, global::System.Enum { public InternalLocale internalLocale; public ModConfigurationKey configKey; internal void b__0(IField field) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) FeedItemInterface componentInParents = WorldElementExtensions.FindNearestParent((IWorldElement)(object)field, (Predicate)null).GetComponentInParents((Predicate)null, true, false); if (componentInParents != null) { ((SyncField)(object)((ContainerWorker)(object)((Component)componentInParents).Slot).AttachComponent(true, (Action)null).Text).Value = internalLocale.Key.content; } ((MethodBase)AccessTools.Method(typeof(ConfigHelpers), "SyncWithNullableConfigKeyHasValue", (global::System.Type[])null, (global::System.Type[])null).MakeGenericMethod(new global::System.Type[1] { configKey.ValueType() })).Invoke((object)null, new object[1] { configKey }); } } [CompilerGenerated] private sealed class d__9 : global::System.Collections.Generic.IAsyncEnumerable, global::System.Collections.Generic.IAsyncEnumerator, global::System.IAsyncDisposable, IValueTaskSource, IValueTaskSource, IAsyncStateMachine where T : unmanaged, global::System.Enum { public int <>1__state; public AsyncIteratorMethodBuilder <>t__builder; public ManualResetValueTaskSourceCore <>v__promiseOfValueOrEnd; private DataFeedItem <>2__current; private bool <>w__disposeMode; private int <>l__initialThreadId; private InternalLocale internalLocale; public InternalLocale <>3__internalLocale; private ModConfigurationKey configKey; public ModConfigurationKey <>3__configKey; private string key; public string <>3__key; private global::System.Collections.Generic.IReadOnlyList path; public global::System.Collections.Generic.IReadOnlyList <>3__path; private global::System.Collections.Generic.IReadOnlyList groupKeys; public global::System.Collections.Generic.IReadOnlyList <>3__groupKeys; private <>c__DisplayClass9_0 <>8__1; private string[] 5__2; private TaskAwaiter <>u__1; private global::System.Collections.Generic.IAsyncEnumerator <>7__wrap2; private object <>7__wrap3; private int <>7__wrap4; private ValueTaskAwaiter <>u__2; private ValueTaskAwaiter <>u__3; DataFeedItem global::System.Collections.Generic.IAsyncEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(int <>1__state) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) <>t__builder = AsyncIteratorMethodBuilder.Create(); this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } private void MoveNext() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_019b: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024c: 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_009f: 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) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; try { TaskAwaiter val4; ValueTaskAwaiter val; DataFeedGroup val5; switch (num) { default: if (!<>w__disposeMode) { num = (<>1__state = -1); <>8__1 = new <>c__DisplayClass9_0(); <>8__1.internalLocale = internalLocale; <>8__1.configKey = configKey; <>2__current = null; val4 = global::System.Threading.Tasks.Task.CompletedTask.GetAwaiter(); if (!((TaskAwaiter)(ref val4)).IsCompleted) { num = (<>1__state = 0); <>u__1 = val4; d__9 d__ = this; ((AsyncIteratorMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompletedd__9>(ref val4, ref d__); return; } goto IL_00d8; } goto end_IL_0007; case 0: val4 = <>u__1; <>u__1 = default(TaskAwaiter); num = (<>1__state = -1); goto IL_00d8; case -4: num = (<>1__state = -1); if (!<>w__disposeMode) { 5__2 = Enumerable.ToArray(Enumerable.Concat((global::System.Collections.Generic.IEnumerable)groupKeys, (global::System.Collections.Generic.IEnumerable)new <>z__ReadOnlySingleElementList(key + "..NullableGroup"))); DataFeedToggle val2 = new DataFeedToggle(); ((DataFeedItem)val2).InitBase(key + ".HasValue", path, (global::System.Collections.Generic.IReadOnlyList)5__2, LocaleString.op_Implicit("?"), (Uri)null, (Action>)null, (Action>)null, (global::System.Collections.Generic.IReadOnlyList)null, (object)null); ((DataFeedValueElement)(object)val2).InitSetupValue((Action>)delegate(IField field) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) FeedItemInterface componentInParents = WorldElementExtensions.FindNearestParent((IWorldElement)(object)field, (Predicate)null).GetComponentInParents((Predicate)null, true, false); if (componentInParents != null) { ((SyncField)(object)((ContainerWorker)(object)((Component)componentInParents).Slot).AttachComponent(true, (Action)null).Text).Value = <>8__1.internalLocale.Key.content; } ((MethodBase)AccessTools.Method(typeof(ConfigHelpers), "SyncWithNullableConfigKeyHasValue", (global::System.Type[])null, (global::System.Type[])null).MakeGenericMethod(new global::System.Type[1] { <>8__1.configKey.ValueType() })).Invoke((object)null, new object[1] { <>8__1.configKey }); }); <>2__current = (DataFeedItem)(object)val2; num = (<>1__state = -5); goto IL_047c; } goto end_IL_0007; case -5: num = (<>1__state = -1); if (!<>w__disposeMode) { global::System.Collections.Generic.IAsyncEnumerable asyncEnumerable = (global::System.Collections.Generic.IAsyncEnumerable)((MethodBase)GenerateEnumItemsAsync.MakeGenericMethod(new global::System.Type[1] { typeof(T) })).Invoke((object)null, new object[3] { path, 5__2, <>8__1.configKey }); if (asyncEnumerable != null) { <>7__wrap2 = asyncEnumerable.GetAsyncEnumerator(default(CancellationToken)); <>7__wrap3 = null; <>7__wrap4 = 0; goto case -6; } } goto end_IL_0007; case -6: case 1: try { ValueTaskAwaiter val3; if (num != -6) { if (num != 1) { goto IL_02af; } val3 = <>u__2; <>u__2 = default(ValueTaskAwaiter); num = (<>1__state = -1); goto IL_031a; } num = (<>1__state = -1); if (!<>w__disposeMode) { goto IL_02af; } goto end_IL_0267; IL_02af: <>2__current = null; val3 = <>7__wrap2.MoveNextAsync().GetAwaiter(); if (!val3.IsCompleted) { num = (<>1__state = 1); <>u__2 = val3; d__9 d__ = this; ((AsyncIteratorMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted, d__9>(ref val3, ref d__); return; } goto IL_031a; IL_031a: if (val3.GetResult()) { DataFeedItem current = <>7__wrap2.Current; <>2__current = current; num = (<>1__state = -6); goto IL_047c; } end_IL_0267:; } catch (object obj) { <>7__wrap3 = obj; } if (<>7__wrap2 == null) { break; } <>2__current = null; val = ((global::System.IAsyncDisposable)<>7__wrap2).DisposeAsync().GetAwaiter(); if (!((ValueTaskAwaiter)(ref val)).IsCompleted) { num = (<>1__state = 2); <>u__3 = val; d__9 d__ = this; ((AsyncIteratorMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompletedd__9>(ref val, ref d__); return; } goto IL_03a7; case 2: { val = <>u__3; <>u__3 = default(ValueTaskAwaiter); num = (<>1__state = -1); goto IL_03a7; } IL_03a7: ((ValueTaskAwaiter)(ref val)).GetResult(); break; IL_00d8: ((TaskAwaiter)(ref val4)).GetResult(); val5 = new DataFeedGroup(); ((DataFeedItem)val5).InitBase(key + ".NullableGroup", path, groupKeys, <>8__1.internalLocale.Key, (Uri)null, (Action>)null, (Action>)null, (global::System.Collections.Generic.IReadOnlyList)null, (object)null); <>2__current = (DataFeedItem)(object)val5; num = (<>1__state = -4); goto IL_047c; } object obj2 = <>7__wrap3; if (obj2 != null) { ExceptionDispatchInfo.Capture((obj2 as global::System.Exception) ?? throw obj2).Throw(); } _ = <>7__wrap4; if (!<>w__disposeMode) { <>7__wrap3 = null; <>7__wrap2 = null; } end_IL_0007:; } catch (global::System.Exception exception) { <>1__state = -2; <>8__1 = null; 5__2 = null; <>7__wrap2 = null; <>7__wrap3 = null; <>2__current = null; ((AsyncIteratorMethodBuilder)(ref <>t__builder)).Complete(); <>v__promiseOfValueOrEnd.SetException(exception); return; } <>1__state = -2; <>8__1 = null; 5__2 = null; <>7__wrap2 = null; <>7__wrap3 = null; <>2__current = null; ((AsyncIteratorMethodBuilder)(ref <>t__builder)).Complete(); <>v__promiseOfValueOrEnd.SetResult(false); return; IL_047c: <>v__promiseOfValueOrEnd.SetResult(true); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } [DebuggerHidden] global::System.Collections.Generic.IAsyncEnumerator global::System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken = default(CancellationToken)) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) d__9 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = -3; <>t__builder = AsyncIteratorMethodBuilder.Create(); <>w__disposeMode = false; d__ = this; } else { d__ = new d__9(-3); } d__.key = <>3__key; d__.path = <>3__path; d__.groupKeys = <>3__groupKeys; d__.internalLocale = <>3__internalLocale; d__.configKey = <>3__configKey; return d__; } [DebuggerHidden] global::System.Threading.Tasks.ValueTask global::System.Collections.Generic.IAsyncEnumerator.MoveNextAsync() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 if (<>1__state == -2) { return default(global::System.Threading.Tasks.ValueTask); } <>v__promiseOfValueOrEnd.Reset(); d__9 d__ = this; ((AsyncIteratorMethodBuilder)(ref <>t__builder)).MoveNext<d__9>(ref d__); short version = <>v__promiseOfValueOrEnd.Version; if ((int)<>v__promiseOfValueOrEnd.GetStatus(version) == 1) { return new global::System.Threading.Tasks.ValueTask(<>v__promiseOfValueOrEnd.GetResult(version)); } return new global::System.Threading.Tasks.ValueTask((IValueTaskSource)this, version); } [DebuggerHidden] bool IValueTaskSource.GetResult(short token) { return <>v__promiseOfValueOrEnd.GetResult(token); } [DebuggerHidden] ValueTaskSourceStatus IValueTaskSource.GetStatus(short token) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return <>v__promiseOfValueOrEnd.GetStatus(token); } [DebuggerHidden] void IValueTaskSource.OnCompleted(Action continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) <>v__promiseOfValueOrEnd.OnCompleted(continuation, state, token, flags); } [DebuggerHidden] void IValueTaskSource.GetResult(short token) { <>v__promiseOfValueOrEnd.GetResult(token); } [DebuggerHidden] ValueTaskSourceStatus IValueTaskSource.GetStatus(short token) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return <>v__promiseOfValueOrEnd.GetStatus(token); } [DebuggerHidden] void IValueTaskSource.OnCompleted(Action continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) <>v__promiseOfValueOrEnd.OnCompleted(continuation, state, token, flags); } [DebuggerHidden] global::System.Threading.Tasks.ValueTask global::System.IAsyncDisposable.DisposeAsync() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (<>1__state >= -1) { throw new NotSupportedException(); } if (<>1__state == -2) { return default(global::System.Threading.Tasks.ValueTask); } <>w__disposeMode = true; <>v__promiseOfValueOrEnd.Reset(); d__9 d__ = this; ((AsyncIteratorMethodBuilder)(ref <>t__builder)).MoveNext<d__9>(ref d__); return new global::System.Threading.Tasks.ValueTask((IValueTaskSource)(object)this, <>v__promiseOfValueOrEnd.Version); } } internal static readonly MethodInfo GenerateEnumItemsAsync = AccessTools.Method(typeof(ConfigHelpers), "GenerateEnumItemsAsyncMethod", (global::System.Type[])null, (global::System.Type[])null); internal static readonly MethodInfo GenerateNullableEnumItemsAsync = AccessTools.Method(typeof(ConfigHelpers), "GenerateNullableEnumItemsAsyncMethod", (global::System.Type[])null, (global::System.Type[])null); internal static readonly MethodInfo GenerateValueField = AccessTools.Method(typeof(ConfigHelpers), "GenerateValueFieldMethod", (global::System.Type[])null, (global::System.Type[])null); private static Dictionary ConfigKeyFields = new Dictionary(); public static void SetupConfigKeyFieldInfo(ResoniteModBase mod) { CollectionExtensions.Do(Enumerable.Where((global::System.Collections.Generic.IEnumerable)AccessTools.GetDeclaredFields(((object)mod).GetType()), (Func)((FieldInfo field) => global::System.Attribute.GetCustomAttribute((MemberInfo)(object)field, typeof(AutoRegisterConfigKeyAttribute)) != null)), (Action)delegate(FieldInfo x) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ModConfigurationKey val = (ModConfigurationKey)x.GetValue((object)(x.IsStatic ? null : mod)); ConfigKeyFields[val] = x; }); } public static bool TryGetConfigKeyFieldInfo(ModConfigurationKey key, out FieldInfo field) { return ConfigKeyFields.TryGetValue(key, ref field); } public static string GetModId(this ResoniteModBase mod) { return ("rml." + mod.Author + "." + mod.Name).ToLower().Replace(" ", "."); } internal static DataFeedToggle GenerateToggle(string key, global::System.Collections.Generic.IReadOnlyList path, global::System.Collections.Generic.IReadOnlyList groupKeys, InternalLocale internalLocale, ModConfiguration config, ModConfigurationKey configKey) { //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_002a: Unknown result type (might be due to invalid IL or missing references) //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_0051: Expected O, but got Unknown //IL_0052: Expected O, but got Unknown DataFeedToggle val = new DataFeedToggle(); ((DataFeedItem)val).InitBase(key + ".Toggle", path, groupKeys, internalLocale.Key, internalLocale.Description, (Uri)null, (Action>)null, (Action>)null, (global::System.Collections.Generic.IReadOnlyList)null, (object)null); ((DataFeedValueElement)val).InitSetupValue((Action>)delegate(IField field) { field.SyncWithConfigKey(config, configKey); }); return val; } internal static DataFeedItem GenerateValueFieldMethod(string key, global::System.Collections.Generic.IReadOnlyList path, global::System.Collections.Generic.IReadOnlyList groupKeys, InternalLocale internalLocale, ModConfiguration config, ModConfigurationKey configKey) { //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_008f: 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) DataFeedHelpers.TryInjectNewTemplateType(configKey.ValueType()); if (TryGetConfigKeyFieldInfo(configKey, out var field)) { RangeAttribute rangeAttribute = CustomAttributeExtensions.GetCustomAttribute((MemberInfo)(object)field); if (rangeAttribute != null) { DataFeedSlider obj = new DataFeedSlider(); ((DataFeedItem)obj).InitBase($"{key}.{configKey.ValueType()}", path, groupKeys, internalLocale.Key, internalLocale.Description, (Uri)null, (Action>)null, (Action>)null, (global::System.Collections.Generic.IReadOnlyList)null, (object)null); ((DataFeedClampedValueField)(object)obj).InitSetup((Action>)delegate(IField field2) { field2.SyncWithConfigKey(config, configKey); }, (Action>)delegate(IField min) { ((IField)min).BoxedValue = rangeAttribute.Min; }, (Action>)delegate(IField max) { ((IField)max).BoxedValue = rangeAttribute.Max; }); return (DataFeedItem)(object)obj; } } DataFeedValueField obj2 = new DataFeedValueField(); ((DataFeedItem)obj2).InitBase($"{key}.{configKey.ValueType()}", path, groupKeys, internalLocale.Key, internalLocale.Description, (Uri)null, (Action>)null, (Action>)null, (global::System.Collections.Generic.IReadOnlyList)null, (object)null); ((DataFeedValueElement)(object)obj2).InitSetupValue((Action>)delegate(IField field2) { field2.SyncWithConfigKey(config, configKey); }); return (DataFeedItem)(object)obj2; } [AsyncIteratorStateMachine(typeof(d__9<>))] private static global::System.Collections.Generic.IAsyncEnumerable GenerateNullableEnumItemsAsyncMethod(string key, global::System.Collections.Generic.IReadOnlyList path, global::System.Collections.Generic.IReadOnlyList groupKeys, InternalLocale internalLocale, ModConfigurationKey configKey) where T : unmanaged, global::System.Enum { return new d__9(-2) { <>3__key = key, <>3__path = path, <>3__groupKeys = groupKeys, <>3__internalLocale = internalLocale, <>3__configKey = configKey }; } private static void SyncWithConfigKey(this IField field, ModConfiguration config, ModConfigurationKey configKey) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown object obj; try { obj = config.GetValue(configKey) ?? ((object)default(T)); } catch { obj = default(T); } ((IValue)(object)field).Value = (T)obj; ((IField)(object)field).SetupChangedHandlers(FieldChanged, configKey, new OnChangedHandler(KeyChanged)); void FieldChanged(IChangeable _) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown config.Set(configKey, (object)((IValue)(object)field).Value, (string)null); ((IWorldElement)field).World.RunSynchronously((Action)delegate { object obj3; try { obj3 = config.GetValue(configKey); } catch { obj3 = default(T); } ((IValue)(object)field).Value = (T)obj3; }, false, (IUpdatable)null, false); } void KeyChanged(object newValue) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown if (!object.Equals((object)((IValue)(object)field).Value, newValue)) { ((IWorldElement)field).World.RunSynchronously((Action)delegate { ((IValue)(object)field).Value = (T)(newValue ?? ((object)default(T))); }, false, (IUpdatable)null, false); } } } private static DataFeedEnum GenerateEnumItemsAsyncMethod(string key, global::System.Collections.Generic.IReadOnlyList path, global::System.Collections.Generic.IReadOnlyList groupKeys, InternalLocale internalLocale, ModConfiguration config, ModConfigurationKey configKey) where T : unmanaged, global::System.Enum { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) DataFeedEnum obj = new DataFeedEnum(); ((DataFeedItem)obj).InitBase(key + ".Enum", path, groupKeys, internalLocale.Key, internalLocale.Description, (Uri)null, (Action>)null, (Action>)null, (global::System.Collections.Generic.IReadOnlyList)null, (object)null); ((DataFeedValueElement)(object)obj).InitSetupValue((Action>)delegate(IField field) { field.SyncWithConfigKey(config, configKey); }); return obj; } private static void SyncWithNullableConfigKeyHasValue(this IField field, ModConfiguration config, ModConfigurationKey configKey) where T : struct { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown object value = config.GetValue(configKey); ((IValue)(object)field).Value = ((T?)value).HasValue; ((IField)(object)field).SetupChangedHandlers(FieldChanged, configKey, new OnChangedHandler(KeyChanged)); void FieldChanged(IChangeable _) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown T? val = (((IValue)(object)field).Value ? new T?(default(T)) : ((T?)null)); if (((IValue)(object)field).Value == ((T?)value).HasValue) { config.Set(configKey, (object)val, (string)null); } else { ((IWorldElement)field).World.RunSynchronously((Action)delegate { field.SetWithoutChangedHandler(((T?)value).HasValue, FieldChanged); }, false, (IUpdatable)null, false); } } void KeyChanged(object newValue) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown if (((IValue)(object)field).Value != ((T?)newValue).HasValue) { ((IWorldElement)field).World.RunSynchronously((Action)delegate { field.SetWithoutChangedHandler(((T?)newValue).HasValue, FieldChanged); }, false, (IUpdatable)null, false); } } } private static void SetWithoutChangedHandler(this IField field, T value, Action changedHandler) { ((IChangeable)field).Changed -= changedHandler; ((IValue)(object)field).Value = value; ((IChangeable)field).Changed += changedHandler; } private static void SetupChangedHandlers(this IField field, Action fieldChangedHandler, ModConfigurationKey configKey, OnChangedHandler keyChangedHandler) { Component parent = WorldElementExtensions.FindNearestParent((IWorldElement)(object)field, (Predicate)null); ((IChangeable)field).Changed += fieldChangedHandler; configKey.OnChanged += keyChangedHandler; ((ComponentBase)(object)parent).Destroyed += ParentDestroyedHandler; void ParentDestroyedHandler(IDestroyable _) { ((ComponentBase)(object)parent).Destroyed -= ParentDestroyedHandler; configKey.OnChanged -= keyChangedHandler; ((IChangeable)field).Changed -= fieldChangedHandler; } } public static bool IsEmpty(ModConfiguration config) { if (config != null && ((global::System.Collections.Generic.ICollection)config.ConfigurationItemDefinitions).Count != 0) { return Enumerable.All((global::System.Collections.Generic.IEnumerable)config.ConfigurationItemDefinitions, (Func)((ModConfigurationKey configIn) => !Plugin.ShowHidden.Value && configIn.InternalAccessOnly)); } return true; } } [ResonitePlugin("NepuShiro.RMLModSettings", "RML Mod Settings", "1.3.2", "NepuShiro", "https://github.com/NepuShiro/RMLModSettings")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { [HarmonyPatch] private class AssemblyPostProcessorPatch { private static MethodBase TargetMethod() { return (MethodBase)(object)AccessTools.Method(typeof(AssemblyPostProcessor), "Process", new global::System.Type[3] { typeof(string), typeof(string).MakeByRefType(), typeof(string) }, (global::System.Type[])null); } private static global::System.Exception Finalizer(global::System.Exception __exception) { IOException ex = (IOException)(object)((__exception is IOException) ? __exception : null); if (ex != null && ((global::System.Exception)(object)ex).Message.Contains("ResoniteModLoader.dll") && ((global::System.Exception)(object)ex).Message.Contains("being used by another process")) { Log.LogError((object)("Suppressed IOException: " + ((global::System.Exception)(object)ex).Message)); return null; } return __exception; } } [Serializable] [CompilerGenerated] private sealed class <>c { [StructLayout((LayoutKind)3)] private struct <b__1_2>d : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder <>t__builder; private <>c__DisplayClass1_0 <>8__1; private TaskAwaiter <>u__1; private void MoveNext() { //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_005d: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; try { if (num != 0) { <>8__1 = new <>c__DisplayClass1_0(); goto IL_0073; } TaskAwaiter val = <>u__1; <>u__1 = default(TaskAwaiter); num = (<>1__state = -1); goto IL_006c; IL_006c: ((TaskAwaiter)(ref val)).GetResult(); goto IL_0073; IL_0073: World userspaceWorld = Userspace.UserspaceWorld; if (((userspaceWorld != null) ? userspaceWorld.LocalUserSpace : null) == null) { val = global::System.Threading.Tasks.Task.Delay(10).GetAwaiter(); if (!((TaskAwaiter)(ref val)).IsCompleted) { num = (<>1__state = 0); <>u__1 = val; ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompletedb__1_2>d>(ref val, ref this); return; } goto IL_006c; } <>8__1.w = Userspace.UserspaceWorld; <>8__1.w.RunSynchronously((Action)delegate { //IL_001c: 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_0080: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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) Slot obj = <>8__1.w.LocalUserSpace.AddSlot("RML Mod Settings Warning", false); UIBuilder obj2 = RadiantUI_Panel.SetupPanel(obj, LocaleString.op_Implicit("RML Mod Settings - Warning"), new float2(700f, 350f), false, true); RadiantUI_Constants.SetupEditorStyle(obj2, false); obj2.VerticalLayout(4f, 0f, (Alignment?)null, (bool?)null, (bool?)null); obj2.Style.MinHeight = 48f; LocaleString val2 = LocaleString.op_Implicit("ResoniteModLoader is not loaded, or is not up to date.\nYou cannot use this plugin without it!"); ((SyncField)(object)obj2.Text(ref val2, true, (Alignment?)null, true, (string)null).Size).Value = 32f; val2 = LocaleString.op_Implicit("Go to Latest RML"); colorX? val3 = Sub.GREEN; Hyperlink obj3 = ((ContainerWorker)(object)((Component)obj2.Button(ref val2, ref val3)).Slot).AttachComponent(true, (Action)null); ((SyncField)(object)obj3.URL).Value = new Uri("https://github.com/resonite-modding-group/ResoniteModLoader/releases/latest"); ((SyncField)(object)obj3.Reason).Value = "Opening RML Github"; SlotPositioning.PositionInFrontOfUser(obj, (float3?)float3.Backward, (float3?)null, 3f, (User)null, true, true, false); float3 localScale = obj.LocalScale; obj.LocalScale = (ref localScale) * 0.003f; }, false, (IUpdatable)null, false); } catch (global::System.Exception exception) { <>1__state = -2; <>8__1 = null; ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; <>8__1 = null; ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } } public static readonly <>c <>9 = new <>c(); public static Func <>9__1_1; public static Func <>9__1_2; public static Action <>9__1_0; public static Predicate <>9__3_6; public static Action <>9__3_7; public static Action> <>9__3_0; public static Func> <>9__3_1; public static Func, bool> <>9__3_2; public static Func, string> <>9__3_3; public static Predicate <>9__5_4; public static Action> <>9__5_6; public static Action> <>9__5_7; public static Action> <>9__5_8; public static Action> <>9__5_9; public static Action> <>9__5_10; internal void b__1_0() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown if (Enumerable.Any((global::System.Collections.Generic.IEnumerable)AppDomain.CurrentDomain.GetAssemblies(), (Func)((Assembly assembly) => assembly.GetName().Name?.Contains("ResoniteModLoader") ?? false))) { BepisPluginsPage.CustomPluginsPages += RmlSettingsEnumerate; BepisConfigsPage.CustomPluginConfigsPages += RmlSettingsConfigsEnumerate; ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("NepuShiro.RMLModSettings"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is fully loaded!"); } log.LogInfo(val); } else { Log.LogFatal((object)"ResoniteModLoader is not loaded! You cannot use this plugin without it."); global::System.Threading.Tasks.Task.Run((Func)([AsyncStateMachine(typeof(<b__1_2>d))] () => { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) <b__1_2>d <b__1_2>d = default(<b__1_2>d); <b__1_2>d.<>t__builder = AsyncTaskMethodBuilder.Create(); <b__1_2>d.<>1__state = -1; ((AsyncTaskMethodBuilder)(ref <b__1_2>d.<>t__builder)).Start<<b__1_2>d>(ref <b__1_2>d); return ((AsyncTaskMethodBuilder)(ref <b__1_2>d.<>t__builder)).Task; })); } } internal bool b__1_1(Assembly assembly) { return assembly.GetName().Name?.Contains("ResoniteModLoader") ?? false; } [AsyncStateMachine(typeof(<b__1_2>d))] internal global::System.Threading.Tasks.Task? b__1_2() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) <b__1_2>d <b__1_2>d = default(<b__1_2>d); <b__1_2>d.<>t__builder = AsyncTaskMethodBuilder.Create(); <b__1_2>d.<>1__state = -1; ((AsyncTaskMethodBuilder)(ref <b__1_2>d.<>t__builder)).Start<<b__1_2>d>(ref <b__1_2>d); return ((AsyncTaskMethodBuilder)(ref <b__1_2>d.<>t__builder)).Task; } internal void b__3_0(SyncDelegate x) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown <>c__DisplayClass3_1 CS$<>8__locals4 = new <>c__DisplayClass3_1(); BooleanValueDriver component = ((ContainerWorker)(object)((Component)((SyncElement)x).Slot.GetComponentInChildren((Predicate)null, false, false)).Slot).GetComponent>((Predicate>)null, false); ((SyncField)(object)component.FalseValue).Value = "Settings.RML.SaveAll"; Image componentInChildren = ((Component)component).Slot.Parent.Parent.GetComponentInChildren((Predicate)null, false, false); if (componentInChildren == null) { return; } SpriteProvider val = ((ContainerWorker)(object)((Component)componentInChildren).Slot).AttachComponent(true, (Action)null); ((SyncRef>)(object)val.Texture).Target = (IAssetProvider)(object)SlotAssets.AttachTexture(((Component)componentInChildren).Slot, new Uri("resdb:///2f5cc6b6d4249bfdceda48fcd3df6375d47d13614e2100a8ed5a0f511ea9c01e.webp"), true, false, false, false, (TextureWrapMode)1, (int?)null); ((SyncRef>)(object)((ImageBase)componentInChildren).Sprite).Target = (IAssetProvider)(object)val; CS$<>8__locals4.btn = ((ContainerWorker)(object)((SyncElement)x).Slot).GetComponent