using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Logging; using Eflatun.SceneReference; using FMOD; using FMODUnity; using HarmonyLib; using JBooth.MicroSplat; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using TMPro; using UnityEngine; using UnityEngine.Localization; using UnityEngine.Localization.Tables; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.MasterBuilderMAC.SBGMaps")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("com.github.MasterBuilderMAC.SBGMaps")] [assembly: AssemblyTitle("CustomMaps")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Microsoft.CodeAnalysis.Embedded] 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")] [Microsoft.CodeAnalysis.Embedded] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Microsoft.CodeAnalysis { [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace CustomMaps { internal class AssetImports { public static Sprite LoadSprite(string imagePath) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0031: 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) byte[] array = File.ReadAllBytes(imagePath); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } public static void LoadBundles() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string[] array = new string[1] { Path.Combine(directoryName, "Maps") }; string[] array2 = array; foreach (string text in array2) { if (!Directory.Exists(text)) { Plugin.Log.LogWarning((object)("Folder not found, skipping: " + text)); continue; } IEnumerable enumerable = from f in Directory.GetFiles(text).Concat(Directory.GetDirectories(text).SelectMany((string subDir) => Directory.GetFiles(subDir))) where !f.EndsWith(".json", StringComparison.OrdinalIgnoreCase) select f; foreach (string item in enumerable) { AssetBundle val = AssetBundle.LoadFromFile(item); if ((Object)(object)val == (Object)null) { Plugin.Log.LogError((object)("Bundle failed to load: " + item)); continue; } string[] allScenePaths = val.GetAllScenePaths(); if (allScenePaths.Length != 0) { string[] array3 = allScenePaths; foreach (string text2 in array3) { string text3 = Guid.NewGuid().ToString("N"); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text2); Plugin.LoadedBundles.Add(new Plugin.LoadedBundle { Bundle = val, ScenePath = text2, SceneGuid = text3 }); Plugin.SceneNameToGuid[fileNameWithoutExtension] = text3; Plugin.Log.LogDebug((object)("Scene registered: " + text2 + " guid: " + text3)); } } else { Plugin.LoadedBundles.Add(new Plugin.LoadedBundle { Bundle = val, ScenePath = null, SceneGuid = null }); Plugin.Log.LogDebug((object)("Asset bundle loaded: " + item)); } } } } } public static class ConfigLoader { public static List<(string bundleFileName, BundleConfig config)> LoadAllConfigs() { string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Maps"); List<(string, BundleConfig)> list = new List<(string, BundleConfig)>(); IEnumerable enumerable = from f in Directory.GetFiles(path).Concat(Directory.GetDirectories(path).SelectMany((string subDir) => Directory.GetFiles(subDir))) where !f.EndsWith(".json", StringComparison.OrdinalIgnoreCase) select f; foreach (string item in enumerable) { string fileName = Path.GetFileName(item); string path2 = item + ".json"; if (!File.Exists(path2)) { Plugin.Log.LogWarning((object)("No config found for bundle: " + fileName + ", using placeholder")); list.Add((fileName, MakePlaceholderConfig(fileName))); continue; } string text = File.ReadAllText(path2, Encoding.UTF8).TrimStart('\ufeff'); BundleConfig bundleConfig; try { bundleConfig = JsonConvert.DeserializeObject(text); } catch (Exception ex) { Plugin.Log.LogError((object)("Failed to parse config for " + fileName + ": " + ex.Message + ", using placeholder")); list.Add((fileName, MakePlaceholderConfig(fileName))); continue; } if (bundleConfig?.holes == null || bundleConfig.holes.Length == 0) { Plugin.Log.LogWarning((object)("No holes defined in config for " + fileName + ", using placeholder")); list.Add((fileName, MakePlaceholderConfig(fileName))); } else { Plugin.Log.LogDebug((object)$"Loaded config for {fileName}: {bundleConfig.holes.Length} hole(s)"); list.Add((fileName, bundleConfig)); } } return list; } private static BundleConfig MakePlaceholderConfig(string bundleFileName) { BundleConfig bundleConfig = new BundleConfig(); bundleConfig.holes = new HoleConfig[1] { new HoleConfig { sceneName = bundleFileName, holeName = "[" + bundleFileName + "]", par = 4, difficulty = "Medium" } }; return bundleConfig; } } [Serializable] public class HoleConfig { public string sceneName; public string holeName; public int par; public string difficulty; } [Serializable] public class BundleConfig { public HoleConfig[] holes; } public static class GetCoursesInfo { public static CourseData getCourse() { //IL_0035: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) string text = ""; string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); CourseData val = ScriptableObject.CreateInstance(); ((Object)val).name = "Custom Courses"; Traverse val2 = Traverse.Create((object)val); LocalizedString value = new LocalizedString(TableReference.op_Implicit("UI"), TableEntryReference.op_Implicit("Mac.CustomMaps")); Plugin.CustomLocalizedStrings["Mac.CustomMaps"] = "Custom Holes"; val2.Property("LocalizedName", (object[])null).SetValue((object)value); text = Path.Combine(directoryName, "Assets\\courseIcon.png"); Sprite val3 = AssetImports.LoadSprite(text); val2.Property("CategoryIcon", (object[])null).SetValue((object)val3); text = Path.Combine(directoryName, "Assets\\menuBackground.png"); Sprite value2 = AssetImports.LoadSprite(text); val2.Property("MenuBackground", (object[])null).SetValue((object)value2); Color green = Color.green; val2.Property("HoleLabelColor", (object[])null).SetValue((object)green); Color red = Color.red; val2.Property("WindBackroundColor", (object[])null).SetValue((object)red); val2.Property("WindAmbienceType", (object[])null).SetValue((object)(WindAudioAmbienceType)1); val2.Field("includeAllHoles").SetValue((object)false); val2.Field("difficultyCourse").SetValue((object)false); HoleData[] value3 = CreateHolesFromConfig(val3); val2.Property("Holes", (object[])null).SetValue((object)value3); Plugin.CustomCourse = val; return val; } private static HoleData[] CreateHolesFromConfig(Sprite courseIcon) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) List list = new List(); List<(string, BundleConfig)> list2 = ConfigLoader.LoadAllConfigs(); foreach (var item3 in list2) { string item = item3.Item1; BundleConfig item2 = item3.Item2; HoleConfig[] holes = item2.holes; foreach (HoleConfig holeConfig in holes) { if (!Plugin.SceneNameToGuid.TryGetValue(holeConfig.sceneName, out string value)) { Plugin.Log.LogError((object)("No scene guid found for scene '" + holeConfig.sceneName + "' in " + item)); continue; } HoleData val = ScriptableObject.CreateInstance(); Traverse val2 = Traverse.Create((object)val); string text = "Mac." + holeConfig.sceneName; Plugin.CustomLocalizedStrings[text] = holeConfig.holeName; val2.Property("LocalizedName", (object[])null).SetValue((object)new LocalizedString(TableReference.op_Implicit("UI"), TableEntryReference.op_Implicit(text))); ((Object)val).name = holeConfig.holeName; val2.Property("Scene", (object[])null).SetValue((object)new SceneReference(value)); val2.Property("Par", (object[])null).SetValue((object)holeConfig.par); val2.Property("Difficulty", (object[])null).SetValue(Enum.Parse(typeof(DifficultyLevel), holeConfig.difficulty)); val2.Property("ScreenshotsThumbnail", (object[])null).SetValue((object)new List { courseIcon }); GUID val3 = default(GUID); val3.Data1 = -55891042; val3.Data2 = 1301584857; val3.Data3 = 1030450600; val3.Data4 = 1380137089; GUID guid = val3; val2.Property("MusicEvent", (object[])null).SetValue((object)new EventReference { Guid = guid }); list.Add(val); Plugin.Log.LogInfo((object)$"Loaded hole: {holeConfig.holeName} (scene: {holeConfig.sceneName}, par: {holeConfig.par})"); } } return list.ToArray(); } } internal class Patches { } [HarmonyPatch(typeof(CourseCollection), "RuntimeInitialize")] public static class CourseCollection_RuntimeInitialize { private static void Prefix(CourseCollection __instance) { StringTable[] array = Resources.FindObjectsOfTypeAll(); CourseData course = GetCoursesInfo.getCourse(); Plugin.Log.LogDebug((object)"SBGMaps - course created, injecting..."); CourseData[] array2 = (CourseData[])(object)new CourseData[__instance.Courses.Length + 1]; __instance.Courses.CopyTo(array2, 0); array2[^1] = course; Traverse.Create((object)__instance).Property("Courses", (object[])null).SetValue((object)array2); } } [HarmonyPatch(typeof(SceneGuidToPathMapProvider), "GetSceneGuidToPathMap")] public static class SceneGuidToPathMapProvider_Patch { private static void Postfix(ref IReadOnlyDictionary __result) { Dictionary dictionary = new Dictionary(__result); foreach (Plugin.LoadedBundle item in Plugin.LoadedBundles.Where((Plugin.LoadedBundle b) => b.IsSceneBundle)) { dictionary[item.SceneGuid] = item.ScenePath; } __result = dictionary; } } public static class LocalizationFixes { [HarmonyPatch] private static class StringTable_Inject_Patch { private static bool _injected; private static MethodBase TargetMethod() { return typeof(StringTable).BaseType.GetMethod("OnAfterDeserialize", BindingFlags.Instance | BindingFlags.Public); } private static void Postfix(object __instance) { if (_injected) { return; } StringTable val = (StringTable)((__instance is StringTable) ? __instance : null); if ((Object)(object)val == (Object)null || ((LocalizationTable)val).TableCollectionName != "UI") { return; } _injected = true; foreach (KeyValuePair customLocalizedString in Plugin.CustomLocalizedStrings) { if (((DetailedLocalizationTable)(object)val).GetEntry(customLocalizedString.Key) == null) { ((DetailedLocalizationTable)(object)val).AddEntry(customLocalizedString.Key, customLocalizedString.Value); } } } } } public static class IngamePatches { public static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) bool flag = Plugin.LoadedBundles.Any((Plugin.LoadedBundle b) => b.IsSceneBundle && b.ScenePath.Contains(((Scene)(ref scene)).name)); bool flag2 = ((Scene)(ref scene)).name.Equals("Driving range"); Plugin.Log.LogDebug((object)("Scene Loaded: " + ((Scene)(ref scene)).name)); if (!flag) { if (flag2) { CachePostProcessing(); CacheMicroSplat(); } CacheText(); CacheMaterials(); CacheShaders(); } else { SetPostProcessing(); SetText(); SetShaders(); SetSkybox(); } } public static void CachePostProcessing() { PostProcessLayer val = Object.FindFirstObjectByType(); if ((Object)(object)val != (Object)null) { Plugin.CachedPostProcessResources = Traverse.Create((object)val).Field("m_Resources").GetValue(); Plugin.Log.LogDebug((object)"Cached PostProcessResources"); } } public static void CacheText() { Object[] array = Resources.FindObjectsOfTypeAll(typeof(TMP_Text)); Object[] array2 = array; foreach (Object val in array2) { TMP_Text val2 = (TMP_Text)(object)((val is TMP_Text) ? val : null); if (!((Object)(object)val2 == (Object)null) && (Object)(object)val2.font != (Object)null && !Plugin.CachedFonts.ContainsKey(((Object)val2.font).name)) { Plugin.CachedFonts[((Object)val2.font).name] = val2.font; Plugin.Log.LogDebug((object)("Cached font: " + ((Object)val2.font).name)); } } } public static void CacheMicroSplat() { MicroSplatTerrain val = Object.FindFirstObjectByType(); if ((Object)(object)val != (Object)null) { Traverse val2 = Traverse.Create((object)val); Plugin.CachedPropData = val2.Field("propData").GetValue(); Plugin.CachedKeywordSO = val2.Field("keywordSO").GetValue(); Plugin.CachedTemplateMaterial = val2.Field("templateMaterial").GetValue(); Plugin.Log.LogDebug((object)"Cached MicroSplat assets"); } } public static void CacheMaterials() { Material[] array = Resources.FindObjectsOfTypeAll(); Material[] array2 = array; foreach (Material val in array2) { if (!((Object)(object)val == (Object)null) && !Plugin.CachedMaterials.ContainsKey(((Object)val).name)) { Plugin.CachedMaterials[((Object)val).name] = val; } } } public static void CacheShaders() { Shader[] array = Resources.FindObjectsOfTypeAll(); Shader[] array2 = array; foreach (Shader val in array2) { if (!((Object)(object)val == (Object)null) && !Plugin.CachedShaders.ContainsKey(((Object)val).name)) { Plugin.CachedShaders[((Object)val).name] = val; } } } public static void SetPostProcessing() { PostProcessLayer val = Object.FindFirstObjectByType(); if ((Object)(object)val == (Object)null) { Plugin.Log.LogError((object)"No PostProcessLayer found in custom scene"); } else if ((Object)(object)Plugin.CachedPostProcessResources != (Object)null) { Traverse.Create((object)val).Field("m_Resources").SetValue((object)Plugin.CachedPostProcessResources); Plugin.Log.LogDebug((object)"Replaced PostProcessResources with cached version"); } else { Plugin.Log.LogError((object)"No cached PostProcessResources available"); } } public static void SetText() { TMP_Text[] array = Resources.FindObjectsOfTypeAll(); TMP_Text[] array2 = array; foreach (TMP_Text val in array2) { if ((Object)(object)val.font != (Object)null && Plugin.CachedFonts.ContainsKey(((Object)val.font).name)) { val.font = Plugin.CachedFonts[((Object)val.font).name]; } } } public static void SetShaders() { Renderer[] array = Object.FindObjectsByType((FindObjectsSortMode)0); Renderer[] array2 = array; foreach (Renderer val in array2) { Material[] sharedMaterials = val.sharedMaterials; foreach (Material val2 in sharedMaterials) { if (!((Object)(object)val2 == (Object)null)) { Shader value2; if (Plugin.CachedMaterials.TryGetValue(((Object)val2).name, out Material value)) { val2.shader = value.shader; } else if ((Object)(object)val2.shader != (Object)null && Plugin.CachedShaders.TryGetValue(((Object)val2.shader).name, out value2)) { val2.shader = value2; } } } } } public static void SetSkybox() { Material skybox = RenderSettings.skybox; Plugin.Log.LogDebug((object)("Skybox material: " + (((Object)(object)RenderSettings.skybox == (Object)null) ? "NULL" : ((Object)RenderSettings.skybox).name))); ManualLogSource log = Plugin.Log; Material skybox2 = RenderSettings.skybox; log.LogDebug((object)("Skybox shader: " + (((Object)(object)((skybox2 != null) ? skybox2.shader : null) == (Object)null) ? "NULL" : ((Object)RenderSettings.skybox.shader).name))); if (Plugin.CachedMaterials.TryGetValue("Unlit_Skybox", out Material value)) { RenderSettings.skybox = value; DynamicGI.UpdateEnvironment(); Plugin.Log.LogDebug((object)("Injected skybox: " + ((Object)value).name)); } else { Plugin.Log.LogWarning((object)"Unlit_Skybox not in cache"); } } } [HarmonyPatch(typeof(MicroSplatTerrain), "Sync")] public static class MicroSplatTerrain_Sync_Patch { private static void Prefix(MicroSplatTerrain __instance) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) Scene activeScene2 = SceneManager.GetActiveScene(); string activeScene = ((Scene)(ref activeScene2)).name; if (Plugin.LoadedBundles.Any((Plugin.LoadedBundle b) => b.IsSceneBundle && b.ScenePath.Contains(activeScene)) && Plugin.CachedPropData != null) { Traverse val = Traverse.Create((object)__instance); val.Field("propData").SetValue(Plugin.CachedPropData); val.Field("keywordSO").SetValue(Plugin.CachedKeywordSO); val.Field("templateMaterial").SetValue(Plugin.CachedTemplateMaterial); Plugin.Log.LogDebug((object)"MicroSplat assets injected"); } } } [BepInPlugin("com.github.MasterBuilderMAC.SBGMaps", "CustomMaps", "0.1.0")] public class Plugin : BaseUnityPlugin { public struct LoadedBundle { public AssetBundle Bundle; public string ScenePath; public string SceneGuid; public bool IsSceneBundle => ScenePath != null; } public static Dictionary CustomLocalizedStrings = new Dictionary(); public static PostProcessResources? CachedPostProcessResources; public static Dictionary CachedFonts = new Dictionary(); public static object? CachedPropData = null; public static object? CachedKeywordSO = null; public static object? CachedTemplateMaterial = null; public static Dictionary CachedMaterials = new Dictionary(); public static Dictionary CachedShaders = new Dictionary(); public static Dictionary SceneNameToGuid = new Dictionary(); public static List LoadedBundles = new List(); public const string Id = "com.github.MasterBuilderMAC.SBGMaps"; internal static ManualLogSource Log { get; private set; } = null; public static Plugin? Instance { get; private set; } public static CourseData CustomCourse { get; set; } = null; public static string Name => "CustomMaps"; public static string Version => "0.1.0"; private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; AssetImports.LoadBundles(); Harmony val = new Harmony("com.github.MasterBuilderMAC.SBGMaps"); SceneManager.sceneLoaded += IngamePatches.OnSceneLoaded; val.PatchAll(); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } } } 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)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class OverloadResolutionPriorityAttribute : Attribute { public int Priority { get; } public OverloadResolutionPriorityAttribute(int priority) { Priority = priority; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] [ExcludeFromCodeCoverage] internal sealed class ParamCollectionAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } }