Decompiled source of FineWoodFurnitures v1.0.9
FineWoodFurnitures.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 FineWoodFurnitures.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: Guid("BD4B608D-510C-4914-9FDC-BD72AC02B4E8")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyProduct("FineWoodFurnitures")] [assembly: AssemblyCompany("blacks7ar")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyDescription("https://valheim.thunderstore.io/package/blacks7ar/FineWoodFurnitures/")] [assembly: AssemblyTitle("FineWoodFurnitures")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyFileVersion("1.0.9")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.9.0")] [module: UnverifiableCode] [module: <491d8cb5-501c-4db6-aadc-70c663c136b0>RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [<ab308dae-d03e-4c71-ab7a-db2b04fdd901>Embedded] [CompilerGenerated] internal sealed class <ab308dae-d03e-4c71-ab7a-db2b04fdd901>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] [<ab308dae-d03e-4c71-ab7a-db2b04fdd901>Embedded] [CompilerGenerated] internal sealed class <491d8cb5-501c-4db6-aadc-70c663c136b0>RefSafetyRulesAttribute : Attribute { public readonly int Version; public <491d8cb5-501c-4db6-aadc-70c663c136b0>RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FineWoodFurnitures { [BepInPlugin("blacks7ar.FineWoodFurnitures", "FineWoodFurnitures", "1.0.9")] [BepInIncompatibility("blacks7ar.FineWoodPieces")] public class Plugin : BaseUnityPlugin { private const string modGUID = "blacks7ar.FineWoodFurnitures"; public const string modName = "FineWoodFurnitures"; public const string modAuthor = "blacks7ar"; public const string modVersion = "1.0.9"; public const string modLink = "https://valheim.thunderstore.io/package/blacks7ar/FineWoodFurnitures/"; private static readonly Harmony _harmony = new Harmony("blacks7ar.FineWoodFurnitures"); private static readonly ConfigSync _configSync = new ConfigSync("blacks7ar.FineWoodFurnitures") { DisplayName = "FineWoodFurnitures", CurrentVersion = "1.0.9", MinimumRequiredVersion = "1.0.9" }; private static ConfigEntry<Toggle> _serverConfigLocked; 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 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); 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 FineWoodFurnitures.Patches { [HarmonyPatch(typeof(ZNetScene), "Awake")] public class ZNetScenePatch { private static void Postfix(ZNetScene __instance) { SetupPrefabs.SetArmorStand1(__instance); SetupPrefabs.SetArmorStand2(__instance); } } } namespace FineWoodFurnitures.Functions { public static class Helper { 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 _furnitureBundle; public static GameObject _armorStand; public static GameObject _woodenStand; private const string _category = "FineWoodFurnitures"; private const string _clutter = "FineWoodClutter"; public static void Init() { _furnitureBundle = PiecePrefabManager.RegisterAssetBundle("finewoodfurnitures"); Others(); Furnitures(); } private static void Furnitures() { BuildPiece buildPiece = new BuildPiece(_furnitureBundle, "BFP_ArmorStand"); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set("FineWoodFurnitures"); buildPiece.RequiredItems.Add("FineWood", 12, recover: true); buildPiece.RequiredItems.Add("BronzeNails", 6, recover: true); buildPiece.RequiredItems.Add("LeatherScraps", 4, recover: true); buildPiece.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece.Prefab); BuildPiece buildPiece2 = new BuildPiece(_furnitureBundle, "BFP_BarrelClutter"); buildPiece2.Crafting.Set(CraftingTable.Workbench); buildPiece2.Category.Set("FineWoodClutter"); buildPiece2.RequiredItems.Add("FineWood", 10, recover: true); buildPiece2.RequiredItems.Add("Bronze", 4, recover: true); buildPiece2.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece2.Prefab); BuildPiece buildPiece3 = new BuildPiece(_furnitureBundle, "BFP_Bench1"); buildPiece3.Crafting.Set(CraftingTable.Workbench); buildPiece3.Category.Set("FineWoodFurnitures"); buildPiece3.RequiredItems.Add("FineWood", 16, recover: true); buildPiece3.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece3.Prefab); BuildPiece buildPiece4 = new BuildPiece(_furnitureBundle, "BFP_Bench2"); buildPiece4.Crafting.Set(CraftingTable.Workbench); buildPiece4.Category.Set("FineWoodFurnitures"); buildPiece4.RequiredItems.Add("FineWood", 24, recover: true); buildPiece4.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece4.Prefab); BuildPiece buildPiece5 = new BuildPiece(_furnitureBundle, "BFP_Bench3"); buildPiece5.Crafting.Set(CraftingTable.Workbench); buildPiece5.Category.Set("FineWoodFurnitures"); buildPiece5.RequiredItems.Add("FineWood", 12, recover: true); buildPiece5.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece5.Prefab); BuildPiece buildPiece6 = new BuildPiece(_furnitureBundle, "BFP_Bench4"); buildPiece6.Crafting.Set(CraftingTable.Workbench); buildPiece6.Category.Set("FineWoodFurnitures"); buildPiece6.RequiredItems.Add("Stone", 24, recover: true); buildPiece6.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece6.Prefab); BuildPiece buildPiece7 = new BuildPiece(_furnitureBundle, "BFP_Bench5"); buildPiece7.Crafting.Set(CraftingTable.Workbench); buildPiece7.Category.Set("FineWoodFurnitures"); buildPiece7.RequiredItems.Add("FineWood", 12, recover: true); buildPiece7.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece7.Prefab); BuildPiece buildPiece8 = new BuildPiece(_furnitureBundle, "BFP_Bench6"); buildPiece8.Crafting.Set(CraftingTable.Workbench); buildPiece8.Category.Set("FineWoodFurnitures"); buildPiece8.RequiredItems.Add("FineWood", 18, recover: true); buildPiece8.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece8.Prefab); BuildPiece buildPiece9 = new BuildPiece(_furnitureBundle, "BFP_Bench7"); buildPiece9.Crafting.Set(CraftingTable.Workbench); buildPiece9.Category.Set("FineWoodFurnitures"); buildPiece9.RequiredItems.Add("FineWood", 8, recover: true); buildPiece9.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece9.Prefab); BuildPiece buildPiece10 = new BuildPiece(_furnitureBundle, "BFP_Bench8"); buildPiece10.Crafting.Set(CraftingTable.Workbench); buildPiece10.Category.Set("FineWoodFurnitures"); buildPiece10.RequiredItems.Add("FineWood", 6, recover: true); buildPiece10.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece10.Prefab); BuildPiece buildPiece11 = new BuildPiece(_furnitureBundle, "BFP_Bench9"); buildPiece11.Crafting.Set(CraftingTable.Workbench); buildPiece11.Category.Set("FineWoodFurnitures"); buildPiece11.RequiredItems.Add("FineWood", 12, recover: true); buildPiece11.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece11.Prefab); BuildPiece buildPiece12 = new BuildPiece(_furnitureBundle, "BFP_BronzeFrameChest"); buildPiece12.Crafting.Set(CraftingTable.Workbench); buildPiece12.Category.Set("FineWoodFurnitures"); buildPiece12.RequiredItems.Add("FineWood", 8, recover: true); buildPiece12.RequiredItems.Add("Bronze", 4, recover: true); buildPiece12.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece12.Prefab); BuildPiece buildPiece13 = new BuildPiece(_furnitureBundle, "BFP_Cabinet1"); buildPiece13.Crafting.Set(CraftingTable.Workbench); buildPiece13.Category.Set("FineWoodFurnitures"); buildPiece13.RequiredItems.Add("FineWood", 42, recover: true); buildPiece13.RequiredItems.Add("BronzeNails", 12, recover: true); buildPiece13.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece13.Prefab); BuildPiece buildPiece14 = new BuildPiece(_furnitureBundle, "BFP_Cabinet2"); buildPiece14.Crafting.Set(CraftingTable.Workbench); buildPiece14.Category.Set("FineWoodFurnitures"); buildPiece14.RequiredItems.Add("FineWood", 42, recover: true); buildPiece14.RequiredItems.Add("BronzeNails", 12, recover: true); buildPiece14.RequiredItems.Add("Crystal", 2, recover: true); buildPiece14.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; BuildPiece buildPiece15 = new BuildPiece(_furnitureBundle, "BFP_Cabinet3"); buildPiece15.Crafting.Set(CraftingTable.Workbench); buildPiece15.Category.Set("FineWoodFurnitures"); buildPiece15.RequiredItems.Add("FineWood", 21, recover: true); buildPiece15.RequiredItems.Add("BronzeNails", 6, recover: true); buildPiece15.RequiredItems.Add("Crystal", 1, recover: true); buildPiece15.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; BuildPiece buildPiece16 = new BuildPiece(_furnitureBundle, "BFP_Cabinet4"); buildPiece16.Crafting.Set(CraftingTable.Workbench); buildPiece16.Category.Set("FineWoodFurnitures"); buildPiece16.RequiredItems.Add("FineWood", 36, recover: true); buildPiece16.RequiredItems.Add("BronzeNails", 16, recover: true); buildPiece16.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece16.Prefab); BuildPiece buildPiece17 = new BuildPiece(_furnitureBundle, "BFP_Cabinet5"); buildPiece17.Crafting.Set(CraftingTable.Workbench); buildPiece17.Category.Set("FineWoodFurnitures"); buildPiece17.RequiredItems.Add("FineWood", 36, recover: true); buildPiece17.RequiredItems.Add("BronzeNails", 16, recover: true); buildPiece17.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece17.Prefab); BuildPiece buildPiece18 = new BuildPiece(_furnitureBundle, "BFP_Cabinet6"); buildPiece18.Crafting.Set(CraftingTable.Workbench); buildPiece18.Category.Set("FineWoodFurnitures"); buildPiece18.RequiredItems.Add("FineWood", 42, recover: true); buildPiece18.RequiredItems.Add("BronzeNails", 12, recover: true); buildPiece18.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece18.Prefab); BuildPiece buildPiece19 = new BuildPiece(_furnitureBundle, "BFP_Cabinet7"); buildPiece19.Crafting.Set(CraftingTable.Workbench); buildPiece19.Category.Set("FineWoodFurnitures"); buildPiece19.RequiredItems.Add("FineWood", 16, recover: true); buildPiece19.RequiredItems.Add("RoundLog", 8, recover: true); buildPiece19.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece19.Prefab); BuildPiece buildPiece20 = new BuildPiece(_furnitureBundle, "BFP_Candle1"); buildPiece20.Crafting.Set(CraftingTable.Workbench); buildPiece20.Category.Set("FineWoodFurnitures"); buildPiece20.RequiredItems.Add("Tin", 2, recover: true); buildPiece20.RequiredItems.Add("Honey", 1, recover: true); buildPiece20.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece20.Prefab); BuildPiece buildPiece21 = new BuildPiece(_furnitureBundle, "BFP_Cupboard"); buildPiece21.Crafting.Set(CraftingTable.Workbench); buildPiece21.Category.Set("FineWoodFurnitures"); buildPiece21.RequiredItems.Add("FineWood", 12, recover: true); buildPiece21.RequiredItems.Add("RoundLog", 2, recover: true); buildPiece21.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece21.Prefab); BuildPiece buildPiece22 = new BuildPiece(_furnitureBundle, "BFP_FineWoodBasket"); buildPiece22.Crafting.Set(CraftingTable.Workbench); buildPiece22.Category.Set("FineWoodFurnitures"); buildPiece22.RequiredItems.Add("FineWood", 4, recover: true); buildPiece22.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece22.Prefab); BuildPiece buildPiece23 = new BuildPiece(_furnitureBundle, "BFP_FineWoodBed1"); buildPiece23.Crafting.Set(CraftingTable.Workbench); buildPiece23.Category.Set("FineWoodFurnitures"); buildPiece23.RequiredItems.Add("FineWood", 12, recover: true); buildPiece23.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece23.Prefab); BuildPiece buildPiece24 = new BuildPiece(_furnitureBundle, "BFP_FineWoodBed2"); buildPiece24.Crafting.Set(CraftingTable.Workbench); buildPiece24.Category.Set("FineWoodFurnitures"); buildPiece24.RequiredItems.Add("FineWood", 18, recover: true); buildPiece24.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece24.Prefab); BuildPiece buildPiece25 = new BuildPiece(_furnitureBundle, "BFP_FineWoodChair1"); buildPiece25.Crafting.Set(CraftingTable.Workbench); buildPiece25.Category.Set("FineWoodFurnitures"); buildPiece25.RequiredItems.Add("FineWood", 8, recover: true); buildPiece25.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece25.Prefab); BuildPiece buildPiece26 = new BuildPiece(_furnitureBundle, "BFP_FineWoodChair2"); buildPiece26.Crafting.Set(CraftingTable.Workbench); buildPiece26.Category.Set("FineWoodFurnitures"); buildPiece26.RequiredItems.Add("FineWood", 8, recover: true); buildPiece26.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece26.Prefab); BuildPiece buildPiece27 = new BuildPiece(_furnitureBundle, "BFP_FineWoodChair3"); buildPiece27.Crafting.Set(CraftingTable.Workbench); buildPiece27.Category.Set("FineWoodFurnitures"); buildPiece27.RequiredItems.Add("FineWood", 8, recover: true); buildPiece27.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece27.Prefab); BuildPiece buildPiece28 = new BuildPiece(_furnitureBundle, "BFP_FineWoodChair4"); buildPiece28.Crafting.Set(CraftingTable.Workbench); buildPiece28.Category.Set("FineWoodFurnitures"); buildPiece28.RequiredItems.Add("FineWood", 8, recover: true); buildPiece28.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece28.Prefab); BuildPiece buildPiece29 = new BuildPiece(_furnitureBundle, "BFP_FineWoodChair5"); buildPiece29.Crafting.Set(CraftingTable.Workbench); buildPiece29.Category.Set("FineWoodFurnitures"); buildPiece29.RequiredItems.Add("FineWood", 8, recover: true); buildPiece29.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece29.Prefab); BuildPiece buildPiece30 = new BuildPiece(_furnitureBundle, "BFP_FineWoodChair6"); buildPiece30.Crafting.Set(CraftingTable.Workbench); buildPiece30.Category.Set("FineWoodFurnitures"); buildPiece30.RequiredItems.Add("FineWood", 14, recover: true); buildPiece30.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece30.Prefab); BuildPiece buildPiece31 = new BuildPiece(_furnitureBundle, "BFP_FineWoodChair7"); buildPiece31.Crafting.Set(CraftingTable.Workbench); buildPiece31.Category.Set("FineWoodFurnitures"); buildPiece31.RequiredItems.Add("FineWood", 14, recover: true); buildPiece31.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece31.Prefab); BuildPiece buildPiece32 = new BuildPiece(_furnitureBundle, "BFP_FineWoodCrib"); buildPiece32.Crafting.Set(CraftingTable.Workbench); buildPiece32.Category.Set("FineWoodClutter"); buildPiece32.RequiredItems.Add("FineWood", 62, recover: true); buildPiece32.RequiredItems.Add("BronzeNails", 28, recover: true); buildPiece32.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece32.Prefab); BuildPiece buildPiece33 = new BuildPiece(_furnitureBundle, "BFP_FineWoodDrawer1"); buildPiece33.Crafting.Set(CraftingTable.Workbench); buildPiece33.Category.Set("FineWoodFurnitures"); buildPiece33.RequiredItems.Add("FineWood", 22, recover: true); buildPiece33.RequiredItems.Add("BronzeNails", 8, recover: true); buildPiece33.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece33.Prefab); BuildPiece buildPiece34 = new BuildPiece(_furnitureBundle, "BFP_FineWoodDrawer2"); buildPiece34.Crafting.Set(CraftingTable.Workbench); buildPiece34.Category.Set("FineWoodFurnitures"); buildPiece34.RequiredItems.Add("FineWood", 22, recover: true); buildPiece34.RequiredItems.Add("BronzeNails", 8, recover: true); buildPiece34.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece34.Prefab); BuildPiece buildPiece35 = new BuildPiece(_furnitureBundle, "BFP_FineWoodDrawer3"); buildPiece35.Crafting.Set(CraftingTable.Workbench); buildPiece35.Category.Set("FineWoodFurnitures"); buildPiece35.RequiredItems.Add("FineWood", 22, recover: true); buildPiece35.RequiredItems.Add("BronzeNails", 8, recover: true); buildPiece35.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece35.Prefab); BuildPiece buildPiece36 = new BuildPiece(_furnitureBundle, "BFP_FineWoodDrawer4"); buildPiece36.Crafting.Set(CraftingTable.Workbench); buildPiece36.Category.Set("FineWoodFurnitures"); buildPiece36.RequiredItems.Add("FineWood", 22, recover: true); buildPiece36.RequiredItems.Add("BronzeNails", 8, recover: true); buildPiece36.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece36.Prefab); BuildPiece buildPiece37 = new BuildPiece(_furnitureBundle, "BFP_FineWoodDrawer5"); buildPiece37.Crafting.Set(CraftingTable.Workbench); buildPiece37.Category.Set("FineWoodFurnitures"); buildPiece37.RequiredItems.Add("FineWood", 22, recover: true); buildPiece37.RequiredItems.Add("BronzeNails", 8, recover: true); buildPiece37.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece37.Prefab); BuildPiece buildPiece38 = new BuildPiece(_furnitureBundle, "BFP_FineWoodStool"); buildPiece38.Crafting.Set(CraftingTable.Workbench); buildPiece38.Category.Set("FineWoodFurnitures"); buildPiece38.RequiredItems.Add("FineWood", 6, recover: true); buildPiece38.RequiredItems.Add("BronzeNails", 4, recover: true); buildPiece38.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece38.Prefab); BuildPiece buildPiece39 = new BuildPiece(_furnitureBundle, "BFP_FineWoodTable1"); buildPiece39.Crafting.Set(CraftingTable.Workbench); buildPiece39.Category.Set("FineWoodFurnitures"); buildPiece39.RequiredItems.Add("FineWood", 14, recover: true); buildPiece39.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece39.Prefab); BuildPiece buildPiece40 = new BuildPiece(_furnitureBundle, "BFP_FineWoodTable2"); buildPiece40.Crafting.Set(CraftingTable.Workbench); buildPiece40.Category.Set("FineWoodFurnitures"); buildPiece40.RequiredItems.Add("FineWood", 14, recover: true); buildPiece40.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece40.Prefab); BuildPiece buildPiece41 = new BuildPiece(_furnitureBundle, "BFP_FineWoodTable3"); buildPiece41.Crafting.Set(CraftingTable.Workbench); buildPiece41.Category.Set("FineWoodFurnitures"); buildPiece41.RequiredItems.Add("FineWood", 14, recover: true); buildPiece41.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece41.Prefab); BuildPiece buildPiece42 = new BuildPiece(_furnitureBundle, "BFP_FineWoodTable4"); buildPiece42.Crafting.Set(CraftingTable.Workbench); buildPiece42.Category.Set("FineWoodFurnitures"); buildPiece42.RequiredItems.Add("FineWood", 14, recover: true); buildPiece42.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece42.Prefab); BuildPiece buildPiece43 = new BuildPiece(_furnitureBundle, "BFP_FineWoodTable5"); buildPiece43.Crafting.Set(CraftingTable.Workbench); buildPiece43.Category.Set("FineWoodFurnitures"); buildPiece43.RequiredItems.Add("FineWood", 14, recover: true); buildPiece43.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece43.Prefab); BuildPiece buildPiece44 = new BuildPiece(_furnitureBundle, "BFP_FineWoodTable6"); buildPiece44.Crafting.Set(CraftingTable.Workbench); buildPiece44.Category.Set("FineWoodFurnitures"); buildPiece44.RequiredItems.Add("FineWood", 14, recover: true); buildPiece44.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece44.Prefab); BuildPiece buildPiece45 = new BuildPiece(_furnitureBundle, "BFP_FineWoodTable7"); buildPiece45.Crafting.Set(CraftingTable.Workbench); buildPiece45.Category.Set("FineWoodFurnitures"); buildPiece45.RequiredItems.Add("FineWood", 14, recover: true); buildPiece45.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece45.Prefab); BuildPiece buildPiece46 = new BuildPiece(_furnitureBundle, "BFP_FineWoodTable8"); buildPiece46.Crafting.Set(CraftingTable.Workbench); buildPiece46.Category.Set("FineWoodFurnitures"); buildPiece46.RequiredItems.Add("FineWood", 14, recover: true); buildPiece46.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece46.Prefab); BuildPiece buildPiece47 = new BuildPiece(_furnitureBundle, "BFP_FineWoodTable9"); buildPiece47.Crafting.Set(CraftingTable.Workbench); buildPiece47.Category.Set("FineWoodFurnitures"); buildPiece47.RequiredItems.Add("FineWood", 14, recover: true); buildPiece47.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece47.Prefab); BuildPiece buildPiece48 = new BuildPiece(_furnitureBundle, "BFP_FlowerStand1"); buildPiece48.Crafting.Set(CraftingTable.Workbench); buildPiece48.Category.Set("FineWoodClutter"); buildPiece48.RequiredItems.Add("Tin", 4, recover: true); buildPiece48.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece48.Prefab); BuildPiece buildPiece49 = new BuildPiece(_furnitureBundle, "BFP_FlowerStand2"); buildPiece49.Crafting.Set(CraftingTable.Workbench); buildPiece49.Category.Set("FineWoodClutter"); buildPiece49.RequiredItems.Add("Tin", 6, recover: true); buildPiece49.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece49.Prefab); BuildPiece buildPiece50 = new BuildPiece(_furnitureBundle, "BFP_Lantern1"); buildPiece50.Crafting.Set(CraftingTable.Workbench); buildPiece50.Category.Set("FineWoodFurnitures"); buildPiece50.RequiredItems.Add("Tin", 4, recover: true); buildPiece50.RequiredItems.Add("Honey", 1, recover: true); buildPiece50.RequiredItems.Add("Resin", 4, recover: true); buildPiece50.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece50.Prefab); BuildPiece buildPiece51 = new BuildPiece(_furnitureBundle, "BFP_Lantern2"); buildPiece51.Crafting.Set(CraftingTable.Workbench); buildPiece51.Category.Set("FineWoodFurnitures"); buildPiece51.RequiredItems.Add("Tin", 4, recover: true); buildPiece51.RequiredItems.Add("Honey", 1, recover: true); buildPiece51.RequiredItems.Add("Resin", 4, recover: true); buildPiece51.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece51.Prefab); BuildPiece buildPiece52 = new BuildPiece(_furnitureBundle, "BFP_Lantern3"); buildPiece52.Crafting.Set(CraftingTable.Workbench); buildPiece52.Category.Set("FineWoodFurnitures"); buildPiece52.RequiredItems.Add("Tin", 4, recover: true); buildPiece52.RequiredItems.Add("Honey", 1, recover: true); buildPiece52.RequiredItems.Add("Resin", 4, recover: true); buildPiece52.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece52.Prefab); BuildPiece buildPiece53 = new BuildPiece(_furnitureBundle, "BFP_Lantern4"); buildPiece53.Crafting.Set(CraftingTable.Workbench); buildPiece53.Category.Set("FineWoodFurnitures"); buildPiece53.RequiredItems.Add("Tin", 4, recover: true); buildPiece53.RequiredItems.Add("Honey", 1, recover: true); buildPiece53.RequiredItems.Add("Resin", 4, recover: true); buildPiece53.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece53.Prefab); BuildPiece buildPiece54 = new BuildPiece(_furnitureBundle, "BFP_Lantern5"); buildPiece54.Crafting.Set(CraftingTable.Workbench); buildPiece54.Category.Set("FineWoodFurnitures"); buildPiece54.RequiredItems.Add("Tin", 4, recover: true); buildPiece54.RequiredItems.Add("Honey", 1, recover: true); buildPiece54.RequiredItems.Add("Resin", 4, recover: true); buildPiece54.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece54.Prefab); BuildPiece buildPiece55 = new BuildPiece(_furnitureBundle, "BFP_Lantern6"); buildPiece55.Crafting.Set(CraftingTable.Workbench); buildPiece55.Category.Set("FineWoodFurnitures"); buildPiece55.RequiredItems.Add("Tin", 4, recover: true); buildPiece55.RequiredItems.Add("Honey", 1, recover: true); buildPiece55.RequiredItems.Add("Resin", 4, recover: true); buildPiece55.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece55.Prefab); BuildPiece buildPiece56 = new BuildPiece(_furnitureBundle, "BFP_Lantern7"); buildPiece56.Crafting.Set(CraftingTable.Workbench); buildPiece56.Category.Set("FineWoodFurnitures"); buildPiece56.RequiredItems.Add("Tin", 10, recover: true); buildPiece56.RequiredItems.Add("Honey", 1, recover: true); buildPiece56.RequiredItems.Add("Resin", 4, recover: true); buildPiece56.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece56.Prefab); BuildPiece buildPiece57 = new BuildPiece(_furnitureBundle, "BFP_LeatherBed"); buildPiece57.Crafting.Set(CraftingTable.Workbench); buildPiece57.Category.Set("FineWoodFurnitures"); buildPiece57.RequiredItems.Add("FineWood", 14, recover: true); buildPiece57.RequiredItems.Add("LeatherScraps", 10, recover: true); buildPiece57.RequiredItems.Add("DeerHide", 12, recover: true); buildPiece57.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece57.Prefab); BuildPiece buildPiece58 = new BuildPiece(_furnitureBundle, "BFP_LogChair"); buildPiece58.Crafting.Set(CraftingTable.Workbench); buildPiece58.Category.Set("FineWoodFurnitures"); buildPiece58.RequiredItems.Add("FineWood", 6, recover: true); buildPiece58.RequiredItems.Add("RoundLog", 1, recover: true); buildPiece58.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece58.Prefab); BuildPiece buildPiece59 = new BuildPiece(_furnitureBundle, "BFP_LongCrate"); buildPiece59.Crafting.Set(CraftingTable.Workbench); buildPiece59.Category.Set("FineWoodFurnitures"); buildPiece59.RequiredItems.Add("FineWood", 12, recover: true); buildPiece59.RequiredItems.Add("Bronze", 4, recover: true); buildPiece59.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece59.Prefab); BuildPiece buildPiece60 = new BuildPiece(_furnitureBundle, "BFP_LoxBed"); buildPiece60.Crafting.Set(CraftingTable.Workbench); buildPiece60.Category.Set("FineWoodFurnitures"); buildPiece60.RequiredItems.Add("FineWood", 18, recover: true); buildPiece60.RequiredItems.Add("LinenThread", 10, recover: true); buildPiece60.RequiredItems.Add("LoxPelt", 8, recover: true); buildPiece60.RequiredItems.Add("WolfPelt", 4, recover: true); buildPiece60.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece60.Prefab); BuildPiece buildPiece61 = new BuildPiece(_furnitureBundle, "BFP_LoxDoubleBed"); buildPiece61.Crafting.Set(CraftingTable.Workbench); buildPiece61.Category.Set("FineWoodFurnitures"); buildPiece61.RequiredItems.Add("FineWood", 26, recover: true); buildPiece61.RequiredItems.Add("LinenThread", 22, recover: true); buildPiece61.RequiredItems.Add("LoxPelt", 16, recover: true); buildPiece61.RequiredItems.Add("WolfPelt", 8, recover: true); buildPiece61.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece61.Prefab); BuildPiece buildPiece62 = new BuildPiece(_furnitureBundle, "BFP_MiniStool1"); buildPiece62.Crafting.Set(CraftingTable.Workbench); buildPiece62.Category.Set("FineWoodFurnitures"); buildPiece62.RequiredItems.Add("FineWood", 6, recover: true); buildPiece62.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece62.Prefab); BuildPiece buildPiece63 = new BuildPiece(_furnitureBundle, "BFP_MiniStool2"); buildPiece63.Crafting.Set(CraftingTable.Workbench); buildPiece63.Category.Set("FineWoodFurnitures"); buildPiece63.RequiredItems.Add("FineWood", 6, recover: true); buildPiece63.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece63.Prefab); BuildPiece buildPiece64 = new BuildPiece(_furnitureBundle, "BFP_MiniTable1"); buildPiece64.Crafting.Set(CraftingTable.Workbench); buildPiece64.Category.Set("FineWoodFurnitures"); buildPiece64.RequiredItems.Add("FineWood", 28, recover: true); buildPiece64.RequiredItems.Add("Crystal", 3, recover: true); buildPiece64.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; BuildPiece buildPiece65 = new BuildPiece(_furnitureBundle, "BFP_MiniTable2"); buildPiece65.Crafting.Set(CraftingTable.Workbench); buildPiece65.Category.Set("FineWoodFurnitures"); buildPiece65.RequiredItems.Add("FineWood", 22, recover: true); buildPiece65.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece65.Prefab); BuildPiece buildPiece66 = new BuildPiece(_furnitureBundle, "BFP_MiniTable4"); buildPiece66.Crafting.Set(CraftingTable.Workbench); buildPiece66.Category.Set("FineWoodFurnitures"); buildPiece66.RequiredItems.Add("FineWood", 16, recover: true); buildPiece66.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece66.Prefab); BuildPiece buildPiece67 = new BuildPiece(_furnitureBundle, "BFP_Plant1"); buildPiece67.Crafting.Set(CraftingTable.Workbench); buildPiece67.Category.Set("FineWoodClutter"); buildPiece67.RequiredItems.Add("Stone", 4, recover: true); buildPiece67.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece67.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece67.Prefab); BuildPiece buildPiece68 = new BuildPiece(_furnitureBundle, "BFP_Plant2"); buildPiece68.Crafting.Set(CraftingTable.Workbench); buildPiece68.Category.Set("FineWoodClutter"); buildPiece68.RequiredItems.Add("Stone", 4, recover: true); buildPiece68.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece68.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece68.Prefab); BuildPiece buildPiece69 = new BuildPiece(_furnitureBundle, "BFP_Plant3"); buildPiece69.Crafting.Set(CraftingTable.Workbench); buildPiece69.Category.Set("FineWoodClutter"); buildPiece69.RequiredItems.Add("Stone", 4, recover: true); buildPiece69.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece69.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece69.Prefab); BuildPiece buildPiece70 = new BuildPiece(_furnitureBundle, "BFP_Plant4"); buildPiece70.Crafting.Set(CraftingTable.Workbench); buildPiece70.Category.Set("FineWoodClutter"); buildPiece70.RequiredItems.Add("Stone", 4, recover: true); buildPiece70.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece70.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece70.Prefab); BuildPiece buildPiece71 = new BuildPiece(_furnitureBundle, "BFP_Plant5"); buildPiece71.Crafting.Set(CraftingTable.Workbench); buildPiece71.Category.Set("FineWoodClutter"); buildPiece71.RequiredItems.Add("Stone", 4, recover: true); buildPiece71.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece71.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece71.Prefab); BuildPiece buildPiece72 = new BuildPiece(_furnitureBundle, "BFP_Plant6"); buildPiece72.Crafting.Set(CraftingTable.Workbench); buildPiece72.Category.Set("FineWoodClutter"); buildPiece72.RequiredItems.Add("Stone", 4, recover: true); buildPiece72.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece72.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece72.Prefab); BuildPiece buildPiece73 = new BuildPiece(_furnitureBundle, "BFP_Plant7"); buildPiece73.Crafting.Set(CraftingTable.Workbench); buildPiece73.Category.Set("FineWoodClutter"); buildPiece73.RequiredItems.Add("Stone", 4, recover: true); buildPiece73.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece73.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece73.Prefab); BuildPiece buildPiece74 = new BuildPiece(_furnitureBundle, "BFP_Plant8"); buildPiece74.Crafting.Set(CraftingTable.Workbench); buildPiece74.Category.Set("FineWoodClutter"); buildPiece74.RequiredItems.Add("Stone", 4, recover: true); buildPiece74.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece74.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece74.Prefab); BuildPiece buildPiece75 = new BuildPiece(_furnitureBundle, "BFP_Plant9"); buildPiece75.Crafting.Set(CraftingTable.Workbench); buildPiece75.Category.Set("FineWoodClutter"); buildPiece75.RequiredItems.Add("Stone", 4, recover: true); buildPiece75.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece75.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece75.Prefab); BuildPiece buildPiece76 = new BuildPiece(_furnitureBundle, "BFP_Plant10"); buildPiece76.Crafting.Set(CraftingTable.Workbench); buildPiece76.Category.Set("FineWoodClutter"); buildPiece76.RequiredItems.Add("Stone", 4, recover: true); buildPiece76.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece76.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece76.Prefab); BuildPiece buildPiece77 = new BuildPiece(_furnitureBundle, "BFP_Plant11"); buildPiece77.Crafting.Set(CraftingTable.Workbench); buildPiece77.Category.Set("FineWoodClutter"); buildPiece77.RequiredItems.Add("Stone", 4, recover: true); buildPiece77.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece77.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece77.Prefab); BuildPiece buildPiece78 = new BuildPiece(_furnitureBundle, "BFP_Plant12"); buildPiece78.Crafting.Set(CraftingTable.Workbench); buildPiece78.Category.Set("FineWoodClutter"); buildPiece78.RequiredItems.Add("Stone", 4, recover: true); buildPiece78.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece78.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece78.Prefab); BuildPiece buildPiece79 = new BuildPiece(_furnitureBundle, "BFP_Plant13"); buildPiece79.Crafting.Set(CraftingTable.Workbench); buildPiece79.Category.Set("FineWoodClutter"); buildPiece79.RequiredItems.Add("Stone", 4, recover: true); buildPiece79.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece79.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece79.Prefab); BuildPiece buildPiece80 = new BuildPiece(_furnitureBundle, "BFP_Plant14"); buildPiece80.Crafting.Set(CraftingTable.Workbench); buildPiece80.Category.Set("FineWoodClutter"); buildPiece80.RequiredItems.Add("Stone", 4, recover: true); buildPiece80.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece80.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece80.Prefab); BuildPiece buildPiece81 = new BuildPiece(_furnitureBundle, "BFP_Plant15"); buildPiece81.Crafting.Set(CraftingTable.Workbench); buildPiece81.Category.Set("FineWoodClutter"); buildPiece81.RequiredItems.Add("Stone", 4, recover: true); buildPiece81.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece81.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece81.Prefab); BuildPiece buildPiece82 = new BuildPiece(_furnitureBundle, "BFP_Plant16"); buildPiece82.Crafting.Set(CraftingTable.Workbench); buildPiece82.Category.Set("FineWoodClutter"); buildPiece82.RequiredItems.Add("Stone", 4, recover: true); buildPiece82.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece82.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece82.Prefab); BuildPiece buildPiece83 = new BuildPiece(_furnitureBundle, "BFP_Plant17"); buildPiece83.Crafting.Set(CraftingTable.Workbench); buildPiece83.Category.Set("FineWoodClutter"); buildPiece83.RequiredItems.Add("Stone", 4, recover: true); buildPiece83.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece83.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece83.Prefab); BuildPiece buildPiece84 = new BuildPiece(_furnitureBundle, "BFP_Plant18"); buildPiece84.Crafting.Set(CraftingTable.Workbench); buildPiece84.Category.Set("FineWoodClutter"); buildPiece84.RequiredItems.Add("Stone", 4, recover: true); buildPiece84.RequiredItems.Add("BeechSeeds", 8, recover: true); buildPiece84.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece84.Prefab); BuildPiece buildPiece85 = new BuildPiece(_furnitureBundle, "BFP_PoolChair"); buildPiece85.Crafting.Set(CraftingTable.Workbench); buildPiece85.Category.Set("FineWoodFurnitures"); buildPiece85.RequiredItems.Add("FineWood", 18, recover: true); buildPiece85.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece85.Prefab); BuildPiece buildPiece86 = new BuildPiece(_furnitureBundle, "BFP_Shelf1"); buildPiece86.Crafting.Set(CraftingTable.Workbench); buildPiece86.Category.Set("FineWoodClutter"); buildPiece86.RequiredItems.Add("FineWood", 28, recover: true); buildPiece86.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece86.Prefab); BuildPiece buildPiece87 = new BuildPiece(_furnitureBundle, "BFP_Shelf2"); buildPiece87.Crafting.Set(CraftingTable.Workbench); buildPiece87.Category.Set("FineWoodClutter"); buildPiece87.RequiredItems.Add("FineWood", 30, recover: true); buildPiece87.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece87.Prefab); BuildPiece buildPiece88 = new BuildPiece(_furnitureBundle, "BFP_Shelf3"); buildPiece88.Crafting.Set(CraftingTable.Workbench); buildPiece88.Category.Set("FineWoodClutter"); buildPiece88.RequiredItems.Add("FineWood", 36, recover: true); buildPiece88.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece88.Prefab); BuildPiece buildPiece89 = new BuildPiece(_furnitureBundle, "BFP_Shelf4"); buildPiece89.Crafting.Set(CraftingTable.Workbench); buildPiece89.Category.Set("FineWoodClutter"); buildPiece89.RequiredItems.Add("FineWood", 20, recover: true); buildPiece89.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece89.Prefab); BuildPiece buildPiece90 = new BuildPiece(_furnitureBundle, "BFP_Shelf5"); buildPiece90.Crafting.Set(CraftingTable.Workbench); buildPiece90.Category.Set("FineWoodClutter"); buildPiece90.RequiredItems.Add("FineWood", 14, recover: true); buildPiece90.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece90.Prefab); BuildPiece buildPiece91 = new BuildPiece(_furnitureBundle, "BFP_ShelfClutter"); buildPiece91.Crafting.Set(CraftingTable.Workbench); buildPiece91.Category.Set("FineWoodClutter"); buildPiece91.RequiredItems.Add("FineWood", 12, recover: true); buildPiece91.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece91.Prefab); BuildPiece buildPiece92 = new BuildPiece(_furnitureBundle, "BFP_Stool1"); buildPiece92.Crafting.Set(CraftingTable.Workbench); buildPiece92.Category.Set("FineWoodFurnitures"); buildPiece92.RequiredItems.Add("FineWood", 14, recover: true); buildPiece92.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece92.Prefab); BuildPiece buildPiece93 = new BuildPiece(_furnitureBundle, "BFP_Stool2"); buildPiece93.Crafting.Set(CraftingTable.Workbench); buildPiece93.Category.Set("FineWoodFurnitures"); buildPiece93.RequiredItems.Add("FineWood", 14, recover: true); buildPiece93.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece93.Prefab); BuildPiece buildPiece94 = new BuildPiece(_furnitureBundle, "BFP_WoodenArmorStand"); buildPiece94.Crafting.Set(CraftingTable.Workbench); buildPiece94.Category.Set("FineWoodFurnitures"); buildPiece94.RequiredItems.Add("FineWood", 16, recover: true); buildPiece94.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece94.Prefab); } private static void Others() { PiecePrefabManager.RegisterPrefab(_furnitureBundle, "bff_fx_ArmorStand_pick"); PiecePrefabManager.RegisterPrefab(_furnitureBundle, "bff_sfx_build_hammer_default"); PiecePrefabManager.RegisterPrefab(_furnitureBundle, "bff_sfx_build_hammer_wood"); PiecePrefabManager.RegisterPrefab(_furnitureBundle, "bff_sfx_chest_close"); PiecePrefabManager.RegisterPrefab(_furnitureBundle, "bff_sfx_chest_open"); PiecePrefabManager.RegisterPrefab(_furnitureBundle, "bff_sfx_pickable_pick"); PiecePrefabManager.RegisterPrefab(_furnitureBundle, "bff_sfx_rock_destroyed"); PiecePrefabManager.RegisterPrefab(_furnitureBundle, "bff_sfx_wood_destroyed"); PiecePrefabManager.RegisterPrefab(_furnitureBundle, "bff_vfx_pickable_pick"); PiecePrefabManager.RegisterPrefab(_furnitureBundle, "bff_vfx_Place_wood_pole"); PiecePrefabManager.RegisterPrefab(_furnitureBundle, "bff_vfx_SawDust"); } public static void SetArmorStand1(ZNetScene zNetScene) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown if (Helper.ZNetSceneAwake()) { ArmorStand component = _furnitureBundle.LoadAsset<GameObject>("BFP_ArmorStand").GetComponent<ArmorStand>(); component.m_supports = new List<ArmorStandSupport>(1) { new ArmorStandSupport { m_items = new List<ItemDrop>(4) { zNetScene.GetPrefab("ArmorBronzeChest").GetComponent<ItemDrop>(), zNetScene.GetPrefab("ArmorIronChest").GetComponent<ItemDrop>(), zNetScene.GetPrefab("ArmorCarapaceChest").GetComponent<ItemDrop>(), zNetScene.GetPrefab("ArmorMageChest").GetComponent<ItemDrop>() }, m_supports = new List<GameObject>(2) { ((Component)Utils.FindChild(((Component)component).gameObject.transform, "ArmLeft", (IterativeSearchType)0)).gameObject, ((Component)Utils.FindChild(((Component)component).gameObject.transform, "ArmRight", (IterativeSearchType)0)).gameObject } } }; } } public static void SetArmorStand2(ZNetScene zNetScene) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown if (Helper.ZNetSceneAwake()) { ArmorStand component = _furnitureBundle.LoadAsset<GameObject>("BFP_WoodenArmorStand").GetComponent<ArmorStand>(); component.m_supports = new List<ArmorStandSupport>(1) { new ArmorStandSupport { m_items = new List<ItemDrop>(4) { zNetScene.GetPrefab("ArmorBronzeChest").GetComponent<ItemDrop>(), zNetScene.GetPrefab("ArmorIronChest").GetComponent<ItemDrop>(), zNetScene.GetPrefab("ArmorCarapaceChest").GetComponent<ItemDrop>(), zNetScene.GetPrefab("ArmorMageChest").GetComponent<ItemDrop>() }, m_supports = new List<GameObject>(2) { ((Component)Utils.FindChild(((Component)component).gameObject.transform, "ArmLeft", (IterativeSearchType)0)).gameObject, ((Component)Utils.FindChild(((Component)component).gameObject.transform, "ArmRight", (IterativeSearchType)0)).gameObject } } }; } } } 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 } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded] internal sealed class <b89b921d-8954-4084-bd4d-1feb826a594e>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [<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] [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] 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 { [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(1)] [PublicAPI] [<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 { [<3c6fff70-01cf-47a2-b84f-21396a89de3c>Embedded] [CompilerGenerated] internal sealed class <3c6fff70-01cf-47a2-b84f-21396a89de3c>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [<3c6fff70-01cf-47a2-b84f-21396a89de3c>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [CompilerGenerated] internal sealed class <67ad2be3-8b4a-441c-a5e8-013337c20b10>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <67ad2be3-8b4a-441c-a5e8-013337c20b10>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <67ad2be3-8b4a-441c-a5e8-013337c20b10>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [<3c6fff70-01cf-47a2-b84f-21396a89de3c>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class <22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContextAttribute : Attribute { public readonly byte Flag; public <22914d04-0f5f-4178-91e3-0c1d44d2840f>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 { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(0)] [<22914d04-0f5f-4178-91e3-0c1d44d2840f>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 { [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] public static void Deconstruct<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] TKey, [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] TValue>([<67ad2be3-8b4a-441c-a5e8-013337c20b10>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 { [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(0)] [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] internal sealed class CultureInfoAdapter : CultureInfo { private readonly IFormatProvider provider; public CultureInfoAdapter(CultureInfo baseCulture, IFormatProvider provider) : base(baseCulture.LCID) { this.provider = provider; } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(2)] public override object GetFormat(Type formatType) { return provider.GetFormat(formatType); } } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(0)] internal static class ReflectionExtensions { [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] private static readonly FieldInfo RemoteStackTraceField = typeof(Exception).GetField("_remoteStackTraceString", BindingFlags.Instance | BindingFlags.NonPublic); [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>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: <67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] public static PropertyInfo GetPublicProperty(this Type type, string name) { return type.GetProperty(name); } [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>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([<22914d04-0f5f-4178-91e3-0c1d44d2840f>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: <67ad2be3-8b4a-441c-a5e8-013337c20b10>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: <67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] TAttribute>(this PropertyInfo property) { return Attribute.GetCustomAttributes(property, typeof(TAttribute)); } } internal static class PropertyInfoExtensions { [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>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 { [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(0)] [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] internal abstract class BuilderSkeleton<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(0)] TTypeInspector>(Func<ITypeInspector, TTypeInspector> typeInspectorFactory) where TTypeInspector : ITypeInspector { return WithTypeInspector(typeInspectorFactory, delegate(IRegistrationLocationSelectionSyntax<ITypeInspector> w) { w.OnTop(); }); } public TBuilder WithTypeInspector<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] TComponentBase, TComponent>(TComponentBase wrapped) where TComponent : TComponentBase; internal delegate TComponent WrapperFactory<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] TArgument, [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] TComponentBase, TComponent>(TComponentBase wrapped, TArgument argument) where TComponent : TComponentBase; [Flags] internal enum DefaultValuesHandling { Preserve = 0, OmitNull = 1, OmitDefaults = 2, OmitEmptyCollections = 4 } [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(0)] [<22914d04-0f5f-4178-91e3-0c1d44d2840f>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] T>(string input) { using StringReader input2 = new StringReader(input); return Deserialize<T>(input2); } public T Deserialize<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] T>(TextReader input) { return Deserialize<T>(new Parser(input)); } [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] public object Deserialize(TextReader input) { return Deserialize(input, typeof(object)); } [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] public object Deserialize(string input, Type type) { using StringReader input2 = new StringReader(input); return Deserialize(input2, type); } [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] public object Deserialize(TextReader input, Type type) { return Deserialize(new Parser(input), type); } public T Deserialize<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] T>(IParser parser) { return (T)Deserialize(parser, typeof(T)); } [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] public object Deserialize(IParser parser) { return Deserialize(parser, typeof(object)); } [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>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; } } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] [<67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] TInterface, [<67ad2be3-8b4a-441c-a5e8-013337c20b10>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())); } } [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(0)] [<22914d04-0f5f-4178-91e3-0c1d44d2840f>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<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(0)] T>() where T : IObjectGraphVisitor<Nothing> { return preProcessingPhaseVisitors.OfType<T>().Single(); } } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] [<67ad2be3-8b4a-441c-a5e8-013337c20b10>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; } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>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; } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] protected ObjectEventInfo(IObjectDescriptor source) : base(source) { } } [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(0)] [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] 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; } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] public MappingStartEventInfo(IObjectDescriptor source) : base(source) { } } internal sealed class MappingEndEventInfo : EventInfo { [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] public MappingEndEventInfo(IObjectDescriptor source) : base(source) { } } internal sealed class SequenceStartEventInfo : ObjectEventInfo { public bool IsImplicit { get; set; } public SequenceStyle Style { get; set; } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] public SequenceStartEventInfo(IObjectDescriptor source) : base(source) { } } internal sealed class SequenceEndEventInfo : EventInfo { [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] public SequenceEndEventInfo(IObjectDescriptor source) : base(source) { } } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] internal interface IAliasProvider { AnchorName GetAlias(object target); } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] internal interface IDeserializer { T Deserialize<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] T>(string input); T Deserialize<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] T>(TextReader input); [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] object Deserialize(TextReader input); [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] object Deserialize(string input, Type type); [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] object Deserialize(TextReader input, Type type); T Deserialize<[<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] T>(IParser parser); [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] object Deserialize(IParser parser); [return: <67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] object Deserialize(IParser parser, Type type); } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>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); } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] internal interface INamingConvention { string Apply(string value); } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] internal interface INodeDeserializer { bool Deserialize(IParser reader, Type expectedType, [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(new byte[] { 1, 1, 1, 2 })] Func<IParser, Type, object> nestedObjectDeserializer, [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] out object value); } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] internal interface INodeTypeResolver { bool Resolve([<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] NodeEvent nodeEvent, ref Type currentType); } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] internal interface IObjectDescriptor { [<67ad2be3-8b4a-441c-a5e8-013337c20b10>Nullable(2)] object Value { [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(2)] get; } Type Type { get; } Type StaticType { get; } ScalarStyle ScalarStyle { get; } } internal static class ObjectDescriptorExtensions { [<22914d04-0f5f-4178-91e3-0c1d44d2840f>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."); } } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] internal interface IObjectFactory { object Create(Type type); } [<22914d04-0f5f-4178-91e3-0c1d44d2840f>NullableContext(1)] internal interface IObjectGraphTraversalStrategy { void Traverse<[<67ad2be3-8b4a-441c-a5e8-013337