Decompiled source of Dream Texts v1.7.0

DreamTexts.dll

Decompiled 7 months 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.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using ServerSync;
using Service;
using TMPro;
using UnityEngine;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.Converters;
using YamlDotNet.Serialization.EventEmitters;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization.NodeDeserializers;
using YamlDotNet.Serialization.NodeTypeResolvers;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.ObjectGraphTraversalStrategies;
using YamlDotNet.Serialization.ObjectGraphVisitors;
using YamlDotNet.Serialization.Schemas;
using YamlDotNet.Serialization.TypeInspectors;
using YamlDotNet.Serialization.TypeResolvers;
using YamlDotNet.Serialization.Utilities;
using YamlDotNet.Serialization.ValueDeserializers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("DreamTexts")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DreamTexts")]
[assembly: AssemblyTitle("DreamTexts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: <4f81e163-4b78-4368-9422-23f2c26cd398>RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<41609c8a-8dc0-4d7a-9351-1f140138b784>Embedded]
	internal sealed class <41609c8a-8dc0-4d7a-9351-1f140138b784>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[<41609c8a-8dc0-4d7a-9351-1f140138b784>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class <4af7b112-9c18-476b-b104-02c40a2512a9>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <4af7b112-9c18-476b-b104-02c40a2512a9>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <4af7b112-9c18-476b-b104-02c40a2512a9>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[<41609c8a-8dc0-4d7a-9351-1f140138b784>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class <a0710ba4-4c73-473a-b6d8-8a5c5492dc25>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <a0710ba4-4c73-473a-b6d8-8a5c5492dc25>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[<41609c8a-8dc0-4d7a-9351-1f140138b784>Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class <4f81e163-4b78-4368-9422-23f2c26cd398>RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public <4f81e163-4b78-4368-9422-23f2c26cd398>RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Service
{
	[<a0710ba4-4c73-473a-b6d8-8a5c5492dc25>NullableContext(1)]
	[<4af7b112-9c18-476b-b104-02c40a2512a9>Nullable(0)]
	public class ConfigWrapper
	{
		private readonly ConfigSync ConfigSync;

		public ConfigWrapper(ConfigSync configSync)
		{
			ConfigSync = configSync;
		}

		public CustomSyncedValue<string> AddValue(string identifier)
		{
			return new CustomSyncedValue<string>(ConfigSync, identifier);
		}
	}
	[<a0710ba4-4c73-473a-b6d8-8a5c5492dc25>NullableContext(1)]
	[<4af7b112-9c18-476b-b104-02c40a2512a9>Nullable(0)]
	public class Watcher
	{
		private static readonly Dictionary<string, byte[]> hashes = new Dictionary<string, byte[]>();

		private static byte[] GetHash(string path)
		{
			using MD5 mD = MD5.Create();
			using FileStream inputStream = File.OpenRead(path);
			return mD.ComputeHash(inputStream);
		}

		public static void Setup(string folder, string pattern, Action action)
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(folder, pattern);
			fileSystemWatcher.Changed += [<a0710ba4-4c73-473a-b6d8-8a5c5492dc25>NullableContext(0)] (object s, FileSystemEventArgs e) =>
			{
				byte[] hash = GetHash(e.FullPath);
				if (!hashes.ContainsKey(e.FullPath) || !hashes[e.FullPath].SequenceEqual(hash))
				{
					hashes[e.FullPath] = hash;
					action();
				}
			};
			fileSystemWatcher.IncludeSubdirectories = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		public static void Setup(string file, Action action)
		{
			string? directoryName = Path.GetDirectoryName(file);
			string fileName = Path.GetFileName(file);
			Setup(directoryName, fileName, action);
		}

		public static void Setup(ConfigFile config, ManualLogSource logger)
		{
			string configFilePath = config.ConfigFilePath;
			string directoryName = Path.GetDirectoryName(configFilePath);
			string fileName = Path.GetFileName(configFilePath);
			Setup(directoryName, fileName, delegate
			{
				if (!File.Exists(config.ConfigFilePath))
				{
					return;
				}
				try
				{
					logger.LogDebug((object)"ReadConfigValues called");
					config.Reload();
				}
				catch
				{
					logger.LogError((object)("There was an issue loading your " + config.ConfigFilePath));
					logger.LogError((object)"Please check your config entries for spelling and format!");
				}
			});
		}
	}
}
namespace DreamTextsPlugin
{
	public class Configuration
	{
		public static CustomSyncedValue<string> valueDreamData;

		[<a0710ba4-4c73-473a-b6d8-8a5c5492dc25>NullableContext(1)]
		public static void Init(ConfigWrapper wrapper)
		{
			valueDreamData = wrapper.AddValue("dream_data");
			valueDreamData.ValueChanged += delegate
			{
				DreamManager.FromSetting(valueDreamData.Value);
			};
		}
	}
	[<a0710ba4-4c73-473a-b6d8-8a5c5492dc25>NullableContext(1)]
	[<4af7b112-9c18-476b-b104-02c40a2512a9>Nullable(0)]
	public class Data
	{
		public static IDeserializer Deserializer()
		{
			return new DeserializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).WithTypeConverter(new FloatConverter()).Build();
		}

		public static IDeserializer DeserializerUnSafe()
		{
			return new DeserializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).WithTypeConverter(new FloatConverter()).IgnoreUnmatchedProperties()
				.Build();
		}

		public static ISerializer Serializer()
		{
			return new SerializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).DisableAliases().ConfigureDefaultValuesHandling(DefaultValuesHandling.OmitDefaults)
				.WithTypeConverter(new FloatConverter())
				.Build();
		}

		public static List<T> Deserialize<[<4af7b112-9c18-476b-b104-02c40a2512a9>Nullable(2)] T>(string raw, string fileName)
		{
			try
			{
				return Deserializer().Deserialize<List<T>>(raw);
			}
			catch (Exception ex)
			{
				DreamTextsPlugin.Log.LogError((object)(fileName + ": " + ex.Message));
				try
				{
					return DeserializerUnSafe().Deserialize<List<T>>(raw);
				}
				catch (Exception)
				{
					return new List<T>();
				}
			}
		}

		public static string Read(string pattern)
		{
			IEnumerable<string> values = from name in Directory.GetFiles(DreamTextsPlugin.ConfigPath, pattern)
				select File.ReadAllText(name);
			return string.Join("\n", values);
		}
	}
	public class FloatConverter : IYamlTypeConverter
	{
		public bool Accepts(Type type)
		{
			return type == typeof(float);
		}

		public object ReadYaml(IParser parser, Type type)
		{
			float num = float.Parse(((YamlDotNet.Core.Events.Scalar)parser.Current).Value, NumberStyles.Float, CultureInfo.InvariantCulture);
			parser.MoveNext();
			return num;
		}

		public void WriteYaml(IEmitter emitter, object value, Type type)
		{
			emitter.Emit(new YamlDotNet.Core.Events.Scalar(((float)value).ToString("0.###", CultureInfo.InvariantCulture)));
		}
	}
	[<a0710ba4-4c73-473a-b6d8-8a5c5492dc25>NullableContext(1)]
	[<4af7b112-9c18-476b-b104-02c40a2512a9>Nullable(0)]
	public class DreamData
	{
		public string text = "";

		public float chance = 0.1f;

		[<4af7b112-9c18-476b-b104-02c40a2512a9>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public string[] trueKeys;

		[<4af7b112-9c18-476b-b104-02c40a2512a9>Nullable(new byte[] { 2, 1 })]
		[DefaultValue(null)]
		public string[] falseKeys;

		[DefaultValue("")]
		public string requiredKeys = "";

		[DefaultValue("")]
		public string forbiddenKeys = "";
	}
	[HarmonyPatch(typeof(Hud), "Awake")]
	public class SaveData
	{
		[<a0710ba4-4c73-473a-b6d8-8a5c5492dc25>NullableContext(1)]
		private static void Postfix(Hud __instance)
		{
			if (Helper.IsServer())
			{
				DreamManager.ToFile(__instance.m_sleepingProgress.GetComponent<SleepText>());
			}
		}
	}
	[HarmonyPatch(typeof(ZoneSystem), "SetupLocations")]
	public class LoadData
	{
		private static void Postfix()
		{
			DreamManager.FromFile();
		}
	}
	[<a0710ba4-4c73-473a-b6d8-8a5c5492dc25>NullableContext(1)]
	[<4af7b112-9c18-476b-b104-02c40a2512a9>Nullable(0)]
	[HarmonyPatch(typeof(DreamTexts), "GetRandomDreamText")]
	[HarmonyPriority(100)]
	public class DreamManager
	{
		public static string FileName = "dream_texts.yaml";

		public static string FilePath = Path.Combine(DreamTextsPlugin.ConfigPath, FileName);

		public static string Pattern = "dream_texts*.yaml";

		private static readonly Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();

		private static List<DreamText> Dreams = new List<DreamText>();

		private static void Prefix(DreamTexts __instance)
		{
			if (Dreams.Count > 0)
			{
				__instance.m_texts = Dreams;
			}
		}

		public static DreamText FromData(DreamData data)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			return new DreamText
			{
				m_text = data.text,
				m_chanceToDream = data.chance,
				m_falseKeys = ((data.falseKeys == null) ? Helper.ToList(data.forbiddenKeys) : data.falseKeys.ToList()),
				m_trueKeys = ((data.trueKeys == null) ? Helper.ToList(data.requiredKeys) : data.trueKeys.ToList())
			};
		}

		public static DreamData ToData(DreamText dream)
		{
			return new DreamData
			{
				text = dream.m_text,
				chance = dream.m_chanceToDream,
				forbiddenKeys = Helper.FromList(dream.m_falseKeys),
				requiredKeys = Helper.FromList(dream.m_trueKeys)
			};
		}

		public static void ToFile(SleepText obj)
		{
			if (Helper.IsServer() && !File.Exists(FilePath))
			{
				List<DreamText> list = obj?.m_dreamTexts?.m_texts;
				if (list != null)
				{
					string text = Data.Serializer().Serialize(list.Select(ToData).ToList());
					File.WriteAllText(FilePath, text);
					Configuration.valueDreamData.Value = text;
				}
			}
		}

		public static void FromFile()
		{
			if (Helper.IsServer())
			{
				string text = Data.Read(Pattern);
				Configuration.valueDreamData.Value = text;
				Set(text);
				if (text.Contains("trueKeys") || text.Contains("falseKeys"))
				{
					DreamTextsPlugin.Log.LogWarning((object)"Updating dream_texts.yaml to the new format.");
					text = Data.Serializer().Serialize(Dreams.Select(ToData).ToList());
					File.WriteAllText(FilePath, text);
				}
			}
		}

		public static void FromSetting(string yaml)
		{
			if (Helper.IsClient())
			{
				Set(yaml);
			}
		}

		private static void Set(string yaml)
		{
			if (yaml == "")
			{
				return;
			}
			try
			{
				List<DreamText> list = Data.Deserialize<DreamData>(yaml, FileName).Select(FromData).ToList();
				if (list.Count == 0)
				{
					DreamTextsPlugin.Log.LogWarning((object)"Failed to load any dream data.");
					return;
				}
				DreamTextsPlugin.Log.LogInfo((object)$"Reloading {list.Count} dream data.");
				Dreams = list;
			}
			catch (Exception ex)
			{
				DreamTextsPlugin.Log.LogError((object)ex.StackTrace);
			}
		}

		public static void SetupWatcher()
		{
			Watcher.Setup(DreamTextsPlugin.ConfigPath, Pattern, FromFile);
		}
	}
	[<a0710ba4-4c73-473a-b6d8-8a5c5492dc25>NullableContext(1)]
	[<4af7b112-9c18-476b-b104-02c40a2512a9>Nullable(0)]
	[BepInPlugin("dream_texts", "Dream Texts", "1.7")]
	public class DreamTextsPlugin : BaseUnityPlugin
	{
		private const string GUID = "dream_texts";

		private const string NAME = "Dream Texts";

		private const string VERSION = "1.7";

		[<4af7b112-9c18-476b-b104-02c40a2512a9>Nullable(0)]
		public static ManualLogSource Log;

		public static ConfigSync ConfigSync = new ConfigSync("dream_texts")
		{
			DisplayName = "Dream Texts",
			CurrentVersion = "1.7",
			ModRequired = false,
			IsLocked = true
		};

		public static string ConfigPath = "";

		public void Awake()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			ConfigPath = Paths.ConfigPath;
			Configuration.Init(new ConfigWrapper(ConfigSync));
			new Harmony("dream_texts").PatchAll();
			DreamManager.SetupWatcher();
		}
	}
	[<a0710ba4-4c73-473a-b6d8-8a5c5492dc25>NullableContext(1)]
	[<4af7b112-9c18-476b-b104-02c40a2512a9>Nullable(0)]
	public static class Helper
	{
		public static bool IsServer()
		{
			if (Object.op_Implicit((Object)(object)ZNet.instance))
			{
				return ZNet.instance.IsServer();
			}
			return false;
		}

		public static bool IsClient()
		{
			if (Object.op_Implicit((Object)(object)ZNet.instance))
			{
				return !ZNet.instance.IsServer();
			}
			return false;
		}

		public static string[] Split(string arg, bool removeEmpty = true, char split = ',')
		{
			return (from s in arg.Split(new char[1] { split })
				select s.Trim() into s
				where !removeEmpty || s != ""
				select s).ToArray();
		}

		public static List<string> ToList(string str, bool removeEmpty = true)
		{
			return Split(str, removeEmpty).ToList();
		}

		public static string FromList(IEnumerable<string> array)
		{
			return string.Join(", ", array);
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<88c8e51e-2809-4a0e-be05-ca580bc99ae9>Embedded]
	internal sealed class <88c8e51e-2809-4a0e-be05-ca580bc99ae9>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[<88c8e51e-2809-4a0e-be05-ca580bc99ae9>Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[<88c8e51e-2809-4a0e-be05-ca580bc99ae9>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class <845a9e44-c741-4f09-a056-857dcc268b0d>NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public <845a9e44-c741-4f09-a056-857dcc268b0d>NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public <845a9e44-c741-4f09-a056-857dcc268b0d>NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[<88c8e51e-2809-4a0e-be05-ca580bc99ae9>Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class <bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public <bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace YamlDotNet
{
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal sealed class CultureInfoAdapter : CultureInfo
	{
		private readonly IFormatProvider provider;

		public CultureInfoAdapter(CultureInfo baseCulture, IFormatProvider provider)
			: base(baseCulture.LCID)
		{
			this.provider = provider;
		}

		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
		public override object GetFormat(Type formatType)
		{
			return provider.GetFormat(formatType);
		}
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal static class ReflectionExtensions
	{
		[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		private static readonly FieldInfo RemoteStackTraceField = typeof(Exception).GetField("_remoteStackTraceString", BindingFlags.Instance | BindingFlags.NonPublic);

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public static Type BaseType(this Type type)
		{
			return type.BaseType;
		}

		public static bool IsValueType(this Type type)
		{
			return type.IsValueType;
		}

		public static bool IsGenericType(this Type type)
		{
			return type.IsGenericType;
		}

		public static bool IsGenericTypeDefinition(this Type type)
		{
			return type.IsGenericTypeDefinition;
		}

		public static bool IsInterface(this Type type)
		{
			return type.IsInterface;
		}

		public static bool IsEnum(this Type type)
		{
			return type.IsEnum;
		}

		public static bool IsDbNull(this object value)
		{
			return value is DBNull;
		}

		public static bool HasDefaultConstructor(this Type type, bool allowPrivateConstructors)
		{
			BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public;
			if (allowPrivateConstructors)
			{
				bindingFlags |= BindingFlags.NonPublic;
			}
			if (!type.IsValueType)
			{
				return type.GetConstructor(bindingFlags, null, Type.EmptyTypes, null) != null;
			}
			return true;
		}

		public static TypeCode GetTypeCode(this Type type)
		{
			return Type.GetTypeCode(type);
		}

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public static PropertyInfo GetPublicProperty(this Type type, string name)
		{
			return type.GetProperty(name);
		}

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public static FieldInfo GetPublicStaticField(this Type type, string name)
		{
			return type.GetField(name, BindingFlags.Static | BindingFlags.Public);
		}

		public static IEnumerable<PropertyInfo> GetProperties(this Type type, bool includeNonPublic)
		{
			BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public;
			if (includeNonPublic)
			{
				bindingFlags |= BindingFlags.NonPublic;
			}
			if (!type.IsInterface)
			{
				return type.GetProperties(bindingFlags);
			}
			return new Type[1] { type }.Concat(type.GetInterfaces()).SelectMany([<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)] (Type i) => i.GetProperties(bindingFlags));
		}

		public static IEnumerable<PropertyInfo> GetPublicProperties(this Type type)
		{
			return type.GetProperties(includeNonPublic: false);
		}

		public static IEnumerable<FieldInfo> GetPublicFields(this Type type)
		{
			return type.GetFields(BindingFlags.Instance | BindingFlags.Public);
		}

		public static IEnumerable<MethodInfo> GetPublicStaticMethods(this Type type)
		{
			return type.GetMethods(BindingFlags.Static | BindingFlags.Public);
		}

		public static MethodInfo GetPrivateStaticMethod(this Type type, string name)
		{
			return type.GetMethod(name, BindingFlags.Static | BindingFlags.NonPublic) ?? throw new MissingMethodException("Expected to find a method named '" + name + "' in '" + type.FullName + "'.");
		}

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public static MethodInfo GetPublicStaticMethod(this Type type, string name, params Type[] parameterTypes)
		{
			return type.GetMethod(name, BindingFlags.Static | BindingFlags.Public, null, parameterTypes, null);
		}

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public static MethodInfo GetPublicInstanceMethod(this Type type, string name)
		{
			return type.GetMethod(name, BindingFlags.Instance | BindingFlags.Public);
		}

		public static Exception Unwrap(this TargetInvocationException ex)
		{
			Exception innerException = ex.InnerException;
			if (innerException == null)
			{
				return ex;
			}
			if (RemoteStackTraceField != null)
			{
				RemoteStackTraceField.SetValue(innerException, innerException.StackTrace + "\r\n");
			}
			return innerException;
		}

		public static bool IsInstanceOf(this Type type, object o)
		{
			return type.IsInstanceOfType(o);
		}

		public static Attribute[] GetAllCustomAttributes<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TAttribute>(this PropertyInfo property)
		{
			return Attribute.GetCustomAttributes(property, typeof(TAttribute), inherit: true);
		}
	}
	internal static class PropertyInfoExtensions
	{
		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public static object ReadValue(this PropertyInfo property, object target)
		{
			return property.GetValue(target, null);
		}
	}
	internal static class StandardRegexOptions
	{
		public const RegexOptions Compiled = RegexOptions.Compiled;
	}
}
namespace YamlDotNet.Serialization
{
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal abstract class BuilderSkeleton<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TBuilder> where TBuilder : BuilderSkeleton<TBuilder>
	{
		internal INamingConvention namingConvention = NullNamingConvention.Instance;

		internal ITypeResolver typeResolver;

		internal readonly YamlAttributeOverrides overrides;

		internal readonly LazyComponentRegistrationList<Nothing, IYamlTypeConverter> typeConverterFactories;

		internal readonly LazyComponentRegistrationList<ITypeInspector, ITypeInspector> typeInspectorFactories;

		internal bool ignoreFields;

		internal bool includeNonPublicProperties;

		internal Settings settings;

		protected abstract TBuilder Self { get; }

		internal BuilderSkeleton(ITypeResolver typeResolver)
		{
			overrides = new YamlAttributeOverrides();
			typeConverterFactories = new LazyComponentRegistrationList<Nothing, IYamlTypeConverter>
			{
				{
					typeof(YamlDotNet.Serialization.Converters.GuidConverter),
					(Nothing _) => new YamlDotNet.Serialization.Converters.GuidConverter(jsonCompatible: false)
				},
				{
					typeof(SystemTypeConverter),
					(Nothing _) => new SystemTypeConverter()
				}
			};
			typeInspectorFactories = new LazyComponentRegistrationList<ITypeInspector, ITypeInspector>();
			this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver");
			settings = new Settings();
		}

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

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

		public TBuilder EnablePrivateConstructors()
		{
			settings.AllowPrivateConstructors = true;
			return Self;
		}

		public TBuilder WithNamingConvention(INamingConvention namingConvention)
		{
			this.namingConvention = namingConvention ?? throw new ArgumentNullException("namingConvention");
			return Self;
		}

		public TBuilder WithTypeResolver(ITypeResolver typeResolver)
		{
			this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver");
			return Self;
		}

		public abstract TBuilder WithTagMapping(TagName tag, Type type);

		public TBuilder WithAttributeOverride<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TClass>(Expression<Func<TClass, object>> propertyAccessor, Attribute attribute)
		{
			overrides.Add(propertyAccessor, attribute);
			return Self;
		}

		public TBuilder WithAttributeOverride(Type type, string member, Attribute attribute)
		{
			overrides.Add(type, member, attribute);
			return Self;
		}

		public TBuilder WithTypeConverter(IYamlTypeConverter typeConverter)
		{
			return WithTypeConverter(typeConverter, delegate(IRegistrationLocationSelectionSyntax<IYamlTypeConverter> w)
			{
				w.OnTop();
			});
		}

		public TBuilder WithTypeConverter(IYamlTypeConverter typeConverter, Action<IRegistrationLocationSelectionSyntax<IYamlTypeConverter>> where)
		{
			if (typeConverter == null)
			{
				throw new ArgumentNullException("typeConverter");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeConverterFactories.CreateRegistrationLocationSelector(typeConverter.GetType(), (Nothing _) => typeConverter));
			return Self;
		}

		public TBuilder WithTypeConverter<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TYamlTypeConverter>(WrapperFactory<IYamlTypeConverter, IYamlTypeConverter> typeConverterFactory, Action<ITrackingRegistrationLocationSelectionSyntax<IYamlTypeConverter>> where) where TYamlTypeConverter : IYamlTypeConverter
		{
			if (typeConverterFactory == null)
			{
				throw new ArgumentNullException("typeConverterFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeConverterFactories.CreateTrackingRegistrationLocationSelector(typeof(TYamlTypeConverter), (IYamlTypeConverter wrapped, Nothing _) => typeConverterFactory(wrapped)));
			return Self;
		}

		public TBuilder WithoutTypeConverter<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TYamlTypeConverter>() where TYamlTypeConverter : IYamlTypeConverter
		{
			return WithoutTypeConverter(typeof(TYamlTypeConverter));
		}

		public TBuilder WithoutTypeConverter(Type converterType)
		{
			if (converterType == null)
			{
				throw new ArgumentNullException("converterType");
			}
			typeConverterFactories.Remove(converterType);
			return Self;
		}

		public TBuilder WithTypeInspector<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TTypeInspector>(Func<ITypeInspector, TTypeInspector> typeInspectorFactory) where TTypeInspector : ITypeInspector
		{
			return WithTypeInspector(typeInspectorFactory, delegate(IRegistrationLocationSelectionSyntax<ITypeInspector> w)
			{
				w.OnTop();
			});
		}

		public TBuilder WithTypeInspector<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TTypeInspector>(Func<ITypeInspector, TTypeInspector> typeInspectorFactory, Action<IRegistrationLocationSelectionSyntax<ITypeInspector>> where) where TTypeInspector : ITypeInspector
		{
			if (typeInspectorFactory == null)
			{
				throw new ArgumentNullException("typeInspectorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeInspectorFactories.CreateRegistrationLocationSelector(typeof(TTypeInspector), (ITypeInspector inner) => typeInspectorFactory(inner)));
			return Self;
		}

		public TBuilder WithTypeInspector<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TTypeInspector>(WrapperFactory<ITypeInspector, ITypeInspector, TTypeInspector> typeInspectorFactory, Action<ITrackingRegistrationLocationSelectionSyntax<ITypeInspector>> where) where TTypeInspector : ITypeInspector
		{
			if (typeInspectorFactory == null)
			{
				throw new ArgumentNullException("typeInspectorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeInspectorFactories.CreateTrackingRegistrationLocationSelector(typeof(TTypeInspector), (ITypeInspector wrapped, ITypeInspector inner) => typeInspectorFactory(wrapped, inner)));
			return Self;
		}

		public TBuilder WithoutTypeInspector<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TTypeInspector>() where TTypeInspector : ITypeInspector
		{
			return WithoutTypeInspector(typeof(TTypeInspector));
		}

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

		protected IEnumerable<IYamlTypeConverter> BuildTypeConverters()
		{
			return typeConverterFactories.BuildComponentList();
		}
	}
	internal delegate TComponent WrapperFactory<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TComponentBase, TComponent>(TComponentBase wrapped) where TComponent : [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] TComponentBase;
	internal delegate TComponent WrapperFactory<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TArgument, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TComponentBase, TComponent>(TComponentBase wrapped, TArgument argument) where TComponent : [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] TComponentBase;
	[Flags]
	internal enum DefaultValuesHandling
	{
		Preserve = 0,
		OmitNull = 1,
		OmitDefaults = 2,
		OmitEmptyCollections = 4
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal sealed class Deserializer : IDeserializer
	{
		private readonly IValueDeserializer valueDeserializer;

		public Deserializer()
			: this(new DeserializerBuilder().BuildValueDeserializer())
		{
		}

		private Deserializer(IValueDeserializer valueDeserializer)
		{
			this.valueDeserializer = valueDeserializer ?? throw new ArgumentNullException("valueDeserializer");
		}

		public static Deserializer FromValueDeserializer(IValueDeserializer valueDeserializer)
		{
			return new Deserializer(valueDeserializer);
		}

		public T Deserialize<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] T>(string input)
		{
			using StringReader input2 = new StringReader(input);
			return Deserialize<T>(input2);
		}

		public T Deserialize<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] T>(TextReader input)
		{
			return Deserialize<T>(new Parser(input));
		}

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public object Deserialize(TextReader input)
		{
			return Deserialize(input, typeof(object));
		}

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public object Deserialize(string input, Type type)
		{
			using StringReader input2 = new StringReader(input);
			return Deserialize(input2, type);
		}

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public object Deserialize(TextReader input, Type type)
		{
			return Deserialize(new Parser(input), type);
		}

		public T Deserialize<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] T>(IParser parser)
		{
			return (T)Deserialize(parser, typeof(T));
		}

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public object Deserialize(IParser parser)
		{
			return Deserialize(parser, typeof(object));
		}

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public object Deserialize(IParser parser, Type type)
		{
			if (parser == null)
			{
				throw new ArgumentNullException("parser");
			}
			if (type == null)
			{
				throw new ArgumentNullException("type");
			}
			YamlDotNet.Core.Events.StreamStart @event;
			bool flag = parser.TryConsume<YamlDotNet.Core.Events.StreamStart>(out @event);
			YamlDotNet.Core.Events.DocumentStart event2;
			bool flag2 = parser.TryConsume<YamlDotNet.Core.Events.DocumentStart>(out event2);
			object result = null;
			if (!parser.Accept<YamlDotNet.Core.Events.DocumentEnd>(out var _) && !parser.Accept<YamlDotNet.Core.Events.StreamEnd>(out var _))
			{
				using SerializerState serializerState = new SerializerState();
				result = valueDeserializer.DeserializeValue(parser, type, serializerState, valueDeserializer);
				serializerState.OnDeserialization();
			}
			if (flag2)
			{
				parser.Consume<YamlDotNet.Core.Events.DocumentEnd>();
			}
			if (flag)
			{
				parser.Consume<YamlDotNet.Core.Events.StreamEnd>();
			}
			return result;
		}
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(new byte[] { 0, 1 })]
	internal sealed class DeserializerBuilder : BuilderSkeleton<DeserializerBuilder>
	{
		private Lazy<IObjectFactory> objectFactory;

		private readonly LazyComponentRegistrationList<Nothing, INodeDeserializer> nodeDeserializerFactories;

		private readonly LazyComponentRegistrationList<Nothing, INodeTypeResolver> nodeTypeResolverFactories;

		private readonly Dictionary<TagName, Type> tagMappings;

		private readonly Dictionary<Type, Type> typeMappings;

		private readonly ITypeConverter typeConverter;

		private bool ignoreUnmatched;

		private bool duplicateKeyChecking;

		private bool attemptUnknownTypeDeserialization;

		protected override DeserializerBuilder Self => this;

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

		internal ITypeInspector BuildTypeInspector()
		{
			ITypeInspector typeInspector = new WritablePropertiesTypeInspector(typeResolver, includeNonPublicProperties);
			if (!ignoreFields)
			{
				typeInspector = new CompositeTypeInspector(new ReadableFieldsTypeInspector(typeResolver), typeInspector);
			}
			return typeInspectorFactories.BuildComponentChain(typeInspector);
		}

		public DeserializerBuilder WithAttemptingUnquotedStringTypeDeserialization()
		{
			attemptUnknownTypeDeserialization = true;
			return this;
		}

		public DeserializerBuilder WithObjectFactory(IObjectFactory objectFactory)
		{
			if (objectFactory == null)
			{
				throw new ArgumentNullException("objectFactory");
			}
			this.objectFactory = new Lazy<IObjectFactory>(() => objectFactory, isThreadSafe: true);
			return this;
		}

		public DeserializerBuilder WithObjectFactory(Func<Type, object> objectFactory)
		{
			if (objectFactory == null)
			{
				throw new ArgumentNullException("objectFactory");
			}
			return WithObjectFactory(new LambdaObjectFactory(objectFactory));
		}

		public DeserializerBuilder WithNodeDeserializer(INodeDeserializer nodeDeserializer)
		{
			return WithNodeDeserializer(nodeDeserializer, delegate(IRegistrationLocationSelectionSyntax<INodeDeserializer> w)
			{
				w.OnTop();
			});
		}

		public DeserializerBuilder WithNodeDeserializer(INodeDeserializer nodeDeserializer, Action<IRegistrationLocationSelectionSyntax<INodeDeserializer>> where)
		{
			if (nodeDeserializer == null)
			{
				throw new ArgumentNullException("nodeDeserializer");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(nodeDeserializerFactories.CreateRegistrationLocationSelector(nodeDeserializer.GetType(), (Nothing _) => nodeDeserializer));
			return this;
		}

		public DeserializerBuilder WithNodeDeserializer<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TNodeDeserializer>(WrapperFactory<INodeDeserializer, TNodeDeserializer> nodeDeserializerFactory, Action<ITrackingRegistrationLocationSelectionSyntax<INodeDeserializer>> where) where TNodeDeserializer : INodeDeserializer
		{
			if (nodeDeserializerFactory == null)
			{
				throw new ArgumentNullException("nodeDeserializerFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(nodeDeserializerFactories.CreateTrackingRegistrationLocationSelector(typeof(TNodeDeserializer), (INodeDeserializer wrapped, Nothing _) => nodeDeserializerFactory(wrapped)));
			return this;
		}

		public DeserializerBuilder WithoutNodeDeserializer<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TNodeDeserializer>() where TNodeDeserializer : INodeDeserializer
		{
			return WithoutNodeDeserializer(typeof(TNodeDeserializer));
		}

		public DeserializerBuilder WithoutNodeDeserializer(Type nodeDeserializerType)
		{
			if (nodeDeserializerType == null)
			{
				throw new ArgumentNullException("nodeDeserializerType");
			}
			nodeDeserializerFactories.Remove(nodeDeserializerType);
			return this;
		}

		public DeserializerBuilder WithNodeTypeResolver(INodeTypeResolver nodeTypeResolver)
		{
			return WithNodeTypeResolver(nodeTypeResolver, delegate(IRegistrationLocationSelectionSyntax<INodeTypeResolver> w)
			{
				w.OnTop();
			});
		}

		public DeserializerBuilder WithNodeTypeResolver(INodeTypeResolver nodeTypeResolver, Action<IRegistrationLocationSelectionSyntax<INodeTypeResolver>> where)
		{
			if (nodeTypeResolver == null)
			{
				throw new ArgumentNullException("nodeTypeResolver");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(nodeTypeResolverFactories.CreateRegistrationLocationSelector(nodeTypeResolver.GetType(), (Nothing _) => nodeTypeResolver));
			return this;
		}

		public DeserializerBuilder WithNodeTypeResolver<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TNodeTypeResolver>(WrapperFactory<INodeTypeResolver, TNodeTypeResolver> nodeTypeResolverFactory, Action<ITrackingRegistrationLocationSelectionSyntax<INodeTypeResolver>> where) where TNodeTypeResolver : INodeTypeResolver
		{
			if (nodeTypeResolverFactory == null)
			{
				throw new ArgumentNullException("nodeTypeResolverFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(nodeTypeResolverFactories.CreateTrackingRegistrationLocationSelector(typeof(TNodeTypeResolver), (INodeTypeResolver wrapped, Nothing _) => nodeTypeResolverFactory(wrapped)));
			return this;
		}

		public DeserializerBuilder WithoutNodeTypeResolver<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TNodeTypeResolver>() where TNodeTypeResolver : INodeTypeResolver
		{
			return WithoutNodeTypeResolver(typeof(TNodeTypeResolver));
		}

		public DeserializerBuilder WithoutNodeTypeResolver(Type nodeTypeResolverType)
		{
			if (nodeTypeResolverType == null)
			{
				throw new ArgumentNullException("nodeTypeResolverType");
			}
			nodeTypeResolverFactories.Remove(nodeTypeResolverType);
			return this;
		}

		public override DeserializerBuilder WithTagMapping(TagName tag, Type type)
		{
			if (tag.IsEmpty)
			{
				throw new ArgumentException("Non-specific tags cannot be maped");
			}
			if (type == null)
			{
				throw new ArgumentNullException("type");
			}
			if (tagMappings.TryGetValue(tag, out var value))
			{
				throw new ArgumentException($"Type already has a registered type '{value.FullName}' for tag '{tag}'", "tag");
			}
			tagMappings.Add(tag, type);
			return this;
		}

		public DeserializerBuilder WithTypeMapping<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TInterface, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TConcrete>() where TConcrete : TInterface
		{
			Type typeFromHandle = typeof(TInterface);
			Type typeFromHandle2 = typeof(TConcrete);
			if (!typeFromHandle.IsAssignableFrom(typeFromHandle2))
			{
				throw new InvalidOperationException("The type '" + typeFromHandle2.Name + "' does not implement interface '" + typeFromHandle.Name + "'.");
			}
			if (typeMappings.ContainsKey(typeFromHandle))
			{
				typeMappings[typeFromHandle] = typeFromHandle2;
			}
			else
			{
				typeMappings.Add(typeFromHandle, typeFromHandle2);
			}
			return this;
		}

		public DeserializerBuilder WithoutTagMapping(TagName tag)
		{
			if (tag.IsEmpty)
			{
				throw new ArgumentException("Non-specific tags cannot be maped");
			}
			if (!tagMappings.Remove(tag))
			{
				throw new KeyNotFoundException($"Tag '{tag}' is not registered");
			}
			return this;
		}

		public DeserializerBuilder IgnoreUnmatchedProperties()
		{
			ignoreUnmatched = true;
			return this;
		}

		public DeserializerBuilder WithDuplicateKeyChecking()
		{
			duplicateKeyChecking = true;
			return this;
		}

		public IDeserializer Build()
		{
			return Deserializer.FromValueDeserializer(BuildValueDeserializer());
		}

		public IValueDeserializer BuildValueDeserializer()
		{
			return new AliasValueDeserializer(new NodeValueDeserializer(nodeDeserializerFactories.BuildComponentList(), nodeTypeResolverFactories.BuildComponentList(), typeConverter));
		}
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal sealed class EmissionPhaseObjectGraphVisitorArgs
	{
		private readonly IEnumerable<IObjectGraphVisitor<Nothing>> preProcessingPhaseVisitors;

		public IObjectGraphVisitor<IEmitter> InnerVisitor { get; private set; }

		public IEventEmitter EventEmitter { get; private set; }

		public ObjectSerializer NestedObjectSerializer { get; private set; }

		public IEnumerable<IYamlTypeConverter> TypeConverters { get; private set; }

		public EmissionPhaseObjectGraphVisitorArgs(IObjectGraphVisitor<IEmitter> innerVisitor, IEventEmitter eventEmitter, IEnumerable<IObjectGraphVisitor<Nothing>> preProcessingPhaseVisitors, IEnumerable<IYamlTypeConverter> typeConverters, ObjectSerializer nestedObjectSerializer)
		{
			InnerVisitor = innerVisitor ?? throw new ArgumentNullException("innerVisitor");
			EventEmitter = eventEmitter ?? throw new ArgumentNullException("eventEmitter");
			this.preProcessingPhaseVisitors = preProcessingPhaseVisitors ?? throw new ArgumentNullException("preProcessingPhaseVisitors");
			TypeConverters = typeConverters ?? throw new ArgumentNullException("typeConverters");
			NestedObjectSerializer = nestedObjectSerializer ?? throw new ArgumentNullException("nestedObjectSerializer");
		}

		public T GetPreProcessingPhaseObjectGraphVisitor<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] T>() where T : IObjectGraphVisitor<Nothing>
		{
			return preProcessingPhaseVisitors.OfType<T>().Single();
		}
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal abstract class EventInfo
	{
		public IObjectDescriptor Source { get; }

		protected EventInfo(IObjectDescriptor source)
		{
			Source = source ?? throw new ArgumentNullException("source");
		}
	}
	internal class AliasEventInfo : EventInfo
	{
		public AnchorName Alias { get; }

		public bool NeedsExpansion { get; set; }

		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
		public AliasEventInfo(IObjectDescriptor source, AnchorName alias)
			: base(source)
		{
			if (alias.IsEmpty)
			{
				throw new ArgumentNullException("alias");
			}
			Alias = alias;
		}
	}
	internal class ObjectEventInfo : EventInfo
	{
		public AnchorName Anchor { get; set; }

		public TagName Tag { get; set; }

		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
		protected ObjectEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal sealed class ScalarEventInfo : ObjectEventInfo
	{
		public string RenderedValue { get; set; }

		public ScalarStyle Style { get; set; }

		public bool IsPlainImplicit { get; set; }

		public bool IsQuotedImplicit { get; set; }

		public ScalarEventInfo(IObjectDescriptor source)
			: base(source)
		{
			Style = source.ScalarStyle;
			RenderedValue = string.Empty;
		}
	}
	internal sealed class MappingStartEventInfo : ObjectEventInfo
	{
		public bool IsImplicit { get; set; }

		public MappingStyle Style { get; set; }

		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
		public MappingStartEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
	}
	internal sealed class MappingEndEventInfo : EventInfo
	{
		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
		public MappingEndEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
	}
	internal sealed class SequenceStartEventInfo : ObjectEventInfo
	{
		public bool IsImplicit { get; set; }

		public SequenceStyle Style { get; set; }

		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
		public SequenceStartEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
	}
	internal sealed class SequenceEndEventInfo : EventInfo
	{
		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
		public SequenceEndEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface IAliasProvider
	{
		AnchorName GetAlias(object target);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	public interface IDeserializer
	{
		T Deserialize<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] T>(string input);

		T Deserialize<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] T>(TextReader input);

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		object Deserialize(TextReader input);

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		object Deserialize(string input, Type type);

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		object Deserialize(TextReader input, Type type);

		T Deserialize<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] T>(IParser parser);

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		object Deserialize(IParser parser);

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		object Deserialize(IParser parser, Type type);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface IEventEmitter
	{
		void Emit(AliasEventInfo eventInfo, IEmitter emitter);

		void Emit(ScalarEventInfo eventInfo, IEmitter emitter);

		void Emit(MappingStartEventInfo eventInfo, IEmitter emitter);

		void Emit(MappingEndEventInfo eventInfo, IEmitter emitter);

		void Emit(SequenceStartEventInfo eventInfo, IEmitter emitter);

		void Emit(SequenceEndEventInfo eventInfo, IEmitter emitter);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface INamingConvention
	{
		string Apply(string value);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface INodeDeserializer
	{
		bool Deserialize(IParser reader, Type expectedType, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(new byte[] { 1, 1, 1, 2 })] Func<IParser, Type, object> nestedObjectDeserializer, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] out object value);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface INodeTypeResolver
	{
		bool Resolve([<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] NodeEvent nodeEvent, ref Type currentType);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface IObjectAccessor
	{
		void Set(string name, object target, object value);

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		object Read(string name, object target);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface IObjectDescriptor
	{
		[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		object Value
		{
			[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
			get;
		}

		Type Type { get; }

		Type StaticType { get; }

		ScalarStyle ScalarStyle { get; }
	}
	internal static class ObjectDescriptorExtensions
	{
		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
		public static object NonNullValue(this IObjectDescriptor objectDescriptor)
		{
			return objectDescriptor.Value ?? throw new InvalidOperationException("Attempted to use a IObjectDescriptor of type '" + objectDescriptor.Type.FullName + "' whose Value is null at a point whete it is invalid to do so. This may indicate a bug in YamlDotNet.");
		}
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface IObjectFactory
	{
		object Create(Type type);

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		object CreatePrimitive(Type type);

		bool GetDictionary(IObjectDescriptor descriptor, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] out IDictionary dictionary, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(new byte[] { 2, 1 })] out Type[] genericArguments);

		Type GetValueType(Type type);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface IObjectGraphTraversalStrategy
	{
		void Traverse<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TContext>(IObjectDescriptor graph, IObjectGraphVisitor<TContext> visitor, TContext context);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface IObjectGraphVisitor<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TContext>
	{
		bool Enter(IObjectDescriptor value, TContext context);

		bool EnterMapping(IObjectDescriptor key, IObjectDescriptor value, TContext context);

		bool EnterMapping(IPropertyDescriptor key, IObjectDescriptor value, TContext context);

		void VisitScalar(IObjectDescriptor scalar, TContext context);

		void VisitMappingStart(IObjectDescriptor mapping, Type keyType, Type valueType, TContext context);

		void VisitMappingEnd(IObjectDescriptor mapping, TContext context);

		void VisitSequenceStart(IObjectDescriptor sequence, Type elementType, TContext context);

		void VisitSequenceEnd(IObjectDescriptor sequence, TContext context);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface IPropertyDescriptor
	{
		string Name { get; }

		bool CanWrite { get; }

		Type Type { get; }

		[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		Type TypeOverride
		{
			[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
			get;
			[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
			set;
		}

		int Order { get; set; }

		ScalarStyle ScalarStyle { get; set; }

		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)]
		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		T GetCustomAttribute<T>() where T : [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] Attribute;

		IObjectDescriptor Read(object target);

		void Write(object target, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object value);
	}
	internal interface IRegistrationLocationSelectionSyntax<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TBaseRegistrationType>
	{
		void InsteadOf<TRegistrationType>() where TRegistrationType : [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] TBaseRegistrationType;

		void Before<TRegistrationType>() where TRegistrationType : [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] TBaseRegistrationType;

		void After<TRegistrationType>() where TRegistrationType : [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] TBaseRegistrationType;

		void OnTop();

		void OnBottom();
	}
	internal interface ITrackingRegistrationLocationSelectionSyntax<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TBaseRegistrationType>
	{
		void InsteadOf<TRegistrationType>() where TRegistrationType : [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] TBaseRegistrationType;
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	public interface ISerializer
	{
		void Serialize(TextWriter writer, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object graph);

		string Serialize([<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object graph);

		void Serialize(TextWriter writer, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object graph, Type type);

		void Serialize(IEmitter emitter, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object graph);

		void Serialize(IEmitter emitter, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object graph, Type type);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface ITypeInspector
	{
		IEnumerable<IPropertyDescriptor> GetProperties(Type type, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object container);

		IPropertyDescriptor GetProperty(Type type, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object container, string name, [MaybeNullWhen(true)] bool ignoreUnmatched);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface ITypeResolver
	{
		Type Resolve(Type staticType, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object actualValue);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface IValueDeserializer
	{
		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		object DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer);
	}
	internal interface IValuePromise
	{
		[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(new byte[] { 1, 2 })]
		event Action<object> ValueAvailable;
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
	internal interface IValueSerializer
	{
		void SerializeValue([<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] IEmitter emitter, object value, Type type);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface IYamlConvertible
	{
		void Read(IParser parser, Type expectedType, ObjectDeserializer nestedObjectDeserializer);

		void Write(IEmitter emitter, ObjectSerializer nestedObjectSerializer);
	}
	[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
	internal delegate object ObjectDeserializer(Type type);
	internal delegate void ObjectSerializer(object value, Type type = null);
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[Obsolete("Please use IYamlConvertible instead")]
	internal interface IYamlSerializable
	{
		void ReadYaml(IParser parser);

		void WriteYaml(IEmitter emitter);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	internal interface IYamlTypeConverter
	{
		bool Accepts(Type type);

		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		object ReadYaml(IParser parser, Type type);

		void WriteYaml(IEmitter emitter, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object value, Type type);
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal sealed class LazyComponentRegistrationList<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TArgument, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TComponent> : IEnumerable<Func<TArgument, TComponent>>, IEnumerable
	{
		[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
		public sealed class LazyComponentRegistration
		{
			public readonly Type ComponentType;

			public readonly Func<TArgument, TComponent> Factory;

			public LazyComponentRegistration(Type componentType, Func<TArgument, TComponent> factory)
			{
				ComponentType = componentType;
				Factory = factory;
			}
		}

		[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
		public sealed class TrackingLazyComponentRegistration
		{
			public readonly Type ComponentType;

			public readonly Func<TComponent, TArgument, TComponent> Factory;

			public TrackingLazyComponentRegistration(Type componentType, Func<TComponent, TArgument, TComponent> factory)
			{
				ComponentType = componentType;
				Factory = factory;
			}
		}

		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)]
		private class RegistrationLocationSelector : IRegistrationLocationSelectionSyntax<TComponent>
		{
			[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)]
			private readonly LazyComponentRegistrationList<TArgument, TComponent> registrations;

			[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(new byte[] { 1, 0, 0 })]
			private readonly LazyComponentRegistration newRegistration;

			[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
			public RegistrationLocationSelector(LazyComponentRegistrationList<TArgument, TComponent> registrations, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(new byte[] { 1, 0, 0 })] LazyComponentRegistration newRegistration)
			{
				this.registrations = registrations;
				this.newRegistration = newRegistration;
			}

			void IRegistrationLocationSelectionSyntax<TComponent>.InsteadOf<TRegistrationType>()
			{
				if (newRegistration.ComponentType != typeof(TRegistrationType))
				{
					registrations.EnsureNoDuplicateRegistrationType(newRegistration.ComponentType);
				}
				int index = registrations.EnsureRegistrationExists<TRegistrationType>();
				registrations.entries[index] = newRegistration;
			}

			void IRegistrationLocationSelectionSyntax<TComponent>.After<TRegistrationType>()
			{
				registrations.EnsureNoDuplicateRegistrationType(newRegistration.ComponentType);
				int num = registrations.EnsureRegistrationExists<TRegistrationType>();
				registrations.entries.Insert(num + 1, newRegistration);
			}

			void IRegistrationLocationSelectionSyntax<TComponent>.Before<TRegistrationType>()
			{
				registrations.EnsureNoDuplicateRegistrationType(newRegistration.ComponentType);
				int index = registrations.EnsureRegistrationExists<TRegistrationType>();
				registrations.entries.Insert(index, newRegistration);
			}

			void IRegistrationLocationSelectionSyntax<TComponent>.OnBottom()
			{
				registrations.EnsureNoDuplicateRegistrationType(newRegistration.ComponentType);
				registrations.entries.Add(newRegistration);
			}

			void IRegistrationLocationSelectionSyntax<TComponent>.OnTop()
			{
				registrations.EnsureNoDuplicateRegistrationType(newRegistration.ComponentType);
				registrations.entries.Insert(0, newRegistration);
			}
		}

		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)]
		private class TrackingRegistrationLocationSelector : ITrackingRegistrationLocationSelectionSyntax<TComponent>
		{
			[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)]
			private readonly LazyComponentRegistrationList<TArgument, TComponent> registrations;

			[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(new byte[] { 1, 0, 0 })]
			private readonly TrackingLazyComponentRegistration newRegistration;

			[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
			public TrackingRegistrationLocationSelector(LazyComponentRegistrationList<TArgument, TComponent> registrations, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(new byte[] { 1, 0, 0 })] TrackingLazyComponentRegistration newRegistration)
			{
				this.registrations = registrations;
				this.newRegistration = newRegistration;
			}

			void ITrackingRegistrationLocationSelectionSyntax<TComponent>.InsteadOf<TRegistrationType>()
			{
				if (newRegistration.ComponentType != typeof(TRegistrationType))
				{
					registrations.EnsureNoDuplicateRegistrationType(newRegistration.ComponentType);
				}
				int index = registrations.EnsureRegistrationExists<TRegistrationType>();
				Func<TArgument, TComponent> innerComponentFactory = registrations.entries[index].Factory;
				registrations.entries[index] = new LazyComponentRegistration(newRegistration.ComponentType, [<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)] (TArgument arg) => newRegistration.Factory(innerComponentFactory(arg), arg));
			}
		}

		[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(new byte[] { 1, 1, 0, 0 })]
		private readonly List<LazyComponentRegistration> entries = new List<LazyComponentRegistration>();

		public int Count => entries.Count;

		public IEnumerable<Func<TArgument, TComponent>> InReverseOrder
		{
			get
			{
				int i = entries.Count - 1;
				while (i >= 0)
				{
					yield return entries[i].Factory;
					int num = i - 1;
					i = num;
				}
			}
		}

		public LazyComponentRegistrationList<TArgument, TComponent> Clone()
		{
			LazyComponentRegistrationList<TArgument, TComponent> lazyComponentRegistrationList = new LazyComponentRegistrationList<TArgument, TComponent>();
			foreach (LazyComponentRegistration entry in entries)
			{
				lazyComponentRegistrationList.entries.Add(entry);
			}
			return lazyComponentRegistrationList;
		}

		public void Clear()
		{
			entries.Clear();
		}

		public void Add(Type componentType, Func<TArgument, TComponent> factory)
		{
			entries.Add(new LazyComponentRegistration(componentType, factory));
		}

		public void Remove(Type componentType)
		{
			for (int i = 0; i < entries.Count; i++)
			{
				if (entries[i].ComponentType == componentType)
				{
					entries.RemoveAt(i);
					return;
				}
			}
			throw new KeyNotFoundException("A component registration of type '" + componentType.FullName + "' was not found.");
		}

		public IRegistrationLocationSelectionSyntax<TComponent> CreateRegistrationLocationSelector(Type componentType, Func<TArgument, TComponent> factory)
		{
			return new RegistrationLocationSelector(this, new LazyComponentRegistration(componentType, factory));
		}

		public ITrackingRegistrationLocationSelectionSyntax<TComponent> CreateTrackingRegistrationLocationSelector(Type componentType, Func<TComponent, TArgument, TComponent> factory)
		{
			return new TrackingRegistrationLocationSelector(this, new TrackingLazyComponentRegistration(componentType, factory));
		}

		public IEnumerator<Func<TArgument, TComponent>> GetEnumerator()
		{
			return entries.Select([<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)] (LazyComponentRegistration e) => e.Factory).GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}

		private int IndexOfRegistration(Type registrationType)
		{
			for (int i = 0; i < entries.Count; i++)
			{
				if (registrationType == entries[i].ComponentType)
				{
					return i;
				}
			}
			return -1;
		}

		private void EnsureNoDuplicateRegistrationType(Type componentType)
		{
			if (IndexOfRegistration(componentType) != -1)
			{
				throw new InvalidOperationException("A component of type '" + componentType.FullName + "' has already been registered.");
			}
		}

		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
		private int EnsureRegistrationExists<TRegistrationType>()
		{
			int num = IndexOfRegistration(typeof(TRegistrationType));
			if (num == -1)
			{
				throw new InvalidOperationException("A component of type '" + typeof(TRegistrationType).FullName + "' has not been registered.");
			}
			return num;
		}
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal static class LazyComponentRegistrationListExtensions
	{
		public static TComponent BuildComponentChain<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TComponent>(this LazyComponentRegistrationList<TComponent, TComponent> registrations, TComponent innerComponent)
		{
			return registrations.InReverseOrder.Aggregate(innerComponent, [<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)] (TComponent inner, Func<TComponent, TComponent> factory) => factory(inner));
		}

		public static TComponent BuildComponentChain<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TArgument, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TComponent>(this LazyComponentRegistrationList<TArgument, TComponent> registrations, TComponent innerComponent, Func<TComponent, TArgument> argumentBuilder)
		{
			return registrations.InReverseOrder.Aggregate(innerComponent, [<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)] (TComponent inner, Func<TArgument, TComponent> factory) => factory(argumentBuilder(inner)));
		}

		public static List<TComponent> BuildComponentList<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TComponent>(this LazyComponentRegistrationList<Nothing, TComponent> registrations)
		{
			return registrations.Select([<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)] (Func<Nothing, TComponent> factory) => factory(default(Nothing))).ToList();
		}

		public static List<TComponent> BuildComponentList<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TArgument, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] TComponent>(this LazyComponentRegistrationList<TArgument, TComponent> registrations, TArgument argument)
		{
			return registrations.Select([<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)] (Func<TArgument, TComponent> factory) => factory(argument)).ToList();
		}
	}
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	internal struct Nothing
	{
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal sealed class ObjectDescriptor : IObjectDescriptor
	{
		[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		[field: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public object Value
		{
			[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
			get;
			[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
			private set;
		}

		public Type Type { get; private set; }

		public Type StaticType { get; private set; }

		public ScalarStyle ScalarStyle { get; private set; }

		public ObjectDescriptor([<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object value, Type type, Type staticType)
			: this(value, type, staticType, ScalarStyle.Any)
		{
		}

		public ObjectDescriptor([<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object value, Type type, Type staticType, ScalarStyle scalarStyle)
		{
			Value = value;
			Type = type ?? throw new ArgumentNullException("type");
			StaticType = staticType ?? throw new ArgumentNullException("staticType");
			ScalarStyle = scalarStyle;
		}
	}
	internal delegate IObjectGraphTraversalStrategy ObjectGraphTraversalStrategyFactory(ITypeInspector typeInspector, ITypeResolver typeResolver, IEnumerable<IYamlTypeConverter> typeConverters, int maximumRecursion);
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal sealed class PropertyDescriptor : IPropertyDescriptor
	{
		private readonly IPropertyDescriptor baseDescriptor;

		public string Name { get; set; }

		public Type Type => baseDescriptor.Type;

		[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public Type TypeOverride
		{
			[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
			get
			{
				return baseDescriptor.TypeOverride;
			}
			[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
			set
			{
				baseDescriptor.TypeOverride = value;
			}
		}

		public int Order { get; set; }

		public ScalarStyle ScalarStyle
		{
			get
			{
				return baseDescriptor.ScalarStyle;
			}
			set
			{
				baseDescriptor.ScalarStyle = value;
			}
		}

		public bool CanWrite => baseDescriptor.CanWrite;

		public PropertyDescriptor(IPropertyDescriptor baseDescriptor)
		{
			this.baseDescriptor = baseDescriptor;
			Name = baseDescriptor.Name;
		}

		public void Write(object target, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object value)
		{
			baseDescriptor.Write(target, value);
		}

		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)]
		[return: <845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)]
		public T GetCustomAttribute<T>() where T : [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] Attribute
		{
			return baseDescriptor.GetCustomAttribute<T>();
		}

		public IObjectDescriptor Read(object target)
		{
			return baseDescriptor.Read(target);
		}
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal sealed class Serializer : ISerializer
	{
		private readonly IValueSerializer valueSerializer;

		private readonly EmitterSettings emitterSettings;

		public Serializer()
			: this(new SerializerBuilder().BuildValueSerializer(), EmitterSettings.Default)
		{
		}

		private Serializer(IValueSerializer valueSerializer, EmitterSettings emitterSettings)
		{
			this.valueSerializer = valueSerializer ?? throw new ArgumentNullException("valueSerializer");
			this.emitterSettings = emitterSettings ?? throw new ArgumentNullException("emitterSettings");
		}

		public static Serializer FromValueSerializer(IValueSerializer valueSerializer, EmitterSettings emitterSettings)
		{
			return new Serializer(valueSerializer, emitterSettings);
		}

		public void Serialize(TextWriter writer, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object graph)
		{
			Serialize(new Emitter(writer, emitterSettings), graph);
		}

		public string Serialize([<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object graph)
		{
			using StringWriter stringWriter = new StringWriter();
			Serialize(stringWriter, graph);
			return stringWriter.ToString();
		}

		public void Serialize(TextWriter writer, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object graph, Type type)
		{
			Serialize(new Emitter(writer, emitterSettings), graph, type);
		}

		public void Serialize(IEmitter emitter, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object graph)
		{
			if (emitter == null)
			{
				throw new ArgumentNullException("emitter");
			}
			EmitDocument(emitter, graph, null);
		}

		public void Serialize(IEmitter emitter, [<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(2)] object graph, Type type)
		{
			if (emitter == null)
			{
				throw new ArgumentNullException("emitter");
			}
			if (type == null)
			{
				throw new ArgumentNullException("type");
			}
			EmitDocument(emitter, graph, type);
		}

		[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
		private void EmitDocument([<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] IEmitter emitter, object graph, Type type)
		{
			emitter.Emit(new YamlDotNet.Core.Events.StreamStart());
			emitter.Emit(new YamlDotNet.Core.Events.DocumentStart());
			valueSerializer.SerializeValue(emitter, graph, type);
			emitter.Emit(new YamlDotNet.Core.Events.DocumentEnd(isImplicit: true));
			emitter.Emit(new YamlDotNet.Core.Events.StreamEnd());
		}
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(new byte[] { 0, 1 })]
	internal sealed class SerializerBuilder : BuilderSkeleton<SerializerBuilder>
	{
		[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
		private class ValueSerializer : IValueSerializer
		{
			private readonly IObjectGraphTraversalStrategy traversalStrategy;

			private readonly IEventEmitter eventEmitter;

			private readonly IEnumerable<IYamlTypeConverter> typeConverters;

			private readonly LazyComponentRegistrationList<IEnumerable<IYamlTypeConverter>, IObjectGraphVisitor<Nothing>> preProcessingPhaseObjectGraphVisitorFactories;

			private readonly LazyComponentRegistrationList<EmissionPhaseObjectGraphVisitorArgs, IObjectGraphVisitor<IEmitter>> emissionPhaseObjectGraphVisitorFactories;

			public ValueSerializer(IObjectGraphTraversalStrategy traversalStrategy, IEventEmitter eventEmitter, IEnumerable<IYamlTypeConverter> typeConverters, LazyComponentRegistrationList<IEnumerable<IYamlTypeConverter>, IObjectGraphVisitor<Nothing>> preProcessingPhaseObjectGraphVisitorFactories, LazyComponentRegistrationList<EmissionPhaseObjectGraphVisitorArgs, IObjectGraphVisitor<IEmitter>> emissionPhaseObjectGraphVisitorFactories)
			{
				this.traversalStrategy = traversalStrategy;
				this.eventEmitter = eventEmitter;
				this.typeConverters = typeConverters;
				this.preProcessingPhaseObjectGraphVisitorFactories = preProcessingPhaseObjectGraphVisitorFactories;
				this.emissionPhaseObjectGraphVisitorFactories = emissionPhaseObjectGraphVisitorFactories;
			}

			[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
			public void SerializeValue([<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] IEmitter emitter, object value, Type type)
			{
				Type type2 = type ?? ((value != null) ? value.GetType() : typeof(object));
				Type staticType = type ?? typeof(object);
				ObjectDescriptor graph = new ObjectDescriptor(value, type2, staticType);
				List<IObjectGraphVisitor<Nothing>> preProcessingPhaseObjectGraphVisitors = preProcessingPhaseObjectGraphVisitorFactories.BuildComponentList(typeConverters);
				foreach (IObjectGraphVisitor<Nothing> item in preProcessingPhaseObjectGraphVisitors)
				{
					traversalStrategy.Traverse(graph, item, default(Nothing));
				}
				IObjectGraphVisitor<IEmitter> visitor = emissionPhaseObjectGraphVisitorFactories.BuildComponentChain(new EmittingObjectGraphVisitor(eventEmitter), [<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)] (IObjectGraphVisitor<IEmitter> inner) => new EmissionPhaseObjectGraphVisitorArgs(inner, eventEmitter, preProcessingPhaseObjectGraphVisitors, typeConverters, NestedObjectSerializer));
				traversalStrategy.Traverse(graph, visitor, emitter);
				[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(2)]
				void NestedObjectSerializer(object v, Type t)
				{
					SerializeValue(emitter, v, t);
				}
			}
		}

		private ObjectGraphTraversalStrategyFactory objectGraphTraversalStrategyFactory;

		private readonly LazyComponentRegistrationList<IEnumerable<IYamlTypeConverter>, IObjectGraphVisitor<Nothing>> preProcessingPhaseObjectGraphVisitorFactories;

		private readonly LazyComponentRegistrationList<EmissionPhaseObjectGraphVisitorArgs, IObjectGraphVisitor<IEmitter>> emissionPhaseObjectGraphVisitorFactories;

		private readonly LazyComponentRegistrationList<IEventEmitter, IEventEmitter> eventEmitterFactories;

		private readonly IDictionary<Type, TagName> tagMappings = new Dictionary<Type, TagName>();

		private readonly IObjectFactory objectFactory;

		private int maximumRecursion = 50;

		private EmitterSettings emitterSettings = EmitterSettings.Default;

		private DefaultValuesHandling defaultValuesHandlingConfiguration;

		private bool quoteNecessaryStrings;

		private bool quoteYaml1_1Strings;

		protected override SerializerBuilder Self => this;

		public SerializerBuilder()
			: base((ITypeResolver)new DynamicTypeResolver())
		{
			typeInspectorFactories.Add(typeof(CachedTypeInspector), (ITypeInspector inner) => new CachedTypeInspector(inner));
			typeInspectorFactories.Add(typeof(NamingConventionTypeInspector), (ITypeInspector inner) => (!(namingConvention is NullNamingConvention)) ? new NamingConventionTypeInspector(inner, namingConvention) : inner);
			typeInspectorFactories.Add(typeof(YamlAttributesTypeInspector), (ITypeInspector inner) => new YamlAttributesTypeInspector(inner));
			typeInspectorFactories.Add(typeof(YamlAttributeOverridesInspector), (ITypeInspector inner) => (overrides == null) ? inner : new YamlAttributeOverridesInspector(inner, overrides.Clone()));
			preProcessingPhaseObjectGraphVisitorFactories = new LazyComponentRegistrationList<IEnumerable<IYamlTypeConverter>, IObjectGraphVisitor<Nothing>> { 
			{
				typeof(AnchorAssigner),
				(IEnumerable<IYamlTypeConverter> typeConverters) => new AnchorAssigner(typeConverters)
			} };
			emissionPhaseObjectGraphVisitorFactories = new LazyComponentRegistrationList<EmissionPhaseObjectGraphVisitorArgs, IObjectGraphVisitor<IEmitter>>
			{
				{
					typeof(CustomSerializationObjectGraphVisitor),
					(EmissionPhaseObjectGraphVisitorArgs args) => new CustomSerializationObjectGraphVisitor(args.InnerVisitor, args.TypeConverters, args.NestedObjectSerializer)
				},
				{
					typeof(AnchorAssigningObjectGraphVisitor),
					(EmissionPhaseObjectGraphVisitorArgs args) => new AnchorAssigningObjectGraphVisitor(args.InnerVisitor, args.EventEmitter, args.GetPreProcessingPhaseObjectGraphVisitor<AnchorAssigner>())
				},
				{
					typeof(DefaultValuesObjectGraphVisitor),
					(EmissionPhaseObjectGraphVisitorArgs args) => new DefaultValuesObjectGraphVisitor(defaultValuesHandlingConfiguration, args.InnerVisitor, new DefaultObjectFactory())
				},
				{
					typeof(CommentsObjectGraphVisitor),
					(EmissionPhaseObjectGraphVisitorArgs args) => new CommentsObjectGraphVisitor(args.InnerVisitor)
				}
			};
			eventEmitterFactories = new LazyComponentRegistrationList<IEventEmitter, IEventEmitter> { 
			{
				typeof(TypeAssigningEventEmitter),
				(IEventEmitter inner) => new TypeAssigningEventEmitter(inner, requireTagWhenStaticAndActualTypesAreDifferent: false, tagMappings, quoteNecessaryStrings, quoteYaml1_1Strings)
			} };
			objectFactory = new DefaultObjectFactory();
			objectGraphTraversalStrategyFactory = (ITypeInspector typeInspector, ITypeResolver typeResolver, IEnumerable<IYamlTypeConverter> typeConverters, int maximumRecursion) => new FullObjectGraphTraversalStrategy(typeInspector, typeResolver, maximumRecursion, namingConvention, objectFactory);
		}

		public SerializerBuilder WithQuotingNecessaryStrings(bool quoteYaml1_1Strings = false)
		{
			quoteNecessaryStrings = true;
			this.quoteYaml1_1Strings = quoteYaml1_1Strings;
			return this;
		}

		public SerializerBuilder WithMaximumRecursion(int maximumRecursion)
		{
			if (maximumRecursion <= 0)
			{
				throw new ArgumentOutOfRangeException("maximumRecursion", $"The maximum recursion specified ({maximumRecursion}) is invalid. It should be a positive integer.");
			}
			this.maximumRecursion = maximumRecursion;
			return this;
		}

		public SerializerBuilder WithEventEmitter<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TEventEmitter>(Func<IEventEmitter, TEventEmitter> eventEmitterFactory) where TEventEmitter : IEventEmitter
		{
			return WithEventEmitter(eventEmitterFactory, delegate(IRegistrationLocationSelectionSyntax<IEventEmitter> w)
			{
				w.OnTop();
			});
		}

		public SerializerBuilder WithEventEmitter<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TEventEmitter>(Func<IEventEmitter, TEventEmitter> eventEmitterFactory, Action<IRegistrationLocationSelectionSyntax<IEventEmitter>> where) where TEventEmitter : IEventEmitter
		{
			if (eventEmitterFactory == null)
			{
				throw new ArgumentNullException("eventEmitterFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(eventEmitterFactories.CreateRegistrationLocationSelector(typeof(TEventEmitter), (IEventEmitter inner) => eventEmitterFactory(inner)));
			return Self;
		}

		public SerializerBuilder WithEventEmitter<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TEventEmitter>(WrapperFactory<IEventEmitter, IEventEmitter, TEventEmitter> eventEmitterFactory, Action<ITrackingRegistrationLocationSelectionSyntax<IEventEmitter>> where) where TEventEmitter : IEventEmitter
		{
			if (eventEmitterFactory == null)
			{
				throw new ArgumentNullException("eventEmitterFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(eventEmitterFactories.CreateTrackingRegistrationLocationSelector(typeof(TEventEmitter), (IEventEmitter wrapped, IEventEmitter inner) => eventEmitterFactory(wrapped, inner)));
			return Self;
		}

		public SerializerBuilder WithoutEventEmitter<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TEventEmitter>() where TEventEmitter : IEventEmitter
		{
			return WithoutEventEmitter(typeof(TEventEmitter));
		}

		public SerializerBuilder WithoutEventEmitter(Type eventEmitterType)
		{
			if (eventEmitterType == null)
			{
				throw new ArgumentNullException("eventEmitterType");
			}
			eventEmitterFactories.Remove(eventEmitterType);
			return this;
		}

		public override SerializerBuilder WithTagMapping(TagName tag, Type type)
		{
			if (tag.IsEmpty)
			{
				throw new ArgumentException("Non-specific tags cannot be maped");
			}
			if (type == null)
			{
				throw new ArgumentNullException("type");
			}
			if (tagMappings.TryGetValue(type, out var value))
			{
				throw new ArgumentException($"Type already has a registered tag '{value}' for type '{type.FullName}'", "type");
			}
			tagMappings.Add(type, tag);
			return this;
		}

		public SerializerBuilder WithoutTagMapping(Type type)
		{
			if (type == null)
			{
				throw new ArgumentNullException("type");
			}
			if (!tagMappings.Remove(type))
			{
				throw new KeyNotFoundException("Tag for type '" + type.FullName + "' is not registered");
			}
			return this;
		}

		public SerializerBuilder EnsureRoundtrip()
		{
			objectGraphTraversalStrategyFactory = (ITypeInspector typeInspector, ITypeResolver typeResolver, IEnumerable<IYamlTypeConverter> typeConverters, int maximumRecursion) => new RoundtripObjectGraphTraversalStrategy(typeConverters, typeInspector, typeResolver, maximumRecursion, namingConvention, settings, objectFactory);
			WithEventEmitter([<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)] ([<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] IEventEmitter inner) => new TypeAssigningEventEmitter(inner, requireTagWhenStaticAndActualTypesAreDifferent: true, tagMappings, quoteNecessaryStrings, quoteYaml1_1Strings), delegate(IRegistrationLocationSelectionSyntax<IEventEmitter> loc)
			{
				loc.InsteadOf<TypeAssigningEventEmitter>();
			});
			return WithTypeInspector([<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)] ([<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] ITypeInspector inner) => new ReadableAndWritablePropertiesTypeInspector(inner), delegate(IRegistrationLocationSelectionSyntax<ITypeInspector> loc)
			{
				loc.OnBottom();
			});
		}

		public SerializerBuilder DisableAliases()
		{
			preProcessingPhaseObjectGraphVisitorFactories.Remove(typeof(AnchorAssigner));
			emissionPhaseObjectGraphVisitorFactories.Remove(typeof(AnchorAssigningObjectGraphVisitor));
			return this;
		}

		[Obsolete("The default behavior is now to always emit default values, thefore calling this method has no effect. This behavior is now controlled by ConfigureDefaultValuesHandling.", true)]
		public SerializerBuilder EmitDefaults()
		{
			return ConfigureDefaultValuesHandling(DefaultValuesHandling.Preserve);
		}

		public SerializerBuilder ConfigureDefaultValuesHandling(DefaultValuesHandling configuration)
		{
			defaultValuesHandlingConfiguration = configuration;
			return this;
		}

		public SerializerBuilder JsonCompatible()
		{
			emitterSettings = emitterSettings.WithMaxSimpleKeyLength(int.MaxValue).WithoutAnchorName();
			return WithTypeConverter(new YamlDotNet.Serialization.Converters.GuidConverter(jsonCompatible: true), delegate(IRegistrationLocationSelectionSyntax<IYamlTypeConverter> w)
			{
				w.InsteadOf<YamlDotNet.Serialization.Converters.GuidConverter>();
			}).WithTypeConverter(new YamlDotNet.Serialization.Converters.DateTimeConverter(DateTimeKind.Utc, null, true)).WithEventEmitter([<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(0)] ([<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(1)] IEventEmitter inner) => new JsonEventEmitter(inner), delegate(IRegistrationLocationSelectionSyntax<IEventEmitter> loc)
			{
				loc.InsteadOf<TypeAssigningEventEmitter>();
			});
		}

		public SerializerBuilder WithNewLine(string newLine)
		{
			emitterSettings = emitterSettings.WithNewLine(newLine);
			return this;
		}

		public SerializerBuilder WithPreProcessingPhaseObjectGraphVisitor<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TObjectGraphVisitor>(TObjectGraphVisitor objectGraphVisitor) where TObjectGraphVisitor : IObjectGraphVisitor<Nothing>
		{
			return WithPreProcessingPhaseObjectGraphVisitor(objectGraphVisitor, delegate(IRegistrationLocationSelectionSyntax<IObjectGraphVisitor<Nothing>> w)
			{
				w.OnTop();
			});
		}

		public SerializerBuilder WithPreProcessingPhaseObjectGraphVisitor<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TObjectGraphVisitor>(TObjectGraphVisitor objectGraphVisitor, Action<IRegistrationLocationSelectionSyntax<IObjectGraphVisitor<Nothing>>> where) where TObjectGraphVisitor : IObjectGraphVisitor<Nothing>
		{
			if (objectGraphVisitor == null)
			{
				throw new ArgumentNullException("objectGraphVisitor");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(preProcessingPhaseObjectGraphVisitorFactories.CreateRegistrationLocationSelector(typeof(TObjectGraphVisitor), (IEnumerable<IYamlTypeConverter> _) => objectGraphVisitor));
			return this;
		}

		public SerializerBuilder WithPreProcessingPhaseObjectGraphVisitor<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TObjectGraphVisitor>(WrapperFactory<IObjectGraphVisitor<Nothing>, TObjectGraphVisitor> objectGraphVisitorFactory, Action<ITrackingRegistrationLocationSelectionSyntax<IObjectGraphVisitor<Nothing>>> where) where TObjectGraphVisitor : IObjectGraphVisitor<Nothing>
		{
			if (objectGraphVisitorFactory == null)
			{
				throw new ArgumentNullException("objectGraphVisitorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(preProcessingPhaseObjectGraphVisitorFactories.CreateTrackingRegistrationLocationSelector(typeof(TObjectGraphVisitor), (IObjectGraphVisitor<Nothing> wrapped, IEnumerable<IYamlTypeConverter> _) => objectGraphVisitorFactory(wrapped)));
			return this;
		}

		public SerializerBuilder WithoutPreProcessingPhaseObjectGraphVisitor<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TObjectGraphVisitor>() where TObjectGraphVisitor : IObjectGraphVisitor<Nothing>
		{
			return WithoutPreProcessingPhaseObjectGraphVisitor(typeof(TObjectGraphVisitor));
		}

		public SerializerBuilder WithoutPreProcessingPhaseObjectGraphVisitor(Type objectGraphVisitorType)
		{
			if (objectGraphVisitorType == null)
			{
				throw new ArgumentNullException("objectGraphVisitorType");
			}
			preProcessingPhaseObjectGraphVisitorFactories.Remove(objectGraphVisitorType);
			return this;
		}

		public SerializerBuilder WithObjectGraphTraversalStrategyFactory(ObjectGraphTraversalStrategyFactory objectGraphTraversalStrategyFactory)
		{
			this.objectGraphTraversalStrategyFactory = objectGraphTraversalStrategyFactory;
			return this;
		}

		public SerializerBuilder WithEmissionPhaseObjectGraphVisitor<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TObjectGraphVisitor>(Func<EmissionPhaseObjectGraphVisitorArgs, TObjectGraphVisitor> objectGraphVisitorFactory) where TObjectGraphVisitor : IObjectGraphVisitor<IEmitter>
		{
			return WithEmissionPhaseObjectGraphVisitor(objectGraphVisitorFactory, delegate(IRegistrationLocationSelectionSyntax<IObjectGraphVisitor<IEmitter>> w)
			{
				w.OnTop();
			});
		}

		public SerializerBuilder WithEmissionPhaseObjectGraphVisitor<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TObjectGraphVisitor>(Func<EmissionPhaseObjectGraphVisitorArgs, TObjectGraphVisitor> objectGraphVisitorFactory, Action<IRegistrationLocationSelectionSyntax<IObjectGraphVisitor<IEmitter>>> where) where TObjectGraphVisitor : IObjectGraphVisitor<IEmitter>
		{
			if (objectGraphVisitorFactory == null)
			{
				throw new ArgumentNullException("objectGraphVisitorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(emissionPhaseObjectGraphVisitorFactories.CreateRegistrationLocationSelector(typeof(TObjectGraphVisitor), (EmissionPhaseObjectGraphVisitorArgs args) => objectGraphVisitorFactory(args)));
			return this;
		}

		public SerializerBuilder WithEmissionPhaseObjectGraphVisitor<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TObjectGraphVisitor>(WrapperFactory<EmissionPhaseObjectGraphVisitorArgs, IObjectGraphVisitor<IEmitter>, TObjectGraphVisitor> objectGraphVisitorFactory, Action<ITrackingRegistrationLocationSelectionSyntax<IObjectGraphVisitor<IEmitter>>> where) where TObjectGraphVisitor : IObjectGraphVisitor<IEmitter>
		{
			if (objectGraphVisitorFactory == null)
			{
				throw new ArgumentNullException("objectGraphVisitorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(emissionPhaseObjectGraphVisitorFactories.CreateTrackingRegistrationLocationSelector(typeof(TObjectGraphVisitor), (IObjectGraphVisitor<IEmitter> wrapped, EmissionPhaseObjectGraphVisitorArgs args) => objectGraphVisitorFactory(wrapped, args)));
			return this;
		}

		public SerializerBuilder WithoutEmissionPhaseObjectGraphVisitor<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TObjectGraphVisitor>() where TObjectGraphVisitor : IObjectGraphVisitor<IEmitter>
		{
			return WithoutEmissionPhaseObjectGraphVisitor(typeof(TObjectGraphVisitor));
		}

		public SerializerBuilder WithoutEmissionPhaseObjectGraphVisitor(Type objectGraphVisitorType)
		{
			if (objectGraphVisitorType == null)
			{
				throw new ArgumentNullException("objectGraphVisitorType");
			}
			emissionPhaseObjectGraphVisitorFactories.Remove(objectGraphVisitorType);
			return this;
		}

		public SerializerBuilder WithIndentedSequences()
		{
			emitterSettings = emitterSettings.WithIndentedSequences();
			return this;
		}

		public ISerializer Build()
		{
			return Serializer.FromValueSerializer(BuildValueSerializer(), emitterSettings);
		}

		public IValueSerializer BuildValueSerializer()
		{
			IEnumerable<IYamlTypeConverter> typeConverters = BuildTypeConverters();
			ITypeInspector typeInspector = BuildTypeInspector();
			IObjectGraphTraversalStrategy traversalStrategy = objectGraphTraversalStrategyFactory(typeInspector, typeResolver, typeConverters, maximumRecursion);
			IEventEmitter eventEmitter = eventEmitterFactories.BuildComponentChain(new WriterEventEmitter());
			return new ValueSerializer(traversalStrategy, eventEmitter, typeConverters, preProcessingPhaseObjectGraphVisitorFactories.Clone(), emissionPhaseObjectGraphVisitorFactories.Clone());
		}

		internal ITypeInspector BuildTypeInspector()
		{
			ITypeInspector typeInspector = new ReadablePropertiesTypeInspector(typeResolver, includeNonPublicProperties);
			if (!ignoreFields)
			{
				typeInspector = new CompositeTypeInspector(new ReadableFieldsTypeInspector(typeResolver), typeInspector);
			}
			return typeInspectorFactories.BuildComponentChain(typeInspector);
		}
	}
	internal class Settings
	{
		public bool AllowPrivateConstructors { get; set; }
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal abstract class StaticBuilderSkeleton<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TBuilder> where TBuilder : StaticBuilderSkeleton<TBuilder>
	{
		internal INamingConvention namingConvention = NullNamingConvention.Instance;

		internal ITypeResolver typeResolver;

		internal readonly LazyComponentRegistrationList<Nothing, IYamlTypeConverter> typeConverterFactories;

		internal readonly LazyComponentRegistrationList<ITypeInspector, ITypeInspector> typeInspectorFactories;

		internal bool includeNonPublicProperties;

		internal Settings settings;

		protected abstract TBuilder Self { get; }

		internal StaticBuilderSkeleton(ITypeResolver typeResolver)
		{
			typeConverterFactories = new LazyComponentRegistrationList<Nothing, IYamlTypeConverter> { 
			{
				typeof(YamlDotNet.Serialization.Converters.GuidConverter),
				(Nothing _) => new YamlDotNet.Serialization.Converters.GuidConverter(jsonCompatible: false)
			} };
			typeInspectorFactories = new LazyComponentRegistrationList<ITypeInspector, ITypeInspector>();
			this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver");
			settings = new Settings();
		}

		public TBuilder WithNamingConvention(INamingConvention namingConvention)
		{
			this.namingConvention = namingConvention ?? throw new ArgumentNullException("namingConvention");
			return Self;
		}

		public TBuilder WithTypeResolver(ITypeResolver typeResolver)
		{
			this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver");
			return Self;
		}

		public abstract TBuilder WithTagMapping(TagName tag, Type type);

		public TBuilder WithTypeConverter(IYamlTypeConverter typeConverter)
		{
			return WithTypeConverter(typeConverter, delegate(IRegistrationLocationSelectionSyntax<IYamlTypeConverter> w)
			{
				w.OnTop();
			});
		}

		public TBuilder WithTypeConverter(IYamlTypeConverter typeConverter, Action<IRegistrationLocationSelectionSyntax<IYamlTypeConverter>> where)
		{
			if (typeConverter == null)
			{
				throw new ArgumentNullException("typeConverter");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeConverterFactories.CreateRegistrationLocationSelector(typeConverter.GetType(), (Nothing _) => typeConverter));
			return Self;
		}

		public TBuilder WithTypeConverter<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TYamlTypeConverter>(WrapperFactory<IYamlTypeConverter, IYamlTypeConverter> typeConverterFactory, Action<ITrackingRegistrationLocationSelectionSyntax<IYamlTypeConverter>> where) where TYamlTypeConverter : IYamlTypeConverter
		{
			if (typeConverterFactory == null)
			{
				throw new ArgumentNullException("typeConverterFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeConverterFactories.CreateTrackingRegistrationLocationSelector(typeof(TYamlTypeConverter), (IYamlTypeConverter wrapped, Nothing _) => typeConverterFactory(wrapped)));
			return Self;
		}

		public TBuilder WithoutTypeConverter<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TYamlTypeConverter>() where TYamlTypeConverter : IYamlTypeConverter
		{
			return WithoutTypeConverter(typeof(TYamlTypeConverter));
		}

		public TBuilder WithoutTypeConverter(Type converterType)
		{
			if (converterType == null)
			{
				throw new ArgumentNullException("converterType");
			}
			typeConverterFactories.Remove(converterType);
			return Self;
		}

		public TBuilder WithTypeInspector<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TTypeInspector>(Func<ITypeInspector, TTypeInspector> typeInspectorFactory) where TTypeInspector : ITypeInspector
		{
			return WithTypeInspector(typeInspectorFactory, delegate(IRegistrationLocationSelectionSyntax<ITypeInspector> w)
			{
				w.OnTop();
			});
		}

		public TBuilder WithTypeInspector<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TTypeInspector>(Func<ITypeInspector, TTypeInspector> typeInspectorFactory, Action<IRegistrationLocationSelectionSyntax<ITypeInspector>> where) where TTypeInspector : ITypeInspector
		{
			if (typeInspectorFactory == null)
			{
				throw new ArgumentNullException("typeInspectorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeInspectorFactories.CreateRegistrationLocationSelector(typeof(TTypeInspector), (ITypeInspector inner) => typeInspectorFactory(inner)));
			return Self;
		}

		public TBuilder WithTypeInspector<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TTypeInspector>(WrapperFactory<ITypeInspector, ITypeInspector, TTypeInspector> typeInspectorFactory, Action<ITrackingRegistrationLocationSelectionSyntax<ITypeInspector>> where) where TTypeInspector : ITypeInspector
		{
			if (typeInspectorFactory == null)
			{
				throw new ArgumentNullException("typeInspectorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where(typeInspectorFactories.CreateTrackingRegistrationLocationSelector(typeof(TTypeInspector), (ITypeInspector wrapped, ITypeInspector inner) => typeInspectorFactory(wrapped, inner)));
			return Self;
		}

		public TBuilder WithoutTypeInspector<[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)] TTypeInspector>() where TTypeInspector : ITypeInspector
		{
			return WithoutTypeInspector(typeof(TTypeInspector));
		}

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

		protected IEnumerable<IYamlTypeConverter> BuildTypeConverters()
		{
			return typeConverterFactories.BuildComponentList();
		}
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(0)]
	internal abstract class StaticContext
	{
		public virtual StaticObjectFactory GetFactory()
		{
			throw new NotImplementedException();
		}

		public virtual ITypeInspector GetTypeInspector()
		{
			throw new NotImplementedException();
		}
	}
	[<bb3abe84-2483-4ad8-88e1-9687591e887b>NullableContext(1)]
	[<845a9e44-c741-4f09-a056-857dcc268b0d>Nullable(new byte[] { 0, 1 })]
	internal sealed class StaticDeserializerBuilder : StaticBuilderSkeleton<StaticDeserializerBuilder>
	{
		private readonly StaticContext context;

		private readonly StaticObjectFactory factory;

		private readonly LazyComponentRegistrationList<Nothing, INodeDeserializer> nodeDeserializerFactories;

		private readonly LazyComponentRegistrationList<Nothing, INodeTypeResolver> nodeTypeResolverFactories;

		private readonly Dictionary<TagName, Type> tagMappings;

		private readonly ITypeConverter typeConverter;

		private readonly Dictionary<Type, Type> typeMappings;

		private bool ignoreUnmatched;

		private bool duplicateKeyChecking;

		private bool attemptUnknownTypeDeserialization;

		protected override StaticDeserializerBuilder Self => this;

		public StaticDeserializerBuilder(StaticContext context)
			: base((ITypeResolver)new StaticTypeResolver())
		{
			this.context = context;
			factory = context.GetFactory();
			typeMappings = new Dictionary<Type, Type>();
			tagMappings = new Dictionary<TagName, Type>
			{
				{
					FailsafeSchema.Tags.Map,
					typeof(Dictionary<object, object>)
				},
				{
					FailsafeSchema.Tags.Str,
					typeof(string)
				},
				{
					JsonSchema.Tags.Bool,
					typeof(bool)
				},
				{
					JsonSchema.Tags.Float,
					typeof(double)
				},
				{
					JsonSchema.Tags.Int,
					typeof(int)
				},
				{
					DefaultSchema.Tags.Timestamp,
					typeof(DateTime)
				}
			};
			typeInspectorFactories.Add(typeof(CachedTypeInspector), (ITypeInspector inner) => new CachedTypeInspector(inner));
			typeInspectorFactories.Add(typeof(NamingConventionTypeInspector), (ITypeInspector inner) => (!(namingConvention is NullNamingConvention)) ? new NamingConventionTypeInspector(inner, namingConvention) : inner);
			typeInspectorFactories.Add(typeof(YamlAttributesTypeInspector), (ITypeInspector inner) => new YamlAttributesTypeInspector(inner));
			nodeDeserializerFactories = new LazyComponentRegistrationList<Nothing, INodeDeserializer>
			{
				{
					typeof(YamlConvertibleNodeDeserializer),
					(Nothing _) => new YamlConvertibleNodeDeserializer(factory)
				},
				{
					typeof(YamlSerializableNodeDeserializer),
					(Nothing _) => new YamlSerializableNodeDeserializer(factory)
				},
				{
					typeof(TypeConverterNodeDeserializer),
					(Nothing _) => new TypeConverterNodeDeserializer(BuildTypeConverters())
				},
				{
					typeof(NullNodeDeserializer),
					(Nothing _) => new NullNodeDeserializer()
				},
				{
					typeof(ScalarNodeDeserializer),
					(Nothing _) => new ScalarNodeDeserializer(attemptUnknownTypeDeserialization, typeConverter)
				},
				{
					typeof(StaticArrayNodeDeserializer),
					(Nothing _) => new StaticArrayNodeDe