Decompiled source of ModConfig v1.6.0
plugins/com.github.PEAKModding.PEAKLib.ModConfig.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using MonoDetour; using PEAKLib.Core; using PEAKLib.ModConfig.Components; using PEAKLib.ModConfig.SettingOptions; using PEAKLib.ModConfig.SettingOptions.SettingUI; using PEAKLib.UI; using PEAKLib.UI.Elements; using TMPro; using Unity.Mathematics; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Utilities; using UnityEngine.Localization; using UnityEngine.UI; using Zorro.ControllerSupport; using Zorro.Core; using Zorro.Settings; using Zorro.Settings.DebugUI; using Zorro.Settings.UI; using Zorro.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PEAKModding")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.6.0.0")] [assembly: AssemblyInformationalVersion("1.6.0+c821198a0bb2464382d499877b96abee63793387")] [assembly: AssemblyProduct("com.github.PEAKModding.PEAKLib.ModConfig")] [assembly: AssemblyTitle("PEAKLib.ModConfig")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.6.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MonoDetour.HookGen { internal static class DefaultMonoDetourManager { internal static MonoDetourManager Instance { get; } = New(); internal static MonoDetourManager New() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name); } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] internal class MonoDetourTargetsAttribute : Attribute, IMonoDetourTargets { public Type? TargetType { get; } public bool IncludeNestedTypes { get; set; } public bool DistinguishOverloadsByName { get; set; } public string[]? Members { get; set; } public string[]? MemberNamePrefixes { get; set; } public string[]? MemberNameSuffixes { get; set; } public bool GenerateControlFlowVariants { get; set; } public MonoDetourTargetsAttribute(Type? targetType = null) { TargetType = targetType; IncludeNestedTypes = true; base..ctor(); } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PEAKLib.ModConfig { internal interface IBepInExProperty { internal ConfigEntryBase ConfigBase { get; } internal void RefreshValueFromConfig(); } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.github.PEAKModding.PEAKLib.ModConfig", "PEAKLib.ModConfig", "1.6.0")] public class ModConfigPlugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__16_2; public static Func<PluginInfo, string> <>9__22_0; public static Func<KeyValuePair<ConfigDefinition, ConfigEntryBase>, ConfigEntryBase> <>9__22_1; internal void <Start>b__16_2() { ProcessModEntries(); } internal string <GetModConfigEntries>b__22_0(PluginInfo p) { return p.Metadata.Name; } internal ConfigEntryBase <GetModConfigEntries>b__22_1(KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) { return configEntry.Value; } } internal static ModConfigPlugin instance = null; private static List<string> _validPaths = new List<string>(); private static bool modSettingsLoaded = false; public const string Id = "com.github.PEAKModding.PEAKLib.ModConfig"; internal static ManualLogSource Log { get; } = Logger.CreateLogSource(Name); private static List<ConfigEntryBase> EntriesProcessed { get; set; } = new List<ConfigEntryBase>(); internal static List<ModKeyToName> ModdedKeys { get; set; } = new List<ModKeyToName>(); private static List<string> GetValidKeyPaths { get { if (_validPaths.Count < 1) { _validPaths = GenerateValidKeyPaths(); } return _validPaths; } } public static string Name => "PEAKLib.ModConfig"; public static string Version => "1.6.0"; private void Awake() { instance = this; MonoDetourManager.InvokeHookInitializers(typeof(ModConfigPlugin).Assembly); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } private void Start() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown LoadModSettings(); MenuAPI.AddToSettingsMenu(new BuilderDelegate(builderDelegate)); MenuAPI.AddToControlsMenu(new BuilderDelegate(controlsBuilder)); static void builderDelegate(Transform parent) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: 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_0317: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Expected O, but got Unknown //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Expected O, but got Unknown //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Expected O, but got Unknown //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Expected O, but got Unknown //IL_06e0: Unknown result type (might be due to invalid IL or missing references) Log.LogDebug((object)"builderDelegate"); MainMenuPageHandler mainMenuHandler = ((Component)parent).GetComponentInParent<MainMenuPageHandler>(); PauseMenuHandler pauseMenuHandler2 = ((Component)parent).GetComponentInParent<PauseMenuHandler>(); if ((Object)(object)mainMenuHandler == (Object)null && (Object)(object)pauseMenuHandler2 == (Object)null) { throw new Exception("Failed to get a UIPageHandler"); } MainMenuPageHandler obj = mainMenuHandler; object obj2 = ((obj != null) ? ((UIPageHandler)obj).GetPage<MainMenuSettingsPage>() : null); if (obj2 == null) { PauseMenuHandler obj3 = pauseMenuHandler2; obj2 = ((obj3 != null) ? ((UIPageHandler)obj3).GetPage<PauseMenuSettingsMenuPage>() : null); } UIPage val11 = (UIPage)obj2; if ((Object)(object)val11 == (Object)null) { throw new Exception("Failed to get the parent page"); } PeakChildPage modSettingsPage = MenuAPI.CreateChildPage("ModSettings", val11); if ((Object)(object)mainMenuHandler != (Object)null) { modSettingsPage.CreateBackground((Color?)new Color(0f, 0f, 0f, 0.8667f)); } PeakChildPage obj4 = modSettingsPage; object obj5 = <>c.<>9__16_2; if (obj5 == null) { UnityAction val12 = delegate { ProcessModEntries(); }; <>c.<>9__16_2 = val12; obj5 = (object)val12; } obj4.SetOnOpen((UnityAction)obj5); TranslationKey val13 = MenuAPI.CreateLocalization("MOD SETTINGS").AddLocalization("MOD SETTINGS", (Language)0).AddLocalization("PARAMÈTRES DU MOD", (Language)1) .AddLocalization("IMPOSTAZIONI MOD", (Language)2) .AddLocalization("MOD-EINSTELLUNGEN", (Language)3) .AddLocalization("AJUSTES DEL MOD", (Language)4) .AddLocalization("CONFIGURACIONES DEL MOD", (Language)5) .AddLocalization("CONFIGURAÇÕES DE MOD", (Language)6) .AddLocalization("НАСТРОЙКИ МОДА", (Language)7) .AddLocalization("НАЛАШТУВАННЯ МОДА", (Language)8) .AddLocalization("模组设置", (Language)9) .AddLocalization("模組設定", (Language)10) .AddLocalization("MOD設定", (Language)11) .AddLocalization("모드 설정", (Language)12) .AddLocalization("USTAWIENIA MODÓW", (Language)13); PeakElement val14 = ElementExtensions.SetSize<PeakElement>(ElementExtensions.SetPivot<PeakElement>(ElementExtensions.SetPosition<PeakElement>(ElementExtensions.SetAnchorMinMax<PeakElement>(ElementExtensions.ParentTo(new GameObject("Header"), (Component)(object)modSettingsPage).AddComponent<PeakElement>(), new Vector2(0f, 1f)), new Vector2(40f, -40f)), new Vector2(0f, 1f)), new Vector2(360f, 100f)); PeakText val15 = ElementExtensions.SetLocalizationIndex<PeakText>(ElementExtensions.ExpandToParent<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText("Mod Settings", "HeaderText").SetFontSize(48f), (Component)(object)val14)), val13); ((PeakLocalizableElement)val15).Text.fontSizeMax = 48f; ((PeakLocalizableElement)val15).Text.fontSizeMin = 24f; ((PeakLocalizableElement)val15).Text.enableAutoSizing = true; ((PeakLocalizableElement)val15).Text.alignment = (TextAlignmentOptions)514; PeakMenuButton val16 = ElementExtensions.SetPosition<PeakMenuButton>(ElementExtensions.ParentTo<PeakMenuButton>(ElementExtensions.SetLocalizationIndex<PeakMenuButton>(MenuAPI.CreateMenuButton("Back"), "BACK").SetColor(new Color(0.5189f, 0.1297f, 0.1718f), true), (Component)(object)modSettingsPage), new Vector2(120f, -160f)).SetWidth(120f); PeakElement val17 = ElementExtensions.SetSize<PeakElement>(ElementExtensions.SetPosition<PeakElement>(ElementExtensions.SetAnchorMax<PeakElement>(ElementExtensions.SetAnchorMin<PeakElement>(ElementExtensions.SetPivot<PeakElement>(ElementExtensions.ParentTo<PeakElement>(new GameObject("Content").AddComponent<PeakElement>(), (Component)(object)modSettingsPage), new Vector2(0f, 1f)), new Vector2(0f, 1f)), new Vector2(0f, 1f)), new Vector2(428f, -70f)), new Vector2(1360f, 980f)); ModdedSettingsMenu moddedSettingsMenu = ((Component)val17).gameObject.AddComponent<ModdedSettingsMenu>(); moddedSettingsMenu.MainPage = modSettingsPage; if ((Object)(object)pauseMenuHandler2 != (Object)null) { PeakMenuButton val18 = ElementExtensions.SetPosition<PeakMenuButton>(ElementExtensions.ParentTo<PeakMenuButton>(ElementExtensions.SetLocalizationIndex<PeakMenuButton>(MenuAPI.CreateMenuButton("MOD CONTROLS"), "MOD CONTROLS").SetColor(new Color(0.185f, 0.394f, 0.6226f), true), (Component)(object)modSettingsPage), new Vector2(285f, -160f)).SetWidth(200f); val18.OnClick((UnityAction)delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown ((UIPageHandler)pauseMenuHandler2).TransistionToPage((UIPage)(object)ModdedControlsMenu.Instance.MainPage, (PageTransistion)new SetActivePageTransistion()); }); } ElementExtensions.SetPosition<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText("Search"), (Component)(object)modSettingsPage), new Vector2(65f, -190f)); PeakTextInput val19 = ElementExtensions.SetPosition<PeakTextInput>(ElementExtensions.SetSize<PeakTextInput>(ElementExtensions.ParentTo<PeakTextInput>(MenuAPI.CreateTextInput("SearchInput"), (Component)(object)modSettingsPage), new Vector2(300f, 70f)), new Vector2(215f, -275f)).SetPlaceholder("Search here").OnValueChanged((UnityAction<string>)moddedSettingsMenu.SetSearch); modSettingsPage.SetBackButton(((Component)val16).GetComponent<Button>()); PeakHorizontalTabs val20 = ElementExtensions.ParentTo(new GameObject("TABS"), (Component)(object)val17).AddComponent<PeakHorizontalTabs>(); ((PeakElement)val20).RectTransform.anchoredPosition = new Vector2(110f, 0f); ((PeakElement)val20).RectTransform.anchorMax = new Vector2(0.92f, 1f); PeakText val21 = ElementExtensions.SetPosition<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText("MODS"), (Component)(object)val17), new Vector2(4f, 10f)); PeakText val22 = ElementExtensions.SetPosition<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText("SECTIONS"), (Component)(object)val17), new Vector2(4f, -50f)); PeakHorizontalTabs val23 = ElementExtensions.ParentTo(new GameObject("SectionTabs"), (Component)(object)val17).AddComponent<PeakHorizontalTabs>(); ((PeakElement)val23).RectTransform.anchoredPosition = new Vector2(175f, -55f); ((PeakElement)val23).RectTransform.anchorMax = new Vector2(0.87f, 1f); ModdedSettingsTABS moddedSettingsTABS = ((Component)val20).gameObject.AddComponent<ModdedSettingsTABS>(); moddedSettingsTABS.SettingsMenu = moddedSettingsMenu; ModdedSettingsSectionTABS moddedSettingsSectionTABS = ((Component)val23).gameObject.AddComponent<ModdedSettingsSectionTABS>(); moddedSettingsSectionTABS.SettingsMenu = moddedSettingsMenu; moddedSettingsMenu.SectionTabController = val23; PeakScrollableContent val24 = ElementExtensions.SetOffsetMax<PeakScrollableContent>(ElementExtensions.ExpandToParent<PeakScrollableContent>(ElementExtensions.ParentTo<PeakScrollableContent>(MenuAPI.CreateScrollableContent("TabContent"), (Component)(object)val17)), new Vector2(0f, -110f)); moddedSettingsMenu.Content = (Transform)(object)val24.Content; moddedSettingsMenu.Tabs = moddedSettingsTABS; foreach (KeyValuePair<string, ConfigEntryBase[]> modConfigEntry in GetModConfigEntries()) { modConfigEntry.Deconstruct(out var key, out var value); string text = key; ConfigEntryBase[] array = value; GameObject val25 = val20.AddTab(text); ModdedTABSButton moddedTABSButton = val25.AddComponent<ModdedTABSButton>(); moddedTABSButton.category = text; ((TAB_Button)moddedTABSButton).text = val25.GetComponentInChildren<TextMeshProUGUI>(); moddedTABSButton.SelectedGraphic = ((Component)val25.transform.Find("Selected")).gameObject; } PeakMenuButton val26 = ElementExtensions.ParentTo<PeakMenuButton>(ElementExtensions.SetLocalizationIndex<PeakMenuButton>(MenuAPI.CreatePauseMenuButton("MOD SETTINGS"), val13).SetColor(new Color(0.185f, 0.394f, 0.6226f), true), parent).OnClick((UnityAction)delegate { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown UIPageHandler val27 = (UIPageHandler)(((object)mainMenuHandler) ?? ((object)pauseMenuHandler2)); if (val27 != null) { val27.TransistionToPage((UIPage)(object)modSettingsPage, (PageTransistion)new SetActivePageTransistion()); } }); ((Component)modSettingsPage).gameObject.SetActive(false); if (val26 != null) { ElementExtensions.SetPosition<PeakMenuButton>(val26, new Vector2(171f, -230f)).SetWidth(220f); } } static void controlsBuilder(Transform parent) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Expected O, but got Unknown //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Expected O, but got Unknown //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Expected O, but got Unknown //IL_04dd: Unknown result type (might be due to invalid IL or missing references) Log.LogDebug((object)"controlsBuilder"); PauseMenuHandler pauseMenuHandler = ((Component)parent).GetComponentInParent<PauseMenuHandler>(); if ((Object)(object)pauseMenuHandler == (Object)null) { throw new Exception("Failed to get a UIPageHandler"); } PauseMenuControlsPage component = ((Component)parent).GetComponent<PauseMenuControlsPage>(); if ((Object)(object)component == (Object)null) { throw new Exception("Failed to get the parent page to create Modded Controls Page"); } PeakChildPage modControlsPage = MenuAPI.CreateChildPage("ModdedControlsPage", (UIPage)(object)component); ModdedControlsMenu controlsMenu = ((Component)modControlsPage).gameObject.AddComponent<ModdedControlsMenu>(); modControlsPage.SetOnOpen((UnityAction)delegate { Log.LogDebug((object)"Modded Controls Menu Opened!"); ProcessModEntries(); controlsMenu.ShowControls(); }); controlsMenu.MainPage = modControlsPage; controlsMenu.RebindNotif = ElementExtensions.ExpandToParent<PeakButton>(ElementExtensions.ParentTo<PeakButton>(MenuAPI.CreateButton("RebindModdedKey"), ((Component)component).transform.parent)); controlsMenu.RebindNotif.Text.SetFontSize(48f); ((Component)controlsMenu.RebindNotif).gameObject.SetActive(false); TranslationKey val = MenuAPI.CreateLocalization("MOD CONTROLS").AddLocalization("MOD CONTROLS", (Language)0); PeakElement val2 = ElementExtensions.SetSize<PeakElement>(ElementExtensions.SetPivot<PeakElement>(ElementExtensions.SetPosition<PeakElement>(ElementExtensions.SetAnchorMinMax<PeakElement>(ElementExtensions.ParentTo(new GameObject("Header"), (Component)(object)modControlsPage).AddComponent<PeakElement>(), new Vector2(0f, 1f)), new Vector2(40f, -40f)), new Vector2(0f, 1f)), new Vector2(360f, 100f)); PeakText val3 = ElementExtensions.SetLocalizationIndex<PeakText>(ElementExtensions.ExpandToParent<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText("Mod Controls", "HeaderText").SetFontSize(48f), (Component)(object)val2)), val); ((PeakLocalizableElement)val3).Text.fontSizeMax = 48f; ((PeakLocalizableElement)val3).Text.fontSizeMin = 24f; ((PeakLocalizableElement)val3).Text.enableAutoSizing = true; ((PeakLocalizableElement)val3).Text.alignment = (TextAlignmentOptions)514; PeakMenuButton val4 = ElementExtensions.SetPosition<PeakMenuButton>(ElementExtensions.ParentTo<PeakMenuButton>(ElementExtensions.SetLocalizationIndex<PeakMenuButton>(MenuAPI.CreateMenuButton("Back (Controls)"), "BACK").SetColor(new Color(0.5189f, 0.1297f, 0.1718f), true), (Component)(object)modControlsPage), new Vector2(120f, -160f)).SetWidth(120f); PeakMenuButton val5 = ElementExtensions.SetPosition<PeakMenuButton>(ElementExtensions.ParentTo<PeakMenuButton>(ElementExtensions.SetLocalizationIndex<PeakMenuButton>(MenuAPI.CreateMenuButton("MOD SETTINGS"), "MOD SETTINGS").SetColor(new Color(0.185f, 0.394f, 0.6226f), true), (Component)(object)modControlsPage), new Vector2(285f, -160f)).SetWidth(220f).OnClick((UnityAction)delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown ((UIPageHandler)pauseMenuHandler).TransistionToPage((UIPage)(object)ModdedSettingsMenu.Instance.MainPage, (PageTransistion)new SetActivePageTransistion()); }); PeakMenuButton val6 = ElementExtensions.SetPosition<PeakMenuButton>(ElementExtensions.ParentTo<PeakMenuButton>(ElementExtensions.SetLocalizationIndex<PeakMenuButton>(MenuAPI.CreateMenuButton("Restore Defaults"), "RESTOREDEFAULTS").SetColor(new Color(0.3919f, 0.1843f, 0.6235f), true), (Component)(object)modControlsPage), new Vector2(225f, -220f)).SetWidth(300f).OnClick(new UnityAction(controlsMenu.OnResetAllClicked)); modControlsPage.SetBackButton(((Component)val4).GetComponent<Button>()); ElementExtensions.SetPosition<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText("Search"), (Component)(object)modControlsPage), new Vector2(65f, -245f)); PeakElement val7 = ElementExtensions.SetSize<PeakElement>(ElementExtensions.SetPosition<PeakElement>(ElementExtensions.SetAnchorMax<PeakElement>(ElementExtensions.SetAnchorMin<PeakElement>(ElementExtensions.SetPivot<PeakElement>(ElementExtensions.ParentTo<PeakElement>(new GameObject("Content").AddComponent<PeakElement>(), (Component)(object)modControlsPage), new Vector2(0f, 1f)), new Vector2(0f, 1f)), new Vector2(0f, 1f)), new Vector2(428f, -70f)), new Vector2(1360f, 980f)); PeakScrollableContent val8 = ElementExtensions.SetOffsetMax<PeakScrollableContent>(ElementExtensions.ExpandToParent<PeakScrollableContent>(ElementExtensions.ParentTo<PeakScrollableContent>(MenuAPI.CreateScrollableContent("ScrollableContent"), (Component)(object)val7)), new Vector2(0f, -60f)); controlsMenu.Content = (Transform)(object)val8.Content; PeakTextInput val9 = ElementExtensions.SetPosition<PeakTextInput>(ElementExtensions.SetSize<PeakTextInput>(ElementExtensions.ParentTo<PeakTextInput>(MenuAPI.CreateTextInput("SearchInput"), (Component)(object)modControlsPage), new Vector2(300f, 70f)), new Vector2(215f, -330f)).SetPlaceholder("Search here").OnValueChanged((UnityAction<string>)controlsMenu.SetSearch); PeakMenuButton val10 = ElementExtensions.ParentTo<PeakMenuButton>(ElementExtensions.SetLocalizationIndex<PeakMenuButton>(MenuAPI.CreatePauseMenuButton("MOD CONTROLS"), val).SetColor(new Color(0.185f, 0.394f, 0.6226f), true), parent).OnClick((UnityAction)delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown ((UIPageHandler)pauseMenuHandler).TransistionToPage((UIPage)(object)modControlsPage, (PageTransistion)new SetActivePageTransistion()); }); ((Component)modControlsPage).gameObject.SetActive(false); if (val10 != null) { ElementExtensions.SetPosition<PeakMenuButton>(val10, new Vector2(205f, -291f)).SetWidth(220f); } } } private static void LoadModSettings() { if (!modSettingsLoaded) { EntriesProcessed = new List<ConfigEntryBase>(); ModdedKeys = new List<ModKeyToName>(); modSettingsLoaded = true; ProcessModEntries(); } } private static void ProcessModEntries() { foreach (KeyValuePair<string, ConfigEntryBase[]> modConfigEntry in GetModConfigEntries()) { modConfigEntry.Deconstruct(out var key, out var value); string text = key; ConfigEntryBase[] array = value; ModSectionNames modSectionNames = ModSectionNames.SetMod(text); ConfigEntryBase[] array2 = array; foreach (ConfigEntryBase configEntry in array2) { try { if (EntriesProcessed.Contains(configEntry)) { continue; } EntriesProcessed.Add(configEntry); modSectionNames.CheckSectionName(configEntry.Definition.Section); if (configEntry.SettingType == typeof(bool)) { SettingsHandlerUtility.AddBoolToTab(configEntry, text, delegate(bool newVal) { configEntry.BoxedValue = newVal; }); } else if (configEntry.SettingType == typeof(float)) { SettingsHandlerUtility.AddFloatToTab(configEntry, text, delegate(float newVal) { configEntry.BoxedValue = newVal; }); } else if (configEntry.SettingType == typeof(double)) { SettingsHandlerUtility.AddDoubleToTab(configEntry, text, delegate(double newVal) { configEntry.BoxedValue = newVal; }); } else if (configEntry.SettingType == typeof(int)) { SettingsHandlerUtility.AddIntToTab(configEntry, text, delegate(int newVal) { configEntry.BoxedValue = newVal; }); } else if (configEntry.SettingType == typeof(string)) { string text3 = ((configEntry.DefaultValue is string text2) ? text2 : ""); if (text3.Length > 4 && IsValidPath(text3)) { ModKeyToName item = new ModKeyToName(configEntry, text); ModdedKeys.Add(item); Log.LogDebug((object)("String config with default - " + text3 + " is detected as InputAction path")); } if (configEntry.Description.AcceptableValues is AcceptableValueList<string>) { SettingsHandlerUtility.AddEnumToTab(configEntry, text, isEnum: false, delegate(string newVal) { configEntry.BoxedValue = newVal; }); return; } SettingsHandlerUtility.AddStringToTab(configEntry, text, delegate(string newVal) { configEntry.BoxedValue = newVal; }); } else if (configEntry.SettingType == typeof(KeyCode)) { if (configEntry is ConfigEntry<KeyCode> key2) { ModKeyToName item2 = new ModKeyToName((ConfigEntryBase)(object)key2, text); ModdedKeys.Add(item2); } SettingsHandlerUtility.AddKeybindToTab(configEntry, text, delegate(KeyCode newVal) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) configEntry.BoxedValue = newVal; }); } else if (configEntry.SettingType.IsEnum) { SettingsHandlerUtility.AddEnumToTab(configEntry, text, isEnum: true, delegate(string newVal) { if (Enum.TryParse(configEntry.SettingType, newVal, out object result)) { configEntry.BoxedValue = result; } }); } else { Log.LogWarning((object)$"Missing SettingType: [Mod: {text}] {configEntry.Definition.Key} (Type: {configEntry.SettingType})"); } } catch (Exception ex) { Log.LogError((object)ex); } } } } private static bool IsValidPath(string path) { string path2 = path; path2 = path2.Replace("<", "").Replace(">", ""); return GetValidKeyPaths.Any((string x) => x.Contains(path2, StringComparison.InvariantCultureIgnoreCase)); } private static List<string> GenerateValidKeyPaths() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); List<string> source = new List<string>(1) { "/Keyboard/anyKey" }; Enumerator<InputDevice> enumerator = InputSystem.devices.GetEnumerator(); try { while (enumerator.MoveNext()) { InputDevice current = enumerator.Current; if (current == null) { continue; } Enumerator<InputControl> enumerator2 = current.allControls.GetEnumerator(); try { while (enumerator2.MoveNext()) { InputControl control = enumerator2.Current; if (!source.Any((string d) => d.Equals(control.path, StringComparison.InvariantCultureIgnoreCase))) { list.Add(control.path); } } } finally { ((IDisposable)enumerator2).Dispose(); } } return list; } finally { ((IDisposable)enumerator).Dispose(); } } private static Dictionary<string, ConfigEntryBase[]> GetModConfigEntries() { Dictionary<string, ConfigEntryBase[]> dictionary = new Dictionary<string, ConfigEntryBase[]>(); foreach (PluginInfo item in Chainloader.PluginInfos.Values.OrderBy((PluginInfo p) => p.Metadata.Name)) { List<ConfigEntryBase> list = new List<ConfigEntryBase>(); foreach (ConfigEntryBase item2 in ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)item.Instance.Config).Select((KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) => configEntry.Value)) { ConfigDescription description = item2.Description; object[] array = ((description != null) ? description.Tags : null); if (array == null || !array.Contains("Hidden")) { list.Add(item2); } } if (list.Count > 0) { dictionary.TryAdd(FixNaming(item.Metadata.Name), list.ToArray()); } } return dictionary; } private static string FixNaming(string input) { input = Regex.Replace(input, "([a-z])([A-Z])", "$1 $2"); input = Regex.Replace(input, "([A-Z])([A-Z][a-z])", "$1 $2"); input = Regex.Replace(input, "\\s+", " "); input = Regex.Replace(input, "([A-Z]\\.)\\s([A-Z]\\.)", "$1$2"); return input.Trim(); } } internal static class SettingsHandlerUtility { internal static void AddBoolToTab(ConfigEntryBase entry, string tabName, Action<bool>? saveCallback = null) { if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExOffOn(entry, tabName, saveCallback)); } internal static void AddFloatToTab(ConfigEntryBase entry, string tabName, Action<float>? applyCallback = null) { if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExFloat(entry, tabName, applyCallback)); } internal static void AddDoubleToTab(ConfigEntryBase entry, string tabName, Action<double>? applyCallback = null) { if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExDouble(entry, tabName, applyCallback)); } internal static void AddIntToTab(ConfigEntryBase entry, string tabName, Action<int>? saveCallback = null) { if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExInt(entry, tabName, saveCallback)); } internal static void AddStringToTab(ConfigEntryBase entry, string tabName, Action<string>? saveCallback = null) { if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExString(entry, tabName, saveCallback)); } internal static void AddKeybindToTab(ConfigEntryBase entry, string tabName, Action<KeyCode>? saveCallback) { if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExKeyCode(entry, tabName, saveCallback)); } internal static void AddEnumToTab(ConfigEntryBase entry, string tabName, bool isEnum, Action<string>? saveCallback) { if (SettingsHandler.Instance == null) { throw new Exception("You're registering options too early! Use the Start() function to create new options!"); } SettingsHandler.Instance.AddSetting((Setting)(object)new BepInExEnum(entry, tabName, isEnum, saveCallback)); } public static T GetDefaultValue<T>(ConfigEntry<T> entry) { return (T)((ConfigEntryBase)entry).DefaultValue; } public static T GetDefaultValue<T>(ConfigEntryBase entry) { return (T)entry.DefaultValue; } public static T GetCurrentValue<T>(ConfigEntryBase entry) { return (T)entry.BoxedValue; } public static List<T> GetAcceptableValues<T>(ConfigEntryBase entry) where T : IEquatable<T> { if (entry.Description.AcceptableValues is AcceptableValueList<T> val) { return val.AcceptableValues.ToList(); } return new List<T>(); } public static bool TryGetMinMaxValue<T>(ConfigEntryBase entry, out T minValue, out T maxValue) where T : IComparable { minValue = default(T); maxValue = default(T); if (entry.Description.AcceptableValues is AcceptableValueRange<T> val) { minValue = val.MinValue; maxValue = val.MaxValue; return true; } return false; } } } namespace PEAKLib.ModConfig.SettingOptions { internal class BepInExDouble : FloatSetting, IBepInExProperty, IExposedSetting { [CompilerGenerated] private ConfigEntryBase <entryBase>P; [CompilerGenerated] private string <categoryName>P; [CompilerGenerated] private Action<double>? <saveCallback>P; [CompilerGenerated] private Action<BepInExDouble>? <onApply>P; ConfigEntryBase IBepInExProperty.ConfigBase => <entryBase>P; public BepInExDouble(ConfigEntryBase entryBase, string categoryName = "Mods", Action<double>? saveCallback = null, Action<BepInExDouble>? onApply = null) { <entryBase>P = entryBase; <categoryName>P = categoryName; <saveCallback>P = saveCallback; <onApply>P = onApply; ((FloatSetting)this)..ctor(); } public override void Load(ISettingsSaveLoad loader) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002a: Unknown result type (might be due to invalid IL or missing references) ((FloatSetting)this).Value = Convert.ToSingle(SettingsHandlerUtility.GetCurrentValue<double>(<entryBase>P)); float2 minMaxValue = ((FloatSetting)this).GetMinMaxValue(); ((FloatSetting)this).MinValue = minMaxValue.x; ((FloatSetting)this).MaxValue = minMaxValue.y; } public override void Save(ISettingsSaveLoad saver) { <saveCallback>P?.Invoke(((FloatSetting)this).Value); } public override void ApplyValue() { <onApply>P?.Invoke(this); } public void RefreshValueFromConfig() { ((FloatSetting)this).Value = Convert.ToSingle(SettingsHandlerUtility.GetCurrentValue<double>(<entryBase>P)); } public string GetDisplayName() { return <entryBase>P.Definition.Key; } public string GetCategory() { return <categoryName>P; } protected override float GetDefaultValue() { double defaultValue = SettingsHandlerUtility.GetDefaultValue<double>(<entryBase>P); return Convert.ToSingle(defaultValue); } protected override float2 GetMinMaxValue() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (SettingsHandlerUtility.TryGetMinMaxValue<double>(<entryBase>P, out var minValue, out var maxValue)) { float num = Convert.ToSingle(minValue); float num2 = Convert.ToSingle(maxValue); return new float2(num, num2); } return new float2(0f, 1000f); } } internal class BepInExEnum : Setting, IEnumSetting, IExposedSetting, IBepInExProperty { [CompilerGenerated] private ConfigEntryBase <entryBase>P; [CompilerGenerated] private string <category>P; [CompilerGenerated] private bool <isEnum>P; [CompilerGenerated] private Action<string>? <saveCallback>P; [CompilerGenerated] private Action<BepInExEnum>? <onApply>P; ConfigEntryBase IBepInExProperty.ConfigBase => <entryBase>P; public string Value { get; protected set; } public BepInExEnum(ConfigEntryBase entryBase, string category = "Mods", bool isEnum = true, Action<string>? saveCallback = null, Action<BepInExEnum>? onApply = null) { <entryBase>P = entryBase; <category>P = category; <isEnum>P = isEnum; <saveCallback>P = saveCallback; <onApply>P = onApply; Value = ""; ((Setting)this)..ctor(); } public string GetDisplayName() { return <entryBase>P.Definition.Key; } public string GetCategory() { return <category>P; } public void RefreshValueFromConfig() { if (<isEnum>P) { Type settingType = <entryBase>P.SettingType; object boxedValue = <entryBase>P.BoxedValue; Value = Enum.GetName(settingType, (boxedValue != null) ? boxedValue : Enum.ToObject(<entryBase>P.SettingType, 0)); } else { Value = SettingsHandlerUtility.GetCurrentValue<string>(<entryBase>P); } } public override void Load(ISettingsSaveLoad loader) { RefreshValueFromConfig(); } public override void Save(ISettingsSaveLoad saver) { <saveCallback>P?.Invoke(Value); } public override GameObject GetSettingUICell() { return SingletonAsset<InputCellMapper>.Instance.EnumSettingCell; } public virtual List<string> GetUnlocalizedChoices() { if (<isEnum>P) { return Enum.GetNames(<entryBase>P.SettingType).ToList(); } return SettingsHandlerUtility.GetAcceptableValues<string>(<entryBase>P); } public List<LocalizedString> GetLocalizedChoices() { return null; } public int GetValue() { return GetUnlocalizedChoices().IndexOf(Value); } public void SetValue(int v, ISettingHandler settingHandler, bool fromUI) { Value = GetUnlocalizedChoices()[v]; ((Setting)this).ApplyValue(); settingHandler.SaveSetting((Setting)(object)this); if (!fromUI) { ((Setting)this).OnSettingChangedExternal(); } ((Setting)this).OnSettingChanged(); } public override void ApplyValue() { <onApply>P?.Invoke(this); } public override SettingUI GetDebugUI(ISettingHandler settingHandler) { return null; } } internal class BepInExFloat : FloatSetting, IBepInExProperty, IExposedSetting { [CompilerGenerated] private ConfigEntryBase <entryBase>P; [CompilerGenerated] private string <categoryName>P; [CompilerGenerated] private Action<float>? <saveCallback>P; [CompilerGenerated] private Action<BepInExFloat>? <onApply>P; ConfigEntryBase IBepInExProperty.ConfigBase => <entryBase>P; public BepInExFloat(ConfigEntryBase entryBase, string categoryName = "Mods", Action<float>? saveCallback = null, Action<BepInExFloat>? onApply = null) { <entryBase>P = entryBase; <categoryName>P = categoryName; <saveCallback>P = saveCallback; <onApply>P = onApply; ((FloatSetting)this)..ctor(); } public override void Load(ISettingsSaveLoad loader) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) ((FloatSetting)this).Value = SettingsHandlerUtility.GetCurrentValue<float>(<entryBase>P); float2 minMaxValue = ((FloatSetting)this).GetMinMaxValue(); ((FloatSetting)this).MinValue = minMaxValue.x; ((FloatSetting)this).MaxValue = minMaxValue.y; } public override void Save(ISettingsSaveLoad saver) { <saveCallback>P?.Invoke(((FloatSetting)this).Value); } public override void ApplyValue() { <onApply>P?.Invoke(this); } public void RefreshValueFromConfig() { ((FloatSetting)this).Value = SettingsHandlerUtility.GetCurrentValue<float>(<entryBase>P); } public string GetDisplayName() { return <entryBase>P.Definition.Key; } public string GetCategory() { return <categoryName>P; } protected override float GetDefaultValue() { return SettingsHandlerUtility.GetDefaultValue<float>(<entryBase>P); } protected override float2 GetMinMaxValue() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (SettingsHandlerUtility.TryGetMinMaxValue<float>(<entryBase>P, out var minValue, out var maxValue)) { return new float2(minValue, maxValue); } return new float2(0f, 1000f); } } internal class BepInExInt : IntSetting, IBepInExProperty, IExposedSetting { [CompilerGenerated] private ConfigEntryBase <entryBase>P; [CompilerGenerated] private string <category>P; [CompilerGenerated] private Action<int>? <saveCallback>P; [CompilerGenerated] private Action<BepInExInt>? <onApply>P; private static GameObject? _settingUICell; ConfigEntryBase IBepInExProperty.ConfigBase => <entryBase>P; public static GameObject? SettingUICell { get { //IL_00af: 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_00d9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_settingUICell == (Object)null) { if ((Object)(object)SingletonAsset<InputCellMapper>.Instance == (Object)null || (Object)(object)SingletonAsset<InputCellMapper>.Instance.FloatSettingCell == (Object)null) { return null; } _settingUICell = Object.Instantiate<GameObject>(SingletonAsset<InputCellMapper>.Instance.FloatSettingCell); ((Object)_settingUICell).name = "BepInExIntCell"; FloatSettingUI component = _settingUICell.GetComponent<FloatSettingUI>(); BepInExInt_SettingUI bepInExInt_SettingUI = _settingUICell.AddComponent<BepInExInt_SettingUI>(); bepInExInt_SettingUI.inputField = component.inputField; Object.DestroyImmediate((Object)(object)((Component)component.slider).gameObject); Object.DestroyImmediate((Object)(object)component); bepInExInt_SettingUI.inputField.characterValidation = (CharacterValidation)2; RectTransform component2 = ((Component)bepInExInt_SettingUI.inputField).GetComponent<RectTransform>(); component2.pivot = new Vector2(0.5f, 0.5f); component2.offsetMin = new Vector2(20f, -25f); component2.offsetMax = new Vector2(380f, 25f); Object.DontDestroyOnLoad((Object)(object)_settingUICell); } return _settingUICell; } } public BepInExInt(ConfigEntryBase entryBase, string category = "Mods", Action<int>? saveCallback = null, Action<BepInExInt>? onApply = null) { <entryBase>P = entryBase; <category>P = category; <saveCallback>P = saveCallback; <onApply>P = onApply; ((IntSetting)this)..ctor(); } public void RefreshValueFromConfig() { ((IntSetting)this).Value = SettingsHandlerUtility.GetCurrentValue<int>(<entryBase>P); } public override void Load(ISettingsSaveLoad loader) { ((IntSetting)this).Value = SettingsHandlerUtility.GetCurrentValue<int>(<entryBase>P); } public override void Save(ISettingsSaveLoad saver) { <saveCallback>P?.Invoke(((IntSetting)this).Value); } public override void ApplyValue() { <onApply>P?.Invoke(this); } public override GameObject? GetSettingUICell() { return SettingUICell; } public string GetCategory() { return <category>P; } public string GetDisplayName() { return <entryBase>P.Definition.Key; } protected override int GetDefaultValue() { return SettingsHandlerUtility.GetDefaultValue<int>(<entryBase>P); } } internal class BepInExKeyCode : Setting, IBepInExProperty, IExposedSetting { [CompilerGenerated] private ConfigEntryBase <entryBase>P; [CompilerGenerated] private string <category>P; [CompilerGenerated] private Action<KeyCode>? <saveCallback>P; [CompilerGenerated] private Action<BepInExKeyCode>? <onApply>P; private static GameObject? _settingUICell; ConfigEntryBase IBepInExProperty.ConfigBase => <entryBase>P; public KeyCode Value { get; set; } public static GameObject? SettingUICell { get { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_settingUICell == (Object)null) { if ((Object)(object)SingletonAsset<InputCellMapper>.Instance == (Object)null || (Object)(object)SingletonAsset<InputCellMapper>.Instance.FloatSettingCell == (Object)null) { return null; } _settingUICell = Object.Instantiate<GameObject>(SingletonAsset<InputCellMapper>.Instance.FloatSettingCell); ((Object)_settingUICell).name = "BepInExKeyCodeCell"; FloatSettingUI component = _settingUICell.GetComponent<FloatSettingUI>(); BepInExKeyCode_SettingUI bepInExKeyCode_SettingUI = _settingUICell.AddComponent<BepInExKeyCode_SettingUI>(); RectTransform component2 = ((Component)component.inputField).GetComponent<RectTransform>(); component2.pivot = new Vector2(0.5f, 0.5f); component2.offsetMin = new Vector2(20f, -25f); component2.offsetMax = new Vector2(380f, 25f); bepInExKeyCode_SettingUI.button = _settingUICell.AddComponent<Button>(); ((Object)component.inputField).name = "Button"; Object.DestroyImmediate((Object)(object)((Component)component.inputField.placeholder).gameObject); Object.Destroy((Object)(object)component.inputField); Object.DestroyImmediate((Object)(object)((Component)component.slider).gameObject); Object.DestroyImmediate((Object)(object)component); TextMeshProUGUI componentInChildren = ((Component)bepInExKeyCode_SettingUI.button).GetComponentInChildren<TextMeshProUGUI>(); float num2 = (((TMP_Text)componentInChildren).fontSizeMax = 22f); float fontSize = (((TMP_Text)componentInChildren).fontSizeMin = num2); ((TMP_Text)componentInChildren).fontSize = fontSize; ((TMP_Text)componentInChildren).alignment = (TextAlignmentOptions)514; bepInExKeyCode_SettingUI.text = componentInChildren; Object.DontDestroyOnLoad((Object)(object)_settingUICell); } return _settingUICell; } } public BepInExKeyCode(ConfigEntryBase entryBase, string category = "Mods", Action<KeyCode>? saveCallback = null, Action<BepInExKeyCode>? onApply = null) { <entryBase>P = entryBase; <category>P = category; <saveCallback>P = saveCallback; <onApply>P = onApply; ((Setting)this)..ctor(); } public override void Load(ISettingsSaveLoad loader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Value = SettingsHandlerUtility.GetCurrentValue<KeyCode>(<entryBase>P); } public override void Save(ISettingsSaveLoad saver) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) <saveCallback>P?.Invoke(Value); } public override void ApplyValue() { <onApply>P?.Invoke(this); } public void RefreshValueFromConfig() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Value = SettingsHandlerUtility.GetCurrentValue<KeyCode>(<entryBase>P); } public override GameObject? GetSettingUICell() { return SettingUICell; } public string GetCategory() { return <category>P; } public string GetDisplayName() { return <entryBase>P.Definition.Key; } protected KeyCode GetDefaultValue() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return SettingsHandlerUtility.GetDefaultValue<KeyCode>(<entryBase>P); } public override SettingUI GetDebugUI(ISettingHandler settingHandler) { return null; } public void SetValue(KeyCode newValue, ISettingHandler settingHandler) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Value = newValue; ((Setting)this).ApplyValue(); settingHandler.SaveSetting((Setting)(object)this); } } internal class BepInExOffOn : OffOnSetting, IBepInExProperty, IExposedSetting { [CompilerGenerated] private ConfigEntryBase <entryBase>P; [CompilerGenerated] private string <category>P; [CompilerGenerated] private Action<bool>? <saveCallback>P; [CompilerGenerated] private Action<BepInExOffOn>? <onApply>P; ConfigEntryBase IBepInExProperty.ConfigBase => <entryBase>P; public BepInExOffOn(ConfigEntryBase entryBase, string category = "Mods", Action<bool>? saveCallback = null, Action<BepInExOffOn>? onApply = null) { <entryBase>P = entryBase; <category>P = category; <saveCallback>P = saveCallback; <onApply>P = onApply; ((OffOnSetting)this)..ctor(); } public override void Load(ISettingsSaveLoad loader) { ((EnumSetting<OffOnMode>)this).Value = (OffOnMode)(SettingsHandlerUtility.GetCurrentValue<bool>(<entryBase>P) ? 1 : 0); } public override void Save(ISettingsSaveLoad saver) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 <saveCallback>P?.Invoke((int)((EnumSetting<OffOnMode>)this).Value == 1); } public void RefreshValueFromConfig() { ((EnumSetting<OffOnMode>)this).Value = (OffOnMode)(SettingsHandlerUtility.GetCurrentValue<bool>(<entryBase>P) ? 1 : 0); } public override void ApplyValue() { <onApply>P?.Invoke(this); } protected override OffOnMode GetDefaultValue() { if (SettingsHandlerUtility.GetDefaultValue<bool>(<entryBase>P)) { return (OffOnMode)1; } return (OffOnMode)0; } public string GetDisplayName() { return <entryBase>P.Definition.Key; } public string GetCategory() { return <category>P; } public override List<LocalizedString>? GetLocalizedChoices() { return null; } } internal class BepInExString : StringSetting, IBepInExProperty, IExposedSetting { [CompilerGenerated] private ConfigEntryBase <entryBase>P; [CompilerGenerated] private string <category>P; [CompilerGenerated] private Action<string>? <saveCallback>P; [CompilerGenerated] private Action<BepInExString>? <onApply>P; private static GameObject? _settingUICell; ConfigEntryBase IBepInExProperty.ConfigBase => <entryBase>P; public string PlaceholderText { get; set; } public static GameObject? SettingUICell { get { //IL_00af: 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_00d9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_settingUICell == (Object)null) { if ((Object)(object)SingletonAsset<InputCellMapper>.Instance == (Object)null || (Object)(object)SingletonAsset<InputCellMapper>.Instance.FloatSettingCell == (Object)null) { return null; } _settingUICell = Object.Instantiate<GameObject>(SingletonAsset<InputCellMapper>.Instance.FloatSettingCell); ((Object)_settingUICell).name = "BepInExStringCell"; FloatSettingUI component = _settingUICell.GetComponent<FloatSettingUI>(); StringSettingUI stringSettingUI = _settingUICell.AddComponent<StringSettingUI>(); stringSettingUI.inputField = component.inputField; Object.DestroyImmediate((Object)(object)((Component)component.slider).gameObject); Object.DestroyImmediate((Object)(object)component); stringSettingUI.inputField.characterValidation = (CharacterValidation)0; RectTransform component2 = ((Component)stringSettingUI.inputField).GetComponent<RectTransform>(); component2.pivot = new Vector2(0.5f, 0.5f); component2.offsetMin = new Vector2(20f, -25f); component2.offsetMax = new Vector2(380f, 25f); TextMeshProUGUI[] componentsInChildren = ((Component)stringSettingUI.inputField).GetComponentsInChildren<TextMeshProUGUI>(); TextMeshProUGUI[] array = componentsInChildren; foreach (TextMeshProUGUI val in array) { float num2 = (((TMP_Text)val).fontSizeMax = 22f); float fontSize = (((TMP_Text)val).fontSizeMin = num2); ((TMP_Text)val).fontSize = fontSize; ((TMP_Text)val).alignment = (TextAlignmentOptions)4097; } Object.DontDestroyOnLoad((Object)(object)_settingUICell); } return _settingUICell; } } public BepInExString(ConfigEntryBase entryBase, string category = "Mods", Action<string>? saveCallback = null, Action<BepInExString>? onApply = null) { <entryBase>P = entryBase; <category>P = category; <saveCallback>P = saveCallback; <onApply>P = onApply; PlaceholderText = SettingsHandlerUtility.GetDefaultValue<string>(<entryBase>P) ?? ""; ((StringSetting)this)..ctor(); } public override void Load(ISettingsSaveLoad loader) { ((StringSetting)this).Value = SettingsHandlerUtility.GetCurrentValue<string>(<entryBase>P); } public override void Save(ISettingsSaveLoad saver) { <saveCallback>P?.Invoke(((StringSetting)this).Value); } public override void ApplyValue() { <onApply>P?.Invoke(this); } public override GameObject? GetSettingUICell() { return SettingUICell; } public string GetCategory() { return <category>P; } public string GetDisplayName() { return <entryBase>P.Definition.Key; } protected override string GetDefaultValue() { return SettingsHandlerUtility.GetDefaultValue<string>(<entryBase>P); } public void RefreshValueFromConfig() { ((StringSetting)this).Value = SettingsHandlerUtility.GetCurrentValue<string>(<entryBase>P); } } public class StringSettingUI : SettingInputUICell { public TMP_InputField? inputField; public override void Setup(Setting setting, ISettingHandler settingHandler) { ISettingHandler settingHandler2 = settingHandler; if (setting == null) { return; } BepInExString stringSetting = setting as BepInExString; if (stringSetting == null) { return; } ((SettingInputUICell)this).RegisterSettingListener(setting); if ((Object)(object)inputField == (Object)null) { return; } inputField.SetTextWithoutNotify(((StringSetting)stringSetting).Value); ((UnityEvent<string>)(object)inputField.onValueChanged).AddListener((UnityAction<string>)OnChanged); TextMeshProUGUI[] componentsInChildren = ((Component)inputField).GetComponentsInChildren<TextMeshProUGUI>(); TextMeshProUGUI[] array = componentsInChildren; foreach (TextMeshProUGUI val in array) { if (((Object)val).name == "Placeholder") { ((TMP_Text)val).text = stringSetting.PlaceholderText; } } void OnChanged(string str) { inputField.SetTextWithoutNotify(str); ((StringSetting)stringSetting).SetValue(str, settingHandler2); } } protected override void OnSettingChangedExternal(Setting setting) { ((SettingInputUICell)this).OnSettingChangedExternal(setting); if ((Object)(object)inputField != (Object)null && setting is BepInExString bepInExString) { inputField.SetTextWithoutNotify(((StringSetting)bepInExString).Value); } } } } namespace PEAKLib.ModConfig.SettingOptions.SettingUI { internal class BepInExInt_SettingUI : SettingInputUICell { public TMP_InputField? inputField; public override void Setup(Setting setting, ISettingHandler settingHandler) { ISettingHandler settingHandler2 = settingHandler; BepInExInt intSetting; if (!((Object)(object)inputField == (Object)null) && setting != null) { intSetting = setting as BepInExInt; if (intSetting != null) { ((SettingInputUICell)this).RegisterSettingListener(setting); inputField.SetTextWithoutNotify(((IntSetting)intSetting).Expose(((IntSetting)intSetting).Value)); ((UnityEvent<string>)(object)inputField.onValueChanged).AddListener((UnityAction<string>)OnChanged); } } void OnChanged(string str) { if (int.TryParse(str, out var result)) { inputField.SetTextWithoutNotify(((IntSetting)intSetting).Expose(result)); ((IntSetting)intSetting).SetValue(result, settingHandler2); } } } protected override void OnSettingChangedExternal(Setting setting) { ((SettingInputUICell)this).OnSettingChangedExternal(setting); if ((Object)(object)inputField != (Object)null && setting is BepInExInt bepInExInt) { inputField.SetTextWithoutNotify(((IntSetting)bepInExInt).Expose(((IntSetting)bepInExInt).Value)); } } } internal class BepInExKeyCode_SettingUI : SettingInputUICell { public Button? button; public TextMeshProUGUI? text; private static BepInExKeyCode_SettingUI? detectingKey = null; internal static KeyCode[] BlackListed = (KeyCode[])(object)new KeyCode[1] { (KeyCode)27 }; public override void Setup(Setting setting, ISettingHandler settingHandler) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown ISettingHandler settingHandler2 = settingHandler; ThrowHelper.ThrowIfFieldNull<Button>(button, "button"); ThrowHelper.ThrowIfFieldNull<TextMeshProUGUI>(text, "text"); if (setting == null) { return; } BepInExKeyCode keyCodeSetting = setting as BepInExKeyCode; if (keyCodeSetting != null) { ((SettingInputUICell)this).RegisterSettingListener(setting); TextMeshProUGUI? obj = text; KeyCode value = keyCodeSetting.Value; ((TMP_Text)obj).text = ((object)(KeyCode)(ref value)).ToString(); ((UnityEvent)button.onClick).AddListener((UnityAction)delegate { StartKeybindCapture(keyCodeSetting, settingHandler2); }); } } protected override void OnSettingChangedExternal(Setting setting) { //IL_0026: 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) ((SettingInputUICell)this).OnSettingChangedExternal(setting); if ((Object)(object)text != (Object)null && setting is BepInExKeyCode bepInExKeyCode) { TextMeshProUGUI? obj = text; KeyCode value = bepInExKeyCode.Value; ((TMP_Text)obj).text = ((object)(KeyCode)(ref value)).ToString(); } } protected override void OnDestroy() { if ((Object)(object)detectingKey == (Object)(object)this) { detectingKey = null; } } private static IEnumerator WaitForKey(Action<KeyCode> onKeyDetected) { while ((Object)(object)detectingKey != (Object)null) { foreach (KeyCode value in Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyDown(value)) { onKeyDetected?.Invoke(value); yield break; } } yield return null; } } private void StartKeybindCapture(BepInExKeyCode setting, ISettingHandler settingHandler) { BepInExKeyCode setting2 = setting; ISettingHandler settingHandler2 = settingHandler; if ((Object)(object)detectingKey != (Object)null) { return; } detectingKey = this; if ((Object)(object)text != (Object)null) { ((TMP_Text)text).text = "SELECT A KEY"; } ((MonoBehaviour)this).StartCoroutine(WaitForKey(delegate(KeyCode key) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!BlackListed.Contains(key)) { setting2.SetValue(key, settingHandler2); } ((SettingInputUICell)this).OnSettingChangedExternal((Setting)(object)setting2); detectingKey = null; })); } } } namespace PEAKLib.ModConfig.Components { internal class ModdedControlsMenu : PeakElement { public GameObject[] keyboardOnlyObjects = Array.Empty<GameObject>(); public GameObject[] controllerOnlyObjects = Array.Empty<GameObject>(); public static ModdedControlsMenu Instance = null; public List<ModdedRebindKey> controlsMenuButtons = new List<ModdedRebindKey>(); public List<GameObject> ModLabels = new List<GameObject>(); private string search = ""; internal UIPageHandler pageHandler; internal bool RebindInProgress; internal PeakChildPage MainPage; internal PeakButton RebindNotif; internal ConfigEntry<KeyCode> SelectedKeyCode; internal ConfigEntry<string> SelectedKeyString; private static readonly InputAction Dummy = new InputAction("ModConfig Dummy InputAction for Rebinding", (InputActionType)0, (string)null, (string)null, (string)null, (string)null); internal Transform Content { get; set; } public void Awake() { //IL_003a: 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_0057: Unknown result type (might be due to invalid IL or missing references) ModConfigPlugin.Log.LogDebug((object)"ModdedControlsMenu Awake"); Instance = this; if ((Object)(object)pageHandler == (Object)null) { pageHandler = ((Component)this).GetComponentInParent<UIPageHandler>(); } InitButtons(); if (Dummy.bindings.Count < 1) { InputActionSetupExtensions.AddBinding(Dummy, "/Keyboard/anyKey", (string)null, (string)null, (string)null); } } internal void OnResetAllClicked() { ModConfigPlugin.Log.LogMessage((object)"Resetting all modded settings!"); controlsMenuButtons.ForEach(delegate(ModdedRebindKey b) { if (!b.IsAlreadyDefault()) { b.SetDefault(); ((Selectable)b.reset.GetComponent<Button>()).animator.SetBool("Pressed", true); ((Selectable)b.reset.GetComponent<Button>()).animator.SetBool("Disabled", true); } }); ShowControls(); } public void OnDeviceChange(InputScheme scheme) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Invalid comparison between Unknown and I4 if ((int)scheme != 0) { if ((int)scheme == 1) { GameObject[] array = keyboardOnlyObjects; for (int i = 0; i < array.Length; i++) { array[i].SetActive(false); } array = controllerOnlyObjects; for (int j = 0; j < array.Length; j++) { array[j].SetActive(true); } } } else { GameObject[] array2 = keyboardOnlyObjects; for (int k = 0; k < array2.Length; k++) { array2[k].SetActive(true); } array2 = controllerOnlyObjects; for (int l = 0; l < array2.Length; l++) { array2[l].SetActive(false); } } InitButtonBindingVisuals(); Transform transform = ((Component)this).transform; LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)(object)((transform is RectTransform) ? transform : null)); } public void InitButtons() { if ((Object)(object)pageHandler == (Object)null) { pageHandler = ((Component)this).GetComponentInParent<UIPageHandler>(); } List<ModKeyToName> list = ModConfigPlugin.ModdedKeys.ToList(); if (controlsMenuButtons.Count > 0) { foreach (ModdedRebindKey controlsMenuButton in controlsMenuButtons) { if (controlsMenuButton.ConfigKeyCode != null) { list = ModKeyToName.RemoveKey(list, (ConfigEntryBase)(object)controlsMenuButton.ConfigKeyCode); } if (controlsMenuButton.ConfigKeyString != null) { list = ModKeyToName.RemoveKey(list, (ConfigEntryBase)(object)controlsMenuButton.ConfigKeyString); } } } foreach (ModKeyToName item in list) { AddControlMenuButton(item.KeyBind, item.ModName); } } private void AddControlMenuButton(ConfigEntryBase configEntry, string ModName) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) string ModName2 = ModName; if (!((Object)(object)Content == (Object)null)) { GameObject val = ((IEnumerable<GameObject>)ModLabels).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name == ModName2)); if (val == null) { PeakText val2 = ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText(ModName2, ModName2).SetFontSize(36f).SetColor(Color.green), Content); ((TMP_Text)val2.TextMesh).alignment = (TextAlignmentOptions)514; val = ((Component)val2).gameObject; ModLabels.Add(val); } GameObject val3 = new GameObject("(" + ModName2 + ") " + configEntry.Definition.Key); ModdedRebindKey moddedRebindKey = val3.AddComponent<ModdedRebindKey>(); moddedRebindKey.Label = val; moddedRebindKey.Setup(configEntry, ModName2); val3.transform.localPosition = Vector3.zero; val3.transform.SetParent(Content); controlsMenuButtons.Add(moddedRebindKey); } } public void InitButtonBindingVisuals() { foreach (GameObject modLabel in ModLabels) { modLabel.SetActive(false); } controlsMenuButtons = controlsMenuButtons.OrderBy((ModdedRebindKey x) => ((Object)x.Label).name).ToList(); for (int i = 0; i < controlsMenuButtons.Count; i++) { if (!string.IsNullOrEmpty(search)) { ((Component)controlsMenuButtons[i]).gameObject.SetActive(controlsMenuButtons[i].inputActionName.Contains(search, StringComparison.InvariantCultureIgnoreCase) || ((Object)controlsMenuButtons[i].Label).name.Contains(search, StringComparison.InvariantCultureIgnoreCase)); } else if (!((Component)controlsMenuButtons[i]).gameObject.activeSelf) { ((Component)controlsMenuButtons[i]).gameObject.SetActive(true); } controlsMenuButtons[i].UpdateBindingVisuals(); if (((Component)controlsMenuButtons[i]).gameObject.activeSelf) { controlsMenuButtons[i].Label.SetActive(true); } } DuplicatesCheck(); } public void DuplicatesCheck() { foreach (ModdedRebindKey btn in controlsMenuButtons) { if (((PeakLocalizableElement)btn.value).Text.text.Equals("None", StringComparison.InvariantCultureIgnoreCase)) { btn.SetWarning(active: false); } else if (controlsMenuButtons.Any((ModdedRebindKey x) => ((PeakLocalizableElement)x.value).Text.text.Equals(((PeakLocalizableElement)btn.value).Text.text, StringComparison.InvariantCultureIgnoreCase) && (Object)(object)x != (Object)(object)btn)) { btn.SetWarning(active: true); } else { btn.SetWarning(active: false); } } } public void SetSearch(string search) { this.search = search.ToLower(); ShowControls(); } public void ShowControls() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) SelectedKeyCode = null; SelectedKeyString = null; PeakButton rebindNotif = RebindNotif; if (rebindNotif != null) { ((Component)rebindNotif).gameObject.SetActive(false); } InitButtons(); OnDeviceChange(InputHandler.GetCurrentUsedInputScheme()); } public void RebindOperation() { if (SelectedKeyCode != null || SelectedKeyString != null) { ((Component)((Component)this).transform).gameObject.SetActive(false); RebindInProgress = true; ((Component)RebindNotif).gameObject.SetActive(true); if (SelectedKeyCode != null) { ((TMP_Text)RebindNotif.Text.TextMesh).text = LocalizedText.GetText("PROMPT_REBIND", true).Replace("@", ((ConfigEntryBase)SelectedKeyCode).Definition.Key.ToString()); ((MonoBehaviour)GUIManager.instance).StartCoroutine(AwaitKeyCode()); } if (SelectedKeyString != null) { ((TMP_Text)RebindNotif.Text.TextMesh).text = LocalizedText.GetText("PROMPT_REBIND", true).Replace("@", ((ConfigEntryBase)SelectedKeyString).Definition.Key.ToString()); ((MonoBehaviour)GUIManager.instance).StartCoroutine(AwaitKeyPath()); } } } public IEnumerator AwaitKeyCode() { RebindingOperation rebindOperation = InputActionRebindingExtensions.PerformInteractiveRebinding(Dummy, 0); rebindOperation.Start(); while (RebindInProgress) { if (Input.GetKeyDown((KeyCode)27)) { rebindOperation.Cancel(); rebindOperation.Dispose(); RebindCancel(); break; } if (Input.anyKeyDown) { rebindOperation.Cancel(); rebindOperation.Dispose(); ModConfigPlugin.Log.LogDebug((object)"Setting new bind value!"); KeyCode[] source = (KeyCode[])Enum.GetValues(typeof(KeyCode)); KeyCode value = ((IEnumerable<KeyCode>)source).FirstOrDefault((Func<KeyCode, bool>)((KeyCode x) => Input.GetKeyDown(x))); SelectedKeyCode.Value = value; RebindInProgress = false; ((Component)RebindNotif).gameObject.SetActive(false); ((Component)((Component)this).transform).gameObject.SetActive(true); ShowControls(); break; } yield return null; } } private void RebindCancel() { ModConfigPlugin.Log.LogDebug((object)"Exiting new bind operation!"); ((Component)RebindNotif).gameObject.SetActive(false); RebindInProgress = false; ((Component)((Component)this).transform).gameObject.SetActive(true); ShowControls(); } public IEnumerator AwaitKeyPath() { InputAction action_pause = InputSystem.actions.FindAction("Pause", false); RebindingOperation rebindOperation = InputActionRebindingExtensions.PerformInteractiveRebinding(Dummy, 0).WithoutGeneralizingPathOfSelectedControl().OnComplete((Action<RebindingOperation>)delegate(RebindingOperation operation) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0028: Unknown result type (might be due to invalid IL or missing references) ModConfigPlugin.Log.LogDebug((object)"Setting new bind value!"); ConfigEntry<string> selectedKeyString = SelectedKeyString; InputBinding val = Dummy.bindings[0]; selectedKeyString.Value = ((InputBinding)(ref val)).overridePath; RebindInProgress = false; ((Component)RebindNotif).gameObject.SetActive(false); ((Component)((Component)this).transform).gameObject.SetActive(true); ShowControls(); operation.Dispose(); }) .OnCancel((Action<RebindingOperation>)delegate(RebindingOperation operation) { RebindCancel(); operation.Dispose(); }); rebindOperation.Start(); while (RebindInProgress) { if (action_pause.WasPressedThisFrame() && rebindOperation != null && rebindOperation.started && !rebindOperation.completed) { rebindOperation.Dispose(); RebindCancel(); break; } yield return null; } } } internal class ModdedRebindKey : PeakElement { public string inputActionName = string.Empty; internal GameObject warning; internal GameObject rebind; internal GameObject reset; internal Color defaultTextColor = new Color(0.8745f, 0.8549f, 0.7608f); internal Color overriddenTextColor = new Color(0.8679f, 0.7459f, 0.3316f); private PeakButton button; internal PeakText value; internal GameObject Label; internal ConfigEntry<KeyCode>? ConfigKeyCode { get; set; } internal ConfigEntry<string>? ConfigKeyString { get; set; } internal string ConfigName { get; set; } = string.Empty; internal void Setup(ConfigEntryBase entry, string ModName) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: 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_0322: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Expected O, but got Unknown //IL_0382: 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_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) if (entry is ConfigEntry<KeyCode> configKeyCode) { ConfigKeyCode = configKeyCode; } if (entry is ConfigEntry<string> configKeyString) { ConfigKeyString = configKeyString; } ConfigName = entry.Definition.Key; inputActionName = "(" + ModName + ") " + ConfigName; button = ElementExtensions.SetSize<PeakButton>(ElementExtensions.ParentTo<PeakButton>(MenuAPI.CreateButton(inputActionName), ((Component)this).transform), new Vector2(1025f, 60f)).OnClick(new UnityAction(RebindOperation)); ((Selectable)button.Button).targetGraphic.color = new Color(0.3396f, 0.204f, 0.1362f, 0.7294f); ((TMP_Text)button.Text.TextMesh).alignment = (TextAlignmentOptions)257; ((TMP_Text)button.Text.TextMesh).margin = new Vector4(15f, 5f, 0f, 0f); ((Graphic)button.Text.TextMesh).color = defaultTextColor; ((TMP_Text)button.Text.TextMesh).enableAutoSizing = true; ((TMP_Text)button.Text.TextMesh).fontSizeMin = 18f; ((TMP_Text)button.Text.TextMesh).fontSizeMax = 30f; GameObject val = new GameObject(ModName + " Value"); val.transform.SetParent(((Component)this).transform); val.AddComponent<LayoutElement>(); val.GetComponent<RectTransform>().anchoredPosition = new Vector2(500f, 0f); string initialValue = GetInitialValue(entry); value = ElementExtensions.SetPosition<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText(initialValue), val.transform), new Vector2(0f, -20f)).SetFontSize(34f).SetColor(defaultTextColor); HorizontalLayoutGroup val2 = ((Component)value).gameObject.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)val2).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = true; LayoutElement val3 = ((Component)value).gameObject.AddComponent<LayoutElement>(); val3.preferredWidth = 60f; ContentSizeFitter val4 = ((Component)value).gameObject.AddComponent<ContentSizeFitter>(); val4.horizontalFit = (FitMode)2; ((TMP_Text)value.TextMesh).horizontalAlignment = (HorizontalAlignmentOptions)4; ((TMP_Text)value.TextMesh).textWrappingMode = (TextWrappingModes)0; ((Component)value).gameObject.AddComponent<TMP_SpriteAnimator>(); warning = Object.Instantiate<GameObject>(Templates.BindWarningButton, ((Component)this).transform); warning.transform.localPosition = new Vector3(-535f, 0f, 0f); warning.SetActive(false); reset = Object.Instantiate<GameObject>(Templates.ResetBindButton, val.transform); ((UnityEventBase)reset.GetComponent<Button>().onClick).RemoveAllListeners(); ((UnityEvent)reset.GetComponent<Button>().onClick).AddListener(new UnityAction(ResetThis)); LayoutElement val5 = reset.AddComponent<LayoutElement>(); val5.preferredWidth = 32f; val5.preferredHeight = 32f; val5.flexibleHeight = 0f; val5.flexibleWidth = 0f; RectTransform component = reset.GetComponent<RectTransform>(); component.anchorMin = new Vector2(1f, 0.5f); component.anchorMax = new Vector2(1f, 0.5f); component.pivot = new Vector2(1f, 0.5f); component.anchoredPosition = Vector2.zero; } private static string GetInitialValue(ConfigEntryBase entry) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (entry is ConfigEntry<KeyCode> val) { KeyCode val2 = val.Value; return ((object)(KeyCode)(ref val2)).ToString(); } if (entry is ConfigEntry<string> val3) { return val3.Value; } ModConfigPlugin.Log.LogWarning((object)"Unexpected config entry type being provided to Modded Controls Menu!"); return string.Empty; } private void ResetThis() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (ConfigKeyCode != null) { ConfigKeyCode.Value = SettingsHandlerUtility.GetDefaultValue<KeyCode>(ConfigKeyCode); } if (ConfigKeyString != null) { ConfigKeyString.Value = SettingsHandlerUtility.GetDefaultValue<string>(ConfigKeyString); } ModdedControlsMenu.Instance.InitButtonBindingVisuals(); } internal void SetWarning(bool active) { if (warning.activeSelf != active) { warning.SetActive(active); } } internal bool IsAlreadyDefault() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (ConfigKeyCode != null) { return ConfigKeyCode.Value == SettingsHandlerUtility.GetDefaultValue<KeyCode>(ConfigKeyCode); } if (ConfigKeyString != null) { return ConfigKeyString.Value == SettingsHandlerUtility.GetDefaultValue<string>(ConfigKeyString); } return false; } internal void SetDefault() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (ConfigKeyCode != null) { ConfigKeyCode.Value = SettingsHandlerUtility.GetDefaultValue<KeyCode>(ConfigKeyCode); } if (ConfigKeyString != null) { ConfigKeyString.Value = SettingsHandlerUtility.GetDefaultValue<string>(ConfigKeyString); } } internal void RebindOperation() { if (ConfigKeyCode != null) { ModdedControlsMenu.Instance.SelectedKeyCode = ConfigKeyCode; } else { if (ConfigKeyString == null) { ModConfigPlugin.Log.LogWarning((object)("No associated config item for " + inputActionName + "!!")); return; } ModdedControlsMenu.Instance.SelectedKeyString = ConfigKeyString; } ModdedControlsMenu.Instance.RebindOperation(); } public void UpdateBindingVisuals() { //IL_0044: 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_00ea: 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_00b8: Unknown result type (might be due to invalid IL or missing references) bool flag = !IsAlreadyDefault(); button.Text.SetText(ConfigName); ((TMP_Text)value.TextMesh).spriteAsset = Templates.KeyboardSpriteSheet; if (ConfigKeyCode != null) { string validKeyValue = GetValidKeyValue(ConfigKeyCode.Value); value.SetText(validKeyValue ?? ""); } if (ConfigKeyString != null) { value.SetText(SingletonAsset<InputSpriteData>.Instance.GetSpriteTagFromInputPathKeyboard(ConfigKeyString.Value)); } if (flag) { ((Graphic)value.TextMesh).color = overriddenTextColor; ((Graphic)button.Text.TextMesh).color = overriddenTextColor; } else { ((Graphic)value.TextMesh).color = defaultTextColor; ((Graphic)button.Text.TextMesh).color = defaultTextColor; } } private static string GetValidKeyValue(KeyCode key) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Invalid comparison between Unknown and I4 //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Invalid comparison between Unknown and I4 string text = ((object)(KeyCode)(ref key)).ToString(); List<KeyCode> list = new List<KeyCode>(10) { (KeyCode)48, (KeyCode)49, (KeyCode)50, (KeyCode)51, (KeyCode)52, (KeyCode)53, (KeyCode)54, (KeyCode)55, (KeyCode)56, (KeyCode)57 }; List<KeyCode> list2 = new List<KeyCode>(7) { (KeyCode)323, (KeyCode)324, (KeyCode)325, (KeyCode)326, (KeyCode)327, (KeyCode)328, (KeyCode)329 }; if (list2.Contains(key)) { if ((int)key == 323) { return "<sprite=109 tint=1>"; } if ((int)key == 324) { return "<sprite=110 tint=1>"; } if ((int)key == 325) { return "<sprite=111 tint=1>"; } return ((object)(KeyCode)(ref key)).ToString(); } if (list.Contains(key)) { text = text.ToString().Replace("Alpha", ""); } if (text.ToString().Contains("keypad", StringComparison.InvariantCultureIgnoreCase)) { text = text.ToString().Replace("Keypad", "numpad"); } if (text.ToString().Contains("control", StringComparison.InvariantCultureIgnoreCase)) { text = text.ToString().Replace("Control", "Ctrl"); } if (text.ToString().Contains("return", StringComparison.InvariantCultureIgnoreCase)) { text = text.ToString().Replace("Return", "Enter"); } if (text.ToString().Contains("backquote", StringComparison.InvariantCultureIgnoreCase)) { text = text.ToLowerInvariant(); } string text2 = char.ToLower(text.ToString()[0]).ToString(); string text3 = text.ToString(); text = text2 + text3.Substring(1, text3.Length - 1); if (SingletonAsset<InputSpriteData>.Instance.inputPathToSpriteTagKeyboard.TryGetValue(text, out var result)) { return result; } return ((object)(KeyCode)(ref key)).ToString(); } } internal class ModdedSettingsSectionTABS : TABS<ModdedTABSButton> { public ModdedSettingsMenu? SettingsMenu; public override void OnSelected(ModdedTABSButton button) { ThrowHelper.ThrowIfFieldNull<ModdedSettingsMenu>(SettingsMenu, "SettingsMenu"); SettingsMenu.SetSection(button.category); } } internal class ModdedSettingsTABS : TABS<ModdedTABSButton> { public ModdedSettingsMenu? SettingsMenu; public override void OnSelected(ModdedTABSButton button) { ThrowHelper.ThrowIfFieldNull<ModdedSettingsMenu>(SettingsMenu, "SettingsMenu"); SettingsMenu.UpdateSectionTabs(button.category); } } internal class ModdedTABSButton : TAB_Button { public string category = ""; public GameObject? SelectedGraphic; private void Update() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) ((Graphic)base.text).color = Color.Lerp(((Graphic)base.text).color, ((TAB_Button)this).Selected ? Color.black : Color.white, Time.unscaledDeltaTime * 7f); if ((Object)(object)SelectedGraphic != (Object)null) { SelectedGraphic.gameObject.SetActive(((TAB_Button)this).Selected); } } } internal class ModKeyToName { internal ConfigEntryBase KeyBind; internal string ModName; public ModKeyToName(ConfigEntryBase key, string name) { KeyBind = key; ModName = name; base..ctor(); } internal static List<ModKeyToName> RemoveKey(List<ModKeyToName> keys, ConfigEntryBase key) { ConfigEntryBase key2 = key; ModKeyToName modKeyToName = keys.FirstOrDefault((ModKeyToName i) => i.KeyBind == key2); if (modKeyToName != null) { keys.Remove(modKeyToName); } return keys; } } internal class ModSectionNames { internal static List<ModSectionNames> SectionNames { get; set; } = new List<ModSectionNames>(); internal string ModName { get; set; } internal List<string> Sections { get; set; } = new List<string>(); internal ModSectionNames(string modName) { ModName = modName; SectionNames.Add(this); } internal static ModSectionNames SetMod(string modName) { string modName2 = modName; ModSectionNames modSectionNames = SectionNames.FirstOrDefault((ModSectionNames x) => x.ModName == modName2); if (modSectionNames == null) { modSectionNames = new ModSectionNames(modName2); } return modSectionNames; } internal static bool TryGetModSections(string modName, out List<string> sections) { string modName2 = modName; sections = new List<string>(); ModSectionNames modSectionNames = SectionNames.FirstOrDefault((ModSectionNames x) => x.ModName == modName2); if (modSectionNames == null) { return false; } sections = modSectionNames.Sections; return sections.Count > 0; } internal static bool TryGetFirstSection(string modName, out string section) { string modName2 = modName; section = string.Empty; ModSectionNames modSectionNames = SectionNames.FirstOrDefault((ModSectionNames x) => x.ModName == modName2); if (modSectionNames == null) { return false; } section = modSectionNames.Sections[0]; return true; } internal void CheckSectionName(string sectionName) { if (!Sections.Contains(sectionName)) { Sections.Add(sectionName); } } } internal class ModdedSettingsMenu : MonoBehaviour { private List<IExposedSetting>? settings; private readonly List<SettingsUICell> m_spawnedCells = new List<SettingsUICell>(); private Coroutine? m_fadeInCoroutine; private string search = ""; private string selectedSection = ""; public PeakHorizontalTabs SectionTabController; internal PeakChildPage MainPage; internal static ModdedSettingsMenu Instance { get; private set; } public ModdedSettingsTABS Tabs { get; set; } public Transform Content { get; set; } private void OnEnable() { RefreshSettings(); if ((Object)(object)Tabs != (Object)null && (Object)(object)((TABS<ModdedTABSButton>)(object)Tabs).selectedButton != (Object)null) { ((TABS<ModdedTABSButton>)(object)Tabs).Select(((TABS<ModdedTABSButton>)(object)Tabs).selectedButton); } } private void Awake() { ModConfigPlugin.Log.LogDebug((object)"ModdedSettingsMenu Awake"); Instance = this; } public void SetSearch(string query) { search = query.ToLower(); ShowSettings(((TABS<ModdedTABSButton>)(object)Tabs).selectedButton.category); } public void SetSection(string section) { selectedSection = section; ShowSettings(((TABS<ModdedTABSButton>)(object)Tabs).selectedButton.category); } public void ShowSettings(string category) { string category2 = category; if (m_fadeInCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(m_fadeInCoroutine); m_fadeInCoroutine = null; } foreach (SettingsUICell spawnedCell in m_spawnedCells) { Object.Destroy((Object)(object)((Component)spawnedCell).gameObject); } m_spawnedCells.Clear(); RefreshSettings(); if (settings == null) { return; } bool isSearching = !string.IsNullOrEmpty(search); foreach (IExposedSetting item in from <>h__TransparentIdentifier1 in (from <>h__TransparentIdentifier0 in settings.Where((IExposedSetting setting) => setting != null && setting is IBepInExProperty).Select(delegate(IExposedSetting setting) { int searchCheck; if (isSearching) { string displayName = setting.GetDisplayName(); searchCheck = ((displayName != null && (displayName.ToLower()?.Contains(search)).GetValueOrDefault()) ? 1 : 0); } else { searchCheck = 0; } return new { setting = setting, searchCheck = ((byte)searchCheck != 0) }; }) let notSearching = !isSearching && setting.GetCategory() == category2.ToString() where searchCheck || notSearching select <>h__TransparentIdentifier1).Where(<>h__TransparentIdentifier1 => { IExposedSetting setting2 = <>h__TransparentIdentifier1.<>h__TransparentIdentifier0.setting; IConditionalSetting val2 = (IConditionalSetting)(object)((setting2 is IConditionalSetting) ? setting2 : null); return val2 == null || val2.ShouldShow(); }) select <>h__TransparentIdentifier1.<>h__TransparentIdentifier0.setting) { if ((Object)(object)Templates.SettingsCellPrefab == (Object)null) { ModConfigPlugin.Log.LogError((object)"SettingsCellPrefab has not been loaded."); return; } Setting val = (Setting)(object)((item is Setting) ? item : null); if (val == null) { ModConfigPlugin.Log.LogError((object)"Invalid IExposedSetting"); return; } if (!string.IsNullOrEmpty(selectedSection)) { if (!(item is IBepInExProperty bepInExProperty)) { continue; } bepInExProperty.RefreshValueFromConfig(); if (!bepInExProperty.ConfigBase.Definition.Section.Equals(selectedSection, StringComparison.InvariantCultureIgnoreCase)) { continue; } } SettingsUICell component = Object.Instantiate<GameObject>(Templates.SettingsCellPrefab, Content).GetComponent<SettingsUICell>(); m_spawnedCells.Add(component); ((TMP_Text)component.m_text).text = item.GetDisplayName(); component.m_canvasGroup = ((Component)component).GetComponent<CanvasGroup>(); component.m_canvasGroup.alpha = 0f; Object.Instantiate<GameObject>(val.GetSettingUICell(), component.m_settingsContentParent).GetComponent<SettingInputUICell>().Setup(val, (ISettingHandler)(object)GameHandler.Instance.SettingsHandler); } m_fadeInCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeInCells()); } public void RefreshSettings() { if ((Object)(object)GameHandler.Instance != (Object)null) { settings = ISettingsHandlerExtensions.GetSettingsThatImplements<IExposedSetting>((ISettingHandler)(object)GameHandler.Instance.SettingsHandler); } } public void UpdateSectionTabs(string modName) { if (!ModSectionNames.TryGetModSections(modName, out List<string> sections)) { return; } if (SectionTabController.Tabs.Count > 0) { for (int num = SectionTabController.Tabs.Count - 1; num >= 0; num--) { SectionTabController.DeleteTab(((Object)SectionTabController.Tabs[num]).name); } } List<ModdedTABSButton> list = new List<ModdedTABSButton>(); foreach (string item in sections) { GameObject val = SectionTabController.AddTab(item); ModdedTABSButton moddedTABSButton = val.AddComponent<ModdedTABSButton>(); moddedTABSButton.category = item; ((TAB_Button)moddedTABSButton).text = val.GetComponentInChildren<TextMeshProUGUI>(); moddedTABSButton.SelectedGraphic = ((Component)val.transform.Find("Selected")).gameObject; list.Add(moddedTABSButton); } ((TAB_Button)list[0]).ButtonClicked(); } private IEnumerator FadeInCells() { int i = 0; foreach (SettingsUICell spawnedCell in m_spawnedCells) { spawnedCell.FadeIn(); yield return (object)new WaitForSecondsRealtime(0.05f); i++; } m_fadeInCoroutine = null; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ConstantExpectedAttribute : Attribute { public object? Min { get; set; } public object? Max { get; set; } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [Exclud