Decompiled source of FineWoodBuildPieces v1.1.6
FineWoodBuildPieces.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.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using FineWoodBuildPieces.Functions; using HarmonyLib; using JetBrains.Annotations; using LocalizationManager; using Microsoft.CodeAnalysis; using PieceManager; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.UI; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyProduct("FineWoodBuildPieces")] [assembly: AssemblyCompany("blacks7ar")] [assembly: AssemblyConfiguration("")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: Guid("E90048BD-E43D-480E-9618-E7818DDF9B14")] [assembly: AssemblyFileVersion("1.1.6")] [assembly: AssemblyTitle("FineWoodBuildPieces")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyDescription("https://valheim.thunderstore.io/package/blacks7ar/FineWoodBuildPieces/")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.6.0")] [module: UnverifiableCode] [module: <7790b4d6-9112-4851-800b-8ba59ffde41e>RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<ebbdb270-7e4e-4842-a2cb-8d4c3278257a>Embedded] internal sealed class <ebbdb270-7e4e-4842-a2cb-8d4c3278257a>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] [<ebbdb270-7e4e-4842-a2cb-8d4c3278257a>Embedded] [CompilerGenerated] internal sealed class <7790b4d6-9112-4851-800b-8ba59ffde41e>RefSafetyRulesAttribute : Attribute { public readonly int Version; public <7790b4d6-9112-4851-800b-8ba59ffde41e>RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FineWoodBuildPieces { [BepInIncompatibility("blacks7ar.FineWoodPieces")] [BepInPlugin("blacks7ar.FineWoodBuildPieces", "FineWoodBuildPieces", "1.1.6")] public class Plugin : BaseUnityPlugin { private const string modGUID = "blacks7ar.FineWoodBuildPieces"; public const string modName = "FineWoodBuildPieces"; public const string modAuthor = "blacks7ar"; public const string modVersion = "1.1.6"; public const string modLink = "https://valheim.thunderstore.io/package/blacks7ar/FineWoodBuildPieces/"; private static readonly Harmony _harmony = new Harmony("blacks7ar.FineWoodBuildPieces"); private static readonly ConfigSync _configSync = new ConfigSync("blacks7ar.FineWoodBuildPieces") { DisplayName = "FineWoodBuildPieces", CurrentVersion = "1.1.6", MinimumRequiredVersion = "1.1.6" }; private static ConfigEntry<Toggle> _serverConfigLocked; public static ConfigEntry<Toggle> _enableReed; public static ConfigEntry<float> _reedGroupRadius; public static ConfigEntry<int> _reedGroupSizeMin; public static ConfigEntry<int> _reedGroupSizeMax; public static ConfigEntry<float> _reedMax; public static ConfigEntry<Toggle> _hideTrapDoorHoverText; private ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description, bool synchronizedConfig = true) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown ConfigDescription val = new ConfigDescription(description.Description + (synchronizedConfig ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags); ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val); _configSync.AddConfigEntry<T>(val2).SynchronizedConfig = synchronizedConfig; return val2; } public void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown Localizer.Load(); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; _serverConfigLocked = config("1- ServerSync", "Lock Configuration", Toggle.On, new ConfigDescription("If On, the configuration is locked and can be changed by server admins only.", (AcceptableValueBase)null, Array.Empty<object>())); _configSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked); _hideTrapDoorHoverText = config("3- TrapDoor", "Hide HoverText", Toggle.On, new ConfigDescription("If On, trap doors hover text and interact prompt will be hidden.", (AcceptableValueBase)null, Array.Empty<object>())); _enableReed = config("2- Reed", "Enable", Toggle.On, new ConfigDescription("If On, harvestable reeds will spawn across meadows and black forest biomes.", (AcceptableValueBase)null, Array.Empty<object>())); _reedGroupRadius = config("2- Reed", "Group Radius", 4f, new ConfigDescription("Group radius.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f), Array.Empty<object>())); _reedGroupSizeMin = config("2- Reed", "Group Size Min", 4, new ConfigDescription("Minimum group size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); _reedGroupSizeMax = config("2- Reed", "Group Size Max", 8, new ConfigDescription("Maximum group size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); _reedMax = config("2- Reed", "Max", 10f, new ConfigDescription("Maximum amount per zone.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>())); SetupPrefabs.Init(); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = true; ((BaseUnityPlugin)this).Config.Save(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } } } namespace FineWoodBuildPieces.Patches { [HarmonyPatch] public class ObjectDBPatch { [HarmonyPatch(typeof(ObjectDB), "Awake")] [HarmonyPriority(800)] [HarmonyPostfix] private static void Awake_Postfix(ObjectDB __instance) { __instance.AddGameObject(SetupPrefabs._straw); __instance.UpdateRegisters(); } [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] [HarmonyPostfix] [HarmonyPriority(800)] private static void CopyOtherDB_Postfix(ObjectDB __instance) { __instance.AddGameObject(SetupPrefabs._straw); __instance.UpdateRegisters(); } } [HarmonyPatch(typeof(ZNetScene), "Awake")] public class ZNetScenePatch { private static void Postfix(ZNetScene __instance) { if (!((Object)(object)__instance == (Object)null) && __instance.m_prefabs.Count > 0) { SetupPrefabs.SetupLightPost(__instance); SetupPrefabs.TrapDoor(); } } } [HarmonyPatch(typeof(ZoneSystem), "ValidateVegetation")] public class ZoneSystemPatch { private static void Prefix(ZoneSystem __instance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown ZoneVegetation item = new ZoneVegetation { m_enable = (Plugin._enableReed.Value == Toggle.On), m_groupRadius = Plugin._reedGroupRadius.Value, m_groupSizeMin = Plugin._reedGroupSizeMin.Value, m_groupSizeMax = Plugin._reedGroupSizeMax.Value, m_max = Plugin._reedMax.Value, m_chanceToUseGroundTilt = 1f, m_biome = (Biome)9, m_minAltitude = -0.6f, m_maxAltitude = 1.8f, m_maxTerrainDelta = 2f, m_prefab = SetupPrefabs._pickableReed }; if (!__instance.m_vegetation.Contains(item)) { __instance.m_vegetation.Add(item); } } } } namespace FineWoodBuildPieces.Functions { public static class Helper { public static void AddGameObject(this ObjectDB objectDB, GameObject gameObject, bool overWrite = true) { GameObject itemPrefab; if ((Object)(object)(itemPrefab = objectDB.GetItemPrefab(((Object)gameObject).name)) != (Object)null) { if (!overWrite) { return; } objectDB.m_items.Remove(itemPrefab); objectDB.m_itemByHash.Remove(StringExtensionMethods.GetStableHashCode(((Object)gameObject).name)); } objectDB.m_items.Add(gameObject); objectDB.m_itemByHash.Add(StringExtensionMethods.GetStableHashCode(((Object)gameObject).name), gameObject); } public static bool ZNetSceneAwake() { if ((Object)(object)ZNetScene.instance != (Object)null && ZNetScene.instance.m_prefabs.Count != 0) { return (Object)(object)ZNetScene.instance.GetPrefab("piece_workbench") != (Object)null; } return false; } } public static class SetupPrefabs { private static AssetBundle _finewoodBundle; public static GameObject _pickableReed; public static GameObject _straw; private static GameObject _sfxOpen; private static GameObject _sfxClose; private const string _category = "FineWoodPieces"; private const string _fence = "FineWoodFence"; public static void Init() { _finewoodBundle = PiecePrefabManager.RegisterAssetBundle("finewoodbuildpieces"); Others(); Fence(); FineWoodPieces(); } private static void Fence() { BuildPiece buildPiece = new BuildPiece(_finewoodBundle, "BFP_FenceGate"); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set("FineWoodFence"); buildPiece.RequiredItems.Add("FineWood", 14, recover: true); buildPiece.RequiredItems.Add("BronzeNails", 8, recover: true); buildPiece.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece.Prefab); BuildPiece buildPiece2 = new BuildPiece(_finewoodBundle, "BFP_FencePillar1"); buildPiece2.Crafting.Set(CraftingTable.Workbench); buildPiece2.Category.Set("FineWoodFence"); buildPiece2.RequiredItems.Add("FineWood", 3, recover: true); buildPiece2.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece2.Prefab); BuildPiece buildPiece3 = new BuildPiece(_finewoodBundle, "BFP_FencePillar2"); buildPiece3.Crafting.Set(CraftingTable.Workbench); buildPiece3.Category.Set("FineWoodFence"); buildPiece3.RequiredItems.Add("FineWood", 3, recover: true); buildPiece3.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece3.Prefab); BuildPiece buildPiece4 = new BuildPiece(_finewoodBundle, "BFP_FencePillar3"); buildPiece4.Crafting.Set(CraftingTable.Workbench); buildPiece4.Category.Set("FineWoodFence"); buildPiece4.RequiredItems.Add("FineWood", 3, recover: true); buildPiece4.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece4.Prefab); BuildPiece buildPiece5 = new BuildPiece(_finewoodBundle, "BFP_FencePillar4"); buildPiece5.Crafting.Set(CraftingTable.Workbench); buildPiece5.Category.Set("FineWoodFence"); buildPiece5.RequiredItems.Add("FineWood", 3, recover: true); buildPiece5.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece5.Prefab); BuildPiece buildPiece6 = new BuildPiece(_finewoodBundle, "BFP_FenceTile1"); buildPiece6.Crafting.Set(CraftingTable.Workbench); buildPiece6.Category.Set("FineWoodFence"); buildPiece6.RequiredItems.Add("FineWood", 4, recover: true); buildPiece6.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece6.Prefab); BuildPiece buildPiece7 = new BuildPiece(_finewoodBundle, "BFP_FenceTile2"); buildPiece7.Crafting.Set(CraftingTable.Workbench); buildPiece7.Category.Set("FineWoodFence"); buildPiece7.RequiredItems.Add("FineWood", 4, recover: true); buildPiece7.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece7.Prefab); BuildPiece buildPiece8 = new BuildPiece(_finewoodBundle, "BFP_FenceTile3"); buildPiece8.Crafting.Set(CraftingTable.Workbench); buildPiece8.Category.Set("FineWoodFence"); buildPiece8.RequiredItems.Add("FineWood", 4, recover: true); buildPiece8.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece8.Prefab); BuildPiece buildPiece9 = new BuildPiece(_finewoodBundle, "BFP_FenceTile4"); buildPiece9.Crafting.Set(CraftingTable.Workbench); buildPiece9.Category.Set("FineWoodFence"); buildPiece9.RequiredItems.Add("FineWood", 4, recover: true); buildPiece9.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece9.Prefab); } private static void FineWoodPieces() { BuildPiece buildPiece = new BuildPiece(_finewoodBundle, "BFP_FineWoodArch"); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set("FineWoodPieces"); buildPiece.RequiredItems.Add("FineWood", 4, recover: true); buildPiece.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece.Prefab); BuildPiece buildPiece2 = new BuildPiece(_finewoodBundle, "BFP_FineWoodBeam1x1"); buildPiece2.Crafting.Set(CraftingTable.Workbench); buildPiece2.Category.Set("FineWoodPieces"); buildPiece2.RequiredItems.Add("FineWood", 1, recover: true); buildPiece2.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece2.Prefab); BuildPiece buildPiece3 = new BuildPiece(_finewoodBundle, "BFP_FineWoodBeam2x2"); buildPiece3.Crafting.Set(CraftingTable.Workbench); buildPiece3.Category.Set("FineWoodPieces"); buildPiece3.RequiredItems.Add("FineWood", 2, recover: true); buildPiece3.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece3.Prefab); BuildPiece buildPiece4 = new BuildPiece(_finewoodBundle, "BFP_FineWoodBeam26"); buildPiece4.Crafting.Set(CraftingTable.Workbench); buildPiece4.Category.Set("FineWoodPieces"); buildPiece4.RequiredItems.Add("FineWood", 1, recover: true); buildPiece4.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece4.Prefab); BuildPiece buildPiece5 = new BuildPiece(_finewoodBundle, "BFP_FineWoodBeam45"); buildPiece5.Crafting.Set(CraftingTable.Workbench); buildPiece5.Category.Set("FineWoodPieces"); buildPiece5.RequiredItems.Add("FineWood", 1, recover: true); buildPiece5.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece5.Prefab); BuildPiece buildPiece6 = new BuildPiece(_finewoodBundle, "BFP_FineWoodDecoWall"); buildPiece6.Crafting.Set(CraftingTable.Workbench); buildPiece6.Category.Set("FineWoodPieces"); buildPiece6.RequiredItems.Add("FineWood", 8, recover: true); buildPiece6.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; BuildPiece buildPiece7 = new BuildPiece(_finewoodBundle, "BFP_FineWoodDoor"); buildPiece7.Crafting.Set(CraftingTable.Workbench); buildPiece7.Category.Set("FineWoodPieces"); buildPiece7.RequiredItems.Add("FineWood", 6, recover: true); buildPiece7.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece7.Prefab); BuildPiece buildPiece8 = new BuildPiece(_finewoodBundle, "BFP_FineWoodDragon"); buildPiece8.Crafting.Set(CraftingTable.Workbench); buildPiece8.Category.Set(BuildPieceCategory.Misc); buildPiece8.RequiredItems.Add("FineWood", 6, recover: true); buildPiece8.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece8.Prefab); BuildPiece buildPiece9 = new BuildPiece(_finewoodBundle, "BFP_FineWoodFloor1x1"); buildPiece9.Crafting.Set(CraftingTable.Workbench); buildPiece9.Category.Set("FineWoodPieces"); buildPiece9.RequiredItems.Add("FineWood", 1, recover: true); buildPiece9.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece9.Prefab); BuildPiece buildPiece10 = new BuildPiece(_finewoodBundle, "BFP_FineWoodFloor2x2"); buildPiece10.Crafting.Set(CraftingTable.Workbench); buildPiece10.Category.Set("FineWoodPieces"); buildPiece10.RequiredItems.Add("FineWood", 2, recover: true); buildPiece10.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece10.Prefab); BuildPiece buildPiece11 = new BuildPiece(_finewoodBundle, "BFP_FineWoodGate"); buildPiece11.Crafting.Set(CraftingTable.Workbench); buildPiece11.Category.Set("FineWoodPieces"); buildPiece11.RequiredItems.Add("FineWood", 12, recover: true); buildPiece11.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece11.Prefab); BuildPiece buildPiece12 = new BuildPiece(_finewoodBundle, "BFP_FineWoodHalfWall"); buildPiece12.Crafting.Set(CraftingTable.Workbench); buildPiece12.Category.Set("FineWoodPieces"); buildPiece12.RequiredItems.Add("FineWood", 2, recover: true); buildPiece12.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece12.Prefab); BuildPiece buildPiece13 = new BuildPiece(_finewoodBundle, "BFP_FineWoodLedge"); buildPiece13.Crafting.Set(CraftingTable.Workbench); buildPiece13.Category.Set("FineWoodPieces"); buildPiece13.RequiredItems.Add("FineWood", 2, recover: true); buildPiece13.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece13.Prefab); BuildPiece buildPiece14 = new BuildPiece(_finewoodBundle, "BFP_FineWoodPole1x1"); buildPiece14.Crafting.Set(CraftingTable.Workbench); buildPiece14.Category.Set("FineWoodPieces"); buildPiece14.RequiredItems.Add("FineWood", 1, recover: true); buildPiece14.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece14.Prefab); BuildPiece buildPiece15 = new BuildPiece(_finewoodBundle, "BFP_FineWoodPole2x2"); buildPiece15.Crafting.Set(CraftingTable.Workbench); buildPiece15.Category.Set("FineWoodPieces"); buildPiece15.RequiredItems.Add("FineWood", 2, recover: true); buildPiece15.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece15.Prefab); BuildPiece buildPiece16 = new BuildPiece(_finewoodBundle, "BFP_FineWoodQuarterWall"); buildPiece16.Crafting.Set(CraftingTable.Workbench); buildPiece16.Category.Set("FineWoodPieces"); buildPiece16.RequiredItems.Add("FineWood", 1, recover: true); buildPiece16.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece16.Prefab); BuildPiece buildPiece17 = new BuildPiece(_finewoodBundle, "BFP_FineWoodRaven"); buildPiece17.Crafting.Set(CraftingTable.Workbench); buildPiece17.Category.Set(BuildPieceCategory.Misc); buildPiece17.RequiredItems.Add("FineWood", 6, recover: true); buildPiece17.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece17.Prefab); BuildPiece buildPiece18 = new BuildPiece(_finewoodBundle, "BFP_FineWoodRoof26"); buildPiece18.Crafting.Set(CraftingTable.Workbench); buildPiece18.Category.Set("FineWoodPieces"); buildPiece18.RequiredItems.Add("FineWood", 2, recover: true); buildPiece18.RequiredItems.Add("BFP_Straw", 8, recover: true); buildPiece18.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece18.Prefab); BuildPiece buildPiece19 = new BuildPiece(_finewoodBundle, "BFP_FineWoodRoof45"); buildPiece19.Crafting.Set(CraftingTable.Workbench); buildPiece19.Category.Set("FineWoodPieces"); buildPiece19.RequiredItems.Add("FineWood", 2, recover: true); buildPiece19.RequiredItems.Add("BFP_Straw", 8, recover: true); buildPiece19.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece19.Prefab); BuildPiece buildPiece20 = new BuildPiece(_finewoodBundle, "BFP_FineWoodRoofCross26"); buildPiece20.Crafting.Set(CraftingTable.Workbench); buildPiece20.Category.Set("FineWoodPieces"); buildPiece20.RequiredItems.Add("FineWood", 2, recover: true); buildPiece20.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece20.Prefab); BuildPiece buildPiece21 = new BuildPiece(_finewoodBundle, "BFP_FineWoodRoofCross45"); buildPiece21.Crafting.Set(CraftingTable.Workbench); buildPiece21.Category.Set("FineWoodPieces"); buildPiece21.RequiredItems.Add("FineWood", 2, recover: true); buildPiece21.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece21.Prefab); BuildPiece buildPiece22 = new BuildPiece(_finewoodBundle, "BFP_FineWoodRoofICorner26"); buildPiece22.Crafting.Set(CraftingTable.Workbench); buildPiece22.Category.Set("FineWoodPieces"); buildPiece22.RequiredItems.Add("FineWood", 2, recover: true); buildPiece22.RequiredItems.Add("BFP_Straw", 8, recover: true); buildPiece22.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece22.Prefab); BuildPiece buildPiece23 = new BuildPiece(_finewoodBundle, "BFP_FineWoodRoofICorner45"); buildPiece23.Crafting.Set(CraftingTable.Workbench); buildPiece23.Category.Set("FineWoodPieces"); buildPiece23.RequiredItems.Add("FineWood", 2, recover: true); buildPiece23.RequiredItems.Add("BFP_Straw", 8, recover: true); buildPiece23.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece23.Prefab); BuildPiece buildPiece24 = new BuildPiece(_finewoodBundle, "BFP_FineWoodRoofOCorner26"); buildPiece24.Crafting.Set(CraftingTable.Workbench); buildPiece24.Category.Set("FineWoodPieces"); buildPiece24.RequiredItems.Add("FineWood", 2, recover: true); buildPiece24.RequiredItems.Add("BFP_Straw", 8, recover: true); buildPiece24.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece24.Prefab); BuildPiece buildPiece25 = new BuildPiece(_finewoodBundle, "BFP_FineWoodRoofOCorner45"); buildPiece25.Crafting.Set(CraftingTable.Workbench); buildPiece25.Category.Set("FineWoodPieces"); buildPiece25.RequiredItems.Add("FineWood", 2, recover: true); buildPiece25.RequiredItems.Add("BFP_Straw", 8, recover: true); buildPiece25.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece25.Prefab); BuildPiece buildPiece26 = new BuildPiece(_finewoodBundle, "BFP_FineWoodRoofTop26"); buildPiece26.Crafting.Set(CraftingTable.Workbench); buildPiece26.Category.Set("FineWoodPieces"); buildPiece26.RequiredItems.Add("FineWood", 2, recover: true); buildPiece26.RequiredItems.Add("BFP_Straw", 8, recover: true); buildPiece26.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece26.Prefab); BuildPiece buildPiece27 = new BuildPiece(_finewoodBundle, "BFP_FineWoodRoofTop45"); buildPiece27.Crafting.Set(CraftingTable.Workbench); buildPiece27.Category.Set("FineWoodPieces"); buildPiece27.RequiredItems.Add("FineWood", 2, recover: true); buildPiece27.RequiredItems.Add("BFP_Straw", 8, recover: true); buildPiece27.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece27.Prefab); BuildPiece buildPiece28 = new BuildPiece(_finewoodBundle, "BFP_FineWoodStair"); buildPiece28.Crafting.Set(CraftingTable.Workbench); buildPiece28.Category.Set("FineWoodPieces"); buildPiece28.RequiredItems.Add("FineWood", 3, recover: true); buildPiece28.RequiredItems.Add("BronzeNails", 4, recover: true); buildPiece28.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece28.Prefab); BuildPiece buildPiece29 = new BuildPiece(_finewoodBundle, "BFP_FineWoodStepLadder"); buildPiece29.Crafting.Set(CraftingTable.Workbench); buildPiece29.Category.Set("FineWoodPieces"); buildPiece29.RequiredItems.Add("FineWood", 2, recover: true); buildPiece29.RequiredItems.Add("BronzeNails", 4, recover: true); buildPiece29.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece29.Prefab); BuildPiece buildPiece30 = new BuildPiece(_finewoodBundle, "BFP_FineWoodWall"); buildPiece30.Crafting.Set(CraftingTable.Workbench); buildPiece30.Category.Set("FineWoodPieces"); buildPiece30.RequiredItems.Add("FineWood", 3, recover: true); buildPiece30.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece30.Prefab); BuildPiece buildPiece31 = new BuildPiece(_finewoodBundle, "BFP_FineWoodWallRoof26"); buildPiece31.Crafting.Set(CraftingTable.Workbench); buildPiece31.Category.Set("FineWoodPieces"); buildPiece31.RequiredItems.Add("FineWood", 2, recover: true); buildPiece31.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece31.Prefab); BuildPiece buildPiece32 = new BuildPiece(_finewoodBundle, "BFP_FineWoodWallRoof26_UpsideDown"); buildPiece32.Crafting.Set(CraftingTable.Workbench); buildPiece32.Category.Set("FineWoodPieces"); buildPiece32.RequiredItems.Add("FineWood", 2, recover: true); buildPiece32.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece32.Prefab); BuildPiece buildPiece33 = new BuildPiece(_finewoodBundle, "BFP_FineWoodWallRoof45"); buildPiece33.Crafting.Set(CraftingTable.Workbench); buildPiece33.Category.Set("FineWoodPieces"); buildPiece33.RequiredItems.Add("FineWood", 2, recover: true); buildPiece33.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece33.Prefab); BuildPiece buildPiece34 = new BuildPiece(_finewoodBundle, "BFP_FineWoodWallRoof45_UpsideDown"); buildPiece34.Crafting.Set(CraftingTable.Workbench); buildPiece34.Category.Set("FineWoodPieces"); buildPiece34.RequiredItems.Add("FineWood", 2, recover: true); buildPiece34.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece34.Prefab); BuildPiece buildPiece35 = new BuildPiece(_finewoodBundle, "BFP_FineWoodWindowShutter"); buildPiece35.Crafting.Set(CraftingTable.Workbench); buildPiece35.Category.Set("FineWoodPieces"); buildPiece35.RequiredItems.Add("FineWood", 2, recover: true); buildPiece35.RequiredItems.Add("BronzeNails", 1, recover: true); buildPiece35.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece35.Prefab); BuildPiece buildPiece36 = new BuildPiece(_finewoodBundle, "BFP_FineWoodWolf"); buildPiece36.Crafting.Set(CraftingTable.Workbench); buildPiece36.Category.Set(BuildPieceCategory.Misc); buildPiece36.RequiredItems.Add("FineWood", 6, recover: true); buildPiece36.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece36.Prefab); BuildPiece buildPiece37 = new BuildPiece(_finewoodBundle, "BFP_GlassWindow1"); buildPiece37.Crafting.Set(CraftingTable.Workbench); buildPiece37.Category.Set("FineWoodPieces"); buildPiece37.RequiredItems.Add("FineWood", 4, recover: true); buildPiece37.RequiredItems.Add("Crystal", 4, recover: true); buildPiece37.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; BuildPiece buildPiece38 = new BuildPiece(_finewoodBundle, "BFP_GlassWindow3"); buildPiece38.Crafting.Set(CraftingTable.Workbench); buildPiece38.Category.Set("FineWoodPieces"); buildPiece38.RequiredItems.Add("FineWood", 2, recover: true); buildPiece38.RequiredItems.Add("Crystal", 2, recover: true); buildPiece38.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; BuildPiece buildPiece39 = new BuildPiece(_finewoodBundle, "BFP_HeavyGate"); buildPiece39.Crafting.Set(CraftingTable.Workbench); buildPiece39.Category.Set("FineWoodPieces"); buildPiece39.RequiredItems.Add("FineWood", 12, recover: true); buildPiece39.RequiredItems.Add("RoundLog", 4, recover: true); buildPiece39.RequiredItems.Add("Bronze", 6, recover: true); buildPiece39.RequiredItems.Add("BronzeNails", 10, recover: true); buildPiece39.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece39.Prefab); BuildPiece buildPiece40 = new BuildPiece(_finewoodBundle, "BFP_HorizontalDecoWall"); buildPiece40.Crafting.Set(CraftingTable.Workbench); buildPiece40.Category.Set("FineWoodPieces"); buildPiece40.RequiredItems.Add("FineWood", 8, recover: true); buildPiece40.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; BuildPiece buildPiece41 = new BuildPiece(_finewoodBundle, "BFP_StepLadder1"); buildPiece41.Crafting.Set(CraftingTable.Workbench); buildPiece41.Category.Set("FineWoodPieces"); buildPiece41.RequiredItems.Add("FineWood", 8, recover: true); buildPiece41.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece41.Prefab); BuildPiece buildPiece42 = new BuildPiece(_finewoodBundle, "BFP_StepLadder2"); buildPiece42.Crafting.Set(CraftingTable.Workbench); buildPiece42.Category.Set("FineWoodPieces"); buildPiece42.RequiredItems.Add("FineWood", 18, recover: true); buildPiece42.RequiredItems.Add("BronzeNails", 6, recover: true); buildPiece42.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece42.Prefab); BuildPiece buildPiece43 = new BuildPiece(_finewoodBundle, "BFP_StoneLightPost"); buildPiece43.Crafting.Set(CraftingTable.Workbench); buildPiece43.Category.Set(BuildPieceCategory.Misc); buildPiece43.RequiredItems.Add("Stone", 20, recover: true); buildPiece43.RequiredItems.Add("Coal", 6, recover: true); buildPiece43.RequiredItems.Add("Resin", 10, recover: true); buildPiece43.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece43.Prefab); BuildPiece buildPiece44 = new BuildPiece(_finewoodBundle, "BFP_StoneRoof26"); buildPiece44.Crafting.Set(CraftingTable.Workbench); buildPiece44.Category.Set("FineWoodPieces"); buildPiece44.RequiredItems.Add("FineWood", 4, recover: true); buildPiece44.RequiredItems.Add("Stone", 6, recover: true); buildPiece44.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece44.Prefab); BuildPiece buildPiece45 = new BuildPiece(_finewoodBundle, "BFP_StoneRoof45"); buildPiece45.Crafting.Set(CraftingTable.Workbench); buildPiece45.Category.Set("FineWoodPieces"); buildPiece45.RequiredItems.Add("FineWood", 4, recover: true); buildPiece45.RequiredItems.Add("Stone", 6, recover: true); buildPiece45.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece45.Prefab); BuildPiece buildPiece46 = new BuildPiece(_finewoodBundle, "BFP_StoneRoofICorner26"); buildPiece46.Crafting.Set(CraftingTable.Workbench); buildPiece46.Category.Set("FineWoodPieces"); buildPiece46.RequiredItems.Add("FineWood", 4, recover: true); buildPiece46.RequiredItems.Add("Stone", 6, recover: true); buildPiece46.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece46.Prefab); BuildPiece buildPiece47 = new BuildPiece(_finewoodBundle, "BFP_StoneRoofICorner45"); buildPiece47.Crafting.Set(CraftingTable.Workbench); buildPiece47.Category.Set("FineWoodPieces"); buildPiece47.RequiredItems.Add("FineWood", 4, recover: true); buildPiece47.RequiredItems.Add("Stone", 6, recover: true); buildPiece47.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece47.Prefab); BuildPiece buildPiece48 = new BuildPiece(_finewoodBundle, "BFP_StoneRoofOCorner26"); buildPiece48.Crafting.Set(CraftingTable.Workbench); buildPiece48.Category.Set("FineWoodPieces"); buildPiece48.RequiredItems.Add("FineWood", 4, recover: true); buildPiece48.RequiredItems.Add("Stone", 6, recover: true); buildPiece48.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece48.Prefab); BuildPiece buildPiece49 = new BuildPiece(_finewoodBundle, "BFP_StoneRoofOCorner45"); buildPiece49.Crafting.Set(CraftingTable.Workbench); buildPiece49.Category.Set("FineWoodPieces"); buildPiece49.RequiredItems.Add("FineWood", 4, recover: true); buildPiece49.RequiredItems.Add("Stone", 6, recover: true); buildPiece49.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece49.Prefab); BuildPiece buildPiece50 = new BuildPiece(_finewoodBundle, "BFP_StoneRoofTop26"); buildPiece50.Crafting.Set(CraftingTable.Workbench); buildPiece50.Category.Set("FineWoodPieces"); buildPiece50.RequiredItems.Add("FineWood", 4, recover: true); buildPiece50.RequiredItems.Add("Stone", 6, recover: true); buildPiece50.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece50.Prefab); BuildPiece buildPiece51 = new BuildPiece(_finewoodBundle, "BFP_StoneRoofTop45"); buildPiece51.Crafting.Set(CraftingTable.Workbench); buildPiece51.Category.Set("FineWoodPieces"); buildPiece51.RequiredItems.Add("FineWood", 4, recover: true); buildPiece51.RequiredItems.Add("Stone", 6, recover: true); buildPiece51.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece51.Prefab); BuildPiece buildPiece52 = new BuildPiece(_finewoodBundle, "BFP_ThatchHalfWall"); buildPiece52.Crafting.Set(CraftingTable.Workbench); buildPiece52.Category.Set("FineWoodPieces"); buildPiece52.RequiredItems.Add("Wood", 2, recover: true); buildPiece52.RequiredItems.Add("BFP_Straw", 4, recover: true); buildPiece52.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece52.Prefab); BuildPiece buildPiece53 = new BuildPiece(_finewoodBundle, "BFP_ThatchQuarterWall"); buildPiece53.Crafting.Set(CraftingTable.Workbench); buildPiece53.Category.Set("FineWoodPieces"); buildPiece53.RequiredItems.Add("Wood", 1, recover: true); buildPiece53.RequiredItems.Add("BFP_Straw", 2, recover: true); buildPiece53.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece53.Prefab); BuildPiece buildPiece54 = new BuildPiece(_finewoodBundle, "BFP_ThatchWall"); buildPiece54.Crafting.Set(CraftingTable.Workbench); buildPiece54.Category.Set("FineWoodPieces"); buildPiece54.RequiredItems.Add("Wood", 4, recover: true); buildPiece54.RequiredItems.Add("BFP_Straw", 8, recover: true); buildPiece54.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece54.Prefab); BuildPiece buildPiece55 = new BuildPiece(_finewoodBundle, "BFP_ThatchWindow"); buildPiece55.Crafting.Set(CraftingTable.Workbench); buildPiece55.Category.Set("FineWoodPieces"); buildPiece55.RequiredItems.Add("Wood", 5, recover: true); buildPiece55.RequiredItems.Add("BFP_Straw", 6, recover: true); buildPiece55.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece55.Prefab); BuildPiece buildPiece56 = new BuildPiece(_finewoodBundle, "BFP_ThatchWindow_Half"); buildPiece56.Crafting.Set(CraftingTable.Workbench); buildPiece56.Category.Set("FineWoodPieces"); buildPiece56.RequiredItems.Add("Wood", 3, recover: true); buildPiece56.RequiredItems.Add("BFP_Straw", 4, recover: true); buildPiece56.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece56.Prefab); BuildPiece buildPiece57 = new BuildPiece(_finewoodBundle, "BFP_ThatchWindow_Quarter"); buildPiece57.Crafting.Set(CraftingTable.Workbench); buildPiece57.Category.Set("FineWoodPieces"); buildPiece57.RequiredItems.Add("Wood", 2, recover: true); buildPiece57.RequiredItems.Add("BFP_Straw", 2, recover: true); buildPiece57.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece57.Prefab); BuildPiece buildPiece58 = new BuildPiece(_finewoodBundle, "BFP_TrapDoor"); buildPiece58.Crafting.Set(CraftingTable.Workbench); buildPiece58.Category.Set("FineWoodPieces"); buildPiece58.RequiredItems.Add("FineWood", 5, recover: true); buildPiece58.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece58.Prefab); if (!Object.op_Implicit((Object)(object)buildPiece58.Prefab.GetComponent<TrapDoor>())) { Object.Destroy((Object)(object)buildPiece58.Prefab.GetComponent<Door>()); buildPiece58.Prefab.AddComponent<TrapDoor>(); } BuildPiece buildPiece59 = new BuildPiece(_finewoodBundle, "BFP_Window"); buildPiece59.Crafting.Set(CraftingTable.Workbench); buildPiece59.Category.Set("FineWoodPieces"); buildPiece59.RequiredItems.Add("FineWood", 6, recover: true); buildPiece59.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece59.Prefab); BuildPiece buildPiece60 = new BuildPiece(_finewoodBundle, "BFP_Window_Half"); buildPiece60.Crafting.Set(CraftingTable.Workbench); buildPiece60.Category.Set("FineWoodPieces"); buildPiece60.RequiredItems.Add("FineWood", 3, recover: true); buildPiece60.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece60.Prefab); BuildPiece buildPiece61 = new BuildPiece(_finewoodBundle, "BFP_Window_Quarter"); buildPiece61.Crafting.Set(CraftingTable.Workbench); buildPiece61.Category.Set("FineWoodPieces"); buildPiece61.RequiredItems.Add("FineWood", 2, recover: true); buildPiece61.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece61.Prefab); } private static void Others() { _pickableReed = PiecePrefabManager.RegisterPrefab(_finewoodBundle, "BFP_Pickable_Reed"); ShaderReplacer.Replace(_pickableReed); _straw = PiecePrefabManager.RegisterPrefab(_finewoodBundle, "BFP_Straw"); ShaderReplacer.Replace(_straw); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_sfx_barley_hit"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_sfx_build_hammer_default"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_sfx_build_hammer_stone"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_sfx_build_hammer_wood"); _sfxClose = PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_sfx_door_close"); _sfxOpen = PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_sfx_door_open"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_sfx_FireAddFuel"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_sfx_rock_destroyed"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_sfx_rock_hit"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_sfx_window_open"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_sfx_windows_close"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_sfx_wood_destroyed"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_vfx_barley_destroyed"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_vfx_dvergpost_destroyed"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_vfx_FireAddFuel"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_vfx_MarbleHit"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_vfx_Place_stone_wall_2x1"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_vfx_Place_wood_wall_half"); PiecePrefabManager.RegisterPrefab(_finewoodBundle, "bfp_vfx_SawDust"); } public static void SetupLightPost(ZNetScene zNetScene) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (Helper.ZNetSceneAwake()) { Fireplace component = _finewoodBundle.LoadAsset<GameObject>("BFP_StoneLightPost").GetComponent<Fireplace>(); component.m_fuelItem = zNetScene.GetPrefab("Coal").GetComponent<ItemDrop>(); FireworkItem[] array = new FireworkItem[1]; FireworkItem val = new FireworkItem { m_fireworkItemCount = 1, m_fireworkItem = zNetScene.GetPrefab("Resin").GetComponent<ItemDrop>() }; EffectList val2 = new EffectList(); val2.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("vfx_Firework_Rocket") } }; val.m_fireworksEffects = val2; array[0] = val; component.m_fireworkItemList = (FireworkItem[])(object)array; } } public static void TrapDoor() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown if (Helper.ZNetSceneAwake()) { TrapDoor component = _finewoodBundle.LoadAsset<GameObject>("BFP_TrapDoor").GetComponent<TrapDoor>(); component.m_name = "$bfp_trapdoor"; component.m_checkGuardStone = true; component.m_openEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = _sfxOpen, m_enabled = true, m_variant = -1 } }; component.m_closeEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = _sfxClose, m_enabled = true, m_variant = -1 } }; } } } public static class ShaderReplacer { private static readonly List<GameObject> GOToSwap; static ShaderReplacer() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown GOToSwap = new List<GameObject>(); new Harmony("blacks7ar.utilities.ShaderReplacer").Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(ShaderReplacer), "ReplaceShaderPatch", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void Replace(GameObject gameObject) { GOToSwap.Add(gameObject); } [HarmonyPriority(700)] private static void ReplaceShaderPatch() { foreach (Material item in from gameObject in GOToSwap select gameObject.GetComponentsInChildren<Renderer>(true) into renderers from renderer in renderers where (Object)(object)renderer != (Object)null from material in renderer.sharedMaterials where (Object)(object)material != (Object)null select material) { Shader[] array = Resources.FindObjectsOfTypeAll<Shader>(); foreach (Shader val in array) { if (((Object)item.shader).name == ((Object)val).name) { item.shader = val; } } } } } public enum Toggle { On = 1, Off = 0 } public class TrapDoor : MonoBehaviour, Hoverable, Interactable { public string m_name = "door"; public bool m_checkGuardStone = true; public EffectList m_openEffects = new EffectList(); public EffectList m_closeEffects = new EffectList(); public ZNetView m_nview; public Animator m_animator; public void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); if (m_nview.GetZDO() != null) { m_animator = ((Component)this).GetComponentInChildren<Animator>(); if (Object.op_Implicit((Object)(object)m_nview)) { m_nview.Register<bool>("UseTrapDoor", (Action<long, bool>)RPC_UseTrapDoor); } ((MonoBehaviour)this).InvokeRepeating("UpdateState", 0f, 0.2f); } } public void UpdateState() { if (m_nview.IsValid()) { int @int = m_nview.GetZDO().GetInt(ZDOVars.s_state, 0); SetState(@int); } } public void SetState(int state) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_002e: Unknown result type (might be due to invalid IL or missing references) if (m_animator.GetInteger("state") != state) { if (state != 0) { m_openEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } else { m_closeEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } m_animator.SetInteger("state", state); } } public string GetHoverText() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (!m_nview.IsValid()) { return ""; } if (Plugin._hideTrapDoorHoverText.Value == Toggle.On) { return ""; } if (m_checkGuardStone && !PrivateArea.CheckAccess(((Component)this).transform.position, 0f, false, false)) { return Localization.instance.Localize(m_name + "\n$piece_noaccess"); } if (m_nview.GetZDO().GetInt(ZDOVars.s_state, 0) != 0) { return Localization.instance.Localize(m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_door_close"); } return Localization.instance.Localize(m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_door_open"); } public string GetHoverName() { return m_name; } public bool Interact(Humanoid character, bool hold, bool alt) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (hold) { return false; } if (m_checkGuardStone && !PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return true; } Vector3 val = ((Component)character).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Game.instance.IncrementPlayerStat((PlayerStatType)((m_nview.GetZDO().GetInt(ZDOVars.s_state, 0) == 0) ? 74 : 75), 1f); Open(normalized); return true; } public void Open(Vector3 userDir) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) bool flag = Vector3.Dot(((Component)this).transform.up, userDir) < 0f; m_nview.InvokeRPC("UseTrapDoor", new object[1] { flag }); } public bool UseItem(Humanoid user, ItemData item) { return false; } public void RPC_UseTrapDoor(long uid, bool forward) { if (m_nview.GetZDO().GetInt(ZDOVars.s_state, 0) == 0) { if (forward) { m_nview.GetZDO().Set(ZDOVars.s_state, 1, false); } else { m_nview.GetZDO().Set(ZDOVars.s_state, -1, false); } } else { m_nview.GetZDO().Set(ZDOVars.s_state, 0, false); } UpdateState(); } } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded] internal sealed class <b89b921d-8954-4084-bd4d-1feb826a594e>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [CompilerGenerated] [<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded] internal sealed class <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [CompilerGenerated] internal sealed class <bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContextAttribute : Attribute { public readonly byte Flag; public <bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace LocalizationManager { [PublicAPI] [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(1)] [<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(0)] internal class Localizer { private static readonly Dictionary<string, Dictionary<string, Func<string>>> PlaceholderProcessors; private static readonly Dictionary<string, Dictionary<string, string>> loadedTexts; private static readonly ConditionalWeakTable<Localization, string> localizationLanguage; private static readonly List<WeakReference<Localization>> localizationObjects; [<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(2)] private static BaseUnityPlugin _plugin; private static readonly List<string> fileExtensions; private static BaseUnityPlugin plugin { get { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown if (_plugin == null) { IEnumerable<TypeInfo> source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First([<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } private static void UpdatePlaceholderText(Localization localization, string key) { localizationLanguage.TryGetValue(localization, out var value); string text = loadedTexts[value][key]; if (PlaceholderProcessors.TryGetValue(key, out var value2)) { text = value2.Aggregate(text, [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] (string current, KeyValuePair<string, Func<string>> kv) => current.Replace("{" + kv.Key + "}", kv.Value())); } localization.AddWord(key, text); } public static void AddPlaceholder<T>(string key, string placeholder, ConfigEntry<T> config, [<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(new byte[] { 2, 1, 1 })] Func<T, string> convertConfigValue = null) { if (convertConfigValue == null) { convertConfigValue = [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] [return: <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(1)] (T val) => val.ToString(); } if (!PlaceholderProcessors.ContainsKey(key)) { PlaceholderProcessors[key] = new Dictionary<string, Func<string>>(); } config.SettingChanged += [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] (object _, EventArgs _) => { UpdatePlaceholder(); }; if (loadedTexts.ContainsKey(Localization.instance.GetSelectedLanguage())) { UpdatePlaceholder(); } void UpdatePlaceholder() { PlaceholderProcessors[key][placeholder] = () => convertConfigValue(config.Value); UpdatePlaceholderText(Localization.instance, key); } } public static void AddText(string key, string text) { List<WeakReference<Localization>> list = new List<WeakReference<Localization>>(); foreach (WeakReference<Localization> localizationObject in localizationObjects) { if (localizationObject.TryGetTarget(out var target)) { Dictionary<string, string> dictionary = loadedTexts[localizationLanguage.GetOrCreateValue(target)]; if (!target.m_translations.ContainsKey(key)) { dictionary[key] = text; target.AddWord(key, text); } } else { list.Add(localizationObject); } } foreach (WeakReference<Localization> item in list) { localizationObjects.Remove(item); } } public static void Load() { LoadLocalization(Localization.instance, Localization.instance.GetSelectedLanguage()); } private static void LoadLocalization(Localization __instance, string language) { if (!localizationLanguage.Remove(__instance)) { localizationObjects.Add(new WeakReference<Localization>(__instance)); } localizationLanguage.Add(__instance, language); Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (string item in from f in Directory.GetFiles(Path.GetDirectoryName(Paths.PluginPath), plugin.Info.Metadata.Name + ".*", SearchOption.AllDirectories) where fileExtensions.IndexOf(Path.GetExtension(f)) >= 0 select f) { string text = Path.GetFileNameWithoutExtension(item).Split(new char[1] { '.' })[1]; if (dictionary.ContainsKey(text)) { Debug.LogWarning((object)("Duplicate key " + text + " found for " + plugin.Info.Metadata.Name + ". The duplicate file found at " + item + " will be skipped.")); } else { dictionary[text] = item; } } byte[] array = LoadTranslationFromAssembly("English"); if (array == null) { throw new Exception("Found no English localizations in mod " + plugin.Info.Metadata.Name + ". Expected an embedded resource translations/English.json or translations/English.yml."); } Dictionary<string, string> dictionary2 = new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(Encoding.UTF8.GetString(array)); if (dictionary2 == null) { throw new Exception("Localization for mod " + plugin.Info.Metadata.Name + " failed: Localization file was empty."); } string text2 = null; if (language != "English") { if (dictionary.ContainsKey(language)) { text2 = File.ReadAllText(dictionary[language]); } else { byte[] array2 = LoadTranslationFromAssembly(language); if (array2 != null) { text2 = Encoding.UTF8.GetString(array2); } } } if (text2 == null && dictionary.ContainsKey("English")) { text2 = File.ReadAllText(dictionary["English"]); } if (text2 != null) { foreach (KeyValuePair<string, string> item2 in new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(text2) ?? new Dictionary<string, string>()) { dictionary2[item2.Key] = item2.Value; } } loadedTexts[language] = dictionary2; foreach (KeyValuePair<string, string> item3 in dictionary2) { UpdatePlaceholderText(__instance, item3.Key); } } static Localizer() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown PlaceholderProcessors = new Dictionary<string, Dictionary<string, Func<string>>>(); loadedTexts = new Dictionary<string, Dictionary<string, string>>(); localizationLanguage = new ConditionalWeakTable<Localization, string>(); localizationObjects = new List<WeakReference<Localization>>(); fileExtensions = new List<string> { ".json", ".yml" }; new Harmony("org.bepinex.helpers.LocalizationManager").Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "LoadCSV", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalization", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } [return: <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(2)] private static byte[] LoadTranslationFromAssembly(string language) { foreach (string fileExtension in fileExtensions) { byte[] array = ReadEmbeddedFileBytes("translations." + language + fileExtension); if (array != null) { return array; } } return null; } [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(2)] public static byte[] ReadEmbeddedFileBytes([<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(1)] string resourceFileName, Assembly containingAssembly = null) { using MemoryStream memoryStream = new MemoryStream(); if ((object)containingAssembly == null) { containingAssembly = Assembly.GetCallingAssembly(); } string text = containingAssembly.GetManifestResourceNames().FirstOrDefault([<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] (string str) => str.EndsWith(resourceFileName, StringComparison.Ordinal)); if (text != null) { containingAssembly.GetManifestResourceStream(text)?.CopyTo(memoryStream); } return (memoryStream.Length == 0L) ? null : memoryStream.ToArray(); } } } namespace Microsoft.CodeAnalysis { [<4c979b98-03e4-4a5c-8247-45220b06dff9>Embedded] [CompilerGenerated] internal sealed class <4c979b98-03e4-4a5c-8247-45220b06dff9>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<4c979b98-03e4-4a5c-8247-45220b06dff9>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <8cfba9ba-35e3-4025-a499-0d967fa8bc99>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <8cfba9ba-35e3-4025-a499-0d967fa8bc99>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <8cfba9ba-35e3-4025-a499-0d967fa8bc99>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [<4c979b98-03e4-4a5c-8247-45220b06dff9>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class <c52b151a-9e71-4ede-9967-ba95416f10da>NullableContextAttribute : Attribute { public readonly byte Flag; public <c52b151a-9e71-4ede-9967-ba95416f10da>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] internal sealed class NotNullAttribute : Attribute { } [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace System.Collections.Generic { internal static class DeconstructionExtensions { [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] public static void Deconstruct<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] TKey, [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] TValue>([<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(new byte[] { 0, 1, 1 })] this KeyValuePair<TKey, TValue> pair, out TKey key, out TValue value) { key = pair.Key; value = pair.Value; } } } namespace YamlDotNet { [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal sealed class CultureInfoAdapter : CultureInfo { private readonly IFormatProvider provider; public CultureInfoAdapter(CultureInfo baseCulture, IFormatProvider provider) : base(baseCulture.LCID) { this.provider = provider; } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(2)] public override object GetFormat(Type formatType) { return provider.GetFormat(formatType); } } [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal static class ReflectionExtensions { [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] private static readonly FieldInfo RemoteStackTraceField = typeof(Exception).GetField("_remoteStackTraceString", BindingFlags.Instance | BindingFlags.NonPublic); [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] public static Type BaseType(this Type type) { return type.BaseType; } public static bool IsValueType(this Type type) { return type.IsValueType; } public static bool IsGenericType(this Type type) { return type.IsGenericType; } public static bool IsGenericTypeDefinition(this Type type) { return type.IsGenericTypeDefinition; } public static bool IsInterface(this Type type) { return type.IsInterface; } public static bool IsEnum(this Type type) { return type.IsEnum; } public static bool IsDbNull(this object value) { return value is DBNull; } public static bool HasDefaultConstructor(this Type type) { if (!type.IsValueType) { return type.GetConstructor(BindingFlags.Instance | BindingFlags.Public, null, Type.EmptyTypes, null) != null; } return true; } public static TypeCode GetTypeCode(this Type type) { return Type.GetTypeCode(type); } [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] public static PropertyInfo GetPublicProperty(this Type type, string name) { return type.GetProperty(name); } [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] public static FieldInfo GetPublicStaticField(this Type type, string name) { return type.GetField(name, BindingFlags.Static | BindingFlags.Public); } public static IEnumerable<PropertyInfo> GetProperties(this Type type, bool includeNonPublic) { BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public; if (includeNonPublic) { bindingFlags |= BindingFlags.NonPublic; } if (!type.IsInterface) { return type.GetProperties(bindingFlags); } return new Type[1] { type }.Concat(type.GetInterfaces()).SelectMany([<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(0)] (Type i) => i.GetProperties(bindingFlags)); } public static IEnumerable<PropertyInfo> GetPublicProperties(this Type type) { return type.GetProperties(includeNonPublic: false); } public static IEnumerable<FieldInfo> GetPublicFields(this Type type) { return type.GetFields(BindingFlags.Instance | BindingFlags.Public); } public static IEnumerable<MethodInfo> GetPublicStaticMethods(this Type type) { return type.GetMethods(BindingFlags.Static | BindingFlags.Public); } public static MethodInfo GetPrivateStaticMethod(this Type type, string name) { return type.GetMethod(name, BindingFlags.Static | BindingFlags.NonPublic) ?? throw new MissingMethodException("Expected to find a method named '" + name + "' in '" + type.FullName + "'."); } [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] public static MethodInfo GetPublicStaticMethod(this Type type, string name, params Type[] parameterTypes) { return type.GetMethod(name, BindingFlags.Static | BindingFlags.Public, null, parameterTypes, null); } [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] public static MethodInfo GetPublicInstanceMethod(this Type type, string name) { return type.GetMethod(name, BindingFlags.Instance | BindingFlags.Public); } public static Exception Unwrap(this TargetInvocationException ex) { Exception innerException = ex.InnerException; if (innerException == null) { return ex; } if (RemoteStackTraceField != null) { RemoteStackTraceField.SetValue(innerException, innerException.StackTrace + "\r\n"); } return innerException; } public static bool IsInstanceOf(this Type type, object o) { return type.IsInstanceOfType(o); } public static Attribute[] GetAllCustomAttributes<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] TAttribute>(this PropertyInfo property) { return Attribute.GetCustomAttributes(property, typeof(TAttribute)); } } internal static class PropertyInfoExtensions { [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] public static object ReadValue(this PropertyInfo property, object target) { return property.GetValue(target, null); } } internal static class StandardRegexOptions { public const RegexOptions Compiled = RegexOptions.Compiled; } } namespace YamlDotNet.Serialization { [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] internal abstract class BuilderSkeleton<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] TBuilder> where TBuilder : BuilderSkeleton<TBuilder> { internal INamingConvention namingConvention = NullNamingConvention.Instance; internal ITypeResolver typeResolver; internal readonly YamlAttributeOverrides overrides; internal readonly LazyComponentRegistrationList<Nothing, IYamlTypeConverter> typeConverterFactories; internal readonly LazyComponentRegistrationList<ITypeInspector, ITypeInspector> typeInspectorFactories; private bool ignoreFields; private bool includeNonPublicProperties; protected abstract TBuilder Self { get; } internal BuilderSkeleton(ITypeResolver typeResolver) { overrides = new YamlAttributeOverrides(); typeConverterFactories = new LazyComponentRegistrationList<Nothing, IYamlTypeConverter> { { typeof(YamlDotNet.Serialization.Converters.GuidConverter), (Nothing _) => new YamlDotNet.Serialization.Converters.GuidConverter(jsonCompatible: false) }, { typeof(SystemTypeConverter), (Nothing _) => new SystemTypeConverter() } }; typeInspectorFactories = new LazyComponentRegistrationList<ITypeInspector, ITypeInspector>(); this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver"); } internal ITypeInspector BuildTypeInspector() { ITypeInspector typeInspector = new ReadablePropertiesTypeInspector(typeResolver, includeNonPublicProperties); if (!ignoreFields) { typeInspector = new CompositeTypeInspector(new ReadableFieldsTypeInspector(typeResolver), typeInspector); } return typeInspectorFactories.BuildComponentChain(typeInspector); } public TBuilder IgnoreFields() { ignoreFields = true; return Self; } public TBuilder IncludeNonPublicProperties() { includeNonPublicProperties = true; return Self; } public TBuilder WithNamingConvention(INamingConvention namingConvention) { this.namingConvention = namingConvention ?? throw new ArgumentNullException("namingConvention"); return Self; } public TBuilder WithTypeResolver(ITypeResolver typeResolver) { this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver"); return Self; } public abstract TBuilder WithTagMapping(TagName tag, Type type); public TBuilder WithAttributeOverride<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] TClass>(Expression<Func<TClass, object>> propertyAccessor, Attribute attribute) { overrides.Add(propertyAccessor, attribute); return Self; } public TBuilder WithAttributeOverride(Type type, string member, Attribute attribute) { overrides.Add(type, member, attribute); return Self; } public TBuilder WithTypeConverter(IYamlTypeConverter typeConverter) { return WithTypeConverter(typeConverter, delegate(IRegistrationLocationSelectionSyntax<IYamlTypeConverter> w) { w.OnTop(); }); } public TBuilder WithTypeConverter(IYamlTypeConverter typeConverter, Action<IRegistrationLocationSelectionSyntax<IYamlTypeConverter>> where) { if (typeConverter == null) { throw new ArgumentNullException("typeConverter"); } if (where == null) { throw new ArgumentNullException("where"); } where(typeConverterFactories.CreateRegistrationLocationSelector(typeConverter.GetType(), (Nothing _) => typeConverter)); return Self; } public TBuilder WithTypeConverter<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] TYamlTypeConverter>(WrapperFactory<IYamlTypeConverter, IYamlTypeConverter> typeConverterFactory, Action<ITrackingRegistrationLocationSelectionSyntax<IYamlTypeConverter>> where) where TYamlTypeConverter : IYamlTypeConverter { if (typeConverterFactory == null) { throw new ArgumentNullException("typeConverterFactory"); } if (where == null) { throw new ArgumentNullException("where"); } where(typeConverterFactories.CreateTrackingRegistrationLocationSelector(typeof(TYamlTypeConverter), (IYamlTypeConverter wrapped, Nothing _) => typeConverterFactory(wrapped))); return Self; } public TBuilder WithoutTypeConverter<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] TYamlTypeConverter>() where TYamlTypeConverter : IYamlTypeConverter { return WithoutTypeConverter(typeof(TYamlTypeConverter)); } public TBuilder WithoutTypeConverter(Type converterType) { if (converterType == null) { throw new ArgumentNullException("converterType"); } typeConverterFactories.Remove(converterType); return Self; } public TBuilder WithTypeInspector<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] TTypeInspector>(Func<ITypeInspector, TTypeInspector> typeInspectorFactory) where TTypeInspector : ITypeInspector { return WithTypeInspector(typeInspectorFactory, delegate(IRegistrationLocationSelectionSyntax<ITypeInspector> w) { w.OnTop(); }); } public TBuilder WithTypeInspector<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] TTypeInspector>(Func<ITypeInspector, TTypeInspector> typeInspectorFactory, Action<IRegistrationLocationSelectionSyntax<ITypeInspector>> where) where TTypeInspector : ITypeInspector { if (typeInspectorFactory == null) { throw new ArgumentNullException("typeInspectorFactory"); } if (where == null) { throw new ArgumentNullException("where"); } where(typeInspectorFactories.CreateRegistrationLocationSelector(typeof(TTypeInspector), (ITypeInspector inner) => typeInspectorFactory(inner))); return Self; } public TBuilder WithTypeInspector<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] TTypeInspector>(WrapperFactory<ITypeInspector, ITypeInspector, TTypeInspector> typeInspectorFactory, Action<ITrackingRegistrationLocationSelectionSyntax<ITypeInspector>> where) where TTypeInspector : ITypeInspector { if (typeInspectorFactory == null) { throw new ArgumentNullException("typeInspectorFactory"); } if (where == null) { throw new ArgumentNullException("where"); } where(typeInspectorFactories.CreateTrackingRegistrationLocationSelector(typeof(TTypeInspector), (ITypeInspector wrapped, ITypeInspector inner) => typeInspectorFactory(wrapped, inner))); return Self; } public TBuilder WithoutTypeInspector<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] TTypeInspector>() where TTypeInspector : ITypeInspector { return WithoutTypeInspector(typeof(TTypeInspector)); } public TBuilder WithoutTypeInspector(Type inspectorType) { if (inspectorType == null) { throw new ArgumentNullException("inspectorType"); } typeInspectorFactories.Remove(inspectorType); return Self; } protected IEnumerable<IYamlTypeConverter> BuildTypeConverters() { return typeConverterFactories.BuildComponentList(); } } internal delegate TComponent WrapperFactory<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] TComponentBase, TComponent>(TComponentBase wrapped) where TComponent : TComponentBase; internal delegate TComponent WrapperFactory<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] TArgument, [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] TComponentBase, TComponent>(TComponentBase wrapped, TArgument argument) where TComponent : TComponentBase; [Flags] internal enum DefaultValuesHandling { Preserve = 0, OmitNull = 1, OmitDefaults = 2, OmitEmptyCollections = 4 } [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal sealed class Deserializer : IDeserializer { private readonly IValueDeserializer valueDeserializer; public Deserializer() : this(new DeserializerBuilder().BuildValueDeserializer()) { } private Deserializer(IValueDeserializer valueDeserializer) { this.valueDeserializer = valueDeserializer ?? throw new ArgumentNullException("valueDeserializer"); } public static Deserializer FromValueDeserializer(IValueDeserializer valueDeserializer) { return new Deserializer(valueDeserializer); } public T Deserialize<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] T>(string input) { using StringReader input2 = new StringReader(input); return Deserialize<T>(input2); } public T Deserialize<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] T>(TextReader input) { return Deserialize<T>(new Parser(input)); } [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] public object Deserialize(TextReader input) { return Deserialize(input, typeof(object)); } [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] public object Deserialize(string input, Type type) { using StringReader input2 = new StringReader(input); return Deserialize(input2, type); } [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] public object Deserialize(TextReader input, Type type) { return Deserialize(new Parser(input), type); } public T Deserialize<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] T>(IParser parser) { return (T)Deserialize(parser, typeof(T)); } [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] public object Deserialize(IParser parser) { return Deserialize(parser, typeof(object)); } [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] public object Deserialize(IParser parser, Type type) { if (parser == null) { throw new ArgumentNullException("parser"); } if (type == null) { throw new ArgumentNullException("type"); } YamlDotNet.Core.Events.StreamStart @event; bool flag = parser.TryConsume<YamlDotNet.Core.Events.StreamStart>(out @event); YamlDotNet.Core.Events.DocumentStart event2; bool flag2 = parser.TryConsume<YamlDotNet.Core.Events.DocumentStart>(out event2); object result = null; if (!parser.Accept<YamlDotNet.Core.Events.DocumentEnd>(out var _) && !parser.Accept<YamlDotNet.Core.Events.StreamEnd>(out var _)) { using SerializerState serializerState = new SerializerState(); result = valueDeserializer.DeserializeValue(parser, type, serializerState, valueDeserializer); serializerState.OnDeserialization(); } if (flag2) { parser.Consume<YamlDotNet.Core.Events.DocumentEnd>(); } if (flag) { parser.Consume<YamlDotNet.Core.Events.StreamEnd>(); } return result; } } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(new byte[] { 0, 1 })] internal sealed class DeserializerBuilder : BuilderSkeleton<DeserializerBuilder> { private Lazy<IObjectFactory> objectFactory; private readonly LazyComponentRegistrationList<Nothing, INodeDeserializer> nodeDeserializerFactories; private readonly LazyComponentRegistrationList<Nothing, INodeTypeResolver> nodeTypeResolverFactories; private readonly Dictionary<TagName, Type> tagMappings; private readonly Dictionary<Type, Type> typeMappings; private bool ignoreUnmatched; protected override DeserializerBuilder Self => this; public DeserializerBuilder() : base((ITypeResolver)new StaticTypeResolver()) { typeMappings = new Dictionary<Type, Type>(); objectFactory = new Lazy<IObjectFactory>(() => new DefaultObjectFactory(typeMappings), isThreadSafe: true); tagMappings = new Dictionary<TagName, Type> { { FailsafeSchema.Tags.Map, typeof(Dictionary<object, object>) }, { FailsafeSchema.Tags.Str, typeof(string) }, { JsonSchema.Tags.Bool, typeof(bool) }, { JsonSchema.Tags.Float, typeof(double) }, { JsonSchema.Tags.Int, typeof(int) }, { DefaultSchema.Tags.Timestamp, typeof(DateTime) } }; typeInspectorFactories.Add(typeof(CachedTypeInspector), (ITypeInspector inner) => new CachedTypeInspector(inner)); typeInspectorFactories.Add(typeof(NamingConventionTypeInspector), (ITypeInspector inner) => (!(namingConvention is NullNamingConvention)) ? new NamingConventionTypeInspector(inner, namingConvention) : inner); typeInspectorFactories.Add(typeof(YamlAttributesTypeInspector), (ITypeInspector inner) => new YamlAttributesTypeInspector(inner)); typeInspectorFactories.Add(typeof(YamlAttributeOverridesInspector), (ITypeInspector inner) => (overrides == null) ? inner : new YamlAttributeOverridesInspector(inner, overrides.Clone())); typeInspectorFactories.Add(typeof(ReadableAndWritablePropertiesTypeInspector), (ITypeInspector inner) => new ReadableAndWritablePropertiesTypeInspector(inner)); nodeDeserializerFactories = new LazyComponentRegistrationList<Nothing, INodeDeserializer> { { typeof(YamlConvertibleNodeDeserializer), (Nothing _) => new YamlConvertibleNodeDeserializer(objectFactory.Value) }, { typeof(YamlSerializableNodeDeserializer), (Nothing _) => new YamlSerializableNodeDeserializer(objectFactory.Value) }, { typeof(TypeConverterNodeDeserializer), (Nothing _) => new TypeConverterNodeDeserializer(BuildTypeConverters()) }, { typeof(NullNodeDeserializer), (Nothing _) => new NullNodeDeserializer() }, { typeof(ScalarNodeDeserializer), (Nothing _) => new ScalarNodeDeserializer() }, { typeof(ArrayNodeDeserializer), (Nothing _) => new ArrayNodeDeserializer() }, { typeof(DictionaryNodeDeserializer), (Nothing _) => new DictionaryNodeDeserializer(objectFactory.Value) }, { typeof(CollectionNodeDeserializer), (Nothing _) => new CollectionNodeDeserializer(objectFactory.Value) }, { typeof(EnumerableNodeDeserializer), (Nothing _) => new EnumerableNodeDeserializer() }, { typeof(ObjectNodeDeserializer), (Nothing _) => new ObjectNodeDeserializer(objectFactory.Value, BuildTypeInspector(), ignoreUnmatched) } }; nodeTypeResolverFactories = new LazyComponentRegistrationList<Nothing, INodeTypeResolver> { { typeof(MappingNodeTypeResolver), (Nothing _) => new MappingNodeTypeResolver(typeMappings) }, { typeof(YamlConvertibleTypeResolver), (Nothing _) => new YamlConvertibleTypeResolver() }, { typeof(YamlSerializableTypeResolver), (Nothing _) => new YamlSerializableTypeResolver() }, { typeof(TagNodeTypeResolver), (Nothing _) => new TagNodeTypeResolver(tagMappings) }, { typeof(PreventUnknownTagsNodeTypeResolver), (Nothing _) => new PreventUnknownTagsNodeTypeResolver() }, { typeof(DefaultContainersNodeTypeResolver), (Nothing _) => new DefaultContainersNodeTypeResolver() } }; } public DeserializerBuilder WithObjectFactory(IObjectFactory objectFactory) { if (objectFactory == null) { throw new ArgumentNullException("objectFactory"); } this.objectFactory = new Lazy<IObjectFactory>(() => objectFactory, isThreadSafe: true); return this; } public DeserializerBuilder WithObjectFactory(Func<Type, object> objectFactory) { if (objectFactory == null) { throw new ArgumentNullException("objectFactory"); } return WithObjectFactory(new LambdaObjectFactory(objectFactory)); } public DeserializerBuilder WithNodeDeserializer(INodeDeserializer nodeDeserializer) { return WithNodeDeserializer(nodeDeserializer, delegate(IRegistrationLocationSelectionSyntax<INodeDeserializer> w) { w.OnTop(); }); } public DeserializerBuilder WithNodeDeserializer(INodeDeserializer nodeDeserializer, Action<IRegistrationLocationSelectionSyntax<INodeDeserializer>> where) { if (nodeDeserializer == null) { throw new ArgumentNullException("nodeDeserializer"); } if (where == null) { throw new ArgumentNullException("where"); } where(nodeDeserializerFactories.CreateRegistrationLocationSelector(nodeDeserializer.GetType(), (Nothing _) => nodeDeserializer)); return this; } public DeserializerBuilder WithNodeDeserializer<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] TNodeDeserializer>(WrapperFactory<INodeDeserializer, TNodeDeserializer> nodeDeserializerFactory, Action<ITrackingRegistrationLocationSelectionSyntax<INodeDeserializer>> where) where TNodeDeserializer : INodeDeserializer { if (nodeDeserializerFactory == null) { throw new ArgumentNullException("nodeDeserializerFactory"); } if (where == null) { throw new ArgumentNullException("where"); } where(nodeDeserializerFactories.CreateTrackingRegistrationLocationSelector(typeof(TNodeDeserializer), (INodeDeserializer wrapped, Nothing _) => nodeDeserializerFactory(wrapped))); return this; } public DeserializerBuilder WithoutNodeDeserializer<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] TNodeDeserializer>() where TNodeDeserializer : INodeDeserializer { return WithoutNodeDeserializer(typeof(TNodeDeserializer)); } public DeserializerBuilder WithoutNodeDeserializer(Type nodeDeserializerType) { if (nodeDeserializerType == null) { throw new ArgumentNullException("nodeDeserializerType"); } nodeDeserializerFactories.Remove(nodeDeserializerType); return this; } public DeserializerBuilder WithNodeTypeResolver(INodeTypeResolver nodeTypeResolver) { return WithNodeTypeResolver(nodeTypeResolver, delegate(IRegistrationLocationSelectionSyntax<INodeTypeResolver> w) { w.OnTop(); }); } public DeserializerBuilder WithNodeTypeResolver(INodeTypeResolver nodeTypeResolver, Action<IRegistrationLocationSelectionSyntax<INodeTypeResolver>> where) { if (nodeTypeResolver == null) { throw new ArgumentNullException("nodeTypeResolver"); } if (where == null) { throw new ArgumentNullException("where"); } where(nodeTypeResolverFactories.CreateRegistrationLocationSelector(nodeTypeResolver.GetType(), (Nothing _) => nodeTypeResolver)); return this; } public DeserializerBuilder WithNodeTypeResolver<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] TNodeTypeResolver>(WrapperFactory<INodeTypeResolver, TNodeTypeResolver> nodeTypeResolverFactory, Action<ITrackingRegistrationLocationSelectionSyntax<INodeTypeResolver>> where) where TNodeTypeResolver : INodeTypeResolver { if (nodeTypeResolverFactory == null) { throw new ArgumentNullException("nodeTypeResolverFactory"); } if (where == null) { throw new ArgumentNullException("where"); } where(nodeTypeResolverFactories.CreateTrackingRegistrationLocationSelector(typeof(TNodeTypeResolver), (INodeTypeResolver wrapped, Nothing _) => nodeTypeResolverFactory(wrapped))); return this; } public DeserializerBuilder WithoutNodeTypeResolver<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] TNodeTypeResolver>() where TNodeTypeResolver : INodeTypeResolver { return WithoutNodeTypeResolver(typeof(TNodeTypeResolver)); } public DeserializerBuilder WithoutNodeTypeResolver(Type nodeTypeResolverType) { if (nodeTypeResolverType == null) { throw new ArgumentNullException("nodeTypeResolverType"); } nodeTypeResolverFactories.Remove(nodeTypeResolverType); return this; } public override DeserializerBuilder WithTagMapping(TagName tag, Type type) { if (tag.IsEmpty) { throw new ArgumentException("Non-specific tags cannot be maped"); } if (type == null) { throw new ArgumentNullException("type"); } if (tagMappings.TryGetValue(tag, out var value)) { throw new ArgumentException($"Type already has a registered type '{value.FullName}' for tag '{tag}'", "tag"); } tagMappings.Add(tag, type); return this; } public DeserializerBuilder WithTypeMapping<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] TInterface, [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] TConcrete>() where TConcrete : TInterface { Type typeFromHandle = typeof(TInterface); Type typeFromHandle2 = typeof(TConcrete); if (!typeFromHandle.IsAssignableFrom(typeFromHandle2)) { throw new InvalidOperationException("The type '" + typeFromHandle2.Name + "' does not implement interface '" + typeFromHandle.Name + "'."); } if (typeMappings.ContainsKey(typeFromHandle)) { typeMappings[typeFromHandle] = typeFromHandle2; } else { typeMappings.Add(typeFromHandle, typeFromHandle2); } return this; } public DeserializerBuilder WithoutTagMapping(TagName tag) { if (tag.IsEmpty) { throw new ArgumentException("Non-specific tags cannot be maped"); } if (!tagMappings.Remove(tag)) { throw new KeyNotFoundException($"Tag '{tag}' is not registered"); } return this; } public DeserializerBuilder IgnoreUnmatchedProperties() { ignoreUnmatched = true; return this; } public IDeserializer Build() { return Deserializer.FromValueDeserializer(BuildValueDeserializer()); } public IValueDeserializer BuildValueDeserializer() { return new AliasValueDeserializer(new NodeValueDeserializer(nodeDeserializerFactories.BuildComponentList(), nodeTypeResolverFactories.BuildComponentList())); } } [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal sealed class EmissionPhaseObjectGraphVisitorArgs { private readonly IEnumerable<IObjectGraphVisitor<Nothing>> preProcessingPhaseVisitors; public IObjectGraphVisitor<IEmitter> InnerVisitor { get; private set; } public IEventEmitter EventEmitter { get; private set; } public ObjectSerializer NestedObjectSerializer { get; private set; } public IEnumerable<IYamlTypeConverter> TypeConverters { get; private set; } public EmissionPhaseObjectGraphVisitorArgs(IObjectGraphVisitor<IEmitter> innerVisitor, IEventEmitter eventEmitter, IEnumerable<IObjectGraphVisitor<Nothing>> preProcessingPhaseVisitors, IEnumerable<IYamlTypeConverter> typeConverters, ObjectSerializer nestedObjectSerializer) { InnerVisitor = innerVisitor ?? throw new ArgumentNullException("innerVisitor"); EventEmitter = eventEmitter ?? throw new ArgumentNullException("eventEmitter"); this.preProcessingPhaseVisitors = preProcessingPhaseVisitors ?? throw new ArgumentNullException("preProcessingPhaseVisitors"); TypeConverters = typeConverters ?? throw new ArgumentNullException("typeConverters"); NestedObjectSerializer = nestedObjectSerializer ?? throw new ArgumentNullException("nestedObjectSerializer"); } public T GetPreProcessingPhaseObjectGraphVisitor<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] T>() where T : IObjectGraphVisitor<Nothing> { return preProcessingPhaseVisitors.OfType<T>().Single(); } } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] internal abstract class EventInfo { public IObjectDescriptor Source { get; } protected EventInfo(IObjectDescriptor source) { Source = source ?? throw new ArgumentNullException("source"); } } internal class AliasEventInfo : EventInfo { public AnchorName Alias { get; } public bool NeedsExpansion { get; set; } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] public AliasEventInfo(IObjectDescriptor source, AnchorName alias) : base(source) { if (alias.IsEmpty) { throw new ArgumentNullException("alias"); } Alias = alias; } } internal class ObjectEventInfo : EventInfo { public AnchorName Anchor { get; set; } public TagName Tag { get; set; } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] protected ObjectEventInfo(IObjectDescriptor source) : base(source) { } } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(0)] internal sealed class ScalarEventInfo : ObjectEventInfo { public string RenderedValue { get; set; } public ScalarStyle Style { get; set; } public bool IsPlainImplicit { get; set; } public bool IsQuotedImplicit { get; set; } public ScalarEventInfo(IObjectDescriptor source) : base(source) { Style = source.ScalarStyle; RenderedValue = string.Empty; } } internal sealed class MappingStartEventInfo : ObjectEventInfo { public bool IsImplicit { get; set; } public MappingStyle Style { get; set; } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] public MappingStartEventInfo(IObjectDescriptor source) : base(source) { } } internal sealed class MappingEndEventInfo : EventInfo { [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] public MappingEndEventInfo(IObjectDescriptor source) : base(source) { } } internal sealed class SequenceStartEventInfo : ObjectEventInfo { public bool IsImplicit { get; set; } public SequenceStyle Style { get; set; } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] public SequenceStartEventInfo(IObjectDescriptor source) : base(source) { } } internal sealed class SequenceEndEventInfo : EventInfo { [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] public SequenceEndEventInfo(IObjectDescriptor source) : base(source) { } } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal interface IAliasProvider { AnchorName GetAlias(object target); } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal interface IDeserializer { T Deserialize<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] T>(string input); T Deserialize<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] T>(TextReader input); [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] object Deserialize(TextReader input); [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] object Deserialize(string input, Type type); [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] object Deserialize(TextReader input, Type type); T Deserialize<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] T>(IParser parser); [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] object Deserialize(IParser parser); [return: <8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] object Deserialize(IParser parser, Type type); } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal interface IEventEmitter { void Emit(AliasEventInfo eventInfo, IEmitter emitter); void Emit(ScalarEventInfo eventInfo, IEmitter emitter); void Emit(MappingStartEventInfo eventInfo, IEmitter emitter); void Emit(MappingEndEventInfo eventInfo, IEmitter emitter); void Emit(SequenceStartEventInfo eventInfo, IEmitter emitter); void Emit(SequenceEndEventInfo eventInfo, IEmitter emitter); } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal interface INamingConvention { string Apply(string value); } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal interface INodeDeserializer { bool Deserialize(IParser reader, Type expectedType, [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(new byte[] { 1, 1, 1, 2 })] Func<IParser, Type, object> nestedObjectDeserializer, [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] out object value); } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal interface INodeTypeResolver { bool Resolve([<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] NodeEvent nodeEvent, ref Type currentType); } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal interface IObjectDescriptor { [<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] object Value { [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(2)] get; } Type Type { get; } Type StaticType { get; } ScalarStyle ScalarStyle { get; } } internal static class ObjectDescriptorExtensions { [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] public static object NonNullValue(this IObjectDescriptor objectDescriptor) { return objectDescriptor.Value ?? throw new InvalidOperationException("Attempted to use a IObjectDescriptor of type '" + objectDescriptor.Type.FullName + "' whose Value is null at a point whete it is invalid to do so. This may indicate a bug in YamlDotNet."); } } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal interface IObjectFactory { object Create(Type type); } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal interface IObjectGraphTraversalStrategy { void Traverse<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] TContext>(IObjectDescriptor graph, IObjectGraphVisitor<TContext> visitor, TContext context); } [<c52b151a-9e71-4ede-9967-ba95416f10da>NullableContext(1)] internal interface IObjectGraphVisitor<[<8cfba9ba-35e3-4025-a499-0d967fa8bc99>Nullable(2)] TContext> { bool Enter(IObjectDescriptor value, TContext context); bool EnterMapping(IObjectDescriptor key, IObjectDescriptor value, TContext context); bool EnterMapping(IPrope