Decompiled source of Grey Announcer v1.3.1

FFmpeg.AutoGen.dll

Decompiled 5 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using FFmpeg.AutoGen.Native;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Rationale One")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © Ruslan Balanukhin 2023 All rights reserved.")]
[assembly: AssemblyDescription("FFmpeg auto generated unsafe bindings for C#/.NET and Mono.")]
[assembly: AssemblyFileVersion("7.1.1")]
[assembly: AssemblyInformationalVersion("7.1.1+d90d69ba6287e040ea09e68e0fc66c641ec77a34")]
[assembly: AssemblyProduct("FFmpeg.AutoGen")]
[assembly: AssemblyTitle("FFmpeg.AutoGen")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("7.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FFmpeg.AutoGen
{
	public class ConstCharPtrMarshaler : ICustomMarshaler
	{
		private static readonly ConstCharPtrMarshaler Instance = new ConstCharPtrMarshaler();

		public object MarshalNativeToManaged(IntPtr pNativeData)
		{
			return Marshal.PtrToStringAnsi(pNativeData);
		}

		public IntPtr MarshalManagedToNative(object managedObj)
		{
			return IntPtr.Zero;
		}

		public void CleanUpNativeData(IntPtr pNativeData)
		{
		}

		public void CleanUpManagedData(object managedObj)
		{
		}

		public int GetNativeDataSize()
		{
			return IntPtr.Size;
		}

		public static ICustomMarshaler GetInstance(string cookie)
		{
			return Instance;
		}
	}
	public static class ffmpeg
	{
		public static readonly int EAGAIN;

		public static readonly int ENOMEM;

		public static readonly int EINVAL;

		public static readonly int EPIPE;

		public static Dictionary<string, int> LibraryVersionMap;

		public const int _WIN32_WINNT = 1538;

		public const int AV_BUFFER_FLAG_READONLY = 1;

		public const int AV_BUFFERSINK_FLAG_NO_REQUEST = 2;

		public const int AV_BUFFERSINK_FLAG_PEEK = 1;

		public static readonly ulong AV_CH_BACK_CENTER;

		public static readonly ulong AV_CH_BACK_LEFT;

		public static readonly ulong AV_CH_BACK_RIGHT;

		public static readonly ulong AV_CH_BOTTOM_FRONT_CENTER;

		public static readonly ulong AV_CH_BOTTOM_FRONT_LEFT;

		public static readonly ulong AV_CH_BOTTOM_FRONT_RIGHT;

		public static readonly ulong AV_CH_FRONT_CENTER;

		public static readonly ulong AV_CH_FRONT_LEFT;

		public static readonly ulong AV_CH_FRONT_LEFT_OF_CENTER;

		public static readonly ulong AV_CH_FRONT_RIGHT;

		public static readonly ulong AV_CH_FRONT_RIGHT_OF_CENTER;

		public static readonly ulong AV_CH_LAYOUT_2_1;

		public static readonly ulong AV_CH_LAYOUT_2_2;

		public static readonly ulong AV_CH_LAYOUT_22POINT2;

		public static readonly ulong AV_CH_LAYOUT_2POINT1;

		public static readonly ulong AV_CH_LAYOUT_3POINT1;

		public static readonly ulong AV_CH_LAYOUT_3POINT1POINT2;

		public static readonly ulong AV_CH_LAYOUT_4POINT0;

		public static readonly ulong AV_CH_LAYOUT_4POINT1;

		public static readonly ulong AV_CH_LAYOUT_5POINT0;

		public static readonly ulong AV_CH_LAYOUT_5POINT0_BACK;

		public static readonly ulong AV_CH_LAYOUT_5POINT1;

		public static readonly ulong AV_CH_LAYOUT_5POINT1_BACK;

		public static readonly ulong AV_CH_LAYOUT_5POINT1POINT2_BACK;

		public static readonly ulong AV_CH_LAYOUT_5POINT1POINT4_BACK;

		public static readonly ulong AV_CH_LAYOUT_6POINT0;

		public static readonly ulong AV_CH_LAYOUT_6POINT0_FRONT;

		public static readonly ulong AV_CH_LAYOUT_6POINT1;

		public static readonly ulong AV_CH_LAYOUT_6POINT1_BACK;

		public static readonly ulong AV_CH_LAYOUT_6POINT1_FRONT;

		public static readonly ulong AV_CH_LAYOUT_7POINT0;

		public static readonly ulong AV_CH_LAYOUT_7POINT0_FRONT;

		public static readonly ulong AV_CH_LAYOUT_7POINT1;

		public static readonly ulong AV_CH_LAYOUT_7POINT1_TOP_BACK;

		public static readonly ulong AV_CH_LAYOUT_7POINT1_WIDE;

		public static readonly ulong AV_CH_LAYOUT_7POINT1_WIDE_BACK;

		public static readonly ulong AV_CH_LAYOUT_7POINT1POINT2;

		public static readonly ulong AV_CH_LAYOUT_7POINT1POINT4_BACK;

		public static readonly ulong AV_CH_LAYOUT_7POINT2POINT3;

		public static readonly ulong AV_CH_LAYOUT_9POINT1POINT4_BACK;

		public static readonly ulong AV_CH_LAYOUT_CUBE;

		public static readonly ulong AV_CH_LAYOUT_HEXADECAGONAL;

		public static readonly ulong AV_CH_LAYOUT_HEXAGONAL;

		public static readonly ulong AV_CH_LAYOUT_MONO;

		public static readonly ulong AV_CH_LAYOUT_OCTAGONAL;

		public static readonly ulong AV_CH_LAYOUT_QUAD;

		public static readonly ulong AV_CH_LAYOUT_STEREO;

		public static readonly ulong AV_CH_LAYOUT_STEREO_DOWNMIX;

		public static readonly ulong AV_CH_LAYOUT_SURROUND;

		public static readonly ulong AV_CH_LOW_FREQUENCY;

		public static readonly ulong AV_CH_LOW_FREQUENCY_2;

		public static readonly ulong AV_CH_SIDE_LEFT;

		public static readonly ulong AV_CH_SIDE_RIGHT;

		public static readonly ulong AV_CH_SIDE_SURROUND_LEFT;

		public static readonly ulong AV_CH_SIDE_SURROUND_RIGHT;

		public static readonly ulong AV_CH_STEREO_LEFT;

		public static readonly ulong AV_CH_STEREO_RIGHT;

		public static readonly ulong AV_CH_SURROUND_DIRECT_LEFT;

		public static readonly ulong AV_CH_SURROUND_DIRECT_RIGHT;

		public static readonly ulong AV_CH_TOP_BACK_CENTER;

		public static readonly ulong AV_CH_TOP_BACK_LEFT;

		public static readonly ulong AV_CH_TOP_BACK_RIGHT;

		public static readonly ulong AV_CH_TOP_CENTER;

		public static readonly ulong AV_CH_TOP_FRONT_CENTER;

		public static readonly ulong AV_CH_TOP_FRONT_LEFT;

		public static readonly ulong AV_CH_TOP_FRONT_RIGHT;

		public static readonly ulong AV_CH_TOP_SIDE_LEFT;

		public static readonly ulong AV_CH_TOP_SIDE_RIGHT;

		public static readonly ulong AV_CH_TOP_SURROUND_LEFT;

		public static readonly ulong AV_CH_TOP_SURROUND_RIGHT;

		public static readonly ulong AV_CH_WIDE_LEFT;

		public static readonly ulong AV_CH_WIDE_RIGHT;

		public const int AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL = 2;

		public const int AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS = 1;

		public const int AV_CODEC_CAP_AVOID_PROBING = 131072;

		public const int AV_CODEC_CAP_CHANNEL_CONF = 1024;

		public const int AV_CODEC_CAP_DELAY = 32;

		public const int AV_CODEC_CAP_DR1 = 2;

		public const int AV_CODEC_CAP_DRAW_HORIZ_BAND = 1;

		public const int AV_CODEC_CAP_ENCODER_FLUSH = 2097152;

		public const int AV_CODEC_CAP_ENCODER_RECON_FRAME = 4194304;

		public const int AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE = 1048576;

		public const int AV_CODEC_CAP_EXPERIMENTAL = 512;

		public const int AV_CODEC_CAP_FRAME_THREADS = 4096;

		public const int AV_CODEC_CAP_HARDWARE = 262144;

		public const int AV_CODEC_CAP_HYBRID = 524288;

		public const int AV_CODEC_CAP_OTHER_THREADS = 32768;

		public const int AV_CODEC_CAP_PARAM_CHANGE = 16384;

		public const int AV_CODEC_CAP_SLICE_THREADS = 8192;

		public const int AV_CODEC_CAP_SMALL_LAST_FRAME = 64;

		public const int AV_CODEC_CAP_SUBFRAMES = 256;

		public const int AV_CODEC_CAP_VARIABLE_FRAME_SIZE = 65536;

		public const int AV_CODEC_EXPORT_DATA_ENHANCEMENTS = 16;

		public const int AV_CODEC_EXPORT_DATA_FILM_GRAIN = 8;

		public const int AV_CODEC_EXPORT_DATA_MVS = 1;

		public const int AV_CODEC_EXPORT_DATA_PRFT = 2;

		public const int AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS = 4;

		public const int AV_CODEC_FLAG_4MV = 4;

		public const int AV_CODEC_FLAG_AC_PRED = 16777216;

		public const int AV_CODEC_FLAG_BITEXACT = 8388608;

		public const uint AV_CODEC_FLAG_CLOSED_GOP = 2147483648u;

		public const int AV_CODEC_FLAG_COPY_OPAQUE = 128;

		public const int AV_CODEC_FLAG_DROPCHANGED = 32;

		public const int AV_CODEC_FLAG_FRAME_DURATION = 256;

		public const int AV_CODEC_FLAG_GLOBAL_HEADER = 4194304;

		public const int AV_CODEC_FLAG_GRAY = 8192;

		public const int AV_CODEC_FLAG_INTERLACED_DCT = 262144;

		public const int AV_CODEC_FLAG_INTERLACED_ME = 536870912;

		public const int AV_CODEC_FLAG_LOOP_FILTER = 2048;

		public const int AV_CODEC_FLAG_LOW_DELAY = 524288;

		public const int AV_CODEC_FLAG_OUTPUT_CORRUPT = 8;

		public const int AV_CODEC_FLAG_PASS1 = 512;

		public const int AV_CODEC_FLAG_PASS2 = 1024;

		public const int AV_CODEC_FLAG_PSNR = 32768;

		public const int AV_CODEC_FLAG_QPEL = 16;

		public const int AV_CODEC_FLAG_QSCALE = 2;

		public const int AV_CODEC_FLAG_RECON_FRAME = 64;

		public const int AV_CODEC_FLAG_UNALIGNED = 1;

		public const int AV_CODEC_FLAG2_CHUNKS = 32768;

		public const int AV_CODEC_FLAG2_EXPORT_MVS = 268435456;

		public const int AV_CODEC_FLAG2_FAST = 1;

		public const uint AV_CODEC_FLAG2_ICC_PROFILES = 2147483648u;

		public const int AV_CODEC_FLAG2_IGNORE_CROP = 65536;

		public const int AV_CODEC_FLAG2_LOCAL_HEADER = 8;

		public const int AV_CODEC_FLAG2_NO_OUTPUT = 4;

		public const int AV_CODEC_FLAG2_RO_FLUSH_NOOP = 1073741824;

		public const int AV_CODEC_FLAG2_SHOW_ALL = 4194304;

		public const int AV_CODEC_FLAG2_SKIP_MANUAL = 536870912;

		public static readonly int AV_CODEC_ID_H265;

		public static readonly int AV_CODEC_ID_H266;

		public static readonly int AV_CODEC_ID_IFF_BYTERUN1;

		public const int AV_CODEC_PROP_BITMAP_SUB = 65536;

		public const int AV_CODEC_PROP_FIELDS = 16;

		public const int AV_CODEC_PROP_INTRA_ONLY = 1;

		public const int AV_CODEC_PROP_LOSSLESS = 4;

		public const int AV_CODEC_PROP_LOSSY = 2;

		public const int AV_CODEC_PROP_REORDER = 8;

		public const int AV_CODEC_PROP_TEXT_SUB = 131072;

		public const int AV_CPU_FLAG_3DNOW = 4;

		public const int AV_CPU_FLAG_3DNOWEXT = 32;

		public const int AV_CPU_FLAG_AESNI = 524288;

		public const int AV_CPU_FLAG_ALTIVEC = 1;

		public const int AV_CPU_FLAG_ARMV5TE = 1;

		public const int AV_CPU_FLAG_ARMV6 = 2;

		public const int AV_CPU_FLAG_ARMV6T2 = 4;

		public const int AV_CPU_FLAG_ARMV8 = 64;

		public const int AV_CPU_FLAG_ATOM = 268435456;

		public const int AV_CPU_FLAG_AVX = 16384;

		public const int AV_CPU_FLAG_AVX2 = 32768;

		public const int AV_CPU_FLAG_AVX512 = 1048576;

		public const int AV_CPU_FLAG_AVX512ICL = 2097152;

		public const int AV_CPU_FLAG_AVXSLOW = 134217728;

		public const int AV_CPU_FLAG_BMI1 = 131072;

		public const int AV_CPU_FLAG_BMI2 = 262144;

		public const int AV_CPU_FLAG_CMOV = 4096;

		public const int AV_CPU_FLAG_DOTPROD = 256;

		public const int AV_CPU_FLAG_FMA3 = 65536;

		public const int AV_CPU_FLAG_FMA4 = 2048;

		public const uint AV_CPU_FLAG_FORCE = 2147483648u;

		public const int AV_CPU_FLAG_I8MM = 512;

		public const int AV_CPU_FLAG_LASX = 2;

		public const int AV_CPU_FLAG_LSX = 1;

		public const int AV_CPU_FLAG_MMI = 1;

		public const int AV_CPU_FLAG_MMX = 1;

		public const int AV_CPU_FLAG_MMX2 = 2;

		public const int AV_CPU_FLAG_MMXEXT = 2;

		public const int AV_CPU_FLAG_MSA = 2;

		public const int AV_CPU_FLAG_NEON = 32;

		public const int AV_CPU_FLAG_POWER8 = 4;

		public const int AV_CPU_FLAG_RV_MISALIGNED = 1024;

		public const int AV_CPU_FLAG_RV_ZVBB = 512;

		public const int AV_CPU_FLAG_RVB = 2048;

		public const int AV_CPU_FLAG_RVB_ADDR = 256;

		public const int AV_CPU_FLAG_RVB_BASIC = 128;

		public const int AV_CPU_FLAG_RVD = 4;

		public const int AV_CPU_FLAG_RVF = 2;

		public const int AV_CPU_FLAG_RVI = 1;

		public const int AV_CPU_FLAG_RVV_F32 = 16;

		public const int AV_CPU_FLAG_RVV_F64 = 64;

		public const int AV_CPU_FLAG_RVV_I32 = 8;

		public const int AV_CPU_FLAG_RVV_I64 = 32;

		public const int AV_CPU_FLAG_SETEND = 65536;

		public const int AV_CPU_FLAG_SLOW_GATHER = 33554432;

		public const int AV_CPU_FLAG_SSE = 8;

		public const int AV_CPU_FLAG_SSE2 = 16;

		public const int AV_CPU_FLAG_SSE2SLOW = 1073741824;

		public const int AV_CPU_FLAG_SSE3 = 64;

		public const int AV_CPU_FLAG_SSE3SLOW = 536870912;

		public const int AV_CPU_FLAG_SSE4 = 256;

		public const int AV_CPU_FLAG_SSE42 = 512;

		public const int AV_CPU_FLAG_SSSE3 = 128;

		public const int AV_CPU_FLAG_SSSE3SLOW = 67108864;

		public const int AV_CPU_FLAG_VFP = 8;

		public const int AV_CPU_FLAG_VFP_VM = 128;

		public const int AV_CPU_FLAG_VFPV3 = 16;

		public const int AV_CPU_FLAG_VSX = 2;

		public const int AV_CPU_FLAG_XOP = 1024;

		public const int AV_DICT_APPEND = 32;

		public const int AV_DICT_DONT_OVERWRITE = 16;

		public const int AV_DICT_DONT_STRDUP_KEY = 4;

		public const int AV_DICT_DONT_STRDUP_VAL = 8;

		public const int AV_DICT_IGNORE_SUFFIX = 2;

		public const int AV_DICT_MATCH_CASE = 1;

		public const int AV_DICT_MULTIKEY = 64;

		public const int AV_DISPOSITION_ATTACHED_PIC = 1024;

		public const int AV_DISPOSITION_CAPTIONS = 65536;

		public const int AV_DISPOSITION_CLEAN_EFFECTS = 512;

		public const int AV_DISPOSITION_COMMENT = 8;

		public const int AV_DISPOSITION_DEFAULT = 1;

		public const int AV_DISPOSITION_DEPENDENT = 524288;

		public const int AV_DISPOSITION_DESCRIPTIONS = 131072;

		public const int AV_DISPOSITION_DUB = 2;

		public const int AV_DISPOSITION_FORCED = 64;

		public const int AV_DISPOSITION_HEARING_IMPAIRED = 128;

		public const int AV_DISPOSITION_KARAOKE = 32;

		public const int AV_DISPOSITION_LYRICS = 16;

		public const int AV_DISPOSITION_METADATA = 262144;

		public const int AV_DISPOSITION_MULTILAYER = 2097152;

		public const int AV_DISPOSITION_NON_DIEGETIC = 4096;

		public const int AV_DISPOSITION_ORIGINAL = 4;

		public const int AV_DISPOSITION_STILL_IMAGE = 1048576;

		public const int AV_DISPOSITION_TIMED_THUMBNAILS = 2048;

		public const int AV_DISPOSITION_VISUAL_IMPAIRED = 256;

		public const int AV_EF_AGGRESSIVE = 262144;

		public const int AV_EF_BITSTREAM = 2;

		public const int AV_EF_BUFFER = 4;

		public const int AV_EF_CAREFUL = 65536;

		public const int AV_EF_COMPLIANT = 131072;

		public const int AV_EF_CRCCHECK = 1;

		public const int AV_EF_EXPLODE = 8;

		public const int AV_EF_IGNORE_ERR = 32768;

		public const int AV_ERROR_MAX_STRING_SIZE = 64;

		public const int AV_FOURCC_MAX_STRING_SIZE = 32;

		public const int AV_FRAME_FILENAME_FLAGS_MULTIPLE = 1;

		public const int AV_FRAME_FLAG_CORRUPT = 1;

		public const int AV_FRAME_FLAG_DISCARD = 4;

		public const int AV_FRAME_FLAG_INTERLACED = 8;

		public const int AV_FRAME_FLAG_KEY = 2;

		public const int AV_FRAME_FLAG_TOP_FIELD_FIRST = 16;

		public const int AV_FRAME_SIDE_DATA_FLAG_REPLACE = 2;

		public const int AV_FRAME_SIDE_DATA_FLAG_UNIQUE = 1;

		public const int AV_GET_BUFFER_FLAG_REF = 1;

		public const int AV_GET_ENCODE_BUFFER_FLAG_REF = 1;

		public const int AV_HAVE_BIGENDIAN = 0;

		public const int AV_HAVE_FAST_UNALIGNED = 1;

		public const int AV_HDR_PLUS_MAX_PAYLOAD_SIZE = 907;

		public const int AV_HWACCEL_CODEC_CAP_EXPERIMENTAL = 512;

		public const int AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH = 2;

		public const int AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH = 4;

		public const int AV_HWACCEL_FLAG_IGNORE_LEVEL = 1;

		public const int AV_HWACCEL_FLAG_UNSAFE_OUTPUT = 8;

		public const int AV_INPUT_BUFFER_MIN_SIZE = 16384;

		public const int AV_INPUT_BUFFER_PADDING_SIZE = 64;

		public const int AV_LEVEL_UNKNOWN = -99;

		public const int AV_LOG_DEBUG = 48;

		public const int AV_LOG_ERROR = 16;

		public const int AV_LOG_FATAL = 8;

		public const int AV_LOG_INFO = 32;

		public const int AV_LOG_MAX_OFFSET = 64;

		public const int AV_LOG_PANIC = 0;

		public const int AV_LOG_PRINT_LEVEL = 2;

		public const int AV_LOG_QUIET = -8;

		public const int AV_LOG_SKIP_REPEATED = 1;

		public const int AV_LOG_TRACE = 56;

		public const int AV_LOG_VERBOSE = 40;

		public const int AV_LOG_WARNING = 24;

		public static readonly long AV_NOPTS_VALUE;

		public const int AV_NUM_DATA_POINTERS = 8;

		public const int AV_OPT_ALLOW_NULL = 4;

		public const int AV_OPT_ARRAY_REPLACE = 8;

		public const int AV_OPT_FLAG_AUDIO_PARAM = 8;

		public const int AV_OPT_FLAG_BSF_PARAM = 256;

		public const int AV_OPT_FLAG_CHILD_CONSTS = 262144;

		public const int AV_OPT_FLAG_DECODING_PARAM = 2;

		public const int AV_OPT_FLAG_DEPRECATED = 131072;

		public const int AV_OPT_FLAG_ENCODING_PARAM = 1;

		public const int AV_OPT_FLAG_EXPORT = 64;

		public const int AV_OPT_FLAG_FILTERING_PARAM = 65536;

		public const int AV_OPT_FLAG_READONLY = 128;

		public const int AV_OPT_FLAG_RUNTIME_PARAM = 32768;

		public const int AV_OPT_FLAG_SUBTITLE_PARAM = 32;

		public const int AV_OPT_FLAG_VIDEO_PARAM = 16;

		public const int AV_OPT_MULTI_COMPONENT_RANGE = 4096;

		public const int AV_OPT_SEARCH_CHILDREN = 1;

		public const int AV_OPT_SEARCH_FAKE_OBJ = 2;

		public const int AV_OPT_SERIALIZE_OPT_FLAGS_EXACT = 2;

		public const int AV_OPT_SERIALIZE_SEARCH_CHILDREN = 4;

		public const int AV_OPT_SERIALIZE_SKIP_DEFAULTS = 1;

		public const int AV_PARSER_PTS_NB = 4;

		public const int AV_PIX_FMT_FLAG_ALPHA = 128;

		public const int AV_PIX_FMT_FLAG_BAYER = 256;

		public const int AV_PIX_FMT_FLAG_BE = 1;

		public const int AV_PIX_FMT_FLAG_BITSTREAM = 4;

		public const int AV_PIX_FMT_FLAG_FLOAT = 512;

		public const int AV_PIX_FMT_FLAG_HWACCEL = 8;

		public const int AV_PIX_FMT_FLAG_PAL = 2;

		public const int AV_PIX_FMT_FLAG_PLANAR = 16;

		public const int AV_PIX_FMT_FLAG_RGB = 32;

		public const int AV_PIX_FMT_FLAG_XYZ = 1024;

		public static readonly int AV_PKT_DATA_QUALITY_FACTOR;

		public const int AV_PKT_FLAG_CORRUPT = 2;

		public const int AV_PKT_FLAG_DISCARD = 4;

		public const int AV_PKT_FLAG_DISPOSABLE = 16;

		public const int AV_PKT_FLAG_KEY = 1;

		public const int AV_PKT_FLAG_TRUSTED = 8;

		public const int AV_PROFILE_AAC_ELD = 38;

		public const int AV_PROFILE_AAC_HE = 4;

		public const int AV_PROFILE_AAC_HE_V2 = 28;

		public const int AV_PROFILE_AAC_LD = 22;

		public const int AV_PROFILE_AAC_LOW = 1;

		public const int AV_PROFILE_AAC_LTP = 3;

		public const int AV_PROFILE_AAC_MAIN = 0;

		public const int AV_PROFILE_AAC_SSR = 2;

		public const int AV_PROFILE_AAC_USAC = 41;

		public const int AV_PROFILE_ARIB_PROFILE_A = 0;

		public const int AV_PROFILE_ARIB_PROFILE_C = 1;

		public const int AV_PROFILE_AV1_HIGH = 1;

		public const int AV_PROFILE_AV1_MAIN = 0;

		public const int AV_PROFILE_AV1_PROFESSIONAL = 2;

		public const int AV_PROFILE_DNXHD = 0;

		public const int AV_PROFILE_DNXHR_444 = 5;

		public const int AV_PROFILE_DNXHR_HQ = 3;

		public const int AV_PROFILE_DNXHR_HQX = 4;

		public const int AV_PROFILE_DNXHR_LB = 1;

		public const int AV_PROFILE_DNXHR_SQ = 2;

		public const int AV_PROFILE_DTS = 20;

		public const int AV_PROFILE_DTS_96_24 = 40;

		public const int AV_PROFILE_DTS_ES = 30;

		public const int AV_PROFILE_DTS_EXPRESS = 70;

		public const int AV_PROFILE_DTS_HD_HRA = 50;

		public const int AV_PROFILE_DTS_HD_MA = 60;

		public const int AV_PROFILE_DTS_HD_MA_X = 61;

		public const int AV_PROFILE_DTS_HD_MA_X_IMAX = 62;

		public const int AV_PROFILE_EAC3_DDP_ATMOS = 30;

		public const int AV_PROFILE_EVC_BASELINE = 0;

		public const int AV_PROFILE_EVC_MAIN = 1;

		public const int AV_PROFILE_H264_BASELINE = 66;

		public const int AV_PROFILE_H264_CAVLC_444 = 44;

		public const int AV_PROFILE_H264_CONSTRAINED = 512;

		public const int AV_PROFILE_H264_CONSTRAINED_BASELINE = 578;

		public const int AV_PROFILE_H264_EXTENDED = 88;

		public const int AV_PROFILE_H264_HIGH = 100;

		public const int AV_PROFILE_H264_HIGH_10 = 110;

		public const int AV_PROFILE_H264_HIGH_10_INTRA = 2158;

		public const int AV_PROFILE_H264_HIGH_422 = 122;

		public const int AV_PROFILE_H264_HIGH_422_INTRA = 2170;

		public const int AV_PROFILE_H264_HIGH_444 = 144;

		public const int AV_PROFILE_H264_HIGH_444_INTRA = 2292;

		public const int AV_PROFILE_H264_HIGH_444_PREDICTIVE = 244;

		public const int AV_PROFILE_H264_INTRA = 2048;

		public const int AV_PROFILE_H264_MAIN = 77;

		public const int AV_PROFILE_H264_MULTIVIEW_HIGH = 118;

		public const int AV_PROFILE_H264_STEREO_HIGH = 128;

		public const int AV_PROFILE_HEVC_MAIN = 1;

		public const int AV_PROFILE_HEVC_MAIN_10 = 2;

		public const int AV_PROFILE_HEVC_MAIN_STILL_PICTURE = 3;

		public const int AV_PROFILE_HEVC_MULTIVIEW_MAIN = 6;

		public const int AV_PROFILE_HEVC_REXT = 4;

		public const int AV_PROFILE_HEVC_SCC = 9;

		public const int AV_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION = 32768;

		public const int AV_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 = 1;

		public const int AV_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 = 2;

		public const int AV_PROFILE_JPEG2000_DCINEMA_2K = 3;

		public const int AV_PROFILE_JPEG2000_DCINEMA_4K = 4;

		public const int AV_PROFILE_KLVA_ASYNC = 1;

		public const int AV_PROFILE_KLVA_SYNC = 0;

		public const int AV_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT = 192;

		public const int AV_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT = 193;

		public const int AV_PROFILE_MJPEG_HUFFMAN_LOSSLESS = 195;

		public const int AV_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT = 194;

		public const int AV_PROFILE_MJPEG_JPEG_LS = 247;

		public const int AV_PROFILE_MPEG2_422 = 0;

		public const int AV_PROFILE_MPEG2_AAC_HE = 131;

		public const int AV_PROFILE_MPEG2_AAC_LOW = 128;

		public const int AV_PROFILE_MPEG2_HIGH = 1;

		public const int AV_PROFILE_MPEG2_MAIN = 4;

		public const int AV_PROFILE_MPEG2_SIMPLE = 5;

		public const int AV_PROFILE_MPEG2_SNR_SCALABLE = 3;

		public const int AV_PROFILE_MPEG2_SS = 2;

		public const int AV_PROFILE_MPEG4_ADVANCED_CODING = 11;

		public const int AV_PROFILE_MPEG4_ADVANCED_CORE = 12;

		public const int AV_PROFILE_MPEG4_ADVANCED_REAL_TIME = 9;

		public const int AV_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE = 13;

		public const int AV_PROFILE_MPEG4_ADVANCED_SIMPLE = 15;

		public const int AV_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE = 7;

		public const int AV_PROFILE_MPEG4_CORE = 2;

		public const int AV_PROFILE_MPEG4_CORE_SCALABLE = 10;

		public const int AV_PROFILE_MPEG4_HYBRID = 8;

		public const int AV_PROFILE_MPEG4_MAIN = 3;

		public const int AV_PROFILE_MPEG4_N_BIT = 4;

		public const int AV_PROFILE_MPEG4_SCALABLE_TEXTURE = 5;

		public const int AV_PROFILE_MPEG4_SIMPLE = 0;

		public const int AV_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION = 6;

		public const int AV_PROFILE_MPEG4_SIMPLE_SCALABLE = 1;

		public const int AV_PROFILE_MPEG4_SIMPLE_STUDIO = 14;

		public const int AV_PROFILE_PRORES_4444 = 4;

		public const int AV_PROFILE_PRORES_HQ = 3;

		public const int AV_PROFILE_PRORES_LT = 1;

		public const int AV_PROFILE_PRORES_PROXY = 0;

		public const int AV_PROFILE_PRORES_STANDARD = 2;

		public const int AV_PROFILE_PRORES_XQ = 5;

		public const int AV_PROFILE_RESERVED = -100;

		public const int AV_PROFILE_SBC_MSBC = 1;

		public const int AV_PROFILE_TRUEHD_ATMOS = 30;

		public const int AV_PROFILE_UNKNOWN = -99;

		public const int AV_PROFILE_VC1_ADVANCED = 3;

		public const int AV_PROFILE_VC1_COMPLEX = 2;

		public const int AV_PROFILE_VC1_MAIN = 1;

		public const int AV_PROFILE_VC1_SIMPLE = 0;

		public const int AV_PROFILE_VP9_0 = 0;

		public const int AV_PROFILE_VP9_1 = 1;

		public const int AV_PROFILE_VP9_2 = 2;

		public const int AV_PROFILE_VP9_3 = 3;

		public const int AV_PROFILE_VVC_MAIN_10 = 1;

		public const int AV_PROFILE_VVC_MAIN_10_444 = 33;

		public const int AV_PROGRAM_RUNNING = 1;

		public const int AV_PTS_WRAP_ADD_OFFSET = 1;

		public const int AV_PTS_WRAP_IGNORE = 0;

		public const int AV_PTS_WRAP_SUB_OFFSET = -1;

		public const int AV_SUBTITLE_FLAG_FORCED = 1;

		public const int AV_TIME_BASE = 1000000;

		public const int AV_TIMECODE_STR_SIZE = 23;

		public const int AV_VIDEO_MAX_PLANES = 4;

		public static readonly int AVERROR_BSF_NOT_FOUND;

		public static readonly int AVERROR_BUFFER_TOO_SMALL;

		public static readonly int AVERROR_BUG;

		public static readonly int AVERROR_BUG2;

		public static readonly int AVERROR_DECODER_NOT_FOUND;

		public static readonly int AVERROR_DEMUXER_NOT_FOUND;

		public static readonly int AVERROR_ENCODER_NOT_FOUND;

		public static readonly int AVERROR_EOF;

		public static readonly int AVERROR_EXIT;

		public const int AVERROR_EXPERIMENTAL = -733130664;

		public static readonly int AVERROR_EXTERNAL;

		public static readonly int AVERROR_FILTER_NOT_FOUND;

		public static readonly int AVERROR_HTTP_BAD_REQUEST;

		public static readonly int AVERROR_HTTP_FORBIDDEN;

		public static readonly int AVERROR_HTTP_NOT_FOUND;

		public static readonly int AVERROR_HTTP_OTHER_4XX;

		public static readonly int AVERROR_HTTP_SERVER_ERROR;

		public static readonly int AVERROR_HTTP_TOO_MANY_REQUESTS;

		public static readonly int AVERROR_HTTP_UNAUTHORIZED;

		public const int AVERROR_INPUT_CHANGED = -1668179713;

		public static readonly int AVERROR_INVALIDDATA;

		public static readonly int AVERROR_MUXER_NOT_FOUND;

		public static readonly int AVERROR_OPTION_NOT_FOUND;

		public const int AVERROR_OUTPUT_CHANGED = -1668179714;

		public static readonly int AVERROR_PATCHWELCOME;

		public static readonly int AVERROR_PROTOCOL_NOT_FOUND;

		public static readonly int AVERROR_STREAM_NOT_FOUND;

		public static readonly int AVERROR_UNKNOWN;

		public const int AVFILTER_CMD_FLAG_FAST = 2;

		public const int AVFILTER_CMD_FLAG_ONE = 1;

		public const int AVFILTER_FLAG_DYNAMIC_INPUTS = 1;

		public const int AVFILTER_FLAG_DYNAMIC_OUTPUTS = 2;

		public const int AVFILTER_FLAG_HWDEVICE = 16;

		public const int AVFILTER_FLAG_METADATA_ONLY = 8;

		public const int AVFILTER_FLAG_SLICE_THREADS = 4;

		public const int AVFILTER_FLAG_SUPPORT_TIMELINE = 196608;

		public const int AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC = 65536;

		public const int AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL = 131072;

		public const int AVFILTER_THREAD_SLICE = 1;

		public const int AVFMT_ALLOW_FLUSH = 65536;

		public const int AVFMT_AVOID_NEG_TS_AUTO = -1;

		public const int AVFMT_AVOID_NEG_TS_DISABLED = 0;

		public const int AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE = 1;

		public const int AVFMT_AVOID_NEG_TS_MAKE_ZERO = 2;

		public const int AVFMT_EVENT_FLAG_METADATA_UPDATED = 1;

		public const int AVFMT_EXPERIMENTAL = 4;

		public const int AVFMT_FLAG_AUTO_BSF = 2097152;

		public const int AVFMT_FLAG_BITEXACT = 1024;

		public const int AVFMT_FLAG_CUSTOM_IO = 128;

		public const int AVFMT_FLAG_DISCARD_CORRUPT = 256;

		public const int AVFMT_FLAG_FAST_SEEK = 524288;

		public const int AVFMT_FLAG_FLUSH_PACKETS = 512;

		public const int AVFMT_FLAG_GENPTS = 1;

		public const int AVFMT_FLAG_IGNDTS = 8;

		public const int AVFMT_FLAG_IGNIDX = 2;

		public const int AVFMT_FLAG_NOBUFFER = 64;

		public const int AVFMT_FLAG_NOFILLIN = 16;

		public const int AVFMT_FLAG_NONBLOCK = 4;

		public const int AVFMT_FLAG_NOPARSE = 32;

		public const int AVFMT_FLAG_SHORTEST = 1048576;

		public const int AVFMT_FLAG_SORT_DTS = 65536;

		public const int AVFMT_GENERIC_INDEX = 256;

		public const int AVFMT_GLOBALHEADER = 64;

		public const int AVFMT_NEEDNUMBER = 2;

		public const int AVFMT_NO_BYTE_SEEK = 32768;

		public const int AVFMT_NOBINSEARCH = 8192;

		public const int AVFMT_NODIMENSIONS = 2048;

		public const int AVFMT_NOFILE = 1;

		public const int AVFMT_NOGENSEARCH = 16384;

		public const int AVFMT_NOSTREAMS = 4096;

		public const int AVFMT_NOTIMESTAMPS = 128;

		public const int AVFMT_SEEK_TO_PTS = 67108864;

		public const int AVFMT_SHOW_IDS = 8;

		public const int AVFMT_TS_DISCONT = 512;

		public const int AVFMT_TS_NEGATIVE = 262144;

		public const int AVFMT_TS_NONSTRICT = 131072;

		public const int AVFMT_VARIABLE_FPS = 1024;

		public const int AVFMTCTX_NOHEADER = 1;

		public const int AVFMTCTX_UNSEEKABLE = 2;

		public const int AVINDEX_DISCARD_FRAME = 2;

		public const int AVINDEX_KEYFRAME = 1;

		public const int AVIO_FLAG_DIRECT = 32768;

		public const int AVIO_FLAG_NONBLOCK = 8;

		public const int AVIO_FLAG_READ = 1;

		public const int AVIO_FLAG_READ_WRITE = 3;

		public const int AVIO_FLAG_WRITE = 2;

		public const int AVIO_SEEKABLE_NORMAL = 1;

		public const int AVIO_SEEKABLE_TIME = 2;

		public const int AVPALETTE_COUNT = 256;

		public const int AVPALETTE_SIZE = 1024;

		public const int AVPROBE_PADDING_SIZE = 32;

		public const int AVPROBE_SCORE_EXTENSION = 50;

		public const int AVPROBE_SCORE_MAX = 100;

		public const int AVPROBE_SCORE_MIME = 75;

		public const int AVPROBE_SCORE_RETRY = 25;

		public const int AVPROBE_SCORE_STREAM_RETRY = 24;

		public const int AVSEEK_FLAG_ANY = 4;

		public const int AVSEEK_FLAG_BACKWARD = 1;

		public const int AVSEEK_FLAG_BYTE = 2;

		public const int AVSEEK_FLAG_FRAME = 8;

		public const int AVSEEK_FORCE = 131072;

		public const int AVSEEK_SIZE = 65536;

		public const int AVSTREAM_EVENT_FLAG_METADATA_UPDATED = 1;

		public const int AVSTREAM_EVENT_FLAG_NEW_PACKETS = 2;

		public const int AVSTREAM_INIT_IN_INIT_OUTPUT = 1;

		public const int AVSTREAM_INIT_IN_WRITE_HEADER = 0;

		public const bool FF_API_ALLOW_FLUSH = true;

		public const bool FF_API_AVCODEC_CLOSE = true;

		public const bool FF_API_AVFFT = true;

		public const bool FF_API_AVSTREAM_SIDE_DATA = true;

		public const bool FF_API_BKTR_DEVICE = true;

		public const bool FF_API_BUFFER_MIN_SIZE = true;

		public const bool FF_API_COMPUTE_PKT_FIELDS2 = true;

		public const bool FF_API_DROPCHANGED = true;

		public const bool FF_API_FF_PROFILE_LEVEL = true;

		public const bool FF_API_FRAME_KEY = true;

		public const bool FF_API_FRAME_PKT = true;

		public const bool FF_API_GET_DUR_ESTIMATE_METHOD = true;

		public const bool FF_API_H274_FILM_GRAIN_VCS = true;

		public const bool FF_API_HDR_VIVID_THREE_SPLINE = true;

		public const bool FF_API_INIT_PACKET = true;

		public const bool FF_API_INTERLACED_FRAME = true;

		public const bool FF_API_INTERNAL_TIMING = true;

		public const bool FF_API_LAVF_SHORTEST = true;

		public const bool FF_API_LINK_PUBLIC = true;

		public const bool FF_API_MOD_UINTP2 = true;

		public const bool FF_API_OPENGL_DEVICE = true;

		public const bool FF_API_PALETTE_HAS_CHANGED = true;

		public const bool FF_API_QUALITY_FACTOR = true;

		public const int FF_API_R_FRAME_RATE = 1;

		public const bool FF_API_RISCV_FD_ZBA = true;

		public const bool FF_API_SDL2_DEVICE = true;

		public const bool FF_API_SUBFRAMES = true;

		public const bool FF_API_TICKS_PER_FRAME = true;

		public const bool FF_API_VDPAU_ALLOC_GET_SET = true;

		public const bool FF_API_VULKAN_CONTIGUOUS_MEMORY = true;

		public const bool FF_API_VULKAN_FIXED_QUEUES = true;

		public const int FF_BUG_AMV = 32;

		public const int FF_BUG_AUTODETECT = 1;

		public const int FF_BUG_DC_CLIP = 4096;

		public const int FF_BUG_DIRECT_BLOCKSIZE = 512;

		public const int FF_BUG_EDGE = 1024;

		public const int FF_BUG_HPEL_CHROMA = 2048;

		public const int FF_BUG_IEDGE = 32768;

		public const int FF_BUG_MS = 8192;

		public const int FF_BUG_NO_PADDING = 16;

		public const int FF_BUG_QPEL_CHROMA = 64;

		public const int FF_BUG_QPEL_CHROMA2 = 256;

		public const int FF_BUG_STD_QPEL = 128;

		public const int FF_BUG_TRUNCATED = 16384;

		public const int FF_BUG_UMP4 = 8;

		public const int FF_BUG_XVID_ILACE = 4;

		public const int FF_CMP_BIT = 5;

		public const int FF_CMP_CHROMA = 256;

		public const int FF_CMP_DCT = 3;

		public const int FF_CMP_DCT264 = 14;

		public const int FF_CMP_DCTMAX = 13;

		public const int FF_CMP_MEDIAN_SAD = 15;

		public const int FF_CMP_NSSE = 10;

		public const int FF_CMP_PSNR = 4;

		public const int FF_CMP_RD = 6;

		public const int FF_CMP_SAD = 0;

		public const int FF_CMP_SATD = 2;

		public const int FF_CMP_SSE = 1;

		public const int FF_CMP_VSAD = 8;

		public const int FF_CMP_VSSE = 9;

		public const int FF_CMP_W53 = 11;

		public const int FF_CMP_W97 = 12;

		public const int FF_CMP_ZERO = 7;

		public const int FF_CODEC_PROPERTY_CLOSED_CAPTIONS = 2;

		public const int FF_CODEC_PROPERTY_FILM_GRAIN = 4;

		public const int FF_CODEC_PROPERTY_LOSSLESS = 1;

		public const int FF_COMPLIANCE_EXPERIMENTAL = -2;

		public const int FF_COMPLIANCE_NORMAL = 0;

		public const int FF_COMPLIANCE_STRICT = 1;

		public const int FF_COMPLIANCE_UNOFFICIAL = -1;

		public const int FF_COMPLIANCE_VERY_STRICT = 2;

		public const int FF_COMPRESSION_DEFAULT = -1;

		public const int FF_DCT_ALTIVEC = 5;

		public const int FF_DCT_AUTO = 0;

		public const int FF_DCT_FAAN = 6;

		public const int FF_DCT_FASTINT = 1;

		public const int FF_DCT_INT = 2;

		public const int FF_DCT_MMX = 3;

		public const int FF_DCT_NEON = 7;

		public const int FF_DEBUG_BITSTREAM = 4;

		public const int FF_DEBUG_BUFFERS = 32768;

		public const int FF_DEBUG_BUGS = 4096;

		public const int FF_DEBUG_DCT_COEFF = 64;

		public const int FF_DEBUG_ER = 1024;

		public const int FF_DEBUG_GREEN_MD = 8388608;

		public const int FF_DEBUG_MB_TYPE = 8;

		public const int FF_DEBUG_MMCO = 2048;

		public const int FF_DEBUG_NOMC = 16777216;

		public const int FF_DEBUG_PICT_INFO = 1;

		public const int FF_DEBUG_QP = 16;

		public const int FF_DEBUG_RC = 2;

		public const int FF_DEBUG_SKIP = 128;

		public const int FF_DEBUG_STARTCODE = 256;

		public const int FF_DEBUG_THREADS = 65536;

		public const int FF_DECODE_ERROR_CONCEALMENT_ACTIVE = 4;

		public const int FF_DECODE_ERROR_DECODE_SLICES = 8;

		public const int FF_DECODE_ERROR_INVALID_BITSTREAM = 1;

		public const int FF_DECODE_ERROR_MISSING_REFERENCE = 2;

		public const int FF_EC_DEBLOCK = 2;

		public const int FF_EC_FAVOR_INTER = 256;

		public const int FF_EC_GUESS_MVS = 1;

		public const int FF_FDEBUG_TS = 1;

		public const int FF_IDCT_ALTIVEC = 8;

		public const int FF_IDCT_ARM = 7;

		public const int FF_IDCT_AUTO = 0;

		public const int FF_IDCT_FAAN = 20;

		public const int FF_IDCT_INT = 1;

		public const int FF_IDCT_SIMPLE = 2;

		public const int FF_IDCT_SIMPLEARM = 10;

		public const int FF_IDCT_SIMPLEARMV5TE = 16;

		public const int FF_IDCT_SIMPLEARMV6 = 17;

		public const int FF_IDCT_SIMPLEAUTO = 128;

		public const int FF_IDCT_SIMPLEMMX = 3;

		public const int FF_IDCT_SIMPLENEON = 22;

		public const int FF_IDCT_XVID = 14;

		public const int FF_LAMBDA_MAX = 32767;

		public const int FF_LAMBDA_SCALE = 128;

		public const int FF_LAMBDA_SHIFT = 7;

		public const int FF_LEVEL_UNKNOWN = -99;

		public const int FF_LOSS_ALPHA = 8;

		public const int FF_LOSS_CHROMA = 32;

		public const int FF_LOSS_COLORQUANT = 16;

		public const int FF_LOSS_COLORSPACE = 4;

		public const int FF_LOSS_DEPTH = 2;

		public const int FF_LOSS_EXCESS_DEPTH = 128;

		public const int FF_LOSS_EXCESS_RESOLUTION = 64;

		public const int FF_LOSS_RESOLUTION = 1;

		public const int FF_MB_DECISION_BITS = 1;

		public const int FF_MB_DECISION_RD = 2;

		public const int FF_MB_DECISION_SIMPLE = 0;

		public const int FF_PROFILE_AAC_ELD = 38;

		public const int FF_PROFILE_AAC_HE = 4;

		public const int FF_PROFILE_AAC_HE_V2 = 28;

		public const int FF_PROFILE_AAC_LD = 22;

		public const int FF_PROFILE_AAC_LOW = 1;

		public const int FF_PROFILE_AAC_LTP = 3;

		public const int FF_PROFILE_AAC_MAIN = 0;

		public const int FF_PROFILE_AAC_SSR = 2;

		public const int FF_PROFILE_ARIB_PROFILE_A = 0;

		public const int FF_PROFILE_ARIB_PROFILE_C = 1;

		public const int FF_PROFILE_AV1_HIGH = 1;

		public const int FF_PROFILE_AV1_MAIN = 0;

		public const int FF_PROFILE_AV1_PROFESSIONAL = 2;

		public const int FF_PROFILE_DNXHD = 0;

		public const int FF_PROFILE_DNXHR_444 = 5;

		public const int FF_PROFILE_DNXHR_HQ = 3;

		public const int FF_PROFILE_DNXHR_HQX = 4;

		public const int FF_PROFILE_DNXHR_LB = 1;

		public const int FF_PROFILE_DNXHR_SQ = 2;

		public const int FF_PROFILE_DTS = 20;

		public const int FF_PROFILE_DTS_96_24 = 40;

		public const int FF_PROFILE_DTS_ES = 30;

		public const int FF_PROFILE_DTS_EXPRESS = 70;

		public const int FF_PROFILE_DTS_HD_HRA = 50;

		public const int FF_PROFILE_DTS_HD_MA = 60;

		public const int FF_PROFILE_DTS_HD_MA_X = 61;

		public const int FF_PROFILE_DTS_HD_MA_X_IMAX = 62;

		public const int FF_PROFILE_EAC3_DDP_ATMOS = 30;

		public const int FF_PROFILE_EVC_BASELINE = 0;

		public const int FF_PROFILE_EVC_MAIN = 1;

		public const int FF_PROFILE_H264_BASELINE = 66;

		public const int FF_PROFILE_H264_CAVLC_444 = 44;

		public const int FF_PROFILE_H264_CONSTRAINED = 512;

		public const int FF_PROFILE_H264_CONSTRAINED_BASELINE = 578;

		public const int FF_PROFILE_H264_EXTENDED = 88;

		public const int FF_PROFILE_H264_HIGH = 100;

		public const int FF_PROFILE_H264_HIGH_10 = 110;

		public const int FF_PROFILE_H264_HIGH_10_INTRA = 2158;

		public const int FF_PROFILE_H264_HIGH_422 = 122;

		public const int FF_PROFILE_H264_HIGH_422_INTRA = 2170;

		public const int FF_PROFILE_H264_HIGH_444 = 144;

		public const int FF_PROFILE_H264_HIGH_444_INTRA = 2292;

		public const int FF_PROFILE_H264_HIGH_444_PREDICTIVE = 244;

		public const int FF_PROFILE_H264_INTRA = 2048;

		public const int FF_PROFILE_H264_MAIN = 77;

		public const int FF_PROFILE_H264_MULTIVIEW_HIGH = 118;

		public const int FF_PROFILE_H264_STEREO_HIGH = 128;

		public const int FF_PROFILE_HEVC_MAIN = 1;

		public const int FF_PROFILE_HEVC_MAIN_10 = 2;

		public const int FF_PROFILE_HEVC_MAIN_STILL_PICTURE = 3;

		public const int FF_PROFILE_HEVC_REXT = 4;

		public const int FF_PROFILE_HEVC_SCC = 9;

		public const int FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION = 32768;

		public const int FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 = 1;

		public const int FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 = 2;

		public const int FF_PROFILE_JPEG2000_DCINEMA_2K = 3;

		public const int FF_PROFILE_JPEG2000_DCINEMA_4K = 4;

		public const int FF_PROFILE_KLVA_ASYNC = 1;

		public const int FF_PROFILE_KLVA_SYNC = 0;

		public const int FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT = 192;

		public const int FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT = 193;

		public const int FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS = 195;

		public const int FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT = 194;

		public const int FF_PROFILE_MJPEG_JPEG_LS = 247;

		public const int FF_PROFILE_MPEG2_422 = 0;

		public const int FF_PROFILE_MPEG2_AAC_HE = 131;

		public const int FF_PROFILE_MPEG2_AAC_LOW = 128;

		public const int FF_PROFILE_MPEG2_HIGH = 1;

		public const int FF_PROFILE_MPEG2_MAIN = 4;

		public const int FF_PROFILE_MPEG2_SIMPLE = 5;

		public const int FF_PROFILE_MPEG2_SNR_SCALABLE = 3;

		public const int FF_PROFILE_MPEG2_SS = 2;

		public const int FF_PROFILE_MPEG4_ADVANCED_CODING = 11;

		public const int FF_PROFILE_MPEG4_ADVANCED_CORE = 12;

		public const int FF_PROFILE_MPEG4_ADVANCED_REAL_TIME = 9;

		public const int FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE = 13;

		public const int FF_PROFILE_MPEG4_ADVANCED_SIMPLE = 15;

		public const int FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE = 7;

		public const int FF_PROFILE_MPEG4_CORE = 2;

		public const int FF_PROFILE_MPEG4_CORE_SCALABLE = 10;

		public const int FF_PROFILE_MPEG4_HYBRID = 8;

		public const int FF_PROFILE_MPEG4_MAIN = 3;

		public const int FF_PROFILE_MPEG4_N_BIT = 4;

		public const int FF_PROFILE_MPEG4_SCALABLE_TEXTURE = 5;

		public const int FF_PROFILE_MPEG4_SIMPLE = 0;

		public const int FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION = 6;

		public const int FF_PROFILE_MPEG4_SIMPLE_SCALABLE = 1;

		public const int FF_PROFILE_MPEG4_SIMPLE_STUDIO = 14;

		public const int FF_PROFILE_PRORES_4444 = 4;

		public const int FF_PROFILE_PRORES_HQ = 3;

		public const int FF_PROFILE_PRORES_LT = 1;

		public const int FF_PROFILE_PRORES_PROXY = 0;

		public const int FF_PROFILE_PRORES_STANDARD = 2;

		public const int FF_PROFILE_PRORES_XQ = 5;

		public const int FF_PROFILE_RESERVED = -100;

		public const int FF_PROFILE_SBC_MSBC = 1;

		public const int FF_PROFILE_TRUEHD_ATMOS = 30;

		public const int FF_PROFILE_UNKNOWN = -99;

		public const int FF_PROFILE_VC1_ADVANCED = 3;

		public const int FF_PROFILE_VC1_COMPLEX = 2;

		public const int FF_PROFILE_VC1_MAIN = 1;

		public const int FF_PROFILE_VC1_SIMPLE = 0;

		public const int FF_PROFILE_VP9_0 = 0;

		public const int FF_PROFILE_VP9_1 = 1;

		public const int FF_PROFILE_VP9_2 = 2;

		public const int FF_PROFILE_VP9_3 = 3;

		public const int FF_PROFILE_VVC_MAIN_10 = 1;

		public const int FF_PROFILE_VVC_MAIN_10_444 = 33;

		public const int FF_QP2LAMBDA = 118;

		public const int FF_QUALITY_SCALE = 128;

		public const int FF_SUB_CHARENC_MODE_AUTOMATIC = 0;

		public const int FF_SUB_CHARENC_MODE_DO_NOTHING = -1;

		public const int FF_SUB_CHARENC_MODE_IGNORE = 2;

		public const int FF_SUB_CHARENC_MODE_PRE_DECODER = 1;

		public const int FF_THREAD_FRAME = 1;

		public const int FF_THREAD_SLICE = 2;

		public static readonly int LIBAVCODEC_BUILD;

		public const string LIBAVCODEC_IDENT = "Lavc";

		public static readonly string LIBAVCODEC_VERSION;

		public static readonly int LIBAVCODEC_VERSION_INT;

		public const int LIBAVCODEC_VERSION_MAJOR = 61;

		public const int LIBAVCODEC_VERSION_MICRO = 101;

		public const int LIBAVCODEC_VERSION_MINOR = 19;

		public static readonly int LIBAVDEVICE_BUILD;

		public const string LIBAVDEVICE_IDENT = "Lavd";

		public static readonly string LIBAVDEVICE_VERSION;

		public static readonly int LIBAVDEVICE_VERSION_INT;

		public const int LIBAVDEVICE_VERSION_MAJOR = 61;

		public const int LIBAVDEVICE_VERSION_MICRO = 100;

		public const int LIBAVDEVICE_VERSION_MINOR = 3;

		public static readonly int LIBAVFILTER_BUILD;

		public const string LIBAVFILTER_IDENT = "Lavfi";

		public static readonly string LIBAVFILTER_VERSION;

		public static readonly int LIBAVFILTER_VERSION_INT;

		public const int LIBAVFILTER_VERSION_MAJOR = 10;

		public const int LIBAVFILTER_VERSION_MICRO = 100;

		public const int LIBAVFILTER_VERSION_MINOR = 4;

		public static readonly int LIBAVFORMAT_BUILD;

		public const string LIBAVFORMAT_IDENT = "Lavf";

		public static readonly string LIBAVFORMAT_VERSION;

		public static readonly int LIBAVFORMAT_VERSION_INT;

		public const int LIBAVFORMAT_VERSION_MAJOR = 61;

		public const int LIBAVFORMAT_VERSION_MICRO = 100;

		public const int LIBAVFORMAT_VERSION_MINOR = 7;

		public static readonly int LIBAVUTIL_BUILD;

		public const string LIBAVUTIL_IDENT = "Lavu";

		public static readonly string LIBAVUTIL_VERSION;

		public static readonly int LIBAVUTIL_VERSION_INT;

		public const int LIBAVUTIL_VERSION_MAJOR = 59;

		public const int LIBAVUTIL_VERSION_MICRO = 100;

		public const int LIBAVUTIL_VERSION_MINOR = 39;

		public static readonly int LIBPOSTPROC_BUILD;

		public const string LIBPOSTPROC_IDENT = "postproc";

		public static readonly string LIBPOSTPROC_VERSION;

		public static readonly int LIBPOSTPROC_VERSION_INT;

		public const int LIBPOSTPROC_VERSION_MAJOR = 58;

		public const int LIBPOSTPROC_VERSION_MICRO = 100;

		public const int LIBPOSTPROC_VERSION_MINOR = 3;

		public static readonly int LIBSWRESAMPLE_BUILD;

		public const string LIBSWRESAMPLE_IDENT = "SwR";

		public static readonly string LIBSWRESAMPLE_VERSION;

		public static readonly int LIBSWRESAMPLE_VERSION_INT;

		public const int LIBSWRESAMPLE_VERSION_MAJOR = 5;

		public const int LIBSWRESAMPLE_VERSION_MICRO = 100;

		public const int LIBSWRESAMPLE_VERSION_MINOR = 3;

		public static readonly int LIBSWSCALE_BUILD;

		public const string LIBSWSCALE_IDENT = "SwS";

		public static readonly string LIBSWSCALE_VERSION;

		public static readonly int LIBSWSCALE_VERSION_INT;

		public const int LIBSWSCALE_VERSION_MAJOR = 8;

		public const int LIBSWSCALE_VERSION_MICRO = 100;

		public const int LIBSWSCALE_VERSION_MINOR = 3;

		public const double M_1_PI = 1.0 / Math.PI;

		public const float M_1_PIf = 1f / MathF.PI;

		public const double M_2_PI = 2.0 / Math.PI;

		public const float M_2_PIf = 2f / MathF.PI;

		public const double M_2_SQRTPI = 1.1283791670955126;

		public const float M_2_SQRTPIf = 1.1283792f;

		public const double M_E = Math.E;

		public const float M_Ef = MathF.E;

		public const double M_LN10 = 2.302585092994046;

		public const float M_LN10f = 2.3025851f;

		public const double M_LN2 = 0.6931471805599453;

		public const float M_LN2f = 0.6931472f;

		public const double M_LOG2_10 = 3.321928094887362;

		public const float M_LOG2_10f = 3.321928f;

		public const double M_PHI = 1.618033988749895;

		public const float M_PHIf = 1.618034f;

		public const double M_PI = Math.PI;

		public const double M_PI_2 = Math.PI / 2.0;

		public const float M_PI_2f = MathF.PI / 2f;

		public const double M_PI_4 = Math.PI / 4.0;

		public const float M_PI_4f = MathF.PI / 4f;

		public const float M_PIf = MathF.PI;

		public const double M_SQRT1_2 = 0.7071067811865476;

		public const float M_SQRT1_2f = 0.70710677f;

		public const double M_SQRT2 = 1.4142135623730951;

		public const float M_SQRT2f = 1.4142135f;

		public const int PARSER_FLAG_COMPLETE_FRAMES = 1;

		public const int PARSER_FLAG_FETCHED_OFFSET = 4;

		public const int PARSER_FLAG_ONCE = 2;

		public const int PARSER_FLAG_USE_CODEC_TS = 4096;

		public const int PP_CPU_CAPS_3DNOW = 1073741824;

		public const int PP_CPU_CAPS_ALTIVEC = 268435456;

		public const int PP_CPU_CAPS_AUTO = 524288;

		public const uint PP_CPU_CAPS_MMX = 2147483648u;

		public const int PP_CPU_CAPS_MMX2 = 536870912;

		public const int PP_FORMAT = 8;

		public const int PP_FORMAT_411 = 10;

		public const int PP_FORMAT_420 = 25;

		public const int PP_FORMAT_422 = 9;

		public const int PP_FORMAT_440 = 24;

		public const int PP_FORMAT_444 = 8;

		public const int PP_PICT_TYPE_QP2 = 16;

		public const int PP_QUALITY_MAX = 6;

		public const int SLICE_FLAG_ALLOW_FIELD = 2;

		public const int SLICE_FLAG_ALLOW_PLANE = 4;

		public const int SLICE_FLAG_CODED_ORDER = 1;

		public const int SWR_FLAG_RESAMPLE = 1;

		public const int SWS_ACCURATE_RND = 262144;

		public const int SWS_AREA = 32;

		public const int SWS_BICUBIC = 4;

		public const int SWS_BICUBLIN = 64;

		public const int SWS_BILINEAR = 2;

		public const int SWS_BITEXACT = 524288;

		public const int SWS_CS_BT2020 = 9;

		public const int SWS_CS_DEFAULT = 5;

		public const int SWS_CS_FCC = 4;

		public const int SWS_CS_ITU601 = 5;

		public const int SWS_CS_ITU624 = 5;

		public const int SWS_CS_ITU709 = 1;

		public const int SWS_CS_SMPTE170M = 5;

		public const int SWS_CS_SMPTE240M = 7;

		public const int SWS_DIRECT_BGR = 32768;

		public const int SWS_ERROR_DIFFUSION = 8388608;

		public const int SWS_FAST_BILINEAR = 1;

		public const int SWS_FULL_CHR_H_INP = 16384;

		public const int SWS_FULL_CHR_H_INT = 8192;

		public const int SWS_GAUSS = 128;

		public const int SWS_LANCZOS = 512;

		public const double SWS_MAX_REDUCE_CUTOFF = 0.002;

		public const int SWS_PARAM_DEFAULT = 123456;

		public const int SWS_POINT = 16;

		public const int SWS_PRINT_INFO = 4096;

		public const int SWS_SINC = 256;

		public const int SWS_SPLINE = 1024;

		public const int SWS_SRC_V_CHR_DROP_MASK = 196608;

		public const int SWS_SRC_V_CHR_DROP_SHIFT = 16;

		public const int SWS_X = 8;

		public static string RootPath { get; set; }

		static ffmpeg()
		{
			ENOMEM = 12;
			EINVAL = 22;
			EPIPE = 32;
			RootPath = AppDomain.CurrentDomain.BaseDirectory;
			LibraryVersionMap = new Dictionary<string, int>
			{
				{ "avcodec", 61 },
				{ "avdevice", 61 },
				{ "avfilter", 10 },
				{ "avformat", 61 },
				{ "avutil", 59 },
				{ "postproc", 58 },
				{ "swresample", 5 },
				{ "swscale", 8 }
			};
			AV_CH_BACK_CENTER = 256uL;
			AV_CH_BACK_LEFT = 16uL;
			AV_CH_BACK_RIGHT = 32uL;
			AV_CH_BOTTOM_FRONT_CENTER = 274877906944uL;
			AV_CH_BOTTOM_FRONT_LEFT = 549755813888uL;
			AV_CH_BOTTOM_FRONT_RIGHT = 1099511627776uL;
			AV_CH_FRONT_CENTER = 4uL;
			AV_CH_FRONT_LEFT = 1uL;
			AV_CH_FRONT_LEFT_OF_CENTER = 64uL;
			AV_CH_FRONT_RIGHT = 2uL;
			AV_CH_FRONT_RIGHT_OF_CENTER = 128uL;
			AV_CH_LAYOUT_2_1 = AV_CH_LAYOUT_STEREO | AV_CH_BACK_CENTER;
			AV_CH_LAYOUT_2_2 = AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT;
			AV_CH_LAYOUT_22POINT2 = AV_CH_LAYOUT_7POINT1POINT4_BACK | AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER | AV_CH_BACK_CENTER | AV_CH_LOW_FREQUENCY_2 | AV_CH_TOP_FRONT_CENTER | AV_CH_TOP_CENTER | AV_CH_TOP_SIDE_LEFT | AV_CH_TOP_SIDE_RIGHT | AV_CH_TOP_BACK_CENTER | AV_CH_BOTTOM_FRONT_CENTER | AV_CH_BOTTOM_FRONT_LEFT | AV_CH_BOTTOM_FRONT_RIGHT;
			AV_CH_LAYOUT_2POINT1 = AV_CH_LAYOUT_STEREO | AV_CH_LOW_FREQUENCY;
			AV_CH_LAYOUT_3POINT1 = AV_CH_LAYOUT_SURROUND | AV_CH_LOW_FREQUENCY;
			AV_CH_LAYOUT_3POINT1POINT2 = AV_CH_LAYOUT_3POINT1 | AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT;
			AV_CH_LAYOUT_4POINT0 = AV_CH_LAYOUT_SURROUND | AV_CH_BACK_CENTER;
			AV_CH_LAYOUT_4POINT1 = AV_CH_LAYOUT_4POINT0 | AV_CH_LOW_FREQUENCY;
			AV_CH_LAYOUT_5POINT0 = AV_CH_LAYOUT_SURROUND | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT;
			AV_CH_LAYOUT_5POINT0_BACK = AV_CH_LAYOUT_SURROUND | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT;
			AV_CH_LAYOUT_5POINT1 = AV_CH_LAYOUT_5POINT0 | AV_CH_LOW_FREQUENCY;
			AV_CH_LAYOUT_5POINT1_BACK = AV_CH_LAYOUT_5POINT0_BACK | AV_CH_LOW_FREQUENCY;
			AV_CH_LAYOUT_5POINT1POINT2_BACK = AV_CH_LAYOUT_5POINT1_BACK | AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT;
			AV_CH_LAYOUT_5POINT1POINT4_BACK = AV_CH_LAYOUT_5POINT1POINT2_BACK | AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT;
			AV_CH_LAYOUT_6POINT0 = AV_CH_LAYOUT_5POINT0 | AV_CH_BACK_CENTER;
			AV_CH_LAYOUT_6POINT0_FRONT = AV_CH_LAYOUT_2_2 | AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER;
			AV_CH_LAYOUT_6POINT1 = AV_CH_LAYOUT_5POINT1 | AV_CH_BACK_CENTER;
			AV_CH_LAYOUT_6POINT1_BACK = AV_CH_LAYOUT_5POINT1_BACK | AV_CH_BACK_CENTER;
			AV_CH_LAYOUT_6POINT1_FRONT = AV_CH_LAYOUT_6POINT0_FRONT | AV_CH_LOW_FREQUENCY;
			AV_CH_LAYOUT_7POINT0 = AV_CH_LAYOUT_5POINT0 | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT;
			AV_CH_LAYOUT_7POINT0_FRONT = AV_CH_LAYOUT_5POINT0 | AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER;
			AV_CH_LAYOUT_7POINT1 = AV_CH_LAYOUT_5POINT1 | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT;
			AV_CH_LAYOUT_7POINT1_TOP_BACK = AV_CH_LAYOUT_5POINT1POINT2_BACK;
			AV_CH_LAYOUT_7POINT1_WIDE = AV_CH_LAYOUT_5POINT1 | AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER;
			AV_CH_LAYOUT_7POINT1_WIDE_BACK = AV_CH_LAYOUT_5POINT1_BACK | AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER;
			AV_CH_LAYOUT_7POINT1POINT2 = AV_CH_LAYOUT_7POINT1 | AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT;
			AV_CH_LAYOUT_7POINT1POINT4_BACK = AV_CH_LAYOUT_7POINT1POINT2 | AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT;
			AV_CH_LAYOUT_7POINT2POINT3 = AV_CH_LAYOUT_7POINT1POINT2 | AV_CH_TOP_BACK_CENTER | AV_CH_LOW_FREQUENCY_2;
			AV_CH_LAYOUT_9POINT1POINT4_BACK = AV_CH_LAYOUT_7POINT1POINT4_BACK | AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER;
			AV_CH_LAYOUT_CUBE = AV_CH_LAYOUT_QUAD | AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT | AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT;
			AV_CH_LAYOUT_HEXADECAGONAL = AV_CH_LAYOUT_OCTAGONAL | AV_CH_WIDE_LEFT | AV_CH_WIDE_RIGHT | AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT | AV_CH_TOP_BACK_CENTER | AV_CH_TOP_FRONT_CENTER | AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT;
			AV_CH_LAYOUT_HEXAGONAL = AV_CH_LAYOUT_5POINT0_BACK | AV_CH_BACK_CENTER;
			AV_CH_LAYOUT_MONO = AV_CH_FRONT_CENTER;
			AV_CH_LAYOUT_OCTAGONAL = AV_CH_LAYOUT_5POINT0 | AV_CH_BACK_LEFT | AV_CH_BACK_CENTER | AV_CH_BACK_RIGHT;
			AV_CH_LAYOUT_QUAD = AV_CH_LAYOUT_STEREO | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT;
			AV_CH_LAYOUT_STEREO = AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT;
			AV_CH_LAYOUT_STEREO_DOWNMIX = AV_CH_STEREO_LEFT | AV_CH_STEREO_RIGHT;
			AV_CH_LAYOUT_SURROUND = AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER;
			AV_CH_LOW_FREQUENCY = 8uL;
			AV_CH_LOW_FREQUENCY_2 = 34359738368uL;
			AV_CH_SIDE_LEFT = 512uL;
			AV_CH_SIDE_RIGHT = 1024uL;
			AV_CH_SIDE_SURROUND_LEFT = 2199023255552uL;
			AV_CH_SIDE_SURROUND_RIGHT = 4398046511104uL;
			AV_CH_STEREO_LEFT = 536870912uL;
			AV_CH_STEREO_RIGHT = 1073741824uL;
			AV_CH_SURROUND_DIRECT_LEFT = 8589934592uL;
			AV_CH_SURROUND_DIRECT_RIGHT = 17179869184uL;
			AV_CH_TOP_BACK_CENTER = 65536uL;
			AV_CH_TOP_BACK_LEFT = 32768uL;
			AV_CH_TOP_BACK_RIGHT = 131072uL;
			AV_CH_TOP_CENTER = 2048uL;
			AV_CH_TOP_FRONT_CENTER = 8192uL;
			AV_CH_TOP_FRONT_LEFT = 4096uL;
			AV_CH_TOP_FRONT_RIGHT = 16384uL;
			AV_CH_TOP_SIDE_LEFT = 68719476736uL;
			AV_CH_TOP_SIDE_RIGHT = 137438953472uL;
			AV_CH_TOP_SURROUND_LEFT = 8796093022208uL;
			AV_CH_TOP_SURROUND_RIGHT = 17592186044416uL;
			AV_CH_WIDE_LEFT = 2147483648uL;
			AV_CH_WIDE_RIGHT = 4294967296uL;
			AV_CODEC_ID_H265 = 173;
			AV_CODEC_ID_H266 = 196;
			AV_CODEC_ID_IFF_BYTERUN1 = 136;
			AV_NOPTS_VALUE = (long)UINT64_C(9223372036854775808uL);
			AV_PKT_DATA_QUALITY_FACTOR = 8;
			AVERROR_BSF_NOT_FOUND = FFERRTAG(248, 'B', 'S', 'F');
			AVERROR_BUFFER_TOO_SMALL = FFERRTAG('B', 'U', 'F', 'S');
			AVERROR_BUG = FFERRTAG('B', 'U', 'G', '!');
			AVERROR_BUG2 = FFERRTAG('B', 'U', 'G', ' ');
			AVERROR_DECODER_NOT_FOUND = FFERRTAG(248, 'D', 'E', 'C');
			AVERROR_DEMUXER_NOT_FOUND = FFERRTAG(248, 'D', 'E', 'M');
			AVERROR_ENCODER_NOT_FOUND = FFERRTAG(248, 'E', 'N', 'C');
			AVERROR_EOF = FFERRTAG('E', 'O', 'F', ' ');
			AVERROR_EXIT = FFERRTAG('E', 'X', 'I', 'T');
			AVERROR_EXTERNAL = FFERRTAG('E', 'X', 'T', ' ');
			AVERROR_FILTER_NOT_FOUND = FFERRTAG(248, 'F', 'I', 'L');
			AVERROR_HTTP_BAD_REQUEST = FFERRTAG(248, '4', '0', '0');
			AVERROR_HTTP_FORBIDDEN = FFERRTAG(248, '4', '0', '3');
			AVERROR_HTTP_NOT_FOUND = FFERRTAG(248, '4', '0', '4');
			AVERROR_HTTP_OTHER_4XX = FFERRTAG(248, '4', 'X', 'X');
			AVERROR_HTTP_SERVER_ERROR = FFERRTAG(248, '5', 'X', 'X');
			AVERROR_HTTP_TOO_MANY_REQUESTS = FFERRTAG(248, '4', '2', '9');
			AVERROR_HTTP_UNAUTHORIZED = FFERRTAG(248, '4', '0', '1');
			AVERROR_INVALIDDATA = FFERRTAG('I', 'N', 'D', 'A');
			AVERROR_MUXER_NOT_FOUND = FFERRTAG(248, 'M', 'U', 'X');
			AVERROR_OPTION_NOT_FOUND = FFERRTAG(248, 'O', 'P', 'T');
			AVERROR_PATCHWELCOME = FFERRTAG('P', 'A', 'W', 'E');
			AVERROR_PROTOCOL_NOT_FOUND = FFERRTAG(248, 'P', 'R', 'O');
			AVERROR_STREAM_NOT_FOUND = FFERRTAG(248, 'S', 'T', 'R');
			AVERROR_UNKNOWN = FFERRTAG('U', 'N', 'K', 'N');
			LIBAVCODEC_BUILD = LIBAVCODEC_VERSION_INT;
			LIBAVCODEC_VERSION = AV_VERSION(61, 19, 101);
			LIBAVCODEC_VERSION_INT = AV_VERSION_INT(61, 19, 101);
			LIBAVDEVICE_BUILD = LIBAVDEVICE_VERSION_INT;
			LIBAVDEVICE_VERSION = AV_VERSION(61, 3, 100);
			LIBAVDEVICE_VERSION_INT = AV_VERSION_INT(61, 3, 100);
			LIBAVFILTER_BUILD = LIBAVFILTER_VERSION_INT;
			LIBAVFILTER_VERSION = AV_VERSION(10, 4, 100);
			LIBAVFILTER_VERSION_INT = AV_VERSION_INT(10, 4, 100);
			LIBAVFORMAT_BUILD = LIBAVFORMAT_VERSION_INT;
			LIBAVFORMAT_VERSION = AV_VERSION(61, 7, 100);
			LIBAVFORMAT_VERSION_INT = AV_VERSION_INT(61, 7, 100);
			LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT;
			LIBAVUTIL_VERSION = AV_VERSION(59, 39, 100);
			LIBAVUTIL_VERSION_INT = AV_VERSION_INT(59, 39, 100);
			LIBPOSTPROC_BUILD = LIBPOSTPROC_VERSION_INT;
			LIBPOSTPROC_VERSION = AV_VERSION(58, 3, 100);
			LIBPOSTPROC_VERSION_INT = AV_VERSION_INT(58, 3, 100);
			LIBSWRESAMPLE_BUILD = LIBSWRESAMPLE_VERSION_INT;
			LIBSWRESAMPLE_VERSION = AV_VERSION(5, 3, 100);
			LIBSWRESAMPLE_VERSION_INT = AV_VERSION_INT(5, 3, 100);
			LIBSWSCALE_BUILD = LIBSWSCALE_VERSION_INT;
			LIBSWSCALE_VERSION = AV_VERSION(8, 3, 100);
			LIBSWSCALE_VERSION_INT = AV_VERSION_INT(8, 3, 100);
			int eAGAIN = ((FunctionResolverFactory.GetPlatformId() != PlatformID.MacOSX) ? 11 : 35);
			EAGAIN = eAGAIN;
			DynamicallyLoadedBindings.Initialize();
		}

		public static ulong UINT64_C<T>(T a)
		{
			return Convert.ToUInt64(a);
		}

		public static int AVERROR<T1>(T1 a)
		{
			return -Convert.ToInt32(a);
		}

		public static int MKTAG<T1, T2, T3, T4>(T1 a, T2 b, T3 c, T4 d)
		{
			return (int)(Convert.ToUInt32(a) | (Convert.ToUInt32(b) << 8) | (Convert.ToUInt32(c) << 16) | (Convert.ToUInt32(d) << 24));
		}

		public static int FFERRTAG<T1, T2, T3, T4>(T1 a, T2 b, T3 c, T4 d)
		{
			return -MKTAG(a, b, c, d);
		}

		public static int AV_VERSION_INT<T1, T2, T3>(T1 a, T2 b, T3 c)
		{
			return (Convert.ToInt32(a) << 16) | (Convert.ToInt32(b) << 8) | Convert.ToInt32(c);
		}

		public static string AV_VERSION_DOT<T1, T2, T3>(T1 a, T2 b, T3 c)
		{
			return $"{a}.{b}.{c}";
		}

		public static string AV_VERSION<T1, T2, T3>(T1 a, T2 b, T3 c)
		{
			return AV_VERSION_DOT(a, b, c);
		}

		public unsafe static int av_add_index_entry(AVStream* st, long pos, long timestamp, int size, int distance, int flags)
		{
			return vectors.av_add_index_entry(st, pos, timestamp, size, distance, flags);
		}

		public static AVRational av_add_q(AVRational b, AVRational c)
		{
			return vectors.av_add_q(b, c);
		}

		public static long av_add_stable(AVRational ts_tb, long ts, AVRational inc_tb, long inc)
		{
			return vectors.av_add_stable(ts_tb, ts, inc_tb, inc);
		}

		public unsafe static int av_append_packet(AVIOContext* s, AVPacket* pkt, int size)
		{
			return vectors.av_append_packet(s, pkt, size);
		}

		public unsafe static AVAudioFifo* av_audio_fifo_alloc(AVSampleFormat sample_fmt, int channels, int nb_samples)
		{
			return vectors.av_audio_fifo_alloc(sample_fmt, channels, nb_samples);
		}

		public unsafe static int av_audio_fifo_drain(AVAudioFifo* af, int nb_samples)
		{
			return vectors.av_audio_fifo_drain(af, nb_samples);
		}

		public unsafe static void av_audio_fifo_free(AVAudioFifo* af)
		{
			vectors.av_audio_fifo_free(af);
		}

		public unsafe static int av_audio_fifo_peek(AVAudioFifo* af, void** data, int nb_samples)
		{
			return vectors.av_audio_fifo_peek(af, data, nb_samples);
		}

		public unsafe static int av_audio_fifo_peek_at(AVAudioFifo* af, void** data, int nb_samples, int offset)
		{
			return vectors.av_audio_fifo_peek_at(af, data, nb_samples, offset);
		}

		public unsafe static int av_audio_fifo_read(AVAudioFifo* af, void** data, int nb_samples)
		{
			return vectors.av_audio_fifo_read(af, data, nb_samples);
		}

		public unsafe static int av_audio_fifo_realloc(AVAudioFifo* af, int nb_samples)
		{
			return vectors.av_audio_fifo_realloc(af, nb_samples);
		}

		public unsafe static void av_audio_fifo_reset(AVAudioFifo* af)
		{
			vectors.av_audio_fifo_reset(af);
		}

		public unsafe static int av_audio_fifo_size(AVAudioFifo* af)
		{
			return vectors.av_audio_fifo_size(af);
		}

		public unsafe static int av_audio_fifo_space(AVAudioFifo* af)
		{
			return vectors.av_audio_fifo_space(af);
		}

		public unsafe static int av_audio_fifo_write(AVAudioFifo* af, void** data, int nb_samples)
		{
			return vectors.av_audio_fifo_write(af, data, nb_samples);
		}

		public static double av_bessel_i0(double x)
		{
			return vectors.av_bessel_i0(x);
		}

		public unsafe static int av_bsf_alloc(AVBitStreamFilter* filter, AVBSFContext** ctx)
		{
			return vectors.av_bsf_alloc(filter, ctx);
		}

		public unsafe static void av_bsf_flush(AVBSFContext* ctx)
		{
			vectors.av_bsf_flush(ctx);
		}

		public unsafe static void av_bsf_free(AVBSFContext** ctx)
		{
			vectors.av_bsf_free(ctx);
		}

		public unsafe static AVBitStreamFilter* av_bsf_get_by_name(string name)
		{
			return vectors.av_bsf_get_by_name(name);
		}

		public unsafe static AVClass* av_bsf_get_class()
		{
			return vectors.av_bsf_get_class();
		}

		public unsafe static int av_bsf_get_null_filter(AVBSFContext** bsf)
		{
			return vectors.av_bsf_get_null_filter(bsf);
		}

		public unsafe static int av_bsf_init(AVBSFContext* ctx)
		{
			return vectors.av_bsf_init(ctx);
		}

		public unsafe static AVBitStreamFilter* av_bsf_iterate(void** opaque)
		{
			return vectors.av_bsf_iterate(opaque);
		}

		public unsafe static AVBSFList* av_bsf_list_alloc()
		{
			return vectors.av_bsf_list_alloc();
		}

		public unsafe static int av_bsf_list_append(AVBSFList* lst, AVBSFContext* bsf)
		{
			return vectors.av_bsf_list_append(lst, bsf);
		}

		public unsafe static int av_bsf_list_append2(AVBSFList* lst, string bsf_name, AVDictionary** options)
		{
			return vectors.av_bsf_list_append2(lst, bsf_name, options);
		}

		public unsafe static int av_bsf_list_finalize(AVBSFList** lst, AVBSFContext** bsf)
		{
			return vectors.av_bsf_list_finalize(lst, bsf);
		}

		public unsafe static void av_bsf_list_free(AVBSFList** lst)
		{
			vectors.av_bsf_list_free(lst);
		}

		public unsafe static int av_bsf_list_parse_str(string str, AVBSFContext** bsf)
		{
			return vectors.av_bsf_list_parse_str(str, bsf);
		}

		public unsafe static int av_bsf_receive_packet(AVBSFContext* ctx, AVPacket* pkt)
		{
			return vectors.av_bsf_receive_packet(ctx, pkt);
		}

		public unsafe static int av_bsf_send_packet(AVBSFContext* ctx, AVPacket* pkt)
		{
			return vectors.av_bsf_send_packet(ctx, pkt);
		}

		public unsafe static AVBufferRef* av_buffer_alloc(ulong size)
		{
			return vectors.av_buffer_alloc(size);
		}

		public unsafe static AVBufferRef* av_buffer_allocz(ulong size)
		{
			return vectors.av_buffer_allocz(size);
		}

		public unsafe static AVBufferRef* av_buffer_create(byte* data, ulong size, av_buffer_create_free_func free, void* opaque, int flags)
		{
			return vectors.av_buffer_create(data, size, free, opaque, flags);
		}

		public unsafe static void av_buffer_default_free(void* opaque, byte* data)
		{
			vectors.av_buffer_default_free(opaque, data);
		}

		public unsafe static void* av_buffer_get_opaque(AVBufferRef* buf)
		{
			return vectors.av_buffer_get_opaque(buf);
		}

		public unsafe static int av_buffer_get_ref_count(AVBufferRef* buf)
		{
			return vectors.av_buffer_get_ref_count(buf);
		}

		public unsafe static int av_buffer_is_writable(AVBufferRef* buf)
		{
			return vectors.av_buffer_is_writable(buf);
		}

		public unsafe static int av_buffer_make_writable(AVBufferRef** buf)
		{
			return vectors.av_buffer_make_writable(buf);
		}

		public unsafe static void* av_buffer_pool_buffer_get_opaque(AVBufferRef* @ref)
		{
			return vectors.av_buffer_pool_buffer_get_opaque(@ref);
		}

		public unsafe static AVBufferRef* av_buffer_pool_get(AVBufferPool* pool)
		{
			return vectors.av_buffer_pool_get(pool);
		}

		public unsafe static AVBufferPool* av_buffer_pool_init(ulong size, av_buffer_pool_init_alloc_func alloc)
		{
			return vectors.av_buffer_pool_init(size, alloc);
		}

		public unsafe static AVBufferPool* av_buffer_pool_init2(ulong size, void* opaque, av_buffer_pool_init2_alloc_func alloc, av_buffer_pool_init2_pool_free_func pool_free)
		{
			return vectors.av_buffer_pool_init2(size, opaque, alloc, pool_free);
		}

		public unsafe static void av_buffer_pool_uninit(AVBufferPool** pool)
		{
			vectors.av_buffer_pool_uninit(pool);
		}

		public unsafe static int av_buffer_realloc(AVBufferRef** buf, ulong size)
		{
			return vectors.av_buffer_realloc(buf, size);
		}

		public unsafe static AVBufferRef* av_buffer_ref(AVBufferRef* buf)
		{
			return vectors.av_buffer_ref(buf);
		}

		public unsafe static int av_buffer_replace(AVBufferRef** dst, AVBufferRef* src)
		{
			return vectors.av_buffer_replace(dst, src);
		}

		public unsafe static void av_buffer_unref(AVBufferRef** buf)
		{
			vectors.av_buffer_unref(buf);
		}

		public unsafe static int av_buffersink_get_ch_layout(AVFilterContext* ctx, AVChannelLayout* ch_layout)
		{
			return vectors.av_buffersink_get_ch_layout(ctx, ch_layout);
		}

		public unsafe static int av_buffersink_get_channels(AVFilterContext* ctx)
		{
			return vectors.av_buffersink_get_channels(ctx);
		}

		public unsafe static AVColorRange av_buffersink_get_color_range(AVFilterContext* ctx)
		{
			return vectors.av_buffersink_get_color_range(ctx);
		}

		public unsafe static AVColorSpace av_buffersink_get_colorspace(AVFilterContext* ctx)
		{
			return vectors.av_buffersink_get_colorspace(ctx);
		}

		public unsafe static int av_buffersink_get_format(AVFilterContext* ctx)
		{
			return vectors.av_buffersink_get_format(ctx);
		}

		public unsafe static int av_buffersink_get_frame(AVFilterContext* ctx, AVFrame* frame)
		{
			return vectors.av_buffersink_get_frame(ctx, frame);
		}

		public unsafe static int av_buffersink_get_frame_flags(AVFilterContext* ctx, AVFrame* frame, int flags)
		{
			return vectors.av_buffersink_get_frame_flags(ctx, frame, flags);
		}

		public unsafe static AVRational av_buffersink_get_frame_rate(AVFilterContext* ctx)
		{
			return vectors.av_buffersink_get_frame_rate(ctx);
		}

		public unsafe static int av_buffersink_get_h(AVFilterContext* ctx)
		{
			return vectors.av_buffersink_get_h(ctx);
		}

		public unsafe static AVBufferRef* av_buffersink_get_hw_frames_ctx(AVFilterContext* ctx)
		{
			return vectors.av_buffersink_get_hw_frames_ctx(ctx);
		}

		public unsafe static AVRational av_buffersink_get_sample_aspect_ratio(AVFilterContext* ctx)
		{
			return vectors.av_buffersink_get_sample_aspect_ratio(ctx);
		}

		public unsafe static int av_buffersink_get_sample_rate(AVFilterContext* ctx)
		{
			return vectors.av_buffersink_get_sample_rate(ctx);
		}

		public unsafe static int av_buffersink_get_samples(AVFilterContext* ctx, AVFrame* frame, int nb_samples)
		{
			return vectors.av_buffersink_get_samples(ctx, frame, nb_samples);
		}

		public unsafe static AVRational av_buffersink_get_time_base(AVFilterContext* ctx)
		{
			return vectors.av_buffersink_get_time_base(ctx);
		}

		public unsafe static AVMediaType av_buffersink_get_type(AVFilterContext* ctx)
		{
			return vectors.av_buffersink_get_type(ctx);
		}

		public unsafe static int av_buffersink_get_w(AVFilterContext* ctx)
		{
			return vectors.av_buffersink_get_w(ctx);
		}

		public unsafe static void av_buffersink_set_frame_size(AVFilterContext* ctx, uint frame_size)
		{
			vectors.av_buffersink_set_frame_size(ctx, frame_size);
		}

		public unsafe static int av_buffersrc_add_frame(AVFilterContext* ctx, AVFrame* frame)
		{
			return vectors.av_buffersrc_add_frame(ctx, frame);
		}

		public unsafe static int av_buffersrc_add_frame_flags(AVFilterContext* buffer_src, AVFrame* frame, int flags)
		{
			return vectors.av_buffersrc_add_frame_flags(buffer_src, frame, flags);
		}

		public unsafe static int av_buffersrc_close(AVFilterContext* ctx, long pts, uint flags)
		{
			return vectors.av_buffersrc_close(ctx, pts, flags);
		}

		public unsafe static uint av_buffersrc_get_nb_failed_requests(AVFilterContext* buffer_src)
		{
			return vectors.av_buffersrc_get_nb_failed_requests(buffer_src);
		}

		public unsafe static AVBufferSrcParameters* av_buffersrc_parameters_alloc()
		{
			return vectors.av_buffersrc_parameters_alloc();
		}

		public unsafe static int av_buffersrc_parameters_set(AVFilterContext* ctx, AVBufferSrcParameters* param)
		{
			return vectors.av_buffersrc_parameters_set(ctx, param);
		}

		public unsafe static int av_buffersrc_write_frame(AVFilterContext* ctx, AVFrame* frame)
		{
			return vectors.av_buffersrc_write_frame(ctx, frame);
		}

		public unsafe static void* av_calloc(ulong nmemb, ulong size)
		{
			return vectors.av_calloc(nmemb, size);
		}

		public unsafe static int av_channel_description(byte* buf, ulong buf_size, AVChannel channel)
		{
			return vectors.av_channel_description(buf, buf_size, channel);
		}

		public unsafe static void av_channel_description_bprint(AVBPrint* bp, AVChannel channel_id)
		{
			vectors.av_channel_description_bprint(bp, channel_id);
		}

		public static AVChannel av_channel_from_string(string name)
		{
			return vectors.av_channel_from_string(name);
		}

		public unsafe static int av_channel_layout_ambisonic_order(AVChannelLayout* channel_layout)
		{
			return vectors.av_channel_layout_ambisonic_order(channel_layout);
		}

		public unsafe static AVChannel av_channel_layout_channel_from_index(AVChannelLayout* channel_layout, uint idx)
		{
			return vectors.av_channel_layout_channel_from_index(channel_layout, idx);
		}

		public unsafe static AVChannel av_channel_layout_channel_from_string(AVChannelLayout* channel_layout, string name)
		{
			return vectors.av_channel_layout_channel_from_string(channel_layout, name);
		}

		public unsafe static int av_channel_layout_check(AVChannelLayout* channel_layout)
		{
			return vectors.av_channel_layout_check(channel_layout);
		}

		public unsafe static int av_channel_layout_compare(AVChannelLayout* chl, AVChannelLayout* chl1)
		{
			return vectors.av_channel_layout_compare(chl, chl1);
		}

		public unsafe static int av_channel_layout_copy(AVChannelLayout* dst, AVChannelLayout* src)
		{
			return vectors.av_channel_layout_copy(dst, src);
		}

		public unsafe static int av_channel_layout_custom_init(AVChannelLayout* channel_layout, int nb_channels)
		{
			return vectors.av_channel_layout_custom_init(channel_layout, nb_channels);
		}

		public unsafe static void av_channel_layout_default(AVChannelLayout* ch_layout, int nb_channels)
		{
			vectors.av_channel_layout_default(ch_layout, nb_channels);
		}

		public unsafe static int av_channel_layout_describe(AVChannelLayout* channel_layout, byte* buf, ulong buf_size)
		{
			return vectors.av_channel_layout_describe(channel_layout, buf, buf_size);
		}

		public unsafe static int av_channel_layout_describe_bprint(AVChannelLayout* channel_layout, AVBPrint* bp)
		{
			return vectors.av_channel_layout_describe_bprint(channel_layout, bp);
		}

		public unsafe static int av_channel_layout_from_mask(AVChannelLayout* channel_layout, ulong mask)
		{
			return vectors.av_channel_layout_from_mask(channel_layout, mask);
		}

		public unsafe static int av_channel_layout_from_string(AVChannelLayout* channel_layout, string str)
		{
			return vectors.av_channel_layout_from_string(channel_layout, str);
		}

		public unsafe static int av_channel_layout_index_from_channel(AVChannelLayout* channel_layout, AVChannel channel)
		{
			return vectors.av_channel_layout_index_from_channel(channel_layout, channel);
		}

		public unsafe static int av_channel_layout_index_from_string(AVChannelLayout* channel_layout, string name)
		{
			return vectors.av_channel_layout_index_from_string(channel_layout, name);
		}

		public unsafe static int av_channel_layout_retype(AVChannelLayout* channel_layout, AVChannelOrder order, int flags)
		{
			return vectors.av_channel_layout_retype(channel_layout, order, flags);
		}

		public unsafe static AVChannelLayout* av_channel_layout_standard(void** opaque)
		{
			return vectors.av_channel_layout_standard(opaque);
		}

		public unsafe static ulong av_channel_layout_subset(AVChannelLayout* channel_layout, ulong mask)
		{
			return vectors.av_channel_layout_subset(channel_layout, mask);
		}

		public unsafe static void av_channel_layout_uninit(AVChannelLayout* channel_layout)
		{
			vectors.av_channel_layout_uninit(channel_layout);
		}

		public unsafe static int av_channel_name(byte* buf, ulong buf_size, AVChannel channel)
		{
			return vectors.av_channel_name(buf, buf_size, channel);
		}

		public unsafe static void av_channel_name_bprint(AVBPrint* bp, AVChannel channel_id)
		{
			vectors.av_channel_name_bprint(bp, channel_id);
		}

		public unsafe static int av_chroma_location_enum_to_pos(int* xpos, int* ypos, AVChromaLocation pos)
		{
			return vectors.av_chroma_location_enum_to_pos(xpos, ypos, pos);
		}

		public static int av_chroma_location_from_name(string name)
		{
			return vectors.av_chroma_location_from_name(name);
		}

		public static string av_chroma_location_name(AVChromaLocation location)
		{
			return vectors.av_chroma_location_name(location);
		}

		public static AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos)
		{
			return vectors.av_chroma_location_pos_to_enum(xpos, ypos);
		}

		public unsafe static AVCodecID av_codec_get_id(AVCodecTag** tags, uint tag)
		{
			return vectors.av_codec_get_id(tags, tag);
		}

		public unsafe static uint av_codec_get_tag(AVCodecTag** tags, AVCodecID id)
		{
			return vectors.av_codec_get_tag(tags, id);
		}

		public unsafe static int av_codec_get_tag2(AVCodecTag** tags, AVCodecID id, uint* tag)
		{
			return vectors.av_codec_get_tag2(tags, id, tag);
		}

		public unsafe static int av_codec_is_decoder(AVCodec* codec)
		{
			return vectors.av_codec_is_decoder(codec);
		}

		public unsafe static int av_codec_is_encoder(AVCodec* codec)
		{
			return vectors.av_codec_is_encoder(codec);
		}

		public unsafe static AVCodec* av_codec_iterate(void** opaque)
		{
			return vectors.av_codec_iterate(opaque);
		}

		public static int av_color_primaries_from_name(string name)
		{
			return vectors.av_color_primaries_from_name(name);
		}

		public static string av_color_primaries_name(AVColorPrimaries primaries)
		{
			return vectors.av_color_primaries_name(primaries);
		}

		public static int av_color_range_from_name(string name)
		{
			return vectors.av_color_range_from_name(name);
		}

		public static string av_color_range_name(AVColorRange range)
		{
			return vectors.av_color_range_name(range);
		}

		public static int av_color_space_from_name(string name)
		{
			return vectors.av_color_space_from_name(name);
		}

		public static string av_color_space_name(AVColorSpace space)
		{
			return vectors.av_color_space_name(space);
		}

		public static int av_color_transfer_from_name(string name)
		{
			return vectors.av_color_transfer_from_name(name);
		}

		public static string av_color_transfer_name(AVColorTransferCharacteristic transfer)
		{
			return vectors.av_color_transfer_name(transfer);
		}

		public static long av_compare_mod(ulong a, ulong b, ulong mod)
		{
			return vectors.av_compare_mod(a, b, mod);
		}

		public static int av_compare_ts(long ts_a, AVRational tb_a, long ts_b, AVRational tb_b)
		{
			return vectors.av_compare_ts(ts_a, tb_a, ts_b, tb_b);
		}

		public unsafe static AVContentLightMetadata* av_content_light_metadata_alloc(ulong* size)
		{
			return vectors.av_content_light_metadata_alloc(size);
		}

		public unsafe static AVContentLightMetadata* av_content_light_metadata_create_side_data(AVFrame* frame)
		{
			return vectors.av_content_light_metadata_create_side_data(frame);
		}

		public unsafe static AVCPBProperties* av_cpb_properties_alloc(ulong* size)
		{
			return vectors.av_cpb_properties_alloc(size);
		}

		public static int av_cpu_count()
		{
			return vectors.av_cpu_count();
		}

		public static void av_cpu_force_count(int count)
		{
			vectors.av_cpu_force_count(count);
		}

		public static ulong av_cpu_max_align()
		{
			return vectors.av_cpu_max_align();
		}

		public static AVRational av_d2q(double d, int max)
		{
			return vectors.av_d2q(d, max);
		}

		public unsafe static AVD3D11VAContext* av_d3d11va_alloc_context()
		{
			return vectors.av_d3d11va_alloc_context();
		}

		public unsafe static AVClassCategory av_default_get_category(void* ptr)
		{
			return vectors.av_default_get_category(ptr);
		}

		public unsafe static string av_default_item_name(void* ctx)
		{
			return vectors.av_default_item_name(ctx);
		}

		public unsafe static AVInputFormat* av_demuxer_iterate(void** opaque)
		{
			return vectors.av_demuxer_iterate(opaque);
		}

		public unsafe static int av_dict_copy(AVDictionary** dst, AVDictionary* src, int flags)
		{
			return vectors.av_dict_copy(dst, src, flags);
		}

		public unsafe static int av_dict_count(AVDictionary* m)
		{
			return vectors.av_dict_count(m);
		}

		public unsafe static void av_dict_free(AVDictionary** m)
		{
			vectors.av_dict_free(m);
		}

		public unsafe static AVDictionaryEntry* av_dict_get(AVDictionary* m, string key, AVDictionaryEntry* prev, int flags)
		{
			return vectors.av_dict_get(m, key, prev, flags);
		}

		public unsafe static int av_dict_get_string(AVDictionary* m, byte** buffer, byte key_val_sep, byte pairs_sep)
		{
			return vectors.av_dict_get_string(m, buffer, key_val_sep, pairs_sep);
		}

		public unsafe static AVDictionaryEntry* av_dict_iterate(AVDictionary* m, AVDictionaryEntry* prev)
		{
			return vectors.av_dict_iterate(m, prev);
		}

		public unsafe static int av_dict_parse_string(AVDictionary** pm, string str, string key_val_sep, string pairs_sep, int flags)
		{
			return vectors.av_dict_parse_string(pm, str, key_val_sep, pairs_sep, flags);
		}

		public unsafe static int av_dict_set(AVDictionary** pm, string key, string value, int flags)
		{
			return vectors.av_dict_set(pm, key, value, flags);
		}

		public unsafe static int av_dict_set_int(AVDictionary** pm, string key, long value, int flags)
		{
			return vectors.av_dict_set_int(pm, key, value, flags);
		}

		public static void av_display_matrix_flip(ref int_array9 matrix, int hflip, int vflip)
		{
			vectors.av_display_matrix_flip(ref matrix, hflip, vflip);
		}

		public static double av_display_rotation_get(in int_array9 matrix)
		{
			return vectors.av_display_rotation_get(in matrix);
		}

		public static void av_display_rotation_set(ref int_array9 matrix, double angle)
		{
			vectors.av_display_rotation_set(ref matrix, angle);
		}

		public static int av_disposition_from_string(string disp)
		{
			return vectors.av_disposition_from_string(disp);
		}

		public static string av_disposition_to_string(int disposition)
		{
			return vectors.av_disposition_to_string(disposition);
		}

		public static AVRational av_div_q(AVRational b, AVRational c)
		{
			return vectors.av_div_q(b, c);
		}

		public unsafe static void av_dump_format(AVFormatContext* ic, int index, string url, int is_output)
		{
			vectors.av_dump_format(ic, index, url, is_output);
		}

		public unsafe static AVDynamicHDRPlus* av_dynamic_hdr_plus_alloc(ulong* size)
		{
			return vectors.av_dynamic_hdr_plus_alloc(size);
		}

		public unsafe static AVDynamicHDRPlus* av_dynamic_hdr_plus_create_side_data(AVFrame* frame)
		{
			return vectors.av_dynamic_hdr_plus_create_side_data(frame);
		}

		public unsafe static int av_dynamic_hdr_plus_from_t35(AVDynamicHDRPlus* s, byte* data, ulong size)
		{
			return vectors.av_dynamic_hdr_plus_from_t35(s, data, size);
		}

		public unsafe static int av_dynamic_hdr_plus_to_t35(AVDynamicHDRPlus* s, byte** data, ulong* size)
		{
			return vectors.av_dynamic_hdr_plus_to_t35(s, data, size);
		}

		public unsafe static void av_dynarray_add(void* tab_ptr, int* nb_ptr, void* elem)
		{
			vectors.av_dynarray_add(tab_ptr, nb_ptr, elem);
		}

		public unsafe static int av_dynarray_add_nofree(void* tab_ptr, int* nb_ptr, void* elem)
		{
			return vectors.av_dynarray_add_nofree(tab_ptr, nb_ptr, elem);
		}

		public unsafe static void* av_dynarray2_add(void** tab_ptr, int* nb_ptr, ulong elem_size, byte* elem_data)
		{
			return vectors.av_dynarray2_add(tab_ptr, nb_ptr, elem_size, elem_data);
		}

		public unsafe static void av_fast_malloc(void* ptr, uint* size, ulong min_size)
		{
			vectors.av_fast_malloc(ptr, size, min_size);
		}

		public unsafe static void av_fast_mallocz(void* ptr, uint* size, ulong min_size)
		{
			vectors.av_fast_mallocz(ptr, size, min_size);
		}

		public unsafe static void av_fast_padded_malloc(void* ptr, uint* size, ulong min_size)
		{
			vectors.av_fast_padded_malloc(ptr, size, min_size);
		}

		public unsafe static void av_fast_padded_mallocz(void* ptr, uint* size, ulong min_size)
		{
			vectors.av_fast_padded_mallocz(ptr, size, min_size);
		}

		public unsafe static void* av_fast_realloc(void* ptr, uint* size, ulong min_size)
		{
			return vectors.av_fast_realloc(ptr, size, min_size);
		}

		public unsafe static int av_file_map(string filename, byte** bufptr, ulong* size, int log_offset, void* log_ctx)
		{
			return vectors.av_file_map(filename, bufptr, size, log_offset, log_ctx);
		}

		public unsafe static void av_file_unmap(byte* bufptr, ulong size)
		{
			vectors.av_file_unmap(bufptr, size);
		}

		public static int av_filename_number_test(string filename)
		{
			return vectors.av_filename_number_test(filename);
		}

		public unsafe static AVFilter* av_filter_iterate(void** opaque)
		{
			return vectors.av_filter_iterate(opaque);
		}

		public unsafe static AVPixelFormat av_find_best_pix_fmt_of_2(AVPixelFormat dst_pix_fmt1, AVPixelFormat dst_pix_fmt2, AVPixelFormat src_pix_fmt, int has_alpha, int* loss_ptr)
		{
			return vectors.av_find_best_pix_fmt_of_2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, has_alpha, loss_ptr);
		}

		public unsafe static int av_find_best_stream(AVFormatContext* ic, AVMediaType type, int wanted_stream_nb, int related_stream, AVCodec** decoder_ret, int flags)
		{
			return vectors.av_find_best_stream(ic, type, wanted_stream_nb, related_stream, decoder_ret, flags);
		}

		public unsafe static int av_find_default_stream_index(AVFormatContext* s)
		{
			return vectors.av_find_default_stream_index(s);
		}

		public unsafe static AVInputFormat* av_find_input_format(string short_name)
		{
			return vectors.av_find_input_format(short_name);
		}

		public unsafe static int av_find_nearest_q_idx(AVRational q, AVRational* q_list)
		{
			return vectors.av_find_nearest_q_idx(q, q_list);
		}

		public unsafe static AVProgram* av_find_program_from_stream(AVFormatContext* ic, AVProgram* last, int s)
		{
			return vectors.av_find_program_from_stream(ic, last, s);
		}

		[Obsolete("duration_estimation_method is public and can be read directly.")]
		public unsafe static AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method(AVFormatContext* ctx)
		{
			return vectors.av_fmt_ctx_get_duration_estimation_method(ctx);
		}

		public static void av_force_cpu_flags(int flags)
		{
			vectors.av_force_cpu_flags(flags);
		}

		public unsafe static void av_format_inject_global_side_data(AVFormatContext* s)
		{
			vectors.av_format_inject_global_side_data(s);
		}

		public unsafe static byte* av_fourcc_make_string(byte* buf, uint fourcc)
		{
			return vectors.av_fourcc_make_string(buf, fourcc);
		}

		public unsafe static AVFrame* av_frame_alloc()
		{
			return vectors.av_frame_alloc();
		}

		public unsafe static int av_frame_apply_cropping(AVFrame* frame, int flags)
		{
			return vectors.av_frame_apply_cropping(frame, flags);
		}

		public unsafe static AVFrame* av_frame_clone(AVFrame* src)
		{
			return vectors.av_frame_clone(src);
		}

		public unsafe static int av_frame_copy(AVFrame* dst, AVFrame* src)
		{
			return vectors.av_frame_copy(dst, src);
		}

		public unsafe static int av_frame_copy_props(AVFrame* dst, AVFrame* src)
		{
			return vectors.av_frame_copy_props(dst, src);
		}

		public unsafe static void av_frame_free(AVFrame** frame)
		{
			vectors.av_frame_free(frame);
		}

		public unsafe static int av_frame_get_buffer(AVFrame* frame, int align)
		{
			return vectors.av_frame_get_buffer(frame, align);
		}

		public unsafe static AVBufferRef* av_frame_get_plane_buffer(AVFrame* frame, int plane)
		{
			return vectors.av_frame_get_plane_buffer(frame, plane);
		}

		public unsafe static AVFrameSideData* av_frame_get_side_data(AVFrame* frame, AVFrameSideDataType type)
		{
			return vectors.av_frame_get_side_data(frame, type);
		}

		public unsafe static int av_frame_is_writable(AVFrame* frame)
		{
			return vectors.av_frame_is_writable(frame);
		}

		public unsafe static int av_frame_make_writable(AVFrame* frame)
		{
			return vectors.av_frame_make_writable(frame);
		}

		public unsafe static void av_frame_move_ref(AVFrame* dst, AVFrame* src)
		{
			vectors.av_frame_move_ref(dst, src);
		}

		public unsafe static AVFrameSideData* av_frame_new_side_data(AVFrame* frame, AVFrameSideDataType type, ulong size)
		{
			return vectors.av_frame_new_side_data(frame, type, size);
		}

		public unsafe static AVFrameSideData* av_frame_new_side_data_from_buf(AVFrame* frame, AVFrameSideDataType type, AVBufferRef* buf)
		{
			return vectors.av_frame_new_side_data_from_buf(frame, type, buf);
		}

		public unsafe static int av_frame_ref(AVFrame* dst, AVFrame* src)
		{
			return vectors.av_frame_ref(dst, src);
		}

		public unsafe static void av_frame_remove_side_data(AVFrame* frame, AVFrameSideDataType type)
		{
			vectors.av_frame_remove_side_data(frame, type);
		}

		public unsafe static int av_frame_replace(AVFrame* dst, AVFrame* src)
		{
			return vectors.av_frame_replace(dst, src);
		}

		public unsafe static AVFrameSideData* av_frame_side_data_add(AVFrameSideData*** sd, int* nb_sd, AVFrameSideDataType type, AVBufferRef** buf, uint flags)
		{
			return vectors.av_frame_side_data_add(sd, nb_sd, type, buf, flags);
		}

		public unsafe static int av_frame_side_data_clone(AVFrameSideData*** sd, int* nb_sd, AVFrameSideData* src, uint flags)
		{
			return vectors.av_frame_side_data_clone(sd, nb_sd, src, flags);
		}

		public unsafe static AVSideDataDescriptor* av_frame_side_data_desc(AVFrameSideDataType type)
		{
			return vectors.av_frame_side_data_desc(type);
		}

		public unsafe static void av_frame_side_data_free(AVFrameSideData*** sd, int* nb_sd)
		{
			vectors.av_frame_side_data_free(sd, nb_sd);
		}

		public unsafe static AVFrameSideData* av_frame_side_data_get_c(AVFrameSideData** sd, int nb_sd, AVFrameSideDataType type)
		{
			return vectors.av_frame_side_data_get_c(sd, nb_sd, type);
		}

		public static string av_frame_side_data_name(AVFrameSideDataType type)
		{
			return vectors.av_frame_side_data_name(type);
		}

		public unsafe static AVFrameSideData* av_frame_side_data_new(AVFrameSideData*** sd, int* nb_sd, AVFrameSideDataType type, ulong size, uint flags)
		{
			return vectors.av_frame_side_data_new(sd, nb_sd, type, size, flags);
		}

		public unsafe static void av_frame_side_data_remove(AVFrameSideData*** sd, int* nb_sd, AVFrameSideDataType type)
		{
			vectors.av_frame_side_data_remove(sd, nb_sd, type);
		}

		public unsafe static void av_frame_unref(AVFrame* frame)
		{
			vectors.av_frame_unref(frame);
		}

		public unsafe static void av_free(void* ptr)
		{
			vectors.av_free(ptr);
		}

		public unsafe static void av_freep(void* ptr)
		{
			vectors.av_freep(ptr);
		}

		public static long av_gcd(long a, long b)
		{
			return vectors.av_gcd(a, b);
		}

		public static AVRational av_gcd_q(AVRational a, AVRational b, int max_den, AVRational def)
		{
			return vectors.av_gcd_q(a, b, max_den, def);
		}

		public static AVSampleFormat av_get_alt_sample_fmt(AVSampleFormat sample_fmt, int planar)
		{
			return vectors.av_get_alt_sample_fmt(sample_fmt, planar);
		}

		public unsafe static int av_get_audio_frame_duration(AVCodecContext* avctx, int frame_bytes)
		{
			return vectors.av_get_audio_frame_duration(avctx, frame_bytes);
		}

		public unsafe static int av_get_audio_frame_duration2(AVCodecParameters* par, int frame_bytes)
		{
			return vectors.av_get_audio_frame_duration2(par, frame_bytes);
		}

		public unsafe static int av_get_bits_per_pixel(AVPixFmtDescriptor* pixdesc)
		{
			return vectors.av_get_bits_per_pixel(pixdesc);
		}

		public static int av_get_bits_per_sample(AVCodecID codec_id)
		{
			return vectors.av_get_bits_per_sample(codec_id);
		}

		public static int av_get_bytes_per_sample(AVSampleFormat sample_fmt)
		{
			return vectors.av_get_bytes_per_sample(sample_fmt);
		}

		public static int av_get_cpu_flags()
		{
			return vectors.av_get_cpu_flags();
		}

		public static int av_get_exact_bits_per_sample(AVCodecID codec_id)
		{
			return vectors.av_get_exact_bits_per_sample(codec_id);
		}

		public unsafe static int av_get_frame_filename(byte* buf, int buf_size, string path, int number)
		{
			return vectors.av_get_frame_filename(buf, buf_size, path, number);
		}

		public unsafe static int av_get_frame_filename2(byte* buf, int buf_size, string path, int number, int flags)
		{
			return vectors.av_get_frame_filename2(buf, buf_size, path, number, flags);
		}

		public static string av_get_media_type_string(AVMediaType media_type)
		{
			return vectors.av_get_media_type_string(media_type);
		}

		public unsafe static int av_get_output_timestamp(AVFormatContext* s, int stream, long* dts, long* wall)
		{
			return vectors.av_get_output_timestamp(s, stream, dts, wall);
		}

		public static AVSampleFormat av_get_packed_sample_fmt(AVSampleFormat sample_fmt)
		{
			return vectors.av_get_packed_sample_fmt(sample_fmt);
		}

		public unsafe static int av_get_packet(AVIOContext* s, AVPacket* pkt, int size)
		{
			return vectors.av_get_packet(s, pkt, size);
		}

		public unsafe static int av_get_padded_bits_per_pixel(AVPixFmtDescriptor* pixdesc)
		{
			return vectors.av_get_padded_bits_per_pixel(pixdesc);
		}

		public static AVCodecID av_get_pcm_codec(AVSampleFormat fmt, int be)
		{
			return vectors.av_get_pcm_codec(fmt, be);
		}

		public static byte av_get_picture_type_char(AVPictureType pict_type)
		{
			return vectors.av_get_picture_type_char(pict_type);
		}

		public static AVPixelFormat av_get_pix_fmt(string name)
		{
			return vectors.av_get_pix_fmt(name);
		}

		public static int av_get_pix_fmt_loss(AVPixelFormat dst_pix_fmt, AVPixelFormat src_pix_fmt, int has_alpha)
		{
			return vectors.av_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
		}

		public static string av_get_pix_fmt_name(AVPixelFormat pix_fmt)
		{
			return vectors.av_get_pix_fmt_name(pix_fmt);
		}

		public unsafe static byte* av_get_pix_fmt_string(byte* buf, int buf_size, AVPixelFormat pix_fmt)
		{
			return vectors.av_get_pix_fmt_string(buf, buf_size, pix_fmt);
		}

		public static AVSampleFormat av_get_planar_sample_fmt(AVSampleFormat sample_fmt)
		{
			return vectors.av_get_planar_sample_fmt(sample_fmt);
		}

		public unsafe static string av_get_profile_name(AVCodec* codec, int profile)
		{
			return vectors.av_get_profile_name(codec, profile);
		}

		public static AVSampleFormat av_get_sample_fmt(string name)
		{
			return vectors.av_get_sample_fmt(name);
		}

		public static string av_get_sample_fmt_name(AVSampleFormat sample_fmt)
		{
			return vectors.av_get_sample_fmt_name(sample_fmt);
		}

		public unsafe static byte* av_get_sample_fmt_string(byte* buf, int buf_size, AVSampleFormat sample_fmt)
		{
			return vectors.av_get_sample_fmt_string(buf, buf_size, sample_fmt);
		}

		public static AVRational av_get_time_base_q()
		{
			return vectors.av_get_time_base_q();
		}

		public static long av_gettime()
		{
			return vectors.av_gettime();
		}

		public static long av_gettime_relative()
		{
			return vectors.av_gettime_relative();
		}

		public static int av_gettime_relative_is_monotonic()
		{
			return vectors.av_gettime_relative_is_monotonic();
		}

		public unsafe static int av_grow_packet(AVPacket* pkt, int grow_by)
		{
			return vectors.av_grow_packet(pkt, grow_by);
		}

		public unsafe static AVCodecID av_guess_codec(AVOutputFormat* fmt, string short_name, string filename, string mime_type, AVMediaType type)
		{
			return vectors.av_guess_codec(fmt, short_name, filename, mime_type, type);
		}

		public unsafe static AVOutputFormat* av_guess_format(string short_name, string filename, string mime_type)
		{
			return vectors.av_guess_format(short_name, filename, mime_type);
		}

		public unsafe static AVRational av_guess_frame_rate(AVFormatContext* ctx, AVStream* stream, AVFrame* frame)
		{
			return vectors.av_guess_frame_rate(ctx, stream, frame);
		}

		public unsafe static AVRational av_guess_sample_aspect_ratio(AVFormatContext* format, AVStream* stream, AVFrame* frame)
		{
			return vectors.av_guess_sample_aspect_ratio(format, stream, frame);
		}

		public unsafe static void av_hex_dump(_iobuf* f, byte* buf, int size)
		{
			vectors.av_hex_dump(f, buf, size);
		}

		public unsafe static void av_hex_dump_log(void* avcl, int level, byte* buf, int size)
		{
			vectors.av_hex_dump_log(avcl, level, buf, size);
		}

		public unsafe static AVBufferRef* av_hwdevice_ctx_alloc(AVHWDeviceType type)
		{
			return vectors.av_hwdevice_ctx_alloc(type);
		}

		public unsafe static int av_hwdevice_ctx_create(AVBufferRef** device_ctx, AVHWDeviceType type, string device, AVDictionary* opts, int flags)
		{
			return vectors.av_hwdevice_ctx_create(device_ctx, type, device, opts, flags);
		}

		public unsafe static int av_hwdevice_ctx_create_derived(AVBufferRef** dst_ctx, AVHWDeviceType type, AVBufferRef* src_ctx, int flags)
		{
			return vectors.av_hwdevice_ctx_create_derived(dst_ctx, type, src_ctx, flags);
		}

		public unsafe static int av_hwdevice_ctx_create_derived_opts(AVBufferRef** dst_ctx, AVHWDeviceType type, AVBufferRef* src_ctx, AVDictionary* options, int flags)
		{
			return vectors.av_hwdevice_ctx_create_derived_opts(dst_ctx, type, src_ctx, options, flags);
		}

		public unsafe static int av_hwdevice_ctx_init(AVBufferRef* @ref)
		{
			return vectors.av_hwdevice_ctx_init(@ref);
		}

		public static AVHWDeviceType av_hwdevice_find_type_by_name(string name)
		{
			return vectors.av_hwdevice_find_type_by_name(name);
		}

		public unsafe static AVHWFramesConstraints* av_hwdevice_get_hwframe_constraints(AVBufferRef* @ref, void* hwconfig)
		{
			return vectors.av_hwdevice_get_hwframe_constraints(@ref, hwconfig);
		}

		public static string av_hwdevice_get_type_name(AVHWDeviceType type)
		{
			return vectors.av_hwdevice_get_type_name(type);
		}

		public unsafe static void* av_hwdevice_hwconfig_alloc(AVBufferRef* device_ctx)
		{
			return vectors.av_hwdevice_hwconfig_alloc(device_ctx);
		}

		public static AVHWDeviceType av_hwdevice_iterate_types(AVHWDeviceType prev)
		{
			return vectors.av_hwdevice_iterate_types(prev);
		}

		public unsafe static void av_hwframe_constraints_free(AVHWFramesConstraints** constraints)
		{
			vectors.av_hwframe_constraints_free(constraints);
		}

		public unsafe static AVBufferRef* av_hwframe_ctx_alloc(AVBufferRef* device_ctx)
		{
			return vectors.av_hwframe_ctx_alloc(device_ctx);
		}

		public unsafe static int av_hwframe_ctx_create_derived(AVBufferRef** derived_frame_ctx, AVPixelFormat format, AVBufferRef* derived_device_ctx, AVBufferRef* source_frame_ctx, int flags)
		{
			return vectors.av_hwframe_ctx_create_derived(derived_frame_ctx, format, derived_device_ctx, source_frame_ctx, flags);
		}

		public unsafe static int av_hwframe_ctx_init(AVBufferRef* @ref)
		{
			return vectors.av_hwframe_ctx_init(@ref);
		}

		public unsafe static int av_hwframe_get_buffer(AVBufferRef* hwframe_ctx, AVFrame* frame, int flags)
		{
			return vectors.av_hwframe_get_buffer(hwframe_ctx, frame, flags);
		}

		public unsafe static int av_hwframe_map(AVFrame* dst, AVFrame* src, int flags)
		{
			return vectors.av_hwframe_map(dst, src, flags);
		}

		public unsafe static int av_hwframe_transfer_data(AVFrame* dst, AVFrame* src, int flags)
		{
			return vectors.av_hwframe_transfer_data(dst, src, flags);
		}

		public unsafe static int av_hwframe_transfer_get_formats(AVBufferRef* hwframe_ctx, AVHWFrameTransferDirection dir, AVPixelFormat** formats, int flags)
		{
			return vectors.av_hwframe_transfer_get_formats(hwframe_ctx, dir, formats, flags);
		}

		public static int av_image_alloc(ref byte_ptrArray4 pointers, ref int_array4 linesizes, int w, int h, AVPixelFormat pix_fmt, int align)
		{
			return vectors.av_image_alloc(ref pointers, ref linesizes, w, h, pix_fmt, align);
		}

		public static int av_image_check_sar(uint w, uint h, AVRational sar)
		{
			return vectors.av_image_check_sar(w, h, sar);
		}

		public unsafe static int av_image_check_size(uint w, uint h, int log_offset, void* log_ctx)
		{
			return vectors.av_image_check_size(w, h, log_offset, log_ctx);
		}

		public unsafe static int av_image_check_size2(uint w, uint h, long max_pixels, AVPixelFormat pix_fmt, int log_offset, void* log_ctx)
		{
			return vectors.av_image_check_size2(w, h, max_pixels, pix_fmt, log_offset, log_ctx);
		}

		public static void av_image_copy(ref byte_ptrArray4 dst_data, in int_array4 dst_linesizes, in byte_ptrArray4 src_data, in int_array4 src_linesizes, AVPixelFormat pix_fmt, int width, int height)
		{
			vectors.av_image_copy(ref dst_data, in dst_linesizes, in src_data, in src_linesizes, pix_fmt, width, height);
		}

		public unsafe static void av_image_copy_plane(byte* dst, int dst_linesize, byte* src, int src_linesize, int bytewidth, int height)
		{
			vectors.av_image_copy_plane(dst, dst_linesize, src, src_linesize, bytewidth, height);
		}

		public unsafe static void av_image_copy_plane_uc_from(byte* dst, long dst_linesize, byte* src, long src_linesize, long bytewidth, int height)
		{
			vectors.av_image_copy_plane_uc_from(dst, dst_linesize, src, src_linesize, bytewidth, height);
		}

		public unsafe static int av_image_copy_to_buffer(byte* dst, int dst_size, in byte_ptrArray4 src_data, in int_array4 src_linesize, AVPixelFormat pix_fmt, int width, int height, int align)
		{
			return vectors.av_image_copy_to_buffer(dst, dst_size, in src_data, in src_linesize, pix_fmt, width, height, align);
		}

		public static void av_image_copy_uc_from(ref byte_ptrArray4 dst_data, in long_array4 dst_linesizes, in byte_ptrArray4 src_data, in long_array4 src_linesizes, AVPixelFormat pix_fmt, int width, int height)
		{
			vectors.av_image_copy_uc_from(ref dst_data, in dst_linesizes, in src_data, in src_linesizes, pix_fmt, width, height);
		}

		public unsafe static int av_image_fill_arrays(ref byte_ptrArray4 dst_data, ref int_array4 dst_linesize, byte* src, AVPixelFormat pix_fmt, int width, int height, int align)
		{
			return vectors.av_image_fill_arrays(ref dst_data, ref dst_linesize, src, pix_fmt, width, height, align);
		}

		public static int av_image_fill_black(ref byte_ptrArray4 dst_data, in long_array4 dst_linesize, AVPixelFormat pix_fmt, AVColorRange range, int width, int height)
		{
			return vectors.av_image_fill_black(ref dst_data, in dst_linesize, pix_fmt, range, width, height);
		}

		public static int av_image_fill_color(ref byte_ptrArray4 dst_data, in long_array4 dst_linesize, AVPixelFormat pix_fmt, in uint_array4 color, int width, int height, int flags)
		{
			return vectors.av_image_fill_color(ref dst_data, in dst_linesize, pix_fmt, in color, width, height, flags);
		}

		public static int av_image_fill_linesizes(ref int_array4 linesizes, AVPixelFormat pix_fmt, int width)
		{
			return vectors.av_image_fill_linesizes(ref linesizes, pix_fmt, width);
		}

		public unsafe static void av_image_fill_max_pixsteps(ref int_array4 max_pixsteps, ref int_array4 max_pixstep_comps, AVPixFmtDescriptor* pixdesc)
		{
			vectors.av_image_fill_max_pixsteps(ref max_pixsteps, ref max_pixstep_comps, pixdesc);
		}

		public static int av_image_fill_plane_sizes(ref ulong_array4 size, AVPixelFormat pix_fmt, int height, in long_array4 linesizes)
		{
			return vectors.av_image_fill_plane_sizes(ref size, pix_fmt, height, in linesizes);
		}

		public unsafe static int av_image_fill_pointers(ref byte_ptrArray4 data, AVPixelFormat pix_fmt, int height, byte* ptr, in int_array4 linesizes)
		{
			return vectors.av_image_fill_pointers(ref data, pix_fmt, height, ptr, in linesizes);
		}

		public static int av_image_get_buffer_size(AVPixelFormat pix_fmt, int width, int height, int align)
		{
			return vectors.av_image_get_buffer_size(pix_fmt, width, height, align);
		}

		public static int av_image_get_linesize(AVPixelFormat pix_fmt, int width, int plane)
		{
			return vectors.av_image_get_linesize(pix_fmt, width, plane);
		}

		public unsafe static int av_index_search_timestamp(AVStream* st, long timestamp, int flags)
		{
			return vectors.av_index_search_timestamp(st, timestamp, flags);
		}

		[Obsolete("This function is deprecated. Once it's removed, sizeof(AVPacket) will not be a part of the ABI anymore.")]
		public unsafe static void av_init_packet(AVPacket* pkt)
		{
			vectors.av_init_packet(pkt);
		}

		public unsafe static AVInputFormat* av_input_audio_device_next(AVInputFormat* d)
		{
			return vectors.av_input_audio_device_next(d);
		}

		public unsafe static AVInputFormat* av_input_video_device_next(AVInputFormat* d)
		{
			return vectors.av_input_video_device_next(d);
		}

		public unsafe static uint av_int_list_length_for_size(uint elsize, void* list, ulong term)
		{
			return vectors.av_int_list_length_for_size(elsize, list, term);
		}

		public unsafe static int av_interleaved_write_frame(AVFormatContext* s, AVPacket* pkt)
		{
			return vectors.av_interleaved_write_frame(s, pkt);
		}

		public unsafe static int av_interleaved_write_uncoded_frame(AVFormatContext* s, int stream_index, AVFrame* frame)
		{
			return vectors.av_interleaved_write_uncoded_frame(s, stream_index, frame);
		}

		public unsafe static void av_log(void* avcl, int level, string fmt)
		{
			vectors.av_log(avcl, level, fmt);
		}

		public unsafe static void av_log_default_callback(void* avcl, int level, string fmt, byte* vl)
		{
			vectors.av_log_default_callback(avcl, level, fmt, vl);
		}

		public unsafe static void av_log_format_line(void* ptr, int level, string fmt, byte* vl, byte* line, int line_size, int* print_prefix)
		{
			vectors.av_log_format_line(ptr, level, fmt, vl, line, line_size, print_prefix);
		}

		public unsafe static int av_log_format_line2(void* ptr, int level, string fmt, byte* vl, byte* line, int line_size, int* print_prefix)
		{
			return vectors.av_log_format_line2(ptr, level, fmt, vl, line, line_size, print_prefix);
		}

		public static int av_log_get_flags()
		{
			return vectors.av_log_get_flags();
		}

		public static int av_log_get_level()
		{
			return vectors.av_log_get_level();
		}

		public unsafe static void av_log_once(void* avcl, int initial_level, int subsequent_level, int* state, string fmt)
		{
			vectors.av_log_once(avcl, initial_level, subsequent_level, state, fmt);
		}

		public static void av_log_set_callback(av_log_set_callback_callback_func callback)
		{
			vectors.av_log_set_callback(callback);
		}

		public static void av_log_set_flags(int arg)
		{
			vectors.av_log_set_flags(arg);
		}

		public static void av_log_set_level(int level)
		{
			vectors.av_log_set_level(level);
		}

		public static int av_log2(uint v)
		{
			return vectors.av_log2(v);
		}

		public static int av_log2_16bit(uint v)
		{
			return vectors.av_log2_16bit(v);
		}

		public unsafe static void

GreyAnnouncer.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using FFmpeg.AutoGen;
using GameConsole;
using GameConsole.CommandTree;
using GreyAnnouncer.AnnouncerAPI;
using GreyAnnouncer.AudioLoading;
using GreyAnnouncer.AudioSourceComponent;
using GreyAnnouncer.Base;
using GreyAnnouncer.Config;
using GreyAnnouncer.FrontEnd;
using GreyAnnouncer.RankAnnouncer;
using GreyAnnouncer.Util;
using GreyAnnouncer.Util.Ini;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using TMPro;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.Video;
using plog;
using plog.Models;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("GreyAnnouncer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+abc6ba1c88ddcc65c8209e051b5774d3e8b18956")]
[assembly: AssemblyProduct("GreyAnnouncer")]
[assembly: AssemblyTitle("GreyAnnouncer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class StreamedAudioData
{
	private const int _CHUNK_SIZE = 8192;

	private readonly List<float[]> _chunks = new List<float[]>();

	private float[] _currentChunk = new float[8192];

	private int _currentPos;

	public int Channels { get; set; }

	public int SampleRate { get; set; }

	public int TotalSamples { get; private set; }

	public void AddSamples(float[] samples)
	{
		foreach (float num in samples)
		{
			_currentChunk[_currentPos++] = num;
			TotalSamples++;
			if (_currentPos >= 8192)
			{
				_chunks.Add(_currentChunk);
				_currentChunk = new float[8192];
				_currentPos = 0;
			}
		}
	}

	public float[] GetAllSamples()
	{
		if (_currentPos > 0)
		{
			Array.Resize(ref _currentChunk, _currentPos);
			_chunks.Add(_currentChunk);
			_currentChunk = Array.Empty<float>();
		}
		float[] array = new float[TotalSamples];
		int num = 0;
		foreach (float[] chunk in _chunks)
		{
			Array.Copy(chunk, 0, array, num, chunk.Length);
			num += chunk.Length;
		}
		return array;
	}
}
public interface ILog
{
	void LogInfo(object data);

	void LogWarning(object data);

	void LogError(object data);

	void LogDebug(object data);
}
public static class ObjectTreePrinter
{
	private static HashSet<object> _visitedObjects = new HashSet<object>();

	public static string GetTreeString(object obj)
	{
		if (obj == null)
		{
			return null;
		}
		_visitedObjects.Clear();
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("\n--- Object Tree Struct (" + obj.GetType().Name + ") ---");
		AppendNode(stringBuilder, obj, 0, "ROOT");
		return stringBuilder.ToString();
	}

	private static void AppendNode(StringBuilder sb, object obj, int depth, string name)
	{
		if (obj == null)
		{
			sb.AppendLine(GetIndent(depth) + "└─ " + name + ": null");
			return;
		}
		Type type = obj.GetType();
		string indent = GetIndent(depth);
		if (type.IsPrimitive || type == typeof(string) || (type.IsValueType && !IsEnumerable(type)))
		{
			sb.AppendLine($"{indent}└─ {name} ({type.Name}): {obj}");
			return;
		}
		if (!type.IsValueType && _visitedObjects.Contains(obj))
		{
			sb.AppendLine(indent + "└─ " + name + " (" + type.Name + "): {... Loop Detected ...}");
			return;
		}
		_visitedObjects.Add(obj);
		if (obj is IDictionary dictionary)
		{
			sb.AppendLine($"{indent}└─ {name} ({type.Name}[{dictionary.Count}])");
			{
				foreach (DictionaryEntry item in dictionary)
				{
					string name2 = $"Key: {item.Key}";
					AppendNode(sb, item.Value, depth + 1, name2);
				}
				return;
			}
		}
		if (obj is IEnumerable enumerable)
		{
			int num = ((obj is ICollection collection) ? collection.Count : 0);
			sb.AppendLine($"{indent}└─ {name} ({type.Name}[{num}])");
			int num2 = 0;
			{
				foreach (object item2 in enumerable)
				{
					AppendNode(sb, item2, depth + 1, $"[{num2++}]");
				}
				return;
			}
		}
		sb.AppendLine(indent + "└─ " + name + " (" + type.Name + ")");
		PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public);
		PropertyInfo[] array = properties;
		foreach (PropertyInfo propertyInfo in array)
		{
			try
			{
				object value = propertyInfo.GetValue(obj);
				AppendNode(sb, value, depth + 1, propertyInfo.Name);
			}
			catch (Exception ex)
			{
				sb.AppendLine(indent + "│   └─ " + propertyInfo.Name + ": <Error: " + ex.Message + ">");
			}
		}
	}

	private static string GetIndent(int depth)
	{
		return new string(' ', depth * 4);
	}

	private static bool IsEnumerable(Type type)
	{
		return type != typeof(string) && typeof(IEnumerable).IsAssignableFrom(type);
	}
}
namespace GreyAnnouncer
{
	public class BepInExLogAdapter : ILog
	{
		private readonly ManualLogSource log;

		public BepInExLogAdapter(ManualLogSource log)
		{
			this.log = log;
		}

		public void LogInfo(object data)
		{
			log.LogInfo(data);
		}

		public void LogWarning(object data)
		{
			log.LogWarning(data);
		}

		public void LogError(object data)
		{
			log.LogError(data);
		}

		public void LogDebug(object data)
		{
			log.LogDebug(data);
		}
	}
	internal static class LogManager
	{
		internal static ILog log { get; set; }

		public static void LogInfo(object data)
		{
			log?.LogInfo(data);
		}

		public static void LogWarning(object data)
		{
			log?.LogWarning(data);
		}

		public static void LogError(object data)
		{
			log?.LogError(data);
		}

		public static void LogDebug(object data)
		{
			log?.LogDebug(data);
		}
	}
	[BepInPlugin("greycsont.ultrakill.GreyAnnouncer", "Grey Announcer", "1.3.0")]
	[BepInProcess("ULTRAKILL.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource log;

		private Harmony _harmony;

		private void Awake()
		{
			log = ((BaseUnityPlugin)this).Logger;
			LogManager.log = new BepInExLogAdapter(log);
			LogManager.LogInfo("Plugin greycsont.ultrakill.GreyAnnouncer is loaded!");
			LoadMainModule();
			LoadOptionalModule();
			PatchHarmony();
		}

		private void LoadMainModule()
		{
			BepInExConfig.Initialize(this);
		}

		private void LoadOptionalModule()
		{
			CheckPluginLoaded();
			GreyAnnouncer.RankAnnouncer.RankAnnouncer.Initialize();
		}

		private void PatchHarmony()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			_harmony = new Harmony("greycsont.ultrakill.GreyAnnouncer.harmony");
			_harmony.PatchAll();
		}

		private void CheckPluginLoaded()
		{
			PluginDependencies.LoadIfPluginExists("com.eternalUnion.pluginConfigurator", "PluginConfiguratorEntry", delegate
			{
				ReflectionManager.LoadByReflection("GreyAnnouncer.FrontEnd.PluginConfiguratorEntry", "Initialize");
			});
		}
	}
	internal static class PluginDependencies
	{
		public const string PLUGINCONFIGURATOR_GUID = "com.eternalUnion.pluginConfigurator";

		public static void LoadIfPluginExists(string guid, string moduleName, Action loader)
		{
			if (!Chainloader.PluginInfos.ContainsKey(guid))
			{
				LogManager.LogWarning("Plugin " + guid + " not loaded, skipping " + moduleName);
				return;
			}
			try
			{
				loader?.Invoke();
				LogManager.LogInfo("Loaded optional module: " + moduleName);
			}
			catch (Exception ex)
			{
				LogManager.LogError("Exception while loading " + moduleName + ": " + ex.Message);
			}
		}
	}
	internal static class PluginInfo
	{
		public const string PLUGIN_GUID = "greycsont.ultrakill.GreyAnnouncer";

		public const string PLUGIN_NAME = "Grey Announcer";

		public const string PLUGIN_VERSION = "1.3.0";
	}
}
namespace GreyAnnouncer.Util
{
	public sealed class CoroutineRunner : MonoBehaviour
	{
		private static CoroutineRunner _instance;

		public static CoroutineRunner Instance
		{
			get
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Expected O, but got Unknown
				if ((Object)(object)_instance == (Object)null)
				{
					GameObject val = new GameObject("CoroutineRunner");
					_instance = val.AddComponent<CoroutineRunner>();
					Object.DontDestroyOnLoad((Object)(object)val);
				}
				return _instance;
			}
		}
	}
	public static class FileSystemUtil
	{
		public static void ValidateAndPrepareDirectory(string directoryPath)
		{
			if (!Directory.Exists(directoryPath))
			{
				LogManager.LogWarning("Directory not found: " + directoryPath);
				Directory.CreateDirectory(directoryPath);
			}
		}
	}
	public static class GuidPrefixAdder
	{
		private const string Prefix = "GreyAnnouncer_";

		public static string AddPrefixToGUID(params string[] GUIDs)
		{
			if (GUIDs == null || GUIDs.Length == 0)
			{
				throw new ArgumentException("At least one key must be provided.", "GUIDs");
			}
			string text = string.Join("_", GUIDs).ToUpper();
			return "GreyAnnouncer_" + text;
		}
	}
	public static class JsonManager
	{
		public static T ReadJson<T>(string jsonName) where T : class
		{
			ValidateJsonName(jsonName);
			PathManager.EnsureDirectoryExists(PathManager.GetCurrentPluginPath());
			string currentPluginPath = PathManager.GetCurrentPluginPath(jsonName);
			string directoryName = Path.GetDirectoryName(currentPluginPath);
			if (!Directory.Exists(directoryName))
			{
				LogManager.LogError("JSON '" + jsonName + "' not found at path: " + directoryName);
				return null;
			}
			return DeserializeJson<T>(currentPluginPath, jsonName);
		}

		public static T CreateJson<T>(string jsonName, T data) where T : class
		{
			ValidateJsonName(jsonName);
			PathManager.EnsureDirectoryExists(PathManager.GetCurrentPluginPath());
			string currentPluginPath = PathManager.GetCurrentPluginPath(jsonName);
			string directoryName = Path.GetDirectoryName(currentPluginPath);
			if (Directory.Exists(directoryName))
			{
				LogManager.LogError("JSON '" + jsonName + "' already exists at path: " + directoryName);
				return null;
			}
			return SerializeAndSaveJson(currentPluginPath, jsonName, data);
		}

		public static T WriteJson<T>(string jsonName, T data) where T : class
		{
			ValidateJsonName(jsonName);
			string currentPluginPath = PathManager.GetCurrentPluginPath(jsonName);
			string directoryName = Path.GetDirectoryName(currentPluginPath);
			if (!Directory.Exists(directoryName))
			{
				Directory.CreateDirectory(directoryName);
			}
			return SerializeAndSaveJson(currentPluginPath, jsonName, data);
		}

		private static void ValidateJsonName(string jsonName)
		{
			if (string.IsNullOrEmpty(jsonName))
			{
				throw new ArgumentException("JSON file name cannot be null or empty");
			}
		}

		private static T DeserializeJson<T>(string path, string name) where T : class
		{
			try
			{
				string text = File.ReadAllText(path);
				T val = JsonConvert.DeserializeObject<T>(text);
				if (val == null)
				{
					throw new InvalidOperationException("Failed to deserialize JSON file '" + name + "' into type " + typeof(T).Name);
				}
				return val;
			}
			catch (Exception ex)
			{
				LogManager.LogError("Error reading JSON file '" + name + "': " + ex.Message);
				throw;
			}
		}

		private static T SerializeAndSaveJson<T>(string path, string name, T data) where T : class
		{
			try
			{
				string contents = JsonConvert.SerializeObject((object)data, (Formatting)1);
				File.WriteAllText(path, contents);
				LogManager.LogInfo("Writed JSON file '" + name + "' at path: " + path);
				return data;
			}
			catch (Exception ex)
			{
				LogManager.LogError("Error writing JSON file '" + name + "': " + ex.Message);
				throw;
			}
		}
	}
	public static class PathManager
	{
		public static string GetCurrentPluginPath(params string[] paths)
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			return CleanPath((paths == null || paths.Length == 0) ? directoryName : Path.Combine(directoryName, Path.Combine(paths)));
		}

		public static string GetGamePath(string filePath)
		{
			return CleanPath(Path.Combine(Paths.GameRootPath, filePath));
		}

		[Description("Reference : (因win程序员想偷懒! 竟在剪切板插入隐藏字符) https://www.bilibili.com/video/BV1ebLczjEWZ (Accessed in 24/4/2025)")]
		public static string CleanPath(string path)
		{
			if (string.IsNullOrEmpty(path))
			{
				return path;
			}
			char[] trimChars = new char[5] { '\u202a', '\u202b', '\u202c', '\u202d', '\u202e' };
			string text = path.TrimStart(trimChars);
			if (!path.Equals(text))
			{
				LogManager.LogInfo("Path cleaned: Original='" + path + "', Cleaned='" + text + "'");
			}
			return text;
		}

		[Description("Reference : (C# 判断操作系统是 Windows 还是 Linux - 青叶煮酒 - 博客园, 11/1/2022) https://www.cnblogs.com/dhqy/p/15787463.html (Accessed in 25/4/2025)")]
		public static void OpenDirectory(string path)
		{
			if (!string.IsNullOrEmpty(path) && Directory.Exists(path))
			{
				if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
				{
					Process.Start("explorer.exe", path);
				}
				else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
				{
					Process.Start("xdg-open", path);
				}
				else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
				{
					Process.Start("open", path);
				}
				else
				{
					LogManager.LogWarning("Unsupported OS platform.");
				}
			}
			else
			{
				LogManager.LogWarning("The path is not valid or the directory does not exist.");
			}
		}

		public static string GetFile(string filePath, string fileName)
		{
			string text = Path.Combine(filePath, fileName);
			if (File.Exists(text))
			{
				return text;
			}
			return null;
		}

		internal static string FindExecutable(string envVariable, string fallbackPath = null)
		{
			string environmentVariable = Environment.GetEnvironmentVariable(envVariable);
			if (!string.IsNullOrEmpty(environmentVariable) && Directory.Exists(environmentVariable))
			{
				string path = Path.Combine(environmentVariable, envVariable + ".exe");
				if (File.Exists(path))
				{
					return environmentVariable;
				}
			}
			string environmentVariable2 = Environment.GetEnvironmentVariable("PATH");
			if (!string.IsNullOrEmpty(environmentVariable2))
			{
				string[] array = environmentVariable2.Split(new char[1] { ';' });
				string[] array2 = array;
				foreach (string text in array2)
				{
					if (!string.IsNullOrWhiteSpace(text))
					{
						string path2 = Path.Combine(text, envVariable + ".exe");
						if (File.Exists(path2))
						{
							return text;
						}
					}
				}
			}
			if (!string.IsNullOrEmpty(fallbackPath) && Directory.Exists(fallbackPath))
			{
				return fallbackPath;
			}
			return null;
		}

		public static void EnsureDirectoryExists(string filePath)
		{
			string directoryName = Path.GetDirectoryName(filePath);
			if (!Directory.Exists(directoryName))
			{
				Directory.CreateDirectory(directoryName);
			}
		}
	}
	public static class ReflectionManager
	{
		public static void LoadByReflection(string assemblyName, string methodName, object[] parameter = null)
		{
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				Type type = executingAssembly.GetType(assemblyName);
				type.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public)?.Invoke(null, parameter);
			}
			catch (Exception arg)
			{
				LogManager.LogError($"Failed to load {assemblyName}'s {methodName} by : {arg}");
			}
		}
	}
	public static class UnityPathManager
	{
		public static Canvas FindCanvas()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
			foreach (GameObject val in rootGameObjects)
			{
				Canvas component = val.GetComponent<Canvas>();
				if ((Object)(object)component != (Object)null)
				{
					return component;
				}
			}
			return null;
		}
	}
}
namespace GreyAnnouncer.Util.Ini
{
	public sealed class IniDocument
	{
		public Dictionary<string, IniSection> Sections { get; } = new Dictionary<string, IniSection>(StringComparer.OrdinalIgnoreCase);


		public bool TryGetSection(string name, out IniSection section)
		{
			return Sections.TryGetValue(name, out section);
		}
	}
	public sealed class IniSection
	{
		public string Name { get; }

		public Dictionary<string, List<string>> Values { get; } = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);


		public IniSection(string name)
		{
			Name = name;
		}

		public IEnumerable<string> GetValues(string key)
		{
			IEnumerable<string> result;
			if (!Values.TryGetValue(key, out var value))
			{
				IEnumerable<string> enumerable = Array.Empty<string>();
				result = enumerable;
			}
			else
			{
				IEnumerable<string> enumerable = value;
				result = enumerable;
			}
			return result;
		}

		public string GetLastValue(string key)
		{
			List<string> value;
			return (Values.TryGetValue(key, out value) && value.Count > 0) ? value[value.Count - 1] : null;
		}
	}
	[AttributeUsage(AttributeTargets.Property)]
	public sealed class IniKeyAttribute : Attribute
	{
		public string KeyName { get; }

		public IniKeyAttribute(string keyName)
		{
			KeyName = keyName;
		}
	}
	public static class IniMapper
	{
		public static T FromIni<T>(IniDocument doc, string sectionPrefix = null) where T : new()
		{
			T val = new T();
			Type typeFromHandle = typeof(T);
			PropertyInfo[] properties = typeFromHandle.GetProperties(BindingFlags.Instance | BindingFlags.Public);
			foreach (PropertyInfo propertyInfo in properties)
			{
				IniKeyAttribute customAttribute = propertyInfo.GetCustomAttribute<IniKeyAttribute>();
				if (customAttribute == null)
				{
					continue;
				}
				IniSection section = null;
				if (sectionPrefix == null)
				{
					doc.TryGetSection("General", out section);
				}
				else
				{
					doc.TryGetSection(sectionPrefix, out section);
				}
				if (section == null)
				{
					continue;
				}
				object obj = null;
				List<string> list = section.GetValues(customAttribute.KeyName).SelectMany((string v) => from s in v.Split(new char[1] { ',' })
					select s.Trim() into s
					where s.Length > 0
					select s).ToList();
				if (propertyInfo.PropertyType == typeof(List<string>))
				{
					obj = list;
				}
				else
				{
					string text = list.LastOrDefault();
					if (text == null)
					{
						continue;
					}
					if (propertyInfo.PropertyType == typeof(string))
					{
						obj = text;
					}
					else if (propertyInfo.PropertyType == typeof(bool))
					{
						obj = bool.TryParse(text, out var result) && result;
					}
					else if (propertyInfo.PropertyType == typeof(float))
					{
						obj = (float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2) ? result2 : 0f);
					}
				}
				if (obj != null)
				{
					propertyInfo.SetValue(val, obj);
				}
			}
			return val;
		}

		public static IniDocument ToIni<T>(IniDocument doc, T obj, string sectionName)
		{
			if (!doc.Sections.TryGetValue(sectionName, out var value))
			{
				value = new IniSection(sectionName);
				doc.Sections[sectionName] = value;
			}
			PropertyInfo[] properties = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public);
			foreach (PropertyInfo propertyInfo in properties)
			{
				IniKeyAttribute customAttribute = propertyInfo.GetCustomAttribute<IniKeyAttribute>();
				if (customAttribute == null)
				{
					continue;
				}
				object value2 = propertyInfo.GetValue(obj);
				if (value2 != null)
				{
					if (value2 is List<string> values)
					{
						value.Values[customAttribute.KeyName] = new List<string> { string.Join(", ", values) };
					}
					else
					{
						value.Values[customAttribute.KeyName] = new List<string> { value2.ToString() };
					}
				}
			}
			return doc;
		}
	}
	public static class IniReader
	{
		public static IniDocument Read(string path)
		{
			IniDocument iniDocument = new IniDocument();
			if (!File.Exists(path))
			{
				return iniDocument;
			}
			IniSection value = null;
			foreach (string item in File.ReadLines(path))
			{
				string text = item.Trim();
				if (string.IsNullOrWhiteSpace(text) || text.StartsWith("//"))
				{
					continue;
				}
				if (text.StartsWith("[") && text.EndsWith("]"))
				{
					string text2 = text.Substring(1, text.Length - 2).Trim();
					if (text2.Length != 0 && !iniDocument.Sections.TryGetValue(text2, out value))
					{
						value = new IniSection(text2);
						iniDocument.Sections[text2] = value;
					}
				}
				else
				{
					if (value == null)
					{
						continue;
					}
					int num = text.IndexOf(':');
					if (num < 0)
					{
						num = text.IndexOf('=');
					}
					if (num <= 0)
					{
						continue;
					}
					string text3 = text.Substring(0, num).Trim();
					string text4 = text.Substring(num + 1).Trim();
					if (text3.Length == 0)
					{
						continue;
					}
					if (!value.Values.TryGetValue(text3, out var value2))
					{
						value2 = new List<string>();
						value.Values[text3] = value2;
					}
					if (text4.Length != 0)
					{
						IEnumerable<string> collection = from x in text4.Split(new char[1] { ',' })
							select x.Trim() into x
							where x.Length > 0
							select x;
						value2.AddRange(collection);
					}
				}
			}
			return iniDocument;
		}
	}
	public static class IniWriter
	{
		public static void Write(string path, IniDocument doc)
		{
			PathManager.EnsureDirectoryExists(path);
			using StreamWriter streamWriter = new StreamWriter(path, append: false);
			foreach (KeyValuePair<string, IniSection> section in doc.Sections)
			{
				IniSection value = section.Value;
				streamWriter.WriteLine("[" + value.Name + "]");
				foreach (KeyValuePair<string, List<string>> value2 in value.Values)
				{
					foreach (string item in value2.Value)
					{
						streamWriter.WriteLine(value2.Key + ": " + item);
					}
				}
				streamWriter.WriteLine();
			}
		}
	}
}
namespace GreyAnnouncer.RankAnnouncer
{
	public static class RankAnnouncer
	{
		private static readonly List<string> category = new List<string> { "Destruction", "Chaotic", "Brutal", "Anarchic", "Supreme", "SSadistic", "SSShitstorm", "ULTRAKILL" };

		private static AudioAnnouncer _announcer;

		private static readonly string _title = "RankAnnouncer";

		public static void Initialize()
		{
			_announcer = new AudioAnnouncer(new AudioLoader(), new CooldownManager(category.ToArray()), category, _title);
		}

		public static void PlayRankSound(int rank)
		{
			_announcer.PlayAudioViaCategory(category[rank]);
		}
	}
	[HarmonyPatch(typeof(StyleHUD))]
	public static class StyleHUDPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("AscendRank")]
		public static void GetNonDrankAscend(StyleHUD __instance)
		{
			int rankIndex = __instance.rankIndex;
			if (rankIndex >= 0 && rankIndex <= 7)
			{
				RankAnnouncer.PlayRankSound(rankIndex);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ComboStart")]
		public static void GetDrank(StyleHUD __instance)
		{
			if (__instance.rankIndex == 0)
			{
				RankAnnouncer.PlayRankSound(0);
			}
		}
	}
}
namespace GreyAnnouncer.FrontEnd
{
	public static class MainPanelBuilder
	{
		private enum PlayOptions
		{
			Override_Last,
			Independent
		}

		private enum audioLoadingOptions
		{
			Load_then_Play,
			Preload_and_Play
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static OnValueChangeEventDelegate <>9__11_0;

			public static EnumValueChangeEventDelegate<PlayOptions> <>9__11_1;

			public static EnumValueChangeEventDelegate<audioLoadingOptions> <>9__11_2;

			public static OnClick <>9__11_3;

			public static OnClick <>9__11_4;

			public static OnClick <>9__11_5;

			public static BoolValueChangeEventDelegate <>9__12_0;

			public static BoolValueChangeEventDelegate <>9__12_1;

			public static OnClick <>9__12_2;

			public static Action<string> <>9__15_0;

			internal void <CreateAudioControls>b__11_0(FloatSliderValueChangeEvent e)
			{
				BepInExConfig.audioSourceVolume.Value = e.newValue;
				SoloAudioSource.Instance.UpdateSoloAudioSourceVolume(e.newValue);
			}

			internal void <CreateAudioControls>b__11_1(EnumValueChangeEvent<PlayOptions> e)
			{
				BepInExConfig.audioPlayOptions.Value = (int)e.value;
			}

			internal void <CreateAudioControls>b__11_2(EnumValueChangeEvent<audioLoadingOptions> e)
			{
				BepInExConfig.audioLoadingStategy.Value = (int)e.value;
				if (e.value.Equals(audioLoadingOptions.Load_then_Play))
				{
					LogManager.LogInfo("Clear audio clip cache");
					ClearAudioClipsCache();
				}
				if (e.value.Equals(audioLoadingOptions.Preload_and_Play))
				{
					LogManager.LogInfo("Reloading all announcer audio");
					ReloadAllAnnouncers();
				}
			}

			internal void <CreateAudioControls>b__11_3()
			{
				AnnouncerManager.ReloadAllAnnouncers();
			}

			internal void <CreateAudioControls>b__11_4()
			{
				advancedPanel.OpenPanel();
			}

			internal void <CreateAudioControls>b__11_5()
			{
				creditPanel.OpenPanel();
			}

			internal void <CreateAdvancedOptionPanel>b__12_0(BoolValueChangeEvent e)
			{
				BepInExConfig.isLowPassFilterEnabled.Value = e.value;
				UnderwaterController_inWater_Instance.CheckIsInWater();
			}

			internal void <CreateAdvancedOptionPanel>b__12_1(BoolValueChangeEvent e)
			{
				BepInExConfig.isFFmpegSupportEnabled.Value = e.value;
				LogManager.LogInfo($"Switched FFmpeg support : {e.value}");
			}

			internal void <CreateAdvancedOptionPanel>b__12_2()
			{
				AudioSourceManager.StopAllAudioSource();
			}

			internal void <CreateDelegateTextFromBackEnd>b__15_0(string log)
			{
				audioLoaderLogHeader.text = log + "\n";
			}
		}

		private static readonly Color m_greyColour = new Color(0.85f, 0.85f, 0.85f, 1f);

		private static readonly Color m_CyanColour = new Color(0f, 1f, 1f, 1f);

		private static readonly Color m_OrangeColour = new Color(1f, 0.6f, 0.2f, 1f);

		private static readonly Color m_RedColour = new Color(1f, 0f, 0f, 1f);

		private static readonly Color m_PurpleColour = new Color(1f, 0f, 1f, 1f);

		private static PluginConfigurator m_pluginConfigurator;

		public static ConfigHeader audioLoaderLogHeader;

		private static ConfigPanel advancedPanel;

		private static ConfigPanel creditPanel;

		public static void Build(PluginConfigurator config)
		{
			m_pluginConfigurator = config;
			CreateMainSettingSectionTitle();
			CreateAudioControls();
			CreateAdvancedOptionPanel();
			CreateCreditsPanel();
			CreateAnnouncerSection();
			CreateDelegateTextFromBackEnd();
		}

		private static void CreateMainSettingSectionTitle()
		{
			//IL_0010: 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_002d: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			new ConfigSpace(m_pluginConfigurator.rootPanel, 15f);
			ConfigHeader val = new ConfigHeader(m_pluginConfigurator.rootPanel, "Main Settings", 24);
			val.textColor = m_CyanColour;
		}

		private static void CreateAudioControls()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Expected O, but got Unknown
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			FloatSliderField val = new FloatSliderField(m_pluginConfigurator.rootPanel, "Master Volume", "Audio_Volume", Tuple.Create(0f, 1f), BepInExConfig.audioSourceVolume.Value, 2);
			val.defaultValue = BepInExConfig.DEFAULT_AUDIO_SOURCE_VOLUME;
			object obj = <>c.<>9__11_0;
			if (obj == null)
			{
				OnValueChangeEventDelegate val2 = delegate(FloatSliderValueChangeEvent e)
				{
					BepInExConfig.audioSourceVolume.Value = e.newValue;
					SoloAudioSource.Instance.UpdateSoloAudioSourceVolume(e.newValue);
				};
				<>c.<>9__11_0 = val2;
				obj = (object)val2;
			}
			val.onValueChange += (OnValueChangeEventDelegate)obj;
			EnumField<PlayOptions> val3 = new EnumField<PlayOptions>(m_pluginConfigurator.rootPanel, "Audio Play Strategy", "Audio_Play_Strategy", (PlayOptions)BepInExConfig.audioPlayOptions.Value);
			val3.defaultValue = (PlayOptions)BepInExConfig.DEFAULT_AUDIO_PLAY_OPTIONS;
			val3.onValueChange += delegate(EnumValueChangeEvent<PlayOptions> e)
			{
				BepInExConfig.audioPlayOptions.Value = (int)e.value;
			};
			EnumField<audioLoadingOptions> val4 = new EnumField<audioLoadingOptions>(m_pluginConfigurator.rootPanel, "Audio Load Strategy", "Audio_Load_Strategy", (audioLoadingOptions)BepInExConfig.audioLoadingStategy.Value);
			val4.defaultValue = (audioLoadingOptions)BepInExConfig.DEFAULT_AUDIO_LOADING_OPTIONS;
			val4.onValueChange += delegate(EnumValueChangeEvent<audioLoadingOptions> e)
			{
				BepInExConfig.audioLoadingStategy.Value = (int)e.value;
				if (e.value.Equals(audioLoadingOptions.Load_then_Play))
				{
					LogManager.LogInfo("Clear audio clip cache");
					ClearAudioClipsCache();
				}
				if (e.value.Equals(audioLoadingOptions.Preload_and_Play))
				{
					LogManager.LogInfo("Reloading all announcer audio");
					ReloadAllAnnouncers();
				}
			};
			new ConfigSpace(m_pluginConfigurator.rootPanel, 7f);
			ButtonArrayField val5 = new ButtonArrayField(m_pluginConfigurator.rootPanel, "audio_button_array", 3, new float[3] { 0.4f, 0.4f, 0.2f }, new string[3] { "Reload", "Advance", "Credit" }, 5f);
			ButtonClickEvent obj2 = val5.OnClickEventHandler(0);
			object obj3 = <>c.<>9__11_3;
			if (obj3 == null)
			{
				OnClick val6 = delegate
				{
					AnnouncerManager.ReloadAllAnnouncers();
				};
				<>c.<>9__11_3 = val6;
				obj3 = (object)val6;
			}
			obj2.onClick += (OnClick)obj3;
			ButtonClickEvent obj4 = val5.OnClickEventHandler(1);
			object obj5 = <>c.<>9__11_4;
			if (obj5 == null)
			{
				OnClick val7 = delegate
				{
					advancedPanel.OpenPanel();
				};
				<>c.<>9__11_4 = val7;
				obj5 = (object)val7;
			}
			obj4.onClick += (OnClick)obj5;
			ButtonClickEvent obj6 = val5.OnClickEventHandler(2);
			object obj7 = <>c.<>9__11_5;
			if (obj7 == null)
			{
				OnClick val8 = delegate
				{
					creditPanel.OpenPanel();
				};
				<>c.<>9__11_5 = val8;
				obj7 = (object)val8;
			}
			obj6.onClick += (OnClick)obj7;
		}

		private static void CreateAdvancedOptionPanel()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0035: 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_005a: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			advancedPanel = new ConfigPanel(m_pluginConfigurator.rootPanel, "Advanced", "Advanced_Option");
			((ConfigField)advancedPanel).hidden = true;
			new ConfigSpace(advancedPanel, 15f);
			BoolField val = new BoolField(advancedPanel, "LowPassFilter when under water", "LowPassFilter_Enabled", BepInExConfig.isLowPassFilterEnabled.Value);
			val.defaultValue = true;
			object obj = <>c.<>9__12_0;
			if (obj == null)
			{
				BoolValueChangeEventDelegate val2 = delegate(BoolValueChangeEvent e)
				{
					BepInExConfig.isLowPassFilterEnabled.Value = e.value;
					UnderwaterController_inWater_Instance.CheckIsInWater();
				};
				<>c.<>9__12_0 = val2;
				obj = (object)val2;
			}
			val.onValueChange += (BoolValueChangeEventDelegate)obj;
			BoolField val3 = new BoolField(advancedPanel, "FFmpeg Support", "FFmpeg_Support", BepInExConfig.isFFmpegSupportEnabled.Value);
			val3.defaultValue = false;
			object obj2 = <>c.<>9__12_1;
			if (obj2 == null)
			{
				BoolValueChangeEventDelegate val4 = delegate(BoolValueChangeEvent e)
				{
					BepInExConfig.isFFmpegSupportEnabled.Value = e.value;
					LogManager.LogInfo($"Switched FFmpeg support : {e.value}");
				};
				<>c.<>9__12_1 = val4;
				obj2 = (object)val4;
			}
			val3.onValueChange += (BoolValueChangeEventDelegate)obj2;
			ConfigHeader val5 = new ConfigHeader(advancedPanel, "To Endabled this will try to load unknown audio/video to AudioClip via FFmpeg\n makesure there's a executable in environment path `ffmpeg` or `PATH`\n\n ", 24);
			val5.tmpAnchor = (TextAlignmentOptions)258;
			val5.textSize = 12;
			val5.textColor = m_greyColour;
			new ConfigSpace(m_pluginConfigurator.rootPanel, 15f);
			ConfigHeader val6 = new ConfigHeader(advancedPanel, "Emergency", 24);
			val6.textColor = m_RedColour;
			ButtonField val7 = new ButtonField(advancedPanel, "Stop All Audio Source", "Stop_All_Audio_Source");
			object obj3 = <>c.<>9__12_2;
			if (obj3 == null)
			{
				OnClick val8 = delegate
				{
					AudioSourceManager.StopAllAudioSource();
				};
				<>c.<>9__12_2 = val8;
				obj3 = (object)val8;
			}
			val7.onClick += (OnClick)obj3;
		}

		private static void CreateCreditsPanel()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			creditPanel = new ConfigPanel(m_pluginConfigurator.rootPanel, "Credits", "Credits");
			((ConfigField)creditPanel).hidden = true;
			new ConfigSpace(creditPanel, 15f);
			ConfigHeader val = new ConfigHeader(creditPanel, "Credits", 24);
			val.textColor = m_PurpleColour;
			new ConfigSpace(creditPanel, 20f);
			ConfigHeader val2 = new ConfigHeader(creditPanel, "", 24);
			val2.tmpAnchor = (TextAlignmentOptions)257;
			val2.textSize = 20;
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("Thanks:\nhttps://unsplash.com/photos/white-textile-on-brown-wooden-table-_kUxT8WkoeY?utm_source=unsplash&utm_medium=referral&utm_content=creditShareLink");
			stringBuilder.AppendLine("\n- OSU! \n(https://osu.ppy.sh/) some UX are copied from lazer(YES EDIT EXTERNALLY), use .ini as config cuz `skin.ini` is pretty easy to edit");
			stringBuilder.AppendLine("\n- Artless Games \n(https://space.bilibili.com/1237125233) 14 Minesweeper variants");
			stringBuilder.AppendLine("\n- Announcer Mod \n(https://www.nexusmods.com/ultrakill/mods/54) I started of this project is just because the mod isn't update in the few days after revamp");
			stringBuilder.AppendLine("\n- PluginConfigurator doc \n(https://github.com/eternalUnion/UKPluginConfigurator/wiki) Easy to use tbh (except changing font)");
			stringBuilder.AppendLine("\n- Maxwell's puzzling demon \n(https://store.steampowered.com/app/2770160/) Fun puzzle game");
			stringBuilder.AppendLine("\n- 快乐萨卡兹厨, jamcame, 夕柱.");
			stringBuilder.AppendLine("\n");
			stringBuilder.AppendLine("\n- Everyone who used this mod.");
			stringBuilder.AppendLine("\n\n\n\n");
			stringBuilder.AppendLine("\n- FUCK YOU UNITY.");
			stringBuilder.AppendLine("\n\n\n\n\n\n\n\n\n");
			stringBuilder.AppendLine("Turn up the bass!\nTHWWWWOOOOOMPPPP DHGDHGDHGDHGDHGDHG BWOBWOBWOBWOB BWOBWOBWOBWOB BWOBWOBWOBWOBWOB BWAHH BWAHH BWAHH HMRMRMRMRMRMRMRMMR WOH WOH WOH- H H H HHHHH THWWOOMPPPP DHGDHGDHGDHGDHGDHG BWOBWOBWOBWOB.. BWOBWOBWOBWOB.. BWOBWOBWOBWOBWOB.... HRMMMMMMMMMMMMMMMMRRR- HRRRRRRR HRRRRRRRR HRRRRRR HRRRRRRRR HRRR HR-YOOOH!!!!!!\n\n- shadow of cats");
			val2.text = stringBuilder.ToString();
		}

		private static void CreateAnnouncerSection()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			ConfigHeader val = new ConfigHeader(m_pluginConfigurator.rootPanel, "Announcer Section", 24);
			val.textColor = m_OrangeColour;
			audioLoaderLogHeader = new ConfigHeader(m_pluginConfigurator.rootPanel, "", 24);
			audioLoaderLogHeader.tmpAnchor = (TextAlignmentOptions)257;
			audioLoaderLogHeader.textSize = 12;
			audioLoaderLogHeader.textColor = m_CyanColour;
		}

		private static void CreateDelegateTextFromBackEnd()
		{
			AudioLoader.onPluginConfiguratorLogUpdated = delegate(string log)
			{
				audioLoaderLogHeader.text = log + "\n";
			};
		}

		private static void ReloadAllAnnouncers()
		{
			audioLoaderLogHeader.text = string.Empty;
			AnnouncerManager.ReloadAllAnnouncers();
		}

		private static void ClearAudioClipsCache()
		{
			audioLoaderLogHeader.text = string.Empty;
			AnnouncerManager.ClearAudioClipsCache();
		}
	}
	[Description("This object is loaded via reflection from Plugin.cs")]
	public static class PluginConfiguratorEntry
	{
		private static PluginConfigurator _config;

		public static PluginConfigurator config
		{
			get
			{
				return _config;
			}
			private set
			{
				_config = value;
			}
		}

		public static void Initialize()
		{
			CreatePluginPages();
			MainPanelBuilder.Build(_config);
		}

		private static void CreatePluginPages()
		{
			_config = PluginConfigurator.Create("Grey Announcer", "greycsont.ultrakill.GreyAnnouncer");
			_config.SetIconWithURL(PathManager.GetCurrentPluginPath("icon.png"));
		}
	}
	public class RegistedAnnouncerPage
	{
		private PluginConfigurator _pluginConfigurator;

		private string _title;

		private AudioAnnouncer _audioAnnouncer;

		private AnnouncerConfigFields _fields = new AnnouncerConfigFields
		{
			CategoryFields = new Dictionary<string, CategoryFields>()
		};

		private static readonly Color HeaderColor = new Color(0.85f, 0.85f, 0.85f, 1f);

		public void Build(string title, AudioAnnouncer audioAnnouncer)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Expected O, but got Unknown
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			_pluginConfigurator = PluginConfiguratorEntry.config;
			_title = title;
			_audioAnnouncer = audioAnnouncer;
			ConfigPanel val = new ConfigPanel(_pluginConfigurator.rootPanel, _title, _title);
			new ConfigSpace(val, 15f);
			ConfigHeader val2 = new ConfigHeader(val, _title, 30);
			val2.textColor = HeaderColor;
			List<string> list = Directory.GetDirectories(AnnouncerIndex.announcersPath).Select(Path.GetFileName).ToList();
			StringListField val3 = new StringListField(val, "Selected Announcer", "Selected_Announcer", list, list.FirstOrDefault() ?? "default");
			ButtonField val4 = new ButtonField(val, "Open Current Announcer Folder", "Open_Current_Announcer_Folder");
			val4.onClick += (OnClick)delegate
			{
				_audioAnnouncer.EditExternally();
			};
			val3.onValueChange += (StringListValueChangeEventDelegate)delegate(StringListValueChangeEvent e)
			{
				audioAnnouncer.announcerPath = Path.Combine(AnnouncerIndex.announcersPath, e.value);
			};
			new ConfigSpace(val, 15f);
			ConfigHeader val5 = new ConfigHeader(val, "Configuration", 24);
			_fields.RandomizeAudioField = new BoolField(val, "Randomize Audio On Play", GuidPrefixAdder.AddPrefixToGUID("RandomizeAudioOnPlay", _title), _audioAnnouncer.announcerConfig.RandomizeAudioOnPlay);
			_fields.RandomizeAudioField.defaultValue = false;
			_fields.RandomizeAudioField.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e)
			{
				_audioAnnouncer.announcerConfig.RandomizeAudioOnPlay = e.value;
			};
			foreach (KeyValuePair<string, CategorySetting> item in _audioAnnouncer.announcerConfig.CategorySetting)
			{
				string key = item.Key;
				ConfigHeader val6 = new ConfigHeader(val, item.Key, 24);
				val6.textColor = new Color(0f, 1f, 1f);
				CategoryFields value = new CategoryFields
				{
					Enabled = CreateEnabledField(val, key, _audioAnnouncer.announcerConfig, defaultValue: true),
					Volume = CreateVolumeField(val, key, _audioAnnouncer.announcerConfig, 1f),
					Cooldown = CreateCooldownField(val, key, _audioAnnouncer.announcerConfig, 3f)
				};
				_fields.CategoryFields[key] = value;
			}
		}

		private BoolField CreateEnabledField(ConfigPanel panel, string guid, AnnouncerConfig AnnouncerConfig, bool defaultValue)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			string text = GuidPrefixAdder.AddPrefixToGUID(guid, "Enabled");
			BoolField val = new BoolField(panel, "Enabled", text, AnnouncerConfig.CategorySetting[guid].Enabled);
			val.defaultValue = defaultValue;
			val.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e)
			{
				if (AnnouncerConfig.CategorySetting.ContainsKey(guid))
				{
					AnnouncerConfig.CategorySetting[guid].Enabled = e.value;
				}
			};
			return val;
		}

		private FloatField CreateVolumeField(ConfigPanel panel, string guid, AnnouncerConfig AnnouncerConfig, float defaultValue)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			string text = GuidPrefixAdder.AddPrefixToGUID(guid, "VolumeMultiplier");
			FloatField val = new FloatField(panel, "Volume", text, AnnouncerConfig.CategorySetting[guid].VolumeMultiplier);
			val.defaultValue = defaultValue;
			val.onValueChange += (FloatValueChangeEventDelegate)delegate(FloatValueChangeEvent e)
			{
				if (AnnouncerConfig.CategorySetting.ContainsKey(guid))
				{
					AnnouncerConfig.CategorySetting[guid].VolumeMultiplier = e.value;
				}
			};
			return val;
		}

		private FloatSliderField CreateCooldownField(ConfigPanel panel, string guid, AnnouncerConfig AnnouncerConfig, float defaultValue)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			string text = GuidPrefixAdder.AddPrefixToGUID(guid, "Cooldown");
			FloatSliderField val = new FloatSliderField(panel, "Cooldown", text, Tuple.Create(0.2f, 6f), AnnouncerConfig.CategorySetting[guid].Cooldown, 1);
			val.defaultValue = defaultValue;
			val.onValueChange += (OnValueChangeEventDelegate)delegate(FloatSliderValueChangeEvent e)
			{
				if (AnnouncerConfig.CategorySetting.ContainsKey(guid))
				{
					AnnouncerConfig.CategorySetting[guid].Cooldown = e.newValue;
				}
			};
			return val;
		}

		public void ApplyConfigToUI(AnnouncerConfig config)
		{
			LogManager.LogDebug("ApplyConfigToUI called");
			if (_fields.RandomizeAudioField != null)
			{
				_fields.RandomizeAudioField.value = config.RandomizeAudioOnPlay;
			}
			foreach (KeyValuePair<string, CategoryFields> categoryField in _fields.CategoryFields)
			{
				string key = categoryField.Key;
				CategoryFields value = categoryField.Value;
				if (config.CategorySetting.TryGetValue(key, out var value2))
				{
					if (value.Enabled.value != value2.Enabled)
					{
						LogManager.LogDebug($"Category '{key}': Enabled changed from {value.Enabled.value} -> {value2.Enabled}");
					}
					else
					{
						LogManager.LogDebug($"Category '{key}': Enabled unchanged ({value.Enabled.value})");
					}
					if (Math.Abs(value.Volume.value - value2.VolumeMultiplier) > 0.0001f)
					{
						LogManager.LogDebug($"Category '{key}': Volume changed from {value.Volume.value} -> {value2.VolumeMultiplier}");
					}
					else
					{
						LogManager.LogDebug($"Category '{key}': Volume unchanged ({value.Volume.value})");
					}
					if (Math.Abs(value.Cooldown.value - value2.Cooldown) > 0.0001f)
					{
						LogManager.LogDebug($"Category '{key}': Cooldown changed from {value.Cooldown.value} -> {value2.Cooldown}");
					}
					else
					{
						LogManager.LogDebug($"Category '{key}': Cooldown unchanged ({value.Cooldown.value})");
					}
					value.Enabled.value = value2.Enabled;
					value.Volume.value = value2.VolumeMultiplier;
					value.Cooldown.value = value2.Cooldown;
				}
			}
		}
	}
	public class CategoryFields
	{
		public BoolField Enabled;

		public FloatField Volume;

		public FloatSliderField Cooldown;
	}
	public class AnnouncerConfigFields
	{
		public BoolField RandomizeAudioField;

		public Dictionary<string, CategoryFields> CategoryFields;
	}
	public static class AssetBundleUI
	{
		public static AssetBundle bundle;

		public static string bundlePath = PathManager.GetCurrentPluginPath("ui");

		public static void CreateUI()
		{
			LogManager.LogInfo("Loading");
			if ((Object)(object)bundle == (Object)null)
			{
				bundle = AssetBundle.LoadFromFile(bundlePath);
			}
			GameObject val = bundle.LoadAsset<GameObject>("UI");
			if ((Object)(object)val == (Object)null)
			{
				LogManager.LogError("Failed to load UI Prefab!");
				return;
			}
			GameObject val2 = Object.Instantiate<GameObject>(val);
			Canvas val3 = UnityPathManager.FindCanvas();
			if ((Object)(object)val3 != (Object)null)
			{
				val2.transform.SetParent(((Component)val3).transform, false);
				val2.transform.SetAsLastSibling();
				LogManager.LogInfo("UI Loaded!");
				Transform val4 = val2.transform.Find("Mask/VideoPlayer");
				if ((Object)(object)val4 != (Object)null)
				{
					VideoPlayer component = ((Component)val4).GetComponent<VideoPlayer>();
					if ((Object)(object)component == (Object)null)
					{
						LogManager.LogInfo("Fuck VideoPlayer");
						return;
					}
					component.source = (VideoSource)1;
					component.url = PathManager.GetCurrentPluginPath("output_h264.mp4");
					component.Play();
				}
			}
			else
			{
				LogManager.LogWarning("Canvas not found! UI may not display correctly.");
			}
		}
	}
}
namespace GreyAnnouncer.Base
{
	public abstract class NotifyBase : INotifyPropertyChanged
	{
		private bool _suspendNotify = false;

		public event PropertyChangedEventHandler PropertyChanged;

		public void BeginUpdate()
		{
			_suspendNotify = true;
		}

		public void EndUpdate()
		{
			_suspendNotify = false;
		}

		protected bool SetField<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
		{
			if (EqualityComparer<T>.Default.Equals(field, value))
			{
				return false;
			}
			field = value;
			if (!_suspendNotify)
			{
				RaiseChanged(propertyName);
			}
			return true;
		}

		protected void RaiseChanged(string name = null)
		{
			if (!_suspendNotify)
			{
				this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
			}
		}
	}
	public class ObservableDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged where TValue : INotifyPropertyChanged
	{
		private readonly Dictionary<TKey, TValue> _dict = new Dictionary<TKey, TValue>();

		public TValue this[TKey key]
		{
			get
			{
				return _dict[key];
			}
			set
			{
				TValue val2;
				if (_dict.ContainsKey(key))
				{
					TValue val = _dict[key];
					ref TValue reference = ref val;
					val2 = default(TValue);
					if (val2 == null)
					{
						val2 = reference;
						reference = ref val2;
					}
					reference.PropertyChanged -= OnItemPropertyChanged;
					_dict[key] = value;
					ref TValue reference2 = ref value;
					val2 = default(TValue);
					if (val2 == null)
					{
						val2 = reference2;
						reference2 = ref val2;
					}
					reference2.PropertyChanged += OnItemPropertyChanged;
					this.CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, value, val));
					this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Count"));
				}
				else
				{
					_dict[key] = value;
					ref TValue reference3 = ref value;
					val2 = default(TValue);
					if (val2 == null)
					{
						val2 = reference3;
						reference3 = ref val2;
					}
					reference3.PropertyChanged += OnItemPropertyChanged;
					this.CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, value));
					this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Count"));
				}
			}
		}

		public ICollection<TKey> Keys => _dict.Keys;

		public ICollection<TValue> Values => _dict.Values;

		public int Count => _dict.Count;

		public bool IsReadOnly => false;

		public event NotifyCollectionChangedEventHandler CollectionChanged;

		public event PropertyChangedEventHandler PropertyChanged;

		public void Add(TKey key, TValue value)
		{
			this[key] = value;
		}

		public bool Remove(TKey key)
		{
			if (_dict.TryGetValue(key, out var value))
			{
				ref TValue reference = ref value;
				TValue val = default(TValue);
				if (val == null)
				{
					val = reference;
					reference = ref val;
				}
				reference.PropertyChanged -= OnItemPropertyChanged;
				bool flag = _dict.Remove(key);
				if (flag)
				{
					this.CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, value));
					this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Count"));
				}
				return flag;
			}
			return false;
		}

		public bool ContainsKey(TKey key)
		{
			return _dict.ContainsKey(key);
		}

		public bool TryGetValue(TKey key, out TValue value)
		{
			return _dict.TryGetValue(key, out value);
		}

		public void Clear()
		{
			foreach (TValue value in _dict.Values)
			{
				TValue current = value;
				ref TValue reference = ref current;
				TValue val = default(TValue);
				if (val == null)
				{
					val = reference;
					reference = ref val;
				}
				reference.PropertyChanged -= OnItemPropertyChanged;
			}
			_dict.Clear();
			this.CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
			this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Count"));
		}

		private void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e)
		{
			this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Item." + e.PropertyName));
		}

		public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
		{
			return _dict.GetEnumerator();
		}

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

		public void Add(KeyValuePair<TKey, TValue> item)
		{
			Add(item.Key, item.Value);
		}

		public bool Contains(KeyValuePair<TKey, TValue> item)
		{
			return _dict.ContainsKey(item.Key) && _dict[item.Key].Equals(item.Value);
		}

		public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
		{
			throw new NotImplementedException();
		}

		public bool Remove(KeyValuePair<TKey, TValue> item)
		{
			return Remove(item.Key);
		}
	}
}
namespace GreyAnnouncer.Config
{
	public static class BepInExConfig
	{
		public static ConfigEntry<float> audioSourceVolume;

		public static ConfigEntry<bool> isLowPassFilterEnabled;

		public static ConfigEntry<int> audioPlayOptions;

		public static ConfigEntry<int> audioLoadingStategy;

		public static ConfigEntry<bool> isFFmpegSupportEnabled;

		public static readonly Dictionary<string, (string section, string name, object defaultValue, string description)> ConfigEntries = new Dictionary<string, (string, string, object, string)>
		{
			{
				"AudioSourceVolume",
				("Audio", "Audio_source_volume", DEFAULT_AUDIO_SOURCE_VOLUME, "Volume of the Announcer ( Range : 0f ~ 1f )")
			},
			{
				"LowPassFilter",
				("Audio", "Under_water_low_pass_filter_Enabled", DEFAULT_LOW_PASS_FILTER_ENABLED, "Set to true to enable muffle effect when under water")
			},
			{
				"AudioPlayOptions",
				("Audio", "Audio_Play_Option", DEFAULT_AUDIO_PLAY_OPTIONS, "0 : new audio will override the old one, 1 : audio will not effect each other")
			},
			{
				"AudioLoadingOption",
				("Audio", "Audio_Loading_Option", DEFAULT_AUDIO_LOADING_OPTIONS, "0 : load clip from file (less RAM more latency), 1 : preload clip to games (less latency more RAM)")
			},
			{
				"FFmpegSupport",
				("Advance", "FFmpeg_Support", false, "Set to true to enable FFmpeg support for loading non-unity supported audios")
			}
		};

		private static float _defaultAudioSourceVolume = 1f;

		private static bool _defaultLowPassFilterEnabled = true;

		private static int _defaultAudioPlayOptions = 0;

		private static int _defaultAudioLoadingOptions = 0;

		public static float DEFAULT_AUDIO_SOURCE_VOLUME
		{
			get
			{
				return _defaultAudioSourceVolume;
			}
			private set
			{
				_defaultAudioSourceVolume = value;
			}
		}

		public static bool DEFAULT_LOW_PASS_FILTER_ENABLED
		{
			get
			{
				return _defaultLowPassFilterEnabled;
			}
			private set
			{
				_defaultLowPassFilterEnabled = value;
			}
		}

		public static int DEFAULT_AUDIO_PLAY_OPTIONS
		{
			get
			{
				return (_defaultAudioPlayOptions < 2) ? _defaultAudioPlayOptions : 0;
			}
			private set
			{
				_defaultAudioPlayOptions = value;
			}
		}

		public static int DEFAULT_AUDIO_LOADING_OPTIONS
		{
			get
			{
				return (_defaultAudioLoadingOptions < 2) ? _defaultAudioLoadingOptions : 0;
			}
			private set
			{
				_defaultAudioLoadingOptions = value;
			}
		}

		public static void Initialize(Plugin plugin)
		{
			BindConfigEntryValues(plugin);
		}

		private static void BindConfigEntryValues(Plugin plugin)
		{
			foreach (KeyValuePair<string, (string, string, object, string)> configEntry in ConfigEntries)
			{
				BindConfigEntry(plugin, configEntry.Key, configEntry.Value.Item1, configEntry.Value.Item2, configEntry.Value.Item3, configEntry.Value.Item4);
			}
		}

		private static void BindConfigEntry(Plugin plugin, string key, string section, string name, object defaultValue, string description)
		{
			if (defaultValue is bool)
			{
				ConfigEntry<bool> val = ((BaseUnityPlugin)plugin).Config.Bind<bool>(section, name, (bool)defaultValue, description);
				if (name == "Under_water_low_pass_filter_Enabled")
				{
					isLowPassFilterEnabled = val;
				}
				else if (name == "FFmpeg_Support")
				{
					isFFmpegSupportEnabled = val;
				}
			}
			else if (defaultValue is float)
			{
				ConfigEntry<float> val2 = ((BaseUnityPlugin)plugin).Config.Bind<float>(section, name, (float)defaultValue, description);
				if (name == "Audio_source_volume")
				{
					audioSourceVolume = val2;
				}
			}
			else if (defaultValue is string)
			{
				ConfigEntry<string> val3 = ((BaseUnityPlugin)plugin).Config.Bind<string>(section, name, (string)defaultValue, description);
			}
			else if (defaultValue is int)
			{
				ConfigEntry<int> val4 = ((BaseUnityPlugin)plugin).Config.Bind<int>(section, name, (int)defaultValue, description);
				if (name == "Audio_Play_Option")
				{
					audioPlayOptions = val4;
				}
				else if (name == "Audio_Loading_Option")
				{
					audioLoadingStategy = val4;
				}
			}
			else
			{
				LogManager.LogError("Unsupported type for config entry: " + key + ", Type: " + (defaultValue?.GetType()?.FullName ?? "null"));
			}
		}
	}
}
namespace GreyAnnouncer.Commands
{
	public sealed class CommandsToRegister : CommandRoot, IConsoleLogger
	{
		public override string Name => "grey";

		public override string Description => "tons of setting";

		public Logger Log { get; } = new Logger("grey");


		public CommandsToRegister(Console con)
			: base(con)
		{
		}//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown


		public override Branch BuildTree(Console con)
		{
			return CommandRoot.Branch(((CommandRoot)this).Name, (Node[])(object)new Node[4]
			{
				(Node)GetMainSettingBranches(),
				(Node)GetUtilBranches(),
				(Node)GetAnnouncerBranches(),
				(Node)GetTestBranches()
			});
		}

		private Branch GetMainSettingBranches()
		{
			return CommandRoot.Branch("mainsetting", (Node[])(object)new Node[3]
			{
				(Node)CommandRoot.Branch("audiosourcevolume", (Node[])(object)new Node[2]
				{
					(Node)CommandRoot.Branch("get", (Node[])(object)new Node[1] { (Node)CommandRoot.Leaf((Action)delegate
					{
						Log.Info($"Audio Source Volume: {BepInExConfig.audioSourceVolume.Value}", (IEnumerable<Tag>)null, (string)null, (object)null);
					}, false) }),
					(Node)CommandRoot.Branch("set", (Node[])(object)new Node[1] { (Node)CommandRoot.Leaf<float>((Action<float>)delegate(float val)
					{
						BepInExConfig.audioSourceVolume.Value = val;
						Log.Info($"Audio Source Volume set to {val}", (IEnumerable<Tag>)null, (string)null, (object)null);
					}, false) })
				}),
				(Node)CommandRoot.Branch("ffmpegenabled", (Node[])(object)new Node[2]
				{
					(Node)CommandRoot.Branch("get", (Node[])(object)new Node[1] { (Node)CommandRoot.Leaf((Action)delegate
					{
						Log.Info($"FFmpeg Support Enabled: {BepInExConfig.isFFmpegSupportEnabled.Value}", (IEnumerable<Tag>)null, (string)null, (object)null);
					}, false) }),
					(Node)CommandRoot.Branch("set", (Node[])(object)new Node[1] { (Node)CommandRoot.Leaf<bool>((Action<bool>)delegate(bool val)
					{
						BepInExConfig.isFFmpegSupportEnabled.Value = val;
						Log.Info($"FFmpeg Support Enabled set to {val}", (IEnumerable<Tag>)null, (string)null, (object)null);
					}, false) })
				}),
				(Node)CommandRoot.Branch("lowpassenabled", (Node[])(object)new Node[2]
				{
					(Node)CommandRoot.Branch("get", (Node[])(object)new Node[1] { (Node)CommandRoot.Leaf((Action)delegate
					{
						Log.Info($"Under Water Low Pass Filter Enabled: {BepInExConfig.isLowPassFilterEnabled.Value}", (IEnumerable<Tag>)null, (string)null, (object)null);
					}, false) }),
					(Node)CommandRoot.Branch("set", (Node[])(object)new Node[1] { (Node)CommandRoot.Leaf<bool>((Action<bool>)delegate(bool val)
					{
						BepInExConfig.isLowPassFilterEnabled.Value = val;
						Log.Info($"Under Water Low Pass Filter Enabled set to {val}", (IEnumerable<Tag>)null, (string)null, (object)null);
					}, false) })
				})
			});
		}

		private Branch GetAnnouncerBranches()
		{
			Node[] array = (Node[])(object)AnnouncerManager.GetAllAnnouncers().Select(delegate(AudioAnnouncer a)
			{
				string title = a.title;
				Node[] obj = new Node[5]
				{
					(Node)CommandRoot.Branch("randomize", (Node[])(object)new Node[2]
					{
						(Node)CommandRoot.Branch("get", (Node[])(object)new Node[1] { (Node)CommandRoot.Leaf((Action)delegate
						{
							Log.Info($"RandomizeAudioOnPlay: {a.announcerConfig.RandomizeAudioOnPlay}", (IEnumerable<Tag>)null, (string)null, (object)null);
						}, false) }),
						(Node)CommandRoot.Branch("set", (Node[])(object)new Node[1] { (Node)CommandRoot.Leaf<bool>((Action<bool>)delegate(bool val)
						{
							a.announcerConfig.RandomizeAudioOnPlay = val;
							Log.Info($"Set RandomizeAudioOnPlay to {val}", (IEnumerable<Tag>)null, (string)null, (object)null);
						}, false) })
					}),
					default(Node),
					default(Node),
					default(Node),
					default(Node)
				};
				Node[] array2 = (Node[])(object)a.announcerConfig.CategorySetting.Select(delegate(KeyValuePair<string, CategorySetting> kvp)
				{
					string key = kvp.Key;
					CategorySetting category = kvp.Value;
					return CommandRoot.Branch(key, (Node[])(object)new Node[2]
					{
						(Node)CommandRoot.Branch("get", (Node[])(object)new Node[4]
						{
							(Node)CommandRoot.Leaf("enabled", (Action)delegate
							{
								Log.Info($"Enabled: {category.Enabled}", (IEnumerable<Tag>)null, (string)null, (object)null);
							}, false),
							(Node)CommandRoot.Leaf("volume", (Action)delegate
							{
								Log.Info($"VolumeMultiplier: {category.VolumeMultiplier}", (IEnumerable<Tag>)null, (string)null, (object)null);
							}, false),
							(Node)CommandRoot.Leaf("cooldown", (Action)delegate
							{
								Log.Info($"Cooldown: {category.Cooldown}", (IEnumerable<Tag>)null, (string)null, (object)null);
							}, false),
							(Node)CommandRoot.Leaf("audiofiles", (Action)delegate
							{
								Log.Info("AudioFiles: " + string.Join(", ", category.AudioFiles), (IEnumerable<Tag>)null, (string)null, (object)null);
							}, false)
						}),
						(Node)CommandRoot.Branch("set", (Node[])(object)new Node[4]
						{
							(Node)CommandRoot.Leaf<bool>("enabled", (Action<bool>)delegate(bool val)
							{
								category.Enabled = val;
							}, false),
							(Node)CommandRoot.Leaf<float>("volume", (Action<float>)delegate(float val)
							{
								category.VolumeMultiplier = val;
							}, false),
							(Node)CommandRoot.Leaf<float>("cooldown", (Action<float>)delegate(float val)
							{
								category.Cooldown = val;
							}, false),
							(Node)CommandRoot.Leaf<string[]>("audiofiles", (Action<string[]>)delegate(string[] files)
							{
								category.AudioFiles.Clear();
								category.AudioFiles.AddRange(files);
								Log.Info("AudioFiles set: " + string.Join(", ", files), (IEnumerable<Tag>)null, (string)null, (object)null);
							}, false)
						})
					});
				}).ToArray();
				obj[1] = (Node)CommandRoot.Branch("category", array2);
				obj[2] = (Node)CommandRoot.Leaf("editexternal", (Action)delegate
				{
					a.EditExternally();
				}, false);
				obj[3] = (Node)CommandRoot.Leaf("reload", (Action)delegate
				{
					a.ReloadAudio();
				}, false);
				obj[4] = (Node)CommandRoot.Leaf("printstructure", (Action)delegate
				{
					Log.Info(ObjectTreePrinter.GetTreeString(a) ?? "", (IEnumerable<Tag>)null, (string)null, (object)null);
				}, false);
				return CommandRoot.Branch(title, (Node[])(object)obj);
			}).ToArray();
			return CommandRoot.Branch("announcers", array);
		}

		public Branch GetUtilBranches()
		{
			return CommandRoot.Branch("util", (Node[])(object)new Node[2]
			{
				(Node)CommandRoot.Leaf("reloadannouncers", (Action)delegate
				{
					AnnouncerManager.ReloadAllAnnouncers();
				}, false),
				(Node)CommandRoot.Leaf("stopallaudiosources", (Action)delegate
				{
					AudioSourceManager.StopAllAudioSource();
				}, false)
			});
		}

		private Branch GetTestBranches()
		{
			return null;
		}
	}
	[HarmonyPatch(typeof(Console))]
	public class ConsolePatcher
	{
		[HarmonyPrefix]
		[HarmonyPatch("Awake")]
		public static void AddConsoleCommands(Console __instance)
		{
			CommandsToRegister commandsToRegister = new CommandsToRegister(__instance);
			__instance.RegisterCommand((ICommand)(object)commandsToRegister);
		}
	}
}
namespace GreyAnnouncer.AudioSourceComponent
{
	public static class AudioSourceManager
	{
		[CompilerGenerated]
		private sealed class <FadeVolume>d__3 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public AudioSource audioSource;

			public float duration;

			public float? targetVolume;

			public float? multiplier;

			private float <startVolume>5__1;

			private float <endVolume>5__2;

			private float <timeStep>5__3;

			private float <time>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FadeVolume>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if ((Object)(object)audioSource == (Object)null)
					{
						return false;
					}
					<startVolume>5__1 = audioSource.volume;
					if (targetVolume.HasValue)
					{
						<endVolume>5__2 = Mathf.Clamp01(targetVolume.Value);
					}
					else
					{
						if (!multiplier.HasValue)
						{
							return false;
						}
						<endVolume>5__2 = Mathf.Clamp01(<startVolume>5__1 * multiplier.Value);
					}
					<timeStep>5__3 = duration / 5f;
					<time>5__4 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<time>5__4 < duration)
				{
					audioSource.volume = Mathf.Lerp(<startVolume>5__1, <endVolume>5__2, <time>5__4 / duration);
					<time>5__4 += <timeStep>5__3;
					<>2__current = (object)new WaitForSeconds(<timeStep>5__3);
					<>1__state = 1;
					return true;
				}
				audioSource.volume = <endVolume>5__2;
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static AudioSource ConfigureAudioSource(AudioSource audioSource, Sound sound)
		{
			audioSource.spatialBlend = sound.SpatialBlend;
			audioSource.priority = sound.Priority;
			audioSource.volume = ((sound.Volume < 1f) ? sound.Volume : 1f);
			audioSource.clip = sound.clip;
			return audioSource;
		}

		public static AudioSource AddLowPassFilter(AudioSource audioSource)
		{
			if ((Object)(object)audioSource == (Object)null)
			{
				return null;
			}
			AudioLowPassFilter val = ((Component)audioSource).gameObject.GetComponent<AudioLowPassFilter>() ?? ((Component)audioSource).gameObject.AddComponent<AudioLowPassFilter>();
			val.cutoffFrequency = 1000f;
			val.lowpassResonanceQ = 1f;
			return audioSource;
		}

		public static AudioSource RemoveLowPassFilter(AudioSource audioSource)
		{
			if ((Object)(object)audioSource == (Object)null)
			{
				return null;
			}
			AudioLowPassFilter component = ((Component)audioSource).GetComponent<AudioLowPassFilter>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			return audioSource;
		}

		[IteratorStateMachine(typeof(<FadeVolume>d__3))]
		public static IEnumerator FadeVolume(AudioSource audioSource, float duration, float? targetVolume = null, float? multiplier = null)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FadeVolume>d__3(0)
			{
				audioSource = audioSource,
				duration = duration,
				targetVolume = targetVolume,
				multiplier = multiplier
			};
		}

		public static void StopAllAudioSource()
		{
			SoloAudioSource.Instance.StopAudioSource();
		}
	}
	public struct AudioSourceSetting
	{
		public float SpatialBlend { get; set; }

		public int Priority { get; set; }

		public float Volume { get; set; }

		public float Pitch { get; set; }

		public string[] Tags { get; set; }

		public static AudioSourceSetting Default
		{
			get
			{
				AudioSourceSetting result = default(AudioSourceSetting);
				result.SpatialBlend = 0f;
				result.Priority = 0;
				result.Volume = 1f;
				result.Pitch = 1f;
				result.Tags = Array.Empty<string>();
				return result;
			}
		}
	}
	public sealed class SoloAudioSource : MonoBehaviour
	{
		private AudioSource _audioSource;

		private static SoloAudioSource _instance;

		public static SoloAudioSource Instance
		{
			get
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Expected O, but got Unknown
				if ((Object)(object)_instance == (Object)null)
				{
					GameObject val = new GameObject("SoloAudioSource");
					Object.DontDestroyOnLoad((Object)(object)val);
					_instance = val.AddComponent<SoloAudioSource>();
				}
				return _instance;
			}
		}

		public void Play(Sound sound)
		{
			if ((Object)(object)_audioSource == (Object)null)
			{
				_audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
			}
			_audioSource.Stop();
			ConfigureAndPlayAudioSource(sound, _audioSource);
		}

		public void PlayOneShot(Sound sound)
		{
			if ((Object)(object)_audioSource == (Object)null)
			{
				_audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
			}
			ConfigureAndPlayAudioSource(sound, _audioSource);
		}

		private void ConfigureAndPlayAudioSource(Sound sound, AudioSource audioSource)
		{
			audioSource.spatialBlend = sound.SpatialBlend;
			audioSource.priority = sound.Priority;
			audioSource.volume = Mathf.Clamp01(BepInExConfig.audioSourceVolume.Value * sound.Volume);
			audioSource.clip = sound.clip;
			audioSource = UnderwaterController_inWater_Instance.GetAudioSourceWithLowPassFilter(_audioSource);
			LogManager.LogDebug("Playing solo audio source: Category=" + sound.category + ", Clip=" + ((Object)sound.clip).name + ", " + $"Volume={audioSource.volume}, " + $"Pitch={audioSource.pitch}, " + $"SpatialBlend={audioSource.spatialBlend}, " + $"Priority={audioSource.priority}");
			audioSource.PlayOneShot(sound.clip, sound.Volume);
		}

		public void AddAudioLowPassFilter()
		{
			_audioSource = AudioSourceManager.AddLowPassFilter(_audioSource);
		}

		public void RemoveAudioLowPassFilter()
		{
			_audioSource = AudioSourceManager.RemoveLowPassFilter(_audioSource);
		}

		public void UpdateSoloAudioSourceVolume(float targetVolume, float duration = 0.35f)
		{
			if ((Object)(object)_audioSource != (Object)null)
			{
				((MonoBehaviour)this).StartCoroutine(AudioSourceManager.FadeVolume(_audioSource, duration, targetVolume));
			}
		}

		public void StopAudioSource()
		{
			_audioSource.Stop();
			Object.Destroy((Object)(object)_audioSource.clip);
		}
	}
	public class Sound
	{
		public string category;

		public AudioClip clip;

		public float SpatialBlend = 0f;

		[Range(0f, 1f)]
		public float Volume = 1f;

		public bool Loop = false;

		public int Priority = 0;

		public AudioMixerGroup audioMixerGroup;

		public Sound(string category, AudioClip clip, float volume)
		{
			this.category = category;
			this.clip = clip;
			Volume = volume;
		}
	}
	public static class SoundDispatcher
	{
		public static void SendClipToAudioSource(Sound sound, int flag)
		{
			switch (flag)
			{
			case 0:
				SoloAudioSource.Instance.Play(sound);
				break;
			case 1:
				SoloAudioSource.Instance.PlayOneShot(sound);
				break;
			default:
				SoloAudioSource.Instance.Play(sound);
				break;
			}
		}
	}
	[Description("Because it's..... related so I just put it at here instead of creating a new object file")]
	public static class UnderwaterController_inWater_Instance
	{
		public static bool isInWater
		{
			get
			{
				UnderwaterController instance = MonoSingleton<UnderwaterController>.Instance;
				return (Object)(object)instance != (Object)null && instance.inWater;
			}
		}

		public static void CheckIsInWater()
		{
			if (!isInWater || !BepInExConfig.isLowPassFilterEnabled.Value)
			{
				RemoveAudioLowPassFilterFromAllAudioSource();
			}
			else if (isInWater)
			{
				AddAudioLowPassFilterToAllAudioSource();
			}
		}

		public static AudioSource GetAudioSourceWithLowPassFilter(AudioSource audioSource)
		{
			if ((Object)(object)audioSource == (Object)null)
			{
				return null;
			}
			audioSource = ((!isInWater || !BepInExConfig.isLowPassFilterEnabled.Value) ? AudioSourceManager.RemoveLowPassFilter(audioSource) : AudioSourceManager.AddLowPassFilter(audioSource));
			return audioSource;
		}

		private static void RemoveAudioLowPassFilterFromAllAudioSource()
		{
			SoloAudioSource.Instance.RemoveAudioLowPassFilter();
		}

		private static void AddAudioLowPassFilterToAllAudioSource()
		{
			SoloAudioSource.Instance.AddAudioLowPassFilter();
		}
	}
	[Description("Q : Why? A : Prevent when audio is playing and enter/out of the water")]
	[HarmonyPatch(typeof(UnderwaterController))]
	public class UnderwaterPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("EnterWater")]
		public static void EnterWater()
		{
			UnderwaterController_inWater_Instance.CheckIsInWater();
		}

		[HarmonyPostfix]
		[HarmonyPatch("OutWater")]
		public static void OutWater()
		{
			UnderwaterController_inWater_Instance.CheckIsInWater();
		}
	}
}
namespace GreyAnnouncer.AudioLoading
{
	public static class AudioClipLoader
	{
		public static async Task<AudioClip> LoadAudioClipAsync(string path)
		{
			string extension = Path.GetExtension(path).ToLower();
			AudioType? unityAudioType = GetUnityAudioType(extension);
			AudioClip clip = null;
			try
			{
				if (unityAudioType.HasValue)
				{
					clip = await UnitySupport.LoadWithUnityAsync(path, unityAudioType.Value);
				}
				else if (BepInExConfig.isFFmpegSupportEnabled.Value)
				{
					clip = await FFmpegSupport.DecodeAndLoad(path);
				}
				else
				{
					LogManager.LogError("Unsupported audio format: 「" + extension + "」 for " + path);
				}
				if ((Object)(object)clip == (Object)null)
				{
					return null;
				}
				return clip;
			}
			catch (Exception ex2)
			{
				Exception ex = ex2;
				LogManager.LogError("Error while loading " + path + ": " + ex.Message + "\n" + ex.StackTrace);
				return null;
			}
		}

		private static AudioType? GetUnityAudioType(string extension)
		{
			if (1 == 0)
			{
			}
			AudioType? result = extension switch
			{
				".wav" => (AudioType)20, 
				".mp3" => (AudioType)13, 
				".ogg" => (AudioType)14, 
				".aiff" => (AudioType)2, 
				".aif" => (AudioType)2, 
				".acc" => (AudioType)1, 
				_ => null, 
			};
			if (1 == 0)
			{
			}
			return result;
		}
	}
	public static class FFmpegSupport
	{
		public unsafe static Task<AudioClip> DecodeAndLoad(string filePath)
		{
			return Task.Run(delegate
			{
				Stopwatch stopwatch = new Stopwatch();
				AVFormatContext* ptr = null;
				AVCodecContext* ptr2 = null;
				SwrContext* ptr3 = null;
				AVPacket* ptr4 = null;
				AVFrame* ptr5 = null;
				ffmpeg.RootPath = PathManager.FindExecutable("ffmpeg");
				LogManager.LogDebug("ffmpeg path: " + ffmpeg.RootPath);
				LogManager.LogDebug("ffmpeg version: " + ffmpeg.av_version_info());
				ffmpeg.avformat_network_init();
				ptr = InitializeFormatContext(filePath);
				int audioStreamIndex = FindAudioStreamIndex(ptr);
				ptr2 = InitializeCodecContext(ptr, audioStreamIndex);
				ptr3 = InitializeResampler(ptr2);
				ptr4 = ffmpeg.av_packet_alloc();
				ptr5 = ffmpeg.av_frame_alloc();
				StreamedAudioData streamedAudioData = DecodeAudioFrames(ptr, ptr2, ptr3, ptr4, ptr5, audioStreamIndex);
				float[] allSamples = streamedAudioData.GetAllSamples();
				int nb_channels = ((AVChannelLayout)(&((AVCodecContext)ptr2).ch_layout)).nb_channels;
				int sample_rate = ((AVCodecContext)ptr2).sample_rate;
				int num = allSamples.Length / nb_channels;
				AudioClip val = AudioClip.Create("decoded_clip", num, nb_channels, sample_rate, false);
				val.SetData(allSamples, 0);
				CleanupResources(ptr5, ptr4, ptr2, ptr3, ptr);
				return val;
			});
		}

		private unsafe static AVFormatContext* InitializeFormatContext(string filePath)
		{
			AVFormatContext* ptr = ffmpeg.avformat_alloc_context();
			if (ffmpeg.avformat_open_input(&ptr, filePath, (AVInputFormat*)null, (AVDictionary**)null) != 0)
			{
				throw new Exception("Could not open input file.");
			}
			if (ffmpeg.avformat_find_stream_info(ptr, (AVDictionary**)null) != 0)
			{
				throw new Exception("Could not find stream info.");
			}
			return ptr;
		}

		private unsafe static int FindAudioStreamIndex(AVFormatContext* formatContext)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			for (int i = 0; i < ((AVFormatContext)formatContext).nb_streams; i++)
			{
				if ((int)((AVCodecParameters)((AVStream)((AVFormatContext)formatContext).streams[i]).codecpar).codec_type == 1)
				{
					return i;
				}
			}
			throw new Exception("No audio stream found.");
		}

		private unsafe static AVCodecContext* InitializeCodecContext(AVFormatContext* formatContext, int audioStreamIndex)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			AVCodecParameters* codecpar = ((AVStream)((AVFormatContext)formatContext).streams[audioStreamIndex]).codecpar;
			AVCodec* ptr = ffmpeg.avcodec_find_decoder(((AVCodecParameters)codecpar).codec_id);
			if (ptr == null)
			{
				throw new Exception("Unsupported codec");
			}
			AVCodecContext* ptr2 = ffmpeg.avcodec_alloc_context3(ptr);
			ffmpeg.avcodec_parameters_to_context(ptr2, codecpar);
			if (ffmpeg.avcodec_open2(ptr2, ptr, (AVDictionary**)null) < 0)
			{
				ffmpeg.avcodec_free_context(&ptr2);
				throw new Exception("Could not open codec");
			}
			return ptr2;
		}

		private unsafe static SwrContext* InitializeResampler(AVCodecContext* codecCtx)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			int nb_channels = ((AVChannelLayout)(&((AVCodecContext)codecCtx).ch_layout)).nb_channels;
			AVChannelLayout ch_layout = ((AVCodecContext)codecCtx).ch_layout;
			AVChannelLayout val = default(AVChannelLayout);
			ffmpeg.av_channel_layout_default(&val, nb_channels);
			SwrContext* ptr = ffmpeg.swr_alloc();
			ffmpeg.av_opt_set_chlayout((void*)ptr, "in_chlayout", &ch_layout, 0);
			ffmpeg.av_opt_set_chlayout((void*)ptr, "out_chlayout", &val, 0);
			ffmpeg.av_opt_set_int((void*)ptr, "in_sample_rate", (long)((AVCodecContext)codecCtx).sample_rate, 0);
			ffmpeg.av_opt_set_int((void*)ptr, "out_sample_rate", (long)((AVCodecContext)codecCtx).sample_rate, 0);
			ffmpeg.av_opt_set_sample_fmt((void*)ptr, "in_sample_fmt", ((AVCodecContext)codecCtx).sample_fmt, 0);
			ffmpeg.av_opt_set_sample_fmt((void*)ptr, "out_sample_fmt", (AVSampleFormat)3, 0);
			ffmpeg.swr_init(ptr);
			return ptr;
		}

		private unsafe static StreamedAudioData DecodeAudioFrames(AVFormatContext* formatContext, AVCodecContext* codecCtx, SwrContext* swrCtx, AVPacket* packet, AVFrame* frame, int audioStreamIndex)
		{
			StreamedAudioData streamedAudioData = new StreamedAudioData
			{
				Channels = ((AVChannelLayout)(&((AVCodecContext)codecCtx).ch_layout)).nb_channels,
				SampleRate = ((AVCodecContext)codecCtx).sample_rate
			};
			while (ffmpeg.av_read_frame(formatContext, packet) >= 0)
			{
				if (((AVPacket)packet).stream_index != audioStreamIndex)
				{
					ffmpeg.av_packet_unref(packet);
					continue;
				}
				ProcessAudioFrame(codecCtx, swrCtx, packet, frame, streamedAudioData);
				ffmpeg.av_packet_unref(packet);
			}
			return streamedAudioData;
		}

		private unsafe static void ProcessAudioFrame(AVCodecContext* codecCtx, SwrContext* swrCtx, AVPacket* packet, AVFrame* frame, StreamedAudioData streamedData)
		{
			byte** ptr = stackalloc byte*[1];
			ffmpeg.avcodec_send_packet(codecCtx, packet);
			int num = default(int);
			while (ffmpeg.avcodec_receive_frame(codecCtx, frame) == 0)
			{
				int num2 = ffmpeg.av_samples_alloc_array_and_samples(&ptr, &num, ((AVChannelLayout)(&((AVCodecContext)codecCtx).ch_layout)).nb_channels, ((AVFrame)frame).nb_samples, (AVSampleFormat)3, 0);
				int num3 = ffmpeg.swr_convert(swrCtx, ptr, ((AVFrame)frame).nb_samples, ((AVFrame)frame).extended_data, ((AVFrame)frame).nb_samples);
				int num4 = ffmpeg.av_samples_get_buffer_size((int*)null, ((AVChannelLayout)(&((AVCodecContext)codecCtx).ch_layout)).nb_channels, num3, (AVSampleFormat)3, 1);
				float[] array = new float[num4 / 4];
				Marshal.Copy((IntPtr)(*ptr), array, 0, array.Length);
				streamedData.AddSamples(array);
				ffmpeg.av_freep((void*)ptr);
			}
		}

		private unsafe static void CleanupResources(AVFrame* frame, AVPacket* packet, AVCodecContext* codecCtx, SwrContext* swrCtx, AVFormatContext* formatContext)
		{
			if (frame != null)
			{
				ffmpeg.av_frame_free(&frame);
			}
			if (packet != null)
			{
				ffmpeg.av_packet_free(&packet);
			}
			if (codecCtx != null)
			{
				ffmpeg.avcodec_free_context(&codecCtx);
			}
			if (swrCtx != null)
			{
				ffmpeg.swr_close(swrCtx);
				ffmpeg.swr_free(&swrCtx);
			}
			if (formatContext != null)
			{
				ffmpeg.avformat_close_input(&formatContext);
				ffmpeg.avformat_free_context(formatContext);
			}
			ffmpeg.avformat_network_deinit();
		}
	}
	public static class UnitySupport
	{
		public static async Task<AudioClip> LoadWithUnityAsync(string path, AudioType audioType)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			string url = new Uri(path).AbsoluteUri;
			UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, audioType);
			try
			{
				UnityWebRequestAsyncOperation operation = www.SendWebRequest();
				while (!((AsyncOperation)operation).isDone)
				{
					await Task.Delay(10);
				}
				if ((int)www.result != 1)
				{
					LogManager.LogError("UnityRequest Failed to load audio: " + www.error);
					return null;
				}
				return DownloadHandlerAudioClip.GetContent(www);
			}
			finally
			{
				((IDisposable)www)?.Dispose();
			}
		}
	}
}
namespace GreyAnnouncer.AnnouncerAPI
{
	public class AnnouncerConfig : NotifyBase
	{
		private bool _randomizeAudioOnPlay;

		[IniKey("RandomizeAudioOnPlay")]
		public bool RandomizeAudioOnPlay
		{
			get
			{
				return _randomizeAudioOnPlay;
			}
			set
			{
				SetField(ref _randomizeAudioOnPlay, value, "RandomizeAudioOnPlay");
			}
		}

		public ObservableDictionary<string, CategorySetting> CategorySetting { get; } = new ObservableDictionary<string, CategorySetting>();


		public AnnouncerConfig()
		{
			CategorySetting.CollectionChanged += delegate
			{
				RaiseChanged("CategorySetting");
			};
			CategorySetting.PropertyChanged += delegate
			{
				RaiseChanged("CategorySetting");
			};
		}

		public void AddCategory(string key, CategorySetting setting)
		{
			CategorySetting[key] = setting;
		}

		public AnnouncerConfig SetCategorySettingMap(Dictionary<string, CategorySetting> map)
		{
			CategorySetting.Clear();
			foreach (KeyValuePair<string, CategorySetting> item in map)
			{
				AddCategory(item.Key, item.Value);
			}
			return this;
		}

		public void ApplyFrom(AnnouncerConfig src)
		{
			BeginUpdate();
			if (src == null)
			{
				return;
			}
			RandomizeAudioOnPlay = src.RandomizeAudioOnPlay;
			foreach (KeyValuePair<string, CategorySetting> item in src.CategorySetting)
			{
				string key = item.Key;
				CategorySetting value = item.Value;
				if (!CategorySetting.TryGetValue(key, out var value2))
				{
					value2 = new CategorySetting();
					CategorySetting[key] = value2;
				}
				value2.ApplyFrom(value);
			}
			List<string> list = CategorySetting.Keys.Where((string k) => !src.CategorySetting.ContainsKey(k)).ToList();
			foreach (string item2 in list)
			{
				CategorySetting.Remove(item2);
			}
			EndUpdate();
		}
	}
	public class CategorySetting : NotifyBase
	{
		private bool _enabled = true;

		private float _volumeMultiplier = 1f;

		private float _cooldown = 1.5f;

		private List<string> _audioFiles = new List<string>();

		[IniKey("Enabled")]
		public bool Enabled
		{
			get
			{
				return _enabled;
			}
			set
			{
				SetField(ref _enabled, value, "Enabled");
			}
		}

		[IniKey("VolumeMultiplier")]
		public float VolumeMultiplier
		{
			get
			{
				return _volumeMultiplier;
			}
			set
			{
				SetField(ref _volumeMultiplier, value, "VolumeMultiplier");
			}
		}

		[IniKey("Cooldown")]
		public float Cooldown
		{
			get
			{
				return _cooldown;
			}
			set
			{
				SetField(ref _cooldown, value, "Cooldown");
			}
		}

		[IniKey("AudioFiles")]
		public List<string> AudioFiles
		{
			get
			{
				return _audioFiles;
			}
			set
			{
				_audioFiles = value ?? new List<string>();
			}
		}

		public void ApplyFrom(CategorySetting src)
		{
			if (src != null)
			{
				Enabled = src.Enabled;
				VolumeMultiplier = src.VolumeMultiplier;
				Cooldown = src.Cooldown;
				AudioFiles.Clear();
				AudioFiles.AddRange(src.AudioFiles);
			}
		}
	}
	public static class AnnouncerIndex
	{
		private static string indexPath = PathManager.GetCurrentPluginPath("index.json");

		private static readonly Dictionary<string, string> _data = Read();

		private static string _announcersPath;

		public static string announcersPath
		{
			get
			{
				if (_announcersPath == null)
				{
					_announcersPath = PathManager.GetCurrentPluginPath("announcers");
				}
				return _announcersPath;
			}
			set
			{
				_announcersPath = value;
			}
		}

		private static string defaultAnnouncerRelativePath => "greythroat";

		public static void Set(string guid, string fullPath)
		{
			string text = announcersPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			string text3;
			if (!text.EndsWith(directorySeparatorChar.ToString()))
			{
				string text2 = announcersPath;
				directorySeparatorChar = Path.DirectorySeparatorChar;
				text3 = text2 + directorySeparatorChar;
			}
			else
			{
				text3 = announcersPath;
			}
			string uriString = text3;
			Uri uri = new Uri(fullPath);
			Uri uri2 = new Uri(uriString);
			string value = Uri.UnescapeDataString(uri2.MakeRelativeUri(uri).ToString()).Replace('/', Path.DirectorySeparatorChar);
			_data[guid] = value;
			Save();
		}

		public static string Get(string guid)
		{
			if (_data.TryGetValue(guid, out var value))
			{
				return Path.Combine(announcersPath, value);
			}
			_data[guid] = defaultAnnouncerRelativePath;
			Save();
			return Path.Combine(announcersPath, defaultAnnouncerRelativePath);
		}

		public static bool Remove(string guid)
		{
			if (_data.Remove(guid))
			{
				Save();
				return true;
			}
			return false;
		}

		private static Dictionary<string, string> Read()
		{
			Dictionary<string, string> dictionary = null;
			try
			{
				return JsonManager.ReadJson<Dictionary<string, string>>("index.json");
			}
			catch (FileNotFoundException)
			{
				JsonManager.WriteJson("index.json", new Dictionary<string, string>());
				return JsonManager.ReadJson<Dictionary<string, string>>("index.json");
			}
		}

		private static void Save()
		{
			JsonManager.WriteJson(indexPath, _data);
		}
	}
	public static class AnnouncerIniMapper
	{
		public static AnnouncerConfig FromIni(IniDocument doc)
		{
			AnnouncerConfig announcerConfig = new AnnouncerConfig();
			if (doc.TryGetSection("General", out var section))
			{
				announcerConfig.RandomizeAudioOnPlay = GetBool(section, "RandomizeAudioOnPlay", def: false);
			}
			foreach (KeyValuePair<string, IniSection> section2 in doc.Sections)
			{
				string key = section2.Key;
				IniSection value = section2.Value;
				if (!key.StartsWith("Category:", StringComparison.OrdinalIgnoreCase))
				{
					continue;
				}
				string text = key.Substring("Category:".Length).Trim();
				if (text.Length == 0)
				{
					continue;
				}
				CategorySetting categorySetting = new CategorySetting
				{
					Enabled = GetBool(value, "Enabled", def: true),
					VolumeMultiplier = GetFloat(value, "VolumeMultiplier", 1f),
					Cooldown = GetFloat(value, "Cooldown", 1.5f)
				};
				IEnumerable<string> values = value.GetValues("AudioFiles");
				foreach (string item in values)
				{
					string[] array = item.Split(new char[1] { ',' });
					foreach (string text2 in array)
					{
						string text3 = text2.Trim();
						if (text3.Length > 0)
						{
							categorySetting.AudioFiles.Add(text3);
						}
					}
				}
				announcerConfig.AddCategory(text, categorySetting);
			}
			return announcerConfig;
		}

		public static IniDocument ToIni(IniDocument doc, AnnouncerConfig config)
		{
			if (!doc.Sections.TryGetValue("General", out var value))
			{
				value = new IniSection("General");
				doc.Sections["General"] = value;
			}
			value.Values["RandomizeAudioOnPlay"] = new List<string> { config.RandomizeAudioOnPlay.ToString() };
			foreach (KeyValuePair<string, CategorySetting> item in config.CategorySetting)
			{
				string text = "Category:" + item.Key;
				if (!doc.Sections.TryGetValue(text, out var value2))
				{
					value2 = new IniSection(text);
					doc.Sections[text] = value2;
				}
				CategorySetting value3 = item.Value;
				value2.Values["Enabled"] = new List<string> { value3.Enabled.ToString() };
				value2.Values["VolumeMultiplier"] = new List<string> { value3.VolumeMultiplier.ToString(CultureInfo.InvariantCulture) };
				value2.Values["Cooldown"] = new List<string> { value3.Cooldown.ToString(CultureInfo.InvariantCulture) };
				if (value3.AudioFiles != null && value3.AudioFiles.Count > 0)
				{
					value2.Values["AudioFiles"] = new List<string> { string.Join(",", value3.AudioFiles) };
				}
			}
			return doc;
		}

		private static bool GetBool(IniSection s, string key, bool def)
		{
			string lastValue = s.GetLastValue(key);
			bool result;
			return (lastValue != null && bool.TryParse(lastValue, out result)) ? result : def;
		}

		private static float GetFloat(IniSection s, string key, float def)
		{
			string lastValue = s.GetLastValue(key);
			float result;
			return (lastValue != null && float.TryParse(lastValue, NumberStyles.Float, CultureInfo.InvariantCulture, out result)) ? result : def;
		}
	}
	public static class AnnouncerManager
	{
		public static List<AudioAnnouncer> announcers = new List<AudioAnnouncer>();

		public static Action reloadAnnouncer;

		public static Action resetCooldown;

		public static Action clearAudioClipCache;

		public static long playRequestId = 0L;

		public static List<AudioAnnouncer> GetAllAnnouncers()
		{
			return announcers;
		}

		public static void AddAnnouncer(AudioAnnouncer announcer)
		{
			announcers.Add(announcer);
		}

		public static void ReloadAllAnnouncers()
		{
			reloadAnnouncer?.Invoke();
		}

		public static void ResetCooldown()
		{
			resetCooldown?.Invoke();
		}

		public static void ClearAudioClipsCache()
		{
			clearAudioClipCache?.Invoke();
		}
	}
	public class AudioAnnouncer
	{
		public string title;

		private IAudioLoader _audioLoader;

		private ICooldownManager _cooldownManager;

		private List<string> category;

		private string _announcerPath;

		private AnnouncerConfig _announcerConfig;

		private string iniPath;

		private RegistedAnnouncerPage page = new RegistedAnnouncerPage();

		public string announcerPath
		{
			get
			{
				return _announcerPath;
			}
			set
			{
				LogManager.LogDebug("announcerPath seted");
				_announcerPath = value;
				iniPath = Path.Combine(value, "config.ini");
				AnnouncerIndex.Set(title, value);
				ReloadAudio();
			}
		}

		public AnnouncerConfig announcerConfig
		{
			get
			{
				return _announcerConfig;
			}
			set
			{
				if (_announcerConfig != value)
				{
					if (_announcerConfig != null)
					{
						_announcerConfig.PropertyChanged -= OnAnnouncerConfigChanged;
					}
					_announcerConfig = value;
					if (_announcerConfig != null)
					{
						_announcerConfig.PropertyChanged += OnAnnouncerConfigChanged;
					}
					ApplyAnnouncerConfig();
				}
			}
		}

		private void OnAnnouncerConfigChanged(object sender, PropertyChangedEventArgs e)
		{
			LogManager.LogDebug("AnnouncerConfig changed: " + e.PropertyName);
			ApplyAnnouncerConfig();
		}

		private void ApplyAnnouncerConfig()
		{
			_audioLoader.UpdateSetting(announcerConfig, announcerPath);
			WriteConfigToIni(announcerConfig);
			page.ApplyConfigToUI(announcerConfig);
		}

		public AudioAnnouncer(IAudioLoader audioLoader, ICooldownManager cooldownManager, List<string> displayNameMapping, string title)
		{
			_audioLoader = audioLoader;
			_cooldownManager = cooldownManager;
			category = displayNameMapping;
			this.title = title;
			announcerPath = AnnouncerIndex.Get(this.title);
			SubscribeAnnouncerManager();
			page.Build(title, this);
		}

		[Description("Parry balls of Maurice -> Hit Maurice -> AscendingRank() -> Postfix() -> PlaySound() -> CheckPlayValidation(), This error will skip all the function before CheckPlayValidation(), That's why try-catch has implemented in the fucntion")]
		public async Task PlayAudioViaCategory(string category)
		{
			LogManager.LogInfo("Request to play audio for category: " + category);
			try
			{
				if (ValidateAndLogPlayback(category))
				{
					await PlayAudioClip(category, BepInExConfig.audioPlayOptions.Value);
				}
			}
			catch (Exception ex2)
			{
				Exception ex = ex2;
				LogPlaybackError(ex);
			}
		}

		public async Task PlayAudioViaIndex(int index)
		{
			await PlayAudioViaCategory(announcerConfig.CategorySetting.Keys.ToArray()[index]);
		}

		public void ReloadAudio()
		{
			if (announcerConfig == null)
			{
				announcerConfig = AnnouncerConfigIniInitialization(category);
				return;
			}
			announcerConfig.ApplyFrom(AnnouncerConfigIniInitialization(category));
			ApplyAnnouncerConfig();
		}

		public void ResetCooldown()
		{
			_cooldownManager.ResetCooldowns();
		}

		public void ClearAudioClipsCache()
		{
			_audioLoader.ClearCache();
		}

		private void SetCooldown(string category, float cooldown)
		{
			_cooldownManager.StartCooldowns(category, cooldown);
		}

		private bool ValidateAndLogPlayback(string category)
		{
			ValidationState playValidationState = GetPlayValidationState(category);
			if (playValidationState != 0)
			{
				LogManager.LogInfo($"PlayValidationState: {category}, {playValidationState}");
				return false;
			}
			return true;
		}

		private async Task PlayAudioClip(string category, int audioPlayOptions = 0)
		{
			LogManager.LogInfo("Attempting to play audio for category: " + category);
			Sound sound = await _audioLoader.LoadAudioClip(category);
			if (sound == null)
			{
				LogManager.LogError("Failed to load audio clip may for this category: " + category);
				return;
			}
			if (_cooldownManager.IsIndividualCooldownActive(sound.category))
			{
				LogManager.LogInfo("The sound's category " + sound.category + " is still in cooldown");
				return;
			}
			LogManager.LogDebug($"category : {sound.category}, Cooldown : {announcerConfig.CategorySetting[sound.category].Cooldown}");
			SoundDispatcher.SendClipToAudioSource(sound, audioPlayOptions);
			SetCooldown(sound.category, announcerConfig.CategorySetting[sound.category].Cooldown);
		}

		private void LogPlaybackError(Exception ex)
		{
			LogManager.LogError("An error occurred while playing sound: " + ex.Message + "\n" + ex.StackTrace);
		}

		private ValidationState GetPlayValidationState(string category)
		{
			if (_cooldownManager == null || _audioLoader == null)
			{
				return ValidationState.ComponentsNotInitialized;
			}
			if (_audioLoader.announcerConfig.CategorySetting.Keys == null || !_audioLoader.announcerConfig.CategorySetting.Keys.Contains(category))
			{
				return ValidationState.InvalidKey;
			}
			if (!announcerConfig.CategorySetting[category].Enabled && !announcerConfig.RandomizeAudioOnPlay)
			{
				return ValidationState.DisabledByConfig;
			}
			return ValidationState.Success;
		}

		private void SubscribeAnnouncerManager()
		{
			AnnouncerManager.reloadAnnouncer = (Action)Delegate.Combine(AnnouncerManager.reloadAnnouncer, new Action(ReloadAudio));
			AnnouncerManager.resetCooldown = (Action)Delegate.Combine(AnnouncerManager.resetCooldown, new Action(ResetCooldown));
			AnnouncerManager.clearAudioClipCache = (Action)Delegate.Combine(AnnouncerManager.clearAudioClipCache, new Action(ClearAudioClipsCache));
			AnnouncerManager.AddAnnouncer(this);
		}

		private AnnouncerConfig AnnouncerConfigIniInitialization(List<string> category)
		{
			LogManager.LogDebug("current iniPath for " + title + ": " + iniPath);
			if (!File.Exists(iniPath))
			{
				LogManager.LogDebug("Initialize new config.ini in: " + iniPath);
				Dictionary<string, CategorySetting> categorySettingMap = category.ToDictionary((string cat) => cat, (string cat) => new CategorySetting());
				AnnouncerConfig announcerConfig = new AnnouncerConfig().SetCategorySettingMap(categorySettingMap);
				WriteConfigToIni(announcerConfig);
			}
			return ReadConfigFromIni();
		}

		private void WriteConfigToIni(AnnouncerConfig announcerConfig)
		{
			IniDocument doc = new IniDocument();
			doc = AnnouncerIniMapper.ToIni(doc, announcerConfig);
			IniWriter.Write(iniPath, doc);
		}

		private AnnouncerConfig ReadConfigFromIni()
		{
			if (!File.Exists(iniPath))
			{
				return null;
			}
			IniDocument doc = IniReader.Read(iniPath);
			return AnnouncerIniMapper.FromIni(doc);
		}

		public void EditExternally()
		{
			PathManager.OpenDirectory(announcerPath);
		}
	}
	public class AudioLoader : IAudioLoader
	{
		private Dictionary<string, List<AudioClip>> _audioClips = new Dictionary<string, List<AudioClip>>();

		public static Action<string> onPluginConfiguratorLogUpdated;

		public string announcerPath;

		public AnnouncerConfig 

Newtonsoft.Json.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Data.SqlTypes;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Dynamic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Numerics;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json.Bson;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq.JsonPath;
using Newtonsoft.Json.Schema;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Utilities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Schema, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f561df277c6c0b497d629032b410cdcf286e537c054724f7ffa0164345f62b3e642029d7a80cc351918955328c4adc8a048823ef90b0cf38ea7db0d729caf2b633c3babe08b0310198c1081995c19029bc675193744eab9d7345b8a67258ec17d112cebdbbb2a281487dceeafb9d83aa930f32103fbe1d2911425bc5744002c7")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f561df277c6c0b497d629032b410cdcf286e537c054724f7ffa0164345f62b3e642029d7a80cc351918955328c4adc8a048823ef90b0cf38ea7db0d729caf2b633c3babe08b0310198c1081995c19029bc675193744eab9d7345b8a67258ec17d112cebdbbb2a281487dceeafb9d83aa930f32103fbe1d2911425bc5744002c7")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Dynamic, PublicKey=0024000004800000940000000602000000240000525341310004000001000100cbd8d53b9d7de30f1f1278f636ec462cf9c254991291e66ebb157a885638a517887633b898ccbcf0d5c5ff7be85a6abe9e765d0ac7cd33c68dac67e7e64530e8222101109f154ab14a941c490ac155cd1d4fcba0fabb49016b4ef28593b015cab5937da31172f03f67d09edda404b88a60023f062ae71d0b2e4438b74cc11dc9")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9ca358aa-317b-4925-8ada-4a29e943a363")]
[assembly: CLSCompliant(true)]
[assembly: TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
[assembly: AssemblyCompany("Newtonsoft")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © James Newton-King 2008")]
[assembly: AssemblyDescription("Json.NET is a popular high-performance JSON framework for .NET")]
[assembly: AssemblyFileVersion("13.0.3.27908")]
[assembly: AssemblyInformationalVersion("13.0.3+0a2e291c0d9c0c7675d445703e51750363a549ef")]
[assembly: AssemblyProduct("Json.NET")]
[assembly: AssemblyTitle("Json.NET .NET 4.5")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/JamesNK/Newtonsoft.Json")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyVersion("13.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
}
namespace Newtonsoft.Json
{
	public enum ConstructorHandling
	{
		Default,
		AllowNonPublicDefaultConstructor
	}
	public enum DateFormatHandling
	{
		IsoDateFormat,
		MicrosoftDateFormat
	}
	public enum DateParseHandling
	{
		None,
		DateTime,
		DateTimeOffset
	}
	public enum DateTimeZoneHandling
	{
		Local,
		Utc,
		Unspecified,
		RoundtripKind
	}
	public class DefaultJsonNameTable : JsonNameTable
	{
		private class Entry
		{
			internal readonly string Value;

			internal readonly int HashCode;

			internal Entry Next;

			internal Entry(string value, int hashCode, Entry next)
			{
				Value = value;
				HashCode = hashCode;
				Next = next;
			}
		}

		private static readonly int HashCodeRandomizer;

		private int _count;

		private Entry[] _entries;

		private int _mask = 31;

		static DefaultJsonNameTable()
		{
			HashCodeRandomizer = Environment.TickCount;
		}

		public DefaultJsonNameTable()
		{
			_entries = new Entry[_mask + 1];
		}

		public override string? Get(char[] key, int start, int length)
		{
			if (length == 0)
			{
				return string.Empty;
			}
			int num = length + HashCodeRandomizer;
			num += (num << 7) ^ key[start];
			int num2 = start + length;
			for (int i = start + 1; i < num2; i++)
			{
				num += (num << 7) ^ key[i];
			}
			num -= num >> 17;
			num -= num >> 11;
			num -= num >> 5;
			int num3 = Volatile.Read(ref _mask);
			int num4 = num & num3;
			for (Entry entry = _entries[num4]; entry != null; entry = entry.Next)
			{
				if (entry.HashCode == num && TextEquals(entry.Value, key, start, length))
				{
					return entry.Value;
				}
			}
			return null;
		}

		public string Add(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			int length = key.Length;
			if (length == 0)
			{
				return string.Empty;
			}
			int num = length + HashCodeRandomizer;
			for (int i = 0; i < key.Length; i++)
			{
				num += (num << 7) ^ key[i];
			}
			num -= num >> 17;
			num -= num >> 11;
			num -= num >> 5;
			for (Entry entry = _entries[num & _mask]; entry != null; entry = entry.Next)
			{
				if (entry.HashCode == num && entry.Value.Equals(key, StringComparison.Ordinal))
				{
					return entry.Value;
				}
			}
			return AddEntry(key, num);
		}

		private string AddEntry(string str, int hashCode)
		{
			int num = hashCode & _mask;
			Entry entry = new Entry(str, hashCode, _entries[num]);
			_entries[num] = entry;
			if (_count++ == _mask)
			{
				Grow();
			}
			return entry.Value;
		}

		private void Grow()
		{
			Entry[] entries = _entries;
			int num = _mask * 2 + 1;
			Entry[] array = new Entry[num + 1];
			for (int i = 0; i < entries.Length; i++)
			{
				Entry entry = entries[i];
				while (entry != null)
				{
					int num2 = entry.HashCode & num;
					Entry next = entry.Next;
					entry.Next = array[num2];
					array[num2] = entry;
					entry = next;
				}
			}
			_entries = array;
			Volatile.Write(ref _mask, num);
		}

		private static bool TextEquals(string str1, char[] str2, int str2Start, int str2Length)
		{
			if (str1.Length != str2Length)
			{
				return false;
			}
			for (int i = 0; i < str1.Length; i++)
			{
				if (str1[i] != str2[str2Start + i])
				{
					return false;
				}
			}
			return true;
		}
	}
	[Flags]
	public enum DefaultValueHandling
	{
		Include = 0,
		Ignore = 1,
		Populate = 2,
		IgnoreAndPopulate = 3
	}
	public enum FloatFormatHandling
	{
		String,
		Symbol,
		DefaultValue
	}
	public enum FloatParseHandling
	{
		Double,
		Decimal
	}
	public enum Formatting
	{
		None,
		Indented
	}
	public interface IArrayPool<T>
	{
		T[] Rent(int minimumLength);

		void Return(T[]? array);
	}
	public interface IJsonLineInfo
	{
		int LineNumber { get; }

		int LinePosition { get; }

		bool HasLineInfo();
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonArrayAttribute : JsonContainerAttribute
	{
		private bool _allowNullItems;

		public bool AllowNullItems
		{
			get
			{
				return _allowNullItems;
			}
			set
			{
				_allowNullItems = value;
			}
		}

		public JsonArrayAttribute()
		{
		}

		public JsonArrayAttribute(bool allowNullItems)
		{
			_allowNullItems = allowNullItems;
		}

		public JsonArrayAttribute(string id)
			: base(id)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false)]
	public sealed class JsonConstructorAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public abstract class JsonContainerAttribute : Attribute
	{
		internal bool? _isReference;

		internal bool? _itemIsReference;

		internal ReferenceLoopHandling? _itemReferenceLoopHandling;

		internal TypeNameHandling? _itemTypeNameHandling;

		private Type? _namingStrategyType;

		private object[]? _namingStrategyParameters;

		public string? Id { get; set; }

		public string? Title { get; set; }

		public string? Description { get; set; }

		public Type? ItemConverterType { get; set; }

		public object[]? ItemConverterParameters { get; set; }

		public Type? NamingStrategyType
		{
			get
			{
				return _namingStrategyType;
			}
			set
			{
				_namingStrategyType = value;
				NamingStrategyInstance = null;
			}
		}

		public object[]? NamingStrategyParameters
		{
			get
			{
				return _namingStrategyParameters;
			}
			set
			{
				_namingStrategyParameters = value;
				NamingStrategyInstance = null;
			}
		}

		internal NamingStrategy? NamingStrategyInstance { get; set; }

		public bool IsReference
		{
			get
			{
				return _isReference.GetValueOrDefault();
			}
			set
			{
				_isReference = value;
			}
		}

		public bool ItemIsReference
		{
			get
			{
				return _itemIsReference.GetValueOrDefault();
			}
			set
			{
				_itemIsReference = value;
			}
		}

		public ReferenceLoopHandling ItemReferenceLoopHandling
		{
			get
			{
				return _itemReferenceLoopHandling.GetValueOrDefault();
			}
			set
			{
				_itemReferenceLoopHandling = value;
			}
		}

		public TypeNameHandling ItemTypeNameHandling
		{
			get
			{
				return _itemTypeNameHandling.GetValueOrDefault();
			}
			set
			{
				_itemTypeNameHandling = value;
			}
		}

		protected JsonContainerAttribute()
		{
		}

		protected JsonContainerAttribute(string id)
		{
			Id = id;
		}
	}
	public static class JsonConvert
	{
		public static readonly string True = "true";

		public static readonly string False = "false";

		public static readonly string Null = "null";

		public static readonly string Undefined = "undefined";

		public static readonly string PositiveInfinity = "Infinity";

		public static readonly string NegativeInfinity = "-Infinity";

		public static readonly string NaN = "NaN";

		public static Func<JsonSerializerSettings>? DefaultSettings { get; set; }

		public static string ToString(DateTime value)
		{
			return ToString(value, DateFormatHandling.IsoDateFormat, DateTimeZoneHandling.RoundtripKind);
		}

		public static string ToString(DateTime value, DateFormatHandling format, DateTimeZoneHandling timeZoneHandling)
		{
			DateTime value2 = DateTimeUtils.EnsureDateTime(value, timeZoneHandling);
			using StringWriter stringWriter = StringUtils.CreateStringWriter(64);
			stringWriter.Write('"');
			DateTimeUtils.WriteDateTimeString(stringWriter, value2, format, null, CultureInfo.InvariantCulture);
			stringWriter.Write('"');
			return stringWriter.ToString();
		}

		public static string ToString(DateTimeOffset value)
		{
			return ToString(value, DateFormatHandling.IsoDateFormat);
		}

		public static string ToString(DateTimeOffset value, DateFormatHandling format)
		{
			using StringWriter stringWriter = StringUtils.CreateStringWriter(64);
			stringWriter.Write('"');
			DateTimeUtils.WriteDateTimeOffsetString(stringWriter, value, format, null, CultureInfo.InvariantCulture);
			stringWriter.Write('"');
			return stringWriter.ToString();
		}

		public static string ToString(bool value)
		{
			if (!value)
			{
				return False;
			}
			return True;
		}

		public static string ToString(char value)
		{
			return ToString(char.ToString(value));
		}

		public static string ToString(Enum value)
		{
			return value.ToString("D");
		}

		public static string ToString(int value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(short value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(ushort value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(uint value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(long value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		private static string ToStringInternal(BigInteger value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(ulong value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(float value)
		{
			return EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture));
		}

		internal static string ToString(float value, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			return EnsureFloatFormat(value, EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)), floatFormatHandling, quoteChar, nullable);
		}

		private static string EnsureFloatFormat(double value, string text, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			if (floatFormatHandling == FloatFormatHandling.Symbol || (!double.IsInfinity(value) && !double.IsNaN(value)))
			{
				return text;
			}
			if (floatFormatHandling == FloatFormatHandling.DefaultValue)
			{
				if (nullable)
				{
					return Null;
				}
				return "0.0";
			}
			return quoteChar + text + quoteChar;
		}

		public static string ToString(double value)
		{
			return EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture));
		}

		internal static string ToString(double value, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			return EnsureFloatFormat(value, EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)), floatFormatHandling, quoteChar, nullable);
		}

		private static string EnsureDecimalPlace(double value, string text)
		{
			if (double.IsNaN(value) || double.IsInfinity(value) || StringUtils.IndexOf(text, '.') != -1 || StringUtils.IndexOf(text, 'E') != -1 || StringUtils.IndexOf(text, 'e') != -1)
			{
				return text;
			}
			return text + ".0";
		}

		private static string EnsureDecimalPlace(string text)
		{
			if (StringUtils.IndexOf(text, '.') != -1)
			{
				return text;
			}
			return text + ".0";
		}

		public static string ToString(byte value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(sbyte value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(decimal value)
		{
			return EnsureDecimalPlace(value.ToString(null, CultureInfo.InvariantCulture));
		}

		public static string ToString(Guid value)
		{
			return ToString(value, '"');
		}

		internal static string ToString(Guid value, char quoteChar)
		{
			string text = value.ToString("D", CultureInfo.InvariantCulture);
			string text2 = quoteChar.ToString(CultureInfo.InvariantCulture);
			return text2 + text + text2;
		}

		public static string ToString(TimeSpan value)
		{
			return ToString(value, '"');
		}

		internal static string ToString(TimeSpan value, char quoteChar)
		{
			return ToString(value.ToString(), quoteChar);
		}

		public static string ToString(Uri? value)
		{
			if (value == null)
			{
				return Null;
			}
			return ToString(value, '"');
		}

		internal static string ToString(Uri value, char quoteChar)
		{
			return ToString(value.OriginalString, quoteChar);
		}

		public static string ToString(string? value)
		{
			return ToString(value, '"');
		}

		public static string ToString(string? value, char delimiter)
		{
			return ToString(value, delimiter, StringEscapeHandling.Default);
		}

		public static string ToString(string? value, char delimiter, StringEscapeHandling stringEscapeHandling)
		{
			if (delimiter != '"' && delimiter != '\'')
			{
				throw new ArgumentException("Delimiter must be a single or double quote.", "delimiter");
			}
			return JavaScriptUtils.ToEscapedJavaScriptString(value, delimiter, appendDelimiters: true, stringEscapeHandling);
		}

		public static string ToString(object? value)
		{
			if (value == null)
			{
				return Null;
			}
			return ConvertUtils.GetTypeCode(value.GetType()) switch
			{
				PrimitiveTypeCode.String => ToString((string)value), 
				PrimitiveTypeCode.Char => ToString((char)value), 
				PrimitiveTypeCode.Boolean => ToString((bool)value), 
				PrimitiveTypeCode.SByte => ToString((sbyte)value), 
				PrimitiveTypeCode.Int16 => ToString((short)value), 
				PrimitiveTypeCode.UInt16 => ToString((ushort)value), 
				PrimitiveTypeCode.Int32 => ToString((int)value), 
				PrimitiveTypeCode.Byte => ToString((byte)value), 
				PrimitiveTypeCode.UInt32 => ToString((uint)value), 
				PrimitiveTypeCode.Int64 => ToString((long)value), 
				PrimitiveTypeCode.UInt64 => ToString((ulong)value), 
				PrimitiveTypeCode.Single => ToString((float)value), 
				PrimitiveTypeCode.Double => ToString((double)value), 
				PrimitiveTypeCode.DateTime => ToString((DateTime)value), 
				PrimitiveTypeCode.Decimal => ToString((decimal)value), 
				PrimitiveTypeCode.DBNull => Null, 
				PrimitiveTypeCode.DateTimeOffset => ToString((DateTimeOffset)value), 
				PrimitiveTypeCode.Guid => ToString((Guid)value), 
				PrimitiveTypeCode.Uri => ToString((Uri)value), 
				PrimitiveTypeCode.TimeSpan => ToString((TimeSpan)value), 
				PrimitiveTypeCode.BigInteger => ToStringInternal((BigInteger)value), 
				_ => throw new ArgumentException("Unsupported type: {0}. Use the JsonSerializer class to get the object's JSON representation.".FormatWith(CultureInfo.InvariantCulture, value.GetType())), 
			};
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value)
		{
			return SerializeObject(value, (Type?)null, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Formatting formatting)
		{
			return SerializeObject(value, formatting, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return SerializeObject(value, null, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Formatting formatting, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return SerializeObject(value, null, formatting, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, JsonSerializerSettings? settings)
		{
			return SerializeObject(value, null, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Type? type, JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			return SerializeObjectInternal(value, type, jsonSerializer);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Formatting formatting, JsonSerializerSettings? settings)
		{
			return SerializeObject(value, null, formatting, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Type? type, Formatting formatting, JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			jsonSerializer.Formatting = formatting;
			return SerializeObjectInternal(value, type, jsonSerializer);
		}

		private static string SerializeObjectInternal(object? value, Type? type, JsonSerializer jsonSerializer)
		{
			StringWriter stringWriter = new StringWriter(new StringBuilder(256), CultureInfo.InvariantCulture);
			using (JsonTextWriter jsonTextWriter = new JsonTextWriter(stringWriter))
			{
				jsonTextWriter.Formatting = jsonSerializer.Formatting;
				jsonSerializer.Serialize(jsonTextWriter, value, type);
			}
			return stringWriter.ToString();
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value)
		{
			return DeserializeObject(value, (Type?)null, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value, JsonSerializerSettings settings)
		{
			return DeserializeObject(value, null, settings);
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value, Type type)
		{
			return DeserializeObject(value, type, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static T? DeserializeObject<T>(string value)
		{
			return JsonConvert.DeserializeObject<T>(value, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static T? DeserializeAnonymousType<T>(string value, T anonymousTypeObject)
		{
			return DeserializeObject<T>(value);
		}

		[DebuggerStepThrough]
		public static T? DeserializeAnonymousType<T>(string value, T anonymousTypeObject, JsonSerializerSettings settings)
		{
			return DeserializeObject<T>(value, settings);
		}

		[DebuggerStepThrough]
		public static T? DeserializeObject<T>(string value, params JsonConverter[] converters)
		{
			return (T)DeserializeObject(value, typeof(T), converters);
		}

		[DebuggerStepThrough]
		public static T? DeserializeObject<T>(string value, JsonSerializerSettings? settings)
		{
			return (T)DeserializeObject(value, typeof(T), settings);
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value, Type type, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return DeserializeObject(value, type, settings);
		}

		public static object? DeserializeObject(string value, Type? type, JsonSerializerSettings? settings)
		{
			ValidationUtils.ArgumentNotNull(value, "value");
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			if (!jsonSerializer.IsCheckAdditionalContentSet())
			{
				jsonSerializer.CheckAdditionalContent = true;
			}
			using JsonTextReader reader = new JsonTextReader(new StringReader(value));
			return jsonSerializer.Deserialize(reader, type);
		}

		[DebuggerStepThrough]
		public static void PopulateObject(string value, object target)
		{
			PopulateObject(value, target, null);
		}

		public static void PopulateObject(string value, object target, JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			using JsonReader jsonReader = new JsonTextReader(new StringReader(value));
			jsonSerializer.Populate(jsonReader, target);
			if (settings == null || !settings.CheckAdditionalContent)
			{
				return;
			}
			while (jsonReader.Read())
			{
				if (jsonReader.TokenType != JsonToken.Comment)
				{
					throw JsonSerializationException.Create(jsonReader, "Additional text found in JSON string after finishing deserializing object.");
				}
			}
		}

		public static string SerializeXmlNode(XmlNode? node)
		{
			return SerializeXmlNode(node, Formatting.None);
		}

		public static string SerializeXmlNode(XmlNode? node, Formatting formatting)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter();
			return SerializeObject(node, formatting, xmlNodeConverter);
		}

		public static string SerializeXmlNode(XmlNode? node, Formatting formatting, bool omitRootObject)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter
			{
				OmitRootObject = omitRootObject
			};
			return SerializeObject(node, formatting, xmlNodeConverter);
		}

		public static XmlDocument? DeserializeXmlNode(string value)
		{
			return DeserializeXmlNode(value, null);
		}

		public static XmlDocument? DeserializeXmlNode(string value, string? deserializeRootElementName)
		{
			return DeserializeXmlNode(value, deserializeRootElementName, writeArrayAttribute: false);
		}

		public static XmlDocument? DeserializeXmlNode(string value, string? deserializeRootElementName, bool writeArrayAttribute)
		{
			return DeserializeXmlNode(value, deserializeRootElementName, writeArrayAttribute, encodeSpecialCharacters: false);
		}

		public static XmlDocument? DeserializeXmlNode(string value, string? deserializeRootElementName, bool writeArrayAttribute, bool encodeSpecialCharacters)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter();
			xmlNodeConverter.DeserializeRootElementName = deserializeRootElementName;
			xmlNodeConverter.WriteArrayAttribute = writeArrayAttribute;
			xmlNodeConverter.EncodeSpecialCharacters = encodeSpecialCharacters;
			return (XmlDocument)DeserializeObject(value, typeof(XmlDocument), xmlNodeConverter);
		}

		public static string SerializeXNode(XObject? node)
		{
			return SerializeXNode(node, Formatting.None);
		}

		public static string SerializeXNode(XObject? node, Formatting formatting)
		{
			return SerializeXNode(node, formatting, omitRootObject: false);
		}

		public static string SerializeXNode(XObject? node, Formatting formatting, bool omitRootObject)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter
			{
				OmitRootObject = omitRootObject
			};
			return SerializeObject(node, formatting, xmlNodeConverter);
		}

		public static XDocument? DeserializeXNode(string value)
		{
			return DeserializeXNode(value, null);
		}

		public static XDocument? DeserializeXNode(string value, string? deserializeRootElementName)
		{
			return DeserializeXNode(value, deserializeRootElementName, writeArrayAttribute: false);
		}

		public static XDocument? DeserializeXNode(string value, string? deserializeRootElementName, bool writeArrayAttribute)
		{
			return DeserializeXNode(value, deserializeRootElementName, writeArrayAttribute, encodeSpecialCharacters: false);
		}

		public static XDocument? DeserializeXNode(string value, string? deserializeRootElementName, bool writeArrayAttribute, bool encodeSpecialCharacters)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter();
			xmlNodeConverter.DeserializeRootElementName = deserializeRootElementName;
			xmlNodeConverter.WriteArrayAttribute = writeArrayAttribute;
			xmlNodeConverter.EncodeSpecialCharacters = encodeSpecialCharacters;
			return (XDocument)DeserializeObject(value, typeof(XDocument), xmlNodeConverter);
		}
	}
	public abstract class JsonConverter
	{
		public virtual bool CanRead => true;

		public virtual bool CanWrite => true;

		public abstract void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer);

		public abstract object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer);

		public abstract bool CanConvert(Type objectType);
	}
	public abstract class JsonConverter<T> : JsonConverter
	{
		public sealed override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
		{
			if (!((value != null) ? (value is T) : ReflectionUtils.IsNullable(typeof(T))))
			{
				throw new JsonSerializationException("Converter cannot write specified value to JSON. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T)));
			}
			WriteJson(writer, (T)value, serializer);
		}

		public abstract void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer);

		public sealed override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
		{
			bool flag = existingValue == null;
			if (!flag && !(existingValue is T))
			{
				throw new JsonSerializationException("Converter cannot read JSON with the specified existing value. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T)));
			}
			return ReadJson(reader, objectType, flag ? default(T) : ((T)existingValue), !flag, serializer);
		}

		public abstract T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer);

		public sealed override bool CanConvert(Type objectType)
		{
			return typeof(T).IsAssignableFrom(objectType);
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter, AllowMultiple = false)]
	public sealed class JsonConverterAttribute : Attribute
	{
		private readonly Type _converterType;

		public Type ConverterType => _converterType;

		public object[]? ConverterParameters { get; }

		public JsonConverterAttribute(Type converterType)
		{
			if (converterType == null)
			{
				throw new ArgumentNullException("converterType");
			}
			_converterType = converterType;
		}

		public JsonConverterAttribute(Type converterType, params object[] converterParameters)
			: this(converterType)
		{
			ConverterParameters = converterParameters;
		}
	}
	public class JsonConverterCollection : Collection<JsonConverter>
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonDictionaryAttribute : JsonContainerAttribute
	{
		public JsonDictionaryAttribute()
		{
		}

		public JsonDictionaryAttribute(string id)
			: base(id)
		{
		}
	}
	[Serializable]
	public class JsonException : Exception
	{
		public JsonException()
		{
		}

		public JsonException(string message)
			: base(message)
		{
		}

		public JsonException(string message, Exception? innerException)
			: base(message, innerException)
		{
		}

		public JsonException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		internal static JsonException Create(IJsonLineInfo lineInfo, string path, string message)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			return new JsonException(message);
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public class JsonExtensionDataAttribute : Attribute
	{
		public bool WriteData { get; set; }

		public bool ReadData { get; set; }

		public JsonExtensionDataAttribute()
		{
			WriteData = true;
			ReadData = true;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public sealed class JsonIgnoreAttribute : Attribute
	{
	}
	public abstract class JsonNameTable
	{
		public abstract string? Get(char[] key, int start, int length);
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonObjectAttribute : JsonContainerAttribute
	{
		private MemberSerialization _memberSerialization;

		internal MissingMemberHandling? _missingMemberHandling;

		internal Required? _itemRequired;

		internal NullValueHandling? _itemNullValueHandling;

		public MemberSerialization MemberSerialization
		{
			get
			{
				return _memberSerialization;
			}
			set
			{
				_memberSerialization = value;
			}
		}

		public MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling.GetValueOrDefault();
			}
			set
			{
				_missingMemberHandling = value;
			}
		}

		public NullValueHandling ItemNullValueHandling
		{
			get
			{
				return _itemNullValueHandling.GetValueOrDefault();
			}
			set
			{
				_itemNullValueHandling = value;
			}
		}

		public Required ItemRequired
		{
			get
			{
				return _itemRequired.GetValueOrDefault();
			}
			set
			{
				_itemRequired = value;
			}
		}

		public JsonObjectAttribute()
		{
		}

		public JsonObjectAttribute(MemberSerialization memberSerialization)
		{
			MemberSerialization = memberSerialization;
		}

		public JsonObjectAttribute(string id)
			: base(id)
		{
		}
	}
	internal enum JsonContainerType
	{
		None,
		Object,
		Array,
		Constructor
	}
	internal struct JsonPosition
	{
		private static readonly char[] SpecialCharacters = new char[18]
		{
			'.', ' ', '\'', '/', '"', '[', ']', '(', ')', '\t',
			'\n', '\r', '\f', '\b', '\\', '\u0085', '\u2028', '\u2029'
		};

		internal JsonContainerType Type;

		internal int Position;

		internal string? PropertyName;

		internal bool HasIndex;

		public JsonPosition(JsonContainerType type)
		{
			Type = type;
			HasIndex = TypeHasIndex(type);
			Position = -1;
			PropertyName = null;
		}

		internal int CalculateLength()
		{
			switch (Type)
			{
			case JsonContainerType.Object:
				return PropertyName.Length + 5;
			case JsonContainerType.Array:
			case JsonContainerType.Constructor:
				return MathUtils.IntLength((ulong)Position) + 2;
			default:
				throw new ArgumentOutOfRangeException("Type");
			}
		}

		internal void WriteTo(StringBuilder sb, ref StringWriter? writer, ref char[]? buffer)
		{
			switch (Type)
			{
			case JsonContainerType.Object:
			{
				string propertyName = PropertyName;
				if (propertyName.IndexOfAny(SpecialCharacters) != -1)
				{
					sb.Append("['");
					if (writer == null)
					{
						writer = new StringWriter(sb);
					}
					JavaScriptUtils.WriteEscapedJavaScriptString(writer, propertyName, '\'', appendDelimiters: false, JavaScriptUtils.SingleQuoteCharEscapeFlags, StringEscapeHandling.Default, null, ref buffer);
					sb.Append("']");
				}
				else
				{
					if (sb.Length > 0)
					{
						sb.Append('.');
					}
					sb.Append(propertyName);
				}
				break;
			}
			case JsonContainerType.Array:
			case JsonContainerType.Constructor:
				sb.Append('[');
				sb.Append(Position);
				sb.Append(']');
				break;
			}
		}

		internal static bool TypeHasIndex(JsonContainerType type)
		{
			if (type != JsonContainerType.Array)
			{
				return type == JsonContainerType.Constructor;
			}
			return true;
		}

		internal static string BuildPath(List<JsonPosition> positions, JsonPosition? currentPosition)
		{
			int num = 0;
			if (positions != null)
			{
				for (int i = 0; i < positions.Count; i++)
				{
					num += positions[i].CalculateLength();
				}
			}
			if (currentPosition.HasValue)
			{
				num += currentPosition.GetValueOrDefault().CalculateLength();
			}
			StringBuilder stringBuilder = new StringBuilder(num);
			StringWriter writer = null;
			char[] buffer = null;
			if (positions != null)
			{
				foreach (JsonPosition position in positions)
				{
					position.WriteTo(stringBuilder, ref writer, ref buffer);
				}
			}
			currentPosition?.WriteTo(stringBuilder, ref writer, ref buffer);
			return stringBuilder.ToString();
		}

		internal static string FormatMessage(IJsonLineInfo? lineInfo, string path, string message)
		{
			if (!message.EndsWith(Environment.NewLine, StringComparison.Ordinal))
			{
				message = message.Trim();
				if (!StringUtils.EndsWith(message, '.'))
				{
					message += ".";
				}
				message += " ";
			}
			message += "Path '{0}'".FormatWith(CultureInfo.InvariantCulture, path);
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				message += ", line {0}, position {1}".FormatWith(CultureInfo.InvariantCulture, lineInfo.LineNumber, lineInfo.LinePosition);
			}
			message += ".";
			return message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
	public sealed class JsonPropertyAttribute : Attribute
	{
		internal NullValueHandling? _nullValueHandling;

		internal DefaultValueHandling? _defaultValueHandling;

		internal ReferenceLoopHandling? _referenceLoopHandling;

		internal ObjectCreationHandling? _objectCreationHandling;

		internal TypeNameHandling? _typeNameHandling;

		internal bool? _isReference;

		internal int? _order;

		internal Required? _required;

		internal bool? _itemIsReference;

		internal ReferenceLoopHandling? _itemReferenceLoopHandling;

		internal TypeNameHandling? _itemTypeNameHandling;

		public Type? ItemConverterType { get; set; }

		public object[]? ItemConverterParameters { get; set; }

		public Type? NamingStrategyType { get; set; }

		public object[]? NamingStrategyParameters { get; set; }

		public NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling.GetValueOrDefault();
			}
			set
			{
				_nullValueHandling = value;
			}
		}

		public DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling.GetValueOrDefault();
			}
			set
			{
				_defaultValueHandling = value;
			}
		}

		public ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling.GetValueOrDefault();
			}
			set
			{
				_referenceLoopHandling = value;
			}
		}

		public ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling.GetValueOrDefault();
			}
			set
			{
				_objectCreationHandling = value;
			}
		}

		public TypeNameHandling TypeNameHandling
		{
			get
			{
				return _typeNameHandling.GetValueOrDefault();
			}
			set
			{
				_typeNameHandling = value;
			}
		}

		public bool IsReference
		{
			get
			{
				return _isReference.GetValueOrDefault();
			}
			set
			{
				_isReference = value;
			}
		}

		public int Order
		{
			get
			{
				return _order.GetValueOrDefault();
			}
			set
			{
				_order = value;
			}
		}

		public Required Required
		{
			get
			{
				return _required.GetValueOrDefault();
			}
			set
			{
				_required = value;
			}
		}

		public string? PropertyName { get; set; }

		public ReferenceLoopHandling ItemReferenceLoopHandling
		{
			get
			{
				return _itemReferenceLoopHandling.GetValueOrDefault();
			}
			set
			{
				_itemReferenceLoopHandling = value;
			}
		}

		public TypeNameHandling ItemTypeNameHandling
		{
			get
			{
				return _itemTypeNameHandling.GetValueOrDefault();
			}
			set
			{
				_itemTypeNameHandling = value;
			}
		}

		public bool ItemIsReference
		{
			get
			{
				return _itemIsReference.GetValueOrDefault();
			}
			set
			{
				_itemIsReference = value;
			}
		}

		public JsonPropertyAttribute()
		{
		}

		public JsonPropertyAttribute(string propertyName)
		{
			PropertyName = propertyName;
		}
	}
	public abstract class JsonReader : IDisposable
	{
		protected internal enum State
		{
			Start,
			Complete,
			Property,
			ObjectStart,
			Object,
			ArrayStart,
			Array,
			Closed,
			PostValue,
			ConstructorStart,
			Constructor,
			Error,
			Finished
		}

		private JsonToken _tokenType;

		private object? _value;

		internal char _quoteChar;

		internal State _currentState;

		private JsonPosition _currentPosition;

		private CultureInfo? _culture;

		private DateTimeZoneHandling _dateTimeZoneHandling;

		private int? _maxDepth;

		private bool _hasExceededMaxDepth;

		internal DateParseHandling _dateParseHandling;

		internal FloatParseHandling _floatParseHandling;

		private string? _dateFormatString;

		private List<JsonPosition>? _stack;

		protected State CurrentState => _currentState;

		public bool CloseInput { get; set; }

		public bool SupportMultipleContent { get; set; }

		public virtual char QuoteChar
		{
			get
			{
				return _quoteChar;
			}
			protected internal set
			{
				_quoteChar = value;
			}
		}

		public DateTimeZoneHandling DateTimeZoneHandling
		{
			get
			{
				return _dateTimeZoneHandling;
			}
			set
			{
				if (value < DateTimeZoneHandling.Local || value > DateTimeZoneHandling.RoundtripKind)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_dateTimeZoneHandling = value;
			}
		}

		public DateParseHandling DateParseHandling
		{
			get
			{
				return _dateParseHandling;
			}
			set
			{
				if (value < DateParseHandling.None || value > DateParseHandling.DateTimeOffset)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_dateParseHandling = value;
			}
		}

		public FloatParseHandling FloatParseHandling
		{
			get
			{
				return _floatParseHandling;
			}
			set
			{
				if (value < FloatParseHandling.Double || value > FloatParseHandling.Decimal)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_floatParseHandling = value;
			}
		}

		public string? DateFormatString
		{
			get
			{
				return _dateFormatString;
			}
			set
			{
				_dateFormatString = value;
			}
		}

		public int? MaxDepth
		{
			get
			{
				return _maxDepth;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentException("Value must be positive.", "value");
				}
				_maxDepth = value;
			}
		}

		public virtual JsonToken TokenType => _tokenType;

		public virtual object? Value => _value;

		public virtual Type? ValueType => _value?.GetType();

		public virtual int Depth
		{
			get
			{
				int num = _stack?.Count ?? 0;
				if (JsonTokenUtils.IsStartToken(TokenType) || _currentPosition.Type == JsonContainerType.None)
				{
					return num;
				}
				return num + 1;
			}
		}

		public virtual string Path
		{
			get
			{
				if (_currentPosition.Type == JsonContainerType.None)
				{
					return string.Empty;
				}
				JsonPosition? currentPosition = ((_currentState != State.ArrayStart && _currentState != State.ConstructorStart && _currentState != State.ObjectStart) ? new JsonPosition?(_currentPosition) : null);
				return JsonPosition.BuildPath(_stack, currentPosition);
			}
		}

		public CultureInfo Culture
		{
			get
			{
				return _culture ?? CultureInfo.InvariantCulture;
			}
			set
			{
				_culture = value;
			}
		}

		public virtual Task<bool> ReadAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<bool>() ?? Read().ToAsync();
		}

		public async Task SkipAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			if (TokenType == JsonToken.PropertyName)
			{
				await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			}
			if (JsonTokenUtils.IsStartToken(TokenType))
			{
				int depth = Depth;
				while (await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false) && depth < Depth)
				{
				}
			}
		}

		internal async Task ReaderReadAndAssertAsync(CancellationToken cancellationToken)
		{
			if (!(await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
			{
				throw CreateUnexpectedEndException();
			}
		}

		public virtual Task<bool?> ReadAsBooleanAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<bool?>() ?? Task.FromResult(ReadAsBoolean());
		}

		public virtual Task<byte[]?> ReadAsBytesAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<byte[]>() ?? Task.FromResult(ReadAsBytes());
		}

		internal async Task<byte[]?> ReadArrayIntoByteArrayAsync(CancellationToken cancellationToken)
		{
			List<byte> buffer = new List<byte>();
			do
			{
				if (!(await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
				{
					SetToken(JsonToken.None);
				}
			}
			while (!ReadArrayElementIntoByteArrayReportDone(buffer));
			byte[] array = buffer.ToArray();
			SetToken(JsonToken.Bytes, array, updateIndex: false);
			return array;
		}

		public virtual Task<DateTime?> ReadAsDateTimeAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<DateTime?>() ?? Task.FromResult(ReadAsDateTime());
		}

		public virtual Task<DateTimeOffset?> ReadAsDateTimeOffsetAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<DateTimeOffset?>() ?? Task.FromResult(ReadAsDateTimeOffset());
		}

		public virtual Task<decimal?> ReadAsDecimalAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<decimal?>() ?? Task.FromResult(ReadAsDecimal());
		}

		public virtual Task<double?> ReadAsDoubleAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return Task.FromResult(ReadAsDouble());
		}

		public virtual Task<int?> ReadAsInt32Async(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<int?>() ?? Task.FromResult(ReadAsInt32());
		}

		public virtual Task<string?> ReadAsStringAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<string>() ?? Task.FromResult(ReadAsString());
		}

		internal async Task<bool> ReadAndMoveToContentAsync(CancellationToken cancellationToken)
		{
			bool flag = await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			if (flag)
			{
				flag = await MoveToContentAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			}
			return flag;
		}

		internal Task<bool> MoveToContentAsync(CancellationToken cancellationToken)
		{
			JsonToken tokenType = TokenType;
			if (tokenType == JsonToken.None || tokenType == JsonToken.Comment)
			{
				return MoveToContentFromNonContentAsync(cancellationToken);
			}
			return AsyncUtils.True;
		}

		private async Task<bool> MoveToContentFromNonContentAsync(CancellationToken cancellationToken)
		{
			JsonToken tokenType;
			do
			{
				if (!(await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
				{
					return false;
				}
				tokenType = TokenType;
			}
			while (tokenType == JsonToken.None || tokenType == JsonToken.Comment);
			return true;
		}

		internal JsonPosition GetPosition(int depth)
		{
			if (_stack != null && depth < _stack.Count)
			{
				return _stack[depth];
			}
			return _currentPosition;
		}

		protected JsonReader()
		{
			_currentState = State.Start;
			_dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;
			_dateParseHandling = DateParseHandling.DateTime;
			_floatParseHandling = FloatParseHandling.Double;
			_maxDepth = 64;
			CloseInput = true;
		}

		private void Push(JsonContainerType value)
		{
			UpdateScopeWithFinishedValue();
			if (_currentPosition.Type == JsonContainerType.None)
			{
				_currentPosition = new JsonPosition(value);
				return;
			}
			if (_stack == null)
			{
				_stack = new List<JsonPosition>();
			}
			_stack.Add(_currentPosition);
			_currentPosition = new JsonPosition(value);
			if (!_maxDepth.HasValue || !(Depth + 1 > _maxDepth) || _hasExceededMaxDepth)
			{
				return;
			}
			_hasExceededMaxDepth = true;
			throw JsonReaderException.Create(this, "The reader's MaxDepth of {0} has been exceeded.".FormatWith(CultureInfo.InvariantCulture, _maxDepth));
		}

		private JsonContainerType Pop()
		{
			JsonPosition currentPosition;
			if (_stack != null && _stack.Count > 0)
			{
				currentPosition = _currentPosition;
				_currentPosition = _stack[_stack.Count - 1];
				_stack.RemoveAt(_stack.Count - 1);
			}
			else
			{
				currentPosition = _currentPosition;
				_currentPosition = default(JsonPosition);
			}
			if (_maxDepth.HasValue && Depth <= _maxDepth)
			{
				_hasExceededMaxDepth = false;
			}
			return currentPosition.Type;
		}

		private JsonContainerType Peek()
		{
			return _currentPosition.Type;
		}

		public abstract bool Read();

		public virtual int? ReadAsInt32()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				object value = Value;
				if (value is int)
				{
					return (int)value;
				}
				int num;
				if (value is BigInteger bigInteger)
				{
					num = (int)bigInteger;
				}
				else
				{
					try
					{
						num = Convert.ToInt32(value, CultureInfo.InvariantCulture);
					}
					catch (Exception ex)
					{
						throw JsonReaderException.Create(this, "Could not convert to integer: {0}.".FormatWith(CultureInfo.InvariantCulture, value), ex);
					}
				}
				SetToken(JsonToken.Integer, num, updateIndex: false);
				return num;
			}
			case JsonToken.String:
			{
				string s = (string)Value;
				return ReadInt32String(s);
			}
			default:
				throw JsonReaderException.Create(this, "Error reading integer. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal int? ReadInt32String(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (int.TryParse(s, NumberStyles.Integer, Culture, out var result))
			{
				SetToken(JsonToken.Integer, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to integer: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual string? ReadAsString()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.String:
				return (string)Value;
			default:
				if (JsonTokenUtils.IsPrimitiveToken(contentToken))
				{
					object value = Value;
					if (value != null)
					{
						string text = ((!(value is IFormattable formattable)) ? ((value is Uri uri) ? uri.OriginalString : value.ToString()) : formattable.ToString(null, Culture));
						SetToken(JsonToken.String, text, updateIndex: false);
						return text;
					}
				}
				throw JsonReaderException.Create(this, "Error reading string. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		public virtual byte[]? ReadAsBytes()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.StartObject:
			{
				ReadIntoWrappedTypeObject();
				byte[] array2 = ReadAsBytes();
				ReaderReadAndAssert();
				if (TokenType != JsonToken.EndObject)
				{
					throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
				}
				SetToken(JsonToken.Bytes, array2, updateIndex: false);
				return array2;
			}
			case JsonToken.String:
			{
				string text = (string)Value;
				Guid g;
				byte[] array3 = ((text.Length == 0) ? CollectionUtils.ArrayEmpty<byte>() : ((!ConvertUtils.TryConvertGuid(text, out g)) ? Convert.FromBase64String(text) : g.ToByteArray()));
				SetToken(JsonToken.Bytes, array3, updateIndex: false);
				return array3;
			}
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Bytes:
				if (Value is Guid guid)
				{
					byte[] array = guid.ToByteArray();
					SetToken(JsonToken.Bytes, array, updateIndex: false);
					return array;
				}
				return (byte[])Value;
			case JsonToken.StartArray:
				return ReadArrayIntoByteArray();
			default:
				throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal byte[] ReadArrayIntoByteArray()
		{
			List<byte> list = new List<byte>();
			do
			{
				if (!Read())
				{
					SetToken(JsonToken.None);
				}
			}
			while (!ReadArrayElementIntoByteArrayReportDone(list));
			byte[] array = list.ToArray();
			SetToken(JsonToken.Bytes, array, updateIndex: false);
			return array;
		}

		private bool ReadArrayElementIntoByteArrayReportDone(List<byte> buffer)
		{
			switch (TokenType)
			{
			case JsonToken.None:
				throw JsonReaderException.Create(this, "Unexpected end when reading bytes.");
			case JsonToken.Integer:
				buffer.Add(Convert.ToByte(Value, CultureInfo.InvariantCulture));
				return false;
			case JsonToken.EndArray:
				return true;
			case JsonToken.Comment:
				return false;
			default:
				throw JsonReaderException.Create(this, "Unexpected token when reading bytes: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
			}
		}

		public virtual double? ReadAsDouble()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				object value = Value;
				if (value is double)
				{
					return (double)value;
				}
				double num = ((!(value is BigInteger bigInteger)) ? Convert.ToDouble(value, CultureInfo.InvariantCulture) : ((double)bigInteger));
				SetToken(JsonToken.Float, num, updateIndex: false);
				return num;
			}
			case JsonToken.String:
				return ReadDoubleString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading double. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal double? ReadDoubleString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (double.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, Culture, out var result))
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to double: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual bool? ReadAsBoolean()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				bool flag = ((!(Value is BigInteger bigInteger)) ? Convert.ToBoolean(Value, CultureInfo.InvariantCulture) : (bigInteger != 0L));
				SetToken(JsonToken.Boolean, flag, updateIndex: false);
				return flag;
			}
			case JsonToken.String:
				return ReadBooleanString((string)Value);
			case JsonToken.Boolean:
				return (bool)Value;
			default:
				throw JsonReaderException.Create(this, "Error reading boolean. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal bool? ReadBooleanString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (bool.TryParse(s, out var result))
			{
				SetToken(JsonToken.Boolean, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to boolean: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual decimal? ReadAsDecimal()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				object value = Value;
				if (value is decimal)
				{
					return (decimal)value;
				}
				decimal num;
				if (value is BigInteger bigInteger)
				{
					num = (decimal)bigInteger;
				}
				else
				{
					try
					{
						num = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
					}
					catch (Exception ex)
					{
						throw JsonReaderException.Create(this, "Could not convert to decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, value), ex);
					}
				}
				SetToken(JsonToken.Float, num, updateIndex: false);
				return num;
			}
			case JsonToken.String:
				return ReadDecimalString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading decimal. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal decimal? ReadDecimalString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (decimal.TryParse(s, NumberStyles.Number, Culture, out var result))
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			if (ConvertUtils.DecimalTryParse(s.ToCharArray(), 0, s.Length, out result) == ParseResult.Success)
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual DateTime? ReadAsDateTime()
		{
			switch (GetContentToken())
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Date:
				if (Value is DateTimeOffset dateTimeOffset)
				{
					SetToken(JsonToken.Date, dateTimeOffset.DateTime, updateIndex: false);
				}
				return (DateTime)Value;
			case JsonToken.String:
				return ReadDateTimeString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading date. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
			}
		}

		internal DateTime? ReadDateTimeString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (DateTimeUtils.TryParseDateTime(s, DateTimeZoneHandling, _dateFormatString, Culture, out var dt))
			{
				dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling);
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			if (DateTime.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt))
			{
				dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling);
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			throw JsonReaderException.Create(this, "Could not convert string to DateTime: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual DateTimeOffset? ReadAsDateTimeOffset()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Date:
				if (Value is DateTime dateTime)
				{
					SetToken(JsonToken.Date, new DateTimeOffset(dateTime), updateIndex: false);
				}
				return (DateTimeOffset)Value;
			case JsonToken.String:
			{
				string s = (string)Value;
				return ReadDateTimeOffsetString(s);
			}
			default:
				throw JsonReaderException.Create(this, "Error reading date. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal DateTimeOffset? ReadDateTimeOffsetString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (DateTimeUtils.TryParseDateTimeOffset(s, _dateFormatString, Culture, out var dt))
			{
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			if (DateTimeOffset.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt))
			{
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to DateTimeOffset: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		internal void ReaderReadAndAssert()
		{
			if (!Read())
			{
				throw CreateUnexpectedEndException();
			}
		}

		internal JsonReaderException CreateUnexpectedEndException()
		{
			return JsonReaderException.Create(this, "Unexpected end when reading JSON.");
		}

		internal void ReadIntoWrappedTypeObject()
		{
			ReaderReadAndAssert();
			if (Value != null && Value.ToString() == "$type")
			{
				ReaderReadAndAssert();
				if (Value != null && Value.ToString().StartsWith("System.Byte[]", StringComparison.Ordinal))
				{
					ReaderReadAndAssert();
					if (Value.ToString() == "$value")
					{
						return;
					}
				}
			}
			throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, JsonToken.StartObject));
		}

		public void Skip()
		{
			if (TokenType == JsonToken.PropertyName)
			{
				Read();
			}
			if (JsonTokenUtils.IsStartToken(TokenType))
			{
				int depth = Depth;
				while (Read() && depth < Depth)
				{
				}
			}
		}

		protected void SetToken(JsonToken newToken)
		{
			SetToken(newToken, null, updateIndex: true);
		}

		protected void SetToken(JsonToken newToken, object? value)
		{
			SetToken(newToken, value, updateIndex: true);
		}

		protected void SetToken(JsonToken newToken, object? value, bool updateIndex)
		{
			_tokenType = newToken;
			_value = value;
			switch (newToken)
			{
			case JsonToken.StartObject:
				_currentState = State.ObjectStart;
				Push(JsonContainerType.Object);
				break;
			case JsonToken.StartArray:
				_currentState = State.ArrayStart;
				Push(JsonContainerType.Array);
				break;
			case JsonToken.StartConstructor:
				_currentState = State.ConstructorStart;
				Push(JsonContainerType.Constructor);
				break;
			case JsonToken.EndObject:
				ValidateEnd(JsonToken.EndObject);
				break;
			case JsonToken.EndArray:
				ValidateEnd(JsonToken.EndArray);
				break;
			case JsonToken.EndConstructor:
				ValidateEnd(JsonToken.EndConstructor);
				break;
			case JsonToken.PropertyName:
				_currentState = State.Property;
				_currentPosition.PropertyName = (string)value;
				break;
			case JsonToken.Raw:
			case JsonToken.Integer:
			case JsonToken.Float:
			case JsonToken.String:
			case JsonToken.Boolean:
			case JsonToken.Null:
			case JsonToken.Undefined:
			case JsonToken.Date:
			case JsonToken.Bytes:
				SetPostValueState(updateIndex);
				break;
			case JsonToken.Comment:
				break;
			}
		}

		internal void SetPostValueState(bool updateIndex)
		{
			if (Peek() != 0 || SupportMultipleContent)
			{
				_currentState = State.PostValue;
			}
			else
			{
				SetFinished();
			}
			if (updateIndex)
			{
				UpdateScopeWithFinishedValue();
			}
		}

		private void UpdateScopeWithFinishedValue()
		{
			if (_currentPosition.HasIndex)
			{
				_currentPosition.Position++;
			}
		}

		private void ValidateEnd(JsonToken endToken)
		{
			JsonContainerType jsonContainerType = Pop();
			if (GetTypeForCloseToken(endToken) != jsonContainerType)
			{
				throw JsonReaderException.Create(this, "JsonToken {0} is not valid for closing JsonType {1}.".FormatWith(CultureInfo.InvariantCulture, endToken, jsonContainerType));
			}
			if (Peek() != 0 || SupportMultipleContent)
			{
				_currentState = State.PostValue;
			}
			else
			{
				SetFinished();
			}
		}

		protected void SetStateBasedOnCurrent()
		{
			JsonContainerType jsonContainerType = Peek();
			switch (jsonContainerType)
			{
			case JsonContainerType.Object:
				_currentState = State.Object;
				break;
			case JsonContainerType.Array:
				_currentState = State.Array;
				break;
			case JsonContainerType.Constructor:
				_currentState = State.Constructor;
				break;
			case JsonContainerType.None:
				SetFinished();
				break;
			default:
				throw JsonReaderException.Create(this, "While setting the reader state back to current object an unexpected JsonType was encountered: {0}".FormatWith(CultureInfo.InvariantCulture, jsonContainerType));
			}
		}

		private void SetFinished()
		{
			_currentState = ((!SupportMultipleContent) ? State.Finished : State.Start);
		}

		private JsonContainerType GetTypeForCloseToken(JsonToken token)
		{
			return token switch
			{
				JsonToken.EndObject => JsonContainerType.Object, 
				JsonToken.EndArray => JsonContainerType.Array, 
				JsonToken.EndConstructor => JsonContainerType.Constructor, 
				_ => throw JsonReaderException.Create(this, "Not a valid close JsonToken: {0}".FormatWith(CultureInfo.InvariantCulture, token)), 
			};
		}

		void IDisposable.Dispose()
		{
			Dispose(disposing: true);
			GC.SuppressFinalize(this);
		}

		protected virtual void Dispose(bool disposing)
		{
			if (_currentState != State.Closed && disposing)
			{
				Close();
			}
		}

		public virtual void Close()
		{
			_currentState = State.Closed;
			_tokenType = JsonToken.None;
			_value = null;
		}

		internal void ReadAndAssert()
		{
			if (!Read())
			{
				throw JsonSerializationException.Create(this, "Unexpected end when reading JSON.");
			}
		}

		internal void ReadForTypeAndAssert(JsonContract? contract, bool hasConverter)
		{
			if (!ReadForType(contract, hasConverter))
			{
				throw JsonSerializationException.Create(this, "Unexpected end when reading JSON.");
			}
		}

		internal bool ReadForType(JsonContract? contract, bool hasConverter)
		{
			if (hasConverter)
			{
				return Read();
			}
			switch (contract?.InternalReadType ?? ReadType.Read)
			{
			case ReadType.Read:
				return ReadAndMoveToContent();
			case ReadType.ReadAsInt32:
				ReadAsInt32();
				break;
			case ReadType.ReadAsInt64:
			{
				bool result = ReadAndMoveToContent();
				if (TokenType == JsonToken.Undefined)
				{
					throw JsonReaderException.Create(this, "An undefined token is not a valid {0}.".FormatWith(CultureInfo.InvariantCulture, contract?.UnderlyingType ?? typeof(long)));
				}
				return result;
			}
			case ReadType.ReadAsDecimal:
				ReadAsDecimal();
				break;
			case ReadType.ReadAsDouble:
				ReadAsDouble();
				break;
			case ReadType.ReadAsBytes:
				ReadAsBytes();
				break;
			case ReadType.ReadAsBoolean:
				ReadAsBoolean();
				break;
			case ReadType.ReadAsString:
				ReadAsString();
				break;
			case ReadType.ReadAsDateTime:
				ReadAsDateTime();
				break;
			case ReadType.ReadAsDateTimeOffset:
				ReadAsDateTimeOffset();
				break;
			default:
				throw new ArgumentOutOfRangeException();
			}
			return TokenType != JsonToken.None;
		}

		internal bool ReadAndMoveToContent()
		{
			if (Read())
			{
				return MoveToContent();
			}
			return false;
		}

		internal bool MoveToContent()
		{
			JsonToken tokenType = TokenType;
			while (tokenType == JsonToken.None || tokenType == JsonToken.Comment)
			{
				if (!Read())
				{
					return false;
				}
				tokenType = TokenType;
			}
			return true;
		}

		private JsonToken GetContentToken()
		{
			JsonToken tokenType;
			do
			{
				if (!Read())
				{
					SetToken(JsonToken.None);
					return JsonToken.None;
				}
				tokenType = TokenType;
			}
			while (tokenType == JsonToken.Comment);
			return tokenType;
		}
	}
	[Serializable]
	public class JsonReaderException : JsonException
	{
		public int LineNumber { get; }

		public int LinePosition { get; }

		public string? Path { get; }

		public JsonReaderException()
		{
		}

		public JsonReaderException(string message)
			: base(message)
		{
		}

		public JsonReaderException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public JsonReaderException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public JsonReaderException(string message, string path, int lineNumber, int linePosition, Exception? innerException)
			: base(message, innerException)
		{
			Path = path;
			LineNumber = lineNumber;
			LinePosition = linePosition;
		}

		internal static JsonReaderException Create(JsonReader reader, string message)
		{
			return Create(reader, message, null);
		}

		internal static JsonReaderException Create(JsonReader reader, string message, Exception? ex)
		{
			return Create(reader as IJsonLineInfo, reader.Path, message, ex);
		}

		internal static JsonReaderException Create(IJsonLineInfo? lineInfo, string path, string message, Exception? ex)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			int lineNumber;
			int linePosition;
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				lineNumber = lineInfo.LineNumber;
				linePosition = lineInfo.LinePosition;
			}
			else
			{
				lineNumber = 0;
				linePosition = 0;
			}
			return new JsonReaderException(message, path, lineNumber, linePosition, ex);
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public sealed class JsonRequiredAttribute : Attribute
	{
	}
	[Serializable]
	public class JsonSerializationException : JsonException
	{
		public int LineNumber { get; }

		public int LinePosition { get; }

		public string? Path { get; }

		public JsonSerializationException()
		{
		}

		public JsonSerializationException(string message)
			: base(message)
		{
		}

		public JsonSerializationException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public JsonSerializationException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public JsonSerializationException(string message, string path, int lineNumber, int linePosition, Exception? innerException)
			: base(message, innerException)
		{
			Path = path;
			LineNumber = lineNumber;
			LinePosition = linePosition;
		}

		internal static JsonSerializationException Create(JsonReader reader, string message)
		{
			return Create(reader, message, null);
		}

		internal static JsonSerializationException Create(JsonReader reader, string message, Exception? ex)
		{
			return Create(reader as IJsonLineInfo, reader.Path, message, ex);
		}

		internal static JsonSerializationException Create(IJsonLineInfo? lineInfo, string path, string message, Exception? ex)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			int lineNumber;
			int linePosition;
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				lineNumber = lineInfo.LineNumber;
				linePosition = lineInfo.LinePosition;
			}
			else
			{
				lineNumber = 0;
				linePosition = 0;
			}
			return new JsonSerializationException(message, path, lineNumber, linePosition, ex);
		}
	}
	public class JsonSerializer
	{
		internal TypeNameHandling _typeNameHandling;

		internal TypeNameAssemblyFormatHandling _typeNameAssemblyFormatHandling;

		internal PreserveReferencesHandling _preserveReferencesHandling;

		internal ReferenceLoopHandling _referenceLoopHandling;

		internal MissingMemberHandling _missingMemberHandling;

		internal ObjectCreationHandling _objectCreationHandling;

		internal NullValueHandling _nullValueHandling;

		internal DefaultValueHandling _defaultValueHandling;

		internal ConstructorHandling _constructorHandling;

		internal MetadataPropertyHandling _metadataPropertyHandling;

		internal JsonConverterCollection? _converters;

		internal IContractResolver _contractResolver;

		internal ITraceWriter? _traceWriter;

		internal IEqualityComparer? _equalityComparer;

		internal ISerializationBinder _serializationBinder;

		internal StreamingContext _context;

		private IReferenceResolver? _referenceResolver;

		private Formatting? _formatting;

		private DateFormatHandling? _dateFormatHandling;

		private DateTimeZoneHandling? _dateTimeZoneHandling;

		private DateParseHandling? _dateParseHandling;

		private FloatFormatHandling? _floatFormatHandling;

		private FloatParseHandling? _floatParseHandling;

		private StringEscapeHandling? _stringEscapeHandling;

		private CultureInfo _culture;

		private int? _maxDepth;

		private bool _maxDepthSet;

		private bool? _checkAdditionalContent;

		private string? _dateFormatString;

		private bool _dateFormatStringSet;

		public virtual IReferenceResolver? ReferenceResolver
		{
			get
			{
				return GetReferenceResolver();
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Reference resolver cannot be null.");
				}
				_referenceResolver = value;
			}
		}

		[Obsolete("Binder is obsolete. Use SerializationBinder instead.")]
		public virtual SerializationBinder Binder
		{
			get
			{
				if (_serializationBinder is SerializationBinder result)
				{
					return result;
				}
				if (_serializationBinder is SerializationBinderAdapter serializationBinderAdapter)
				{
					return serializationBinderAdapter.SerializationBinder;
				}
				throw new InvalidOperationException("Cannot get SerializationBinder because an ISerializationBinder was previously set.");
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Serialization binder cannot be null.");
				}
				_serializationBinder = (value as ISerializationBinder) ?? new SerializationBinderAdapter(value);
			}
		}

		public virtual ISerializationBinder SerializationBinder
		{
			get
			{
				return _serializationBinder;
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Serialization binder cannot be null.");
				}
				_serializationBinder = value;
			}
		}

		public virtual ITraceWriter? TraceWriter
		{
			get
			{
				return _traceWriter;
			}
			set
			{
				_traceWriter = value;
			}
		}

		public virtual IEqualityComparer? EqualityComparer
		{
			get
			{
				return _equalityComparer;
			}
			set
			{
				_equalityComparer = value;
			}
		}

		public virtual TypeNameHandling TypeNameHandling
		{
			get
			{
				return _typeNameHandling;
			}
			set
			{
				if (value < TypeNameHandling.None || value > TypeNameHandling.Auto)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameHandling = value;
			}
		}

		[Obsolete("TypeNameAssemblyFormat is obsolete. Use TypeNameAssemblyFormatHandling instead.")]
		public virtual FormatterAssemblyStyle TypeNameAssemblyFormat
		{
			get
			{
				return (FormatterAssemblyStyle)_typeNameAssemblyFormatHandling;
			}
			set
			{
				if (value < FormatterAssemblyStyle.Simple || value > FormatterAssemblyStyle.Full)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameAssemblyFormatHandling = (TypeNameAssemblyFormatHandling)value;
			}
		}

		public virtual TypeNameAssemblyFormatHandling TypeNameAssemblyFormatHandling
		{
			get
			{
				return _typeNameAssemblyFormatHandling;
			}
			set
			{
				if (value < TypeNameAssemblyFormatHandling.Simple || value > TypeNameAssemblyFormatHandling.Full)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameAssemblyFormatHandling = value;
			}
		}

		public virtual PreserveReferencesHandling PreserveReferencesHandling
		{
			get
			{
				return _preserveReferencesHandling;
			}
			set
			{
				if (value < PreserveReferencesHandling.None || value > PreserveReferencesHandling.All)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_preserveReferencesHandling = value;
			}
		}

		public virtual ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling;
			}
			set
			{
				if (value < ReferenceLoopHandling.Error || value > ReferenceLoopHandling.Serialize)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_referenceLoopHandling = value;
			}
		}

		public virtual MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling;
			}
			set
			{
				if (value < MissingMemberHandling.Ignore || value > MissingMemberHandling.Error)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_missingMemberHandling = value;
			}
		}

		public virtual NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling;
			}
			set
			{
				if (value < NullValueHandling.Include || value > NullValueHandling.Ignore)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_nullValueHandling = value;
			}
		}

		public virtual DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling;
			}
			set
			{
				if (value < DefaultValueHandling.Include || value > DefaultValueHandling.IgnoreAndPopulate)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_defaultValueHandling = value;
			}
		}

		public virtual ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling;
			}
			set
			{
				if (value < ObjectCreationHandling.Auto || value > ObjectCreationHandling.Replace)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_objectCreationHandling = value;
			}
		}

		public virtual ConstructorHandling ConstructorHandling
		{
			get
			{
				return _constructorHandling;
			}
			set
			{
				if (value < ConstructorHandling.Default || value > ConstructorHandling.AllowNonPublicDefaultConstructor)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_constructorHandling = value;
			}
		}

		public virtual MetadataPropertyHandling MetadataPropertyHandling
		{
			get
			{
				return _metadataPropertyHandling;
			}
			set
			{
				if (value < MetadataPropertyHandling.Default || value > MetadataPropertyHandling.Ignore)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_metadataPropertyHandling = value;
			}
		}

		public virtual JsonConverterCollection Converters
		{
			get
			{
				if (_converters == null)
				{
					_converters = new JsonConverterCollection();
				}
				return _converters;
			}
		}

		public virtual IContractResolver ContractResolver
		{
			get
			{
				return _contractResolver;
			}
			set
			{
				_contractResolver = value ?? DefaultContractResolver.Instance;
			}
		}

		public virtual StreamingContext Context
		{
			get
			{
				return _context;
			}
			set
			{
				_context = value;
			}
		}

		public virtual Formatting Formatting
		{
			get
			{
				return _formatting.GetValueOrDefault();
			}
			set
			{
				_formatting = value;
			}
		}

		public virtual DateFormatHandling DateFormatHandling
		{
			get
			{
				return _dateFormatHandling.GetValueOrDefault();
			}
			set
			{
				_dateFormatHandling = value;
			}
		}

		public virtual DateTimeZoneHandling DateTimeZoneHandling
		{
			get
			{
				return _dateTimeZoneHandling ?? DateTimeZoneHandling.RoundtripKind;
			}
			set
			{
				_dateTimeZoneHandling = value;
			}
		}

		public virtual DateParseHandling DateParseHandling
		{
			get
			{
				return _dateParseHandling ?? DateParseHandling.DateTime;
			}
			set
			{
				_dateParseHandling = value;
			}
		}

		public virtual FloatParseHandling FloatParseHandling
		{
			get
			{
				return _floatParseHandling.GetValueOrDefault();
			}
			set
			{
				_floatParseHandling = value;
			}
		}

		public virtual FloatFormatHandling FloatFormatHandling
		{
			get
			{
				return _floatFormatHandling.GetValueOrDefault();
			}
			set
			{
				_floatFormatHandling = value;
			}
		}

		public virtual StringEscapeHandling StringEscapeHandling
		{
			get
			{
				return _stringEscapeHandling.GetValueOrDefault();
			}
			set
			{
				_stringEscapeHandling = value;
			}
		}

		public virtual string DateFormatString
		{
			get
			{
				return _dateFormatString ?? "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
			}
			set
			{
				_dateFormatString = value;
				_dateFormatStringSet = true;
			}
		}

		public virtual CultureInfo Culture
		{
			get
			{
				return _culture ?? JsonSerializerSettings.DefaultCulture;
			}
			set
			{
				_culture = value;
			}
		}

		public virtual int? MaxDepth
		{
			get
			{
				return _maxDepth;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentException("Value must be positive.", "value");
				}
				_maxDepth = value;
				_maxDepthSet = true;
			}
		}

		public virtual bool CheckAdditionalContent
		{
			get
			{
				return _checkAdditionalContent.GetValueOrDefault();
			}
			set
			{
				_checkAdditionalContent = value;
			}
		}

		public virtual event EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs>? Error;

		internal bool IsCheckAdditionalContentSet()
		{
			return _checkAdditionalContent.HasValue;
		}

		public JsonSerializer()
		{
			_referenceLoopHandling = ReferenceLoopHandling.Error;
			_missingMemberHandling = MissingMemberHandling.Ignore;
			_nullValueHandling = NullValueHandling.Include;
			_defaultValueHandling = DefaultValueHandling.Include;
			_objectCreationHandling = ObjectCreationHandling.Auto;
			_preserveReferencesHandling = PreserveReferencesHandling.None;
			_constructorHandling = ConstructorHandling.Default;
			_typeNameHandling = TypeNameHandling.None;
			_metadataPropertyHandling = MetadataPropertyHandling.Default;
			_context = JsonSerializerSettings.DefaultContext;
			_serializationBinder = DefaultSerializationBinder.Instance;
			_culture = JsonSerializerSettings.DefaultCulture;
			_contractResolver = DefaultContractResolver.Instance;
		}

		public static JsonSerializer Create()
		{
			return new JsonSerializer();
		}

		public static JsonSerializer Create(JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = Create();
			if (settings != null)
			{
				ApplySerializerSettings(jsonSerializer, settings);
			}
			return jsonSerializer;
		}

		public static JsonSerializer CreateDefault()
		{
			return Create(JsonConvert.DefaultSettings?.Invoke());
		}

		public static JsonSerializer CreateDefault(JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = CreateDefault();
			if (settings != null)
			{
				ApplySerializerSettings(jsonSerializer, settings);
			}
			return jsonSerializer;
		}

		private static void ApplySerializerSettings(JsonSerializer serializer, JsonSerializerSettings settings)
		{
			if (!CollectionUtils.IsNullOrEmpty(settings.Converters))
			{
				for (int i = 0; i < settings.Converters.Count; i++)
				{
					serializer.Converters.Insert(i, settings.Converters[i]);
				}
			}
			if (settings._typeNameHandling.HasValue)
			{
				serializer.TypeNameHandling = settings.TypeNameHandling;
			}
			if (settings._metadataPropertyHandling.HasValue)
			{
				serializer.MetadataPropertyHandling = settings.MetadataPropertyHandling;
			}
			if (settings._typeNameAssemblyFormatHandling.HasValue)
			{
				serializer.TypeNameAssemblyFormatHandling = settings.TypeNameAssemblyFormatHandling;
			}
			if (settings._preserveReferencesHandling.HasValue)
			{
				serializer.PreserveReferencesHandling = settings.PreserveReferencesHandling;
			}
			if (settings._referenceLoopHandling.HasValue)
			{
				serializer.ReferenceLoopHandling = settings.ReferenceLoopHandling;
			}
			if (settings._missingMemberHandling.HasValue)
			{
				serializer.MissingMemberHandling = settings.MissingMemberHandling;
			}
			if (settings._objectCreationHandling.HasValue)
			{
				serializer.ObjectCreationHandling = settings.ObjectCreationHandling;
			}
			if (settings._nullValueHandling.HasValue)
			{
				serializer.NullValueHandling = settings.NullValueHandling;
			}
			if (settings._defaultValueHandling.HasValue)
			{
				serializer.DefaultValueHandling = settings.DefaultValueHandling;
			}
			if (settings._constructorHandling.HasValue)
			{
				serializer.ConstructorHandling = settings.ConstructorHandling;
			}
			if (settings._context.HasValue)
			{
				serializer.Context = settings.Context;
			}
			if (settings._checkAdditionalContent.HasValue)
			{
				serializer._checkAdditionalContent = settings._checkAdditionalContent;
			}
			if (settings.Error != null)
			{
				serializer.Error += settings.Error;
			}
			if (settings.ContractResolver != null)
			{
				serializer.ContractResolver = settings.ContractResolver;
			}
			if (settings.ReferenceResolverProvider != null)
			{
				serializer.ReferenceResolver = settings.ReferenceResolverProvider();
			}
			if (settings.TraceWriter != null)
			{
				serializer.TraceWriter = settings.TraceWriter;
			}
			if (settings.EqualityComparer != null)
			{
				serializer.EqualityComparer = settings.EqualityComparer;
			}
			if (settings.SerializationBinder != null)
			{
				serializer.SerializationBinder = settings.SerializationBinder;
			}
			if (settings._formatting.HasValue)
			{
				serializer._formatting = settings._formatting;
			}
			if (settings._dateFormatHandling.HasValue)
			{
				serializer._dateFormatHandling = settings._dateFormatHandling;
			}
			if (settings._dateTimeZoneHandling.HasValue)
			{
				serializer._dateTimeZoneHandling = settings._dateTimeZoneHandling;
			}
			if (settings._dateParseHandling.HasValue)
			{
				serializer._dateParseHandling = settings._dateParseHandling;
			}
			if (settings._dateFormatStringSet)
			{
				serializer._dateFormatString = settings._dateFormatString;
				serializer._dateFormatStringSet = settings._dateFormatStringSet;
			}
			if (settings._floatFormatHandling.HasValue)
			{
				serializer._floatFormatHandling = settings._floatFormatHandling;
			}
			if (settings._floatParseHandling.HasValue)
			{
				serializer._floatParseHandling = settings._floatParseHandling;
			}
			if (settings._stringEscapeHandling.HasValue)
			{
				serializer._stringEscapeHandling = settings._stringEscapeHandling;
			}
			if (settings._culture != null)
			{
				serializer._culture = settings._culture;
			}
			if (settings._maxDepthSet)
			{
				serializer._maxDepth = settings._maxDepth;
				serializer._maxDepthSet = settings._maxDepthSet;
			}
		}

		[DebuggerStepThrough]
		public void Populate(TextReader reader, object target)
		{
			Populate(new JsonTextReader(reader), target);
		}

		[DebuggerStepThrough]
		public void Populate(JsonReader reader, object target)
		{
			PopulateInternal(reader, target);
		}

		internal virtual void PopulateInternal(JsonReader reader, object target)
		{
			ValidationUtils.ArgumentNotNull(reader, "reader");
			ValidationUtils.ArgumentNotNull(target, "target");
			SetupReader(reader, out CultureInfo previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string previousDateFormatString);
			TraceJsonReader traceJsonReader = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? CreateTraceJsonReader(reader) : null);
			new JsonSerializerInternalReader(this).Populate(traceJsonReader ?? reader, target);
			if (traceJsonReader != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonReader.GetDeserializedJsonMessage(), null);
			}
			ResetReader(reader, previousCulture, previousDateTimeZoneHandling, previousDateParseHandling, previousFloatParseHandling, previousMaxDepth, previousDateFormatString);
		}

		[DebuggerStepThrough]
		public object? Deserialize(JsonReader reader)
		{
			return Deserialize(reader, null);
		}

		[DebuggerStepThrough]
		public object? Deserialize(TextReader reader, Type objectType)
		{
			return Deserialize(new JsonTextReader(reader), objectType);
		}

		[DebuggerStepThrough]
		public T? Deserialize<T>(JsonReader reader)
		{
			return (T)Deserialize(reader, typeof(T));
		}

		[DebuggerStepThrough]
		public object? Deserialize(JsonReader reader, Type? objectType)
		{
			return DeserializeInternal(reader, objectType);
		}

		internal virtual object? DeserializeInternal(JsonReader reader, Type? objectType)
		{
			ValidationUtils.ArgumentNotNull(reader, "reader");
			SetupReader(reader, out CultureInfo previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string previousDateFormatString);
			TraceJsonReader traceJsonReader = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? CreateTraceJsonReader(reader) : null);
			object? result = new JsonSerializerInternalReader(this).Deserialize(traceJsonReader ?? reader, objectType, CheckAdditionalContent);
			if (traceJsonReader != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonReader.GetDeserializedJsonMessage(), null);
			}
			ResetReader(reader, previousCulture, previousDateTimeZoneHandling, previousDateParseHandling, previousFloatParseHandling, previousMaxDepth, previousDateFormatString);
			return result;
		}

		internal void SetupReader(JsonReader reader, out CultureInfo? previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string? previousDateFormatString)
		{
			if (_culture != null && !_culture.Equals(reader.Culture))
			{
				previousCulture = reader.Culture;
				reader.Culture = _culture;
			}
			else
			{
				previousCulture = null;
			}
			if (_dateTimeZoneHandling.HasValue && reader.DateTimeZoneHandling != _dateTimeZoneHandling)
			{
				previousDateTimeZoneHandling = reader.DateTimeZoneHandling;
				reader.DateTimeZoneHandling = _dateTimeZoneHandling.GetValueOrDefault();
			}
			else
			{
				previousDateTimeZoneHandling = null;
			}
			if (_dateParseHandling.HasValue && reader.DateParseHandling != _dateParseHandling)
			{
				previousDateParseHandling = reader.DateParseHandling;
				reader.DateParseHandling = _dateParseHandling.GetValueOrDefault();
			}
			else
			{
				previousDateParseHandling = null;
			}
			if (_floatParseHandling.HasValue && reader.FloatParseHandling != _floatParseHandling)
			{
				previousFloatParseHandling = reader.FloatParseHandling;
				reader.FloatParseHandling = _floatParseHandling.GetValueOrDefault();
			}
			else
			{
				previousFloatParseHandling = null;
			}
			if (_maxDepthSet && reader.MaxDepth != _maxDepth)
			{
				previousMaxDepth = reader.MaxDepth;
				reader.MaxDepth = _maxDepth;
			}
			else
			{
				previousMaxDepth = null;
			}
			if (_dateFormatStringSet && reader.DateFormatString != _dateFormatString)
			{
				previousDateFormatString = reader.DateFormatString;
				reader.DateFormatString = _dateFormatString;
			}
			else
			{
				previousDateFormatString = null;
			}
			if (reader is JsonTextReader jsonTextReader && jsonTextReader.PropertyNameTable == null && _contractResolver is DefaultContractResolver defaultContractResolver)
			{
				jsonTextReader.PropertyNameTable = defaultContractResolver.GetNameTable();
			}
		}

		private void ResetReader(JsonReader reader, CultureInfo? previousCulture, DateTimeZoneHandling? previousDateTimeZoneHandling, DateParseHandling? previousDateParseHandling, FloatParseHandling? previousFloatParseHandling, int? previousMaxDepth, string? previousDateFormatString)
		{
			if (previousCulture != null)
			{
				reader.Culture = previousCulture;
			}
			if (previousDateTimeZoneHandling.HasValue)
			{
				reader.DateTimeZoneHandling = previousDateTimeZoneHandling.GetValueOrDefault();
			}
			if (previousDateParseHandling.HasValue)
			{
				reader.DateParseHandling = previousDateParseHandling.GetValueOrDefault();
			}
			if (previousFloatParseHandling.HasValue)
			{
				reader.FloatParseHandling = previousFloatParseHandling.GetValueOrDefault();
			}
			if (_maxDepthSet)
			{
				reader.MaxDepth = previousMaxDepth;
			}
			if (_dateFormatStringSet)
			{
				reader.DateFormatString = previousDateFormatString;
			}
			if (reader is JsonTextReader jsonTextReader && jsonTextReader.PropertyNameTable != null && _contractResolver is DefaultContractResolver defaultContractResolver && jsonTextReader.PropertyNameTable == defaultContractResolver.GetNameTable())
			{
				jsonTextReader.PropertyNameTable = null;
			}
		}

		public void Serialize(TextWriter textWriter, object? value)
		{
			Serialize(new JsonTextWriter(textWriter), value);
		}

		public void Serialize(JsonWriter jsonWriter, object? value, Type? objectType)
		{
			SerializeInternal(jsonWriter, value, objectType);
		}

		public void Serialize(TextWriter textWriter, object? value, Type objectType)
		{
			Serialize(new JsonTextWriter(textWriter), value, objectType);
		}

		public void Serialize(JsonWriter jsonWriter, object? value)
		{
			SerializeInternal(jsonWriter, value, null);
		}

		private TraceJsonReader CreateTraceJsonReader(JsonReader reader)
		{
			TraceJsonReader traceJsonReader = new TraceJsonReader(reader);
			if (reader.TokenType != 0)
			{
				traceJsonReader.WriteCurrentToken();
			}
			return traceJsonReader;
		}

		internal virtual void SerializeInternal(JsonWriter jsonWriter, object? value, Type? objectType)
		{
			ValidationUtils.ArgumentNotNull(jsonWriter, "jsonWriter");
			Formatting? formatting = null;
			if (_formatting.HasValue && jsonWriter.Formatting != _formatting)
			{
				formatting = jsonWriter.Formatting;
				jsonWriter.Formatting = _formatting.GetValueOrDefault();
			}
			DateFormatHandling? dateFormatHandling = null;
			if (_dateFormatHandling.HasValue && jsonWriter.DateFormatHandling != _dateFormatHandling)
			{
				dateFormatHandling = jsonWriter.DateFormatHandling;
				jsonWriter.DateFormatHandling = _dateFormatHandling.GetValueOrDefault();
			}
			DateTimeZoneHandling? dateTimeZoneHandling = null;
			if (_dateTimeZoneHandling.HasValue && jsonWriter.DateTimeZoneHandling != _dateTimeZoneHandling)
			{
				dateTimeZoneHandling = jsonWriter.DateTimeZoneHandling;
				jsonWriter.DateTimeZoneHandling = _dateTimeZoneHandling.GetValueOrDefault();
			}
			FloatFormatHandling? floatFormatHandling = null;
			if (_floatFormatHandling.HasValue && jsonWriter.FloatFormatHandling != _floatFormatHandling)
			{
				floatFormatHandling = jsonWriter.FloatFormatHandling;
				jsonWriter.FloatFormatHandling = _floatFormatHandling.GetValueOrDefault();
			}
			StringEscapeHandling? stringEscapeHandling = null;
			if (_stringEscapeHandling.HasValue && jsonWriter.StringEscapeHandling != _stringEscapeHandling)
			{
				stringEscapeHandling = jsonWriter.StringEscapeHandling;
				jsonWriter.StringEscapeHandling = _stringEscapeHandling.GetValueOrDefault();
			}
			CultureInfo cultureInfo = null;
			if (_culture != null && !_culture.Equals(jsonWriter.Culture))
			{
				cultureInfo = jsonWriter.Culture;
				jsonWriter.Culture = _culture;
			}
			string dateFormatString = null;
			if (_dateFormatStringSet && jsonWriter.DateFormatString != _dateFormatString)
			{
				dateFormatString = jsonWriter.DateFormatString;
				jsonWriter.DateFormatString = _dateFormatString;
			}
			TraceJsonWriter traceJsonWriter = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? new TraceJsonWriter(jsonWriter) : null);
			new JsonSerializerInternalWriter(this).Serialize(traceJsonWriter ?? jsonWriter, value, objectType);
			if (traceJsonWriter != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonWriter.GetSerializedJsonMessage(), null);
			}
			if (formatting.HasValue)
			{
				jsonWriter.Formatting = formatting.GetValueOrDefault();
			}
			if (dateFormatHandling.HasValue)
			{
				jsonWriter.DateFormatHandling = dateFormatHandling.GetValueOrDefault();
			}
			if (dateTimeZoneHandling.HasValue)
			{
				jsonWriter.DateTimeZoneHandling = dateTimeZoneHandling.GetValueOrDefault();
			}
			if (floatFormatHandling.HasValue)
			{
				jsonWriter.FloatFormatHandling = floatFormatHandling.GetValueOrDefault();
			}
			if (stringEscapeHandling.HasValue)
			{
				jsonWriter.StringEscapeHandling = stringEscapeHandling.GetValueOrDefault();
			}
			if (_dateFormatStringSet)
			{
				jsonWriter.DateFormatString = dateFormatString;
			}
			if (cultureInfo != null)
			{
				jsonWriter.Culture = cultureInfo;
			}
		}

		internal IReferenceResolver GetReferenceResolver()
		{
			if (_referenceResolver == null)
			{
				_referenceResolver = new DefaultReferenceResolver();
			}
			return _referenceResolver;
		}

		internal JsonConverter? GetMatchingConverter(Type type)
		{
			return GetMatchingConverter(_converters, type);
		}

		internal static JsonConverter? GetMatchingConverter(IList<JsonConverter>? converters, Type objectType)
		{
			if (converters != null)
			{
				for (int i = 0; i < converters.Count; i++)
				{
					JsonConverter jsonConverter = converters[i];
					if (jsonConverter.CanConvert(objectType))
					{
						return jsonConverter;
					}
				}
			}
			return null;
		}

		internal void OnError(Newtonsoft.Json.Serialization.ErrorEventArgs e)
		{
			this.Error?.Invoke(this, e);
		}
	}
	public class JsonSerializerSettings
	{
		internal const ReferenceLoopHandling DefaultReferenceLoopHandling = ReferenceLoopHandling.Error;

		internal const MissingMemberHandling DefaultMissingMemberHandling = MissingMemberHandling.Ignore;

		internal const NullValueHandling DefaultNullValueHandling = NullValueHandling.Include;

		internal const DefaultValueHandling DefaultDefaultValueHandling = DefaultValueHandling.Include;

		internal const ObjectCreationHandling DefaultObjectCreationHandling = ObjectCreationHandling.Auto;

		internal const PreserveReferencesHandling DefaultPreserveReferencesHandling = PreserveReferencesHandling.None;

		internal const ConstructorHandling DefaultConstructorHandling = ConstructorHandling.Default;

		internal const TypeNameHandling DefaultTypeNameHandling = TypeNameHandling.None;

		internal const MetadataPropertyHandling DefaultMetadataPropertyHandling = MetadataPropertyHandling.Default;

		internal static readonly StreamingContext DefaultContext;

		internal const Formatting DefaultFormatting = Formatting.None;

		internal const DateFormatHandling DefaultDateFormatHandling = DateFormatHandling.IsoDateFormat;

		internal const DateTimeZoneHandling DefaultDateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;

		internal const DateParseHandling DefaultDateParseHandling = DateParseHandling.DateTime;

		internal const FloatParseHandling DefaultFloatParseHandling = FloatParseHandling.Double;

		internal const FloatFormatHandling DefaultFloatFormatHandling = FloatFormatHandling.String;

		internal const StringEscapeHandling DefaultStringEscapeHandling = StringEscapeHandling.Default;

		internal const TypeNameAssemblyFormatHandling DefaultTypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple;

		internal static readonly CultureInfo DefaultCulture;

		internal const bool DefaultCheckAdditionalContent = false;

		internal const string DefaultDateFormatString = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";

		internal const int DefaultMaxDepth = 64;

		internal Formatting? _formatting;

		internal DateFormatHandling? _dateFormatHandling;

		internal DateTimeZoneHandling? _dateTimeZoneHandling;

		internal DateParseHandling? _dateParseHandling;

		internal FloatFormatHandling? _floatFormatHandling;

		internal FloatParseHandling? _floatParseHandling;

		internal StringEscapeHandling? _stringEscapeHandling;

		internal CultureInfo? _culture;

		internal bool? _checkAdditionalContent;

		internal int? _maxDepth;

		internal bool _maxDepthSet;

		internal string? _dateFormatString;

		internal bool _dateFormatStringSet;

		internal TypeNameAssemblyFormatHandling? _typeNameAssemblyFormatHandling;

		internal DefaultValueHandling? _defaultValueHandling;

		internal PreserveReferencesHandling? _preserveReferencesHandling;

		internal NullValueHandling? _nullValueHandling;

		internal ObjectCreationHandling? _objectCreationHandling;

		internal MissingMemberHandling? _missingMemberHandling;

		internal ReferenceLoopHandling? _referenceLoopHandling;

		internal StreamingContext? _context;

		internal ConstructorHandling? _constructorHandling;

		internal TypeNameHandling? _typeNameHandling;

		internal MetadataPropertyHandling? _metadataPropertyHandling;

		public ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling.GetValueOrDefault();
			}
			set
			{
				_referenceLoopHandling = value;
			}
		}

		public MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling.GetValueOrDefault();
			}
			set
			{
				_missingMemberHandling = value;
			}
		}

		public ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling.GetValueOrDefault();
			}
			set
			{
				_objectCreationHandling = value;
			}
		}

		public NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling.GetValueOrDefault();
			}
			set
			{
				_nullValueHandling = value;
			}
		}

		public DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling.GetValueOrDefault();
			}
			set
			{
				_defaultValueHandling = value;
			}
		}

		public IList<JsonConverter> Converters { get; set; }

		public PreserveReferencesHandling PreserveReferencesHandling
		{
			get
			{
				return _preserveReferencesHandling.GetValueOrDef