

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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[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]
[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* av_malloc(ulong size)
{
return vectors.av_malloc(size);
}
public unsafe static void* av_malloc_array(ulonusing System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
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 System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using FFmpeg.AutoGen;
using GameConsole;
using GameConsole.CommandTree;
using GreyAnnouncer.AnnouncerCore;
using GreyAnnouncer.AudioLoading;
using GreyAnnouncer.AudioSourceComponent;
using GreyAnnouncer.Base;
using GreyAnnouncer.Config;
using GreyAnnouncer.FrontEnd;
using GreyAnnouncer.Util;
using HarmonyLib;
using JetBrains.Annotations;
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.Events;
using UnityEngine.InputSystem;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using plog;
using plog.Models;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("GreyAnnouncer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.4.1.0")]
[assembly: AssemblyInformationalVersion("1.4.1+f4bd37883942b0db524b1d306d3f22e8c0839333")]
[assembly: AssemblyProduct("GreyAnnouncer")]
[assembly: AssemblyTitle("GreyAnnouncer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.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]
[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 LinkedList<float[]> _chunks = new LinkedList<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)
{
int num = 0;
int num2 = samples.Length;
while (num2 > 0)
{
int num3 = Math.Min(8192 - _currentPos, num2);
Array.Copy(samples, num, _currentChunk, _currentPos, num3);
_currentPos += num3;
num += num3;
num2 -= num3;
TotalSamples += num3;
if (_currentPos >= 8192)
{
_chunks.AddLast(_currentChunk);
_currentChunk = new float[8192];
_currentPos = 0;
}
}
}
public float[] GetAllSamples()
{
float[] array = new float[TotalSamples];
int num = 0;
foreach (float[] chunk in _chunks)
{
Array.Copy(chunk, 0, array, num, chunk.Length);
num += chunk.Length;
}
if (_currentPos > 0)
{
Array.Copy(_currentChunk, 0, array, num, _currentPos);
}
return array;
}
}
public class Category : MonoBehaviour
{
public Toggle enabledToggle;
public Slider volumeSlider;
public Slider cooldownSlider;
private TextMeshProUGUI _titleText;
private TextMeshProUGUI _volumeLabel;
private TextMeshProUGUI _cooldownLabel;
public void Awake()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
((Graphic)((Component)this).gameObject.AddComponent<Image>()).color = new Color(0.12f, 0.12f, 0.12f, 1f);
HorizontalLayoutGroup obj = ((Component)this).gameObject.AddComponent<HorizontalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = false;
((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false;
((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
((LayoutGroup)obj).childAlignment = (TextAnchor)3;
((HorizontalOrVerticalLayoutGroup)obj).spacing = 6f;
((LayoutGroup)obj).padding = new RectOffset(8, 8, 3, 3);
((Component)this).gameObject.AddComponent<LayoutElement>().preferredHeight = 28f;
_titleText = UIBuilder.AddLabel(((Component)this).transform, "Category", 13, new Color(0f, 1f, 1f), -1f, 110f, 0f, (TextAlignmentOptions)4097);
UIBuilder.AddLabel(((Component)this).transform, "En", 12, Color.white, -1f, 18f, 0f, (TextAlignmentOptions)4097);
enabledToggle = UIBuilder.AddToggle(((Component)this).transform);
UIBuilder.AddLabel(((Component)this).transform, "Vol", 12, Color.white, -1f, 24f, 0f, (TextAlignmentOptions)4097);
volumeSlider = AddSteppedSlider("VolumeSlider", 0f, 5f, 0.1f);
_volumeLabel = UIBuilder.AddLabel(((Component)this).transform, "1.0", 12, Color.white, -1f, 32f, 0f, (TextAlignmentOptions)4097);
((UnityEvent<float>)(object)volumeSlider.onValueChanged).AddListener((UnityAction<float>)delegate(float v)
{
((TMP_Text)_volumeLabel).text = v.ToString("F1");
});
UIBuilder.AddLabel(((Component)this).transform, "CD", 12, Color.white, -1f, 22f, 0f, (TextAlignmentOptions)4097);
cooldownSlider = AddSteppedSlider("CooldownSlider", 0f, 10f, 0.1f);
_cooldownLabel = UIBuilder.AddLabel(((Component)this).transform, "3.0", 12, Color.white, -1f, 32f, 0f, (TextAlignmentOptions)4097);
((UnityEvent<float>)(object)cooldownSlider.onValueChanged).AddListener((UnityAction<float>)delegate(float v)
{
((TMP_Text)_cooldownLabel).text = v.ToString("F1");
});
}
public void SetName(string name)
{
((TMP_Text)_titleText).text = name;
}
public void SetVolume(float v)
{
volumeSlider.SetValueWithoutNotify(v);
((TMP_Text)_volumeLabel).text = v.ToString("F1");
}
public void SetCooldown(float v)
{
cooldownSlider.SetValueWithoutNotify(v);
((TMP_Text)_cooldownLabel).text = v.ToString("F1");
}
private Slider AddSteppedSlider(string name, float min, float max, float step)
{
Slider s = UIBuilder.AddSlider(((Component)this).transform, min, min, max);
((Object)((Component)s).gameObject).name = name;
s.wholeNumbers = false;
((UnityEvent<float>)(object)s.onValueChanged).AddListener((UnityAction<float>)delegate(float v)
{
s.SetValueWithoutNotify(Mathf.Round(v / step) * step);
});
return s;
}
}
internal static class LogHelper
{
internal static ManualLogSource log { get; set; }
public static void LogInfo(object data, [CallerMemberName] string member = "")
{
ManualLogSource obj = log;
if (obj != null)
{
obj.LogInfo((object)$"[{member}] {data}");
}
}
public static void LogWarning(object data, [CallerMemberName] string member = "")
{
ManualLogSource obj = log;
if (obj != null)
{
obj.LogWarning((object)$"[{member}] {data}");
}
}
public static void LogError(object data, [CallerMemberName] string member = "")
{
ManualLogSource obj = log;
if (obj != null)
{
obj.LogError((object)$"[{member}] {data}");
}
}
public static void LogDebug(object data, [CallerMemberName] string member = "")
{
ManualLogSource obj = log;
if (obj != null)
{
obj.LogDebug((object)$"[{member}] {data}");
}
}
private static string GetClassName(string path)
{
return Path.GetFileNameWithoutExtension(path);
}
}
namespace GreyAnnouncer
{
public enum AudioLoadOptions
{
Load_then_Play,
Preload_and_Play
}
public enum AudioPlayOptions
{
Override_Last,
Independent
}
[PublicAPI]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method, Inherited = false)]
public sealed class EntryPointAttribute : Attribute
{
}
[PublicAPI]
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
internal sealed class PatchOnEntryAttribute : Attribute
{
}
[BepInPlugin("greycsont.ultrakill.GreyAnnouncer", "Grey Announcer", "1.4.1")]
[BepInProcess("ULTRAKILL.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
((Object)((Component)this).gameObject).hideFlags = (HideFlags)4;
LogHelper.log = ((BaseUnityPlugin)this).Logger;
LogHelper.LogInfo("Plugin greycsont.ultrakill.GreyAnnouncer is loaded!", "Awake");
LoadMainModule();
LoadOptionalModule();
}
private void LoadMainModule()
{
PluginSettings.Initialize();
}
private void LoadOptionalModule()
{
LoadPatches();
}
private void LoadPatches()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
Harmony val = new Harmony("greycsont.ultrakill.GreyAnnouncer");
List<MethodInfo> list = new List<MethodInfo>();
Type[] types = typeof(Plugin).Assembly.GetTypes();
foreach (Type type in types)
{
if (type.GetCustomAttribute<PatchOnEntryAttribute>() != null)
{
try
{
val.PatchAll(type);
}
catch (Exception arg)
{
LogHelper.LogError($"FUCK PATCHING {type.Name}, {arg}", "LoadPatches");
throw;
}
}
if (type.GetCustomAttribute<EntryPointAttribute>() == null)
{
continue;
}
MethodInfo[] array = (from mi in type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
where mi.GetCustomAttribute<EntryPointAttribute>() != null
select mi).ToArray();
int num = array.Length;
if (num <= 1)
{
switch (num)
{
case 0:
LogHelper.LogError("Type " + type.FullName + " is marked as an entry point but has no methods marked with EntryPointAttribute.", "LoadPatches");
break;
case 1:
if (array[0].GetParameters().Length != 0)
{
LogHelper.LogError("Entry point method " + type.FullName + "." + array[0].Name + " must have no parameters.", "LoadPatches");
}
else
{
list.Add(array[0]);
}
break;
}
}
else
{
LogHelper.LogError("Type " + type.FullName + " has multiple entry points defined. Only one is allowed.", "LoadPatches");
}
}
foreach (MethodInfo item in list)
{
LogHelper.LogInfo("Invoking entry point: " + item.DeclaringType?.FullName + "." + item.Name, "LoadPatches");
try
{
item.Invoke(null, null);
}
catch (Exception data)
{
LogHelper.LogError(data, "LoadPatches");
}
}
}
}
[EntryPoint]
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))
{
LogHelper.LogWarning("Plugin " + guid + " not loaded, skipping " + moduleName, "LoadIfPluginExists");
return;
}
try
{
loader?.Invoke();
LogHelper.LogInfo("Loaded optional module: " + moduleName, "LoadIfPluginExists");
}
catch (Exception ex)
{
LogHelper.LogError("Exception while loading " + moduleName + ": " + ex.Message, "LoadIfPluginExists");
}
}
[EntryPoint]
public static void CheckPluginLoaded()
{
LoadIfPluginExists("com.eternalUnion.pluginConfigurator", "PluginConfiguratorEntry", delegate
{
LoadByReflection("GreyAnnouncer.FrontEnd.PluginConfiguratorEntry", "Initialize");
});
}
public static void LoadByReflection(string assemblyName, string methodName, object[] parameter = null)
{
try
{
Assembly.GetExecutingAssembly().GetType(assemblyName).GetMethod(methodName, BindingFlags.Static | BindingFlags.Public)?.Invoke(null, parameter);
}
catch (Exception arg)
{
LogHelper.LogError($"Failed to load {assemblyName}'s {methodName} by : {arg}", "LoadByReflection");
}
}
}
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.4.1";
}
}
namespace GreyAnnouncer.Util
{
public sealed class CoroutineRunner : MonoBehaviour
{
[CompilerGenerated]
private static CoroutineRunner <Instance>k__BackingField;
public static CoroutineRunner Instance
{
get
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
if ((Object)(object)<Instance>k__BackingField == (Object)null)
{
GameObject val = new GameObject("CoroutineRunner");
<Instance>k__BackingField = val.AddComponent<CoroutineRunner>();
Object.DontDestroyOnLoad((Object)val);
}
return <Instance>k__BackingField;
}
}
}
public static class FileSystemUtil
{
public static void ValidateAndPrepareDirectory(string directoryPath)
{
if (!Directory.Exists(directoryPath))
{
LogHelper.LogWarning("Directory not found: " + directoryPath, "ValidateAndPrepareDirectory");
Directory.CreateDirectory(directoryPath);
}
}
public static void EnsureDirectoryExists(string filePath)
{
string directoryName = Path.GetDirectoryName(filePath);
if (!Directory.Exists(directoryName))
{
Directory.CreateDirectory(directoryName);
}
}
public static void CopyDirectoryParallel(string source, string targetRoot)
{
try
{
string fileName = Path.GetFileName(source.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar));
string item = Path.Combine(targetRoot, fileName);
Stack<(string, string)> stack = new Stack<(string, string)>();
stack.Push((source, item));
while (stack.Count > 0)
{
var (path, currDest) = stack.Pop();
if (!Directory.Exists(currDest))
{
Directory.CreateDirectory(currDest);
}
Parallel.ForEach(Directory.GetFiles(path), new ParallelOptions
{
MaxDegreeOfParallelism = 8
}, delegate(string file)
{
string fileName3 = Path.GetFileName(file);
string destFileName = Path.Combine(currDest, fileName3);
File.Copy(file, destFileName, overwrite: true);
});
string[] directories = Directory.GetDirectories(path);
foreach (string text in directories)
{
string fileName2 = Path.GetFileName(text);
stack.Push((text, Path.Combine(currDest, fileName2)));
}
}
}
catch (Exception ex)
{
LogHelper.LogError("failed to copy: " + ex.Message, "CopyDirectoryParallel");
}
}
}
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 path) where T : class
{
if (!File.Exists(path))
{
return null;
}
return DeserializeJson<T>(path);
}
public static T WriteJson<T>(string path, T data) where T : class
{
string directoryName = Path.GetDirectoryName(path);
if (!Directory.Exists(directoryName))
{
Directory.CreateDirectory(directoryName);
}
return SerializeAndSaveJson(path, data);
}
private static T DeserializeJson<T>(string path) where T : class
{
try
{
return JsonConvert.DeserializeObject<T>(File.ReadAllText(path)) ?? throw new InvalidOperationException("Failed to deserialize JSON at '" + path + "' into type " + typeof(T).Name);
}
catch (FileNotFoundException)
{
return null;
}
catch (Exception ex2)
{
LogHelper.LogError("Error reading JSON '" + path + "': " + ex2.Message, "DeserializeJson");
throw;
}
}
private static T SerializeAndSaveJson<T>(string path, T data) where T : class
{
try
{
string contents = JsonConvert.SerializeObject((object)data, (Formatting)1);
File.WriteAllText(path, contents);
return data;
}
catch (Exception ex)
{
LogHelper.LogError("Error writing JSON '" + path + "': " + ex.Message, "SerializeAndSaveJson");
throw;
}
}
}
public static class PathHelper
{
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))
{
LogHelper.LogInfo("[CleanPath] Path cleaned: Original='" + path + "', Cleaned='" + text + "'", "CleanPath");
}
return text;
}
public static string GetFile(string filePath, string fileName)
{
string text = Path.Combine(filePath, fileName);
if (File.Exists(text))
{
return text;
}
return null;
}
public static bool TryGetExtension(string filePath, out string foundExtension, params string[] extensions)
{
foundExtension = null;
if (string.IsNullOrWhiteSpace(filePath))
{
return false;
}
string[] source = (from e in extensions.SelectMany((string e) => e.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries))
select e.Trim()).ToArray();
string text = filePath.Trim();
while (!string.IsNullOrEmpty(text))
{
string ext = Path.GetExtension(text)?.Trim();
if (string.IsNullOrEmpty(ext))
{
break;
}
if (source.Any((string e) => e.Equals(ext, StringComparison.OrdinalIgnoreCase)))
{
foundExtension = ext;
return true;
}
text = Path.Combine(Path.GetDirectoryName(text) ?? "", Path.GetFileNameWithoutExtension(text));
}
return false;
}
}
public static class ProcessHelper
{
[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
{
LogHelper.LogWarning("Unsupported OS platform.", "OpenDirectory");
}
}
else
{
LogHelper.LogWarning("The path is not valid or the directory does not exist.", "OpenDirectory");
}
}
internal static string FindExecutable(string executableName, string fallbackPath = null)
{
bool num = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
string path = (num ? (executableName + ".exe") : executableName);
char separator = (num ? ';' : ':');
string environmentVariable = Environment.GetEnvironmentVariable(executableName);
if (!string.IsNullOrEmpty(environmentVariable) && Directory.Exists(environmentVariable) && File.Exists(Path.Combine(environmentVariable, path)))
{
return environmentVariable;
}
string environmentVariable2 = Environment.GetEnvironmentVariable("PATH");
if (!string.IsNullOrEmpty(environmentVariable2))
{
string[] array = environmentVariable2.Split(separator);
foreach (string text in array)
{
if (!string.IsNullOrWhiteSpace(text) && File.Exists(Path.Combine(text, path)))
{
return text;
}
}
}
if (!string.IsNullOrEmpty(fallbackPath) && Directory.Exists(fallbackPath))
{
return fallbackPath;
}
return null;
}
}
public static class UnityPathManager
{
public static Canvas FindCanvas()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
for (int i = 0; i < rootGameObjects.Length; i++)
{
Canvas component = rootGameObjects[i].GetComponent<Canvas>();
if ((Object)(object)component != (Object)null)
{
return component;
}
}
return null;
}
public static async Task<Texture2D> LoadTextureFromFileAsync(string path)
{
UnityWebRequest request = UnityWebRequestTexture.GetTexture("file:///" + path);
try
{
TaskCompletionSource<Texture2D> tcs = new TaskCompletionSource<Texture2D>();
((AsyncOperation)request.SendWebRequest()).completed += delegate
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
if ((int)request.result == 1)
{
tcs.SetResult(DownloadHandlerTexture.GetContent(request));
}
else
{
tcs.SetResult(null);
}
};
return await tcs.Task;
}
finally
{
if (request != null)
{
((IDisposable)request).Dispose();
}
}
}
}
}
namespace GreyAnnouncer.FrontEnd
{
public class AnnouncerConfigFields
{
public BoolField RandomizeAudioField;
public Dictionary<string, CategoryFields> CategoryFields;
}
public class CategoryFields
{
public BoolField Enabled;
public FloatField Volume;
public FloatSliderField Cooldown;
public BoolField ExcludeFromRandom;
}
[Description("This object is loaded via reflection from Plugin.cs")]
public static class PluginConfiguratorEntry
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static OnValueChangeEventDelegate <>9__25_0;
public static OnValueChangeEventDelegate <>9__25_1;
public static EnumValueChangeEventDelegate<AudioPlayOptions> <>9__25_2;
public static EnumValueChangeEventDelegate<AudioLoadOptions> <>9__25_3;
public static OnClick <>9__25_4;
public static OnClick <>9__25_5;
public static OnClick <>9__25_6;
public static BoolValueChangeEventDelegate <>9__26_0;
public static BoolValueChangeEventDelegate <>9__26_1;
public static OnClick <>9__26_2;
public static Action<string> <>9__29_0;
internal void <CreateAudioControls>b__25_0(FloatSliderValueChangeEvent e)
{
Setting.audioSourceVolume = e.newValue;
}
internal void <CreateAudioControls>b__25_1(FloatSliderValueChangeEvent e)
{
Setting.spatialBlend = e.newValue;
}
internal void <CreateAudioControls>b__25_2(EnumValueChangeEvent<AudioPlayOptions> e)
{
Setting.audioPlayOptions = (int)e.value;
}
internal void <CreateAudioControls>b__25_3(EnumValueChangeEvent<AudioLoadOptions> e)
{
Setting.audioLoadingStrategy = (int)e.value;
}
internal void <CreateAudioControls>b__25_4()
{
AnnouncerManager.ReloadAllAnnouncers();
}
internal void <CreateAudioControls>b__25_5()
{
advancedPanel.OpenPanel();
}
internal void <CreateAudioControls>b__25_6()
{
creditPanel.OpenPanel();
}
internal void <CreateAdvancedOptionPanel>b__26_0(BoolValueChangeEvent e)
{
Setting.isLowPassFilterEnabled = e.value;
}
internal void <CreateAdvancedOptionPanel>b__26_1(BoolValueChangeEvent e)
{
Setting.isFFmpegSupportEnabled = e.value;
}
internal void <CreateAdvancedOptionPanel>b__26_2()
{
AudioSourceManager.StopAllAudioSource();
}
internal void <CreateDelegateTextFromBackEnd>b__29_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);
[CompilerGenerated]
private static PluginConfigurator <config>k__BackingField;
public static ConfigHeader audioLoaderLogHeader;
private static ConfigPanel advancedPanel;
private static ConfigPanel creditPanel;
private static List<RegistedAnnouncerPage> _pages = new List<RegistedAnnouncerPage>();
private static FloatSliderField volumeSlider;
private static FloatSliderField spatialBlendSlider;
private static EnumField<AudioPlayOptions> playOption;
private static EnumField<AudioLoadOptions> loadOption;
private static BoolField lowpassToggle;
private static BoolField ffmpegToggle;
public static PluginConfigurator config
{
get
{
return <config>k__BackingField;
}
private set
{
<config>k__BackingField = value;
}
}
public static void Initialize()
{
CreatePluginPages();
Build();
}
private static void CreatePluginPages()
{
config = PluginConfigurator.Create("Grey Announcer", "greycsont.ultrakill.GreyAnnouncer");
config.SetIconWithURL(PathHelper.GetCurrentPluginPath("./../../icon.png"));
}
public static void Build()
{
CreateMainSettingSectionTitle();
CreateAnnouncerPage();
CreateAudioControls();
CreateAdvancedOptionPanel();
CreateCreditsPanel();
CreateAnnouncerSection();
CreateDelegateTextFromBackEnd();
AnnouncerManager.OnRegistered += AddAnnouncerPage;
Setting.syncUI = (Action)Delegate.Combine(Setting.syncUI, new Action(SyncUI));
}
public static void SyncUI()
{
volumeSlider.value = Setting.audioSourceVolume;
playOption.value = (AudioPlayOptions)Setting.audioPlayOptions;
loadOption.value = (AudioLoadOptions)Setting.audioLoadingStrategy;
lowpassToggle.value = Setting.isLowPassFilterEnabled;
ffmpegToggle.value = Setting.isFFmpegSupportEnabled;
}
public static void CreateAnnouncerPage()
{
foreach (IAnnouncer announcer in AnnouncerManager.announcers)
{
RegistedAnnouncerPage item = new RegistedAnnouncerPage(announcer);
_pages.Add(item);
}
}
private static void CreateMainSettingSectionTitle()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
new ConfigSpace(config.rootPanel, 15f);
new ConfigHeader(config.rootPanel, "Main Settings", 24).textColor = m_CyanColour;
}
private static void CreateAudioControls()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Expected O, but got Unknown
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Expected O, but got Unknown
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Expected O, but got Unknown
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Expected O, but got Unknown
volumeSlider = new FloatSliderField(config.rootPanel, "Master Volume", "Audio_Volume", Tuple.Create(0f, 1f), 1f, 2, false);
volumeSlider.value = Setting.audioSourceVolume;
FloatSliderField obj = volumeSlider;
object obj2 = <>c.<>9__25_0;
if (obj2 == null)
{
OnValueChangeEventDelegate val = delegate(FloatSliderValueChangeEvent e)
{
Setting.audioSourceVolume = e.newValue;
};
<>c.<>9__25_0 = val;
obj2 = (object)val;
}
obj.onValueChange += (OnValueChangeEventDelegate)obj2;
spatialBlendSlider = new FloatSliderField(config.rootPanel, "Spatial Blend", "Spatial_Blend", Tuple.Create(0f, 1f), 1f, 2, false);
spatialBlendSlider.value = Setting.spatialBlend;
FloatSliderField obj3 = spatialBlendSlider;
object obj4 = <>c.<>9__25_1;
if (obj4 == null)
{
OnValueChangeEventDelegate val2 = delegate(FloatSliderValueChangeEvent e)
{
Setting.spatialBlend = e.newValue;
};
<>c.<>9__25_1 = val2;
obj4 = (object)val2;
}
obj3.onValueChange += (OnValueChangeEventDelegate)obj4;
playOption = new EnumField<AudioPlayOptions>(config.rootPanel, "Audio Play Strategy", "Audio_Play_Strategy", AudioPlayOptions.Override_Last, false);
playOption.value = (AudioPlayOptions)Setting.audioPlayOptions;
playOption.onValueChange += delegate(EnumValueChangeEvent<AudioPlayOptions> e)
{
Setting.audioPlayOptions = (int)e.value;
};
loadOption = new EnumField<AudioLoadOptions>(config.rootPanel, "Audio Load Strategy", "Audio_Load_Strategy", AudioLoadOptions.Load_then_Play, false);
loadOption.value = (AudioLoadOptions)Setting.audioLoadingStrategy;
loadOption.onValueChange += delegate(EnumValueChangeEvent<AudioLoadOptions> e)
{
Setting.audioLoadingStrategy = (int)e.value;
};
new ConfigSpace(config.rootPanel, 7f);
ButtonArrayField val3 = new ButtonArrayField(config.rootPanel, "audio_button_array", 3, new float[3] { 0.4f, 0.4f, 0.2f }, new string[3] { "Reload", "Advance", "Credit" }, 5f);
ButtonClickEvent obj5 = val3.OnClickEventHandler(0);
object obj6 = <>c.<>9__25_4;
if (obj6 == null)
{
OnClick val4 = delegate
{
AnnouncerManager.ReloadAllAnnouncers();
};
<>c.<>9__25_4 = val4;
obj6 = (object)val4;
}
obj5.onClick += (OnClick)obj6;
ButtonClickEvent obj7 = val3.OnClickEventHandler(1);
object obj8 = <>c.<>9__25_5;
if (obj8 == null)
{
OnClick val5 = delegate
{
advancedPanel.OpenPanel();
};
<>c.<>9__25_5 = val5;
obj8 = (object)val5;
}
obj7.onClick += (OnClick)obj8;
ButtonClickEvent obj9 = val3.OnClickEventHandler(2);
object obj10 = <>c.<>9__25_6;
if (obj10 == null)
{
OnClick val6 = delegate
{
creditPanel.OpenPanel();
};
<>c.<>9__25_6 = val6;
obj10 = (object)val6;
}
obj9.onClick += (OnClick)obj10;
}
private static void CreateAdvancedOptionPanel()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: 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(config.rootPanel, "Advanced", "Advanced_Option");
((ConfigField)advancedPanel).hidden = true;
new ConfigSpace(advancedPanel, 15f);
lowpassToggle = new BoolField(advancedPanel, "LowPassFilter when under water", "LowPassFilter_Enabled", true, false);
lowpassToggle.value = Setting.isLowPassFilterEnabled;
BoolField obj = lowpassToggle;
object obj2 = <>c.<>9__26_0;
if (obj2 == null)
{
BoolValueChangeEventDelegate val = delegate(BoolValueChangeEvent e)
{
Setting.isLowPassFilterEnabled = e.value;
};
<>c.<>9__26_0 = val;
obj2 = (object)val;
}
obj.onValueChange += (BoolValueChangeEventDelegate)obj2;
ffmpegToggle = new BoolField(advancedPanel, "Use FFmpeg to load unknown format", "FFmpeg_Support", false, false);
ffmpegToggle.value = Setting.isFFmpegSupportEnabled;
BoolField obj3 = ffmpegToggle;
object obj4 = <>c.<>9__26_1;
if (obj4 == null)
{
BoolValueChangeEventDelegate val2 = delegate(BoolValueChangeEvent e)
{
Setting.isFFmpegSupportEnabled = e.value;
};
<>c.<>9__26_1 = val2;
obj4 = (object)val2;
}
obj3.onValueChange += (BoolValueChangeEventDelegate)obj4;
new ConfigHeader(advancedPanel, "this will try to load unknown format to AudioClip via FFmpeg\n makesure there's a executable in environment path `ffmpeg` or `PATH`\n\n ", 24)
{
tmpAnchor = (TextAlignmentOptions)258,
textSize = 12,
textColor = m_greyColour
};
new ConfigSpace(config.rootPanel, 15f);
new ConfigHeader(advancedPanel, "Emergency", 24).textColor = m_RedColour;
ButtonField val3 = new ButtonField(advancedPanel, "Stop All Audio Source", "Stop_All_Audio_Source");
object obj5 = <>c.<>9__26_2;
if (obj5 == null)
{
OnClick val4 = delegate
{
AudioSourceManager.StopAllAudioSource();
};
<>c.<>9__26_2 = val4;
obj5 = (object)val4;
}
val3.onClick += (OnClick)obj5;
}
private static void CreateCreditsPanel()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_0080: Unknown result type (might be due to invalid IL or missing references)
creditPanel = new ConfigPanel(config.rootPanel, "Credits", "Credits");
((ConfigField)creditPanel).hidden = true;
new ConfigSpace(creditPanel, 15f);
new ConfigHeader(creditPanel, "Credits", 24).textColor = m_PurpleColour;
new ConfigSpace(creditPanel, 20f);
ConfigHeader val = new ConfigHeader(creditPanel, "", 24)
{
tmpAnchor = (TextAlignmentOptions)257,
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- ULTRASTATS \n(https://thunderstore.io/c/ultrakill/p/AtomSmasher/ULTRASTATS/)\n Great mod, Goat dev");
stringBuilder.AppendLine("\n- Maxwell's puzzling demon \n(https://store.steampowered.com/app/2770160/) Fun puzzle game");
stringBuilder.AppendLine("\n- A mod that currently WIP \n(Advert Placeholder) Pretty FUN I would say");
stringBuilder.AppendLine("\n- HappySKZC, jamcame, ZHU!.");
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");
val.text = stringBuilder.ToString();
}
private static void CreateAnnouncerSection()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
new ConfigHeader(config.rootPanel, "Announcer Section", 24).textColor = m_OrangeColour;
audioLoaderLogHeader = new ConfigHeader(config.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 AddAnnouncerPage(IAnnouncer announcer)
{
RegistedAnnouncerPage item = new RegistedAnnouncerPage(announcer);
_pages.Add(item);
}
}
public class RegistedAnnouncerPage
{
private string _title;
private IAnnouncer _announcer;
private StringListField _announcerField;
private ConfigPanel _panel;
private AnnouncerConfigFields _fields = new AnnouncerConfigFields
{
CategoryFields = new Dictionary<string, CategoryFields>()
};
private ConfigHeader _mismatchHeader;
private static readonly Color HeaderColor = new Color(0.85f, 0.85f, 0.85f, 1f);
private PluginConfigurator _pluginConfigurator => PluginConfiguratorEntry.config;
public RegistedAnnouncerPage(IAnnouncer announcer)
{
Build(announcer);
}
public void Build(IAnnouncer announcer)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_0040: 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_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Expected O, but got Unknown
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Expected O, but got Unknown
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Expected O, but got Unknown
_title = announcer.title;
_announcer = announcer;
_panel = new ConfigPanel(_pluginConfigurator.rootPanel, _title, _title);
new ConfigSpace(_panel, 15f);
new ConfigHeader(_panel, _title, 30).textColor = HeaderColor;
List<string> availablePacks = AudioAnnouncer.GetAvailablePacks(_announcer.title);
_announcerField = new StringListField(_panel, "Selected Announcer", _announcer.title + "_Selected_Announcer", availablePacks, availablePacks.FirstOrDefault() ?? "default", false);
_announcerField.value = Path.GetFileName(_announcer.announcerPath);
_announcerField.onValueChange += (StringListValueChangeEventDelegate)delegate(StringListValueChangeEvent e)
{
_announcer.announcerPath = Path.Combine(Setting.announcersPath, _announcer.title, e.value);
};
new ButtonField(_panel, "Open Current Announcer Folder", _announcer.title + "_Open_Current_Announcer_Folder").onClick += (OnClick)delegate
{
_announcer.EditExternally();
};
_mismatchHeader = new ConfigHeader(_panel, "", 24)
{
textColor = new Color(1f, 0.4f, 0.4f),
textSize = 14
};
if (_announcer.isConfigLoaded)
{
BuildConfigSection();
}
IAnnouncer announcer2 = _announcer;
announcer2.syncUI = (Action)Delegate.Combine(announcer2.syncUI, new Action(ApplyConfigToUI));
}
private void BuildConfigSection()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
new ConfigSpace(_panel, 15f);
new ConfigHeader(_panel, "Configuration", 24);
_fields.RandomizeAudioField = new BoolField(_panel, "Randomize Audio On Play", _announcer.title + "_RandomizeAudioOnPlay", false, false);
_fields.RandomizeAudioField.defaultValue = false;
_fields.RandomizeAudioField.value = _announcer.announcerConfig.RandomizeAudioOnPlay;
_fields.RandomizeAudioField.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e)
{
_announcer.announcerConfig.RandomizeAudioOnPlay = e.value;
};
foreach (KeyValuePair<string, CategorySetting> item in _announcer.announcerConfig.CategorySetting)
{
string key = item.Key;
new ConfigHeader(_panel, item.Key, 24).textColor = new Color(0f, 1f, 1f);
CategoryFields value = new CategoryFields
{
Enabled = CreateEnabledField(_panel, key, defaultValue: true),
Volume = CreateVolumeField(_panel, key, 1f),
Cooldown = CreateCooldownField(_panel, key, 3f),
ExcludeFromRandom = CreateExcludeFromRandomField(_panel, key, defaultValue: false)
};
_fields.CategoryFields[key] = value;
}
}
private BoolField CreateEnabledField(ConfigPanel panel, string guid, bool defaultValue)
{
//IL_004f: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
//IL_0094: Expected O, but got Unknown
string text = _announcer.title + "_" + GuidPrefixAdder.AddPrefixToGUID(guid, "Enabled");
BoolField val = new BoolField(panel, "Enabled", text, defaultValue, false)
{
defaultValue = defaultValue,
value = _announcer.announcerConfig.CategorySetting[guid].Enabled
};
val.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e)
{
_announcer.announcerConfig.CategorySetting[guid].Enabled = e.value;
};
return val;
}
private FloatField CreateVolumeField(ConfigPanel panel, string guid, float defaultValue)
{
//IL_004f: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
//IL_0094: Expected O, but got Unknown
string text = _announcer.title + "_" + GuidPrefixAdder.AddPrefixToGUID(guid, "VolumeMultiplier");
FloatField val = new FloatField(panel, "Volume", text, defaultValue, false)
{
defaultValue = defaultValue,
value = _announcer.announcerConfig.CategorySetting[guid].VolumeMultiplier
};
val.onValueChange += (FloatValueChangeEventDelegate)delegate(FloatValueChangeEvent e)
{
_announcer.announcerConfig.CategorySetting[guid].VolumeMultiplier = e.value;
};
return val;
}
private FloatSliderField CreateCooldownField(ConfigPanel panel, string guid, float defaultValue)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
//IL_00a4: Expected O, but got Unknown
string text = _announcer.title + "_" + GuidPrefixAdder.AddPrefixToGUID(guid, "Cooldown");
FloatSliderField val = new FloatSliderField(panel, "Cooldown", text, Tuple.Create(0.2f, 6f), defaultValue, 1, false)
{
defaultValue = defaultValue,
value = _announcer.announcerConfig.CategorySetting[guid].Cooldown
};
val.onValueChange += (OnValueChangeEventDelegate)delegate(FloatSliderValueChangeEvent e)
{
_announcer.announcerConfig.CategorySetting[guid].Cooldown = e.newValue;
};
return val;
}
private BoolField CreateExcludeFromRandomField(ConfigPanel panel, string guid, bool defaultValue)
{
//IL_004f: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Expected O, but got Unknown
string text = _announcer.title + "_" + GuidPrefixAdder.AddPrefixToGUID(guid, "ExcludeFromRandom");
BoolField val = new BoolField(panel, "Exclude From Random Selection", text, defaultValue, false)
{
defaultValue = defaultValue,
value = _announcer.announcerConfig.CategorySetting[guid].ExcludeFromRandom
};
val.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e)
{
_announcer.announcerConfig.CategorySetting[guid].ExcludeFromRandom = e.value;
};
((ConfigField)val).hidden = !_announcer.announcerConfig.RandomizeAudioOnPlay;
return val;
}
public void ApplyConfigToUI()
{
LogHelper.LogDebug("ApplyConfigToUI called", "ApplyConfigToUI");
string fileName = Path.GetFileName(_announcer.announcerPath);
_announcerField.value = fileName;
if (!_announcer.isConfigLoaded)
{
_mismatchHeader.text = (string.IsNullOrEmpty(_announcer.configMismatchInfo) ? "Config not loaded." : ("Config mismatch — " + _announcer.configMismatchInfo));
return;
}
_mismatchHeader.text = "";
PackConfig announcerConfig = _announcer.announcerConfig;
if (_fields.RandomizeAudioField == null)
{
BuildConfigSection();
}
_fields.RandomizeAudioField.value = announcerConfig.RandomizeAudioOnPlay;
foreach (KeyValuePair<string, CategoryFields> categoryField in _fields.CategoryFields)
{
string key = categoryField.Key;
CategoryFields value = categoryField.Value;
if (announcerConfig.CategorySetting.TryGetValue(key, out var value2))
{
value.Enabled.value = value2.Enabled;
value.Volume.value = value2.VolumeMultiplier;
value.Cooldown.value = value2.Cooldown;
value.ExcludeFromRandom.value = value2.ExcludeFromRandom;
((ConfigField)value.ExcludeFromRandom).hidden = !announcerConfig.RandomizeAudioOnPlay;
}
}
}
}
public class AdvancedPanel : MonoBehaviour
{
[CompilerGenerated]
private static class <>O
{
public static UnityAction <0>__StopAllAudioSource;
}
private Toggle _lpToggle;
private Toggle _ffToggle;
public void SyncUI()
{
_lpToggle.SetIsOnWithoutNotify(Setting.isLowPassFilterEnabled);
_ffToggle.SetIsOnWithoutNotify(Setting.isFFmpegSupportEnabled);
}
public void Awake()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Expected O, but got Unknown
UIBuilder.SetFullStretch(((Component)this).GetComponent<RectTransform>() ?? ((Component)this).gameObject.AddComponent<RectTransform>());
Transform item = UIBuilder.BuildScrollView(((Component)this).transform, new RectOffset(12, 12, 12, 12)).content;
UIBuilder.AddLabel(item, "Advanced", 26, new Color(0.5f, 0.8f, 1f), 23f, -1f, -1f, (TextAlignmentOptions)513);
UIBuilder.AddSeparator(item);
UIBuilder.AddSpace(item, 6f);
Transform transform = UIBuilder.AddRow(item, "LowPass_Row", 28f).transform;
UIBuilder.AddLabel(transform, "LowPass Filter when under water", 13, Color.white, -1f, -1f, 1f, (TextAlignmentOptions)513);
_lpToggle = UIBuilder.AddToggle(transform, 30f);
_lpToggle.isOn = Setting.isLowPassFilterEnabled;
((UnityEvent<bool>)(object)_lpToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool v)
{
Setting.isLowPassFilterEnabled = v;
});
UIBuilder.AddSpace(item, 4f);
Transform transform2 = UIBuilder.AddRow(item, "FFmpeg_Row", 28f).transform;
UIBuilder.AddLabel(transform2, "FFmpeg Support", 13, Color.white, -1f, -1f, 1f, (TextAlignmentOptions)513);
_ffToggle = UIBuilder.AddToggle(transform2, 30f);
_ffToggle.isOn = Setting.isFFmpegSupportEnabled;
((UnityEvent<bool>)(object)_ffToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool v)
{
Setting.isFFmpegSupportEnabled = v;
});
UIBuilder.AddLabel(item, "Enables loading unknown audio/video via FFmpeg.\nMake sure 'ffmpeg' is available in PATH.", 11, UIBuilder.SubLabelColor, 38f, -1f, -1f, (TextAlignmentOptions)513);
UIBuilder.AddSpace(item, 10f);
UIBuilder.AddSeparator(item);
UIBuilder.AddSpace(item, 4f);
UIBuilder.AddLabel(item, "Emergency", 13, new Color(1f, 0.3f, 0.3f), 20f, -1f, -1f, (TextAlignmentOptions)513);
ButtonClickedEvent onClick = UIBuilder.AddButton(item, "Stop All Audio Sources", 13).onClick;
object obj = <>O.<0>__StopAllAudioSource;
if (obj == null)
{
UnityAction val = AudioSourceManager.StopAllAudioSource;
<>O.<0>__StopAllAudioSource = val;
obj = (object)val;
}
((UnityEvent)onClick).AddListener((UnityAction)obj);
Setting.syncUI = (Action)Delegate.Combine(Setting.syncUI, new Action(SyncUI));
}
private void OnDestroy()
{
Setting.syncUI = (Action)Delegate.Remove(Setting.syncUI, new Action(SyncUI));
}
}
public class AnnouncerPanel : MonoBehaviour
{
private IAnnouncer _announcer;
private Transform _content;
private Dropdown _announcerDropdown;
private Toggle _randomizeToggle;
private TextMeshProUGUI _mismatchLabel;
private readonly Dictionary<string, Category> _categories = new Dictionary<string, Category>();
public void Initialize(IAnnouncer announcer)
{
_announcer = announcer;
IAnnouncer announcer2 = _announcer;
announcer2.syncUI = (Action)Delegate.Combine(announcer2.syncUI, new Action(Refresh));
Build();
}
public void Refresh()
{
if (_announcer == null)
{
return;
}
string currentPack = Path.GetFileName(_announcer.announcerPath);
int num = _announcerDropdown.options.FindIndex((OptionData o) => o.text == currentPack);
if (num >= 0)
{
_announcerDropdown.SetValueWithoutNotify(num);
}
if (!_announcer.isConfigLoaded)
{
((TMP_Text)_mismatchLabel).text = (string.IsNullOrEmpty(_announcer.configMismatchInfo) ? "Config not loaded." : ("Config mismatch — " + _announcer.configMismatchInfo));
return;
}
((TMP_Text)_mismatchLabel).text = "";
PackConfig announcerConfig = _announcer.announcerConfig;
if ((Object)(object)_randomizeToggle == (Object)null)
{
BuildConfigSection(announcerConfig);
}
Toggle randomizeToggle = _randomizeToggle;
if (randomizeToggle != null)
{
randomizeToggle.SetIsOnWithoutNotify(announcerConfig.RandomizeAudioOnPlay);
}
foreach (KeyValuePair<string, Category> category in _categories)
{
if (announcerConfig.CategorySetting.TryGetValue(category.Key, out var value))
{
category.Value.enabledToggle.SetIsOnWithoutNotify(value.Enabled);
category.Value.SetVolume(value.VolumeMultiplier);
category.Value.SetCooldown(value.Cooldown);
}
}
}
private void Build()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Expected O, but got Unknown
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
UIBuilder.SetFullStretch(((Component)this).GetComponent<RectTransform>() ?? ((Component)this).gameObject.AddComponent<RectTransform>());
Transform parent = (_content = UIBuilder.BuildScrollView(((Component)this).transform).content);
UIBuilder.AddLabel(parent, _announcer.title, 26, Color.white, 36f, -1f, -1f, (TextAlignmentOptions)513);
UIBuilder.AddSpace(parent, 3f);
UIBuilder.AddLabel(parent, "Selected Announcer", 13, UIBuilder.SubLabelColor, 22f, -1f, -1f, (TextAlignmentOptions)513);
List<string> availablePacks = AudioAnnouncer.GetAvailablePacks(_announcer.title);
_announcerDropdown = UIBuilder.AddDropdown(parent, availablePacks);
string fileName = Path.GetFileName(_announcer.announcerPath);
int num = availablePacks.IndexOf(fileName);
if (num >= 0)
{
_announcerDropdown.SetValueWithoutNotify(num);
}
((UnityEvent<int>)(object)_announcerDropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int idx)
{
string text = _announcerDropdown.options[idx].text;
_announcer.announcerPath = Path.Combine(Setting.announcersPath, _announcer.title, text);
});
UIBuilder.AddSpace(parent, 3f);
((UnityEvent)UIBuilder.AddButton(parent, "Open Current Announcer Folder").onClick).AddListener((UnityAction)delegate
{
_announcer.EditExternally();
});
UIBuilder.AddSpace(parent, 3f);
_mismatchLabel = UIBuilder.AddLabel(parent, "", 14, new Color(1f, 0.4f, 0.4f), 22f, -1f, -1f, (TextAlignmentOptions)513);
if (_announcer.isConfigLoaded)
{
BuildConfigSection(_announcer.announcerConfig);
}
}
private void BuildConfigSection(PackConfig cfg)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
Transform transform = UIBuilder.AddRow(_content, "RandomizeRow").transform;
UIBuilder.AddLabel(transform, "Randomize Audio On Play", 14, Color.white, -1f, 200f, 1f, (TextAlignmentOptions)513);
_randomizeToggle = UIBuilder.AddToggle(transform, 30f);
_randomizeToggle.isOn = cfg.RandomizeAudioOnPlay;
((UnityEvent<bool>)(object)_randomizeToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool v)
{
_announcer.announcerConfig.RandomizeAudioOnPlay = v;
});
UIBuilder.AddSpace(_content, 3f);
UIBuilder.AddLabel(_content, "Configuration", 20, new Color(0.85f, 0.85f, 0.85f), 30f, -1f, -1f, (TextAlignmentOptions)513);
foreach (KeyValuePair<string, CategorySetting> item in cfg.CategorySetting)
{
string key = item.Key;
GameObject val = new GameObject("Category_" + key, new Type[1] { typeof(RectTransform) });
val.transform.SetParent(_content, false);
Category category = val.AddComponent<Category>();
category.SetName(key);
category.enabledToggle.isOn = item.Value.Enabled;
((UnityEvent<bool>)(object)category.enabledToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool v)
{
if (_announcer.announcerConfig.CategorySetting.TryGetValue(key, out var value3))
{
value3.Enabled = v;
}
});
category.SetVolume(item.Value.VolumeMultiplier);
((UnityEvent<float>)(object)category.volumeSlider.onValueChanged).AddListener((UnityAction<float>)delegate(float v)
{
if (_announcer.announcerConfig.CategorySetting.TryGetValue(key, out var value2))
{
value2.VolumeMultiplier = v;
}
});
category.SetCooldown(item.Value.Cooldown);
((UnityEvent<float>)(object)category.cooldownSlider.onValueChanged).AddListener((UnityAction<float>)delegate(float v)
{
if (_announcer.announcerConfig.CategorySetting.TryGetValue(key, out var value))
{
value.Cooldown = v;
}
});
_categories[key] = category;
UIBuilder.AddSpace(_content, 3f);
}
}
}
public class CreditsPanel : MonoBehaviour
{
public void Awake()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
UIBuilder.SetFullStretch(((Component)this).GetComponent<RectTransform>() ?? ((Component)this).gameObject.AddComponent<RectTransform>());
Transform item = UIBuilder.BuildScrollView(((Component)this).transform, new RectOffset(12, 12, 12, 12)).content;
UIBuilder.AddLabel(item, "Credits", 26, new Color(1f, 0.3f, 1f), 23f, -1f, -1f, (TextAlignmentOptions)513);
UIBuilder.AddSeparator(item);
UIBuilder.AddSpace(item, 6f);
UIBuilder.AddLabel(item, BuildCreditText(), 13, Color.white, -1f, -1f, -1f, (TextAlignmentOptions)257);
}
private static string BuildCreditText()
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("Thanks:");
stringBuilder.AppendLine("https://unsplash.com/photos/white-textile-on-brown-wooden-table-_kUxT8WkoeY");
stringBuilder.AppendLine();
stringBuilder.AppendLine("- OSU!");
stringBuilder.AppendLine(" (https://osu.ppy.sh/) some UX are copied from lazer (YES EDIT EXTERNALLY),");
stringBuilder.AppendLine(" use .ini as config cuz `skin.ini` is pretty easy to edit");
stringBuilder.AppendLine();
stringBuilder.AppendLine("- Artless Games");
stringBuilder.AppendLine(" (https://space.bilibili.com/1237125233) 14 Minesweeper variants");
stringBuilder.AppendLine();
stringBuilder.AppendLine("- Announcer Mod");
stringBuilder.AppendLine(" (https://www.nexusmods.com/ultrakill/mods/54) I started this project just");
stringBuilder.AppendLine(" because the mod wasn't updated a few days after revamp");
stringBuilder.AppendLine();
stringBuilder.AppendLine("- PluginConfigurator doc");
stringBuilder.AppendLine(" (https://github.com/eternalUnion/UKPluginConfigurator/wiki)");
stringBuilder.AppendLine(" Easy to use tbh (except changing font)");
stringBuilder.AppendLine();
stringBuilder.AppendLine("- Maxwell's puzzling demon");
stringBuilder.AppendLine(" (https://store.steampowered.com/app/2770160/)");
stringBuilder.AppendLine(" Fun puzzle game");
stringBuilder.AppendLine();
stringBuilder.AppendLine("- A mod that currently WIP");
stringBuilder.AppendLine(" (Advert Placeholder)");
stringBuilder.AppendLine(" Pretty FUN I would say");
stringBuilder.AppendLine();
stringBuilder.AppendLine("- 快乐萨卡兹厨, jamcame, 夕柱.");
stringBuilder.AppendLine();
stringBuilder.AppendLine("- Everyone who used this mod.");
stringBuilder.AppendLine();
stringBuilder.AppendLine();
stringBuilder.AppendLine("- FUCK YOU UNITY.");
stringBuilder.AppendLine();
stringBuilder.AppendLine();
stringBuilder.AppendLine("Turn up the bass!");
stringBuilder.AppendLine("THWWWWOOOOMPPPP DHGDHGDHGDHGDHGDHG BWOBWOBWOBWOB BWOBWOBWOBWOB BWOBWOBWOBWOBWOB");
stringBuilder.AppendLine("BWAHH BWAHH BWAHH HMRMRMRMRMRMRMRMMR WOH WOH WOH- H H H HHHHH");
stringBuilder.AppendLine("THWWOOMPPPP DHGDHGDHGDHGDHGDHG BWOBWOBWOBWOB.. BWOBWOBWOBWOB..");
stringBuilder.AppendLine("BWOBWOBWOBWOBWOB.... HRMMMMMMMMMMMMMMMMRRR- HRRRRRRR HRRRRRRRR HRRRRRR HRRRRRRRR");
stringBuilder.AppendLine("HRRR HR-YOOOH!!!!!!");
stringBuilder.AppendLine();
stringBuilder.AppendLine("- shadow of cats");
return stringBuilder.ToString();
}
}
public class MainPanel : MonoBehaviour
{
[CompilerGenerated]
private static class <>O
{
public static UnityAction <0>__ReloadAllAnnouncers;
}
private Transform _navContent;
private Transform _rightPanelRoot;
private readonly List<AnnouncerPanel> _panels = new List<AnnouncerPanel>();
private readonly List<GameObject> _navButtons = new List<GameObject>();
private GameObject _advancedPanelObj;
private GameObject _creditsPanelObj;
private Slider _volumeSlider;
private Dropdown _playDd;
private Dropdown _loadDd;
public void Awake()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
UIBuilder.SetFullStretch(((Component)this).GetComponent<RectTransform>() ?? ((Component)this).gameObject.AddComponent<RectTransform>());
Transform item = UIBuilder.BuildScrollView(CreatePanel("LeftPanel", 0f, 0.4f, new Color(0.18f, 0.18f, 0.18f, 0.95f)).transform, new RectOffset(8, 8, 8, 8), addScrollbar: false).content;
_navContent = item;
BuildGlobalSettings(_navContent);
GameObject val = CreatePanel("RightPanel", 0.4f, 1f, new Color(0.1f, 0.1f, 0.1f, 1f));
_rightPanelRoot = val.transform;
_advancedPanelObj = CreateSpecialPanel<AdvancedPanel>("AdvancedPanel");
_creditsPanelObj = CreateSpecialPanel<CreditsPanel>("CreditsPanel");
foreach (IAnnouncer allAnnouncer in AnnouncerManager.GetAllAnnouncers())
{
AddAnnouncerPanel(allAnnouncer);
}
AnnouncerManager.OnRegistered += AddAnnouncerPanel;
Setting.syncUI = (Action)Delegate.Combine(Setting.syncUI, new Action(SyncUI));
}
private void OnDestroy()
{
AnnouncerManager.OnRegistered -= AddAnnouncerPanel;
Setting.syncUI = (Action)Delegate.Remove(Setting.syncUI, new Action(SyncUI));
}
private void SyncUI()
{
_volumeSlider.SetValueWithoutNotify(Setting.audioSourceVolume);
_playDd.SetValueWithoutNotify(Setting.audioPlayOptions);
_loadDd.SetValueWithoutNotify(Setting.audioLoadingStrategy);
}
private void BuildGlobalSettings(Transform parent)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Expected O, but got Unknown
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Expected O, but got Unknown
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Expected O, but got Unknown
UIBuilder.AddLabel(parent, "Settings", 15, new Color(0.5f, 0.8f, 1f), 23f, -1f, -1f, (TextAlignmentOptions)513);
UIBuilder.AddLabel(parent, "Master Volume", 12, UIBuilder.SubLabelColor, 20f, -1f, -1f, (TextAlignmentOptions)513);
_volumeSlider = UIBuilder.AddSlider(parent, Setting.audioSourceVolume, 0f, 1f);
((UnityEvent<float>)(object)_volumeSlider.onValueChanged).AddListener((UnityAction<float>)delegate(float v)
{
Setting.audioSourceVolume = v;
});
UIBuilder.AddLabel(parent, "Play Strategy", 12, UIBuilder.SubLabelColor, 20f, -1f, -1f, (TextAlignmentOptions)513);
_playDd = UIBuilder.AddDropdown(parent, (from s in Enum.GetNames(typeof(AudioPlayOptions))
select s.Replace('_', ' ')).ToList(), 30f);
_playDd.value = Setting.audioPlayOptions;
((UnityEvent<int>)(object)_playDd.onValueChanged).AddListener((UnityAction<int>)delegate(int v)
{
Setting.audioPlayOptions = v;
});
UIBuilder.AddLabel(parent, "Load Strategy", 12, UIBuilder.SubLabelColor, 20f, -1f, -1f, (TextAlignmentOptions)513);
_loadDd = UIBuilder.AddDropdown(parent, (from s in Enum.GetNames(typeof(AudioLoadOptions))
select s.Replace('_', ' ')).ToList(), 30f);
_loadDd.value = Setting.audioLoadingStrategy;
((UnityEvent<int>)(object)_loadDd.onValueChanged).AddListener((UnityAction<int>)delegate(int v)
{
Setting.audioLoadingStrategy = v;
});
Transform transform = UIBuilder.AddRow(parent, "ActionRow", 36f).transform;
Button obj = UIBuilder.AddButton(transform, "Reload", 12);
((Component)obj).GetComponent<LayoutElement>().flexibleWidth = 1f;
ButtonClickedEvent onClick = obj.onClick;
object obj2 = <>O.<0>__ReloadAllAnnouncers;
if (obj2 == null)
{
UnityAction val = AnnouncerManager.ReloadAllAnnouncers;
<>O.<0>__ReloadAllAnnouncers = val;
obj2 = (object)val;
}
((UnityEvent)onClick).AddListener((UnityAction)obj2);
Button obj3 = UIBuilder.AddButton(transform, "Advanced", 12);
((Component)obj3).GetComponent<LayoutElement>().flexibleWidth = 1f;
((UnityEvent)obj3.onClick).AddListener(new UnityAction(ShowAdvanced));
Button obj4 = UIBuilder.AddButton(transform, "Credits", 12);
((Component)obj4).GetComponent<LayoutElement>().flexibleWidth = 1f;
((UnityEvent)obj4.onClick).AddListener(new UnityAction(ShowCredits));
UIBuilder.AddSeparator(parent);
UIBuilder.AddLabel(parent, "Announcers", 13, new Color(1f, 0.7f, 0.3f), 21f, -1f, -1f, (TextAlignmentOptions)513);
}
private void AddAnnouncerPanel(IAnnouncer announcer)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
int index = _panels.Count;
Button val = UIBuilder.AddButton(_navContent, announcer.title, 14, 44f);
UIBuilder.StyleButton(((Component)val).gameObject, index == 0);
((UnityEvent)val.onClick).AddListener((UnityAction)delegate
{
ShowPanel(index);
});
GameObject val2 = new GameObject("AnnouncerPanel_" + announcer.title, new Type[1] { typeof(RectTransform) });
val2.transform.SetParent(_rightPanelRoot, false);
UIBuilder.SetFullStretch(val2.GetComponent<RectTransform>());
AnnouncerPanel announcerPanel = val2.AddComponent<AnnouncerPanel>();
announcerPanel.Initialize(announcer);
val2.SetActive(index == 0);
_panels.Add(announcerPanel);
_navButtons.Add(((Component)val).gameObject);
}
private void ShowPanel(int index)
{
_advancedPanelObj.SetActive(false);
_creditsPanelObj.SetActive(false);
for (int i = 0; i < _panels.Count; i++)
{
((Component)_panels[i]).gameObject.SetActive(i == index);
UIBuilder.StyleButton(_navButtons[i], i == index);
}
}
private void ShowAdvanced()
{
foreach (AnnouncerPanel panel in _panels)
{
((Component)panel).gameObject.SetActive(false);
}
foreach (GameObject navButton in _navButtons)
{
UIBuilder.StyleButton(navButton, active: false);
}
_advancedPanelObj.SetActive(true);
_creditsPanelObj.SetActive(false);
}
private void ShowCredits()
{
foreach (AnnouncerPanel panel in _panels)
{
((Component)panel).gameObject.SetActive(false);
}
foreach (GameObject navButton in _navButtons)
{
UIBuilder.StyleButton(navButton, active: false);
}
_advancedPanelObj.SetActive(false);
_creditsPanelObj.SetActive(true);
}
private GameObject CreateSpecialPanel<T>(string name) where T : MonoBehaviour
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
val.transform.SetParent(_rightPanelRoot, false);
UIBuilder.SetFullStretch(val.GetComponent<RectTransform>());
val.AddComponent<T>();
val.SetActive(false);
return val;
}
private GameObject CreatePanel(string name, float xMin, float xMax, Color color)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_0083: Expected O, but got Unknown
GameObject val = new GameObject(name, new Type[2]
{
typeof(RectTransform),
typeof(Image)
});
val.transform.SetParent(((Component)this).transform, false);
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = new Vector2(xMin, 0f);
component.anchorMax = new Vector2(xMax, 1f);
component.offsetMin = Vector2.zero;
component.offsetMax = Vector2.zero;
((Graphic)val.GetComponent<Image>()).color = color;
return val;
}
}
public static class UIBuilder
{
public static readonly Color NavActive = new Color(0.25f, 0.45f, 0.65f);
public static readonly Color NavInactive = new Color(0.22f, 0.22f, 0.22f);
public static readonly Color SeparatorColor = new Color(0.4f, 0.4f, 0.4f);
public static readonly Color SubLabelColor = new Color(0.7f, 0.7f, 0.7f);
public static void SetFullStretch(RectTransform rt)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
rt.anchorMin = Vector2.zero;
rt.anchorMax = Vector2.one;
rt.offsetMin = Vector2.zero;
rt.offsetMax = Vector2.zero;
((Transform)rt).localScale = Vector3.one;
}
public static GameObject AddRow(Transform parent, string name, float height = 30f, float spacing = 8f)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parent, false);
HorizontalLayoutGroup obj = val.AddComponent<HorizontalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false;
((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
((HorizontalOrVerticalLayoutGroup)obj).spacing = spacing;
val.AddComponent<LayoutElement>().preferredHeight = height;
return val;
}
public static TextMeshProUGUI AddLabel(Transform parent, string text, int fontSize, Color color, float preferredHeight = -1f, float preferredWidth = -1f, float flexibleWidth = -1f, TextAlignmentOptions alignment = 513)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Label_" + text, new Type[2]
{
typeof(RectTransform),
typeof(TextMeshProUGUI)
});
val.transform.SetParent(parent, false);
LayoutElement val2 = val.AddComponent<LayoutElement>();
if (preferredHeight >= 0f)
{
val2.preferredHeight = preferredHeight;
}
if (preferredWidth >= 0f)
{
val2.preferredWidth = preferredWidth;
}
if (flexibleWidth >= 0f)
{
val2.flexibleWidth = flexibleWidth;
}
TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
((TMP_Text)component).text = text;
((TMP_Text)component).fontSize = fontSize;
((Graphic)component).color = color;
((TMP_Text)component).alignment = alignment;
return component;
}
public static Button AddButton(Transform parent, string label, int fontSize = 14, float height = 36f)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = DefaultControls.CreateButton(default(Resources));
((Object)obj).name = "Btn_" + label;
obj.transform.SetParent(parent, false);
obj.AddComponent<LayoutElement>().preferredHeight = height;
SetButtonLabel(obj, label, fontSize);
return obj.GetComponent<Button>();
}
public static void StyleButton(GameObject btnObj, bool active)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
Image component = btnObj.GetComponent<Image>();
if (component != null)
{
((Graphic)component).color = (active ? NavActive : NavInactive);
}
}
public static void SetButtonLabel(GameObject btnObj, string text, int fontSize)
{
TextMeshProUGUI componentInChildren = btnObj.GetComponentInChildren<TextMeshProUGUI>();
if (componentInChildren != null)
{
((TMP_Text)componentInChildren).text = text;
((TMP_Text)componentInChildren).fontSize = fontSize;
return;
}
Text componentInChildren2 = btnObj.GetComponentInChildren<Text>();
if (componentInChildren2 != null)
{
componentInChildren2.text = text;
componentInChildren2.fontSize = fontSize;
}
}
public static Toggle AddToggle(Transform parent, float preferredWidth = 24f, float preferredHeight = 28f)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
GameObject val = DefaultControls.CreateToggle(default(Resources));
val.transform.SetParent(parent, false);
LayoutElement val2 = val.AddComponent<LayoutElement>();
val2.preferredWidth = preferredWidth;
val2.flexibleWidth = 0f;
if (preferredHeight >= 0f)
{
val2.preferredHeight = preferredHeight;
}
Toggle component = val.GetComponent<Toggle>();
GameObject val3 = new GameObject("Indicator", new Type[2]
{
typeof(RectTransform),
typeof(TextMeshProUGUI)
});
val3.transform.SetParent(val.transform, false);
SetFullStretch(val3.GetComponent<RectTransform>());
TextMeshProUGUI tmp = val3.GetComponent<TextMeshProUGUI>();
((TMP_Text)tmp).text = (component.isOn ? "x" : "");
((TMP_Text)tmp).fontSize = 14f;
((Graphic)tmp).color = Color.black;
((TMP_Text)tmp).alignment = (TextAlignmentOptions)514;
((Graphic)tmp).raycastTarget = false;
((UnityEvent<bool>)(object)component.onValueChanged).AddListener((UnityAction<bool>)delegate(bool v)
{
((TMP_Text)tmp).text = (v ? "x" : "");
});
return component;
}
public static Slider AddSlider(Transform parent, float value, float min, float max, float preferredHeight = 28f, float preferredWidth = -1f)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = DefaultControls.CreateSlider(default(Resources));
obj.transform.SetParent(parent, false);
LayoutElement val = obj.AddComponent<LayoutElement>();
val.preferredHeight = preferredHeight;
if (preferredWidth >= 0f)
{
val.preferredWidth = preferredWidth;
val.flexibleWidth = 0f;
}
else
{
val.flexibleWidth = 1f;
}
Slider component = obj.GetComponent<Slider>();
component.minValue = min;
component.maxValue = max;
component.value = value;
return component;
}
public static Dropdown AddDropdown(Transform parent, List<string> options, float height = 36f)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = DefaultControls.CreateDropdown(default(Resources));
obj.transform.SetParent(parent, false);
obj.AddComponent<LayoutElement>().preferredHeight = height;
Dropdown component = obj.GetComponent<Dropdown>();
component.ClearOptions();
component.AddOptions(options);
return component;
}
public static void AddSpace(Transform parent, float height)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Space", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parent, false);
val.AddComponent<LayoutElement>().preferredHeight = height;
}
public static void AddSeparator(Transform parent)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Separator", new Type[2]
{
typeof(RectTransform),
typeof(Image)
});
val.transform.SetParent(parent, false);
val.AddComponent<LayoutElement>().preferredHeight = 1f;
((Graphic)val.GetComponent<Image>()).color = SeparatorColor;
}
public static (ScrollRect scrollRect, Transform content) BuildScrollView(Transform parent, RectOffset padding = null, bool addScrollbar = true)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Expected O, but got Unknown
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02de: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Expected O, but got Unknown
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("ScrollView", new Type[2]
{
typeof(RectTransform),
typeof(ScrollRect)
});
val.transform.SetParent(parent, false);
SetFullStretch(val.GetComponent<RectTransform>());
ScrollRect component = val.GetComponent<ScrollRect>();
GameObject val2 = new GameObject("Viewport", new Type[3]
{
typeof(RectTransform),
typeof(RectMask2D),
typeof(Image)
});
val2.transform.SetParent(val.transform, false);
RectTransform component2 = val2.GetComponent<RectTransform>();
SetFullStretch(component2);
if (addScrollbar)
{
component2.offsetMax = new Vector2(-20f, 0f);
}
((Graphic)val2.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0f);
GameObject val3 = new GameObject("Content", new Type[1] { typeof(RectTransform) });
val3.transform.SetParent(val2.transform, false);
RectTransform component3 = val3.GetComponent<RectTransform>();
component3.anchorMin = new Vector2(0f, 1f);
component3.anchorMax = new Vector2(1f, 1f);
component3.pivot = new Vector2(0.5f, 1f);
component3.offsetMin = Vector2.zero;
component3.offsetMax = Vector2.zero;
VerticalLayoutGroup obj = val3.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
((HorizontalOrVerticalLayoutGroup)obj).spacing = 8f;
((LayoutGroup)obj).padding = (RectOffset)(((object)padding) ?? ((object)new RectOffset(12, 12, 12, 12)));
val3.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
component.content = component3;
component.viewport = component2;
component.horizontal = false;
component.vertical = true;
if (addScrollbar)
{
GameObject val4 = new GameObject("Scrollbar", new Type[3]
{
typeof(RectTransform),
typeof(Scrollbar),
typeof(Image)
});
val4.transform.SetParent(val.transform, false);
RectTransform component4 = val4.GetComponent<RectTransform>();
component4.anchorMin = new Vector2(1f, 0f);
component4.anchorMax = new Vector2(1f, 1f);
component4.offsetMin = new Vector2(-20f, 0f);
component4.offsetMax = Vector2.zero;
((Graphic)val4.GetComponent<Image>()).color = new Color(0.1f, 0.1f, 0.1f, 0.6f);
Scrollbar component5 = val4.GetComponent<Scrollbar>();
component5.direction = (Direction)2;
GameObject val5 = new GameObject("Handle", new Type[2]
{
typeof(RectTransform),
typeof(Image)
});
val5.transform.SetParent(val4.transform, false);
SetFullStretch(val5.GetComponent<RectTransform>());
((Graphic)val5.GetComponent<Image>()).color = new Color(0.6f, 0.6f, 0.6f);
component.verticalScrollbar = component5;
component5.handleRect = val5.GetComponent<RectTransform>();
}
return (component, val3.transform);
}
}
public class UIFactory : MonoBehaviour
{
public GameObject mainPanel;
public InputAction _toggleUIAction;
public bool isAllowTrigger;
public void Start()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
LogHelper.LogDebug("Register UIFactory Actions", "Start");
_toggleUIAction = new InputAction((string)null, (InputActionType)0, "<Keyboard>/backslash", "hold(duration=0.5)", (string)null, (string)null);
_toggleUIAction.performed += delegate
{
isAllowTrigger = true;
};
_toggleUIAction.canceled += delegate
{
TryOpenUI();
};
_toggleUIAction.Enable();
}
public void TryOpenUI()
{
LogHelper.LogDebug("TryOpenUI Called", "TryOpenUI");
if (isAllowTrigger)
{
if ((Object)(object)mainPanel == (Object)null)
{
CreateUI();
}
else
{
mainPanel.SetActive(!mainPanel.activeSelf);
}
isAllowTrigger = false;
}
}
public void CreateUI()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
LogHelper.LogInfo("Loading UI...", "CreateUI");
Canvas val = UnityPathManager.FindCanvas();
if (!((Object)(object)val == (Object)null))
{
mainPanel = new GameObject("MainPanelHost");
mainPanel.transform.SetParent(((Component)val).transform, false);
mainPanel.AddComponent<MainPanel>();
RectTransform obj = mainPanel.GetComponent<RectTransform>() ?? mainPanel.AddComponent<RectTransform>();
obj.anchorMin = Vector2.zero;
obj.anchorMax = Vector2.one;
obj.anchoredPosition = Vector2.zero;
obj.offsetMax = new Vector2(-20f, -20f);
obj.offsetMin = new Vector2(20f, 20f);
LogHelper.LogInfo("UI Initialized at full size with margins.", "CreateUI");
}
}
}
}
namespace GreyAnnouncer.Base
{
public abstract class NotifyBase : INotifyPropertyChanged
{
private bool _suspendNotify;
private bool _hasPendingChange;
public event PropertyChangedEventHandler PropertyChanged;
public void BeginUpdate()
{
_suspendNotify = true;
}
public void EndUpdate()
{
_suspendNotify = false;
if (_hasPendingChange)
{
_hasPendingChange = false;
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(null));
}
}
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);
}
else
{
_hasPendingChange = true;
}
return true;
}
protected void RaiseChanged(string name = null)
{
if (_suspendNotify)
{
_hasPendingChange = true;
}
else
{
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 num = _dict.Remove(key);
if (num)
{
this.CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, value));
PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if (propertyChanged == null)
{
return num;
}
propertyChanged(this, new PropertyChangedEventArgs("Count"));
}
return num;
}
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)
{
if (_dict.ContainsKey(item.Key))
{
return _dict[item.Key].Equals(item.Value);
}
return false;
}
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
{
[ConfigInfo("Audio", "Audio_source_volume", "Volume of the Announcer (Range: 0f ~ 1f)")]
public static ConfigEntry<float> audioSourceVolume;
[ConfigInfo("Audio", "Under_water_low_pass_filter_Enabled", "Set to true to enable muffle effect when under water")]
public static ConfigEntry<bool> isLowPassFilterEnabled;
[ConfigInfo("Audio", "Audio_Play_Option", "0: new audio will override the old one, 1: audio will not effect each other")]
public static ConfigEntry<int> audioPlayOptions;
[ConfigInfo("Audio", "Audio_Loading_Option", "0: load from file (less RAM), 1: preload (less latency)")]
public static ConfigEntry<int> audioLoadingStrategy;
[ConfigInfo("Advanced", "FFmpeg_Support", "Set to true to enable FFmpeg support for non-Unity audio formats")]
public static ConfigEntry<bool> isFFmpegSupportEnabled;
public static void Initialize(Plugin plugin)
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
foreach (FieldInfo item in from f in typeof(BepInExConfig).GetFields(BindingFlags.Static | BindingFlags.Public)
where f.GetCustomAttribute<ConfigInfoAttribute>() != null
select f)
{
try
{
ConfigInfoAttribute customAttribute = item.GetCustomAttribute<ConfigInfoAttribute>();
object defaultValueForField = GetDefaultValueForField(item.Name);
Type type = item.FieldType.GetGenericArguments()[0];
ConfigDescription val = new ConfigDescription(customAttribute.Description, (AcceptableValueBase)null, Array.Empty<object>());
object value = ((object)((BaseUnityPlugin)plugin).Config).GetType().GetMethods().First((MethodInfo m) => m.Name == "Bind" && m.GetParameters().Length == 4 && m.GetParameters()[3].ParameterType == typeof(ConfigDescription))
.MakeGenericMethod(type)
.Invoke(((BaseUnityPlugin)plugin).Config, new object[4] { customAttribute.Section, customAttribute.Name, defaultValueForField, val });
item.SetValue(null, value);
}
catch (Exception ex)
{
LogHelper.LogError("Failed to bind config field " + item.Name + ": " + (ex.InnerException?.Message ?? ex.Message), "Initialize");
}
}
LogHelper.LogInfo("BepInExConfig initialized successfully.", "Initialize");
}
private static object GetDefaultValueForField(string fieldName)
{
return fieldName switch
{
"audioSourceVolume" => 1f,
"isLowPassFilterEnabled" => true,
"audioPlayOptions" => 0,
"audioLoadingStrategy" => 0,
"isFFmpegSupportEnabled" => false,
_ => throw new ArgumentException("[Config] No default value defined for: " + fieldName),
};
}
}
[AttributeUsage(AttributeTargets.Field)]
public class ConfigInfoAttribute : Attribute
{
public string Section { get; }
public string Name { get; }
public string Description { get; }
public ConfigInfoAttribute(string section, string name, string description)
{
Section = section;
Name = name;
Description = description;
}
}
public class PluginSettings
{
private const string FileName = "settings.json";
public static PluginSettings Instance { get; private set; }
public float AudioSourceVolume { get; set; } = 1f;
public bool IsLowPassFilterEnabled { get; set; } = true;
public int AudioPlayOptions { get; set; }
public int AudioLoadingStrategy { get; set; }
public bool IsFFmpegSupportEnabled { get; set; }
public float SpatialBlend { get; set; }
public static void Initialize()
{
Instance = JsonManager.ReadJson<PluginSettings>(PathHelper.GetCurrentPluginPath("settings.json"));
if (Instance == null)
{
Instance = new PluginSettings();
Save();
}
}
public static void Save()
{
JsonManager.WriteJson(PathHelper.GetCurrentPluginPath("settings.json"), Instance);
}
}
public static class Setting
{
public static Action syncUI;
public static float audioSourceVolume
{
get
{
return PluginSettings.Instance.AudioSourceVolume;
}
set
{
PluginSettings.Instance.AudioSourceVolume = value;
SoloAudioSource.Instance.UpdateSoloAudioSourceVolume(value);
SaveSettings();
}
}
public static float spatialBlend
{
get
{
return PluginSettings.Instance.SpatialBlend;
}
set
{
PluginSettings.Instance.SpatialBlend = value;
SaveSettings();
}
}
public static bool isLowPassFilterEnabled
{
get
{
return PluginSettings.Instance.IsLowPassFilterEnabled;
}
set
{
PluginSettings.Instance.IsLowPassFilterEnabled = value;
UnderwaterController_inWater_Instance.CheckIsInWater();
SaveSettings();
}
}
public static int audioPlayOptions
{
get
{
return PluginSettings.Instance.AudioPlayOptions;
}
set
{
PluginSettings.Instance.AudioPlayOptions = value;
SaveSettings();
}
}
public static int audioLoadingStrategy
{
get
{
return PluginSettings.Instance.AudioLoadingStrategy;
}
set
{
PluginSettings.Instance.AudioLoadingStrategy = value;
if (value.Equals(0))
{
LogHelper.LogInfo("Clear audio clip cache", "audioLoadingStrategy");
AnnouncerManager.ClearAudioClipsCache();
}
if (value.Equals(1))
{
LogHelper.LogInfo("Reloading all announcer audio", "audioLoadingStrategy");
AnnouncerManager.ReloadAllAnnouncers();
}
SaveSettings();
}
}
public static bool isFFmpegSupportEnabled
{
get
{
return PluginSettings.Instance.IsFFmpegSupportEnabled;
}
set
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.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.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(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[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 Standard 2.0")]
[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)
{
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.GetValueOrDefault();
}
set
{
_preserveReferencesHandling = value;
}
}
public TypeNameHandling TypeNameHandling
{
get
{
return _typeNameHandling.GetValueOrDefault();
}
set
{