Decompiled source of SeedBed v1.2.4

SeedBed.dll

Decompiled 2 weeks ago
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 System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using LocalizationManager;
using Microsoft.CodeAnalysis;
using PieceManager;
using SeedBed.Functions;
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.BufferedDeserialization;
using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators;
using YamlDotNet.Serialization.Callbacks;
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: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("SeedBed")]
[assembly: AssemblyDescription("https://valheim.thunderstore.io/package/blacks7ar/SeedBed/")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyProduct("SeedBed")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("05457574-B66F-4250-8F0C-1959276A6407")]
[assembly: AssemblyFileVersion("1.2.4")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SeedBed
{
	[BepInPlugin("blacks7ar.SeedBed", "SeedBed", "1.2.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public struct ItemConversions
		{
			[YamlMember(Alias = "From", ApplyNamingConventions = false)]
			public string m_from { get; set; }

			[YamlMember(Alias = "To", ApplyNamingConventions = false)]
			public string m_to { get; set; }

			[YamlMember(Alias = "SeedAmount", ApplyNamingConventions = false)]
			public int m_seedAmount { get; set; }

			[YamlMember(Alias = "ProducedItems", ApplyNamingConventions = false)]
			public int m_producedItems { get; set; }

			public ItemConversions()
			{
				m_from = "";
				m_to = "";
				m_seedAmount = 0;
				m_producedItems = 0;
			}
		}

		[HarmonyPatch]
		private static class Patches
		{
			[HarmonyPriority(600)]
			[HarmonyPostfix]
			[HarmonyPatch(typeof(ZNetScene), "Awake")]
			private static void Awake_Postfix(ZNetScene __instance)
			{
				GetResourcesFromZNetScene(__instance);
				SetupPrefabs.SetCollector(__instance);
			}
		}

		private const string modGUID = "blacks7ar.SeedBed";

		public const string modName = "SeedBed";

		public const string modAuthor = "blacks7ar";

		public const string modVersion = "1.2.4";

		public const string modLink = "https://valheim.thunderstore.io/package/blacks7ar/SeedBed/";

		public static string ymlFileName = "blacks7ar.SeedBed.yml";

		private static string ymlFullPath;

		private static readonly Harmony _harmony;

		private static readonly ConfigSync _configSync;

		private static ConfigEntry<Toggle> _serverConfigLocked;

		public static ConfigEntry<float> _germinationDuration;

		public static ConfigEntry<float> _harvestDelay;

		public static ConfigEntry<float> _expAmountFarming;

		public static ConfigEntry<float> _expAmountHerbalist;

		public static List<ItemConversions> _itemConversions;

		private static readonly CustomSyncedValue<string> _ItemConversionsSyncedValue;

		public static bool _hasFarmingMod;

		public static bool _hasHerbalistMod;

		public static readonly IDictionary<string, GameObject> _ResourceDB;

		public static readonly HashSet<string> _herbalPlants;

		public static readonly HashSet<string> _notAllowedItems;

		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;
		}

		private static void YmlDataWatcher()
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ymlFileName);
			fileSystemWatcher.Changed += YmlDataChanged;
			fileSystemWatcher.Created += YmlDataChanged;
			fileSystemWatcher.Renamed += YmlDataChanged;
			fileSystemWatcher.IncludeSubdirectories = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		private static void YmlDataChanged(object sender, FileSystemEventArgs e)
		{
			if (!File.Exists(ymlFullPath))
			{
				return;
			}
			try
			{
				Logging.LogDebug("YmlDataWatcher called..");
				_ItemConversionsSyncedValue.AssignLocalValue(File.ReadAllText(ymlFullPath));
			}
			catch
			{
				Logging.LogError("There was an issue loading your " + ymlFileName);
				Logging.LogError("Please check your entries for spelling and format!");
			}
		}

		public void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: 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);
			_germinationDuration = config("2- General", "Germination Duration", 4000f, new ConfigDescription("How many seconds would it take to finished germination.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(60f, 5000f), Array.Empty<object>()));
			_harvestDelay = config("2- General", "Harvest Delay", 1.5f, new ConfigDescription("Delay in seconds before the produced items spawns.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 3f), Array.Empty<object>()));
			_hasFarmingMod = Helper.CheckFarmingMod();
			if (_hasFarmingMod)
			{
				_expAmountFarming = config("3- Farming", "Exp Amount", 1f, new ConfigDescription("Exp amount given to Farming skill when harvesting from seedbed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 1f), Array.Empty<object>()));
			}
			_hasHerbalistMod = Helper.CheckHerbalistMod();
			if (_hasHerbalistMod)
			{
				_expAmountHerbalist = config("4- Herbalist", "Exp Amount", 1f, new ConfigDescription("Exp amount given to Herbalist skill when harvesting herbal plants from the seedbed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 5f), Array.Empty<object>()));
			}
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmony.PatchAll(executingAssembly);
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
			((BaseUnityPlugin)this).Config.Save();
			if (!File.Exists(ymlFullPath))
			{
				CreateItemConversionYml();
				Logging.LogWarning("File not found - " + ymlFileName + "!");
				Logging.LogWarning("Creating a new one..");
			}
			_ItemConversionsSyncedValue.ValueChanged += ItemConversionsSyncedValueOnValueChanged;
			_ItemConversionsSyncedValue.AssignLocalValue(File.ReadAllText(ymlFullPath));
			SetupPrefabs.Init();
			YmlDataWatcher();
		}

		public static void ItemConversionsSyncedValueOnValueChanged()
		{
			Logging.LogDebug("ItemConversionsSyncedValueOnChanged called..");
			try
			{
				_itemConversions.Clear();
				_itemConversions = new DeserializerBuilder().Build().Deserialize<List<ItemConversions>>(_ItemConversionsSyncedValue.Value);
			}
			catch (Exception arg)
			{
				Logging.LogError($"Failed to deserializer {ymlFileName}: {arg}");
			}
		}

		private void OnDestroy()
		{
			((BaseUnityPlugin)this).Config.Save();
		}

		private static void GetResourcesFromZNetScene(ZNetScene zNetScene)
		{
			if (!Helper.ZNetSceneAwake())
			{
				return;
			}
			_ResourceDB.Clear();
			foreach (GameObject prefab in zNetScene.m_prefabs)
			{
				if (!Object.op_Implicit((Object)(object)prefab.GetComponent<Pickable>()) || ((Object)prefab).name.ToLower().EndsWith("_wild") || ((Object)prefab).name.ToLower().Contains("dvergerthing") || ((Object)prefab).name.ToLower().Contains("_wild_"))
				{
					continue;
				}
				Pickable component = prefab.GetComponent<Pickable>();
				if ((Object)(object)component.m_itemPrefab == (Object)null)
				{
					continue;
				}
				string name = component.m_itemPrefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_name;
				if (_notAllowedItems.Contains(name))
				{
					continue;
				}
				string key = name;
				if (!(name == "$item_carrot"))
				{
					switch (name)
					{
					case "$item_onion":
					case "$item_turnip":
					case "$bca_chilipepper":
					case "$bca_tomato":
						break;
					default:
						goto IL_0115;
					}
				}
				bool flag = true;
				goto IL_0118;
				IL_0115:
				flag = false;
				goto IL_0118;
				IL_0118:
				if (flag)
				{
					key = name + "seeds";
				}
				else
				{
					switch (name)
					{
					case "$item_carrotseeds":
					case "$item_onionseeds":
					case "$item_turnipseeds":
						flag = true;
						break;
					default:
						flag = false;
						break;
					}
					if (flag)
					{
						key = name.Replace("seeds", "");
					}
				}
				if (!_ResourceDB.ContainsKey(key))
				{
					_ResourceDB.Add(key, prefab);
				}
				if (((Object)prefab).name.ToLower().StartsWith("bca_") && ((Object)prefab).name.ToLower().EndsWith("plant") && !_ResourceDB.ContainsKey(name))
				{
					_ResourceDB.Add(name, prefab);
				}
			}
		}

		private static void CreateItemConversionYml()
		{
			List<ItemConversions> graph = new List<ItemConversions>
			{
				new ItemConversions
				{
					m_from = "Barley",
					m_to = "Barley",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "CarrotSeeds",
					m_to = "Carrot",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "Dandelion",
					m_to = "Dandelion",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "Fiddleheadfern",
					m_to = "Fiddleheadfern",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "Flax",
					m_to = "Flax",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "Mushroom",
					m_to = "Mushroom",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "MushroomMagecap",
					m_to = "MushroomMagecap",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "MushroomYellow",
					m_to = "MushroomYellow",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "MushroomJotunPuffs",
					m_to = "MushroomJotunPuffs",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "OnionSeeds",
					m_to = "Onion",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "Carrot",
					m_to = "CarrotSeeds",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "Onion",
					m_to = "OnionSeeds",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "Turnip",
					m_to = "TurnipSeeds",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "MushroomSmokePuff",
					m_to = "MushroomSmokePuff",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "Thistle",
					m_to = "Thistle",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "TurnipSeeds",
					m_to = "Turnip",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "Blueberries",
					m_to = "Blueberries",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "Cloudberry",
					m_to = "Cloudberry",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "Raspberry",
					m_to = "Raspberry",
					m_seedAmount = 5,
					m_producedItems = 15
				},
				new ItemConversions
				{
					m_from = "Vineberry",
					m_to = "Vineberry",
					m_seedAmount = 5,
					m_producedItems = 15
				}
			};
			string contents = new SerializerBuilder().Build().Serialize(graph);
			File.WriteAllText(ymlFullPath, contents);
		}

		static Plugin()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ymlFullPath = configPath + directorySeparatorChar + ymlFileName;
			_harmony = new Harmony("blacks7ar.SeedBed");
			_configSync = new ConfigSync("blacks7ar.SeedBed")
			{
				DisplayName = "SeedBed",
				CurrentVersion = "1.2.4",
				MinimumRequiredVersion = "1.2.4"
			};
			_itemConversions = new List<ItemConversions>();
			_ItemConversionsSyncedValue = new CustomSyncedValue<string>(_configSync, "Item Conversions", "");
			_ResourceDB = new Dictionary<string, GameObject>();
			_herbalPlants = new HashSet<string> { "$bh_boswellia", "$bh_chamomile", "$bh_chicory", "$bh_daisy", "$bh_echinacea", "$bh_lavender", "$item_dandelion", "$item_thistle" };
			_notAllowedItems = new HashSet<string>
			{
				"$item_grausten", "$item_blackcore", "$item_ironore", "$item_wood", "$item_charredskull", "$item_dragonegg", "$item_lantern", "$item_coins", "$item_dvergrtankard", "$item_fishingrod",
				"$item_flint", "$item_bonefragments", "$item_wolfhairbundle", "$item_entrails", "$item_moltencore", "$item_crystal", "$item_obsidian", "$item_pot_shard_green", "$item_royaljelly", "$item_stone",
				"$item_sulfurstone", "$item_surtlingcore", "$item_Dyrnwyn_hilt", "$item_Dyrnwyn_blade", "$item_tar", "$item_tinore", "$item_voltureegg", "$item_Dyrnwyn_tip", "$item_goblintotem", "$item_wisp"
			};
		}
	}
}
namespace SeedBed.Functions
{
	public class Germination : MonoBehaviour, Hoverable, Interactable
	{
		private class ItemConversion
		{
			public ItemDrop m_from;

			public ItemDrop m_to;

			public int m_seedAmount = 5;

			public int m_producedItems = 15;
		}

		private enum Status
		{
			Empty,
			Germinating,
			Ready
		}

		public string m_name = "Seed Bed";

		public float m_germinationDuration = 2400f;

		public GameObject m_sapling;

		public GameObject m_grown;

		public GameObject m_saplingT5x5;

		public GameObject m_grownT5x5;

		public GameObject m_saplingT3x1;

		public GameObject m_grownT3x1;

		public GameObject m_saplingVine;

		public GameObject m_grownVine;

		public GameObject m_saplingVineWall;

		public GameObject m_GrownVineWall;

		public EffectList m_addEffects = new EffectList();

		public EffectList m_harvestEffects = new EffectList();

		public EffectList m_spawnEffects = new EffectList();

		public Switch m_addSwitch;

		public Switch m_harvestSwitch;

		public float m_harvestDelay = 1.5f;

		public Transform m_spawnPoint;

		private List<ItemConversion> m_conversion = new List<ItemConversion>();

		public ZNetView m_nview;

		public string m_delayedTapItem = "";

		public void Awake()
		{
			m_nview = ((Component)this).GetComponent<ZNetView>();
			SetTransforms();
			SetConversion();
			if (!((Object)(object)m_nview == (Object)null) && m_nview.GetZDO() != null)
			{
				DisableGameObject();
				ReapplyVisuals();
				m_nview.Register<string>("RPC_AddItem", (Action<long, string>)RPC_AddItem);
				m_nview.Register("RPC_Tap", (Action<long>)RPC_Tap);
				((MonoBehaviour)this).InvokeRepeating("SlowUpdate", (GetStatus() == Status.Germinating) ? 2f : 0f, 2f);
				WearNTear component = ((Component)this).GetComponent<WearNTear>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(OnDestroyed));
				}
			}
		}

		public void DisableGameObject()
		{
			m_sapling.SetActive(false);
			m_grown.SetActive(false);
		}

		public void SetTransforms()
		{
			if (!((Object)(object)m_nview == (Object)null) && m_nview.GetZDO() != null)
			{
				m_sapling = ((Component)((Component)this).transform.Find("_sapling")).gameObject;
				m_grown = ((Component)((Component)this).transform.Find("_grown")).gameObject;
				m_saplingT5x5 = ((Component)m_sapling.transform.Find("_sapling5x5")).gameObject;
				m_grownT5x5 = ((Component)m_grown.transform.Find("_grown5x5")).gameObject;
				m_saplingT3x1 = ((Component)m_sapling.transform.Find("_sapling3x1")).gameObject;
				m_grownT3x1 = ((Component)m_grown.transform.Find("_grown3x1")).gameObject;
				m_saplingVine = ((Component)m_sapling.transform.Find("_saplingvine")).gameObject;
				m_saplingVineWall = ((Component)m_sapling.transform.Find("deco")).gameObject;
				m_grownVine = ((Component)m_grown.transform.Find("_grownvine")).gameObject;
				m_GrownVineWall = ((Component)m_grown.transform.Find("deco")).gameObject;
				m_addSwitch = ((Component)((Component)this).transform.Find("add_seeds")).GetComponent<Switch>();
				m_harvestSwitch = ((Component)((Component)this).transform.Find("collect_produce")).GetComponent<Switch>();
				m_spawnPoint = ((Component)this).transform.Find("spawnpoint");
			}
		}

		public void SetConversion()
		{
			foreach (List<ItemConversion> item in from conversion in Plugin._itemConversions.Where(delegate(Plugin.ItemConversions data)
				{
					ObjectDB instance5 = ObjectDB.instance;
					Plugin.ItemConversions itemConversions3 = data;
					if ((Object)(object)instance5.GetItemPrefab(StringExtensionMethods.GetStableHashCode(itemConversions3.m_from)) != (Object)null)
					{
						ObjectDB instance6 = ObjectDB.instance;
						itemConversions3 = data;
						return (Object)(object)instance6.GetItemPrefab(StringExtensionMethods.GetStableHashCode(itemConversions3.m_to)) != (Object)null;
					}
					return false;
				}).Where(delegate(Plugin.ItemConversions data)
				{
					ObjectDB instance3 = ObjectDB.instance;
					Plugin.ItemConversions itemConversions2 = data;
					if (Object.op_Implicit((Object)(object)instance3.GetItemPrefab(StringExtensionMethods.GetStableHashCode(itemConversions2.m_from)).GetComponent<ItemDrop>()))
					{
						ObjectDB instance4 = ObjectDB.instance;
						itemConversions2 = data;
						return Object.op_Implicit((Object)(object)instance4.GetItemPrefab(StringExtensionMethods.GetStableHashCode(itemConversions2.m_to)).GetComponent<ItemDrop>());
					}
					return false;
				}).Select(delegate(Plugin.ItemConversions data)
				{
					List<ItemConversion> list = new List<ItemConversion>();
					ItemConversion itemConversion = new ItemConversion();
					ObjectDB instance = ObjectDB.instance;
					Plugin.ItemConversions itemConversions = data;
					itemConversion.m_from = instance.GetItemPrefab(StringExtensionMethods.GetStableHashCode(itemConversions.m_from)).GetComponent<ItemDrop>();
					ObjectDB instance2 = ObjectDB.instance;
					itemConversions = data;
					itemConversion.m_to = instance2.GetItemPrefab(StringExtensionMethods.GetStableHashCode(itemConversions.m_to)).GetComponent<ItemDrop>();
					itemConversions = data;
					itemConversion.m_seedAmount = itemConversions.m_seedAmount;
					itemConversions = data;
					itemConversion.m_producedItems = itemConversions.m_producedItems;
					list.Add(itemConversion);
					return list;
				})
				from item in conversion
				where !m_conversion.Contains(item)
				select conversion)
			{
				m_conversion.AddRange(item);
			}
			Logging.LogDebug("Added " + m_conversion.Count + " items to conversion list from " + Plugin._itemConversions.Count + " items in " + Plugin.ymlFileName + " file.");
		}

		public void DropAllItems()
		{
			Status status = GetStatus();
			string content = GetContent();
			if (string.IsNullOrEmpty(content))
			{
				return;
			}
			if (status == Status.Ready)
			{
				ItemConversion itemConversion = GetItemConversion(content);
				if (itemConversion != null)
				{
					for (int i = 0; i < itemConversion.m_producedItems; i++)
					{
						drop(itemConversion.m_to);
					}
				}
			}
			else
			{
				ItemConversion itemConversion2 = GetItemConversion(content);
				if (itemConversion2 != null)
				{
					for (int j = 0; j < itemConversion2.m_seedAmount; j++)
					{
						drop(itemConversion2.m_from);
					}
				}
			}
			m_nview.GetZDO().Set(ZDOVars.s_content, "");
			m_nview.GetZDO().Set(ZDOVars.s_startTime, 0, false);
			void drop(ItemDrop item)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f;
				Quaternion val2 = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f);
				ItemDrop.OnCreateNew(Object.Instantiate<GameObject>(((Component)item).gameObject, val, val2));
			}
		}

		public void OnDestroyed()
		{
			m_nview.IsOwner();
			DropAllItems();
		}

		public string GetHoverName()
		{
			return m_name;
		}

		public string GetHoverText()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, false, false))
			{
				return Localization.instance.Localize(m_name + "\n$bsb_noaccess");
			}
			switch (GetStatus())
			{
			case Status.Ready:
			{
				string contentName2 = GetContentName();
				return Localization.instance.Localize(m_name + "\n( " + contentName2 + ", $bsb_germentation_ready )\n[<color=yellow><b>$KEY_Use</b></color>] $bsb_seedbed_harvest");
			}
			case Status.Germinating:
			{
				string contentName = GetContentName();
				return Localization.instance.Localize(m_name + " <color=orange><b>" + TimeLeft(this) + "</b></color>\n( " + contentName + ", $bsb_seedbed_germinating )");
			}
			case Status.Empty:
				return Localization.instance.Localize(m_name + " ( $bsb_seedbed_empty )\n[<color=yellow><b>$KEY_Use</b></color>] $bsb_seedbed_add");
			default:
				return m_name;
			}
		}

		public bool Interact(Humanoid user, bool hold, bool alt)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			if (hold)
			{
				return false;
			}
			if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false))
			{
				return false;
			}
			switch (GetStatus())
			{
			case Status.Empty:
			{
				ItemData val = FindPlantableSeed(user.GetInventory());
				if (val == null)
				{
					((Character)user).Message((MessageType)2, "$bsb_notenoughseeds", 0, (Sprite)null);
					return false;
				}
				ItemConversion itemConversion2 = GetItemConversion(((Object)val.m_dropPrefab).name);
				AddItem(user, val, itemConversion2.m_seedAmount);
				return true;
			}
			case Status.Ready:
				m_nview.InvokeRPC("RPC_Tap", Array.Empty<object>());
				if (Plugin._hasFarmingMod)
				{
					((Character)user).GetSkills().m_skillData.TryGetValue((SkillType)Mathf.Abs(StringExtensionMethods.GetStableHashCode("Farming")), out var value);
					if (value != null)
					{
						((Character)user).RaiseSkill(value.m_info.m_skill, Plugin._expAmountFarming.Value);
					}
				}
				if (Plugin._hasHerbalistMod)
				{
					ItemConversion itemConversion = GetItemConversion(m_delayedTapItem);
					if (Plugin._herbalPlants.Contains(itemConversion.m_to.m_itemData.m_shared.m_name))
					{
						((Character)user).GetSkills().m_skillData.TryGetValue((SkillType)Mathf.Abs(StringExtensionMethods.GetStableHashCode("Herbalist")), out var value2);
						if (value2 != null)
						{
							((Character)user).RaiseSkill(value2.m_info.m_skill, Plugin._expAmountHerbalist.Value);
						}
					}
				}
				return true;
			default:
				return false;
			}
		}

		public bool UseItem(Humanoid user, ItemData item)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false))
			{
				return false;
			}
			ItemConversion itemConversion = GetItemConversion(((Object)item.m_dropPrefab).name);
			if (itemConversion == null)
			{
				return false;
			}
			if (item.m_stack < itemConversion.m_seedAmount)
			{
				((Character)user).Message((MessageType)2, "$bsb_notenoughseeds", 0, (Sprite)null);
				return false;
			}
			if (!AddItem(user, item, itemConversion.m_seedAmount))
			{
				return false;
			}
			return true;
		}

		public void ReapplyVisuals()
		{
			string fromName = GetFromName();
			SetVisuals(fromName);
		}

		public void SlowUpdate()
		{
			switch (GetStatus())
			{
			case Status.Empty:
				DisableGameObject();
				break;
			case Status.Germinating:
				m_sapling.SetActive(true);
				m_grown.SetActive(false);
				break;
			case Status.Ready:
				m_sapling.SetActive(false);
				m_grown.SetActive(true);
				break;
			}
		}

		private Status GetStatus()
		{
			if (string.IsNullOrEmpty(GetContent()))
			{
				return Status.Empty;
			}
			if (GetGerminationTime() > (double)m_germinationDuration)
			{
				return Status.Ready;
			}
			return Status.Germinating;
		}

		private bool AddItem(Humanoid user, ItemData item, int amount)
		{
			if (GetStatus() != 0)
			{
				return false;
			}
			if (!IsItemAllowed(item))
			{
				return false;
			}
			if (!user.GetInventory().RemoveItem(item, amount))
			{
				return false;
			}
			m_nview.InvokeRPC("RPC_AddItem", new object[1] { ((Object)item.m_dropPrefab).name });
			SetVisuals(item.m_shared.m_name);
			return true;
		}

		public void ResetVisuals()
		{
			for (int i = 0; i < m_saplingT5x5.transform.childCount; i++)
			{
				GameObject gameObject = ((Component)m_saplingT5x5.transform.GetChild(i)).gameObject;
				for (int j = 0; j < gameObject.transform.childCount; j++)
				{
					Object.Destroy((Object)(object)((Component)gameObject.transform.GetChild(j)).gameObject);
				}
			}
			for (int k = 0; k < m_grownT5x5.transform.childCount; k++)
			{
				GameObject gameObject2 = ((Component)m_grownT5x5.transform.GetChild(k)).gameObject;
				for (int l = 0; l < gameObject2.transform.childCount; l++)
				{
					Object.Destroy((Object)(object)((Component)gameObject2.transform.GetChild(l)).gameObject);
				}
			}
			for (int m = 0; m < m_saplingT3x1.transform.childCount; m++)
			{
				GameObject gameObject3 = ((Component)m_saplingT3x1.transform.GetChild(m)).gameObject;
				for (int n = 0; n < gameObject3.transform.childCount; n++)
				{
					Object.Destroy((Object)(object)((Component)gameObject3.transform.GetChild(n)).gameObject);
				}
			}
			for (int num = 0; num < m_grownT3x1.transform.childCount; num++)
			{
				GameObject gameObject4 = ((Component)m_grownT3x1.transform.GetChild(num)).gameObject;
				for (int num2 = 0; num2 < gameObject4.transform.childCount; num2++)
				{
					Object.Destroy((Object)(object)((Component)gameObject4.transform.GetChild(num2)).gameObject);
				}
			}
			for (int num3 = 0; num3 < m_saplingVine.transform.childCount; num3++)
			{
				GameObject gameObject5 = ((Component)m_saplingVine.transform.GetChild(num3)).gameObject;
				for (int num4 = 0; num4 < gameObject5.transform.childCount; num4++)
				{
					Object.Destroy((Object)(object)((Component)gameObject5.transform.GetChild(num4)).gameObject);
				}
			}
			for (int num5 = 0; num5 < m_grownVine.transform.childCount; num5++)
			{
				GameObject gameObject6 = ((Component)m_grownVine.transform.GetChild(num5)).gameObject;
				for (int num6 = 0; num6 < gameObject6.transform.childCount; num6++)
				{
					Object.Destroy((Object)(object)((Component)gameObject6.transform.GetChild(num6)).gameObject);
				}
			}
		}

		public void SetVisuals(string itemName)
		{
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_0528: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
			foreach (string key in Plugin._ResourceDB.Keys)
			{
				if (itemName != key)
				{
					continue;
				}
				string text = ((Object)Plugin._ResourceDB[key]).name.ToLower();
				if (text.Contains("pickable_"))
				{
					for (int i = 0; i < Plugin._ResourceDB[key].transform.childCount; i++)
					{
						GameObject gameObject = ((Component)Plugin._ResourceDB[key].transform.GetChild(i)).gameObject;
						for (int j = 0; j < m_saplingT5x5.transform.childCount; j++)
						{
							GameObject val = Object.Instantiate<GameObject>(gameObject, m_saplingT5x5.transform.GetChild(j));
							((Object)val).name = ((Object)Plugin._ResourceDB[key]).name;
							val.transform.SetParent(m_saplingT5x5.transform.GetChild(j));
							val.transform.localPosition = new Vector3(0f, 0f, 0f);
							m_saplingT5x5.ChangeColor(new Color(0f, 1f, 0.45f));
							m_saplingVineWall.SetActive(false);
							for (int k = 0; k < val.transform.childCount; k++)
							{
								((Component)val.transform.GetChild(k)).gameObject.RemoveComponent(typeof(ParticleSystem));
								((Component)val.transform.GetChild(k)).gameObject.RemoveComponent(typeof(Light));
								((Component)val.transform.GetChild(k)).gameObject.RemoveComponent(typeof(LightLod));
							}
							val.RemoveComponent(typeof(Light));
							val.RemoveComponent(typeof(ParticleSystem));
							val.RemoveComponent(typeof(LightLod));
						}
						for (int l = 0; l < m_grownT5x5.transform.childCount; l++)
						{
							GameObject obj = Object.Instantiate<GameObject>(gameObject, m_grownT5x5.transform.GetChild(l));
							((Object)obj).name = ((Object)Plugin._ResourceDB[key]).name;
							obj.transform.SetParent(m_grownT5x5.transform.GetChild(l));
							obj.transform.localPosition = new Vector3(0f, 0f, 0f);
							m_GrownVineWall.SetActive(false);
						}
					}
				}
				else if (text.Contains("blueberrybush") || text.Contains("raspberrybush") || text.EndsWith("plant"))
				{
					for (int m = 0; m < Plugin._ResourceDB[key].transform.childCount; m++)
					{
						GameObject gameObject2 = ((Component)Plugin._ResourceDB[key].transform.GetChild(m)).gameObject;
						for (int n = 0; n < m_saplingT3x1.transform.childCount; n++)
						{
							GameObject obj2 = Object.Instantiate<GameObject>(gameObject2, m_saplingT3x1.transform.GetChild(n));
							((Object)obj2).name = ((Object)Plugin._ResourceDB[key]).name;
							obj2.transform.SetParent(m_saplingT3x1.transform.GetChild(n));
							obj2.transform.localPosition = new Vector3(0f, 0f, 0f);
							m_saplingT3x1.ChangeColor(new Color(0f, 1f, 0.45f));
							m_saplingVineWall.SetActive(false);
						}
						for (int num = 0; num < m_grownT3x1.transform.childCount; num++)
						{
							GameObject obj3 = Object.Instantiate<GameObject>(gameObject2, m_grownT3x1.transform.GetChild(num));
							((Object)obj3).name = ((Object)Plugin._ResourceDB[key]).name;
							obj3.transform.SetParent(m_grownT3x1.transform.GetChild(num));
							obj3.transform.localPosition = new Vector3(0f, 0f, 0f);
							m_GrownVineWall.SetActive(false);
						}
					}
				}
				else if (text.Contains("cloudberrybush"))
				{
					for (int num2 = 0; num2 < Plugin._ResourceDB[key].transform.childCount; num2++)
					{
						GameObject gameObject3 = ((Component)Plugin._ResourceDB[key].transform.GetChild(num2)).gameObject;
						for (int num3 = 0; num3 < m_saplingT5x5.transform.childCount; num3++)
						{
							GameObject obj4 = Object.Instantiate<GameObject>(gameObject3, m_saplingT5x5.transform.GetChild(num3));
							((Object)obj4).name = ((Object)Plugin._ResourceDB[key]).name;
							obj4.transform.SetParent(m_saplingT5x5.transform.GetChild(num3));
							obj4.transform.localPosition = new Vector3(0f, 0f, 0f);
							m_saplingT5x5.ChangeColor(new Color(0f, 1f, 0.45f));
							m_saplingVineWall.SetActive(false);
						}
						for (int num4 = 0; num4 < m_grownT5x5.transform.childCount; num4++)
						{
							GameObject obj5 = Object.Instantiate<GameObject>(gameObject3, m_grownT5x5.transform.GetChild(num4));
							((Object)obj5).name = ((Object)Plugin._ResourceDB[key]).name;
							obj5.transform.SetParent(m_grownT5x5.transform.GetChild(num4));
							obj5.transform.localPosition = new Vector3(0f, 0f, 0f);
							m_GrownVineWall.SetActive(false);
						}
					}
				}
				else
				{
					if (!text.Contains("vineash"))
					{
						continue;
					}
					for (int num5 = 0; num5 < Plugin._ResourceDB[key].transform.childCount; num5++)
					{
						GameObject gameObject4 = ((Component)Plugin._ResourceDB[key].transform.GetChild(num5)).gameObject;
						for (int num6 = 0; num6 < m_saplingVine.transform.childCount; num6++)
						{
							GameObject obj6 = Object.Instantiate<GameObject>(gameObject4, m_saplingVine.transform.GetChild(num6));
							((Object)obj6).name = ((Object)Plugin._ResourceDB[key]).name;
							obj6.transform.SetParent(m_saplingVine.transform.GetChild(num6));
							obj6.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f);
							m_saplingVine.ChangeColor(new Color(0f, 1f, 0.45f));
						}
						for (int num7 = 0; num7 < m_grownVine.transform.childCount; num7++)
						{
							GameObject obj7 = Object.Instantiate<GameObject>(gameObject4, m_grownVine.transform.GetChild(num7));
							((Object)obj7).name = ((Object)Plugin._ResourceDB[key]).name;
							obj7.transform.SetParent(m_grownVine.transform.GetChild(num7));
						}
					}
					m_saplingVineWall.SetActive(true);
					m_GrownVineWall.SetActive(true);
				}
			}
		}

		public void RPC_AddItem(long sender, string name)
		{
			//IL_0036: 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)
			if (m_nview.IsOwner() && GetStatus() == Status.Empty)
			{
				if (!IsItemAllowed(name))
				{
					ZLog.DevLog((object)"Item not allowed");
					return;
				}
				m_addEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1);
				m_nview.GetZDO().Set(ZDOVars.s_content, name);
				m_nview.GetZDO().Set(ZDOVars.s_startTime, ZNet.instance.GetTime().Ticks);
			}
		}

		public void RPC_Tap(long sender)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (m_nview.IsOwner() && GetStatus() == Status.Ready)
			{
				m_delayedTapItem = GetContent();
				((MonoBehaviour)this).Invoke("DelayedTap", m_harvestDelay);
				m_harvestEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1);
				m_nview.GetZDO().Set(ZDOVars.s_content, "");
				m_nview.GetZDO().Set(ZDOVars.s_startTime, 0, false);
				ResetVisuals();
			}
		}

		public void DelayedTap()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			m_spawnEffects.Create(((Component)this).transform.position, Quaternion.identity, (Transform)null, 1f, -1);
			ItemConversion itemConversion = GetItemConversion(m_delayedTapItem);
			if (itemConversion != null)
			{
				for (int i = 0; i < itemConversion.m_producedItems; i++)
				{
					Vector3 val = m_spawnPoint.position + Vector3.up * 0.3f;
					ItemDrop.OnCreateNew(Object.Instantiate<ItemDrop>(itemConversion.m_to, val, Quaternion.identity));
				}
			}
		}

		public void ResetGerminationTimer()
		{
			if (GetStatus() == Status.Germinating)
			{
				m_nview.GetZDO().Set(ZDOVars.s_startTime, ZNet.instance.GetTime().Ticks);
			}
		}

		private double GetGerminationTime()
		{
			DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(ZDOVars.s_startTime, 0L));
			if (dateTime.Ticks == 0L)
			{
				return -1.0;
			}
			return (ZNet.instance.GetTime() - dateTime).TotalSeconds;
		}

		private string GetFromName()
		{
			string content = GetContent();
			if (string.IsNullOrEmpty(content))
			{
				return "";
			}
			ItemConversion itemConversion = GetItemConversion(content);
			if (itemConversion == null)
			{
				return "Invalid";
			}
			return itemConversion.m_from.m_itemData.m_shared.m_name;
		}

		private string GetContentName()
		{
			string content = GetContent();
			if (string.IsNullOrEmpty(content))
			{
				return "";
			}
			ItemConversion itemConversion = GetItemConversion(content);
			if (itemConversion == null)
			{
				return "Invalid";
			}
			return itemConversion.m_to.m_itemData.m_shared.m_name;
		}

		private string GetContent()
		{
			if (m_nview.GetZDO() != null)
			{
				return m_nview.GetZDO().GetString(ZDOVars.s_content, "");
			}
			return "";
		}

		private bool IsItemAllowed(ItemData item)
		{
			return IsItemAllowed(((Object)item.m_dropPrefab).name);
		}

		private bool IsItemAllowed(string itemName)
		{
			return m_conversion.Any((ItemConversion item) => ((Object)((Component)item.m_from).gameObject).name == itemName);
		}

		private ItemData FindPlantableSeed(Inventory inventory)
		{
			return (from item2 in m_conversion
				let item = inventory.GetItem(item2.m_from.m_itemData.m_shared.m_name, -1, false)
				where item != null
				where item.m_stack >= item2.m_seedAmount
				select item).FirstOrDefault();
		}

		private ItemConversion GetItemConversion(string itemName)
		{
			return m_conversion.FirstOrDefault((ItemConversion item) => ((Object)((Component)item.m_from).gameObject).name == itemName);
		}

		private static string TimeLeft(Germination germination)
		{
			double num = (double)germination.m_germinationDuration - germination.GetGerminationTime();
			float num2 = Mathf.FloorToInt((float)((int)num / 60));
			float num3 = Mathf.FloorToInt((float)((int)num % 60));
			return $"({num2:00}:{num3:00})";
		}
	}
	public class ConfigurationManagerAttributes
	{
		[UsedImplicitly]
		public int? Order;

		[UsedImplicitly]
		public bool? Browsable;

		[UsedImplicitly]
		public string Category;

		[UsedImplicitly]
		public Action<ConfigEntryBase> CustomDrawer;
	}
	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 bool CheckFarmingMod()
		{
			if (!Chainloader.PluginInfos.ContainsKey("org.bepinex.plugins.farming"))
			{
				return false;
			}
			Logging.LogInfo("Farming mod detected! Applying patch..");
			return true;
		}

		public static bool CheckHerbalistMod()
		{
			if (!Chainloader.PluginInfos.ContainsKey("blacks7ar.Herbalist"))
			{
				return false;
			}
			Logging.LogInfo("Herbalist mod detected! Applying patch..");
			return true;
		}

		public static void ChangeColor(this GameObject gameObject, Color color)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)gameObject == (Object)null)
			{
				return;
			}
			Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(true);
			if (componentsInChildren == null || componentsInChildren.Length == 0)
			{
				return;
			}
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Material material = componentsInChildren[i].material;
				if (!((Object)(object)material == (Object)null))
				{
					material.SetColor("_Color", color);
				}
			}
		}

		public static void RemoveComponent(this GameObject gameObject, Type type)
		{
			Component component = gameObject.GetComponent(type);
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			if ((Object)(object)gameObject.GetComponentInChildren(type) != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
		}
	}
	public static class Logging
	{
		private static readonly ManualLogSource SBLogger = Logger.CreateLogSource("SeedBed");

		public static void LogDebug(string debug)
		{
			SBLogger.LogDebug((object)debug);
		}

		public static void LogInfo(string info)
		{
			SBLogger.LogInfo((object)info);
		}

		public static void LogWarning(string warning)
		{
			SBLogger.LogWarning((object)warning);
		}

		public static void LogError(string error)
		{
			SBLogger.LogError((object)error);
		}
	}
	public static class SetupPrefabs
	{
		private static AssetBundle _seedBundle;

		public static void Init()
		{
			_seedBundle = PiecePrefabManager.RegisterAssetBundle("seedbedbundle");
			BuildPiece buildPiece = new BuildPiece(_seedBundle, "BSB_SeedBed");
			buildPiece.Crafting.Set(CraftingTable.Workbench);
			buildPiece.Category.Set("CollectorSeries");
			buildPiece.RequiredItems.Add("YmirRemains", 5, recover: true);
			buildPiece.RequiredItems.Add("BronzeNails", 8, recover: true);
			buildPiece.RequiredItems.Add("Wood", 18, recover: true);
			buildPiece.SpecialProperties = new SpecialProperties
			{
				AdminOnly = false,
				NoConfig = false
			};
			ShaderReplacer.Replace(buildPiece.Prefab);
			if (!Object.op_Implicit((Object)(object)buildPiece.Prefab.GetComponent<Germination>()))
			{
				buildPiece.Prefab.AddComponent<Germination>();
			}
			PiecePrefabManager.RegisterPrefab(_seedBundle, "bsb_sfx_build_hammer_wood");
			PiecePrefabManager.RegisterPrefab(_seedBundle, "bsb_sfx_wood_destroyed");
			PiecePrefabManager.RegisterPrefab(_seedBundle, "bsb_vfx_Place_workbench");
			PiecePrefabManager.RegisterPrefab(_seedBundle, "bsb_vfx_SawDust");
		}

		public static void SetCollector(ZNetScene zNetScene)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			if (Helper.ZNetSceneAwake())
			{
				Germination component = _seedBundle.LoadAsset<GameObject>("BSB_SeedBed").GetComponent<Germination>();
				component.m_name = "$bsb_seedbed";
				Plugin._germinationDuration.SettingChanged += delegate
				{
					component.m_germinationDuration = Plugin._germinationDuration.Value;
				};
				component.m_germinationDuration = Plugin._germinationDuration.Value;
				component.m_addEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2]
				{
					new EffectData
					{
						m_prefab = zNetScene.GetPrefab("sfx_fermenter_add"),
						m_enabled = true,
						m_variant = -1
					},
					new EffectData
					{
						m_prefab = zNetScene.GetPrefab("vfx_fermenter_add"),
						m_enabled = true,
						m_variant = -1
					}
				};
				component.m_harvestEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1]
				{
					new EffectData
					{
						m_prefab = zNetScene.GetPrefab("sfx_pickable_pick"),
						m_enabled = true,
						m_variant = -1
					}
				};
				component.m_spawnEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2]
				{
					new EffectData
					{
						m_prefab = zNetScene.GetPrefab("sfx_lootspawn"),
						m_enabled = true,
						m_variant = -1
					},
					new EffectData
					{
						m_prefab = zNetScene.GetPrefab("vfx_lootspawn"),
						m_enabled = true,
						m_variant = -1
					}
				};
				Plugin._harvestDelay.SettingChanged += delegate
				{
					component.m_harvestDelay = Plugin._harvestDelay.Value;
				};
				component.m_harvestDelay = Plugin._harvestDelay.Value;
			}
		}
	}
	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,
		Off
	}
}
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]
	[<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	internal sealed class <bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace LocalizationManager
{
	[<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(0)]
	[PublicAPI]
	[<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(1)]
	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 <c1115aee-2ebb-4910-9809-e81b758f145c>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 <c1115aee-2ebb-4910-9809-e81b758f145c>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 System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public <c1115aee-2ebb-4910-9809-e81b758f145c>MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public <c1115aee-2ebb-4910-9809-e81b758f145c>NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public <c1115aee-2ebb-4910-9809-e81b758f145c>NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
}
namespace System.Collections.Generic
{
	internal static class DeconstructionExtensions
	{
		public static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> pair, out TKey key, out TValue value)
		{
			key = pair.Key;
			value = pair.Value;
		}
	}
}
namespace YamlDotNet
{
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>CultureInfoAdapter : CultureInfo
	{
		private readonly IFormatProvider provider;

		public <c1115aee-2ebb-4910-9809-e81b758f145c>CultureInfoAdapter(CultureInfo baseCulture, IFormatProvider provider)
			: base(baseCulture.LCID)
		{
			this.provider = provider;
		}

		public override object? GetFormat(Type? formatType)
		{
			return provider.GetFormat(formatType);
		}
	}
	internal static class <c1115aee-2ebb-4910-9809-e81b758f145c>ReflectionExtensions
	{
		private static readonly FieldInfo? RemoteStackTraceField = typeof(Exception).GetField("_remoteStackTraceString", BindingFlags.Instance | BindingFlags.NonPublic);

		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);
		}

		public static PropertyInfo? GetPublicProperty(this Type type, string name)
		{
			return type.GetProperty(name);
		}

		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((Type i) => i.GetProperties(bindingFlags));
		}

		public static IEnumerable<PropertyInfo> GetPublicProperties(this Type type)
		{
			return GetProperties(type, 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 + "'.");
		}

		public static MethodInfo? GetPublicStaticMethod(this Type type, string name, params Type[] parameterTypes)
		{
			return type.GetMethod(name, BindingFlags.Static | BindingFlags.Public, null, parameterTypes, null);
		}

		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<TAttribute>(this PropertyInfo property)
		{
			return Attribute.GetCustomAttributes(property, typeof(TAttribute));
		}
	}
	internal static class <c1115aee-2ebb-4910-9809-e81b758f145c>PropertyInfoExtensions
	{
		public static object? ReadValue(this PropertyInfo property, object target)
		{
			return property.GetValue(target, null);
		}
	}
	internal static class <c1115aee-2ebb-4910-9809-e81b758f145c>StandardRegexOptions
	{
		public const RegexOptions Compiled = RegexOptions.Compiled;
	}
}
namespace YamlDotNet.Serialization
{
	internal abstract class <c1115aee-2ebb-4910-9809-e81b758f145c>BuilderSkeleton<TBuilder> where TBuilder : <c1115aee-2ebb-4910-9809-e81b758f145c>BuilderSkeleton<TBuilder>
	{
		internal <c1115aee-2ebb-4910-9809-e81b758f145c>INamingConvention namingConvention = <c1115aee-2ebb-4910-9809-e81b758f145c>NullNamingConvention.Instance;

		internal <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeResolver typeResolver;

		internal readonly <c1115aee-2ebb-4910-9809-e81b758f145c>YamlAttributeOverrides overrides;

		internal readonly <c1115aee-2ebb-4910-9809-e81b758f145c>LazyComponentRegistrationList<<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing, <c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter> typeConverterFactories;

		internal readonly <c1115aee-2ebb-4910-9809-e81b758f145c>LazyComponentRegistrationList<<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector, <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector> typeInspectorFactories;

		private bool ignoreFields;

		private bool includeNonPublicProperties;

		protected abstract TBuilder Self { get; }

		internal <c1115aee-2ebb-4910-9809-e81b758f145c>BuilderSkeleton(<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeResolver typeResolver)
		{
			overrides = new <c1115aee-2ebb-4910-9809-e81b758f145c>YamlAttributeOverrides();
			typeConverterFactories = new <c1115aee-2ebb-4910-9809-e81b758f145c>LazyComponentRegistrationList<<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing, <c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter>
			{
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>GuidConverter),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>GuidConverter(jsonCompatible: false)
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>SystemTypeConverter),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>SystemTypeConverter()
				}
			};
			typeInspectorFactories = new <c1115aee-2ebb-4910-9809-e81b758f145c>LazyComponentRegistrationList<<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector, <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector>();
			this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver");
		}

		internal <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector BuildTypeInspector()
		{
			<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector2 = new <c1115aee-2ebb-4910-9809-e81b758f145c>ReadablePropertiesTypeInspector(typeResolver, includeNonPublicProperties);
			if (!ignoreFields)
			{
				<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector2 = new <c1115aee-2ebb-4910-9809-e81b758f145c>CompositeTypeInspector(new <c1115aee-2ebb-4910-9809-e81b758f145c>ReadableFieldsTypeInspector(typeResolver), <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector2);
			}
			return typeInspectorFactories.BuildComponentChain(<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector2);
		}

		public TBuilder IgnoreFields()
		{
			ignoreFields = true;
			return Self;
		}

		public TBuilder IncludeNonPublicProperties()
		{
			includeNonPublicProperties = true;
			return Self;
		}

		public TBuilder WithNamingConvention(<c1115aee-2ebb-4910-9809-e81b758f145c>INamingConvention namingConvention)
		{
			this.namingConvention = namingConvention ?? throw new ArgumentNullException("namingConvention");
			return Self;
		}

		public TBuilder WithTypeResolver(<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeResolver typeResolver)
		{
			this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver");
			return Self;
		}

		public abstract TBuilder WithTagMapping(<c1115aee-2ebb-4910-9809-e81b758f145c>TagName tag, Type type);

		public TBuilder WithAttributeOverride<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(<c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter typeConverter)
		{
			return WithTypeConverter(typeConverter, delegate(<c1115aee-2ebb-4910-9809-e81b758f145c>IRegistrationLocationSelectionSyntax<<c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter> w)
			{
				w.OnTop();
			});
		}

		public TBuilder WithTypeConverter(<c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter typeConverter, Action<<c1115aee-2ebb-4910-9809-e81b758f145c>IRegistrationLocationSelectionSyntax<<c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter>> where)
		{
			<c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter typeConverter2 = typeConverter;
			if (typeConverter2 == null)
			{
				throw new ArgumentNullException("typeConverter");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeConverterFactories.CreateRegistrationLocationSelector(typeConverter2.GetType(), (<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => typeConverter2));
			return Self;
		}

		public TBuilder WithTypeConverter<TYamlTypeConverter>(<c1115aee-2ebb-4910-9809-e81b758f145c>WrapperFactory<<c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter, <c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter> typeConverterFactory, Action<<c1115aee-2ebb-4910-9809-e81b758f145c>ITrackingRegistrationLocationSelectionSyntax<<c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter>> where) where TYamlTypeConverter : <c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter
		{
			<c1115aee-2ebb-4910-9809-e81b758f145c>WrapperFactory<<c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter, <c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter> typeConverterFactory2 = typeConverterFactory;
			if (typeConverterFactory2 == null)
			{
				throw new ArgumentNullException("typeConverterFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeConverterFactories.CreateTrackingRegistrationLocationSelector(typeof(TYamlTypeConverter), (<c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter wrapped, <c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => typeConverterFactory2(wrapped)));
			return Self;
		}

		public TBuilder WithoutTypeConverter<TYamlTypeConverter>() where TYamlTypeConverter : <c1115aee-2ebb-4910-9809-e81b758f145c>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<TTypeInspector>(Func<<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector, TTypeInspector> typeInspectorFactory) where TTypeInspector : <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector
		{
			return WithTypeInspector(typeInspectorFactory, delegate(<c1115aee-2ebb-4910-9809-e81b758f145c>IRegistrationLocationSelectionSyntax<<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector> w)
			{
				w.OnTop();
			});
		}

		public TBuilder WithTypeInspector<TTypeInspector>(Func<<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector, TTypeInspector> typeInspectorFactory, Action<<c1115aee-2ebb-4910-9809-e81b758f145c>IRegistrationLocationSelectionSyntax<<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector>> where) where TTypeInspector : <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector
		{
			Func<<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector, TTypeInspector> typeInspectorFactory2 = typeInspectorFactory;
			if (typeInspectorFactory2 == null)
			{
				throw new ArgumentNullException("typeInspectorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeInspectorFactories.CreateRegistrationLocationSelector(typeof(TTypeInspector), (<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector inner) => typeInspectorFactory2(inner)));
			return Self;
		}

		public TBuilder WithTypeInspector<TTypeInspector>(<c1115aee-2ebb-4910-9809-e81b758f145c>WrapperFactory<<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector, <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector, TTypeInspector> typeInspectorFactory, Action<<c1115aee-2ebb-4910-9809-e81b758f145c>ITrackingRegistrationLocationSelectionSyntax<<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector>> where) where TTypeInspector : <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector
		{
			<c1115aee-2ebb-4910-9809-e81b758f145c>WrapperFactory<<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector, <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector, TTypeInspector> typeInspectorFactory2 = typeInspectorFactory;
			if (typeInspectorFactory2 == null)
			{
				throw new ArgumentNullException("typeInspectorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeInspectorFactories.CreateTrackingRegistrationLocationSelector(typeof(TTypeInspector), (<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector wrapped, <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector inner) => typeInspectorFactory2(wrapped, inner)));
			return Self;
		}

		public TBuilder WithoutTypeInspector<TTypeInspector>() where TTypeInspector : <c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector
		{
			return WithoutTypeInspector(typeof(TTypeInspector));
		}

		public TBuilder WithoutTypeInspector(Type inspectorType)
		{
			if (inspectorType == null)
			{
				throw new ArgumentNullException("inspectorType");
			}
			typeInspectorFactories.Remove(inspectorType);
			return Self;
		}

		protected IEnumerable<<c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter> BuildTypeConverters()
		{
			return typeConverterFactories.BuildComponentList();
		}
	}
	internal delegate TComponent <c1115aee-2ebb-4910-9809-e81b758f145c>WrapperFactory<TComponentBase, TComponent>(TComponentBase wrapped) where TComponent : TComponentBase;
	internal delegate TComponent <c1115aee-2ebb-4910-9809-e81b758f145c>WrapperFactory<TArgument, TComponentBase, TComponent>(TComponentBase wrapped, TArgument argument) where TComponent : TComponentBase;
	[Flags]
	internal enum <c1115aee-2ebb-4910-9809-e81b758f145c>DefaultValuesHandling
	{
		Preserve = 0,
		OmitNull = 1,
		OmitDefaults = 2,
		OmitEmptyCollections = 4
	}
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>Deserializer : <c1115aee-2ebb-4910-9809-e81b758f145c>IDeserializer
	{
		private readonly <c1115aee-2ebb-4910-9809-e81b758f145c>IValueDeserializer valueDeserializer;

		public <c1115aee-2ebb-4910-9809-e81b758f145c>Deserializer()
			: this(new <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder().BuildValueDeserializer())
		{
		}

		private <c1115aee-2ebb-4910-9809-e81b758f145c>Deserializer(<c1115aee-2ebb-4910-9809-e81b758f145c>IValueDeserializer valueDeserializer)
		{
			this.valueDeserializer = valueDeserializer ?? throw new ArgumentNullException("valueDeserializer");
		}

		public static <c1115aee-2ebb-4910-9809-e81b758f145c>Deserializer FromValueDeserializer(<c1115aee-2ebb-4910-9809-e81b758f145c>IValueDeserializer valueDeserializer)
		{
			return new <c1115aee-2ebb-4910-9809-e81b758f145c>Deserializer(valueDeserializer);
		}

		public T Deserialize<T>(string input)
		{
			using StringReader input2 = new StringReader(input);
			return Deserialize<T>(input2);
		}

		public T Deserialize<T>(TextReader input)
		{
			return Deserialize<T>(new <c1115aee-2ebb-4910-9809-e81b758f145c>Parser(input));
		}

		public object? Deserialize(TextReader input)
		{
			return Deserialize(input, typeof(object));
		}

		public object? Deserialize(string input, Type type)
		{
			using StringReader input2 = new StringReader(input);
			return Deserialize(input2, type);
		}

		public object? Deserialize(TextReader input, Type type)
		{
			return Deserialize(new <c1115aee-2ebb-4910-9809-e81b758f145c>Parser(input), type);
		}

		public T Deserialize<T>(<c1115aee-2ebb-4910-9809-e81b758f145c>IParser parser)
		{
			return (T)Deserialize(parser, typeof(T));
		}

		public object? Deserialize(<c1115aee-2ebb-4910-9809-e81b758f145c>IParser parser)
		{
			return Deserialize(parser, typeof(object));
		}

		public object? Deserialize(<c1115aee-2ebb-4910-9809-e81b758f145c>IParser parser, Type type)
		{
			if (parser == null)
			{
				throw new ArgumentNullException("parser");
			}
			if (type == null)
			{
				throw new ArgumentNullException("type");
			}
			YamlDotNet.Core.Events.<c1115aee-2ebb-4910-9809-e81b758f145c>StreamStart @event;
			bool flag = parser.TryConsume<YamlDotNet.Core.Events.<c1115aee-2ebb-4910-9809-e81b758f145c>StreamStart>(out @event);
			YamlDotNet.Core.Events.<c1115aee-2ebb-4910-9809-e81b758f145c>DocumentStart event2;
			bool flag2 = parser.TryConsume<YamlDotNet.Core.Events.<c1115aee-2ebb-4910-9809-e81b758f145c>DocumentStart>(out event2);
			object result = null;
			if (!parser.Accept<YamlDotNet.Core.Events.<c1115aee-2ebb-4910-9809-e81b758f145c>DocumentEnd>(out var _) && !parser.Accept<YamlDotNet.Core.Events.<c1115aee-2ebb-4910-9809-e81b758f145c>StreamEnd>(out var _))
			{
				using <c1115aee-2ebb-4910-9809-e81b758f145c>SerializerState <c1115aee-2ebb-4910-9809-e81b758f145c>SerializerState = new <c1115aee-2ebb-4910-9809-e81b758f145c>SerializerState();
				result = valueDeserializer.DeserializeValue(parser, type, <c1115aee-2ebb-4910-9809-e81b758f145c>SerializerState, valueDeserializer);
				<c1115aee-2ebb-4910-9809-e81b758f145c>SerializerState.OnDeserialization();
			}
			if (flag2)
			{
				parser.Consume<YamlDotNet.Core.Events.<c1115aee-2ebb-4910-9809-e81b758f145c>DocumentEnd>();
			}
			if (flag)
			{
				parser.Consume<YamlDotNet.Core.Events.<c1115aee-2ebb-4910-9809-e81b758f145c>StreamEnd>();
			}
			return result;
		}
	}
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder : <c1115aee-2ebb-4910-9809-e81b758f145c>BuilderSkeleton<<c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder>
	{
		private Lazy<<c1115aee-2ebb-4910-9809-e81b758f145c>IObjectFactory> objectFactory;

		private readonly <c1115aee-2ebb-4910-9809-e81b758f145c>LazyComponentRegistrationList<<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing, <c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer> nodeDeserializerFactories;

		private readonly <c1115aee-2ebb-4910-9809-e81b758f145c>LazyComponentRegistrationList<<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing, <c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver> nodeTypeResolverFactories;

		private readonly Dictionary<<c1115aee-2ebb-4910-9809-e81b758f145c>TagName, Type> tagMappings;

		private readonly Dictionary<Type, Type> typeMappings;

		private bool ignoreUnmatched;

		protected override <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder Self => this;

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder()
			: base((<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeResolver)new <c1115aee-2ebb-4910-9809-e81b758f145c>StaticTypeResolver())
		{
			typeMappings = new Dictionary<Type, Type>();
			objectFactory = new Lazy<<c1115aee-2ebb-4910-9809-e81b758f145c>IObjectFactory>(() => new <c1115aee-2ebb-4910-9809-e81b758f145c>DefaultObjectFactory(typeMappings), isThreadSafe: true);
			tagMappings = new Dictionary<<c1115aee-2ebb-4910-9809-e81b758f145c>TagName, Type>
			{
				{
					<c1115aee-2ebb-4910-9809-e81b758f145c>FailsafeSchema.Tags.Map,
					typeof(Dictionary<object, object>)
				},
				{
					<c1115aee-2ebb-4910-9809-e81b758f145c>FailsafeSchema.Tags.Str,
					typeof(string)
				},
				{
					<c1115aee-2ebb-4910-9809-e81b758f145c>JsonSchema.Tags.Bool,
					typeof(bool)
				},
				{
					<c1115aee-2ebb-4910-9809-e81b758f145c>JsonSchema.Tags.Float,
					typeof(double)
				},
				{
					<c1115aee-2ebb-4910-9809-e81b758f145c>JsonSchema.Tags.Int,
					typeof(int)
				},
				{
					<c1115aee-2ebb-4910-9809-e81b758f145c>DefaultSchema.Tags.Timestamp,
					typeof(DateTime)
				}
			};
			typeInspectorFactories.Add(typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>CachedTypeInspector), (<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector inner) => new <c1115aee-2ebb-4910-9809-e81b758f145c>CachedTypeInspector(inner));
			typeInspectorFactories.Add(typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>NamingConventionTypeInspector), (<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector inner) => (!(namingConvention is <c1115aee-2ebb-4910-9809-e81b758f145c>NullNamingConvention)) ? new <c1115aee-2ebb-4910-9809-e81b758f145c>NamingConventionTypeInspector(inner, namingConvention) : inner);
			typeInspectorFactories.Add(typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>YamlAttributesTypeInspector), (<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector inner) => new <c1115aee-2ebb-4910-9809-e81b758f145c>YamlAttributesTypeInspector(inner));
			typeInspectorFactories.Add(typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>YamlAttributeOverridesInspector), (<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector inner) => (overrides == null) ? inner : new <c1115aee-2ebb-4910-9809-e81b758f145c>YamlAttributeOverridesInspector(inner, overrides.Clone()));
			typeInspectorFactories.Add(typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>ReadableAndWritablePropertiesTypeInspector), (<c1115aee-2ebb-4910-9809-e81b758f145c>ITypeInspector inner) => new <c1115aee-2ebb-4910-9809-e81b758f145c>ReadableAndWritablePropertiesTypeInspector(inner));
			nodeDeserializerFactories = new <c1115aee-2ebb-4910-9809-e81b758f145c>LazyComponentRegistrationList<<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing, <c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer>
			{
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>YamlConvertibleNodeDeserializer),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>YamlConvertibleNodeDeserializer(objectFactory.Value)
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>YamlSerializableNodeDeserializer),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>YamlSerializableNodeDeserializer(objectFactory.Value)
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>TypeConverterNodeDeserializer),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>TypeConverterNodeDeserializer(BuildTypeConverters())
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>NullNodeDeserializer),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>NullNodeDeserializer()
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>ScalarNodeDeserializer),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>ScalarNodeDeserializer()
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>ArrayNodeDeserializer),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>ArrayNodeDeserializer()
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>DictionaryNodeDeserializer),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>DictionaryNodeDeserializer(objectFactory.Value)
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>CollectionNodeDeserializer),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>CollectionNodeDeserializer(objectFactory.Value)
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>EnumerableNodeDeserializer),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>EnumerableNodeDeserializer()
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>ObjectNodeDeserializer),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>ObjectNodeDeserializer(objectFactory.Value, BuildTypeInspector(), ignoreUnmatched)
				}
			};
			nodeTypeResolverFactories = new <c1115aee-2ebb-4910-9809-e81b758f145c>LazyComponentRegistrationList<<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing, <c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver>
			{
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>MappingNodeTypeResolver),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>MappingNodeTypeResolver(typeMappings)
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>YamlConvertibleTypeResolver),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>YamlConvertibleTypeResolver()
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>YamlSerializableTypeResolver),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>YamlSerializableTypeResolver()
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>TagNodeTypeResolver),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>TagNodeTypeResolver(tagMappings)
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>PreventUnknownTagsNodeTypeResolver),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>PreventUnknownTagsNodeTypeResolver()
				},
				{
					typeof(<c1115aee-2ebb-4910-9809-e81b758f145c>DefaultContainersNodeTypeResolver),
					(<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => new <c1115aee-2ebb-4910-9809-e81b758f145c>DefaultContainersNodeTypeResolver()
				}
			};
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithObjectFactory(<c1115aee-2ebb-4910-9809-e81b758f145c>IObjectFactory objectFactory)
		{
			<c1115aee-2ebb-4910-9809-e81b758f145c>IObjectFactory objectFactory2 = objectFactory;
			if (objectFactory2 == null)
			{
				throw new ArgumentNullException("objectFactory");
			}
			this.objectFactory = new Lazy<<c1115aee-2ebb-4910-9809-e81b758f145c>IObjectFactory>(() => objectFactory2, isThreadSafe: true);
			return this;
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithObjectFactory(Func<Type, object> objectFactory)
		{
			if (objectFactory == null)
			{
				throw new ArgumentNullException("objectFactory");
			}
			return WithObjectFactory(new <c1115aee-2ebb-4910-9809-e81b758f145c>LambdaObjectFactory(objectFactory));
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithNodeDeserializer(<c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer nodeDeserializer)
		{
			return WithNodeDeserializer(nodeDeserializer, delegate(<c1115aee-2ebb-4910-9809-e81b758f145c>IRegistrationLocationSelectionSyntax<<c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer> w)
			{
				w.OnTop();
			});
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithNodeDeserializer(<c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer nodeDeserializer, Action<<c1115aee-2ebb-4910-9809-e81b758f145c>IRegistrationLocationSelectionSyntax<<c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer>> where)
		{
			<c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer nodeDeserializer2 = nodeDeserializer;
			if (nodeDeserializer2 == null)
			{
				throw new ArgumentNullException("nodeDeserializer");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(nodeDeserializerFactories.CreateRegistrationLocationSelector(nodeDeserializer2.GetType(), (<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => nodeDeserializer2));
			return this;
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithNodeDeserializer<TNodeDeserializer>(<c1115aee-2ebb-4910-9809-e81b758f145c>WrapperFactory<<c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer, TNodeDeserializer> nodeDeserializerFactory, Action<<c1115aee-2ebb-4910-9809-e81b758f145c>ITrackingRegistrationLocationSelectionSyntax<<c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer>> where) where TNodeDeserializer : <c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer
		{
			<c1115aee-2ebb-4910-9809-e81b758f145c>WrapperFactory<<c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer, TNodeDeserializer> nodeDeserializerFactory2 = nodeDeserializerFactory;
			if (nodeDeserializerFactory2 == null)
			{
				throw new ArgumentNullException("nodeDeserializerFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(nodeDeserializerFactories.CreateTrackingRegistrationLocationSelector(typeof(TNodeDeserializer), (<c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer wrapped, <c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => nodeDeserializerFactory2(wrapped)));
			return this;
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithoutNodeDeserializer<TNodeDeserializer>() where TNodeDeserializer : <c1115aee-2ebb-4910-9809-e81b758f145c>INodeDeserializer
		{
			return WithoutNodeDeserializer(typeof(TNodeDeserializer));
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithoutNodeDeserializer(Type nodeDeserializerType)
		{
			if (nodeDeserializerType == null)
			{
				throw new ArgumentNullException("nodeDeserializerType");
			}
			nodeDeserializerFactories.Remove(nodeDeserializerType);
			return this;
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithNodeTypeResolver(<c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver nodeTypeResolver)
		{
			return WithNodeTypeResolver(nodeTypeResolver, delegate(<c1115aee-2ebb-4910-9809-e81b758f145c>IRegistrationLocationSelectionSyntax<<c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver> w)
			{
				w.OnTop();
			});
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithNodeTypeResolver(<c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver nodeTypeResolver, Action<<c1115aee-2ebb-4910-9809-e81b758f145c>IRegistrationLocationSelectionSyntax<<c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver>> where)
		{
			<c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver nodeTypeResolver2 = nodeTypeResolver;
			if (nodeTypeResolver2 == null)
			{
				throw new ArgumentNullException("nodeTypeResolver");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(nodeTypeResolverFactories.CreateRegistrationLocationSelector(nodeTypeResolver2.GetType(), (<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => nodeTypeResolver2));
			return this;
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithNodeTypeResolver<TNodeTypeResolver>(<c1115aee-2ebb-4910-9809-e81b758f145c>WrapperFactory<<c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver, TNodeTypeResolver> nodeTypeResolverFactory, Action<<c1115aee-2ebb-4910-9809-e81b758f145c>ITrackingRegistrationLocationSelectionSyntax<<c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver>> where) where TNodeTypeResolver : <c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver
		{
			<c1115aee-2ebb-4910-9809-e81b758f145c>WrapperFactory<<c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver, TNodeTypeResolver> nodeTypeResolverFactory2 = nodeTypeResolverFactory;
			if (nodeTypeResolverFactory2 == null)
			{
				throw new ArgumentNullException("nodeTypeResolverFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(nodeTypeResolverFactories.CreateTrackingRegistrationLocationSelector(typeof(TNodeTypeResolver), (<c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver wrapped, <c1115aee-2ebb-4910-9809-e81b758f145c>Nothing _) => nodeTypeResolverFactory2(wrapped)));
			return this;
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithoutNodeTypeResolver<TNodeTypeResolver>() where TNodeTypeResolver : <c1115aee-2ebb-4910-9809-e81b758f145c>INodeTypeResolver
		{
			return WithoutNodeTypeResolver(typeof(TNodeTypeResolver));
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithoutNodeTypeResolver(Type nodeTypeResolverType)
		{
			if (nodeTypeResolverType == null)
			{
				throw new ArgumentNullException("nodeTypeResolverType");
			}
			nodeTypeResolverFactories.Remove(nodeTypeResolverType);
			return this;
		}

		public override <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithTagMapping(<c1115aee-2ebb-4910-9809-e81b758f145c>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 Type value))
			{
				throw new ArgumentException($"Type already has a registered type '{value.FullName}' for tag '{tag}'", "tag");
			}
			tagMappings.Add(tag, type);
			return this;
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithTypeMapping<TInterface, 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 <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder WithoutTagMapping(<c1115aee-2ebb-4910-9809-e81b758f145c>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 <c1115aee-2ebb-4910-9809-e81b758f145c>DeserializerBuilder IgnoreUnmatchedProperties()
		{
			ignoreUnmatched = true;
			return this;
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>IDeserializer Build()
		{
			return <c1115aee-2ebb-4910-9809-e81b758f145c>Deserializer.FromValueDeserializer(BuildValueDeserializer());
		}

		public <c1115aee-2ebb-4910-9809-e81b758f145c>IValueDeserializer BuildValueDeserializer()
		{
			return new <c1115aee-2ebb-4910-9809-e81b758f145c>AliasValueDeserializer(new <c1115aee-2ebb-4910-9809-e81b758f145c>NodeValueDeserializer(nodeDeserializerFactories.BuildComponentList(), nodeTypeResolverFactories.BuildComponentList()));
		}
	}
	internal sealed class <c1115aee-2ebb-4910-9809-e81b758f145c>EmissionPhaseObjectGraphVisitorArgs
	{
		private readonly IEnumerable<<c1115aee-2ebb-4910-9809-e81b758f145c>IObjectGraphVisitor<<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing>> preProcessingPhaseVisitors;

		public <c1115aee-2ebb-4910-9809-e81b758f145c>IObjectGraphVisitor<<c1115aee-2ebb-4910-9809-e81b758f145c>IEmitter> InnerVisitor { get; private set; }

		public <c1115aee-2ebb-4910-9809-e81b758f145c>IEventEmitter EventEmitter { get; private set; }

		public <c1115aee-2ebb-4910-9809-e81b758f145c>ObjectSerializer NestedObjectSerializer { get; private set; }

		public IEnumerable<<c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter> TypeConverters { get; private set; }

		public <c1115aee-2ebb-4910-9809-e81b758f145c>EmissionPhaseObjectGraphVisitorArgs(<c1115aee-2ebb-4910-9809-e81b758f145c>IObjectGraphVisitor<<c1115aee-2ebb-4910-9809-e81b758f145c>IEmitter> innerVisitor, <c1115aee-2ebb-4910-9809-e81b758f145c>IEventEmitter eventEmitter, IEnumerable<<c1115aee-2ebb-4910-9809-e81b758f145c>IObjectGraphVisitor<<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing>> preProcessingPhaseVisitors, IEnumerable<<c1115aee-2ebb-4910-9809-e81b758f145c>IYamlTypeConverter> typeConverters, <c1115aee-2ebb-4910-9809-e81b758f145c>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<T>() where T : <c1115aee-2ebb-4910-9809-e81b758f145c>IObjectGraphVisitor<<c1115aee-2ebb-4910-9809-e81b758f145c>Nothing