Decompiled source of BoneControl v1.0.4

BoneControl.dll

Decompiled 3 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.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.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.BufferedDeserialization;
using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators;
using YamlDotNet.Serialization.Callbacks;
using YamlDotNet.Serialization.Converters;
using YamlDotNet.Serialization.EventEmitters;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization.NodeDeserializers;
using YamlDotNet.Serialization.NodeTypeResolvers;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.ObjectGraphTraversalStrategies;
using YamlDotNet.Serialization.ObjectGraphVisitors;
using YamlDotNet.Serialization.Schemas;
using YamlDotNet.Serialization.TypeInspectors;
using YamlDotNet.Serialization.TypeResolvers;
using YamlDotNet.Serialization.Utilities;
using YamlDotNet.Serialization.ValueDeserializers;

[assembly: Guid("2B8E06C2-72AF-45A9-83E4-C3096A2E92F0")]
[assembly: ComVisible(false)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyProduct("BoneControl")]
[assembly: AssemblyCompany("")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("BoneControl")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BoneControl
{
	[BepInPlugin("kg.BoneControl", "kg.BoneControl", "1.0.0")]
	public class BoneControl : BaseUnityPlugin
	{
		private struct Scale
		{
			public float x;

			public float y;

			public float z;

			public static implicit operator Vector3(Scale scale)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				return new Vector3(scale.x, scale.y, scale.z);
			}
		}

		[HarmonyPatch(typeof(Player), "Start")]
		private static class Player_Awake_Patch
		{
			private static void Postfix(Player __instance)
			{
				if (((Character)__instance).m_nview.IsValid() && ((Character)__instance).m_nview.IsOwner())
				{
					((Character)__instance).m_nview.InvokeRPC(ZNetView.Everybody, "kg.BoneSet", new object[1] { new SerializerBuilder().Build().Serialize(boneScale) });
				}
			}
		}

		[HarmonyPatch(typeof(Player), "Awake")]
		private static class Player_Awake_Patch2
		{
			private static void ApplyBoneControl(Player p, string str, bool save = false)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					Transform val = ((Component)p).transform.Find("Visual/Armature");
					Transform[] componentsInChildren = ((Component)val.GetChild(0)).GetComponentsInChildren<Transform>();
					foreach (Transform val2 in componentsInChildren)
					{
						val2.localScale = Vector3.one;
					}
					IDeserializer deserializer = new DeserializerBuilder().Build();
					Dictionary<string, Scale> dictionary = deserializer.Deserialize<Dictionary<string, Scale>>(str);
					foreach (KeyValuePair<string, Scale> item in dictionary)
					{
						Transform val3 = Utils.FindChild(val, item.Key, (IterativeSearchType)0);
						if (val3 != null)
						{
							val3.localScale = item.Value;
						}
					}
					if (save && ((Character)p).m_nview.IsOwner())
					{
						((Character)p).m_nview.m_zdo.Set("kg.BoneSet", str);
					}
				}
				catch
				{
				}
			}

			private static void Postfix(Player __instance)
			{
				if (((Character)__instance).m_nview.IsValid())
				{
					((Character)__instance).m_nview.Register<string>("kg.BoneSet", (Action<long, string>)delegate(long _, string str)
					{
						ApplyBoneControl(__instance, str, save: true);
					});
					if (!string.IsNullOrEmpty(((Character)__instance).m_nview.m_zdo.GetString("kg.BoneSet", "")))
					{
						ApplyBoneControl(__instance, ((Character)__instance).m_nview.m_zdo.GetString("kg.BoneSet", ""));
					}
				}
			}
		}

		private const string GUID = "kg.BoneControl";

		private const string Version = "1.0.0";

		private static Dictionary<string, Scale> boneScale = new Dictionary<string, Scale>();

		private void Awake()
		{
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			string path = Path.Combine(Paths.ConfigPath, "kg.BoneControl.yml");
			if (!File.Exists(path))
			{
				File.Create(path).Dispose();
				ISerializer serializer = new SerializerBuilder().Build();
				string contents = serializer.Serialize(new Dictionary<string, Scale> { 
				{
					"Hips",
					new Scale
					{
						x = 1f,
						y = 1f,
						z = 1f
					}
				} });
				File.WriteAllText(path, contents);
			}
			boneScale = new DeserializerBuilder().Build().Deserialize<Dictionary<string, Scale>>(File.ReadAllText(path));
			new Harmony("kg.BoneControl").PatchAll();
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath);
			fileSystemWatcher.EnableRaisingEvents = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.Filter = "kg.BoneControl.yml";
			fileSystemWatcher.Changed += delegate
			{
				MonoBehaviour.print((object)"Bone control config changed");
				boneScale = new DeserializerBuilder().Build().Deserialize<Dictionary<string, Scale>>(File.ReadAllText(path));
				if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
				{
					MonoBehaviour.print((object)("Applying bone scale to " + Player.m_localPlayer.GetPlayerName()));
					((Character)Player.m_localPlayer).m_nview.InvokeRPC("kg.BoneSet", new object[1] { new SerializerBuilder().Build().Serialize(boneScale) });
				}
			};
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[Microsoft.CodeAnalysis.Embedded]
	[CompilerGenerated]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	[Microsoft.CodeAnalysis.Embedded]
	[CompilerGenerated]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace YamlDotNet
{
	internal sealed class CultureInfoAdapter : CultureInfo
	{
		private readonly IFormatProvider provider;

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

		public override object GetFormat(Type? formatType)
		{
			return provider.GetFormat(formatType);
		}
	}
	internal static class PropertyInfoExtensions : Object
	{
		public static object? ReadValue(this PropertyInfo property, object target)
		{
			return property.GetValue(target, (object[])null);
		}
	}
	internal static class ReflectionExtensions : Object
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass16_0 : Object
		{
			public Func<PropertyInfo, bool> predicate;

			internal IEnumerable<PropertyInfo> <GetProperties>b__0(Type i)
			{
				return Enumerable.Where<PropertyInfo>(RuntimeReflectionExtensions.GetRuntimeProperties(i), predicate);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass20_0 : Object
		{
			public string name;

			internal bool <GetPrivateStaticMethod>b__0(MethodInfo m)
			{
				if (!((MethodBase)m).IsPublic && ((MethodBase)m).IsStatic)
				{
					return ((MemberInfo)m).Name.Equals(name);
				}
				return false;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass21_0 : Object
		{
			public string name;

			public Type[] parameterTypes;

			internal bool <GetPublicStaticMethod>b__0(MethodInfo m)
			{
				if (((MethodBase)m).IsPublic && ((MethodBase)m).IsStatic && ((MemberInfo)m).Name.Equals(name))
				{
					ParameterInfo[] parameters = ((MethodBase)m).GetParameters();
					if (parameters.Length == parameterTypes.Length)
					{
						return Enumerable.All<bool>(Enumerable.Zip<ParameterInfo, Type, bool>((IEnumerable<ParameterInfo>)(object)parameters, (IEnumerable<Type>)(object)parameterTypes, (Func<ParameterInfo, Type, bool>)((ParameterInfo pi, Type pt) => pi.ParameterType == pt)), (Func<bool, bool>)((bool r) => r));
					}
					return false;
				}
				return false;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass22_0 : Object
		{
			public string name;

			internal bool <GetPublicInstanceMethod>b__0(MethodInfo m)
			{
				if (((MethodBase)m).IsPublic && !((MethodBase)m).IsStatic)
				{
					return ((MemberInfo)m).Name.Equals(name);
				}
				return false;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass6_0 : Object
		{
			public bool allowPrivateConstructors;

			internal bool <HasDefaultConstructor>b__0(ConstructorInfo c)
			{
				if ((((MethodBase)c).IsPublic || (allowPrivateConstructors && ((MethodBase)c).IsPrivate)) && !((MethodBase)c).IsStatic)
				{
					return ((MethodBase)c).GetParameters().Length == 0;
				}
				return false;
			}
		}

		private static readonly Func<PropertyInfo, bool> IsInstance = (PropertyInfo property) => !((MethodBase)(property.GetMethod ?? property.SetMethod)).IsStatic;

		private static readonly Func<PropertyInfo, bool> IsInstancePublic = (PropertyInfo property) => IsInstance.Invoke(property) && ((MethodBase)(property.GetMethod ?? property.SetMethod)).IsPublic;

		public static Type? BaseType(this Type type)
		{
			return ((Type)IntrospectionExtensions.GetTypeInfo(type)).BaseType;
		}

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

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

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

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

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

		public static bool HasDefaultConstructor(this Type type, bool allowPrivateConstructors)
		{
			<>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0();
			CS$<>8__locals0.allowPrivateConstructors = allowPrivateConstructors;
			TypeInfo typeInfo = IntrospectionExtensions.GetTypeInfo(type);
			if (!((Type)typeInfo).IsValueType)
			{
				return Enumerable.Any<ConstructorInfo>(typeInfo.DeclaredConstructors, (Func<ConstructorInfo, bool>)((ConstructorInfo c) => (((MethodBase)c).IsPublic || (CS$<>8__locals0.allowPrivateConstructors && ((MethodBase)c).IsPrivate)) && !((MethodBase)c).IsStatic && ((MethodBase)c).GetParameters().Length == 0));
			}
			return true;
		}

		public static bool IsAssignableFrom(this Type type, Type source)
		{
			return type.IsAssignableFrom((Type)(object)IntrospectionExtensions.GetTypeInfo(source));
		}

		public static bool IsAssignableFrom(this Type type, TypeInfo source)
		{
			return IntrospectionExtensions.GetTypeInfo(type).IsAssignableFrom(source);
		}

		public static TypeCode GetTypeCode(this Type type)
		{
			if (type.IsEnum())
			{
				type = Enum.GetUnderlyingType(type);
			}
			if (!(type == typeof(Boolean)))
			{
				if (!(type == typeof(Char)))
				{
					if (!(type == typeof(SByte)))
					{
						if (!(type == typeof(Byte)))
						{
							if (!(type == typeof(Int16)))
							{
								if (!(type == typeof(UInt16)))
								{
									if (!(type == typeof(Int32)))
									{
										if (!(type == typeof(UInt32)))
										{
											if (!(type == typeof(Int64)))
											{
												if (!(type == typeof(UInt64)))
												{
													if (!(type == typeof(Single)))
													{
														if (!(type == typeof(Double)))
														{
															if (!(type == typeof(Decimal)))
															{
																if (!(type == typeof(DateTime)))
																{
																	if (!(type == typeof(String)))
																	{
																		return (TypeCode)1;
																	}
																	return (TypeCode)18;
																}
																return (TypeCode)16;
															}
															return (TypeCode)15;
														}
														return (TypeCode)14;
													}
													return (TypeCode)13;
												}
												return (TypeCode)12;
											}
											return (TypeCode)11;
										}
										return (TypeCode)10;
									}
									return (TypeCode)9;
								}
								return (TypeCode)8;
							}
							return (TypeCode)7;
						}
						return (TypeCode)6;
					}
					return (TypeCode)5;
				}
				return (TypeCode)4;
			}
			return (TypeCode)3;
		}

		public static bool IsDbNull(this object value)
		{
			object obj;
			if (value == null)
			{
				obj = null;
			}
			else
			{
				Type type = value.GetType();
				obj = ((type != null) ? type.FullName : null);
			}
			return (string)obj == "System.DBNull";
		}

		public static Type[] GetGenericArguments(this Type type)
		{
			return ((Type)IntrospectionExtensions.GetTypeInfo(type)).GenericTypeArguments;
		}

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

		public static FieldInfo? GetPublicStaticField(this Type type, string name)
		{
			return RuntimeReflectionExtensions.GetRuntimeField(type, name);
		}

		public static IEnumerable<PropertyInfo> GetProperties(this Type type, bool includeNonPublic)
		{
			<>c__DisplayClass16_0 CS$<>8__locals0 = new <>c__DisplayClass16_0();
			CS$<>8__locals0.predicate = (includeNonPublic ? IsInstance : IsInstancePublic);
			if (!type.IsInterface())
			{
				return Enumerable.Where<PropertyInfo>(RuntimeReflectionExtensions.GetRuntimeProperties(type), CS$<>8__locals0.predicate);
			}
			return Enumerable.SelectMany<Type, PropertyInfo>(Enumerable.Concat<Type>((IEnumerable<Type>)(object)new Type[1] { type }, (IEnumerable<Type>)(object)type.GetInterfaces()), (Func<Type, IEnumerable<PropertyInfo>>)((Type i) => Enumerable.Where<PropertyInfo>(RuntimeReflectionExtensions.GetRuntimeProperties(i), CS$<>8__locals0.predicate)));
		}

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

		public static IEnumerable<FieldInfo> GetPublicFields(this Type type)
		{
			return Enumerable.Where<FieldInfo>(RuntimeReflectionExtensions.GetRuntimeFields(type), (Func<FieldInfo, bool>)((FieldInfo f) => !f.IsStatic && f.IsPublic));
		}

		public static IEnumerable<MethodInfo> GetPublicStaticMethods(this Type type)
		{
			return Enumerable.Where<MethodInfo>(RuntimeReflectionExtensions.GetRuntimeMethods(type), (Func<MethodInfo, bool>)((MethodInfo m) => ((MethodBase)m).IsPublic && ((MethodBase)m).IsStatic));
		}

		public static MethodInfo GetPrivateStaticMethod(this Type type, string name)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass20_0 CS$<>8__locals0 = new <>c__DisplayClass20_0();
			CS$<>8__locals0.name = name;
			return Enumerable.FirstOrDefault<MethodInfo>(RuntimeReflectionExtensions.GetRuntimeMethods(type), (Func<MethodInfo, bool>)((MethodInfo m) => !((MethodBase)m).IsPublic && ((MethodBase)m).IsStatic && ((MemberInfo)m).Name.Equals(CS$<>8__locals0.name))) ?? throw new MissingMethodException(String.Concat((string[])(object)new String[5] { "Expected to find a method named '", CS$<>8__locals0.name, "' in '", type.FullName, "'." }));
		}

		public static MethodInfo? GetPublicStaticMethod(this Type type, string name, params Type[] parameterTypes)
		{
			<>c__DisplayClass21_0 CS$<>8__locals0 = new <>c__DisplayClass21_0();
			CS$<>8__locals0.name = name;
			CS$<>8__locals0.parameterTypes = parameterTypes;
			return Enumerable.FirstOrDefault<MethodInfo>(RuntimeReflectionExtensions.GetRuntimeMethods(type), (Func<MethodInfo, bool>)delegate(MethodInfo m)
			{
				if (((MethodBase)m).IsPublic && ((MethodBase)m).IsStatic && ((MemberInfo)m).Name.Equals(CS$<>8__locals0.name))
				{
					ParameterInfo[] parameters = ((MethodBase)m).GetParameters();
					if (parameters.Length == CS$<>8__locals0.parameterTypes.Length)
					{
						return Enumerable.All<bool>(Enumerable.Zip<ParameterInfo, Type, bool>((IEnumerable<ParameterInfo>)(object)parameters, (IEnumerable<Type>)(object)CS$<>8__locals0.parameterTypes, (Func<ParameterInfo, Type, bool>)((ParameterInfo pi, Type pt) => pi.ParameterType == pt)), (Func<bool, bool>)((bool r) => r));
					}
					return false;
				}
				return false;
			});
		}

		public static MethodInfo? GetPublicInstanceMethod(this Type type, string name)
		{
			<>c__DisplayClass22_0 CS$<>8__locals0 = new <>c__DisplayClass22_0();
			CS$<>8__locals0.name = name;
			return Enumerable.FirstOrDefault<MethodInfo>(RuntimeReflectionExtensions.GetRuntimeMethods(type), (Func<MethodInfo, bool>)((MethodInfo m) => ((MethodBase)m).IsPublic && !((MethodBase)m).IsStatic && ((MemberInfo)m).Name.Equals(CS$<>8__locals0.name)));
		}

		public static MethodInfo? GetGetMethod(this PropertyInfo property, bool nonPublic)
		{
			MethodInfo val = property.GetMethod;
			if (!nonPublic && !((MethodBase)val).IsPublic)
			{
				val = null;
			}
			return val;
		}

		public static MethodInfo? GetSetMethod(this PropertyInfo property)
		{
			return property.SetMethod;
		}

		public static IEnumerable<Type> GetInterfaces(this Type type)
		{
			return IntrospectionExtensions.GetTypeInfo(type).ImplementedInterfaces;
		}

		public static bool IsInstanceOf(this Type type, object o)
		{
			if (!(o.GetType() == type))
			{
				return ((Type)IntrospectionExtensions.GetTypeInfo(o.GetType())).IsSubclassOf(type);
			}
			return true;
		}

		public static Attribute[] GetAllCustomAttributes<TAttribute>(this PropertyInfo member)
		{
			List<Attribute> list = new List<Attribute>();
			Type val = ((MemberInfo)member).DeclaringType;
			while (val != (Type)null)
			{
				val.GetPublicProperty(((MemberInfo)member).Name);
				list.AddRange(CustomAttributeExtensions.GetCustomAttributes((MemberInfo)(object)member, typeof(TAttribute)));
				val = val.BaseType();
			}
			return list.ToArray();
		}
	}
	internal static class StandardRegexOptions : Object
	{
		public const RegexOptions Compiled = RegexOptions.Compiled;
	}
}
namespace YamlDotNet.Serialization
{
	internal abstract class BuilderSkeleton<TBuilder> : Object where TBuilder : BuilderSkeleton<TBuilder>
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass23_0 : Object
		{
			public IYamlTypeConverter typeConverter;

			internal IYamlTypeConverter <WithTypeConverter>b__0(Nothing _)
			{
				return typeConverter;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass24_0<TYamlTypeConverter> : Object where TYamlTypeConverter : notnull, IYamlTypeConverter
		{
			public WrapperFactory<IYamlTypeConverter, IYamlTypeConverter> typeConverterFactory;

			internal IYamlTypeConverter <WithTypeConverter>b__0(IYamlTypeConverter wrapped, Nothing _)
			{
				return typeConverterFactory(wrapped);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass28_0<TTypeInspector> : Object where TTypeInspector : notnull, ITypeInspector
		{
			public Func<ITypeInspector, TTypeInspector> typeInspectorFactory;

			internal ITypeInspector <WithTypeInspector>b__0(ITypeInspector inner)
			{
				return typeInspectorFactory.Invoke(inner);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass29_0<TTypeInspector> : Object where TTypeInspector : notnull, ITypeInspector
		{
			public WrapperFactory<ITypeInspector, ITypeInspector, TTypeInspector> typeInspectorFactory;

			internal ITypeInspector <WithTypeInspector>b__0(ITypeInspector wrapped, ITypeInspector inner)
			{
				return typeInspectorFactory(wrapped, inner);
			}
		}

		internal INamingConvention namingConvention = NullNamingConvention.Instance;

		internal INamingConvention enumNamingConvention = 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;

		internal YamlFormatter yamlFormatter = YamlFormatter.Default;

		protected abstract TBuilder Self { get; }

		internal BuilderSkeleton(ITypeResolver typeResolver)
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			overrides = new YamlAttributeOverrides();
			LazyComponentRegistrationList<Nothing, IYamlTypeConverter> lazyComponentRegistrationList = new LazyComponentRegistrationList<Nothing, IYamlTypeConverter>();
			lazyComponentRegistrationList.Add(typeof(YamlDotNet.Serialization.Converters.GuidConverter), (Nothing _) => new YamlDotNet.Serialization.Converters.GuidConverter(jsonCompatible: false));
			lazyComponentRegistrationList.Add(typeof(SystemTypeConverter), (Nothing _) => new SystemTypeConverter());
			typeConverterFactories = lazyComponentRegistrationList;
			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)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			this.namingConvention = namingConvention ?? throw new ArgumentNullException("namingConvention");
			return Self;
		}

		public TBuilder WithEnumNamingConvention(INamingConvention enumNamingConvention)
		{
			this.enumNamingConvention = enumNamingConvention;
			return Self;
		}

		public TBuilder WithTypeResolver(ITypeResolver typeResolver)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver");
			return Self;
		}

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

		public TBuilder WithAttributeOverride<TClass>(Expression<Func<TClass, object>> propertyAccessor, Attribute attribute)
		{
			overrides.Add<TClass>(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)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass23_0 CS$<>8__locals0 = new <>c__DisplayClass23_0();
			CS$<>8__locals0.typeConverter = typeConverter;
			if (CS$<>8__locals0.typeConverter == null)
			{
				throw new ArgumentNullException("typeConverter");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where.Invoke(typeConverterFactories.CreateRegistrationLocationSelector(((Object)CS$<>8__locals0.typeConverter).GetType(), (Nothing _) => CS$<>8__locals0.typeConverter));
			return Self;
		}

		public TBuilder WithTypeConverter<TYamlTypeConverter>(WrapperFactory<IYamlTypeConverter, IYamlTypeConverter> typeConverterFactory, Action<ITrackingRegistrationLocationSelectionSyntax<IYamlTypeConverter>> where) where TYamlTypeConverter : IYamlTypeConverter
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass24_0<TYamlTypeConverter> CS$<>8__locals0 = new <>c__DisplayClass24_0<TYamlTypeConverter>();
			CS$<>8__locals0.typeConverterFactory = typeConverterFactory;
			if (CS$<>8__locals0.typeConverterFactory == null)
			{
				throw new ArgumentNullException("typeConverterFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where.Invoke(typeConverterFactories.CreateTrackingRegistrationLocationSelector(typeof(TYamlTypeConverter), (IYamlTypeConverter wrapped, Nothing _) => CS$<>8__locals0.typeConverterFactory(wrapped)));
			return Self;
		}

		public TBuilder WithoutTypeConverter<TYamlTypeConverter>() where TYamlTypeConverter : IYamlTypeConverter
		{
			return WithoutTypeConverter(typeof(TYamlTypeConverter));
		}

		public TBuilder WithoutTypeConverter(Type converterType)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (converterType == (Type)null)
			{
				throw new ArgumentNullException("converterType");
			}
			typeConverterFactories.Remove(converterType);
			return Self;
		}

		public TBuilder WithTypeInspector<TTypeInspector>(Func<ITypeInspector, TTypeInspector> typeInspectorFactory) where TTypeInspector : ITypeInspector
		{
			return WithTypeInspector<TTypeInspector>(typeInspectorFactory, delegate(IRegistrationLocationSelectionSyntax<ITypeInspector> w)
			{
				w.OnTop();
			});
		}

		public TBuilder WithTypeInspector<TTypeInspector>(Func<ITypeInspector, TTypeInspector> typeInspectorFactory, Action<IRegistrationLocationSelectionSyntax<ITypeInspector>> where) where TTypeInspector : ITypeInspector
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass28_0<TTypeInspector> CS$<>8__locals0 = new <>c__DisplayClass28_0<TTypeInspector>();
			CS$<>8__locals0.typeInspectorFactory = typeInspectorFactory;
			if (CS$<>8__locals0.typeInspectorFactory == null)
			{
				throw new ArgumentNullException("typeInspectorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where.Invoke(typeInspectorFactories.CreateRegistrationLocationSelector(typeof(TTypeInspector), (ITypeInspector inner) => CS$<>8__locals0.typeInspectorFactory.Invoke(inner)));
			return Self;
		}

		public TBuilder WithTypeInspector<TTypeInspector>(WrapperFactory<ITypeInspector, ITypeInspector, TTypeInspector> typeInspectorFactory, Action<ITrackingRegistrationLocationSelectionSyntax<ITypeInspector>> where) where TTypeInspector : ITypeInspector
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass29_0<TTypeInspector> CS$<>8__locals0 = new <>c__DisplayClass29_0<TTypeInspector>();
			CS$<>8__locals0.typeInspectorFactory = typeInspectorFactory;
			if (CS$<>8__locals0.typeInspectorFactory == null)
			{
				throw new ArgumentNullException("typeInspectorFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where.Invoke(typeInspectorFactories.CreateTrackingRegistrationLocationSelector(typeof(TTypeInspector), (ITypeInspector wrapped, ITypeInspector inner) => CS$<>8__locals0.typeInspectorFactory(wrapped, inner)));
			return Self;
		}

		public TBuilder WithoutTypeInspector<TTypeInspector>() where TTypeInspector : ITypeInspector
		{
			return WithoutTypeInspector(typeof(TTypeInspector));
		}

		public TBuilder WithoutTypeInspector(Type inspectorType)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (inspectorType == (Type)null)
			{
				throw new ArgumentNullException("inspectorType");
			}
			typeInspectorFactories.Remove(inspectorType);
			return Self;
		}

		public TBuilder WithYamlFormatter(YamlFormatter formatter)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			yamlFormatter = formatter ?? throw new ArgumentNullException("formatter");
			return Self;
		}

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

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

		private Deserializer(IValueDeserializer valueDeserializer)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			this.valueDeserializer = valueDeserializer ?? throw new ArgumentNullException("valueDeserializer");
		}

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

		public T Deserialize<T>(string input)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			StringReader val = new StringReader(input);
			try
			{
				return Deserialize<T>((TextReader)(object)val);
			}
			finally
			{
				if (val != null)
				{
					((IDisposable)val).Dispose();
				}
			}
		}

		public T Deserialize<T>(TextReader input)
		{
			return this.Deserialize<T>((IParser)new Parser(input));
		}

		public T Deserialize<T>(IParser parser)
		{
			return (T)Deserialize(parser, typeof(T));
		}

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

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

		public object? Deserialize(IParser parser)
		{
			return Deserialize(parser, typeof(Object));
		}

		public object? Deserialize(string input, Type type)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			StringReader val = new StringReader(input);
			try
			{
				return Deserialize((TextReader)(object)val, type);
			}
			finally
			{
				if (val != null)
				{
					((IDisposable)val).Dispose();
				}
			}
		}

		public object? Deserialize(TextReader input, Type type)
		{
			return Deserialize((IParser)new Parser(input), type);
		}

		public object? Deserialize(IParser parser, Type type)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			if (parser == null)
			{
				throw new ArgumentNullException("parser");
			}
			if (type == (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 _))
			{
				SerializerState serializerState = new SerializerState();
				try
				{
					result = valueDeserializer.DeserializeValue(parser, type, serializerState, valueDeserializer);
					serializerState.OnDeserialization();
				}
				finally
				{
					if (serializerState != null)
					{
						((IDisposable)serializerState).Dispose();
					}
				}
			}
			if (flag2)
			{
				parser.Consume<YamlDotNet.Core.Events.DocumentEnd>();
			}
			if (flag)
			{
				parser.Consume<YamlDotNet.Core.Events.StreamEnd>();
			}
			return result;
		}
	}
	internal sealed class DeserializerBuilder : BuilderSkeleton<DeserializerBuilder>
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass14_0 : Object
		{
			public IObjectFactory objectFactory;

			internal IObjectFactory <WithObjectFactory>b__0()
			{
				return objectFactory;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass17_0 : Object
		{
			public INodeDeserializer nodeDeserializer;

			internal INodeDeserializer <WithNodeDeserializer>b__0(Nothing _)
			{
				return nodeDeserializer;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass18_0<TNodeDeserializer> : Object where TNodeDeserializer : notnull, INodeDeserializer
		{
			public WrapperFactory<INodeDeserializer, TNodeDeserializer> nodeDeserializerFactory;

			internal INodeDeserializer <WithNodeDeserializer>b__0(INodeDeserializer wrapped, Nothing _)
			{
				return nodeDeserializerFactory(wrapped);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass23_0 : Object
		{
			public INodeTypeResolver nodeTypeResolver;

			internal INodeTypeResolver <WithNodeTypeResolver>b__0(Nothing _)
			{
				return nodeTypeResolver;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass24_0<TNodeTypeResolver> : Object where TNodeTypeResolver : notnull, INodeTypeResolver
		{
			public WrapperFactory<INodeTypeResolver, TNodeTypeResolver> nodeTypeResolverFactory;

			internal INodeTypeResolver <WithNodeTypeResolver>b__0(INodeTypeResolver wrapped, Nothing _)
			{
				return nodeTypeResolverFactory(wrapped);
			}
		}

		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>((Func<IObjectFactory>)([CompilerGenerated] () => new DefaultObjectFactory((IDictionary<Type, Type>)(object)typeMappings, settings)), true);
			tagMappings = new Dictionary<TagName, Type>
			{
				{
					FailsafeSchema.Tags.Map,
					typeof(Dictionary<object, object>)
				},
				{
					FailsafeSchema.Tags.Str,
					typeof(String)
				},
				{
					JsonSchema.Tags.Bool,
					typeof(Boolean)
				},
				{
					JsonSchema.Tags.Float,
					typeof(Double)
				},
				{
					JsonSchema.Tags.Int,
					typeof(Int32)
				},
				{
					DefaultSchema.Tags.Timestamp,
					typeof(DateTime)
				}
			};
			typeInspectorFactories.Add(typeof(CachedTypeInspector), (ITypeInspector inner) => new CachedTypeInspector(inner));
			typeInspectorFactories.Add(typeof(NamingConventionTypeInspector), [CompilerGenerated] (ITypeInspector inner) => (!(namingConvention is NullNamingConvention)) ? new NamingConventionTypeInspector(inner, namingConvention) : inner);
			typeInspectorFactories.Add(typeof(YamlAttributesTypeInspector), (ITypeInspector inner) => new YamlAttributesTypeInspector(inner));
			typeInspectorFactories.Add(typeof(YamlAttributeOverridesInspector), [CompilerGenerated] (ITypeInspector inner) => (overrides == null) ? inner : new YamlAttributeOverridesInspector(inner, overrides.Clone()));
			typeInspectorFactories.Add(typeof(ReadableAndWritablePropertiesTypeInspector), (ITypeInspector inner) => new ReadableAndWritablePropertiesTypeInspector(inner));
			LazyComponentRegistrationList<Nothing, INodeDeserializer> lazyComponentRegistrationList = new LazyComponentRegistrationList<Nothing, INodeDeserializer>();
			lazyComponentRegistrationList.Add(typeof(YamlConvertibleNodeDeserializer), [CompilerGenerated] (Nothing _) => new YamlConvertibleNodeDeserializer(objectFactory.Value));
			lazyComponentRegistrationList.Add(typeof(YamlSerializableNodeDeserializer), [CompilerGenerated] (Nothing _) => new YamlSerializableNodeDeserializer(objectFactory.Value));
			lazyComponentRegistrationList.Add(typeof(TypeConverterNodeDeserializer), [CompilerGenerated] (Nothing _) => new TypeConverterNodeDeserializer(BuildTypeConverters()));
			lazyComponentRegistrationList.Add(typeof(NullNodeDeserializer), (Nothing _) => new NullNodeDeserializer());
			lazyComponentRegistrationList.Add(typeof(ScalarNodeDeserializer), [CompilerGenerated] (Nothing _) => new ScalarNodeDeserializer(attemptUnknownTypeDeserialization, typeConverter, yamlFormatter, enumNamingConvention));
			lazyComponentRegistrationList.Add(typeof(ArrayNodeDeserializer), [CompilerGenerated] (Nothing _) => new ArrayNodeDeserializer(enumNamingConvention));
			lazyComponentRegistrationList.Add(typeof(DictionaryNodeDeserializer), [CompilerGenerated] (Nothing _) => new DictionaryNodeDeserializer(objectFactory.Value, duplicateKeyChecking));
			lazyComponentRegistrationList.Add(typeof(CollectionNodeDeserializer), [CompilerGenerated] (Nothing _) => new CollectionNodeDeserializer(objectFactory.Value, enumNamingConvention));
			lazyComponentRegistrationList.Add(typeof(EnumerableNodeDeserializer), (Nothing _) => new EnumerableNodeDeserializer());
			lazyComponentRegistrationList.Add(typeof(ObjectNodeDeserializer), [CompilerGenerated] (Nothing _) => new ObjectNodeDeserializer(objectFactory.Value, BuildTypeInspector(), ignoreUnmatched, duplicateKeyChecking, typeConverter, enumNamingConvention));
			nodeDeserializerFactories = lazyComponentRegistrationList;
			LazyComponentRegistrationList<Nothing, INodeTypeResolver> lazyComponentRegistrationList2 = new LazyComponentRegistrationList<Nothing, INodeTypeResolver>();
			lazyComponentRegistrationList2.Add(typeof(MappingNodeTypeResolver), [CompilerGenerated] (Nothing _) => new MappingNodeTypeResolver((IDictionary<Type, Type>)(object)typeMappings));
			lazyComponentRegistrationList2.Add(typeof(YamlConvertibleTypeResolver), (Nothing _) => new YamlConvertibleTypeResolver());
			lazyComponentRegistrationList2.Add(typeof(YamlSerializableTypeResolver), (Nothing _) => new YamlSerializableTypeResolver());
			lazyComponentRegistrationList2.Add(typeof(TagNodeTypeResolver), [CompilerGenerated] (Nothing _) => new TagNodeTypeResolver((IDictionary<TagName, Type>)(object)tagMappings));
			lazyComponentRegistrationList2.Add(typeof(PreventUnknownTagsNodeTypeResolver), (Nothing _) => new PreventUnknownTagsNodeTypeResolver());
			lazyComponentRegistrationList2.Add(typeof(DefaultContainersNodeTypeResolver), (Nothing _) => new DefaultContainersNodeTypeResolver());
			nodeTypeResolverFactories = lazyComponentRegistrationList2;
			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)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass14_0 CS$<>8__locals0 = new <>c__DisplayClass14_0();
			CS$<>8__locals0.objectFactory = objectFactory;
			if (CS$<>8__locals0.objectFactory == null)
			{
				throw new ArgumentNullException("objectFactory");
			}
			this.objectFactory = new Lazy<IObjectFactory>((Func<IObjectFactory>)(() => CS$<>8__locals0.objectFactory), true);
			return this;
		}

		public DeserializerBuilder WithObjectFactory(Func<Type, object> objectFactory)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (objectFactory == null)
			{
				throw new ArgumentNullException("objectFactory");
			}
			return WithObjectFactory((IObjectFactory)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)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass17_0 CS$<>8__locals0 = new <>c__DisplayClass17_0();
			CS$<>8__locals0.nodeDeserializer = nodeDeserializer;
			if (CS$<>8__locals0.nodeDeserializer == null)
			{
				throw new ArgumentNullException("nodeDeserializer");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where.Invoke(nodeDeserializerFactories.CreateRegistrationLocationSelector(((Object)CS$<>8__locals0.nodeDeserializer).GetType(), (Nothing _) => CS$<>8__locals0.nodeDeserializer));
			return this;
		}

		public DeserializerBuilder WithNodeDeserializer<TNodeDeserializer>(WrapperFactory<INodeDeserializer, TNodeDeserializer> nodeDeserializerFactory, Action<ITrackingRegistrationLocationSelectionSyntax<INodeDeserializer>> where) where TNodeDeserializer : INodeDeserializer
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass18_0<TNodeDeserializer> CS$<>8__locals0 = new <>c__DisplayClass18_0<TNodeDeserializer>();
			CS$<>8__locals0.nodeDeserializerFactory = nodeDeserializerFactory;
			if (CS$<>8__locals0.nodeDeserializerFactory == null)
			{
				throw new ArgumentNullException("nodeDeserializerFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where.Invoke(nodeDeserializerFactories.CreateTrackingRegistrationLocationSelector(typeof(TNodeDeserializer), (INodeDeserializer wrapped, Nothing _) => CS$<>8__locals0.nodeDeserializerFactory(wrapped)));
			return this;
		}

		public DeserializerBuilder WithoutNodeDeserializer<TNodeDeserializer>() where TNodeDeserializer : INodeDeserializer
		{
			return WithoutNodeDeserializer(typeof(TNodeDeserializer));
		}

		public DeserializerBuilder WithoutNodeDeserializer(Type nodeDeserializerType)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (nodeDeserializerType == (Type)null)
			{
				throw new ArgumentNullException("nodeDeserializerType");
			}
			nodeDeserializerFactories.Remove(nodeDeserializerType);
			return this;
		}

		public DeserializerBuilder WithTypeDiscriminatingNodeDeserializer(Action<ITypeDiscriminatingNodeDeserializerOptions> configureTypeDiscriminatingNodeDeserializerOptions, int maxDepth = -1, int maxLength = -1)
		{
			TypeDiscriminatingNodeDeserializerOptions typeDiscriminatingNodeDeserializerOptions = new TypeDiscriminatingNodeDeserializerOptions();
			configureTypeDiscriminatingNodeDeserializerOptions.Invoke((ITypeDiscriminatingNodeDeserializerOptions)typeDiscriminatingNodeDeserializerOptions);
			TypeDiscriminatingNodeDeserializer nodeDeserializer = new TypeDiscriminatingNodeDeserializer((IList<INodeDeserializer>)(object)nodeDeserializerFactories.BuildComponentList(), (IList<ITypeDiscriminator>)(object)typeDiscriminatingNodeDeserializerOptions.discriminators, maxDepth, maxLength);
			return WithNodeDeserializer(nodeDeserializer, delegate(IRegistrationLocationSelectionSyntax<INodeDeserializer> s)
			{
				s.Before<DictionaryNodeDeserializer>();
			});
		}

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

		public DeserializerBuilder WithNodeTypeResolver(INodeTypeResolver nodeTypeResolver, Action<IRegistrationLocationSelectionSyntax<INodeTypeResolver>> where)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass23_0 CS$<>8__locals0 = new <>c__DisplayClass23_0();
			CS$<>8__locals0.nodeTypeResolver = nodeTypeResolver;
			if (CS$<>8__locals0.nodeTypeResolver == null)
			{
				throw new ArgumentNullException("nodeTypeResolver");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where.Invoke(nodeTypeResolverFactories.CreateRegistrationLocationSelector(((Object)CS$<>8__locals0.nodeTypeResolver).GetType(), (Nothing _) => CS$<>8__locals0.nodeTypeResolver));
			return this;
		}

		public DeserializerBuilder WithNodeTypeResolver<TNodeTypeResolver>(WrapperFactory<INodeTypeResolver, TNodeTypeResolver> nodeTypeResolverFactory, Action<ITrackingRegistrationLocationSelectionSyntax<INodeTypeResolver>> where) where TNodeTypeResolver : INodeTypeResolver
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass24_0<TNodeTypeResolver> CS$<>8__locals0 = new <>c__DisplayClass24_0<TNodeTypeResolver>();
			CS$<>8__locals0.nodeTypeResolverFactory = nodeTypeResolverFactory;
			if (CS$<>8__locals0.nodeTypeResolverFactory == null)
			{
				throw new ArgumentNullException("nodeTypeResolverFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where.Invoke(nodeTypeResolverFactories.CreateTrackingRegistrationLocationSelector(typeof(TNodeTypeResolver), (INodeTypeResolver wrapped, Nothing _) => CS$<>8__locals0.nodeTypeResolverFactory(wrapped)));
			return this;
		}

		public DeserializerBuilder WithoutNodeTypeResolver<TNodeTypeResolver>() where TNodeTypeResolver : INodeTypeResolver
		{
			return WithoutNodeTypeResolver(typeof(TNodeTypeResolver));
		}

		public DeserializerBuilder WithoutNodeTypeResolver(Type nodeTypeResolverType)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (nodeTypeResolverType == (Type)null)
			{
				throw new ArgumentNullException("nodeTypeResolverType");
			}
			nodeTypeResolverFactories.Remove(nodeTypeResolverType);
			return this;
		}

		public override DeserializerBuilder WithTagMapping(TagName tag, Type type)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (tag.IsEmpty)
			{
				throw new ArgumentException("Non-specific tags cannot be maped");
			}
			if (type == (Type)null)
			{
				throw new ArgumentNullException("type");
			}
			if (tagMappings.TryGetValue(tag, out Type value))
			{
				throw new ArgumentException(String.Format("Type already has a registered type '{0}' for tag '{1}'", (object)value.FullName, (object)tag), "tag");
			}
			tagMappings.Add(tag, type);
			return this;
		}

		public DeserializerBuilder WithTypeMapping<TInterface, TConcrete>() where TConcrete : TInterface
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			Type typeFromHandle = typeof(TInterface);
			Type typeFromHandle2 = typeof(TConcrete);
			if (!typeFromHandle.IsAssignableFrom(typeFromHandle2))
			{
				throw new InvalidOperationException(String.Concat((string[])(object)new String[5]
				{
					"The type '",
					((MemberInfo)typeFromHandle2).Name,
					"' does not implement interface '",
					((MemberInfo)typeFromHandle).Name,
					"'."
				}));
			}
			if (typeMappings.ContainsKey(typeFromHandle))
			{
				typeMappings[typeFromHandle] = typeFromHandle2;
			}
			else
			{
				typeMappings.Add(typeFromHandle, typeFromHandle2);
			}
			return this;
		}

		public DeserializerBuilder WithoutTagMapping(TagName tag)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (tag.IsEmpty)
			{
				throw new ArgumentException("Non-specific tags cannot be maped");
			}
			if (!tagMappings.Remove(tag))
			{
				throw new KeyNotFoundException(String.Format("Tag '{0}' is not registered", (object)tag));
			}
			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((IList<INodeDeserializer>)(object)nodeDeserializerFactories.BuildComponentList(), (IList<INodeTypeResolver>)(object)nodeTypeResolverFactories.BuildComponentList(), typeConverter, enumNamingConvention));
		}
	}
	internal sealed class EmissionPhaseObjectGraphVisitorArgs : Object
	{
		private readonly IEnumerable<IObjectGraphVisitor<Nothing>> preProcessingPhaseVisitors;

		[field: CompilerGenerated]
		public IObjectGraphVisitor<IEmitter> InnerVisitor
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			private set;
		}

		[field: CompilerGenerated]
		public IEventEmitter EventEmitter
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			private set;
		}

		[field: CompilerGenerated]
		public ObjectSerializer NestedObjectSerializer
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			private set;
		}

		[field: CompilerGenerated]
		public IEnumerable<IYamlTypeConverter> TypeConverters
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			private set;
		}

		public EmissionPhaseObjectGraphVisitorArgs(IObjectGraphVisitor<IEmitter> innerVisitor, IEventEmitter eventEmitter, IEnumerable<IObjectGraphVisitor<Nothing>> preProcessingPhaseVisitors, IEnumerable<IYamlTypeConverter> typeConverters, ObjectSerializer nestedObjectSerializer)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			InnerVisitor = innerVisitor ?? throw new ArgumentNullException("innerVisitor");
			EventEmitter = eventEmitter ?? throw new ArgumentNullException("eventEmitter");
			this.preProcessingPhaseVisitors = preProcessingPhaseVisitors ?? throw new ArgumentNullException("preProcessingPhaseVisitors");
			TypeConverters = typeConverters ?? throw new ArgumentNullException("typeConverters");
			NestedObjectSerializer = nestedObjectSerializer ?? throw new ArgumentNullException("nestedObjectSerializer");
		}

		public T GetPreProcessingPhaseObjectGraphVisitor<T>() where T : IObjectGraphVisitor<Nothing>
		{
			return Enumerable.Single<T>(Enumerable.OfType<T>((IEnumerable)(object)preProcessingPhaseVisitors));
		}
	}
	internal abstract class EventInfo : Object
	{
		[field: CompilerGenerated]
		public IObjectDescriptor Source
		{
			[CompilerGenerated]
			get;
		}

		protected EventInfo(IObjectDescriptor source)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Source = source ?? throw new ArgumentNullException("source");
		}
	}
	internal class AliasEventInfo : EventInfo
	{
		[field: CompilerGenerated]
		public AnchorName Alias
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public bool NeedsExpansion
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public AliasEventInfo(IObjectDescriptor source, AnchorName alias)
			: base(source)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (alias.IsEmpty)
			{
				throw new ArgumentNullException("alias");
			}
			Alias = alias;
		}
	}
	internal class ObjectEventInfo : EventInfo
	{
		[field: CompilerGenerated]
		public AnchorName Anchor
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public TagName Tag
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		protected ObjectEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
	}
	internal sealed class ScalarEventInfo : ObjectEventInfo
	{
		[field: CompilerGenerated]
		public string RenderedValue
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public ScalarStyle Style
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool IsPlainImplicit
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool IsQuotedImplicit
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

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

		[field: CompilerGenerated]
		public MappingStyle Style
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public MappingStartEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
	}
	internal sealed class MappingEndEventInfo : EventInfo
	{
		public MappingEndEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
	}
	internal sealed class SequenceStartEventInfo : ObjectEventInfo
	{
		[field: CompilerGenerated]
		public bool IsImplicit
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public SequenceStyle Style
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public SequenceStartEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
	}
	internal sealed class SequenceEndEventInfo : EventInfo
	{
		public SequenceEndEventInfo(IObjectDescriptor source)
			: base(source)
		{
		}
	}
	internal interface IAliasProvider
	{
		AnchorName GetAlias(object target);
	}
	internal interface IDeserializer
	{
		T Deserialize<T>(string input);

		T Deserialize<T>(TextReader input);

		T Deserialize<T>(IParser parser);

		object? Deserialize(string input);

		object? Deserialize(TextReader input);

		object? Deserialize(IParser parser);

		object? Deserialize(string input, Type type);

		object? Deserialize(TextReader input, Type type);

		object? Deserialize(IParser parser, Type type);
	}
	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);
	}
	internal interface INamingConvention
	{
		string Apply(string value);

		string Reverse(string value);
	}
	internal interface INodeDeserializer
	{
		bool Deserialize(IParser reader, Type expectedType, Func<IParser, Type, object?> nestedObjectDeserializer, out object? value);
	}
	internal interface INodeTypeResolver
	{
		bool Resolve(NodeEvent? nodeEvent, ref Type currentType);
	}
	internal interface IObjectAccessor
	{
		void Set(string name, object target, object value);

		object? Read(string name, object target);
	}
	internal interface IObjectDescriptor
	{
		object? Value { get; }

		Type Type { get; }

		Type StaticType { get; }

		ScalarStyle ScalarStyle { get; }
	}
	internal static class ObjectDescriptorExtensions : Object
	{
		public static object NonNullValue(this IObjectDescriptor objectDescriptor)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			return objectDescriptor.Value ?? throw new InvalidOperationException(String.Concat("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."));
		}
	}
	internal interface IObjectFactory
	{
		object Create(Type type);

		object? CreatePrimitive(Type type);

		bool GetDictionary(IObjectDescriptor descriptor, out IDictionary? dictionary, out Type[]? genericArguments);

		Type GetValueType(Type type);

		void ExecuteOnDeserializing(object value);

		void ExecuteOnDeserialized(object value);

		void ExecuteOnSerializing(object value);

		void ExecuteOnSerialized(object value);
	}
	internal interface IObjectGraphTraversalStrategy
	{
		void Traverse<TContext>(IObjectDescriptor graph, IObjectGraphVisitor<TContext> visitor, TContext context);
	}
	internal interface IObjectGraphVisitor<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);
	}
	internal interface IPropertyDescriptor
	{
		string Name { get; }

		bool CanWrite { get; }

		Type Type { get; }

		Type? TypeOverride { get; set; }

		int Order { get; set; }

		ScalarStyle ScalarStyle { get; set; }

		T? GetCustomAttribute<T>() where T : Attribute;

		IObjectDescriptor Read(object target);

		void Write(object target, object? value);
	}
	internal interface IRegistrationLocationSelectionSyntax<TBaseRegistrationType>
	{
		void InsteadOf<TRegistrationType>() where TRegistrationType : TBaseRegistrationType;

		void Before<TRegistrationType>() where TRegistrationType : TBaseRegistrationType;

		void After<TRegistrationType>() where TRegistrationType : TBaseRegistrationType;

		void OnTop();

		void OnBottom();
	}
	internal interface ITrackingRegistrationLocationSelectionSyntax<TBaseRegistrationType>
	{
		void InsteadOf<TRegistrationType>() where TRegistrationType : TBaseRegistrationType;
	}
	internal interface ISerializer
	{
		string Serialize(object? graph);

		string Serialize(object? graph, Type type);

		void Serialize(TextWriter writer, object? graph);

		void Serialize(TextWriter writer, object? graph, Type type);

		void Serialize(IEmitter emitter, object? graph);

		void Serialize(IEmitter emitter, object? graph, Type type);
	}
	internal interface ITypeInspector
	{
		IEnumerable<IPropertyDescriptor> GetProperties(Type type, object? container);

		IPropertyDescriptor GetProperty(Type type, object? container, string name, [MaybeNullWhen(true)] bool ignoreUnmatched);
	}
	internal interface ITypeResolver
	{
		Type Resolve(Type staticType, object? actualValue);
	}
	internal interface IValueDeserializer
	{
		object? DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer);
	}
	internal interface IValuePromise
	{
		event Action<object?> ValueAvailable;
	}
	internal interface IValueSerializer
	{
		void SerializeValue(IEmitter emitter, object? value, Type? type);
	}
	internal interface IYamlConvertible
	{
		void Read(IParser parser, Type expectedType, ObjectDeserializer nestedObjectDeserializer);

		void Write(IEmitter emitter, ObjectSerializer nestedObjectSerializer);
	}
	internal delegate object? ObjectDeserializer(Type type);
	internal delegate void ObjectSerializer(object? value, Type? type = null);
	[Obsolete("Please use IYamlConvertible instead")]
	internal interface IYamlSerializable
	{
		void ReadYaml(IParser parser);

		void WriteYaml(IEmitter emitter);
	}
	internal interface IYamlTypeConverter
	{
		bool Accepts(Type type);

		object? ReadYaml(IParser parser, Type type);

		void WriteYaml(IEmitter emitter, object? value, Type type);
	}
	internal sealed class LazyComponentRegistrationList<TArgument, TComponent> : Object, IEnumerable<Func<TArgument, TComponent>>, IEnumerable
	{
		public sealed class LazyComponentRegistration : Object
		{
			public readonly Type ComponentType;

			public readonly Func<TArgument, TComponent> Factory;

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

		public sealed class TrackingLazyComponentRegistration : Object
		{
			public readonly Type ComponentType;

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

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

		private class RegistrationLocationSelector : Object, IRegistrationLocationSelectionSyntax<TComponent>
		{
			private readonly LazyComponentRegistrationList<TArgument, TComponent> registrations;

			private readonly LazyComponentRegistration newRegistration;

			public RegistrationLocationSelector(LazyComponentRegistrationList<TArgument, TComponent> registrations, 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);
			}
		}

		private class TrackingRegistrationLocationSelector : Object, ITrackingRegistrationLocationSelectionSyntax<TComponent>
		{
			[CompilerGenerated]
			private sealed class <>c__DisplayClass3_0<TRegistrationType> : Object where TRegistrationType : TComponent
			{
				public TrackingRegistrationLocationSelector <>4__this;

				public Func<TArgument, TComponent> innerComponentFactory;

				internal TComponent <YamlDotNet.Serialization.ITrackingRegistrationLocationSelectionSyntax<TComponent>.InsteadOf>b__0(TArgument arg)
				{
					return ((Func<TArgument, TComponent, TArgument>)(object)<>4__this.newRegistration.Factory).Invoke((TArgument)innerComponentFactory.Invoke(arg), (TComponent)arg);
				}
			}

			private readonly LazyComponentRegistrationList<TArgument, TComponent> registrations;

			private readonly TrackingLazyComponentRegistration newRegistration;

			public TrackingRegistrationLocationSelector(LazyComponentRegistrationList<TArgument, TComponent> registrations, TrackingLazyComponentRegistration newRegistration)
			{
				this.registrations = registrations;
				this.newRegistration = newRegistration;
			}

			void ITrackingRegistrationLocationSelectionSyntax<TComponent>.InsteadOf<TRegistrationType>()
			{
				<>c__DisplayClass3_0<TRegistrationType> CS$<>8__locals0 = new <>c__DisplayClass3_0<TRegistrationType>();
				CS$<>8__locals0.<>4__this = this;
				if (newRegistration.ComponentType != typeof(TRegistrationType))
				{
					registrations.EnsureNoDuplicateRegistrationType(newRegistration.ComponentType);
				}
				int index = registrations.EnsureRegistrationExists<TRegistrationType>();
				CS$<>8__locals0.innerComponentFactory = registrations.entries[index].Factory;
				registrations.entries[index] = new LazyComponentRegistration(newRegistration.ComponentType, (TArgument arg) => ((Func<TArgument, TComponent, TArgument>)(object)CS$<>8__locals0.<>4__this.newRegistration.Factory).Invoke((TArgument)CS$<>8__locals0.innerComponentFactory.Invoke(arg), (TComponent)arg));
			}
		}

		private readonly List<LazyComponentRegistration> entries = new List<LazyComponentRegistration>();

		public int Count => entries.Count;

		public IEnumerable<Func<TArgument, TComponent>> InReverseOrder
		{
			[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
			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)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < entries.Count; i++)
			{
				if (entries[i].ComponentType == componentType)
				{
					entries.RemoveAt(i);
					return;
				}
			}
			throw new KeyNotFoundException(String.Concat("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 ((IEnumerable<Func<Func<TArgument, TComponent>, ?>>)(object)Enumerable.Select<LazyComponentRegistration, Func<TArgument, TComponent>>((IEnumerable<LazyComponentRegistration>)(object)entries, (Func<LazyComponentRegistration, Func<TArgument, TComponent>>)(object)(Func<LazyComponentRegistrationList<LazyComponentRegistration, Func<TArgument, TComponent>>.LazyComponentRegistration, Func<LazyComponentRegistration, Func<TArgument, TComponent>>>)((LazyComponentRegistration e) => e.Factory))).GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return (IEnumerator)(object)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)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (IndexOfRegistration(componentType) != -1)
			{
				throw new InvalidOperationException(String.Concat("A component of type '", componentType.FullName, "' has already been registered."));
			}
		}

		private int EnsureRegistrationExists<TRegistrationType>()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			int num = IndexOfRegistration(typeof(TRegistrationType));
			if (num == -1)
			{
				throw new InvalidOperationException(String.Concat("A component of type '", typeof(TRegistrationType).FullName, "' has not been registered."));
			}
			return num;
		}
	}
	internal static class LazyComponentRegistrationListExtensions : Object
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass1_0<TArgument, TComponent> : Object where TArgument : notnull where TComponent : notnull
		{
			public Func<TComponent, TArgument> argumentBuilder;

			internal TComponent <BuildComponentChain>b__0(TComponent inner, Func<TArgument, TComponent> factory)
			{
				return factory.Invoke(((Func<TArgument, TComponent>)(object)argumentBuilder).Invoke((TArgument)inner));
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass3_0<TArgument, TComponent> : Object where TArgument : notnull where TComponent : notnull
		{
			public TArgument argument;

			internal TComponent <BuildComponentList>b__0(Func<TArgument, TComponent> factory)
			{
				return factory.Invoke(argument);
			}
		}

		public static TComponent BuildComponentChain<TComponent>(this LazyComponentRegistrationList<TComponent, TComponent> registrations, TComponent innerComponent)
		{
			return Enumerable.Aggregate<Func<TComponent, TComponent>, TComponent>(registrations.InReverseOrder, innerComponent, (Func<TComponent, Func<TComponent, TComponent>, TComponent>)((TComponent inner, Func<TComponent, TComponent> factory) => factory.Invoke(inner)));
		}

		public static TComponent BuildComponentChain<TArgument, TComponent>(this LazyComponentRegistrationList<TArgument, TComponent> registrations, TComponent innerComponent, Func<TComponent, TArgument> argumentBuilder)
		{
			<>c__DisplayClass1_0<TArgument, TComponent> CS$<>8__locals0 = new <>c__DisplayClass1_0<TArgument, TComponent>();
			CS$<>8__locals0.argumentBuilder = argumentBuilder;
			return Enumerable.Aggregate<Func<TArgument, TComponent>, TComponent>(registrations.InReverseOrder, innerComponent, (Func<TComponent, Func<TArgument, TComponent>, TComponent>)((TComponent inner, Func<TArgument, TComponent> factory) => factory.Invoke(CS$<>8__locals0.argumentBuilder.Invoke(inner))));
		}

		public static List<TComponent> BuildComponentList<TComponent>(this LazyComponentRegistrationList<Nothing, TComponent> registrations)
		{
			return Enumerable.ToList<TComponent>(Enumerable.Select<Func<Nothing, TComponent>, TComponent>((IEnumerable<Func<Nothing, TComponent>>)(object)registrations, (Func<Func<Nothing, TComponent>, TComponent>)((Func<Nothing, TComponent> factory) => factory.Invoke(default(Nothing)))));
		}

		public static List<TComponent> BuildComponentList<TArgument, TComponent>(this LazyComponentRegistrationList<TArgument, TComponent> registrations, TArgument argument)
		{
			<>c__DisplayClass3_0<TArgument, TComponent> CS$<>8__locals0 = new <>c__DisplayClass3_0<TArgument, TComponent>();
			CS$<>8__locals0.argument = argument;
			return Enumerable.ToList<TComponent>(Enumerable.Select<Func<TArgument, TComponent>, TComponent>((IEnumerable<Func<TArgument, TComponent>>)(object)registrations, (Func<Func<TArgument, TComponent>, TComponent>)((Func<TArgument, TComponent> factory) => factory.Invoke(CS$<>8__locals0.argument))));
		}
	}
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	internal struct Nothing : ValueType
	{
	}
	internal sealed class ObjectDescriptor : Object, IObjectDescriptor
	{
		[field: CompilerGenerated]
		public object? Value
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			private set;
		}

		[field: CompilerGenerated]
		public Type Type
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			private set;
		}

		[field: CompilerGenerated]
		public Type StaticType
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			private set;
		}

		[field: CompilerGenerated]
		public ScalarStyle ScalarStyle
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			private set;
		}

		public ObjectDescriptor(object? value, Type type, Type staticType)
			: this(value, type, staticType, ScalarStyle.Any)
		{
		}

		public ObjectDescriptor(object? value, Type type, Type staticType, ScalarStyle scalarStyle)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			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);
	internal sealed class PropertyDescriptor : Object, IPropertyDescriptor
	{
		private readonly IPropertyDescriptor baseDescriptor;

		[field: CompilerGenerated]
		public string Name
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public Type Type => baseDescriptor.Type;

		public Type? TypeOverride
		{
			get
			{
				return baseDescriptor.TypeOverride;
			}
			set
			{
				baseDescriptor.TypeOverride = value;
			}
		}

		[field: CompilerGenerated]
		public int Order
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			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, object? value)
		{
			baseDescriptor.Write(target, value);
		}

		public T? GetCustomAttribute<T>() where T : Attribute
		{
			return baseDescriptor.GetCustomAttribute<T>();
		}

		public IObjectDescriptor Read(object target)
		{
			return baseDescriptor.Read(target);
		}
	}
	internal sealed class Serializer : Object, ISerializer
	{
		private readonly IValueSerializer valueSerializer;

		private readonly EmitterSettings emitterSettings;

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

		private Serializer(IValueSerializer valueSerializer, EmitterSettings emitterSettings)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			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 string Serialize(object? graph)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			StringWriter val = new StringWriter();
			try
			{
				Serialize((TextWriter)(object)val, graph);
				return ((Object)val).ToString();
			}
			finally
			{
				if (val != null)
				{
					((IDisposable)val).Dispose();
				}
			}
		}

		public string Serialize(object? graph, Type type)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			StringWriter val = new StringWriter();
			try
			{
				Serialize((TextWriter)(object)val, graph, type);
				return ((Object)val).ToString();
			}
			finally
			{
				if (val != null)
				{
					((IDisposable)val).Dispose();
				}
			}
		}

		public void Serialize(TextWriter writer, object? graph)
		{
			Serialize((IEmitter)new Emitter(writer, emitterSettings), graph);
		}

		public void Serialize(TextWriter writer, object? graph, Type type)
		{
			Serialize((IEmitter)new Emitter(writer, emitterSettings), graph, type);
		}

		public void Serialize(IEmitter emitter, object? graph)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (emitter == null)
			{
				throw new ArgumentNullException("emitter");
			}
			EmitDocument(emitter, graph, null);
		}

		public void Serialize(IEmitter emitter, object? graph, Type type)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			if (emitter == null)
			{
				throw new ArgumentNullException("emitter");
			}
			if (type == (Type)null)
			{
				throw new ArgumentNullException("type");
			}
			EmitDocument(emitter, graph, type);
		}

		private void EmitDocument(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());
		}
	}
	internal sealed class SerializerBuilder : BuilderSkeleton<SerializerBuilder>
	{
		private class ValueSerializer : Object, IValueSerializer
		{
			[CompilerGenerated]
			private sealed class <>c__DisplayClass6_0 : Object
			{
				public ValueSerializer <>4__this;

				public IEmitter emitter;

				public List<IObjectGraphVisitor<Nothing>> preProcessingPhaseObjectGraphVisitors;

				internal EmissionPhaseObjectGraphVisitorArgs <SerializeValue>b__1(IObjectGraphVisitor<IEmitter> inner)
				{
					return new EmissionPhaseObjectGraphVisitorArgs(inner, <>4__this.eventEmitter, (IEnumerable<IObjectGraphVisitor<Nothing>>)(object)preProcessingPhaseObjectGraphVisitors, <>4__this.typeConverters, NestedObjectSerializer);
					void NestedObjectSerializer(object? v, Type? t)
					{
						<>4__this.SerializeValue(emitter, v, t);
					}
				}
			}

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

			public void SerializeValue(IEmitter emitter, object? value, Type? type)
			{
				<>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0();
				CS$<>8__locals0.<>4__this = this;
				CS$<>8__locals0.emitter = emitter;
				Type type2 = type ?? ((value != null) ? value.GetType() : typeof(Object));
				Type staticType = type ?? typeof(Object);
				ObjectDescriptor graph = new ObjectDescriptor(value, type2, staticType);
				CS$<>8__locals0.preProcessingPhaseObjectGraphVisitors = preProcessingPhaseObjectGraphVisitorFactories.BuildComponentList(typeConverters);
				foreach (IObjectGraphVisitor<Nothing> preProcessingPhaseObjectGraphVisitor in CS$<>8__locals0.preProcessingPhaseObjectGraphVisitors)
				{
					traversalStrategy.Traverse(graph, preProcessingPhaseObjectGraphVisitor, default(Nothing));
				}
				IObjectGraphVisitor<IEmitter> visitor = emissionPhaseObjectGraphVisitorFactories.BuildComponentChain(new EmittingObjectGraphVisitor(eventEmitter), (IObjectGraphVisitor<IEmitter> inner) => new EmissionPhaseObjectGraphVisitorArgs(inner, CS$<>8__locals0.<>4__this.eventEmitter, (IEnumerable<IObjectGraphVisitor<Nothing>>)(object)CS$<>8__locals0.preProcessingPhaseObjectGraphVisitors, CS$<>8__locals0.<>4__this.typeConverters, NestedObjectSerializer));
				traversalStrategy.Traverse(graph, visitor, CS$<>8__locals0.emitter);
				void NestedObjectSerializer(object? v, Type? t)
				{
					CS$<>8__locals0.<>4__this.SerializeValue(CS$<>8__locals0.emitter, v, t);
				}
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass19_0<TEventEmitter> : Object where TEventEmitter : notnull, IEventEmitter
		{
			public Func<IEventEmitter, TEventEmitter> eventEmitterFactory;

			internal IEventEmitter <WithEventEmitter>b__0(IEventEmitter inner)
			{
				return ((Func<IEventEmitter, IEventEmitter>)(object)eventEmitterFactory).Invoke(inner);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass20_0<TEventEmitter> : Object where TEventEmitter : notnull, IEventEmitter
		{
			public WrapperFactory<IEventEmitter, IEventEmitter, TEventEmitter> eventEmitterFactory;

			internal IEventEmitter <WithEventEmitter>b__0(IEventEmitter wrapped, IEventEmitter inner)
			{
				return eventEmitterFactory(wrapped, inner);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass33_0<TObjectGraphVisitor> : Object where TObjectGraphVisitor : notnull, IObjectGraphVisitor<Nothing>
		{
			public TObjectGraphVisitor objectGraphVisitor;

			internal IObjectGraphVisitor<Nothing> <WithPreProcessingPhaseObjectGraphVisitor>b__0(IEnumerable<IYamlTypeConverter> _)
			{
				return objectGraphVisitor;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass34_0<TObjectGraphVisitor> : Object where TObjectGraphVisitor : notnull, IObjectGraphVisitor<Nothing>
		{
			public Func<IEnumerable<IYamlTypeConverter>, TObjectGraphVisitor> objectGraphVisitorFactory;

			internal IObjectGraphVisitor<Nothing> <WithPreProcessingPhaseObjectGraphVisitor>b__0(IEnumerable<IYamlTypeConverter> typeConverters)
			{
				return ((Func<IEnumerable<IYamlTypeConverter>, IEnumerable<IYamlTypeConverter>>)(object)objectGraphVisitorFactory).Invoke(typeConverters);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass35_0<TObjectGraphVisitor> : Object where TObjectGraphVisitor : notnull, IObjectGraphVisitor<Nothing>
		{
			public WrapperFactory<IObjectGraphVisitor<Nothing>, TObjectGraphVisitor> objectGraphVisitorFactory;

			internal IObjectGraphVisitor<Nothing> <WithPreProcessingPhaseObjectGraphVisitor>b__0(IObjectGraphVisitor<Nothing> wrapped, IEnumerable<IYamlTypeConverter> _)
			{
				return objectGraphVisitorFactory(wrapped);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass36_0<TObjectGraphVisitor> : Object where TObjectGraphVisitor : notnull, IObjectGraphVisitor<Nothing>
		{
			public WrapperFactory<IEnumerable<IYamlTypeConverter>, IObjectGraphVisitor<Nothing>, TObjectGraphVisitor> objectGraphVisitorFactory;

			internal IObjectGraphVisitor<Nothing> <WithPreProcessingPhaseObjectGraphVisitor>b__0(IObjectGraphVisitor<Nothing> wrapped, IEnumerable<IYamlTypeConverter> typeConverters)
			{
				return objectGraphVisitorFactory(wrapped, typeConverters);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass41_0<TObjectGraphVisitor> : Object where TObjectGraphVisitor : notnull, IObjectGraphVisitor<IEmitter>
		{
			public Func<EmissionPhaseObjectGraphVisitorArgs, TObjectGraphVisitor> objectGraphVisitorFactory;

			internal IObjectGraphVisitor<IEmitter> <WithEmissionPhaseObjectGraphVisitor>b__0(EmissionPhaseObjectGraphVisitorArgs args)
			{
				return ((Func<EmissionPhaseObjectGraphVisitorArgs, EmissionPhaseObjectGraphVisitorArgs>)(object)objectGraphVisitorFactory).Invoke(args);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass42_0<TObjectGraphVisitor> : Object where TObjectGraphVisitor : notnull, IObjectGraphVisitor<IEmitter>
		{
			public WrapperFactory<EmissionPhaseObjectGraphVisitorArgs, IObjectGraphVisitor<IEmitter>, TObjectGraphVisitor> objectGraphVisitorFactory;

			internal IObjectGraphVisitor<IEmitter> <WithEmissionPhaseObjectGraphVisitor>b__0(IObjectGraphVisitor<IEmitter> wrapped, EmissionPhaseObjectGraphVisitorArgs args)
			{
				return objectGraphVisitorFactory(wrapped, args);
			}
		}

		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 = (IDictionary<Type, TagName>)(object)new Dictionary<Type, TagName>();

		private readonly IObjectFactory objectFactory;

		private int maximumRecursion = 50;

		private EmitterSettings emitterSettings = EmitterSettings.Default;

		private DefaultValuesHandling defaultValuesHandlingConfiguration;

		private ScalarStyle defaultScalarStyle;

		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), [CompilerGenerated] (ITypeInspector inner) => (!(namingConvention is NullNamingConvention)) ? new NamingConventionTypeInspector(inner, namingConvention) : inner);
			typeInspectorFactories.Add(typeof(YamlAttributesTypeInspector), (ITypeInspector inner) => new YamlAttributesTypeInspector(inner));
			typeInspectorFactories.Add(typeof(YamlAttributeOverridesInspector), [CompilerGenerated] (ITypeInspector inner) => (overrides == null) ? inner : new YamlAttributeOverridesInspector(inner, overrides.Clone()));
			LazyComponentRegistrationList<IEnumerable<IYamlTypeConverter>, IObjectGraphVisitor<Nothing>> lazyComponentRegistrationList = new LazyComponentRegistrationList<IEnumerable<IYamlTypeConverter>, IObjectGraphVisitor<Nothing>>();
			lazyComponentRegistrationList.Add(typeof(AnchorAssigner), (IEnumerable<IYamlTypeConverter> typeConverters) => new AnchorAssigner(typeConverters));
			preProcessingPhaseObjectGraphVisitorFactories = lazyComponentRegistrationList;
			LazyComponentRegistrationList<EmissionPhaseObjectGraphVisitorArgs, IObjectGraphVisitor<IEmitter>> lazyComponentRegistrationList2 = new LazyComponentRegistrationList<EmissionPhaseObjectGraphVisitorArgs, IObjectGraphVisitor<IEmitter>>();
			lazyComponentRegistrationList2.Add(typeof(CustomSerializationObjectGraphVisitor), (EmissionPhaseObjectGraphVisitorArgs args) => new CustomSerializationObjectGraphVisitor(args.InnerVisitor, args.TypeConverters, args.NestedObjectSerializer));
			lazyComponentRegistrationList2.Add(typeof(AnchorAssigningObjectGraphVisitor), (EmissionPhaseObjectGraphVisitorArgs args) => new AnchorAssigningObjectGraphVisitor(args.InnerVisitor, args.EventEmitter, args.GetPreProcessingPhaseObjectGraphVisitor<AnchorAssigner>()));
			lazyComponentRegistrationList2.Add(typeof(DefaultValuesObjectGraphVisitor), [CompilerGenerated] (EmissionPhaseObjectGraphVisitorArgs args) => new DefaultValuesObjectGraphVisitor(defaultValuesHandlingConfiguration, args.InnerVisitor, new DefaultObjectFactory()));
			lazyComponentRegistrationList2.Add(typeof(CommentsObjectGraphVisitor), (EmissionPhaseObjectGraphVisitorArgs args) => new CommentsObjectGraphVisitor(args.InnerVisitor));
			emissionPhaseObjectGraphVisitorFactories = lazyComponentRegistrationList2;
			LazyComponentRegistrationList<IEventEmitter, IEventEmitter> lazyComponentRegistrationList3 = new LazyComponentRegistrationList<IEventEmitter, IEventEmitter>();
			lazyComponentRegistrationList3.Add(typeof(TypeAssigningEventEmitter), [CompilerGenerated] (IEventEmitter inner) => new TypeAssigningEventEmitter(inner, requireTagWhenStaticAndActualTypesAreDifferent: false, tagMappings, quoteNecessaryStrings, quoteYaml1_1Strings, defaultScalarStyle, yamlFormatter, enumNamingConvention));
			eventEmitterFactories = lazyComponentRegistrationList3;
			objectFactory = new DefaultObjectFactory();
			objectGraphTraversalStrategyFactory = [CompilerGenerated] (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 WithDefaultScalarStyle(ScalarStyle style)
		{
			defaultScalarStyle = style;
			return this;
		}

		public SerializerBuilder WithMaximumRecursion(int maximumRecursion)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (maximumRecursion <= 0)
			{
				throw new ArgumentOutOfRangeException("maximumRecursion", String.Format("The maximum recursion specified ({0}) is invalid. It should be a positive integer.", (object)maximumRecursion));
			}
			this.maximumRecursion = maximumRecursion;
			return this;
		}

		public SerializerBuilder WithEventEmitter<TEventEmitter>(Func<IEventEmitter, TEventEmitter> eventEmitterFactory) where TEventEmitter : IEventEmitter
		{
			return WithEventEmitter<TEventEmitter>(eventEmitterFactory, delegate(IRegistrationLocationSelectionSyntax<IEventEmitter> w)
			{
				w.OnTop();
			});
		}

		public SerializerBuilder WithEventEmitter<TEventEmitter>(Func<IEventEmitter, TEventEmitter> eventEmitterFactory, Action<IRegistrationLocationSelectionSyntax<IEventEmitter>> where) where TEventEmitter : IEventEmitter
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass19_0<TEventEmitter> CS$<>8__locals0 = new <>c__DisplayClass19_0<TEventEmitter>();
			CS$<>8__locals0.eventEmitterFactory = eventEmitterFactory;
			if (CS$<>8__locals0.eventEmitterFactory == null)
			{
				throw new ArgumentNullException("eventEmitterFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where.Invoke(eventEmitterFactories.CreateRegistrationLocationSelector(typeof(TEventEmitter), (IEventEmitter inner) => CS$<>8__locals0.eventEmitterFactory.Invoke(inner)));
			return Self;
		}

		public SerializerBuilder WithEventEmitter<TEventEmitter>(WrapperFactory<IEventEmitter, IEventEmitter, TEventEmitter> eventEmitterFactory, Action<ITrackingRegistrationLocationSelectionSyntax<IEventEmitter>> where) where TEventEmitter : IEventEmitter
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass20_0<TEventEmitter> CS$<>8__locals0 = new <>c__DisplayClass20_0<TEventEmitter>();
			CS$<>8__locals0.eventEmitterFactory = eventEmitterFactory;
			if (CS$<>8__locals0.eventEmitterFactory == null)
			{
				throw new ArgumentNullException("eventEmitterFactory");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where.Invoke(eventEmitterFactories.CreateTrackingRegistrationLocationSelector(typeof(TEventEmitter), (IEventEmitter wrapped, IEventEmitter inner) => CS$<>8__locals0.eventEmitterFactory(wrapped, inner)));
			return Self;
		}

		public SerializerBuilder WithoutEventEmitter<TEventEmitter>() where TEventEmitter : IEventEmitter
		{
			return WithoutEventEmitter(typeof(TEventEmitter));
		}

		public SerializerBuilder WithoutEventEmitter(Type eventEmitterType)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (eventEmitterType == (Type)null)
			{
				throw new ArgumentNullException("eventEmitterType");
			}
			eventEmitterFactories.Remove(eventEmitterType);
			return this;
		}

		public override SerializerBuilder WithTagMapping(TagName tag, Type type)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (tag.IsEmpty)
			{
				throw new ArgumentException("Non-specific tags cannot be maped");
			}
			if (type == (Type)null)
			{
				throw new ArgumentNullException("type");
			}
			TagName tagName = default(TagName);
			if (tagMappings.TryGetValue(type, ref tagName))
			{
				throw new ArgumentException(String.Format("Type already has a registered tag '{0}' for type '{1}'", (object)tagName, (object)type.FullName), "type");
			}
			tagMappings.Add(type, tag);
			return this;
		}

		public SerializerBuilder WithoutTagMapping(Type type)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (type == (Type)null)
			{
				throw new ArgumentNullException("type");
			}
			if (!tagMappings.Remove(type))
			{
				throw new KeyNotFoundException(String.Concat("Tag for type '", type.FullName, "' is not registered"));
			}
			return this;
		}

		public SerializerBuilder EnsureRoundtrip()
		{
			objectGraphTraversalStrategyFactory = [CompilerGenerated] (ITypeInspector typeInspector, ITypeResolver typeResolver, IEnumerable<IYamlTypeConverter> typeConverters, int maximumRecursion) => new RoundtripObjectGraphTraversalStrategy(typeConverters, typeInspector, typeResolver, maximumRecursion, namingConvention, settings, objectFactory);
			WithEventEmitter<TypeAssigningEventEmitter>([CompilerGenerated] (IEventEmitter inner) => new TypeAssigningEventEmitter(inner, requireTagWhenStaticAndActualTypesAreDifferent: true, tagMappings, quoteNecessaryStrings, quoteYaml1_1Strings, defaultScalarStyle, yamlFormatter, enumNamingConvention), delegate(IRegistrationLocationSelectionSyntax<IEventEmitter> loc)
			{
				loc.InsteadOf<TypeAssigningEventEmitter>();
			});
			return WithTypeInspector<ReadableAndWritablePropertiesTypeInspector>((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)1, null, true)).WithEventEmitter<JsonEventEmitter>([CompilerGenerated] (IEventEmitter inner) => new JsonEventEmitter(inner, yamlFormatter, enumNamingConvention), delegate(IRegistrationLocationSelectionSyntax<IEventEmitter> loc)
			{
				loc.InsteadOf<TypeAssigningEventEmitter>();
			});
		}

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

		public SerializerBuilder WithPreProcessingPhaseObjectGraphVisitor<TObjectGraphVisitor>(TObjectGraphVisitor objectGraphVisitor) where TObjectGraphVisitor : IObjectGraphVisitor<Nothing>
		{
			return WithPreProcessingPhaseObjectGraphVisitor(objectGraphVisitor, delegate(IRegistrationLocationSelectionSyntax<IObjectGraphVisitor<Nothing>> w)
			{
				w.OnTop();
			});
		}

		public SerializerBuilder WithPreProcessingPhaseObjectGraphVisitor<TObjectGraphVisitor>(Func<IEnumerable<IYamlTypeConverter>, TObjectGraphVisitor> objectGraphVisitorFactory) where TObjectGraphVisitor : IObjectGraphVisitor<Nothing>
		{
			return WithPreProcessingPhaseObjectGraphVisitor<TObjectGraphVisitor>(objectGraphVisitorFactory, delegate(IRegistrationLocationSelectionSyntax<IObjectGraphVisitor<Nothing>> w)
			{
				w.OnTop();
			});
		}

		public SerializerBuilder WithPreProcessingPhaseObjectGraphVisitor<TObjectGraphVisitor>(TObjectGraphVisitor objectGraphVisitor, Action<IRegistrationLocationSelectionSyntax<IObjectGraphVisitor<Nothing>>> where) where TObjectGraphVisitor : IObjectGraphVisitor<Nothing>
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass33_0<TObjectGraphVisitor> CS$<>8__locals0 = new <>c__DisplayClass33_0<TObjectGraphVisitor>();
			CS$<>8__locals0.objectGraphVisitor = objectGraphVisitor;
			if (CS$<>8__locals0.objectGraphVisitor == null)
			{
				throw new ArgumentNullException("objectGraphVisitor");
			}
			if (where == null)
			{
				throw new ArgumentNullException("where");
			}
			where.Invoke(preProcessingPhaseObjectGraphVisitorFactories.CreateRegistrationLocationSelector(typeof(TObjectGraphVisitor), (IEnumerable<IYamlTypeConverter> _) => CS$<>8__locals0.objectGraphVisitor));
			return this;
		}

		public SerializerBuilder WithPreProcessingPhaseObjectGraphVisitor<TObjectGraphVisitor>(Func<IEnumerable<IYamlTypeConverter>, TObjectGraphVisitor> objectGraphVisitorFactory, Action<IRegistrationLocationSelectionSyntax<IObjectGraphVisitor<Nothing>>> where) where TObjectGraphVisitor : IObjectGraphVisitor<Nothing>
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass34_0<TObjectGraphVisitor> CS$<>8__locals0 = new <>c__DisplayClass34_0<TObjectGraphVisitor>();
			CS$<>8__locals0.ob