Decompiled source of AdventureGuide v2026.327.2

plugins/AdventureGuide/AdventureGuide.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
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 AdventureGuide.Config;
using AdventureGuide.Data;
using AdventureGuide.Diagnostics;
using AdventureGuide.Navigation;
using AdventureGuide.Patches;
using AdventureGuide.Rendering;
using AdventureGuide.State;
using AdventureGuide.UI;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using ImGuiNET;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using TMPro;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AdventureGuide")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bfa55558cb8c2118ef5fe2ac2ac03fdad8bac222")]
[assembly: AssemblyProduct("AdventureGuide")]
[assembly: AssemblyTitle("AdventureGuide")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.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;
		}
	}
	[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 sealed class SpawnPointBridge
{
	public enum SpawnState
	{
		Alive,
		Dead,
		Mined,
		NightLocked,
		QuestGated,
		DirectlyPlacedDead,
		NotFound
	}

	public readonly struct SpawnInfo
	{
		public readonly SpawnState State;

		public readonly SpawnPoint? LiveSpawnPoint;

		public readonly NPC? LiveNPC;

		public readonly MiningNode? LiveMiningNode;

		public readonly float RespawnSeconds;

		public SpawnInfo(SpawnState state, SpawnPoint? liveSP = null, NPC? liveNPC = null, MiningNode? miningNode = null, float respawnSeconds = 0f)
		{
			State = state;
			LiveSpawnPoint = liveSP;
			LiveNPC = liveNPC;
			LiveMiningNode = miningNode;
			RespawnSeconds = respawnSeconds;
		}
	}

	private readonly struct PosKey : IEquatable<PosKey>
	{
		private readonly int _x;

		private readonly int _y;

		private readonly int _z;

		public PosKey(float x, float y, float z)
		{
			_x = Mathf.RoundToInt(x * 100f);
			_y = Mathf.RoundToInt(y * 100f);
			_z = Mathf.RoundToInt(z * 100f);
		}

		public bool Equals(PosKey other)
		{
			return _x == other._x && _y == other._y && _z == other._z;
		}

		public override bool Equals(object? obj)
		{
			return obj is PosKey other && Equals(other);
		}

		public override int GetHashCode()
		{
			return (_x * 397) ^ (_y * 17) ^ _z;
		}
	}

	private readonly Dictionary<PosKey, SpawnPoint> _index = new Dictionary<PosKey, SpawnPoint>();

	private readonly Dictionary<string, List<NPC>> _npcByName = new Dictionary<string, List<NPC>>();

	private const float MaxDriftSqr = 4f;

	public void Rebuild()
	{
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: 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)
		_index.Clear();
		_npcByName.Clear();
		if (SpawnPointManager.SpawnPointsInScene != null)
		{
			foreach (SpawnPoint item in SpawnPointManager.SpawnPointsInScene)
			{
				if (!((Object)(object)item == (Object)null))
				{
					Vector3 position = ((Component)item).transform.position;
					PosKey key = new PosKey(position.x, position.y, position.z);
					_index.TryAdd(key, item);
				}
			}
		}
		NPC[] array = Object.FindObjectsOfType<NPC>();
		foreach (NPC val in array)
		{
			if (!((Object)(object)val == (Object)null) && !string.IsNullOrEmpty(val.NPCName))
			{
				string key2 = val.NPCName.ToLowerInvariant();
				if (!_npcByName.TryGetValue(key2, out List<NPC> value))
				{
					value = new List<NPC>();
					_npcByName[key2] = value;
				}
				value.Add(val);
			}
		}
	}

	public SpawnInfo GetState(float x, float y, float z, string expectedNPCName)
	{
		PosKey key = new PosKey(x, y, z);
		if (_index.TryGetValue(key, out SpawnPoint value))
		{
			return ClassifySpawnPoint(value, expectedNPCName);
		}
		NPC val = FindDirectlyPlacedNPC(x, y, z, expectedNPCName);
		if ((Object)(object)val != (Object)null)
		{
			MiningNode component = ((Component)val).GetComponent<MiningNode>();
			if ((Object)(object)component != (Object)null)
			{
				if (IsMiningNodeMined(component))
				{
					float miningNodeRespawnSeconds = GetMiningNodeRespawnSeconds(component);
					return new SpawnInfo(SpawnState.Mined, null, val, component, miningNodeRespawnSeconds);
				}
				return new SpawnInfo(SpawnState.Alive, null, val, component);
			}
			return new SpawnInfo(SpawnState.Alive, null, val);
		}
		return new SpawnInfo(SpawnState.DirectlyPlacedDead);
	}

	public static bool IsExpectedNPCAlive(SpawnPoint sp, string expectedName)
	{
		return sp.MyNPCAlive && (Object)(object)sp.SpawnedNPC != (Object)null && string.Equals(sp.SpawnedNPC.NPCName, expectedName, StringComparison.OrdinalIgnoreCase);
	}

	private static SpawnInfo ClassifySpawnPoint(SpawnPoint sp, string expectedNPCName)
	{
		if (!sp.canSpawn)
		{
			return new SpawnInfo(SpawnState.QuestGated, sp);
		}
		if (sp.NightSpawn && !IsNightHours())
		{
			if (IsExpectedNPCAlive(sp, expectedNPCName))
			{
				return new SpawnInfo(SpawnState.Alive, sp, sp.SpawnedNPC);
			}
			return new SpawnInfo(SpawnState.NightLocked, sp);
		}
		if (IsExpectedNPCAlive(sp, expectedNPCName))
		{
			return new SpawnInfo(SpawnState.Alive, sp, sp.SpawnedNPC);
		}
		if (sp.MyNPCAlive && (Object)(object)sp.SpawnedNPC != (Object)null)
		{
			return new SpawnInfo(SpawnState.NotFound, sp);
		}
		float num = 60f * GetSpawnTimeMod();
		float respawnSeconds = ((num > 0f) ? (sp.actualSpawnDelay / num) : 0f);
		return new SpawnInfo(SpawnState.Dead, sp, null, null, respawnSeconds);
	}

	private static bool IsNightHours()
	{
		int hour = GameData.Time.GetHour();
		return hour > 22 || hour < 4;
	}

	private NPC? FindDirectlyPlacedNPC(float x, float y, float z, string expectedName)
	{
		//IL_0056: 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_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)
		if (!_npcByName.TryGetValue(expectedName.ToLowerInvariant(), out List<NPC> value))
		{
			return null;
		}
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(x, y, z);
		foreach (NPC item in value)
		{
			if (!((Object)(object)item == (Object)null))
			{
				Vector3 val2 = ((Component)item).transform.position - val;
				if (((Vector3)(ref val2)).sqrMagnitude <= 4f)
				{
					return item;
				}
			}
		}
		return null;
	}

	private static float GetSpawnTimeMod()
	{
		GameManager gM = GameData.GM;
		return ((Object)(object)gM != (Object)null) ? gM.SpawnTimeMod : 1f;
	}

	public static bool IsMiningNodeMined(MiningNode node)
	{
		return MiningNodeTracker.IsMined(node);
	}

	public static float GetMiningNodeRespawnSeconds(MiningNode node)
	{
		return MiningNodeTracker.GetRemainingSeconds(node).GetValueOrDefault();
	}
}
namespace AdventureGuide
{
	[BepInPlugin("wow-much.adventure-guide", "Adventure Guide", "2026.327.2")]
	public sealed class Plugin : BaseUnityPlugin
	{
		private Harmony? _harmony;

		private GuideConfig? _config;

		private GuideData? _data;

		private QuestStateTracker? _state;

		private EntityRegistry? _entities;

		private NavigationController? _nav;

		private ArrowRenderer? _arrow;

		private GroundPathRenderer? _groundPath;

		private WorldMarkerSystem? _markers;

		private SpawnTimerTracker? _timers;

		private MiningNodeTracker? _miningTracker;

		private LootScanner? _lootScanner;

		private ImGuiRenderer? _imgui;

		private GuideWindow? _window;

		private TrackerState? _trackerState;

		private TrackerWindow? _tracker;

		private bool _wasTextInputActive;

		private bool _gameUIVisible = true;

		private bool _inGameplay;

		private bool _discoveryDone;

		private bool _wasEditUIMode;

		internal static ManualLogSource Log { get; private set; }

		static Plugin()
		{
			Log = null;
			AppDomain.CurrentDomain.AssemblyResolve += delegate(object _, ResolveEventArgs args)
			{
				if (new AssemblyName(args.Name).Name == "System.Numerics.Vectors")
				{
					Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
					foreach (Assembly assembly in assemblies)
					{
						if (assembly.GetName().Name == "System.Numerics")
						{
							return assembly;
						}
					}
				}
				return null;
			};
		}

		private void Awake()
		{
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Expected O, but got Unknown
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_064c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0661: Unknown result type (might be due to invalid IL or missing references)
			//IL_0676: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			_config = new GuideConfig(((BaseUnityPlugin)this).Config);
			_data = GuideData.Load(Log);
			_state = new QuestStateTracker(_data);
			_trackerState = new TrackerState();
			_trackerState.LoadFromConfig(_config);
			float num = ((_config.UiScale.Value >= 0f) ? _config.UiScale.Value : 1f);
			_config.ResolvedUiScale = num;
			string iniPath = Path.Combine(Paths.ConfigPath, "wow-much.adventure-guide.imgui.ini");
			_imgui = new ImGuiRenderer(Log)
			{
				UiScale = num,
				IniPath = iniPath
			};
			if (!_imgui.Init())
			{
				Log.LogError((object)"ImGui.NET init failed — mod cannot render UI");
				return;
			}
			_config.UiScale.SettingChanged += OnUiScaleChanged;
			_config.ResetWindowLayout.SettingChanged += OnResetWindowLayout;
			_entities = new EntityRegistry();
			_timers = new SpawnTimerTracker();
			_miningTracker = new MiningNodeTracker();
			SpawnPointBridge bridge = new SpawnPointBridge();
			_lootScanner = new LootScanner();
			_nav = new NavigationController(_data, _entities, _state, _timers, _miningTracker, _lootScanner);
			_arrow = new ArrowRenderer(_nav);
			_arrow.Enabled = _config.ShowArrow.Value;
			_config.ShowArrow.SettingChanged += OnShowArrowChanged;
			_groundPath = new GroundPathRenderer(_nav);
			_groundPath.Enabled = _config.ShowGroundPath.Value;
			_config.ShowGroundPath.SettingChanged += OnShowGroundPathChanged;
			_markers = new WorldMarkerSystem(_data, _state, bridge, _lootScanner, _config);
			_markers.Enabled = _config.ShowWorldMarkers.Value;
			_config.ShowWorldMarkers.SettingChanged += OnShowWorldMarkersChanged;
			_config.TrackerEnabled.SettingChanged += OnTrackerEnabledChanged;
			_config.ReplaceQuestLog.SettingChanged += OnReplaceQuestLogChanged;
			NavigationHistory history = new NavigationHistory(_config.HistoryMaxSize.Value);
			_config.HistoryMaxSize.SettingChanged += delegate
			{
				history.MaxSize = _config.HistoryMaxSize.Value;
			};
			_window = new GuideWindow(_data, _state, _nav, history, _trackerState, _config);
			_state.SetHistory(history);
			_window.Filter.LoadFrom(_config);
			_tracker = new TrackerWindow(_data, _state, _nav, _trackerState, _window, _config);
			_imgui.OnLayout = delegate
			{
				_window.Draw();
				_tracker.Draw();
				_arrow.Draw();
				_config.LayoutResetRequested = false;
			};
			DebugAPI.Data = _data;
			DebugAPI.State = _state;
			DebugAPI.Filter = _window.Filter;
			DebugAPI.Nav = _nav;
			DebugAPI.Entities = _entities;
			DebugAPI.GroundPath = _groundPath;
			QuestAssignPatch.Tracker = _state;
			QuestAssignPatch.Nav = _nav;
			QuestAssignPatch.Loot = _lootScanner;
			QuestAssignPatch.TrackerPins = _trackerState;
			QuestFinishPatch.Tracker = _state;
			QuestFinishPatch.Nav = _nav;
			QuestFinishPatch.Loot = _lootScanner;
			QuestFinishPatch.TrackerPins = _trackerState;
			InventoryPatch.Tracker = _state;
			InventoryPatch.Nav = _nav;
			InventoryPatch.Loot = _lootScanner;
			SpawnPatch.Registry = _entities;
			SpawnPatch.Timers = _timers;
			SpawnPatch.Markers = _markers;
			SpawnPatch.Loot = _lootScanner;
			DeathPatch.Registry = _entities;
			DeathPatch.Timers = _timers;
			DeathPatch.Markers = _markers;
			DeathPatch.Loot = _lootScanner;
			QuestMarkerPatch.SuppressGameMarkers = _config.ShowWorldMarkers.Value;
			PointerOverUIPatch.Renderer = _imgui;
			QuestLogPatch.ReplaceQuestLog = _config.ReplaceQuestLog;
			SceneManager.sceneLoaded += OnSceneLoaded;
			_harmony = new Harmony("wow-much.adventure-guide");
			_harmony.PatchAll();
			QuestStateTracker? state = _state;
			Scene activeScene = SceneManager.GetActiveScene();
			state.OnSceneChanged(((Scene)(ref activeScene)).name);
			_entities.SyncFromLiveNPCs();
			_miningTracker.Rescan();
			_lootScanner.OnSceneLoaded();
			_trackerState.OnCharacterLoaded();
			NavigationController? nav = _nav;
			GuideConfig? config = _config;
			activeScene = SceneManager.GetActiveScene();
			nav.LoadPerCharacter(config, ((Scene)(ref activeScene)).name);
			activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			_inGameplay = name != "Menu" && name != "LoadScene";
			int num2 = 0;
			foreach (QuestEntry item in _data.All)
			{
				if (item.HasSteps)
				{
					num2++;
				}
			}
			Log.LogInfo((object)("Adventure Guide v2026.327.2\n" + $"  Quests: {_data.Count} in guide, {num2} with step data\n" + $"  Controls: {_config.ToggleKey.Value} = guide, {_config.TrackerToggleKey.Value} = tracker, {_config.GroundPathToggleKey.Value} = ground path\n" + "  Config: BepInEx/config/wow-much.adventure-guide.cfg\n  Tip: Install BepInEx ConfigurationManager for in-game settings (F1)"));
		}

		private void TryMergeUnknownQuests()
		{
			if (!_discoveryDone && _data != null)
			{
				int num = _data.MergeUnknownQuests();
				if (num >= 0)
				{
					_discoveryDone = true;
				}
			}
		}

		private void Update()
		{
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: 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)
			bool isVisible = GameUIVisibility.IsVisible;
			if (isVisible != _gameUIVisible)
			{
				_gameUIVisible = isVisible;
				SyncVisibility();
				if (!isVisible)
				{
					_imgui?.ClearCaptureState();
					if (_wasTextInputActive)
					{
						GameData.PlayerTyping = false;
						_wasTextInputActive = false;
					}
				}
			}
			bool editUIMode = GameData.EditUIMode;
			if (_wasEditUIMode && !editUIMode)
			{
				GameWindowOverlap.InvalidateRects();
			}
			_wasEditUIMode = editUIMode;
			if (_gameUIVisible)
			{
				bool flag = _imgui?.WantTextInput ?? false;
				if (flag && !_wasTextInputActive)
				{
					GameData.PlayerTyping = true;
				}
				else if (!flag && _wasTextInputActive)
				{
					GameData.PlayerTyping = false;
				}
				_wasTextInputActive = flag;
			}
			if (!_discoveryDone)
			{
				TryMergeUnknownQuests();
			}
			string currentScene = _state?.CurrentZone ?? "";
			_lootScanner?.Update(_data, _state);
			_nav?.Update(currentScene);
			_groundPath?.Update(currentScene);
			_markers?.Update(currentScene);
			if (_config != null && _window != null && _inGameplay && !GameData.PlayerTyping)
			{
				if (Input.GetKeyDown(_config.ToggleKey.Value))
				{
					_window.Toggle();
				}
				if (_config.ReplaceQuestLog.Value && Input.GetKeyDown(InputManager.Journal))
				{
					_window.Toggle();
				}
				if (_config.TrackerEnabled.Value && Input.GetKeyDown(_config.TrackerToggleKey.Value))
				{
					_tracker?.Toggle();
				}
				if (Input.GetKeyDown(_config.GroundPathToggleKey.Value))
				{
					_config.ShowGroundPath.Value = !_config.ShowGroundPath.Value;
				}
			}
		}

		private void OnGUI()
		{
			if (_gameUIVisible)
			{
				_imgui?.OnGUI();
			}
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			if (_config.UiScale.Value < 0f && ((Scene)(ref scene)).name != "Menu" && ((Scene)(ref scene)).name != "LoadScene")
			{
				float value = DetectUiScale();
				_config.UiScale.Value = value;
			}
			CameraCache.Invalidate();
			GameWindowOverlap.Reset();
			_inGameplay = ((Scene)(ref scene)).name != "Menu" && ((Scene)(ref scene)).name != "LoadScene";
			if (!_inGameplay)
			{
				_window?.Hide();
				_tracker?.Hide();
				_nav?.Clear();
			}
			_markers?.OnSceneLoaded();
			_entities?.Clear();
			_timers?.Clear();
			_miningTracker?.Rescan();
			_lootScanner?.OnSceneLoaded();
			_state?.OnSceneChanged(((Scene)(ref scene)).name);
			_trackerState?.OnCharacterLoaded();
			_trackerState?.PruneCompleted(_state);
			_nav?.LoadPerCharacter(_config, ((Scene)(ref scene)).name);
			_nav?.OnGameStateChanged(((Scene)(ref scene)).name);
		}

		private void OnShowArrowChanged(object sender, EventArgs e)
		{
			SyncVisibility();
		}

		private void OnShowGroundPathChanged(object sender, EventArgs e)
		{
			SyncVisibility();
		}

		private void OnUiScaleChanged(object sender, EventArgs e)
		{
			float num = _config.UiScale.Value;
			if (num < 0f)
			{
				num = DetectUiScale();
			}
			_config.ResolvedUiScale = num;
			_config.LayoutResetRequested = true;
			_imgui?.SetScale(num);
		}

		private void OnResetWindowLayout(object sender, EventArgs e)
		{
			if (_config.ResetWindowLayout.Value)
			{
				_imgui?.ClearWindowState();
				_config.LayoutResetRequested = true;
				_config.ResetWindowLayout.Value = false;
			}
		}

		private void OnShowWorldMarkersChanged(object sender, EventArgs e)
		{
			SyncVisibility();
			QuestMarkerPatch.SuppressGameMarkers = _config.ShowWorldMarkers.Value;
		}

		private void OnTrackerEnabledChanged(object sender, EventArgs e)
		{
			_trackerState.Enabled = _config.TrackerEnabled.Value;
		}

		private void OnReplaceQuestLogChanged(object sender, EventArgs e)
		{
			if (_config.ReplaceQuestLog.Value)
			{
				QuestLog questLog = GameData.QuestLog;
				if ((Object)(object)questLog != (Object)null && (Object)(object)questLog.QuestWindow != (Object)null && questLog.QuestWindow.activeSelf)
				{
					questLog.QuestWindow.SetActive(false);
					_window?.Show();
				}
			}
		}

		private void SyncVisibility()
		{
			bool gameUIVisible = _gameUIVisible;
			_arrow.Enabled = gameUIVisible && _config.ShowArrow.Value;
			_groundPath.Enabled = gameUIVisible && _config.ShowGroundPath.Value;
			_markers.Enabled = gameUIVisible && _config.ShowWorldMarkers.Value;
		}

		private void OnDestroy()
		{
			SceneManager.sceneLoaded -= OnSceneLoaded;
			if (_config != null)
			{
				_config.ShowArrow.SettingChanged -= OnShowArrowChanged;
				_config.ShowGroundPath.SettingChanged -= OnShowGroundPathChanged;
				_config.ShowWorldMarkers.SettingChanged -= OnShowWorldMarkersChanged;
				_config.TrackerEnabled.SettingChanged -= OnTrackerEnabledChanged;
				_config.ReplaceQuestLog.SettingChanged -= OnReplaceQuestLogChanged;
				_config.UiScale.SettingChanged -= OnUiScaleChanged;
				_config.ResetWindowLayout.SettingChanged -= OnResetWindowLayout;
				QuestMarkerPatch.SuppressGameMarkers = false;
			}
			Harmony? harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			_tracker?.Dispose();
			_trackerState?.SaveToConfig();
			_nav?.SavePerCharacter();
			_imgui?.Dispose();
			_arrow?.Dispose();
			_groundPath?.Destroy();
			_markers?.Destroy();
			_timers?.Clear();
			_entities?.Clear();
			_miningTracker?.Clear();
			MarkerFonts.Destroy();
			DebugAPI.Data = null;
			DebugAPI.State = null;
			DebugAPI.Filter = null;
			DebugAPI.Nav = null;
			DebugAPI.Entities = null;
			DebugAPI.GroundPath = null;
		}

		private static float DetectUiScale()
		{
			return Mathf.Clamp((float)Screen.height / 1080f, 0.5f, 4f);
		}
	}
	internal static class PluginInfo
	{
		public const string GUID = "wow-much.adventure-guide";

		public const string Name = "Adventure Guide";

		public const string Version = "2026.327.2";
	}
}
namespace AdventureGuide.UI
{
	public enum QuestFilterMode
	{
		Active,
		Available,
		Completed,
		All
	}
	public enum QuestSortMode
	{
		Alphabetical,
		ByZone,
		ByLevel
	}
	public class FilterState
	{
		private GuideConfig? _config;

		private QuestFilterMode _filterMode = QuestFilterMode.Active;

		private string _searchText = string.Empty;

		private string? _zoneFilter;

		private QuestSortMode _sortMode = QuestSortMode.Alphabetical;

		public int Version { get; private set; }

		public QuestFilterMode FilterMode
		{
			get
			{
				return _filterMode;
			}
			set
			{
				if (_filterMode != value)
				{
					_filterMode = value;
					Version++;
					GuideConfig? config = _config;
					if (config != null)
					{
						((ConfigEntryBase)config.FilterMode).SetSerializedValue(value.ToString());
					}
				}
			}
		}

		public string SearchText
		{
			get
			{
				return _searchText;
			}
			set
			{
				if (_searchText != value)
				{
					_searchText = value;
					Version++;
				}
			}
		}

		public string? ZoneFilter
		{
			get
			{
				return _zoneFilter;
			}
			set
			{
				if (_zoneFilter != value)
				{
					_zoneFilter = value;
					Version++;
					GuideConfig? config = _config;
					if (config != null)
					{
						((ConfigEntryBase)config.ZoneFilter).SetSerializedValue(value ?? "");
					}
				}
			}
		}

		public QuestSortMode SortMode
		{
			get
			{
				return _sortMode;
			}
			set
			{
				if (_sortMode != value)
				{
					_sortMode = value;
					Version++;
					GuideConfig? config = _config;
					if (config != null)
					{
						((ConfigEntryBase)config.SortMode).SetSerializedValue(value.ToString());
					}
				}
			}
		}

		public void LoadFrom(GuideConfig config)
		{
			_config = config;
			_filterMode = config.FilterMode.Value;
			_sortMode = config.SortMode.Value;
			string value = config.ZoneFilter.Value;
			_zoneFilter = (string.IsNullOrEmpty(value) ? null : value);
			Version++;
		}
	}
	public sealed class GuideWindow
	{
		private readonly GuideData _data;

		private readonly QuestStateTracker _state;

		private readonly FilterState _filter = new FilterState();

		private readonly QuestListPanel _listPanel;

		private readonly QuestDetailPanel _detailPanel;

		private readonly NavigationHistory _history;

		private readonly GuideConfig _config;

		private bool _visible;

		public bool Visible => _visible;

		public FilterState Filter => _filter;

		public GuideWindow(GuideData data, QuestStateTracker state, NavigationController nav, NavigationHistory history, TrackerState tracker, GuideConfig config)
		{
			_data = data;
			_state = state;
			_history = history;
			_config = config;
			_listPanel = new QuestListPanel(data, state, _filter, tracker);
			_detailPanel = new QuestDetailPanel(data, state, nav, tracker, config);
		}

		public void Toggle()
		{
			_visible = !_visible;
		}

		public void Show()
		{
			_visible = true;
		}

		public void Hide()
		{
			_visible = false;
		}

		public void Draw()
		{
			//IL_0024: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if (_visible)
			{
				ImGuiCond val = (ImGuiCond)(_config.LayoutResetRequested ? 1 : 4);
				float resolvedUiScale = _config.ResolvedUiScale;
				ImGuiIOPtr iO = ImGui.GetIO();
				Vector2 displaySize = ((ImGuiIOPtr)(ref iO)).DisplaySize;
				ImGui.SetNextWindowSize(new Vector2(780f * resolvedUiScale, 530f * resolvedUiScale), val);
				ImGui.SetNextWindowPos(new Vector2(displaySize.X * 0.5f, displaySize.Y * 0.5f), val, new Vector2(0.5f, 0.5f));
				Theme.PushWindowStyle();
				if (ImGui.Begin("Adventure Guide", ref _visible, (ImGuiWindowFlags)32))
				{
					DrawTabBar();
				}
				Theme.ClampWindowPosition();
				ImGui.End();
				Theme.PopWindowStyle();
			}
		}

		private void DrawTabBar()
		{
			if (!ImGui.BeginTabBar("##GuideTabs"))
			{
				return;
			}
			if (ImGui.BeginTabItem("Quests"))
			{
				DrawQuestsTab();
				ImGui.EndTabItem();
			}
			if (ImGui.TabItemButton("<"))
			{
				NavigationHistory.PageRef? pageRef = _history.Back();
				if (pageRef.HasValue && pageRef.Value.Type == NavigationHistory.PageType.Quest)
				{
					_state.SelectedQuestDBName = pageRef.Value.Key;
				}
			}
			if (ImGui.TabItemButton(">"))
			{
				NavigationHistory.PageRef? pageRef2 = _history.Forward();
				if (pageRef2.HasValue && pageRef2.Value.Type == NavigationHistory.PageType.Quest)
				{
					_state.SelectedQuestDBName = pageRef2.Value.Key;
				}
			}
			ImGui.EndTabBar();
		}

		private void DrawQuestsTab()
		{
			float num = ImGui.GetContentRegionAvail().X * 0.32f;
			ImGui.BeginChild("##LeftPanel", new Vector2(num, 0f), true);
			_listPanel.Draw(num);
			ImGui.EndChild();
			ImGui.SameLine();
			ImGui.BeginChild("##RightPanel", Vector2.Zero, true);
			_detailPanel.Draw();
			ImGui.EndChild();
		}
	}
	public sealed class QuestDetailPanel
	{
		private enum StepState
		{
			Completed,
			Current,
			Future
		}

		private readonly GuideData _data;

		private readonly QuestStateTracker _state;

		private readonly NavigationController _nav;

		private readonly TrackerState _tracker;

		private readonly GuideConfig _config;

		private const int MaxSubQuestDepth = 5;

		private bool IsNavigationEnabled => _config.ShowArrow.Value || _config.ShowGroundPath.Value;

		public QuestDetailPanel(GuideData data, QuestStateTracker state, NavigationController nav, TrackerState tracker, GuideConfig config)
		{
			_data = data;
			_state = state;
			_nav = nav;
			_tracker = tracker;
			_config = config;
		}

		public void Draw()
		{
			if (_state.SelectedQuestDBName == null)
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
				ImGui.TextWrapped("Select a quest from the list.");
				ImGui.PopStyleColor();
				return;
			}
			QuestEntry byDBName = _data.GetByDBName(_state.SelectedQuestDBName);
			if (byDBName == null)
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
				ImGui.TextWrapped("Quest not found in guide data.");
				ImGui.PopStyleColor();
			}
			else
			{
				DrawHeader(byDBName);
				DrawObjectives(byDBName);
				DrawRewards(byDBName);
				DrawPrerequisites(byDBName);
			}
		}

		private void DrawHeader(QuestEntry quest)
		{
			if (_tracker.Enabled && !_state.IsCompleted(quest.DBName))
			{
				bool flag = _tracker.IsTracked(quest.DBName);
				if (flag)
				{
					ImGui.PushStyleColor((ImGuiCol)21, Theme.Accent);
				}
				if (ImGui.SmallButton(flag ? "[Untrack]" : "[Track]"))
				{
					if (flag)
					{
						_tracker.Untrack(quest.DBName);
					}
					else
					{
						_tracker.Track(quest.DBName);
					}
				}
				if (flag)
				{
					ImGui.PopStyleColor();
				}
				ImGui.SameLine();
			}
			ImGui.PushStyleColor((ImGuiCol)0, Theme.Header);
			ImGui.TextWrapped(quest.DisplayName);
			ImGui.PopStyleColor();
			DrawLevelZoneLine(quest);
			if (quest.Acquisition != null)
			{
				foreach (AcquisitionSource item in quest.Acquisition)
				{
					ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
					string method = item.Method;
					if (1 == 0)
					{
					}
					string text;
					switch (method)
					{
					case "dialog":
						if (item.SourceName == null)
						{
							goto default;
						}
						text = "Given by: " + item.SourceName;
						break;
					case "item_read":
						if (item.SourceName == null)
						{
							goto default;
						}
						text = "Read: " + item.SourceName;
						break;
					case "zone_entry":
						if (item.SourceName == null)
						{
							goto default;
						}
						text = "Enter: " + item.SourceName;
						break;
					case "quest_chain":
						if (item.SourceName == null)
						{
							goto default;
						}
						text = "Chain from: " + item.SourceName;
						break;
					default:
						text = ((item.SourceName != null) ? ("From: " + item.SourceName) : null);
						break;
					}
					if (1 == 0)
					{
					}
					string text2 = text;
					if (text2 != null)
					{
						if (item.ZoneName != null && item.Method == "dialog")
						{
							text2 = text2 + " (" + item.ZoneName + ")";
						}
						ImGui.Text(text2);
					}
					ImGui.PopStyleColor();
				}
			}
			if (quest.Completion != null)
			{
				foreach (CompletionSource item2 in quest.Completion)
				{
					if (item2.SourceName == null && item2.ZoneName == null)
					{
						continue;
					}
					ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
					string method2 = item2.Method;
					if (1 == 0)
					{
					}
					string text;
					switch (method2)
					{
					case "item_turnin":
					case "dialog":
						if (item2.SourceName == null)
						{
							goto default;
						}
						text = "Turn in to: " + item2.SourceName;
						break;
					case "zone":
						if (item2.SourceName == null)
						{
							goto default;
						}
						text = "Complete at: " + item2.SourceName;
						break;
					default:
						text = ((item2.SourceName == null) ? null : ("Complete: " + item2.SourceName));
						break;
					}
					if (1 == 0)
					{
					}
					string text3 = text;
					if (text3 == null)
					{
						ImGui.PopStyleColor();
						continue;
					}
					bool flag2 = item2.ZoneName != null;
					bool flag3 = flag2;
					if (flag3)
					{
						text = item2.Method;
						bool flag4 = ((text == "item_turnin" || text == "dialog") ? true : false);
						flag3 = flag4;
					}
					if (flag3)
					{
						text3 = text3 + " (" + item2.ZoneName + ")";
					}
					ImGui.Text(text3);
					ImGui.PopStyleColor();
				}
			}
			if (quest.Description != null)
			{
				ImGui.Spacing();
				ImGui.TextWrapped(quest.Description);
			}
			ImGui.Spacing();
			ImGui.Separator();
			ImGui.Spacing();
		}

		private static void DrawLevelZoneLine(QuestEntry quest)
		{
			int? num = quest.LevelEstimate?.Recommended;
			string zoneContext = quest.ZoneContext;
			bool flag = quest.Flags?.Repeatable ?? false;
			if (!num.HasValue && zoneContext == null && !flag)
			{
				return;
			}
			ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
			string text = "";
			if (num.HasValue)
			{
				text = $"Lv {num}";
			}
			if (zoneContext != null)
			{
				if (text.Length > 0)
				{
					text += "  ·  ";
				}
				text += zoneContext;
			}
			if (flag)
			{
				if (text.Length > 0)
				{
					text += "  ·  ";
				}
				text += "Repeatable";
			}
			ImGui.Text(text);
			if (ImGui.IsItemHovered())
			{
				List<QuestStep> steps = quest.Steps;
				if (steps != null && steps.Count > 0)
				{
					ImGui.BeginTooltip();
					ImGui.Text("Quest level: hardest step");
					ImGui.Separator();
					int? num2 = quest.LevelEstimate?.Recommended;
					foreach (QuestStep step in quest.Steps)
					{
						int? num3 = step.LevelEstimate?.Recommended;
						string text2 = (num3.HasValue ? $"Lv {num3,2}" : "    ");
						bool flag2 = num2.HasValue && num3 == num2;
						string text3 = (flag2 ? " <" : "");
						uint num4 = (flag2 ? Theme.TextPrimary : Theme.TextSecondary);
						ImGui.PushStyleColor((ImGuiCol)0, num4);
						ImGui.Text($"  {step.Order}. {step.Description}  {text2}{text3}");
						ImGui.PopStyleColor();
					}
					ImGui.EndTooltip();
				}
			}
			ImGui.PopStyleColor();
		}

		private void DrawObjectives(QuestEntry quest)
		{
			if (!quest.HasSteps)
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
				ImGui.TextWrapped("No guide data available for this quest.");
				ImGui.PopStyleColor();
			}
			else if (ImGui.CollapsingHeader("Objectives", (ImGuiTreeNodeFlags)32))
			{
				HashSet<string> visited = new HashSet<string> { quest.StableKey };
				ImGui.Indent(16f);
				DrawSteps(quest, visited);
				ImGui.Unindent(16f);
			}
		}

		private void DrawSteps(QuestEntry quest, HashSet<string> visited)
		{
			if (quest.Steps == null || quest.Steps.Count == 0)
			{
				return;
			}
			ImGui.PushID(quest.DBName);
			int currentStepIndex = StepProgress.GetCurrentStepIndex(quest, _state, _data);
			string text = null;
			for (int i = 0; i < quest.Steps.Count; i++)
			{
				QuestStep questStep = quest.Steps[i];
				if (questStep.OrGroup != null && questStep.OrGroup == text)
				{
					ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
					ImGui.Text("  -- OR --");
					ImGui.PopStyleColor();
				}
				StepState state = ((i >= currentStepIndex) ? ((i == currentStepIndex) ? StepState.Current : StepState.Future) : StepState.Completed);
				DrawStep(questStep, state, quest, visited);
				text = questStep.OrGroup;
			}
			ImGui.PopID();
		}

		private void DrawStep(QuestStep step, StepState state, QuestEntry quest, HashSet<string> visited)
		{
			if (1 == 0)
			{
			}
			uint num = state switch
			{
				StepState.Completed => Theme.QuestCompleted, 
				StepState.Current => Theme.QuestActive, 
				_ => Theme.TextPrimary, 
			};
			if (1 == 0)
			{
			}
			uint num2 = num;
			string text = $"{step.Order}. {step.Description}";
			if (step.Action == "collect" && step.TargetKey != null && step.Quantity.HasValue)
			{
				int num3 = _state.CountItem(step.TargetKey);
				text += $" ({num3}/{step.Quantity})";
				if (num3 >= step.Quantity.Value)
				{
					num2 = Theme.QuestCompleted;
				}
			}
			if (step.Action == "complete_quest" && step.TargetKey != null)
			{
				QuestEntry byStableKey = _data.GetByStableKey(step.TargetKey);
				if (byStableKey != null && _state.IsCompleted(byStableKey.DBName))
				{
					num2 = Theme.QuestCompleted;
				}
			}
			int? num4 = step.LevelEstimate?.Recommended;
			string action;
			if (num4.HasValue)
			{
				int valueOrDefault = num4.GetValueOrDefault();
				if (true)
				{
					action = step.Action;
					if (!(action == "collect") && !(action == "read"))
					{
						List<LevelFactor> factors = step.LevelEstimate.Factors;
						if (factors != null && factors.Count > 0)
						{
							text = text + "  ·  " + step.LevelEstimate.Factors[0].Name;
						}
					}
					text += $"  ·  Lv {valueOrDefault}";
					goto IL_026d;
				}
			}
			action = step.Action;
			if (!(action == "collect") && !(action == "read"))
			{
				List<LevelFactor> factors = step.LevelEstimate?.Factors;
				if (factors != null && factors.Count > 0)
				{
					text = text + "  ·  " + step.LevelEstimate.Factors[0].Name;
				}
			}
			goto IL_026d;
			IL_026d:
			DrawNavButton(step, quest);
			ImGui.PushStyleColor((ImGuiCol)0, num2);
			ImGui.Text(text);
			ImGui.PopStyleColor();
			DrawStepSources(step, quest, visited);
			DrawSubQuestSteps(step, visited);
			if (_nav.IsNavigating(quest.DBName, step.Order))
			{
				List<(ZoneLineEntry, float, bool, bool)> alternativeZoneLines = _nav.GetAlternativeZoneLines(_state.CurrentZone);
				if (alternativeZoneLines.Count > 1)
				{
					DrawZoneLineAlternatives(alternativeZoneLines, step);
				}
			}
		}

		private void DrawNavButton(QuestStep step, QuestEntry quest)
		{
			if (!IsNavigationEnabled || step.TargetKey == null)
			{
				return;
			}
			bool flag;
			if (!(step.TargetType == "item"))
			{
				flag = ((step.TargetType == "character") ? (step.TargetKey != null && _data.CharacterSpawns.ContainsKey(step.TargetKey)) : (step.TargetType == "zone" && (step.ZoneName != null || step.TargetKey != null)));
			}
			else
			{
				RequiredItemInfo requiredItemInfo = FindRequiredItem(quest, step);
				flag = requiredItemInfo != null && (requiredItemInfo.Sources?.Exists((ItemSource s) => HasNavigableSource(s))).GetValueOrDefault();
			}
			bool flag2 = _nav.IsNavigating(quest.DBName, step.Order);
			if (!flag)
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
				ImGui.PushStyleVar((ImGuiStyleVar)0, 0.4f);
				ImGui.SmallButton($"[NAV]##{step.Order}");
				ImGui.PopStyleVar();
				ImGui.PopStyleColor();
				if (ImGui.IsItemHovered((ImGuiHoveredFlags)512))
				{
					ImGui.BeginTooltip();
					ImGui.Text("No known source");
					ImGui.EndTooltip();
				}
				ImGui.SameLine();
				return;
			}
			if (flag2)
			{
				ImGui.PushStyleColor((ImGuiCol)21, Theme.QuestActive);
			}
			if (ImGui.SmallButton($"[NAV]##{step.Order}"))
			{
				if (flag2)
				{
					_nav.Clear();
				}
				else
				{
					_nav.NavigateTo(step, quest, _state.CurrentZone);
				}
			}
			if (flag2)
			{
				ImGui.PopStyleColor();
			}
			if (ImGui.IsItemHovered())
			{
				ImGui.BeginTooltip();
				if (flag2)
				{
					ImGui.Text("Click to stop navigating");
				}
				else
				{
					ImGui.Text("Navigate to " + (step.TargetName ?? step.Description));
				}
				ImGui.EndTooltip();
			}
			ImGui.SameLine();
		}

		private void DrawStepSources(QuestStep step, QuestEntry quest, HashSet<string> visited)
		{
			string action = step.Action;
			if ((!(action == "collect") && !(action == "read")) || step.TargetName == null)
			{
				DrawTips(step);
				return;
			}
			RequiredItemInfo requiredItemInfo = FindRequiredItem(quest, step);
			if (requiredItemInfo?.Sources == null || requiredItemInfo.Sources.Count == 0)
			{
				DrawTips(step);
				return;
			}
			ImGui.Indent(16f);
			ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
			int num = Math.Min(requiredItemInfo.Sources.Count, 4);
			for (int i = 0; i < num; i++)
			{
				DrawSource(requiredItemInfo.Sources[i], quest, step, visited);
			}
			if (requiredItemInfo.Sources.Count > 4)
			{
				int num2 = requiredItemInfo.Sources.Count - 4;
				int valueOrDefault = requiredItemInfo.Sources[4].Level.GetValueOrDefault();
				List<ItemSource>? sources = requiredItemInfo.Sources;
				int valueOrDefault2 = sources[sources.Count - 1].Level.GetValueOrDefault(valueOrDefault);
				string arg = ((valueOrDefault == valueOrDefault2) ? $"Lv {valueOrDefault}" : $"Lv {valueOrDefault}-{valueOrDefault2}");
				if (ImGui.TreeNode($"{num2} more sources ({arg})##{step.Order}"))
				{
					for (int j = 4; j < requiredItemInfo.Sources.Count; j++)
					{
						DrawSource(requiredItemInfo.Sources[j], quest, step, visited);
					}
					ImGui.TreePop();
				}
			}
			ImGui.PopStyleColor();
			ImGui.Unindent(16f);
			DrawTips(step);
		}

		private void DrawZoneLineAlternatives(List<(ZoneLineEntry line, float distance, bool isSelected, bool isAccessible)> alternatives, QuestStep step)
		{
			ImGui.Indent(16f);
			ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
			string arg = $"{alternatives.Count} zone connections";
			if (ImGui.TreeNode($"{arg}##zl_{step.Order}"))
			{
				for (int i = 0; i < alternatives.Count; i++)
				{
					(ZoneLineEntry line, float distance, bool isSelected, bool isAccessible) tuple = alternatives[i];
					var (zoneLineEntry, num, flag, _) = tuple;
					if (!tuple.isAccessible)
					{
						ImGui.PushStyleVar((ImGuiStyleVar)0, 0.3f);
						ImGui.Text($"To {zoneLineEntry.DestinationDisplay} ({num:F0}m)");
						ImGui.PopStyleVar();
						if (zoneLineEntry.RequiredQuestGroups == null)
						{
							continue;
						}
						using List<List<string>>.Enumerator enumerator = zoneLineEntry.RequiredQuestGroups.GetEnumerator();
						if (!enumerator.MoveNext())
						{
							continue;
						}
						List<string> current = enumerator.Current;
						foreach (string item in current)
						{
							if (_state.IsCompleted(item))
							{
								continue;
							}
							QuestEntry byDBName = _data.GetByDBName(item);
							if (byDBName != null)
							{
								ImGui.Indent(16f);
								if (ImGui.Selectable($"Requires: \"{byDBName.DisplayName}\"##rq_{step.Order}_{i}_{item}"))
								{
									_state.SelectQuest(byDBName.DBName);
								}
								ImGui.Unindent(16f);
							}
						}
					}
					else
					{
						string arg2 = $"To {zoneLineEntry.DestinationDisplay} ({num:F0}m)";
						if (flag)
						{
							ImGui.PushStyleColor((ImGuiCol)0, Theme.QuestActive);
						}
						if (ImGui.Selectable($"{arg2}##zl_{step.Order}_{i}"))
						{
							_nav.PinZoneLine(zoneLineEntry);
						}
						if (flag)
						{
							ImGui.PopStyleColor();
						}
						if (ImGui.IsItemHovered())
						{
							ImGui.BeginTooltip();
							ImGui.Text("Route via " + zoneLineEntry.DestinationDisplay);
							ImGui.EndTooltip();
						}
					}
				}
				ImGui.TreePop();
			}
			ImGui.PopStyleColor();
			ImGui.Unindent(16f);
		}

		private void DrawSource(ItemSource src, QuestEntry quest, QuestStep step, HashSet<string> visited, int depth = 0)
		{
			string type = src.Type;
			if (1 == 0)
			{
			}
			string text;
			int? nodeCount;
			switch (type)
			{
			case "drop":
				text = "Drops from: " + src.Name;
				break;
			case "vendor":
				text = "Sold by: " + src.Name;
				break;
			case "dialog_give":
				text = "Given by: " + src.Name;
				break;
			case "fishing":
				text = "Fishing";
				break;
			case "mining":
				text = "Mining";
				break;
			case "pickup":
				text = "Found in world";
				break;
			case "crafting":
				text = "Crafted from: " + src.Name;
				break;
			case "quest_reward":
				text = "Quest reward: " + src.Name;
				break;
			case "ingredient":
			{
				string? name = src.Name;
				nodeCount = src.NodeCount;
				object obj;
				if (nodeCount.HasValue)
				{
					int valueOrDefault = nodeCount.GetValueOrDefault();
					obj = $" x{valueOrDefault}";
				}
				else
				{
					obj = "";
				}
				text = "Ingredient: " + name + (string?)obj;
				break;
			}
			case "item_use":
				text = "Use: " + src.Name;
				break;
			default:
				text = src.Name ?? src.Type;
				break;
			}
			if (1 == 0)
			{
			}
			string text2 = text;
			string text3 = text2;
			if (src.Zone != null)
			{
				text3 = text3 + "  ·  " + src.Zone;
			}
			nodeCount = src.Level;
			if (nodeCount.HasValue)
			{
				int valueOrDefault2 = nodeCount.GetValueOrDefault();
				if (true)
				{
					text3 += $"  ·  Lv {valueOrDefault2}";
				}
			}
			if (src.Type == "quest_reward" && src.QuestKey != null)
			{
				QuestEntry byStableKey = _data.GetByStableKey(src.QuestKey);
				List<QuestStep> list = byStableKey?.Steps;
				if (list != null && list.Count > 0 && visited.Count <= 5 && !visited.Contains(byStableKey.StableKey))
				{
					DrawQuestRewardTree(src, byStableKey, text3, step, visited);
					return;
				}
			}
			List<ItemSource> children = src.Children;
			if (children != null && children.Count > 0 && depth < 3)
			{
				if (!ImGui.TreeNode($"{text3}##src_{step.Order}_{depth}_{src.Type}_{src.Name}"))
				{
					return;
				}
				if (src.Type == "quest_reward" && src.QuestKey != null)
				{
					QuestEntry byStableKey2 = _data.GetByStableKey(src.QuestKey);
					if (byStableKey2 != null)
					{
						ImGui.PushStyleColor((ImGuiCol)0, Theme.QuestActive);
						if (ImGui.Selectable($"Open quest: {byStableKey2.DisplayName}##goto_{step.Order}_{src.QuestKey}"))
						{
							_state.SelectQuest(byStableKey2.DBName);
						}
						ImGui.PopStyleColor();
					}
				}
				foreach (ItemSource child in src.Children)
				{
					DrawSource(child, quest, step, visited, depth + 1);
				}
				ImGui.TreePop();
				return;
			}
			string text4 = src.MakeSourceId();
			if (text4 != null)
			{
				bool flag = _nav.IsSourceActive(text4);
				if (flag)
				{
					uint num = (_nav.IsManualSourceOverride ? Theme.NavManualOverride : Theme.QuestActive);
					ImGui.PushStyleColor((ImGuiCol)0, num);
				}
				if (ImGui.Selectable($"{text3}##src_{step.Order}_{text4}"))
				{
					_nav.ToggleSource(text4, _state.CurrentZone);
				}
				if (flag)
				{
					ImGui.PopStyleColor();
				}
				if (ImGui.IsItemHovered())
				{
					ImGui.BeginTooltip();
					string text5 = (flag ? "Remove from" : "Add to");
					if (src.SourceKey != null)
					{
						ImGui.Text(text5 + " navigation: " + src.Name);
					}
					else
					{
						ImGui.Text(text5 + " navigation: " + (src.Zone ?? src.Scene));
					}
					ImGui.EndTooltip();
				}
			}
			else
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.SourceDimmed);
				ImGui.Text(text3);
				ImGui.PopStyleColor();
			}
		}

		private void DrawSubQuestSteps(QuestStep step, HashSet<string> visited)
		{
			if (step.Action != "complete_quest" || step.TargetKey == null)
			{
				return;
			}
			QuestEntry byStableKey = _data.GetByStableKey(step.TargetKey);
			if (byStableKey?.Steps != null && byStableKey.Steps.Count != 0 && visited.Count <= 5 && !visited.Contains(byStableKey.StableKey))
			{
				ImGui.Indent(16f);
				ImGui.PushStyleColor((ImGuiCol)0, Theme.QuestActive);
				if (ImGui.Selectable($"Open quest: {byStableKey.DisplayName}##cq_{step.Order}_{step.TargetKey}"))
				{
					_state.SelectQuest(byStableKey.DBName);
				}
				ImGui.PopStyleColor();
				visited.Add(byStableKey.StableKey);
				DrawSteps(byStableKey, visited);
				visited.Remove(byStableKey.StableKey);
				ImGui.Unindent(16f);
			}
		}

		private void DrawQuestRewardTree(ItemSource src, QuestEntry subQuest, string label, QuestStep parentStep, HashSet<string> visited)
		{
			//IL_001b: 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)
			bool flag = _state.IsCompleted(subQuest.DBName);
			ImGuiTreeNodeFlags val = (ImGuiTreeNodeFlags)((!flag) ? 32 : 0);
			if (flag)
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.QuestCompleted);
			}
			bool flag2 = ImGui.TreeNodeEx($"{label}##sqt_{parentStep.Order}_{src.QuestKey}", val);
			if (flag)
			{
				ImGui.PopStyleColor();
			}
			if (flag2)
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.QuestActive);
				if (ImGui.Selectable($"Open quest: {subQuest.DisplayName}##goto_{parentStep.Order}_{src.QuestKey}"))
				{
					_state.SelectQuest(subQuest.DBName);
				}
				ImGui.PopStyleColor();
				visited.Add(subQuest.StableKey);
				DrawSteps(subQuest, visited);
				visited.Remove(subQuest.StableKey);
				ImGui.TreePop();
			}
		}

		private void DrawTips(QuestStep step)
		{
			if (step.Tips == null || step.Tips.Count == 0)
			{
				return;
			}
			ImGui.Indent(16f);
			if (ImGui.TreeNode($"Tips##{step.Order}"))
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
				foreach (string tip in step.Tips)
				{
					ImGui.TextWrapped(tip);
				}
				ImGui.PopStyleColor();
				ImGui.TreePop();
			}
			ImGui.Unindent(16f);
		}

		private void DrawRewards(QuestEntry quest)
		{
			RewardInfo rewards = quest.Rewards;
			if (rewards == null || !HasAnyRewards(rewards) || !ImGui.CollapsingHeader("Rewards", (ImGuiTreeNodeFlags)32))
			{
				return;
			}
			ImGui.Indent(16f);
			if (rewards.XP > 0)
			{
				ImGui.Text($"{rewards.XP} XP");
			}
			if (rewards.Gold > 0)
			{
				ImGui.Text($"{rewards.Gold} Gold");
			}
			if (rewards.ItemName != null)
			{
				ImGui.Text(rewards.ItemName);
			}
			if (rewards.VendorUnlock != null)
			{
				ImGui.Text("Unlocks " + rewards.VendorUnlock.ItemName + " at " + rewards.VendorUnlock.VendorName);
			}
			if (rewards.UnlockedZoneLines != null)
			{
				foreach (UnlockedZoneLine unlockedZoneLine in rewards.UnlockedZoneLines)
				{
					string text = "Opens path from " + unlockedZoneLine.FromZone + " to " + unlockedZoneLine.ToZone;
					List<string> coRequirements = unlockedZoneLine.CoRequirements;
					if (coRequirements != null && coRequirements.Count > 0)
					{
						text = text + " (also requires " + string.Join(", ", unlockedZoneLine.CoRequirements) + ")";
					}
					ImGui.Text(text);
				}
			}
			if (rewards.UnlockedCharacters != null)
			{
				foreach (UnlockedCharacter unlockedCharacter in rewards.UnlockedCharacters)
				{
					string text2 = ((unlockedCharacter.Zone != null) ? ("Enables " + unlockedCharacter.Name + " in " + unlockedCharacter.Zone) : ("Enables " + unlockedCharacter.Name));
					ImGui.Text(text2);
				}
			}
			if (rewards.NextQuestName != null)
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
				ImGui.Text("Next: " + rewards.NextQuestName);
				ImGui.PopStyleColor();
			}
			if (rewards.FactionEffects != null)
			{
				foreach (FactionEffect factionEffect in rewards.FactionEffects)
				{
					string arg = ((factionEffect.Amount >= 0) ? "+" : "");
					ImGui.Text($"{factionEffect.FactionName}: {arg}{factionEffect.Amount}");
				}
			}
			if (rewards.AlsoCompletes != null && rewards.AlsoCompletes.Count > 0)
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
				ImGui.Text("Also completes: " + string.Join(", ", rewards.AlsoCompletes));
				ImGui.PopStyleColor();
			}
			ImGui.Unindent(16f);
		}

		private static bool HasAnyRewards(RewardInfo r)
		{
			int result;
			if (r.XP <= 0 && r.Gold <= 0 && r.ItemName == null && r.VendorUnlock == null)
			{
				List<UnlockedZoneLine> unlockedZoneLines = r.UnlockedZoneLines;
				if (unlockedZoneLines == null || unlockedZoneLines.Count <= 0)
				{
					List<UnlockedCharacter> unlockedCharacters = r.UnlockedCharacters;
					if ((unlockedCharacters == null || unlockedCharacters.Count <= 0) && r.NextQuestName == null)
					{
						List<FactionEffect> factionEffects = r.FactionEffects;
						if (factionEffects == null || factionEffects.Count <= 0)
						{
							List<string> alsoCompletes = r.AlsoCompletes;
							result = ((alsoCompletes != null && alsoCompletes.Count > 0) ? 1 : 0);
							goto IL_007c;
						}
					}
				}
			}
			result = 1;
			goto IL_007c;
			IL_007c:
			return (byte)result != 0;
		}

		private void DrawPrerequisites(QuestEntry quest)
		{
			//IL_00ea: 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)
			if (quest.Prerequisites == null || quest.Prerequisites.Count == 0)
			{
				return;
			}
			HashSet<string> hashSet = CollectStepTreeQuestKeys(quest);
			List<Prerequisite> list = new List<Prerequisite>();
			foreach (Prerequisite prerequisite in quest.Prerequisites)
			{
				if (!hashSet.Contains(prerequisite.QuestKey))
				{
					list.Add(prerequisite);
				}
			}
			if (list.Count == 0)
			{
				return;
			}
			bool flag = false;
			foreach (Prerequisite item in list)
			{
				if (!IsPrerequisiteCompleted(item))
				{
					flag = true;
					break;
				}
			}
			ImGuiTreeNodeFlags val = (ImGuiTreeNodeFlags)(flag ? 32 : 0);
			if (!ImGui.CollapsingHeader("Prerequisites", val))
			{
				return;
			}
			ImGui.Indent(16f);
			foreach (Prerequisite item2 in list)
			{
				uint num = (IsPrerequisiteCompleted(item2) ? Theme.QuestCompleted : Theme.TextPrimary);
				string text = ((item2.Item != null) ? (item2.QuestName + " (" + item2.Item + ")") : item2.QuestName);
				ImGui.PushStyleColor((ImGuiCol)0, num);
				if (ImGui.Selectable(text + "##prereq_" + item2.QuestKey))
				{
					QuestEntry byStableKey = _data.GetByStableKey(item2.QuestKey);
					if (byStableKey != null)
					{
						_state.SelectQuest(byStableKey.DBName);
					}
				}
				ImGui.PopStyleColor();
			}
			ImGui.Unindent(16f);
		}

		private static HashSet<string> CollectStepTreeQuestKeys(QuestEntry quest)
		{
			HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
			if (quest.Steps != null)
			{
				foreach (QuestStep step in quest.Steps)
				{
					if (step.Action == "complete_quest" && step.TargetKey != null)
					{
						hashSet.Add(step.TargetKey);
					}
				}
			}
			if (quest.RequiredItems != null)
			{
				foreach (RequiredItemInfo requiredItem in quest.RequiredItems)
				{
					if (requiredItem.Sources != null)
					{
						CollectQuestRewardKeys(requiredItem.Sources, hashSet);
					}
				}
			}
			return hashSet;
		}

		private static void CollectQuestRewardKeys(List<ItemSource> sources, HashSet<string> keys)
		{
			foreach (ItemSource source in sources)
			{
				if (source.Type == "quest_reward" && source.QuestKey != null)
				{
					keys.Add(source.QuestKey);
				}
				if (source.Children != null)
				{
					CollectQuestRewardKeys(source.Children, keys);
				}
			}
		}

		private bool IsPrerequisiteCompleted(Prerequisite prereq)
		{
			QuestEntry byStableKey = _data.GetByStableKey(prereq.QuestKey);
			return byStableKey != null && _state.IsCompleted(byStableKey.DBName);
		}

		private static RequiredItemInfo? FindRequiredItem(QuestEntry quest, QuestStep step)
		{
			QuestStep step2 = step;
			return quest.RequiredItems?.Find((RequiredItemInfo ri) => string.Equals(ri.ItemName, step2.TargetName, StringComparison.OrdinalIgnoreCase));
		}

		private bool HasNavigableSource(ItemSource s)
		{
			if (s.Scene != null)
			{
				return true;
			}
			if (s.SourceKey != null && _data.CharacterSpawns.ContainsKey(s.SourceKey))
			{
				return true;
			}
			return s.Children?.Exists((ItemSource c) => HasNavigableSource(c)) ?? false;
		}
	}
	public sealed class QuestListPanel
	{
		private readonly GuideData _data;

		private readonly QuestStateTracker _state;

		private readonly FilterState _filter;

		private readonly TrackerState _tracker;

		private string _searchBuf = string.Empty;

		private readonly List<QuestEntry> _sorted = new List<QuestEntry>();

		private int _lastFilterVersion = -1;

		private int _lastStateVersion = -1;

		private static readonly string[] FilterNames = new string[4] { "Active", "Available", "Completed", "All" };

		private int _filterIndex;

		private const string CurrentZoneSentinel = "\u001current";

		private readonly string[] _zoneNames;

		private int _zoneIndex;

		public QuestListPanel(GuideData data, QuestStateTracker state, FilterState filter, TrackerState tracker)
		{
			_data = data;
			_state = state;
			_filter = filter;
			_tracker = tracker;
			SortedSet<string> sortedSet = new SortedSet<string>(StringComparer.OrdinalIgnoreCase);
			foreach (QuestEntry item in data.All)
			{
				if (item.ZoneContext != null)
				{
					sortedSet.Add(item.ZoneContext);
				}
			}
			_zoneNames = new string[sortedSet.Count + 2];
			_zoneNames[0] = "All Zones";
			_zoneNames[1] = "Current Zone";
			int num = 2;
			foreach (string item2 in sortedSet)
			{
				_zoneNames[num++] = item2;
			}
		}

		public void Draw(float width)
		{
			DrawFilterRow(width);
			DrawZoneFilter();
			DrawSearchBar();
			ImGui.Separator();
			ImGui.BeginChild("##QuestScroll");
			if (DrawQuestList() == 0)
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
				if (_data.Count == 0)
				{
					ImGui.TextWrapped("No quest data loaded.");
				}
				else if (!string.IsNullOrEmpty(_filter.SearchText))
				{
					ImGui.TextWrapped("No quests match your search.");
				}
				else
				{
					ImGui.TextWrapped("No quests in this category.");
				}
				ImGui.PopStyleColor();
			}
			ImGui.EndChild();
		}

		private void DrawFilterRow(float width)
		{
			_filterIndex = (int)_filter.FilterMode;
			ImGui.SetNextItemWidth(width * 0.55f);
			if (ImGui.Combo("##Filter", ref _filterIndex, FilterNames, FilterNames.Length))
			{
				_filter.FilterMode = (QuestFilterMode)_filterIndex;
			}
			ImGui.SameLine();
			DrawSortButton("Az", QuestSortMode.Alphabetical, "Sort alphabetically");
			ImGui.SameLine(0f, 2f);
			DrawSortButton("Lv", QuestSortMode.ByLevel, "Sort by level");
			ImGui.SameLine(0f, 2f);
			DrawSortButton("Zn", QuestSortMode.ByZone, "Sort by zone");
			ImGui.Spacing();
		}

		private void DrawSortButton(string label, QuestSortMode mode, string tooltip)
		{
			bool flag = _filter.SortMode == mode;
			if (flag)
			{
				ImGui.PushStyleColor((ImGuiCol)21, Theme.Accent);
			}
			if (ImGui.SmallButton(label + "##sort"))
			{
				_filter.SortMode = mode;
			}
			if (flag)
			{
				ImGui.PopStyleColor();
			}
			if (ImGui.IsItemHovered())
			{
				ImGui.BeginTooltip();
				ImGui.TextUnformatted(tooltip);
				ImGui.EndTooltip();
			}
		}

		private void DrawZoneFilter()
		{
			_zoneIndex = 0;
			if (_filter.ZoneFilter != null)
			{
				if (_filter.ZoneFilter == "\u001current")
				{
					_zoneIndex = 1;
				}
				else
				{
					for (int i = 2; i < _zoneNames.Length; i++)
					{
						if (string.Equals(_zoneNames[i], _filter.ZoneFilter, StringComparison.OrdinalIgnoreCase))
						{
							_zoneIndex = i;
							break;
						}
					}
				}
			}
			ImGui.SetNextItemWidth(-1f);
			if (ImGui.Combo("##Zone", ref _zoneIndex, _zoneNames, _zoneNames.Length))
			{
				FilterState filter = _filter;
				int zoneIndex = _zoneIndex;
				if (1 == 0)
				{
				}
				string zoneFilter = zoneIndex switch
				{
					0 => null, 
					1 => "\u001current", 
					_ => _zoneNames[_zoneIndex], 
				};
				if (1 == 0)
				{
				}
				filter.ZoneFilter = zoneFilter;
			}
			ImGui.Spacing();
		}

		private void DrawSearchBar()
		{
			if (_searchBuf != _filter.SearchText)
			{
				_searchBuf = _filter.SearchText;
			}
			ImGui.SetNextItemWidth(-1f);
			if (ImGui.InputTextWithHint("##QuestSearch", "Search quests...", ref _searchBuf, 256u))
			{
				_filter.SearchText = _searchBuf;
			}
			ImGui.Spacing();
		}

		private int DrawQuestList()
		{
			bool flag = _filter.Version != _lastFilterVersion;
			bool flag2 = _state.Version != _lastStateVersion;
			if (flag || flag2)
			{
				_lastFilterVersion = _filter.Version;
				_lastStateVersion = _state.Version;
				_sorted.Clear();
				IReadOnlyList<QuestEntry> all = _data.All;
				for (int i = 0; i < all.Count; i++)
				{
					QuestEntry questEntry = all[i];
					if (PassesFilter(questEntry) && PassesSearch(questEntry))
					{
						_sorted.Add(questEntry);
					}
				}
				_sorted.Sort(CompareQuests);
			}
			foreach (QuestEntry item in _sorted)
			{
				DrawQuestEntry(item);
			}
			return _sorted.Count;
		}

		private int CompareQuests(QuestEntry a, QuestEntry b)
		{
			QuestSortMode sortMode = _filter.SortMode;
			if (1 == 0)
			{
			}
			int result = sortMode switch
			{
				QuestSortMode.ByLevel => CompareLevels(a, b), 
				QuestSortMode.ByZone => CompareZones(a, b), 
				_ => string.Compare(a.DisplayName, b.DisplayName, StringComparison.OrdinalIgnoreCase), 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		private static int CompareLevels(QuestEntry a, QuestEntry b)
		{
			int? num = a.LevelEstimate?.Recommended;
			int? num2 = b.LevelEstimate?.Recommended;
			if (!num.HasValue && !num2.HasValue)
			{
				return string.Compare(a.DisplayName, b.DisplayName, StringComparison.OrdinalIgnoreCase);
			}
			if (!num.HasValue)
			{
				return 1;
			}
			if (!num2.HasValue)
			{
				return -1;
			}
			int num3 = num.Value.CompareTo(num2.Value);
			return (num3 != 0) ? num3 : string.Compare(a.DisplayName, b.DisplayName, StringComparison.OrdinalIgnoreCase);
		}

		private static int CompareZones(QuestEntry a, QuestEntry b)
		{
			if (a.ZoneContext == null && b.ZoneContext == null)
			{
				return string.Compare(a.DisplayName, b.DisplayName, StringComparison.OrdinalIgnoreCase);
			}
			if (a.ZoneContext == null)
			{
				return 1;
			}
			if (b.ZoneContext == null)
			{
				return -1;
			}
			int num = string.Compare(a.ZoneContext, b.ZoneContext, StringComparison.OrdinalIgnoreCase);
			return (num != 0) ? num : string.Compare(a.DisplayName, b.DisplayName, StringComparison.OrdinalIgnoreCase);
		}

		private bool PassesFilter(QuestEntry quest)
		{
			QuestFilterMode filterMode = _filter.FilterMode;
			if (1 == 0)
			{
			}
			bool flag = filterMode switch
			{
				QuestFilterMode.Active => _state.IsActive(quest.DBName), 
				QuestFilterMode.Available => !_state.IsActive(quest.DBName) && !_state.IsCompleted(quest.DBName), 
				QuestFilterMode.Completed => _state.IsCompleted(quest.DBName), 
				QuestFilterMode.All => true, 
				_ => true, 
			};
			if (1 == 0)
			{
			}
			if (!flag)
			{
				return false;
			}
			if (_filter.ZoneFilter != null)
			{
				string text = ((_filter.ZoneFilter == "\u001current") ? _data.GetZoneDisplayName(_state.CurrentZone) : _filter.ZoneFilter);
				if (text == null)
				{
					return true;
				}
				return string.Equals(quest.ZoneContext, text, StringComparison.OrdinalIgnoreCase);
			}
			return true;
		}

		private bool PassesSearch(QuestEntry quest)
		{
			if (string.IsNullOrEmpty(_filter.SearchText))
			{
				return true;
			}
			string searchText = _filter.SearchText;
			if (quest.DisplayName.Contains(searchText, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (quest.ZoneContext != null && quest.ZoneContext.Contains(searchText, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (quest.Acquisition != null)
			{
				foreach (AcquisitionSource item in quest.Acquisition)
				{
					if (item.SourceName != null && item.SourceName.Contains(searchText, StringComparison.OrdinalIgnoreCase))
					{
						return true;
					}
				}
			}
			if (quest.RequiredItems != null)
			{
				foreach (RequiredItemInfo requiredItem in quest.RequiredItems)
				{
					if (requiredItem.ItemName.Contains(searchText, StringComparison.OrdinalIgnoreCase))
					{
						return true;
					}
				}
			}
			if (quest.Steps != null)
			{
				foreach (QuestStep step in quest.Steps)
				{
					if (step.TargetName != null && step.TargetName.Contains(searchText, StringComparison.OrdinalIgnoreCase))
					{
						return true;
					}
				}
			}
			return false;
		}

		private void DrawQuestEntry(QuestEntry quest)
		{
			bool flag = quest.DBName == _state.SelectedQuestDBName;
			uint questColor = GetQuestColor(quest);
			if (flag)
			{
				ImGui.PushStyleColor((ImGuiCol)21, Theme.Accent);
			}
			string text = ((_tracker.Enabled && _tracker.IsTracked(quest.DBName)) ? "·" : " ");
			QuestFlags flags = quest.Flags;
			string text2 = ((flags != null && flags.Repeatable) ? " [R]" : "");
			int? num = quest.LevelEstimate?.Recommended;
			string text3;
			if (num.HasValue)
			{
				int valueOrDefault = num.GetValueOrDefault();
				text3 = $"{text}{valueOrDefault,2}  {quest.DisplayName}{text2}";
			}
			else
			{
				text3 = text + "    " + quest.DisplayName + text2;
			}
			string text4 = text3;
			ImGui.PushStyleColor((ImGuiCol)0, questColor);
			if (ImGui.Selectable(text4 + "##" + quest.DBName, flag))
			{
				_state.SelectQuest(quest.DBName);
			}
			if (ImGui.IsItemHovered())
			{
				ImGui.BeginTooltip();
				if (quest.ZoneContext != null)
				{
					ImGui.Text(quest.ZoneContext);
				}
				string text5 = (_state.IsCompleted(quest.DBName) ? "Completed" : (_state.IsImplicitlyActive(quest.DBName) ? "Completable here" : (_state.IsActive(quest.DBName) ? "Active" : "Available")));
				ImGui.Text(text5);
				num = quest.LevelEstimate?.Recommended;
				if (num.HasValue)
				{
					int valueOrDefault2 = num.GetValueOrDefault();
					if (true)
					{
						ImGui.Text($"Level {valueOrDefault2}");
					}
				}
				ImGui.EndTooltip();
			}
			ImGui.PopStyleColor((!flag) ? 1 : 2);
		}

		private uint GetQuestColor(QuestEntry quest)
		{
			return Theme.GetQuestColor(_state, quest.DBName);
		}
	}
	public readonly struct StepDistance
	{
		public readonly bool InCurrentZone;

		public readonly float Meters;

		public readonly string? Label;

		public bool HasDistance => Meters < float.MaxValue;

		public bool HasLabel => Label != null;

		public StepDistance(bool inCurrentZone, float meters, string? label = null)
		{
			InCurrentZone = inCurrentZone;
			Meters = meters;
			Label = label;
		}
	}
	public static class Theme
	{
		public static readonly uint Background = Rgba(0.1f, 0.1f, 0.12f, 0.95f);

		public static readonly uint Surface = Rgba(0.15f, 0.15f, 0.18f, 1f);

		public static readonly uint TextPrimary = Rgba(1f, 1f, 1f, 1f);

		public static readonly uint TextSecondary = Rgba(0.6f, 0.6f, 0.6f, 1f);

		public static readonly uint Accent = Rgba(0.2f, 0.35f, 0.55f, 1f);

		public static readonly uint Success = Rgba(0.4f, 0.8f, 0.4f, 1f);

		public static readonly uint Warning = Rgba(1f, 0.5f, 0.3f, 1f);

		public static readonly uint Error = Rgba(1f, 0.3f, 0.3f, 1f);

		public static readonly uint QuestActive = Rgba(1f, 0.9f, 0.3f, 1f);

		public static readonly uint QuestImplicit = Rgba(0.55f, 0.8f, 0.75f, 1f);

		public static readonly uint QuestCompleted = Rgba(0.4f, 0.7f, 0.4f, 1f);

		public static readonly uint QuestAvailable = Rgba(0.5f, 0.7f, 0.9f, 1f);

		public static readonly uint NavManualOverride = Rgba(0.45f, 0.85f, 0.9f, 1f);

		public static readonly uint SourceDimmed = Rgba(0.5f, 0.5f, 0.5f, 1f);

		public static readonly uint Header = Rgba(0.9f, 0.85f, 0.6f, 1f);

		public static readonly uint LevelSafe = Rgba(0.4f, 0.8f, 0.4f, 1f);

		public static readonly uint LevelCaution = Rgba(1f, 0.9f, 0.3f, 1f);

		public static readonly uint LevelDanger = Rgba(1f, 0.3f, 0.3f, 1f);

		public static readonly uint TrackerFlashGreen = Rgba(0.2f, 0.8f, 0.2f, 0.3f);

		public static readonly uint TrackerFlashYellow = Rgba(0.8f, 0.7f, 0.1f, 0.2f);

		public const float WindowPadding = 8f;

		public const float ItemSpacing = 4f;

		public const float SectionGap = 8f;

		public const float IndentWidth = 16f;

		public const float LeftPanelRatio = 0.32f;

		public static void PushWindowStyle()
		{
			ImGui.PushStyleColor((ImGuiCol)2, Background);
			ImGui.PushStyleColor((ImGuiCol)3, Surface);
		}

		public static void PopWindowStyle()
		{
			ImGui.PopStyleColor(2);
		}

		public static uint Rgba(float r, float g, float b, float a)
		{
			byte b2 = (byte)(r * 255f + 0.5f);
			byte b3 = (byte)(g * 255f + 0.5f);
			byte b4 = (byte)(b * 255f + 0.5f);
			byte b5 = (byte)(a * 255f + 0.5f);
			return (uint)(b2 | (b3 << 8) | (b4 << 16) | (b5 << 24));
		}

		public static void ClampWindowPosition()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			Vector2 windowPos = ImGui.GetWindowPos();
			Vector2 windowSize = ImGui.GetWindowSize();
			ImGuiIOPtr iO = ImGui.GetIO();
			Vector2 displaySize = ((ImGuiIOPtr)(ref iO)).DisplaySize;
			float num = windowPos.X;
			float num2 = windowPos.Y;
			if (num + windowSize.X < 40f)
			{
				num = 40f - windowSize.X;
			}
			if (num > displaySize.X - 40f)
			{
				num = displaySize.X - 40f;
			}
			if (num2 > displaySize.Y - 40f)
			{
				num2 = displaySize.Y - 40f;
			}
			if (num2 < 0f)
			{
				num2 = 0f;
			}
			if (num != windowPos.X || num2 != windowPos.Y)
			{
				ImGui.SetWindowPos(new Vector2(num, num2));
			}
		}

		public static uint GetQuestColor(QuestStateTracker state, string dbName)
		{
			if (state.IsImplicitlyActive(dbName))
			{
				return QuestImplicit;
			}
			if (state.IsActive(dbName))
			{
				return QuestActive;
			}
			if (state.IsCompleted(dbName))
			{
				return QuestCompleted;
			}
			return QuestAvailable;
		}
	}
	internal static class TrackerSorter
	{
		private readonly struct SourceDistance
		{
			public readonly float Meters;

			public readonly string? Label;

			public static SourceDistance None => new SourceDistance(float.MaxValue);

			public SourceDistance(float meters, string? label = null)
			{
				Meters = meters;
				Label = label;
			}

			public static SourceDistance Best(SourceDistance a, SourceDistance b)
			{
				if (a.Label != null && b.Label == null)
				{
					return a;
				}
				if (b.Label != null && a.Label == null)
				{
					return b;
				}
				return (a.Meters <= b.Meters) ? a : b;
			}
		}

		public static void ComputeDistances(IReadOnlyList<string> quests, GuideData data, QuestStateTracker state, NavigationController nav, Vector3 playerPos, Dictionary<string, StepDistance> output)
		{
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			output.Clear();
			string currentZone = state.CurrentZone;
			for (int i = 0; i < quests.Count; i++)
			{
				string text = quests[i];
				QuestEntry byDBName = data.GetByDBName(text);
				if (byDBName == null)
				{
					output[text] = new StepDistance(inCurrentZone: false, float.MaxValue);
				}
				else if (nav.Target != null && string.Equals(nav.Target.QuestDBName, text, StringComparison.OrdinalIgnoreCase))
				{
					bool flag = !nav.Target.IsCrossZone(currentZone);
					if (flag && nav.Target.TargetKind == NavigationTarget.Kind.Zone)
					{
						string label = ((nav.Target.SourceId != null && nav.Target.SourceId.StartsWith("fishing:", StringComparison.Ordinal)) ? "Fishing" : null);
						output[text] = new StepDistance(inCurrentZone: true, float.MaxValue, label);
					}
					else
					{
						float meters = (flag ? nav.Distance : float.MaxValue);
						output[text] = new StepDistance(flag, meters);
					}
				}
				else if (!IsCurrentStepInZone(byDBName, state, data, currentZone))
				{
					output[text] = new StepDistance(inCurrentZone: false, float.MaxValue);
				}
				else
				{
					SourceDistance sourceDistance = ComputeStepDistance(byDBName, state, data, currentZone, playerPos);
					output[text] = new StepDistance(inCurrentZone: true, sourceDistance.Meters, sourceDistance.Label);
				}
			}
		}

		public static void Sort(List<string> quests, TrackerSortMode mode, GuideData data, IReadOnlyDictionary<string, StepDistance>? distances)
		{
			switch (mode)
			{
			case TrackerSortMode.Proximity:
				if (distances == null)
				{
					break;
				}
				SortByProximity(quests, data, distances);
				return;
			case TrackerSortMode.Level:
				SortByLevel(quests, data);
				return;
			}
			SortAlphabetical(quests, data);
		}

		private static void SortByProximity(List<string> quests, GuideData data, IReadOnlyDictionary<string, StepDistance> distances)
		{
			IReadOnlyDictionary<string, StepDistance> distances2 = distances;
			GuideData data2 = data;
			quests.Sort(delegate(string a, string b)
			{
				StepDistance value;
				StepDistance stepDistance = (distances2.TryGetValue(a, out value) ? value : new StepDistance(inCurrentZone: false, float.MaxValue));
				StepDistance value2;
				StepDistance stepDistance2 = (distances2.TryGetValue(b, out value2) ? value2 : new StepDistance(inCurrentZone: false, float.MaxValue));
				if (stepDistance.InCurrentZone != stepDistance2.InCurrentZone)
				{
					return (!stepDistance.InCurrentZone) ? 1 : (-1);
				}
				if (stepDistance.InCurrentZone)
				{
					float num = (stepDistance.HasDistance ? stepDistance.Meters : 0f);
					float value3 = (stepDistance2.HasDistance ? stepDistance2.Meters : 0f);
					int num2 = num.CompareTo(value3);
					if (num2 != 0)
					{
						return num2;
					}
				}
				QuestEntry byDBName = data2.GetByDBName(a);
				QuestEntry byDBName2 = data2.GetByDBName(b);
				return string.Compare(byDBName?.DisplayName, byDBName2?.DisplayName, StringComparison.OrdinalIgnoreCase);
			});
		}

		private static void SortByLevel(List<string> quests, GuideData data)
		{
			GuideData data2 = data;
			quests.Sort(delegate(string a, string b)
			{
				QuestEntry byDBName = data2.GetByDBName(a);
				QuestEntry byDBName2 = data2.GetByDBName(b);
				int valueOrDefault = (byDBName?.LevelEstimate?.Recommended).GetValueOrDefault(int.MaxValue);
				int valueOrDefault2 = (byDBName2?.LevelEstimate?.Recommended).GetValueOrDefault(int.MaxValue);
				int num = valueOrDefault.CompareTo(valueOrDefault2);
				return (num != 0) ? num : string.Compare(byDBName?.DisplayName, byDBName2?.DisplayName, StringComparison.OrdinalIgnoreCase);
			});
		}

		private static void SortAlphabetical(List<string> quests, GuideData data)
		{
			GuideData data2 = data;
			quests.Sort(delegate(string a, string b)
			{
				QuestEntry byDBName = data2.GetByDBName(a);
				QuestEntry byDBName2 = data2.GetByDBName(b);
				return string.Compare(byDBName?.DisplayName ?? a, byDBName2?.DisplayName ?? b, StringComparison.OrdinalIgnoreCase);
			});
		}

		public static string? GetStepZoneName(QuestEntry quest, QuestStateTracker state, GuideData data)
		{
			QuestStep currentStep = GetCurrentStep(quest, state, data);
			if (currentStep == null)
			{
				return null;
			}
			var (questStep, questEntry) = StepProgress.ResolveActiveStep(currentStep, quest, state, data);
			if (questStep == null)
			{
				return null;
			}
			string text = StepSceneResolver.ResolveScene(questEntry ?? quest, questStep, data);
			return (text != null) ? data.GetZoneDisplayName(text) : null;
		}

		private static bool IsCurrentStepInZone(QuestEntry quest, QuestStateTracker state, GuideData data, string currentScene)
		{
			QuestStep currentStep = GetCurrentStep(quest, state, data);
			if (currentStep == null)
			{
				return false;
			}
			var (questStep, questEntry) = StepProgress.ResolveActiveStep(currentStep, quest, state, data);
			if (questStep == null)
			{
				return false;
			}
			return StepSceneResolver.HasSourceInScene(questEntry ?? quest, questStep, data, currentScene);
		}

		private static SourceDistance ComputeStepDistance(QuestEntry quest, QuestStateTracker state, GuideData data, string currentScene, Vector3 playerPos)
		{
			//IL_00ab: 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)
			QuestStep currentStep = GetCurrentStep(quest, state, data);
			if (currentStep == null)
			{
				return SourceDistance.None;
			}
			var (step, questEntry) = StepProgress.ResolveActiveStep(currentStep, quest, state, data);
			if (step == null)
			{
				return SourceDistance.None;
			}
			QuestEntry questEntry2 = questEntry ?? quest;
			string targetKey = step.TargetKey;
			if (targetKey != null && step.TargetType == "character" && data.CharacterSpawns.ContainsKey(targetKey))
			{
				return NearestSpawnDistance(data, targetKey, currentScene, playerPos);
			}
			if (step.TargetType == "item" && questEntry2.RequiredItems != null)
			{
				RequiredItemInfo requiredItemInfo = questEntry2.RequiredItems.Find((RequiredItemInfo ri) => string.Equals(ri.ItemName, step.TargetName, StringComparison.OrdinalIgnoreCase));
				if (requiredItemInfo?.Sources != null)
				{
					return NearestSourceDistance(requiredItemInfo.Sources, data, currentScene, playerPos);
				}
			}
			return SourceDistance.None;
		}

		private static SourceDistance NearestSourceDistance(List<ItemSource> sources, GuideData data, string currentScene, Vector3 playerPos)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			SourceDistance sourceDistance = SourceDistance.None;
			foreach (ItemSource source in sources)
			{
				if (source.Type == "quest_reward")
				{
					List<ItemSource> children = source.Children;
					if (children != null && children.Count > 0)
					{
						sourceDistance = SourceDistance.Best(sourceDistance, NearestSourceDistance(source.Children, data, currentScene, playerPos));
						continue;
					}
				}
				if (source.SourceKey != null)
				{
					sourceDistance = SourceDistance.Best(sourceDistance, NearestSpawnDistance(data, source.SourceKey, currentScene, playerPos));
				}
				if (source.Children != null)
				{
					sourceDistance = SourceDistance.Best(sourceDistance, NearestSourceDistance(source.Children, data, currentScene, playerPos));
				}
			}
			return sourceDistance;
		}

		private static SourceDistance NearestSpawnDistance(GuideData data, string key, string currentScene, Vector3 playerPos)
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			if (key.StartsWith("fishing:", StringComparison.Ordinal))
			{
				string a = key.Substring("fishing:".Length);
				return string.Equals(a, currentScene, StringComparison.OrdinalIgnoreCase) ? new SourceDistance(float.MaxValue, "Fishing") : SourceDistance.None;
			}
			if (!data.CharacterSpawns.TryGetValue(key, out List<SpawnPoint> value) || value.Count == 0)
			{
				return SourceDistance.None;
			}
			float num = float.MaxValue;
			foreach (SpawnPoint item in value)
			{
				if (string.Equals(item.Scene, currentScene, StringComparison.OrdinalIgnoreCase))
				{
					float num2 = Vector3.Distance(playerPos, new Vector3(item.X, item.Y, item.Z));
					if (num2 < num)
					{
						num = num2;
					}
				}
			}
			return new SourceDistance(num);
		}

		private static QuestStep? GetCurrentStep(QuestEntry quest, QuestStateTracker state, GuideData data)
		{
			if (quest.Steps == null || quest.Steps.Count == 0)
			{
				return null;
			}
			int currentStepIndex = StepProgress.GetCurrentStepIndex(quest, state, data);
			return (currentStepIndex < quest.Steps.Count) ? quest.Steps[currentStepIndex] : null;
		}
	}
	public enum TrackerSortMode
	{
		Proximity,
		Level,
		Alphabetical
	}
	public sealed class TrackerWindow
	{
		private struct EntryAnimation
		{
			public float AddedAt;

			public float CompletedAt;

			public float StepAdvancedAt;
		}

		private const float DefaultWidth = 340f;

		private const float DefaultHeight = 260f;

		private const float FadeInDuration = 0.3f;

		private const float FadeOutDuration = 0.3f;

		private const float CompletionFlashDuration = 1.5f;

		private const float CompletionLingerDuration = 2f;

		private const float StepAdvanceDuration = 0.8f;

		private const float CompactTintRounding = 8f;

		private const float CompactPadTop = 10f;

		private const float CompactPadBottom = 6f;

		private const float CompactPadLeft = 8f;

		private const float CompactPadRight = 6f;

		private const int DrawFlagsRoundCornersAll = 240;

		private readonly GuideData _data;

		private readonly QuestStateTracker _state;

		private readonly NavigationController _nav;

		private readonly TrackerState _tracker;

		private readonly GuideWindow _guide;

		private readonly GuideConfig _config;

		private bool _visible = true;

		private readonly Dictionary<string, EntryAnimation> _animations = new Dictionary<string, EntryAnimation>(StringComparer.OrdinalIgnoreCase);

		private readonly Dictionary<string, float> _fadingOut = new Dictionary<string, float>(StringComparer.OrdinalIgnoreCase);

		private readonly Dictionary<string, float> _completionTimers = new Dictionary<string, float>(StringComparer.OrdinalIgnoreCase);

		private readonly List<string> _sorted = new List<string>();

		private readonly Dictionary<string, StepDistance> _distances = new Dictionary<string, StepDistance>(StringComparer.OrdinalIgnoreCase);

		private int _lastStateVersion = -1;

		private float _lastProximitySort;

		private TrackerSortMode _lastSortMode;

		private readonly Dictionary<string, int> _cachedStepIndex = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);

		private bool _compact = true;

		private Vector2 _contentMin;

		private Vector2 _contentMax;

		public bool Visible => _visible;

		public void Toggle()
		{
			_visible = !_visible;
		}

		public void Show()
		{
			_visible = true;
		}

		public void Hide()
		{
			_visible = false;
		}

		public TrackerWindow(GuideData data, QuestStateTracker state, NavigationController nav, TrackerState tracker, GuideWindow guide, GuideConfig config)
		{
			_data = data;
			_state = state;
			_nav = nav;
			_tracker = tracker;
			_guide = guide;
			_config = config;
			_tracker.Tracked += OnQuestTracked;
			_tracker.Untracked += OnQuestUntracked;
			_tracker.QuestCompleted += OnQuestCompleted;
			_tracker.StepAdvanced += OnQuestStepAdvanced;
		}

		public void Dispose()
		{
			_tracker.Tracked -= OnQuestTracked;
			_tracker.Untracked -= OnQuestUntracked;
			_tracker.QuestCompleted -= OnQuestCompleted;
			_tracker.StepAdvanced -= OnQuestStepAdvanced;
		}

		private void OnQuestTracked(string dbName)
		{
			_animations[dbName] = new EntryAnimation
			{
				AddedAt = Time.realtimeSinceStartup
			};
			_fadingOut.Remove(dbName);
			_visible = true;
		}

		private void OnQuestUntracked(string dbName)
		{
			_fadingOut[dbName] = Time.realtimeSinceStartup;
			_completionTimers.Remove(dbName);
		}

		private void OnQuestCompleted(string dbName)
		{
			EntryAnimation orDefaultAnim = GetOrDefaultAnim(dbName);
			orDefaultAnim.CompletedAt = Time.realtimeSinceStartup;
			_animations[dbName] = orDefaultAnim;
			_completionTimers[dbName] = Time.realtimeSinceStartup;
		}

		private void OnQuestStepAdvanced(string dbName)
		{
			EntryAnimation orDefaultAnim = GetOrDefaultAnim(dbName);
			orDefaultAnim.StepAdvancedAt = Time.realtimeSinceStartup;
			_animations[dbName] = orDefaultAnim;
		}

		public void Draw()
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			if (!_visible || !_tracker.Enabled || (_contentMax.Y > _contentMin.Y && GameWindowOverlap.ShouldSuppressTracker(_contentMin.X, _contentMin.Y, _contentMax.X, _contentMax.Y)))
			{
				return;
			}
			PruneAnimations();
			DetectStepAdvances();
			RebuildSortedListIfNeeded();
			if (_sorted.Count == 0 && _fadingOut.Count == 0)
			{
				return;
			}
			ImGuiCond val = (ImGuiCond)(_config.LayoutResetRequested ? 1 : 4);
			float resolvedUiScale = _config.ResolvedUiScale;
			ImGuiIOPtr iO = ImGui.GetIO();
			Vector2 displaySize = ((ImGuiIOPtr)(ref iO)).DisplaySize;
			ImGui.SetNextWindowSize(new Vector2(340f * resolvedUiScale, 260f * resolvedUiScale), val);
			ImGui.SetNextWindowPos(new Vector2(40f, displaySize.Y * 0.5f), val, new Vector2(0f, 0.5f));
			int num = 0;
			int num2 = 0;
			Theme.PushWindowStyle();
			if (_compact)
			{
				ImGui.PushStyleColor((ImGuiCol)2, 0u);
				ImGui.PushStyleColor((ImGuiCol)3, 0u);
				ImGui.PushStyleColor((ImGuiCol)5, 0u);
				ImGui.PushStyleColor((ImGuiCol)10, 0u);
				ImGui.PushStyleColor((ImGuiCol)11, 0u);
				ImGui.PushStyleColor((ImGuiCol)12, 0u);
				ImGui.PushStyleColor((ImGuiCol)21, 0u);
				ImGui.PushStyleColor((ImGuiCol)7, 0u);
				num = 8;
			}
			if (_compact && _contentMax.Y > _contentMin.Y)
			{
				uint col = Theme.Rgba(0f, 0f, 0f, _config.TrackerBackgroundOpacity.Value);
				IntPtr self = CimguiNative.igGetBackgroundDrawList_Nil();
				CimguiNative.ImDrawList_AddRectFilled(self, new CimguiNative.Vec2(_contentMin.X, _contentMin.Y), new CimguiNative.Vec2(_contentMax.X, _contentMax.Y), col, 8f, 240);
			}
			ImGuiWindowFlags val2 = (ImGuiWindowFlags)798752;
			if (_compact)
			{
				val2 = (ImGuiWindowFlags)(val2 | 0xA);
			}
			if ((!_compact) ? ImGui.Begin("Quest Tracker###Tracker", ref _visible, val2) : ImGui.Begin("###Tracker", val2))
			{
				if (_compact)
				{
					ImGui.PushStyleVar((ImGuiStyleVar)0, 0f);
				}
				DrawHeaderBar();
				if (_compact)
				{
					ImGui.PopStyleVar();
				}
				DrawQuestList();
				bool flag = ImGui.IsWindowHovered((ImGuiHoveredFlags)3);
				bool flag2 = ImGui.IsWindowFocused((ImGuiFocusedFlags)3) && ImGui.IsMouseDown((ImGuiMouseButton)0);
				_compact = !flag && !flag2;
				if (_compact && ImGui.IsWindowFocused((ImGuiFocusedFlags)3))
				{
					ImGui.SetWindowFocus((string)null);
				}
			}
			Theme.ClampWindowPosition();
			ImGui.End();
			if (num > 0)
			{
				ImGui.PopStyleColor(num);
			}
			if (num2 > 0)
			{
				ImGui.PopStyleVar(num2);
			}
			Theme.PopWindowStyle();
		}

		private void DrawHeaderBar()
		{
			DrawSortButton("Px", TrackerSortMode.Proximity, "Sort by proximity");
			ImGui.SameLine(0f, 2f);
			DrawSortButton("Lv", TrackerSortMode.Level, "Sort by level");
			ImGui.SameLine(0f, 2f);
			DrawSortButton("Az", TrackerSortMode.Alphabetical, "Sort alphabetically");
			ImGui.Separator();
		}

		private void DrawSortButton(string label, TrackerSortMode mode, string tooltip)
		{
			bool flag = _tracker.SortMode == mode;
			if (flag)
			{
				ImGui.PushStyleColor((ImGuiCol)21, Theme.Accent);
			}
			if (ImGui.SmallButton(label + "##tsort"))
			{
				_tracker.SortMode = mode;
				_lastSortMode = mode;
				RebuildSortedList();
			}
			if (flag)
			{
				ImGui.PopStyleColor();
			}
			if (ImGui.IsItemHovered())
			{
				ImGui.BeginTooltip();
				ImGui.TextUnformatted(tooltip);
				ImGui.EndTooltip();
			}
		}

		private void DrawQuestList()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			ImGui.BeginChild("##TrackerScroll", Vector2.Zero, false);
			Vector2 cursorScreenPos = ImGui.GetCursorScreenPos();
			for (int i = 0; i < _sorted.Count; i++)
			{
				string dbName = _sorted[i];
				QuestEntry byDBName = _data.GetByDBName(dbName);
				if (byDBName != null)
				{
					DrawQuestEntry(byDBName, dbName, i);
				}
			}
			Vector2 cursorScreenPos2 = ImGui.GetCursorScreenPos();
			Vector2 windowPos = ImGui.GetWindowPos();
			float windowWidth = ImGui.GetWindowWidth();
			float windowHeight = ImGui.GetWindowHeight();
			ImGuiStylePtr style = ImGui.GetStyle();
			float y = ((ImGuiStylePtr)(ref style)).ItemSpacing.Y;
			float num = windowPos.Y + windowHeight;
			float y2 = ((cursorScreenPos2.Y <= num) ? (cursorScreenPos2.Y - y + 6f) : (num + 6f));
			_contentMin = new Vector2(windowPos.X - 8f, windowPos.Y - 10f);
			_contentMax = new Vector2(windowPos.X + windowWidth + 6f, y2);
			ImGui.EndChild();
		}

		private void DrawQuestEntry(QuestEntry quest, string dbName, int index)
		{
			EntryAnimation orDefaultAnim = GetOrDefaultAnim(dbName);
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			float value;
			bool flag = _fadingOut.TryGetValue(dbName, out value);
			if (!flag && !_tracker.IsTracked(dbName))
			{
				return;
			}
			float num = 1f;
			if (flag)
			{
				float num2 = realtimeSinceStartup - value;
				num = Mathf.Clamp01(1f - num2 / 0.3f);
				if (num <= 0f)
				{
					return;
				}
			}
			else if (orDefaultAnim.AddedAt > 0f)
			{
				float num3 = realtimeSinceStartup - orDefaultAnim.AddedAt;
				if (num3 < 0.3f)
				{
					num = num3 / 0.3f;
				}
			}
			ImGui.PushID(index);
			if (num < 1f)
			{
				ImGui.PushStyleVar((ImGuiStyleVar)0, num);
			}
			bool flag2 = false;
			if (orDefaultAnim.CompletedAt > 0f && realtimeSinceStartup - orDefaultAnim.CompletedAt < 1.5f)
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.Success);
				flag2 = true;
			}
			else if (orDefaultAnim.StepAdvancedAt > 0f && realtimeSinceStartup - orDefaultAnim.StepAdvancedAt < 0.8f)
			{
				ImGui.PushStyleColor((ImGuiCol)0, Theme.QuestActive);
				flag2 = true;
			}
			if (_config.ShowArrow.Value || _config.ShowGroundPath.Value)
			{
				DrawNavButton(quest);
				ImGui.SameLine();
			}
			DrawQuestNameAndLevel(quest);
			DrawCurrentStep(quest);
			if (ImGui.BeginPopupContextItem("##ctx" + quest.DBName))
			{
				if (ImGui.Selectable("Untrack"))
				{
					_tracker.Untrack(quest.DBName);
				}
				if (ImGui.Selectable("Open in Guide"))
				{
					_state.SelectQuest(quest.DBName);
					_guide.Show();
				}
				ImGui.EndPopup();
			}
			DrawPrerequisites(quest);
			ImGui.Spacing();
			if (flag2)
			{
				ImGui.PopStyleColor();
			}
			if (num < 1f)
			{
				ImGui.PopStyleVar();
			}
			ImGui.PopID();
		}

		private void DrawNavButton(QuestEntry quest)
		{
			(QuestStep? rawStep, QuestStep? displayStep, QuestEntry displayQuest) currentStep = GetCurrentStep(quest);
			QuestStep item = currentStep.rawStep;
			QuestStep item2 = currentStep.displayStep;
			QuestEntry item3 = currentStep.displayQuest;
			bool flag = item2?.TargetKey != null;
			bool flag2 = item != null && _nav.IsNavigating(quest.DBName, item.Order);
			if (!flag)
			{
				ImGui.PushStyleVar((ImGuiStyleVar)0, 0.3f);
				ImGui.SmallButton("[NAV]");
				ImGui.PopStyleVar();
				if (ImGui.IsItemHovered((ImGuiHoveredFlags)512))
				{
					ImGui.BeginTooltip();
					ImGui.TextUnformatted("No navigable target");
					ImGui.EndTooltip();
				}
				return;
			}
			if (flag2)
			{
				ImGui.PushStyleColor((ImGuiCol)21, Theme.QuestActive);
			}
			if (ImGui.SmallButton("[NAV]"))
			{
				if (flag2)
				{
					_nav.Clear();
				}
				else
				{
					_nav.NavigateTo(item, quest, _state.CurrentZone);
				}
			}
			if (flag2)
			{
				ImGui.PopStyleColor();
			}
			if (ImGui.IsItemHovered())
			{
				ImGui.BeginTooltip();
				ImGui.TextUnformatted(flag2 ? "Stop navigating" : "Navigate to current step");
				ImGui.EndTooltip();
			}
		}

		private void DrawQuestNameAndLevel(QuestEntry quest)
		{
			int? num = quest.LevelEstimate?.Recommended;
			string text;
			if (num.HasValue)
			{
				int valueOrDefault = num.GetValueOrDefault();
				text = $"{valueOrDefault,2}  {quest.DisplayName}";
			}
			else
			{
				text = "    " + quest.DisplayName;
			}
			string text2 = text;
			if (_distances.TryGetValue(quest.DBName, out var value))
			{
				if (value.HasDistance)
				{
					text2 += $" ({value.Meters:0}m)";
				}
				else if (value.HasLabel)
				{
					text2 = text2 + " (" + value.Label + ")";
				}
			}
			ImGui.PushStyleColor((ImGuiCol)0, Theme.GetQuestColor(_state, quest.DBName));
			if (ImGui.Selectable(text2 + "##name" + quest.DBName))
			{
				_state.SelectQuest(quest.DBName);
				_guide.Show();
			}
			ImGui.PopStyleColor();
		}

		private void DrawCurrentStep(QuestEntry quest)
		{
			(QuestStep? rawStep, QuestStep? displayStep, QuestEntry displayQuest) currentStep = GetCurrentStep(quest);
			QuestStep item = currentStep.displayStep;
			QuestEntry item2 = currentStep.displayQuest;
			ImGui.Indent(16f);
			ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
			if (item == null)
			{
				ImGui.TextWrapped(quest.HasSteps ? "Completed" : "No guide data available.");
				ImGui.PopStyleColor();
				ImGui.Unindent(16f);
				return;
			}
			string text = FormatStepText(item2, item);
			if (_distances.TryGetValue(quest.DBName, out var value) && !value.InCurrentZone && item.Action != "travel")
			{
				string stepZoneName = TrackerSorter.GetStepZoneName(quest, _state, _data);
				if (stepZoneName != null)
				{
					text = "Travel to " + stepZoneName + ".";
				}
			}
			ImGui.TextWrapped(text);
			ImGui.PopStyleColor();
			ImGui.Unindent(16f);
		}

		private string FormatStepText(QuestEntry quest, QuestStep step)
		{
			if (step.Quantity.HasValue && step.TargetKey != null)
			{
				int num = _state.CountItem(step.TargetKey);
				int value = step.Quantity.Value;
				return $"{step.Description} ({num}/{value})";
			}
			return step.Description;
		}

		private void DrawPrerequisites(QuestEntry quest)
		{
			if (quest.Prerequisites == null || quest.Prerequisites.Count == 0)
			{
				return;
			}
			foreach (Prerequisite prerequisite in quest.Prerequisites)
			{
				if (prerequisite.Item != null || _state.IsCompleted(prerequisite.QuestKey))
				{
					continue;
				}
				ImGui.Indent(16f);
				ImGui.PushStyleColor((ImGuiCol)0, Theme.TextSecondary);
				ImGui.PushStyleVar((ImGuiStyleVar)0, 0.6f);
				if (ImGui.Selectable("Requires: " + prerequisite.QuestName + "##prereq" + prerequisite.QuestKey))
				{
					_state.SelectQuest(prerequisite.QuestKey);
					_guide.Show();
				}
				ImGui.PopStyleVar();
				ImGui.PopStyleColor();
				ImGui.Unindent(16f);
				break;
			}
		}

		private void PruneAnimations()
		{
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			List<string> list = new List<string>();
			string key;
			float value;
			foreach (KeyValuePair<string, float> completionTimer in _completionTimers)
			{
				completionTimer.Deconstruct(out key, out value);
				string item = key;
				float num = value;
				if (realtimeSinceStartup - num > 2f)
				{
					list.Add(item);
				}
			}
			foreach (string item3 in list)
			{
				_completionTimers.Remove(item3);
				_tracker.Untrack(item3);
			}
			List<string> list2 = new List<string>();
			foreach (KeyValuePair<string, float> item4 in _fadingOut)
			{
				item4.Deconstruct(out key, out value);
				string item2 = key;
				float num2 = value;
				if (realtimeSinceStartup - num2 > 0.3f)
				{
					list2.Add(item2);
				}
			}
			foreach (string item5 in list2)
			{
				_fadingOut.Remove(item5);
				_animations.Remove(item5);
				_cachedStepIndex.Remove(item5);
			}
		}

		private void RebuildSortedListIfNeeded()
		{
			bool isDirty = _tracker.IsDirty;
			bool flag = _state.Version != _lastStateVersion;
			bool flag2 = _tracker.SortMode != _lastSortMode;
			bool flag3 = Time.realtimeSinceStartup - _lastProximitySort > 2f;
			if (isDirty || flag || flag2 || flag3)
			{
				if (flag)
				{
					_lastStateVersion = _state.Version;
				}
				RebuildSortedList();
			}
		}

		private void RebuildSortedList()
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			_sorted.Clear();
			_sorted.AddRange(_tracker.TrackedQuests);
			foreach (string key in _fadingOut.Keys)
			{
				if (!_sorted.Contains(key))
				{
					_sorted.Add(key);
				}
			}
			_lastSortMode = _tracker.SortMode;
			_lastProximitySort = Time.realtimeSinceStartup;
			if ((Object)(object)GameData.PlayerControl != (Object)null)
			{
				Vector3 position = ((Component)GameData.PlayerControl).transform.position;
				TrackerSorter.ComputeDistances(_sorted, _data, _state, _nav, position, _distances);
			}
			else
			{
				_distances.Clear();
			}
			TrackerSorter.Sort(_sorted, _tracker.SortMode, _data, (_distances.Count > 0) ? _distances : null);
		}

		private void DetectStepAdvances()
		{
			foreach (string trackedQuest in _tracker.TrackedQuests)
			{
				QuestEntry byDBName = _data.GetByDBName(trackedQuest);
				if (byDBName?.Steps != null)
				{
					int currentStepIndex = StepProgress.GetCurrentStepIndex(byDBName, _state, _data);
					if (_cachedStepIndex.TryGetValue(trackedQuest, out var value) && currentStepIndex > value)
					{
						_tracker.OnStepAdvanced(trackedQuest);
					}
					_cachedStepIndex[trackedQuest] = currentStepIndex;
				}
			}
		}

		private (QuestStep? rawStep, QuestStep? displayStep, QuestEntry displayQuest) GetCurrentStep(QuestEntry quest)
		{
			if (quest.Steps == null || quest.Steps.Count == 0)
			{
				return (null, null, quest);
			}
			int currentStepIndex = StepProgress.GetCurrentStepIndex(quest, _state, _data);
			QuestStep questStep = ((currentStepIndex < quest.Steps.Count) ? quest.Steps[currentStepIndex] : null);
			if (questStep == null)
			{
				return (null, null, quest);
			}
			var (item, questEntry) = StepProgress.ResolveActiveStep(questStep, quest, _state, _data);
			return (questStep, item, questEntry ?? quest);
		}

		private EntryAnimation GetOrDefaultAnim(string dbName)
		{
			EntryAnimation value;
			return _animations.TryGetValue(dbName, out value) ? value : default(EntryAnimation);
		}
	}
}
namespace AdventureGuide.State
{
	internal static class GameUIVisibility
	{
		private static Canvas? _hudCanvas;

		private static bool _searched;

		public static bool IsVisible
		{
			get
			{
				if ((Object)(object)_hudCanvas == (Object)null)
				{
					if (_searched)
					{
						return true;
					}
					_searched = true;
					TypeText val = Object.FindObjectOfType<TypeText>();
					if ((Object)(object)val != (Object)null)
					{
						_hudCanvas = ((Component)val).GetComponent<Canvas>();
					}
				}
				return (Object)(object)_hudCanvas == (Object)null || ((Behaviour)_hudCanvas).enabled;
			}
		}
	}
	internal static class GameWindowOverlap
	{
		private struct WindowRect
		{
			public float Left;

			public float Top;

			public float Right;

			public float Bottom;

			public bool Overlaps(float otherLeft, float otherTop, float otherRight, float otherBottom)
			{
				return Left < otherRight && Right > otherLeft && Top < otherBottom && Bottom > otherTop;
			}
		}

		private static List<GameObject>? _uiWindows;

		private static bool _searched;

		private static WindowRect[]? _rects;

		private static bool[]? _wasActive;

		private static readonly HashSet<int> _suppressors = new HashSet<int>();

		public static bool ShouldSuppressTracker(float trackerLeft, float trackerTop, float trackerRight, float trackerBottom)
		{
			List<GameObject> uIWindows = GetUIWindows();
			if (uIWindows == null || uIWindows.Count == 0)
			{
				return false;
			}
			EnsureCaches(uIWindows.Count);
			for (int i = 0; i < uIWindows.Count; i++)
			{
				GameObject val = uIWindows[i];
				bool flag = (Object)(object)val != (Object)null && val.activeSelf;
				if (flag && !_wasActive[i])
				{
					EnsureRect(i, val);
					if (_rects[i].Overlaps(trackerLeft, trackerTop, trackerRight, trackerBottom))
					{
						_suppressors.Add(i);
					}
				}
				else if (!flag && _wasActive[i])
				{
					_suppressors.Remove(i);
				}
				_wasActive[i] = flag;
			}
			return _suppressors.Count > 0;
		}

		public static void InvalidateRects()
		{
			_rects = null;
		}

		public static void Reset()
		{
			_uiWindows = null;
			_searched = false;
			_rects = null;
			_wasActive = null;
			_suppressors.Clear();
		}

		private static List<GameObject>? GetUIWindows()
		{
			if (_uiWindows != null)
			{
				return _uiWindows;
			}
			if (_searched)
			{
				return null;
			}
			_searched = true;
			CameraController val = Object.FindObjectOfType<CameraController>();
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			HashSet<GameObject> hashSet = new HashSet<GameObject>();
			List<GameObject> list = new List<GameObject>();
			foreach (GameObject uIWindow in val.UIWindows)
			{
				if ((Object)(object)uIWindow != (Object)null && hashSet.Add(uIWindow))
				{
					list.Add(uIWindow);
				}
			}
			if ((Object)(object)GameData.Misc != (Object)null)
			{
				foreach (GameObject uIWindow2 in GameData.Misc.UIWindows)
				{
					if ((Object)(object)uIWindow2 != (Object)null && hashSet.Add(uIWindow2))
					{
						list.Add(uIWindow2);
					}
				}
			}
			_uiWindows = list;
			return _uiWindows;
		}

		private static void EnsureCaches(int count)
		{
			if (_wasActive == null || _wasActive.Length != count)
			{
				_wasActive = new bool[count];
				for (int i = 0; i < count; i++)
				{
					GameObject val = _uiWindows[i];
					_wasActive[i] = (Object)(object)val != (Object)null && val.activeSelf;
				}
				_suppressors.Clear();
			}
			if (_rects == null || _rects.Length != count)
			{
				_rects = new WindowRect[count];
			}
		}

		private static void EnsureRect(int i, GameObject go)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			if (_rects[i].Right > 0f)
			{
				return;
			}
			RectTransform component = go.GetComponent<RectTransform>();
			if ((Object)(object)component == (Object)null)
			{
				_rects[i] = default(WindowRect);
				return;
			}
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			component.GetWorldCorners(array);
			floa

plugins/AdventureGuide/Newtonsoft.Json.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Data.SqlTypes;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Dynamic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Numerics;
using System.Reflection;
using System.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
			{

plugins/AdventureGuide/ImGui.NET.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Numerics;
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;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: InternalsVisibleTo("ImPlot.NET")]
[assembly: InternalsVisibleTo("ImNodes.NET")]
[assembly: AssemblyCompany("Eric Mellino")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A .NET wrapper for the Dear ImGui library.")]
[assembly: AssemblyFileVersion("1.89.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ImGui.NET")]
[assembly: AssemblyTitle("ImGui.NET")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.89.1.0")]
[module: UnverifiableCode]
namespace ImGuiNET;

public struct ImColor
{
	public Vector4 Value;
}
public struct ImColorPtr
{
	public unsafe ImColor* NativePtr { get; }

	public unsafe ref Vector4 Value => ref Unsafe.AsRef<Vector4>(&NativePtr->Value);

	public unsafe ImColorPtr(ImColor* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImColorPtr(IntPtr nativePtr)
	{
		NativePtr = (ImColor*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImColorPtr(ImColor* nativePtr)
	{
		return new ImColorPtr(nativePtr);
	}

	public unsafe static implicit operator ImColor*(ImColorPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImColorPtr(IntPtr nativePtr)
	{
		return new ImColorPtr(nativePtr);
	}

	public unsafe void Destroy()
	{
		ImGuiNative.ImColor_destroy(NativePtr);
	}

	public unsafe ImColor HSV(float h, float s, float v)
	{
		float a = 1f;
		ImColor result = default(ImColor);
		ImGuiNative.ImColor_HSV(&result, h, s, v, a);
		return result;
	}

	public unsafe ImColor HSV(float h, float s, float v, float a)
	{
		ImColor result = default(ImColor);
		ImGuiNative.ImColor_HSV(&result, h, s, v, a);
		return result;
	}

	public unsafe void SetHSV(float h, float s, float v)
	{
		float a = 1f;
		ImGuiNative.ImColor_SetHSV(NativePtr, h, s, v, a);
	}

	public unsafe void SetHSV(float h, float s, float v, float a)
	{
		ImGuiNative.ImColor_SetHSV(NativePtr, h, s, v, a);
	}
}
public struct ImDrawChannel
{
	public ImVector _CmdBuffer;

	public ImVector _IdxBuffer;
}
public struct ImDrawChannelPtr
{
	public unsafe ImDrawChannel* NativePtr { get; }

	public unsafe ImPtrVector<ImDrawCmdPtr> _CmdBuffer => new ImPtrVector<ImDrawCmdPtr>(NativePtr->_CmdBuffer, Unsafe.SizeOf<ImDrawCmd>());

	public unsafe ImVector<ushort> _IdxBuffer => new ImVector<ushort>(NativePtr->_IdxBuffer);

	public unsafe ImDrawChannelPtr(ImDrawChannel* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImDrawChannelPtr(IntPtr nativePtr)
	{
		NativePtr = (ImDrawChannel*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImDrawChannelPtr(ImDrawChannel* nativePtr)
	{
		return new ImDrawChannelPtr(nativePtr);
	}

	public unsafe static implicit operator ImDrawChannel*(ImDrawChannelPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImDrawChannelPtr(IntPtr nativePtr)
	{
		return new ImDrawChannelPtr(nativePtr);
	}
}
public struct ImDrawCmd
{
	public Vector4 ClipRect;

	public IntPtr TextureId;

	public uint VtxOffset;

	public uint IdxOffset;

	public uint ElemCount;

	public IntPtr UserCallback;

	public unsafe void* UserCallbackData;
}
public struct ImDrawCmdPtr
{
	public unsafe ImDrawCmd* NativePtr { get; }

	public unsafe ref Vector4 ClipRect => ref Unsafe.AsRef<Vector4>(&NativePtr->ClipRect);

	public unsafe ref IntPtr TextureId => ref Unsafe.AsRef<IntPtr>(&NativePtr->TextureId);

	public unsafe ref uint VtxOffset => ref Unsafe.AsRef<uint>(&NativePtr->VtxOffset);

	public unsafe ref uint IdxOffset => ref Unsafe.AsRef<uint>(&NativePtr->IdxOffset);

	public unsafe ref uint ElemCount => ref Unsafe.AsRef<uint>(&NativePtr->ElemCount);

	public unsafe ref IntPtr UserCallback => ref Unsafe.AsRef<IntPtr>(&NativePtr->UserCallback);

	public unsafe IntPtr UserCallbackData
	{
		get
		{
			return (IntPtr)NativePtr->UserCallbackData;
		}
		set
		{
			NativePtr->UserCallbackData = (void*)value;
		}
	}

	public unsafe ImDrawCmdPtr(ImDrawCmd* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImDrawCmdPtr(IntPtr nativePtr)
	{
		NativePtr = (ImDrawCmd*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImDrawCmdPtr(ImDrawCmd* nativePtr)
	{
		return new ImDrawCmdPtr(nativePtr);
	}

	public unsafe static implicit operator ImDrawCmd*(ImDrawCmdPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImDrawCmdPtr(IntPtr nativePtr)
	{
		return new ImDrawCmdPtr(nativePtr);
	}

	public unsafe void Destroy()
	{
		ImGuiNative.ImDrawCmd_destroy(NativePtr);
	}

	public unsafe IntPtr GetTexID()
	{
		return ImGuiNative.ImDrawCmd_GetTexID(NativePtr);
	}
}
public struct ImDrawCmdHeader
{
	public Vector4 ClipRect;

	public IntPtr TextureId;

	public uint VtxOffset;
}
public struct ImDrawCmdHeaderPtr
{
	public unsafe ImDrawCmdHeader* NativePtr { get; }

	public unsafe ref Vector4 ClipRect => ref Unsafe.AsRef<Vector4>(&NativePtr->ClipRect);

	public unsafe ref IntPtr TextureId => ref Unsafe.AsRef<IntPtr>(&NativePtr->TextureId);

	public unsafe ref uint VtxOffset => ref Unsafe.AsRef<uint>(&NativePtr->VtxOffset);

	public unsafe ImDrawCmdHeaderPtr(ImDrawCmdHeader* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImDrawCmdHeaderPtr(IntPtr nativePtr)
	{
		NativePtr = (ImDrawCmdHeader*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImDrawCmdHeaderPtr(ImDrawCmdHeader* nativePtr)
	{
		return new ImDrawCmdHeaderPtr(nativePtr);
	}

	public unsafe static implicit operator ImDrawCmdHeader*(ImDrawCmdHeaderPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImDrawCmdHeaderPtr(IntPtr nativePtr)
	{
		return new ImDrawCmdHeaderPtr(nativePtr);
	}
}
public struct ImDrawData
{
	public byte Valid;

	public int CmdListsCount;

	public int TotalIdxCount;

	public int TotalVtxCount;

	public unsafe ImDrawList** CmdLists;

	public Vector2 DisplayPos;

	public Vector2 DisplaySize;

	public Vector2 FramebufferScale;

	public unsafe ImGuiViewport* OwnerViewport;
}
public struct ImDrawDataPtr
{
	public unsafe ImDrawData* NativePtr { get; }

	public unsafe ref bool Valid => ref Unsafe.AsRef<bool>(&NativePtr->Valid);

	public unsafe ref int CmdListsCount => ref Unsafe.AsRef<int>(&NativePtr->CmdListsCount);

	public unsafe ref int TotalIdxCount => ref Unsafe.AsRef<int>(&NativePtr->TotalIdxCount);

	public unsafe ref int TotalVtxCount => ref Unsafe.AsRef<int>(&NativePtr->TotalVtxCount);

	public unsafe IntPtr CmdLists
	{
		get
		{
			return (IntPtr)NativePtr->CmdLists;
		}
		set
		{
			NativePtr->CmdLists = (ImDrawList**)(void*)value;
		}
	}

	public unsafe ref Vector2 DisplayPos => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplayPos);

	public unsafe ref Vector2 DisplaySize => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplaySize);

	public unsafe ref Vector2 FramebufferScale => ref Unsafe.AsRef<Vector2>(&NativePtr->FramebufferScale);

	public unsafe ImGuiViewportPtr OwnerViewport => new ImGuiViewportPtr(NativePtr->OwnerViewport);

	public unsafe RangePtrAccessor<ImDrawListPtr> CmdListsRange => new RangePtrAccessor<ImDrawListPtr>(CmdLists.ToPointer(), CmdListsCount);

	public unsafe ImDrawDataPtr(ImDrawData* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImDrawDataPtr(IntPtr nativePtr)
	{
		NativePtr = (ImDrawData*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImDrawDataPtr(ImDrawData* nativePtr)
	{
		return new ImDrawDataPtr(nativePtr);
	}

	public unsafe static implicit operator ImDrawData*(ImDrawDataPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImDrawDataPtr(IntPtr nativePtr)
	{
		return new ImDrawDataPtr(nativePtr);
	}

	public unsafe void Clear()
	{
		ImGuiNative.ImDrawData_Clear(NativePtr);
	}

	public unsafe void DeIndexAllBuffers()
	{
		ImGuiNative.ImDrawData_DeIndexAllBuffers(NativePtr);
	}

	public unsafe void Destroy()
	{
		ImGuiNative.ImDrawData_destroy(NativePtr);
	}

	public unsafe void ScaleClipRects(Vector2 fb_scale)
	{
		ImGuiNative.ImDrawData_ScaleClipRects(NativePtr, fb_scale);
	}
}
[Flags]
public enum ImDrawFlags
{
	None = 0,
	Closed = 1,
	RoundCornersTopLeft = 0x10,
	RoundCornersTopRight = 0x20,
	RoundCornersBottomLeft = 0x40,
	RoundCornersBottomRight = 0x80,
	RoundCornersNone = 0x100,
	RoundCornersTop = 0x30,
	RoundCornersBottom = 0xC0,
	RoundCornersLeft = 0x50,
	RoundCornersRight = 0xA0,
	RoundCornersAll = 0xF0,
	RoundCornersDefault = 0xF0,
	RoundCornersMask = 0x1F0
}
public struct ImDrawList
{
	public ImVector CmdBuffer;

	public ImVector IdxBuffer;

	public ImVector VtxBuffer;

	public ImDrawListFlags Flags;

	public uint _VtxCurrentIdx;

	public IntPtr _Data;

	public unsafe byte* _OwnerName;

	public unsafe ImDrawVert* _VtxWritePtr;

	public unsafe ushort* _IdxWritePtr;

	public ImVector _ClipRectStack;

	public ImVector _TextureIdStack;

	public ImVector _Path;

	public ImDrawCmdHeader _CmdHeader;

	public ImDrawListSplitter _Splitter;

	public float _FringeScale;
}
public struct ImDrawListPtr
{
	public unsafe ImDrawList* NativePtr { get; }

	public unsafe ImPtrVector<ImDrawCmdPtr> CmdBuffer => new ImPtrVector<ImDrawCmdPtr>(NativePtr->CmdBuffer, Unsafe.SizeOf<ImDrawCmd>());

	public unsafe ImVector<ushort> IdxBuffer => new ImVector<ushort>(NativePtr->IdxBuffer);

	public unsafe ImPtrVector<ImDrawVertPtr> VtxBuffer => new ImPtrVector<ImDrawVertPtr>(NativePtr->VtxBuffer, Unsafe.SizeOf<ImDrawVert>());

	public unsafe ref ImDrawListFlags Flags => ref Unsafe.AsRef<ImDrawListFlags>(&NativePtr->Flags);

	public unsafe ref uint _VtxCurrentIdx => ref Unsafe.AsRef<uint>(&NativePtr->_VtxCurrentIdx);

	public unsafe ref IntPtr _Data => ref Unsafe.AsRef<IntPtr>(&NativePtr->_Data);

	public unsafe NullTerminatedString _OwnerName => new NullTerminatedString(NativePtr->_OwnerName);

	public unsafe ImDrawVertPtr _VtxWritePtr => new ImDrawVertPtr(NativePtr->_VtxWritePtr);

	public unsafe IntPtr _IdxWritePtr
	{
		get
		{
			return (IntPtr)NativePtr->_IdxWritePtr;
		}
		set
		{
			NativePtr->_IdxWritePtr = (ushort*)(void*)value;
		}
	}

	public unsafe ImVector<Vector4> _ClipRectStack => new ImVector<Vector4>(NativePtr->_ClipRectStack);

	public unsafe ImVector<IntPtr> _TextureIdStack => new ImVector<IntPtr>(NativePtr->_TextureIdStack);

	public unsafe ImVector<Vector2> _Path => new ImVector<Vector2>(NativePtr->_Path);

	public unsafe ref ImDrawCmdHeader _CmdHeader => ref Unsafe.AsRef<ImDrawCmdHeader>(&NativePtr->_CmdHeader);

	public unsafe ref ImDrawListSplitter _Splitter => ref Unsafe.AsRef<ImDrawListSplitter>(&NativePtr->_Splitter);

	public unsafe ref float _FringeScale => ref Unsafe.AsRef<float>(&NativePtr->_FringeScale);

	public unsafe ImDrawListPtr(ImDrawList* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImDrawListPtr(IntPtr nativePtr)
	{
		NativePtr = (ImDrawList*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImDrawListPtr(ImDrawList* nativePtr)
	{
		return new ImDrawListPtr(nativePtr);
	}

	public unsafe static implicit operator ImDrawList*(ImDrawListPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImDrawListPtr(IntPtr nativePtr)
	{
		return new ImDrawListPtr(nativePtr);
	}

	public unsafe int _CalcCircleAutoSegmentCount(float radius)
	{
		return ImGuiNative.ImDrawList__CalcCircleAutoSegmentCount(NativePtr, radius);
	}

	public unsafe void _ClearFreeMemory()
	{
		ImGuiNative.ImDrawList__ClearFreeMemory(NativePtr);
	}

	public unsafe void _OnChangedClipRect()
	{
		ImGuiNative.ImDrawList__OnChangedClipRect(NativePtr);
	}

	public unsafe void _OnChangedTextureID()
	{
		ImGuiNative.ImDrawList__OnChangedTextureID(NativePtr);
	}

	public unsafe void _OnChangedVtxOffset()
	{
		ImGuiNative.ImDrawList__OnChangedVtxOffset(NativePtr);
	}

	public unsafe void _PathArcToFastEx(Vector2 center, float radius, int a_min_sample, int a_max_sample, int a_step)
	{
		ImGuiNative.ImDrawList__PathArcToFastEx(NativePtr, center, radius, a_min_sample, a_max_sample, a_step);
	}

	public unsafe void _PathArcToN(Vector2 center, float radius, float a_min, float a_max, int num_segments)
	{
		ImGuiNative.ImDrawList__PathArcToN(NativePtr, center, radius, a_min, a_max, num_segments);
	}

	public unsafe void _PopUnusedDrawCmd()
	{
		ImGuiNative.ImDrawList__PopUnusedDrawCmd(NativePtr);
	}

	public unsafe void _ResetForNewFrame()
	{
		ImGuiNative.ImDrawList__ResetForNewFrame(NativePtr);
	}

	public unsafe void _TryMergeDrawCmds()
	{
		ImGuiNative.ImDrawList__TryMergeDrawCmds(NativePtr);
	}

	public unsafe void AddBezierCubic(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, uint col, float thickness)
	{
		int num_segments = 0;
		ImGuiNative.ImDrawList_AddBezierCubic(NativePtr, p1, p2, p3, p4, col, thickness, num_segments);
	}

	public unsafe void AddBezierCubic(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, uint col, float thickness, int num_segments)
	{
		ImGuiNative.ImDrawList_AddBezierCubic(NativePtr, p1, p2, p3, p4, col, thickness, num_segments);
	}

	public unsafe void AddBezierQuadratic(Vector2 p1, Vector2 p2, Vector2 p3, uint col, float thickness)
	{
		int num_segments = 0;
		ImGuiNative.ImDrawList_AddBezierQuadratic(NativePtr, p1, p2, p3, col, thickness, num_segments);
	}

	public unsafe void AddBezierQuadratic(Vector2 p1, Vector2 p2, Vector2 p3, uint col, float thickness, int num_segments)
	{
		ImGuiNative.ImDrawList_AddBezierQuadratic(NativePtr, p1, p2, p3, col, thickness, num_segments);
	}

	public unsafe void AddCallback(IntPtr callback, IntPtr callback_data)
	{
		void* callback_data2 = callback_data.ToPointer();
		ImGuiNative.ImDrawList_AddCallback(NativePtr, callback, callback_data2);
	}

	public unsafe void AddCircle(Vector2 center, float radius, uint col)
	{
		int num_segments = 0;
		float thickness = 1f;
		ImGuiNative.ImDrawList_AddCircle(NativePtr, center, radius, col, num_segments, thickness);
	}

	public unsafe void AddCircle(Vector2 center, float radius, uint col, int num_segments)
	{
		float thickness = 1f;
		ImGuiNative.ImDrawList_AddCircle(NativePtr, center, radius, col, num_segments, thickness);
	}

	public unsafe void AddCircle(Vector2 center, float radius, uint col, int num_segments, float thickness)
	{
		ImGuiNative.ImDrawList_AddCircle(NativePtr, center, radius, col, num_segments, thickness);
	}

	public unsafe void AddCircleFilled(Vector2 center, float radius, uint col)
	{
		int num_segments = 0;
		ImGuiNative.ImDrawList_AddCircleFilled(NativePtr, center, radius, col, num_segments);
	}

	public unsafe void AddCircleFilled(Vector2 center, float radius, uint col, int num_segments)
	{
		ImGuiNative.ImDrawList_AddCircleFilled(NativePtr, center, radius, col, num_segments);
	}

	public unsafe void AddConvexPolyFilled(ref Vector2 points, int num_points, uint col)
	{
		fixed (Vector2* points2 = &points)
		{
			ImGuiNative.ImDrawList_AddConvexPolyFilled(NativePtr, points2, num_points, col);
		}
	}

	public unsafe void AddDrawCmd()
	{
		ImGuiNative.ImDrawList_AddDrawCmd(NativePtr);
	}

	public unsafe void AddImage(IntPtr user_texture_id, Vector2 p_min, Vector2 p_max)
	{
		Vector2 uv_min = default(Vector2);
		Vector2 uv_max = new Vector2(1f, 1f);
		uint col = uint.MaxValue;
		ImGuiNative.ImDrawList_AddImage(NativePtr, user_texture_id, p_min, p_max, uv_min, uv_max, col);
	}

	public unsafe void AddImage(IntPtr user_texture_id, Vector2 p_min, Vector2 p_max, Vector2 uv_min)
	{
		Vector2 uv_max = new Vector2(1f, 1f);
		uint col = uint.MaxValue;
		ImGuiNative.ImDrawList_AddImage(NativePtr, user_texture_id, p_min, p_max, uv_min, uv_max, col);
	}

	public unsafe void AddImage(IntPtr user_texture_id, Vector2 p_min, Vector2 p_max, Vector2 uv_min, Vector2 uv_max)
	{
		uint col = uint.MaxValue;
		ImGuiNative.ImDrawList_AddImage(NativePtr, user_texture_id, p_min, p_max, uv_min, uv_max, col);
	}

	public unsafe void AddImage(IntPtr user_texture_id, Vector2 p_min, Vector2 p_max, Vector2 uv_min, Vector2 uv_max, uint col)
	{
		ImGuiNative.ImDrawList_AddImage(NativePtr, user_texture_id, p_min, p_max, uv_min, uv_max, col);
	}

	public unsafe void AddImageQuad(IntPtr user_texture_id, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4)
	{
		Vector2 uv = default(Vector2);
		Vector2 uv2 = new Vector2(1f, 0f);
		Vector2 uv3 = new Vector2(1f, 1f);
		Vector2 uv4 = new Vector2(0f, 1f);
		uint col = uint.MaxValue;
		ImGuiNative.ImDrawList_AddImageQuad(NativePtr, user_texture_id, p1, p2, p3, p4, uv, uv2, uv3, uv4, col);
	}

	public unsafe void AddImageQuad(IntPtr user_texture_id, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 uv1)
	{
		Vector2 uv2 = new Vector2(1f, 0f);
		Vector2 uv3 = new Vector2(1f, 1f);
		Vector2 uv4 = new Vector2(0f, 1f);
		uint col = uint.MaxValue;
		ImGuiNative.ImDrawList_AddImageQuad(NativePtr, user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
	}

	public unsafe void AddImageQuad(IntPtr user_texture_id, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 uv1, Vector2 uv2)
	{
		Vector2 uv3 = new Vector2(1f, 1f);
		Vector2 uv4 = new Vector2(0f, 1f);
		uint col = uint.MaxValue;
		ImGuiNative.ImDrawList_AddImageQuad(NativePtr, user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
	}

	public unsafe void AddImageQuad(IntPtr user_texture_id, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 uv1, Vector2 uv2, Vector2 uv3)
	{
		Vector2 uv4 = new Vector2(0f, 1f);
		uint col = uint.MaxValue;
		ImGuiNative.ImDrawList_AddImageQuad(NativePtr, user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
	}

	public unsafe void AddImageQuad(IntPtr user_texture_id, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 uv1, Vector2 uv2, Vector2 uv3, Vector2 uv4)
	{
		uint col = uint.MaxValue;
		ImGuiNative.ImDrawList_AddImageQuad(NativePtr, user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
	}

	public unsafe void AddImageQuad(IntPtr user_texture_id, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 uv1, Vector2 uv2, Vector2 uv3, Vector2 uv4, uint col)
	{
		ImGuiNative.ImDrawList_AddImageQuad(NativePtr, user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
	}

	public unsafe void AddImageRounded(IntPtr user_texture_id, Vector2 p_min, Vector2 p_max, Vector2 uv_min, Vector2 uv_max, uint col, float rounding)
	{
		ImDrawFlags flags = ImDrawFlags.None;
		ImGuiNative.ImDrawList_AddImageRounded(NativePtr, user_texture_id, p_min, p_max, uv_min, uv_max, col, rounding, flags);
	}

	public unsafe void AddImageRounded(IntPtr user_texture_id, Vector2 p_min, Vector2 p_max, Vector2 uv_min, Vector2 uv_max, uint col, float rounding, ImDrawFlags flags)
	{
		ImGuiNative.ImDrawList_AddImageRounded(NativePtr, user_texture_id, p_min, p_max, uv_min, uv_max, col, rounding, flags);
	}

	public unsafe void AddLine(Vector2 p1, Vector2 p2, uint col)
	{
		float thickness = 1f;
		ImGuiNative.ImDrawList_AddLine(NativePtr, p1, p2, col, thickness);
	}

	public unsafe void AddLine(Vector2 p1, Vector2 p2, uint col, float thickness)
	{
		ImGuiNative.ImDrawList_AddLine(NativePtr, p1, p2, col, thickness);
	}

	public unsafe void AddNgon(Vector2 center, float radius, uint col, int num_segments)
	{
		float thickness = 1f;
		ImGuiNative.ImDrawList_AddNgon(NativePtr, center, radius, col, num_segments, thickness);
	}

	public unsafe void AddNgon(Vector2 center, float radius, uint col, int num_segments, float thickness)
	{
		ImGuiNative.ImDrawList_AddNgon(NativePtr, center, radius, col, num_segments, thickness);
	}

	public unsafe void AddNgonFilled(Vector2 center, float radius, uint col, int num_segments)
	{
		ImGuiNative.ImDrawList_AddNgonFilled(NativePtr, center, radius, col, num_segments);
	}

	public unsafe void AddPolyline(ref Vector2 points, int num_points, uint col, ImDrawFlags flags, float thickness)
	{
		fixed (Vector2* points2 = &points)
		{
			ImGuiNative.ImDrawList_AddPolyline(NativePtr, points2, num_points, col, flags, thickness);
		}
	}

	public unsafe void AddQuad(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, uint col)
	{
		float thickness = 1f;
		ImGuiNative.ImDrawList_AddQuad(NativePtr, p1, p2, p3, p4, col, thickness);
	}

	public unsafe void AddQuad(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, uint col, float thickness)
	{
		ImGuiNative.ImDrawList_AddQuad(NativePtr, p1, p2, p3, p4, col, thickness);
	}

	public unsafe void AddQuadFilled(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, uint col)
	{
		ImGuiNative.ImDrawList_AddQuadFilled(NativePtr, p1, p2, p3, p4, col);
	}

	public unsafe void AddRect(Vector2 p_min, Vector2 p_max, uint col)
	{
		float rounding = 0f;
		ImDrawFlags flags = ImDrawFlags.None;
		float thickness = 1f;
		ImGuiNative.ImDrawList_AddRect(NativePtr, p_min, p_max, col, rounding, flags, thickness);
	}

	public unsafe void AddRect(Vector2 p_min, Vector2 p_max, uint col, float rounding)
	{
		ImDrawFlags flags = ImDrawFlags.None;
		float thickness = 1f;
		ImGuiNative.ImDrawList_AddRect(NativePtr, p_min, p_max, col, rounding, flags, thickness);
	}

	public unsafe void AddRect(Vector2 p_min, Vector2 p_max, uint col, float rounding, ImDrawFlags flags)
	{
		float thickness = 1f;
		ImGuiNative.ImDrawList_AddRect(NativePtr, p_min, p_max, col, rounding, flags, thickness);
	}

	public unsafe void AddRect(Vector2 p_min, Vector2 p_max, uint col, float rounding, ImDrawFlags flags, float thickness)
	{
		ImGuiNative.ImDrawList_AddRect(NativePtr, p_min, p_max, col, rounding, flags, thickness);
	}

	public unsafe void AddRectFilled(Vector2 p_min, Vector2 p_max, uint col)
	{
		float rounding = 0f;
		ImDrawFlags flags = ImDrawFlags.None;
		ImGuiNative.ImDrawList_AddRectFilled(NativePtr, p_min, p_max, col, rounding, flags);
	}

	public unsafe void AddRectFilled(Vector2 p_min, Vector2 p_max, uint col, float rounding)
	{
		ImDrawFlags flags = ImDrawFlags.None;
		ImGuiNative.ImDrawList_AddRectFilled(NativePtr, p_min, p_max, col, rounding, flags);
	}

	public unsafe void AddRectFilled(Vector2 p_min, Vector2 p_max, uint col, float rounding, ImDrawFlags flags)
	{
		ImGuiNative.ImDrawList_AddRectFilled(NativePtr, p_min, p_max, col, rounding, flags);
	}

	public unsafe void AddRectFilledMultiColor(Vector2 p_min, Vector2 p_max, uint col_upr_left, uint col_upr_right, uint col_bot_right, uint col_bot_left)
	{
		ImGuiNative.ImDrawList_AddRectFilledMultiColor(NativePtr, p_min, p_max, col_upr_left, col_upr_right, col_bot_right, col_bot_left);
	}

	public unsafe void AddTriangle(Vector2 p1, Vector2 p2, Vector2 p3, uint col)
	{
		float thickness = 1f;
		ImGuiNative.ImDrawList_AddTriangle(NativePtr, p1, p2, p3, col, thickness);
	}

	public unsafe void AddTriangle(Vector2 p1, Vector2 p2, Vector2 p3, uint col, float thickness)
	{
		ImGuiNative.ImDrawList_AddTriangle(NativePtr, p1, p2, p3, col, thickness);
	}

	public unsafe void AddTriangleFilled(Vector2 p1, Vector2 p2, Vector2 p3, uint col)
	{
		ImGuiNative.ImDrawList_AddTriangleFilled(NativePtr, p1, p2, p3, col);
	}

	public unsafe void ChannelsMerge()
	{
		ImGuiNative.ImDrawList_ChannelsMerge(NativePtr);
	}

	public unsafe void ChannelsSetCurrent(int n)
	{
		ImGuiNative.ImDrawList_ChannelsSetCurrent(NativePtr, n);
	}

	public unsafe void ChannelsSplit(int count)
	{
		ImGuiNative.ImDrawList_ChannelsSplit(NativePtr, count);
	}

	public unsafe ImDrawListPtr CloneOutput()
	{
		return new ImDrawListPtr(ImGuiNative.ImDrawList_CloneOutput(NativePtr));
	}

	public unsafe void Destroy()
	{
		ImGuiNative.ImDrawList_destroy(NativePtr);
	}

	public unsafe Vector2 GetClipRectMax()
	{
		Vector2 result = default(Vector2);
		ImGuiNative.ImDrawList_GetClipRectMax(&result, NativePtr);
		return result;
	}

	public unsafe Vector2 GetClipRectMin()
	{
		Vector2 result = default(Vector2);
		ImGuiNative.ImDrawList_GetClipRectMin(&result, NativePtr);
		return result;
	}

	public unsafe void PathArcTo(Vector2 center, float radius, float a_min, float a_max)
	{
		int num_segments = 0;
		ImGuiNative.ImDrawList_PathArcTo(NativePtr, center, radius, a_min, a_max, num_segments);
	}

	public unsafe void PathArcTo(Vector2 center, float radius, float a_min, float a_max, int num_segments)
	{
		ImGuiNative.ImDrawList_PathArcTo(NativePtr, center, radius, a_min, a_max, num_segments);
	}

	public unsafe void PathArcToFast(Vector2 center, float radius, int a_min_of_12, int a_max_of_12)
	{
		ImGuiNative.ImDrawList_PathArcToFast(NativePtr, center, radius, a_min_of_12, a_max_of_12);
	}

	public unsafe void PathBezierCubicCurveTo(Vector2 p2, Vector2 p3, Vector2 p4)
	{
		int num_segments = 0;
		ImGuiNative.ImDrawList_PathBezierCubicCurveTo(NativePtr, p2, p3, p4, num_segments);
	}

	public unsafe void PathBezierCubicCurveTo(Vector2 p2, Vector2 p3, Vector2 p4, int num_segments)
	{
		ImGuiNative.ImDrawList_PathBezierCubicCurveTo(NativePtr, p2, p3, p4, num_segments);
	}

	public unsafe void PathBezierQuadraticCurveTo(Vector2 p2, Vector2 p3)
	{
		int num_segments = 0;
		ImGuiNative.ImDrawList_PathBezierQuadraticCurveTo(NativePtr, p2, p3, num_segments);
	}

	public unsafe void PathBezierQuadraticCurveTo(Vector2 p2, Vector2 p3, int num_segments)
	{
		ImGuiNative.ImDrawList_PathBezierQuadraticCurveTo(NativePtr, p2, p3, num_segments);
	}

	public unsafe void PathClear()
	{
		ImGuiNative.ImDrawList_PathClear(NativePtr);
	}

	public unsafe void PathFillConvex(uint col)
	{
		ImGuiNative.ImDrawList_PathFillConvex(NativePtr, col);
	}

	public unsafe void PathLineTo(Vector2 pos)
	{
		ImGuiNative.ImDrawList_PathLineTo(NativePtr, pos);
	}

	public unsafe void PathLineToMergeDuplicate(Vector2 pos)
	{
		ImGuiNative.ImDrawList_PathLineToMergeDuplicate(NativePtr, pos);
	}

	public unsafe void PathRect(Vector2 rect_min, Vector2 rect_max)
	{
		float rounding = 0f;
		ImDrawFlags flags = ImDrawFlags.None;
		ImGuiNative.ImDrawList_PathRect(NativePtr, rect_min, rect_max, rounding, flags);
	}

	public unsafe void PathRect(Vector2 rect_min, Vector2 rect_max, float rounding)
	{
		ImDrawFlags flags = ImDrawFlags.None;
		ImGuiNative.ImDrawList_PathRect(NativePtr, rect_min, rect_max, rounding, flags);
	}

	public unsafe void PathRect(Vector2 rect_min, Vector2 rect_max, float rounding, ImDrawFlags flags)
	{
		ImGuiNative.ImDrawList_PathRect(NativePtr, rect_min, rect_max, rounding, flags);
	}

	public unsafe void PathStroke(uint col)
	{
		ImDrawFlags flags = ImDrawFlags.None;
		float thickness = 1f;
		ImGuiNative.ImDrawList_PathStroke(NativePtr, col, flags, thickness);
	}

	public unsafe void PathStroke(uint col, ImDrawFlags flags)
	{
		float thickness = 1f;
		ImGuiNative.ImDrawList_PathStroke(NativePtr, col, flags, thickness);
	}

	public unsafe void PathStroke(uint col, ImDrawFlags flags, float thickness)
	{
		ImGuiNative.ImDrawList_PathStroke(NativePtr, col, flags, thickness);
	}

	public unsafe void PopClipRect()
	{
		ImGuiNative.ImDrawList_PopClipRect(NativePtr);
	}

	public unsafe void PopTextureID()
	{
		ImGuiNative.ImDrawList_PopTextureID(NativePtr);
	}

	public unsafe void PrimQuadUV(Vector2 a, Vector2 b, Vector2 c, Vector2 d, Vector2 uv_a, Vector2 uv_b, Vector2 uv_c, Vector2 uv_d, uint col)
	{
		ImGuiNative.ImDrawList_PrimQuadUV(NativePtr, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col);
	}

	public unsafe void PrimRect(Vector2 a, Vector2 b, uint col)
	{
		ImGuiNative.ImDrawList_PrimRect(NativePtr, a, b, col);
	}

	public unsafe void PrimRectUV(Vector2 a, Vector2 b, Vector2 uv_a, Vector2 uv_b, uint col)
	{
		ImGuiNative.ImDrawList_PrimRectUV(NativePtr, a, b, uv_a, uv_b, col);
	}

	public unsafe void PrimReserve(int idx_count, int vtx_count)
	{
		ImGuiNative.ImDrawList_PrimReserve(NativePtr, idx_count, vtx_count);
	}

	public unsafe void PrimUnreserve(int idx_count, int vtx_count)
	{
		ImGuiNative.ImDrawList_PrimUnreserve(NativePtr, idx_count, vtx_count);
	}

	public unsafe void PrimVtx(Vector2 pos, Vector2 uv, uint col)
	{
		ImGuiNative.ImDrawList_PrimVtx(NativePtr, pos, uv, col);
	}

	public unsafe void PrimWriteIdx(ushort idx)
	{
		ImGuiNative.ImDrawList_PrimWriteIdx(NativePtr, idx);
	}

	public unsafe void PrimWriteVtx(Vector2 pos, Vector2 uv, uint col)
	{
		ImGuiNative.ImDrawList_PrimWriteVtx(NativePtr, pos, uv, col);
	}

	public unsafe void PushClipRect(Vector2 clip_rect_min, Vector2 clip_rect_max)
	{
		byte intersect_with_current_clip_rect = 0;
		ImGuiNative.ImDrawList_PushClipRect(NativePtr, clip_rect_min, clip_rect_max, intersect_with_current_clip_rect);
	}

	public unsafe void PushClipRect(Vector2 clip_rect_min, Vector2 clip_rect_max, bool intersect_with_current_clip_rect)
	{
		byte intersect_with_current_clip_rect2 = (byte)(intersect_with_current_clip_rect ? 1 : 0);
		ImGuiNative.ImDrawList_PushClipRect(NativePtr, clip_rect_min, clip_rect_max, intersect_with_current_clip_rect2);
	}

	public unsafe void PushClipRectFullScreen()
	{
		ImGuiNative.ImDrawList_PushClipRectFullScreen(NativePtr);
	}

	public unsafe void PushTextureID(IntPtr texture_id)
	{
		ImGuiNative.ImDrawList_PushTextureID(NativePtr, texture_id);
	}

	public unsafe void AddText(Vector2 pos, uint col, string text_begin)
	{
		int byteCount = Encoding.UTF8.GetByteCount(text_begin);
		byte* ptr = stackalloc byte[(int)(uint)(byteCount + 1)];
		fixed (char* chars = text_begin)
		{
			int bytes = Encoding.UTF8.GetBytes(chars, text_begin.Length, ptr, byteCount);
			ptr[bytes] = 0;
		}
		byte* text_end = null;
		ImGuiNative.ImDrawList_AddText_Vec2(NativePtr, pos, col, ptr, text_end);
	}

	public unsafe void AddText(ImFontPtr font, float font_size, Vector2 pos, uint col, string text_begin)
	{
		ImFont* nativePtr = font.NativePtr;
		int byteCount = Encoding.UTF8.GetByteCount(text_begin);
		byte* ptr = stackalloc byte[(int)(uint)(byteCount + 1)];
		fixed (char* chars = text_begin)
		{
			int bytes = Encoding.UTF8.GetBytes(chars, text_begin.Length, ptr, byteCount);
			ptr[bytes] = 0;
		}
		byte* text_end = null;
		float wrap_width = 0f;
		Vector4* cpu_fine_clip_rect = null;
		ImGuiNative.ImDrawList_AddText_FontPtr(NativePtr, nativePtr, font_size, pos, col, ptr, text_end, wrap_width, cpu_fine_clip_rect);
	}
}
[Flags]
public enum ImDrawListFlags
{
	None = 0,
	AntiAliasedLines = 1,
	AntiAliasedLinesUseTex = 2,
	AntiAliasedFill = 4,
	AllowVtxOffset = 8
}
public struct ImDrawListSplitter
{
	public int _Current;

	public int _Count;

	public ImVector _Channels;
}
public struct ImDrawListSplitterPtr
{
	public unsafe ImDrawListSplitter* NativePtr { get; }

	public unsafe ref int _Current => ref Unsafe.AsRef<int>(&NativePtr->_Current);

	public unsafe ref int _Count => ref Unsafe.AsRef<int>(&NativePtr->_Count);

	public unsafe ImPtrVector<ImDrawChannelPtr> _Channels => new ImPtrVector<ImDrawChannelPtr>(NativePtr->_Channels, Unsafe.SizeOf<ImDrawChannel>());

	public unsafe ImDrawListSplitterPtr(ImDrawListSplitter* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImDrawListSplitterPtr(IntPtr nativePtr)
	{
		NativePtr = (ImDrawListSplitter*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImDrawListSplitterPtr(ImDrawListSplitter* nativePtr)
	{
		return new ImDrawListSplitterPtr(nativePtr);
	}

	public unsafe static implicit operator ImDrawListSplitter*(ImDrawListSplitterPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImDrawListSplitterPtr(IntPtr nativePtr)
	{
		return new ImDrawListSplitterPtr(nativePtr);
	}

	public unsafe void Clear()
	{
		ImGuiNative.ImDrawListSplitter_Clear(NativePtr);
	}

	public unsafe void ClearFreeMemory()
	{
		ImGuiNative.ImDrawListSplitter_ClearFreeMemory(NativePtr);
	}

	public unsafe void Destroy()
	{
		ImGuiNative.ImDrawListSplitter_destroy(NativePtr);
	}

	public unsafe void Merge(ImDrawListPtr draw_list)
	{
		ImDrawList* nativePtr = draw_list.NativePtr;
		ImGuiNative.ImDrawListSplitter_Merge(NativePtr, nativePtr);
	}

	public unsafe void SetCurrentChannel(ImDrawListPtr draw_list, int channel_idx)
	{
		ImDrawList* nativePtr = draw_list.NativePtr;
		ImGuiNative.ImDrawListSplitter_SetCurrentChannel(NativePtr, nativePtr, channel_idx);
	}

	public unsafe void Split(ImDrawListPtr draw_list, int count)
	{
		ImDrawList* nativePtr = draw_list.NativePtr;
		ImGuiNative.ImDrawListSplitter_Split(NativePtr, nativePtr, count);
	}
}
public struct ImDrawVert
{
	public Vector2 pos;

	public Vector2 uv;

	public uint col;
}
public struct ImDrawVertPtr
{
	public unsafe ImDrawVert* NativePtr { get; }

	public unsafe ref Vector2 pos => ref Unsafe.AsRef<Vector2>(&NativePtr->pos);

	public unsafe ref Vector2 uv => ref Unsafe.AsRef<Vector2>(&NativePtr->uv);

	public unsafe ref uint col => ref Unsafe.AsRef<uint>(&NativePtr->col);

	public unsafe ImDrawVertPtr(ImDrawVert* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImDrawVertPtr(IntPtr nativePtr)
	{
		NativePtr = (ImDrawVert*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImDrawVertPtr(ImDrawVert* nativePtr)
	{
		return new ImDrawVertPtr(nativePtr);
	}

	public unsafe static implicit operator ImDrawVert*(ImDrawVertPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImDrawVertPtr(IntPtr nativePtr)
	{
		return new ImDrawVertPtr(nativePtr);
	}
}
public struct ImFont
{
	public ImVector IndexAdvanceX;

	public float FallbackAdvanceX;

	public float FontSize;

	public ImVector IndexLookup;

	public ImVector Glyphs;

	public unsafe ImFontGlyph* FallbackGlyph;

	public unsafe ImFontAtlas* ContainerAtlas;

	public unsafe ImFontConfig* ConfigData;

	public short ConfigDataCount;

	public ushort FallbackChar;

	public ushort EllipsisChar;

	public ushort DotChar;

	public byte DirtyLookupTables;

	public float Scale;

	public float Ascent;

	public float Descent;

	public int MetricsTotalSurface;

	public unsafe fixed byte Used4kPagesMap[2];
}
public struct ImFontPtr
{
	public unsafe ImFont* NativePtr { get; }

	public unsafe ImVector<float> IndexAdvanceX => new ImVector<float>(NativePtr->IndexAdvanceX);

	public unsafe ref float FallbackAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->FallbackAdvanceX);

	public unsafe ref float FontSize => ref Unsafe.AsRef<float>(&NativePtr->FontSize);

	public unsafe ImVector<ushort> IndexLookup => new ImVector<ushort>(NativePtr->IndexLookup);

	public unsafe ImPtrVector<ImFontGlyphPtr> Glyphs => new ImPtrVector<ImFontGlyphPtr>(NativePtr->Glyphs, Unsafe.SizeOf<ImFontGlyph>());

	public unsafe ImFontGlyphPtr FallbackGlyph => new ImFontGlyphPtr(NativePtr->FallbackGlyph);

	public unsafe ImFontAtlasPtr ContainerAtlas => new ImFontAtlasPtr(NativePtr->ContainerAtlas);

	public unsafe ImFontConfigPtr ConfigData => new ImFontConfigPtr(NativePtr->ConfigData);

	public unsafe ref short ConfigDataCount => ref Unsafe.AsRef<short>(&NativePtr->ConfigDataCount);

	public unsafe ref ushort FallbackChar => ref Unsafe.AsRef<ushort>(&NativePtr->FallbackChar);

	public unsafe ref ushort EllipsisChar => ref Unsafe.AsRef<ushort>(&NativePtr->EllipsisChar);

	public unsafe ref ushort DotChar => ref Unsafe.AsRef<ushort>(&NativePtr->DotChar);

	public unsafe ref bool DirtyLookupTables => ref Unsafe.AsRef<bool>(&NativePtr->DirtyLookupTables);

	public unsafe ref float Scale => ref Unsafe.AsRef<float>(&NativePtr->Scale);

	public unsafe ref float Ascent => ref Unsafe.AsRef<float>(&NativePtr->Ascent);

	public unsafe ref float Descent => ref Unsafe.AsRef<float>(&NativePtr->Descent);

	public unsafe ref int MetricsTotalSurface => ref Unsafe.AsRef<int>(&NativePtr->MetricsTotalSurface);

	public unsafe RangeAccessor<byte> Used4kPagesMap => new RangeAccessor<byte>(NativePtr->Used4kPagesMap, 2);

	public unsafe ImFontPtr(ImFont* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImFontPtr(IntPtr nativePtr)
	{
		NativePtr = (ImFont*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImFontPtr(ImFont* nativePtr)
	{
		return new ImFontPtr(nativePtr);
	}

	public unsafe static implicit operator ImFont*(ImFontPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImFontPtr(IntPtr nativePtr)
	{
		return new ImFontPtr(nativePtr);
	}

	public unsafe void AddGlyph(ImFontConfigPtr src_cfg, ushort c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x)
	{
		ImFontConfig* nativePtr = src_cfg.NativePtr;
		ImGuiNative.ImFont_AddGlyph(NativePtr, nativePtr, c, x0, y0, x1, y1, u0, v0, u1, v1, advance_x);
	}

	public unsafe void AddRemapChar(ushort dst, ushort src)
	{
		byte overwrite_dst = 1;
		ImGuiNative.ImFont_AddRemapChar(NativePtr, dst, src, overwrite_dst);
	}

	public unsafe void AddRemapChar(ushort dst, ushort src, bool overwrite_dst)
	{
		byte overwrite_dst2 = (byte)(overwrite_dst ? 1 : 0);
		ImGuiNative.ImFont_AddRemapChar(NativePtr, dst, src, overwrite_dst2);
	}

	public unsafe void BuildLookupTable()
	{
		ImGuiNative.ImFont_BuildLookupTable(NativePtr);
	}

	public unsafe void ClearOutputData()
	{
		ImGuiNative.ImFont_ClearOutputData(NativePtr);
	}

	public unsafe void Destroy()
	{
		ImGuiNative.ImFont_destroy(NativePtr);
	}

	public unsafe ImFontGlyphPtr FindGlyph(ushort c)
	{
		return new ImFontGlyphPtr(ImGuiNative.ImFont_FindGlyph(NativePtr, c));
	}

	public unsafe ImFontGlyphPtr FindGlyphNoFallback(ushort c)
	{
		return new ImFontGlyphPtr(ImGuiNative.ImFont_FindGlyphNoFallback(NativePtr, c));
	}

	public unsafe float GetCharAdvance(ushort c)
	{
		return ImGuiNative.ImFont_GetCharAdvance(NativePtr, c);
	}

	public unsafe string GetDebugName()
	{
		return Util.StringFromPtr(ImGuiNative.ImFont_GetDebugName(NativePtr));
	}

	public unsafe void GrowIndex(int new_size)
	{
		ImGuiNative.ImFont_GrowIndex(NativePtr, new_size);
	}

	public unsafe bool IsLoaded()
	{
		return ImGuiNative.ImFont_IsLoaded(NativePtr) != 0;
	}

	public unsafe void RenderChar(ImDrawListPtr draw_list, float size, Vector2 pos, uint col, ushort c)
	{
		ImDrawList* nativePtr = draw_list.NativePtr;
		ImGuiNative.ImFont_RenderChar(NativePtr, nativePtr, size, pos, col, c);
	}

	public unsafe void SetGlyphVisible(ushort c, bool visible)
	{
		byte visible2 = (byte)(visible ? 1 : 0);
		ImGuiNative.ImFont_SetGlyphVisible(NativePtr, c, visible2);
	}
}
public struct ImFontAtlas
{
	public ImFontAtlasFlags Flags;

	public IntPtr TexID;

	public int TexDesiredWidth;

	public int TexGlyphPadding;

	public byte Locked;

	public byte TexReady;

	public byte TexPixelsUseColors;

	public unsafe byte* TexPixelsAlpha8;

	public unsafe uint* TexPixelsRGBA32;

	public int TexWidth;

	public int TexHeight;

	public Vector2 TexUvScale;

	public Vector2 TexUvWhitePixel;

	public ImVector Fonts;

	public ImVector CustomRects;

	public ImVector ConfigData;

	public Vector4 TexUvLines_0;

	public Vector4 TexUvLines_1;

	public Vector4 TexUvLines_2;

	public Vector4 TexUvLines_3;

	public Vector4 TexUvLines_4;

	public Vector4 TexUvLines_5;

	public Vector4 TexUvLines_6;

	public Vector4 TexUvLines_7;

	public Vector4 TexUvLines_8;

	public Vector4 TexUvLines_9;

	public Vector4 TexUvLines_10;

	public Vector4 TexUvLines_11;

	public Vector4 TexUvLines_12;

	public Vector4 TexUvLines_13;

	public Vector4 TexUvLines_14;

	public Vector4 TexUvLines_15;

	public Vector4 TexUvLines_16;

	public Vector4 TexUvLines_17;

	public Vector4 TexUvLines_18;

	public Vector4 TexUvLines_19;

	public Vector4 TexUvLines_20;

	public Vector4 TexUvLines_21;

	public Vector4 TexUvLines_22;

	public Vector4 TexUvLines_23;

	public Vector4 TexUvLines_24;

	public Vector4 TexUvLines_25;

	public Vector4 TexUvLines_26;

	public Vector4 TexUvLines_27;

	public Vector4 TexUvLines_28;

	public Vector4 TexUvLines_29;

	public Vector4 TexUvLines_30;

	public Vector4 TexUvLines_31;

	public Vector4 TexUvLines_32;

	public Vector4 TexUvLines_33;

	public Vector4 TexUvLines_34;

	public Vector4 TexUvLines_35;

	public Vector4 TexUvLines_36;

	public Vector4 TexUvLines_37;

	public Vector4 TexUvLines_38;

	public Vector4 TexUvLines_39;

	public Vector4 TexUvLines_40;

	public Vector4 TexUvLines_41;

	public Vector4 TexUvLines_42;

	public Vector4 TexUvLines_43;

	public Vector4 TexUvLines_44;

	public Vector4 TexUvLines_45;

	public Vector4 TexUvLines_46;

	public Vector4 TexUvLines_47;

	public Vector4 TexUvLines_48;

	public Vector4 TexUvLines_49;

	public Vector4 TexUvLines_50;

	public Vector4 TexUvLines_51;

	public Vector4 TexUvLines_52;

	public Vector4 TexUvLines_53;

	public Vector4 TexUvLines_54;

	public Vector4 TexUvLines_55;

	public Vector4 TexUvLines_56;

	public Vector4 TexUvLines_57;

	public Vector4 TexUvLines_58;

	public Vector4 TexUvLines_59;

	public Vector4 TexUvLines_60;

	public Vector4 TexUvLines_61;

	public Vector4 TexUvLines_62;

	public Vector4 TexUvLines_63;

	public unsafe IntPtr* FontBuilderIO;

	public uint FontBuilderFlags;

	public int PackIdMouseCursors;

	public int PackIdLines;
}
public struct ImFontAtlasPtr
{
	public unsafe ImFontAtlas* NativePtr { get; }

	public unsafe ref ImFontAtlasFlags Flags => ref Unsafe.AsRef<ImFontAtlasFlags>(&NativePtr->Flags);

	public unsafe ref IntPtr TexID => ref Unsafe.AsRef<IntPtr>(&NativePtr->TexID);

	public unsafe ref int TexDesiredWidth => ref Unsafe.AsRef<int>(&NativePtr->TexDesiredWidth);

	public unsafe ref int TexGlyphPadding => ref Unsafe.AsRef<int>(&NativePtr->TexGlyphPadding);

	public unsafe ref bool Locked => ref Unsafe.AsRef<bool>(&NativePtr->Locked);

	public unsafe ref bool TexReady => ref Unsafe.AsRef<bool>(&NativePtr->TexReady);

	public unsafe ref bool TexPixelsUseColors => ref Unsafe.AsRef<bool>(&NativePtr->TexPixelsUseColors);

	public unsafe IntPtr TexPixelsAlpha8
	{
		get
		{
			return (IntPtr)NativePtr->TexPixelsAlpha8;
		}
		set
		{
			NativePtr->TexPixelsAlpha8 = (byte*)(void*)value;
		}
	}

	public unsafe IntPtr TexPixelsRGBA32
	{
		get
		{
			return (IntPtr)NativePtr->TexPixelsRGBA32;
		}
		set
		{
			NativePtr->TexPixelsRGBA32 = (uint*)(void*)value;
		}
	}

	public unsafe ref int TexWidth => ref Unsafe.AsRef<int>(&NativePtr->TexWidth);

	public unsafe ref int TexHeight => ref Unsafe.AsRef<int>(&NativePtr->TexHeight);

	public unsafe ref Vector2 TexUvScale => ref Unsafe.AsRef<Vector2>(&NativePtr->TexUvScale);

	public unsafe ref Vector2 TexUvWhitePixel => ref Unsafe.AsRef<Vector2>(&NativePtr->TexUvWhitePixel);

	public unsafe ImVector<ImFontPtr> Fonts => new ImVector<ImFontPtr>(NativePtr->Fonts);

	public unsafe ImPtrVector<ImFontAtlasCustomRectPtr> CustomRects => new ImPtrVector<ImFontAtlasCustomRectPtr>(NativePtr->CustomRects, Unsafe.SizeOf<ImFontAtlasCustomRect>());

	public unsafe ImPtrVector<ImFontConfigPtr> ConfigData => new ImPtrVector<ImFontConfigPtr>(NativePtr->ConfigData, Unsafe.SizeOf<ImFontConfig>());

	public unsafe RangeAccessor<Vector4> TexUvLines => new RangeAccessor<Vector4>(&NativePtr->TexUvLines_0, 64);

	public unsafe IntPtr FontBuilderIO
	{
		get
		{
			return (IntPtr)NativePtr->FontBuilderIO;
		}
		set
		{
			NativePtr->FontBuilderIO = (IntPtr*)(void*)value;
		}
	}

	public unsafe ref uint FontBuilderFlags => ref Unsafe.AsRef<uint>(&NativePtr->FontBuilderFlags);

	public unsafe ref int PackIdMouseCursors => ref Unsafe.AsRef<int>(&NativePtr->PackIdMouseCursors);

	public unsafe ref int PackIdLines => ref Unsafe.AsRef<int>(&NativePtr->PackIdLines);

	public unsafe ImFontAtlasPtr(ImFontAtlas* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImFontAtlasPtr(IntPtr nativePtr)
	{
		NativePtr = (ImFontAtlas*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImFontAtlasPtr(ImFontAtlas* nativePtr)
	{
		return new ImFontAtlasPtr(nativePtr);
	}

	public unsafe static implicit operator ImFontAtlas*(ImFontAtlasPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImFontAtlasPtr(IntPtr nativePtr)
	{
		return new ImFontAtlasPtr(nativePtr);
	}

	public unsafe int AddCustomRectFontGlyph(ImFontPtr font, ushort id, int width, int height, float advance_x)
	{
		ImFont* nativePtr = font.NativePtr;
		return ImGuiNative.ImFontAtlas_AddCustomRectFontGlyph(NativePtr, nativePtr, id, width, height, advance_x, default(Vector2));
	}

	public unsafe int AddCustomRectFontGlyph(ImFontPtr font, ushort id, int width, int height, float advance_x, Vector2 offset)
	{
		ImFont* nativePtr = font.NativePtr;
		return ImGuiNative.ImFontAtlas_AddCustomRectFontGlyph(NativePtr, nativePtr, id, width, height, advance_x, offset);
	}

	public unsafe int AddCustomRectRegular(int width, int height)
	{
		return ImGuiNative.ImFontAtlas_AddCustomRectRegular(NativePtr, width, height);
	}

	public unsafe ImFontPtr AddFont(ImFontConfigPtr font_cfg)
	{
		ImFontConfig* nativePtr = font_cfg.NativePtr;
		return new ImFontPtr(ImGuiNative.ImFontAtlas_AddFont(NativePtr, nativePtr));
	}

	public unsafe ImFontPtr AddFontDefault()
	{
		ImFontConfig* font_cfg = null;
		return new ImFontPtr(ImGuiNative.ImFontAtlas_AddFontDefault(NativePtr, font_cfg));
	}

	public unsafe ImFontPtr AddFontDefault(ImFontConfigPtr font_cfg)
	{
		ImFontConfig* nativePtr = font_cfg.NativePtr;
		return new ImFontPtr(ImGuiNative.ImFontAtlas_AddFontDefault(NativePtr, nativePtr));
	}

	public unsafe ImFontPtr AddFontFromFileTTF(string filename, float size_pixels)
	{
		int num = 0;
		byte* ptr;
		if (filename != null)
		{
			num = Encoding.UTF8.GetByteCount(filename);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(filename, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImFontConfig* font_cfg = null;
		ushort* glyph_ranges = null;
		ImFont* nativePtr = ImGuiNative.ImFontAtlas_AddFontFromFileTTF(NativePtr, ptr, size_pixels, font_cfg, glyph_ranges);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return new ImFontPtr(nativePtr);
	}

	public unsafe ImFontPtr AddFontFromFileTTF(string filename, float size_pixels, ImFontConfigPtr font_cfg)
	{
		int num = 0;
		byte* ptr;
		if (filename != null)
		{
			num = Encoding.UTF8.GetByteCount(filename);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(filename, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImFontConfig* nativePtr = font_cfg.NativePtr;
		ushort* glyph_ranges = null;
		ImFont* nativePtr2 = ImGuiNative.ImFontAtlas_AddFontFromFileTTF(NativePtr, ptr, size_pixels, nativePtr, glyph_ranges);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return new ImFontPtr(nativePtr2);
	}

	public unsafe ImFontPtr AddFontFromFileTTF(string filename, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges)
	{
		int num = 0;
		byte* ptr;
		if (filename != null)
		{
			num = Encoding.UTF8.GetByteCount(filename);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(filename, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImFontConfig* nativePtr = font_cfg.NativePtr;
		ushort* glyph_ranges2 = (ushort*)glyph_ranges.ToPointer();
		ImFont* nativePtr2 = ImGuiNative.ImFontAtlas_AddFontFromFileTTF(NativePtr, ptr, size_pixels, nativePtr, glyph_ranges2);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return new ImFontPtr(nativePtr2);
	}

	public unsafe ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels)
	{
		int num = 0;
		byte* ptr;
		if (compressed_font_data_base85 != null)
		{
			num = Encoding.UTF8.GetByteCount(compressed_font_data_base85);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(compressed_font_data_base85, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImFontConfig* font_cfg = null;
		ushort* glyph_ranges = null;
		ImFont* nativePtr = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativePtr, ptr, size_pixels, font_cfg, glyph_ranges);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return new ImFontPtr(nativePtr);
	}

	public unsafe ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels, ImFontConfigPtr font_cfg)
	{
		int num = 0;
		byte* ptr;
		if (compressed_font_data_base85 != null)
		{
			num = Encoding.UTF8.GetByteCount(compressed_font_data_base85);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(compressed_font_data_base85, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImFontConfig* nativePtr = font_cfg.NativePtr;
		ushort* glyph_ranges = null;
		ImFont* nativePtr2 = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativePtr, ptr, size_pixels, nativePtr, glyph_ranges);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return new ImFontPtr(nativePtr2);
	}

	public unsafe ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges)
	{
		int num = 0;
		byte* ptr;
		if (compressed_font_data_base85 != null)
		{
			num = Encoding.UTF8.GetByteCount(compressed_font_data_base85);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(compressed_font_data_base85, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImFontConfig* nativePtr = font_cfg.NativePtr;
		ushort* glyph_ranges2 = (ushort*)glyph_ranges.ToPointer();
		ImFont* nativePtr2 = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativePtr, ptr, size_pixels, nativePtr, glyph_ranges2);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return new ImFontPtr(nativePtr2);
	}

	public unsafe ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels)
	{
		void* compressed_font_data2 = compressed_font_data.ToPointer();
		ImFontConfig* font_cfg = null;
		ushort* glyph_ranges = null;
		return new ImFontPtr(ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, compressed_font_data2, compressed_font_size, size_pixels, font_cfg, glyph_ranges));
	}

	public unsafe ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels, ImFontConfigPtr font_cfg)
	{
		void* compressed_font_data2 = compressed_font_data.ToPointer();
		ImFontConfig* nativePtr = font_cfg.NativePtr;
		ushort* glyph_ranges = null;
		return new ImFontPtr(ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, compressed_font_data2, compressed_font_size, size_pixels, nativePtr, glyph_ranges));
	}

	public unsafe ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges)
	{
		void* compressed_font_data2 = compressed_font_data.ToPointer();
		ImFontConfig* nativePtr = font_cfg.NativePtr;
		ushort* glyph_ranges2 = (ushort*)glyph_ranges.ToPointer();
		return new ImFontPtr(ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, compressed_font_data2, compressed_font_size, size_pixels, nativePtr, glyph_ranges2));
	}

	public unsafe ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_size, float size_pixels)
	{
		void* font_data2 = font_data.ToPointer();
		ImFontConfig* font_cfg = null;
		ushort* glyph_ranges = null;
		return new ImFontPtr(ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(NativePtr, font_data2, font_size, size_pixels, font_cfg, glyph_ranges));
	}

	public unsafe ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_size, float size_pixels, ImFontConfigPtr font_cfg)
	{
		void* font_data2 = font_data.ToPointer();
		ImFontConfig* nativePtr = font_cfg.NativePtr;
		ushort* glyph_ranges = null;
		return new ImFontPtr(ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(NativePtr, font_data2, font_size, size_pixels, nativePtr, glyph_ranges));
	}

	public unsafe ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_size, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges)
	{
		void* font_data2 = font_data.ToPointer();
		ImFontConfig* nativePtr = font_cfg.NativePtr;
		ushort* glyph_ranges2 = (ushort*)glyph_ranges.ToPointer();
		return new ImFontPtr(ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(NativePtr, font_data2, font_size, size_pixels, nativePtr, glyph_ranges2));
	}

	public unsafe bool Build()
	{
		return ImGuiNative.ImFontAtlas_Build(NativePtr) != 0;
	}

	public unsafe void CalcCustomRectUV(ImFontAtlasCustomRectPtr rect, out Vector2 out_uv_min, out Vector2 out_uv_max)
	{
		ImFontAtlasCustomRect* nativePtr = rect.NativePtr;
		fixed (Vector2* out_uv_min2 = &out_uv_min)
		{
			fixed (Vector2* out_uv_max2 = &out_uv_max)
			{
				ImGuiNative.ImFontAtlas_CalcCustomRectUV(NativePtr, nativePtr, out_uv_min2, out_uv_max2);
			}
		}
	}

	public unsafe void Clear()
	{
		ImGuiNative.ImFontAtlas_Clear(NativePtr);
	}

	public unsafe void ClearFonts()
	{
		ImGuiNative.ImFontAtlas_ClearFonts(NativePtr);
	}

	public unsafe void ClearInputData()
	{
		ImGuiNative.ImFontAtlas_ClearInputData(NativePtr);
	}

	public unsafe void ClearTexData()
	{
		ImGuiNative.ImFontAtlas_ClearTexData(NativePtr);
	}

	public unsafe void Destroy()
	{
		ImGuiNative.ImFontAtlas_destroy(NativePtr);
	}

	public unsafe ImFontAtlasCustomRectPtr GetCustomRectByIndex(int index)
	{
		return new ImFontAtlasCustomRectPtr(ImGuiNative.ImFontAtlas_GetCustomRectByIndex(NativePtr, index));
	}

	public unsafe IntPtr GetGlyphRangesChineseFull()
	{
		return (IntPtr)ImGuiNative.ImFontAtlas_GetGlyphRangesChineseFull(NativePtr);
	}

	public unsafe IntPtr GetGlyphRangesChineseSimplifiedCommon()
	{
		return (IntPtr)ImGuiNative.ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon(NativePtr);
	}

	public unsafe IntPtr GetGlyphRangesCyrillic()
	{
		return (IntPtr)ImGuiNative.ImFontAtlas_GetGlyphRangesCyrillic(NativePtr);
	}

	public unsafe IntPtr GetGlyphRangesDefault()
	{
		return (IntPtr)ImGuiNative.ImFontAtlas_GetGlyphRangesDefault(NativePtr);
	}

	public unsafe IntPtr GetGlyphRangesGreek()
	{
		return (IntPtr)ImGuiNative.ImFontAtlas_GetGlyphRangesGreek(NativePtr);
	}

	public unsafe IntPtr GetGlyphRangesJapanese()
	{
		return (IntPtr)ImGuiNative.ImFontAtlas_GetGlyphRangesJapanese(NativePtr);
	}

	public unsafe IntPtr GetGlyphRangesKorean()
	{
		return (IntPtr)ImGuiNative.ImFontAtlas_GetGlyphRangesKorean(NativePtr);
	}

	public unsafe IntPtr GetGlyphRangesThai()
	{
		return (IntPtr)ImGuiNative.ImFontAtlas_GetGlyphRangesThai(NativePtr);
	}

	public unsafe IntPtr GetGlyphRangesVietnamese()
	{
		return (IntPtr)ImGuiNative.ImFontAtlas_GetGlyphRangesVietnamese(NativePtr);
	}

	public unsafe bool GetMouseCursorTexData(ImGuiMouseCursor cursor, out Vector2 out_offset, out Vector2 out_size, out Vector2 out_uv_border, out Vector2 out_uv_fill)
	{
		fixed (Vector2* out_offset2 = &out_offset)
		{
			fixed (Vector2* out_size2 = &out_size)
			{
				fixed (Vector2* out_uv_border2 = &out_uv_border)
				{
					fixed (Vector2* out_uv_fill2 = &out_uv_fill)
					{
						return ImGuiNative.ImFontAtlas_GetMouseCursorTexData(NativePtr, cursor, out_offset2, out_size2, out_uv_border2, out_uv_fill2) != 0;
					}
				}
			}
		}
	}

	public unsafe void GetTexDataAsAlpha8(out byte* out_pixels, out int out_width, out int out_height)
	{
		int* out_bytes_per_pixel = null;
		fixed (byte** out_pixels2 = &out_pixels)
		{
			fixed (int* out_width2 = &out_width)
			{
				fixed (int* out_height2 = &out_height)
				{
					ImGuiNative.ImFontAtlas_GetTexDataAsAlpha8(NativePtr, out_pixels2, out_width2, out_height2, out_bytes_per_pixel);
				}
			}
		}
	}

	public unsafe void GetTexDataAsAlpha8(out byte* out_pixels, out int out_width, out int out_height, out int out_bytes_per_pixel)
	{
		fixed (byte** out_pixels2 = &out_pixels)
		{
			fixed (int* out_width2 = &out_width)
			{
				fixed (int* out_height2 = &out_height)
				{
					fixed (int* out_bytes_per_pixel2 = &out_bytes_per_pixel)
					{
						ImGuiNative.ImFontAtlas_GetTexDataAsAlpha8(NativePtr, out_pixels2, out_width2, out_height2, out_bytes_per_pixel2);
					}
				}
			}
		}
	}

	public unsafe void GetTexDataAsAlpha8(out IntPtr out_pixels, out int out_width, out int out_height)
	{
		int* out_bytes_per_pixel = null;
		fixed (IntPtr* out_pixels2 = &out_pixels)
		{
			fixed (int* out_width2 = &out_width)
			{
				fixed (int* out_height2 = &out_height)
				{
					ImGuiNative.ImFontAtlas_GetTexDataAsAlpha8(NativePtr, out_pixels2, out_width2, out_height2, out_bytes_per_pixel);
				}
			}
		}
	}

	public unsafe void GetTexDataAsAlpha8(out IntPtr out_pixels, out int out_width, out int out_height, out int out_bytes_per_pixel)
	{
		fixed (IntPtr* out_pixels2 = &out_pixels)
		{
			fixed (int* out_width2 = &out_width)
			{
				fixed (int* out_height2 = &out_height)
				{
					fixed (int* out_bytes_per_pixel2 = &out_bytes_per_pixel)
					{
						ImGuiNative.ImFontAtlas_GetTexDataAsAlpha8(NativePtr, out_pixels2, out_width2, out_height2, out_bytes_per_pixel2);
					}
				}
			}
		}
	}

	public unsafe void GetTexDataAsRGBA32(out byte* out_pixels, out int out_width, out int out_height)
	{
		int* out_bytes_per_pixel = null;
		fixed (byte** out_pixels2 = &out_pixels)
		{
			fixed (int* out_width2 = &out_width)
			{
				fixed (int* out_height2 = &out_height)
				{
					ImGuiNative.ImFontAtlas_GetTexDataAsRGBA32(NativePtr, out_pixels2, out_width2, out_height2, out_bytes_per_pixel);
				}
			}
		}
	}

	public unsafe void GetTexDataAsRGBA32(out byte* out_pixels, out int out_width, out int out_height, out int out_bytes_per_pixel)
	{
		fixed (byte** out_pixels2 = &out_pixels)
		{
			fixed (int* out_width2 = &out_width)
			{
				fixed (int* out_height2 = &out_height)
				{
					fixed (int* out_bytes_per_pixel2 = &out_bytes_per_pixel)
					{
						ImGuiNative.ImFontAtlas_GetTexDataAsRGBA32(NativePtr, out_pixels2, out_width2, out_height2, out_bytes_per_pixel2);
					}
				}
			}
		}
	}

	public unsafe void GetTexDataAsRGBA32(out IntPtr out_pixels, out int out_width, out int out_height)
	{
		int* out_bytes_per_pixel = null;
		fixed (IntPtr* out_pixels2 = &out_pixels)
		{
			fixed (int* out_width2 = &out_width)
			{
				fixed (int* out_height2 = &out_height)
				{
					ImGuiNative.ImFontAtlas_GetTexDataAsRGBA32(NativePtr, out_pixels2, out_width2, out_height2, out_bytes_per_pixel);
				}
			}
		}
	}

	public unsafe void GetTexDataAsRGBA32(out IntPtr out_pixels, out int out_width, out int out_height, out int out_bytes_per_pixel)
	{
		fixed (IntPtr* out_pixels2 = &out_pixels)
		{
			fixed (int* out_width2 = &out_width)
			{
				fixed (int* out_height2 = &out_height)
				{
					fixed (int* out_bytes_per_pixel2 = &out_bytes_per_pixel)
					{
						ImGuiNative.ImFontAtlas_GetTexDataAsRGBA32(NativePtr, out_pixels2, out_width2, out_height2, out_bytes_per_pixel2);
					}
				}
			}
		}
	}

	public unsafe bool IsBuilt()
	{
		return ImGuiNative.ImFontAtlas_IsBuilt(NativePtr) != 0;
	}

	public unsafe void SetTexID(IntPtr id)
	{
		ImGuiNative.ImFontAtlas_SetTexID(NativePtr, id);
	}
}
public struct ImFontAtlasCustomRect
{
	public ushort Width;

	public ushort Height;

	public ushort X;

	public ushort Y;

	public uint GlyphID;

	public float GlyphAdvanceX;

	public Vector2 GlyphOffset;

	public unsafe ImFont* Font;
}
public struct ImFontAtlasCustomRectPtr
{
	public unsafe ImFontAtlasCustomRect* NativePtr { get; }

	public unsafe ref ushort Width => ref Unsafe.AsRef<ushort>(&NativePtr->Width);

	public unsafe ref ushort Height => ref Unsafe.AsRef<ushort>(&NativePtr->Height);

	public unsafe ref ushort X => ref Unsafe.AsRef<ushort>(&NativePtr->X);

	public unsafe ref ushort Y => ref Unsafe.AsRef<ushort>(&NativePtr->Y);

	public unsafe ref uint GlyphID => ref Unsafe.AsRef<uint>(&NativePtr->GlyphID);

	public unsafe ref float GlyphAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->GlyphAdvanceX);

	public unsafe ref Vector2 GlyphOffset => ref Unsafe.AsRef<Vector2>(&NativePtr->GlyphOffset);

	public unsafe ImFontPtr Font => new ImFontPtr(NativePtr->Font);

	public unsafe ImFontAtlasCustomRectPtr(ImFontAtlasCustomRect* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImFontAtlasCustomRectPtr(IntPtr nativePtr)
	{
		NativePtr = (ImFontAtlasCustomRect*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImFontAtlasCustomRectPtr(ImFontAtlasCustomRect* nativePtr)
	{
		return new ImFontAtlasCustomRectPtr(nativePtr);
	}

	public unsafe static implicit operator ImFontAtlasCustomRect*(ImFontAtlasCustomRectPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImFontAtlasCustomRectPtr(IntPtr nativePtr)
	{
		return new ImFontAtlasCustomRectPtr(nativePtr);
	}

	public unsafe void Destroy()
	{
		ImGuiNative.ImFontAtlasCustomRect_destroy(NativePtr);
	}

	public unsafe bool IsPacked()
	{
		return ImGuiNative.ImFontAtlasCustomRect_IsPacked(NativePtr) != 0;
	}
}
[Flags]
public enum ImFontAtlasFlags
{
	None = 0,
	NoPowerOfTwoHeight = 1,
	NoMouseCursors = 2,
	NoBakedLines = 4
}
public struct ImFontConfig
{
	public unsafe void* FontData;

	public int FontDataSize;

	public byte FontDataOwnedByAtlas;

	public int FontNo;

	public float SizePixels;

	public int OversampleH;

	public int OversampleV;

	public byte PixelSnapH;

	public Vector2 GlyphExtraSpacing;

	public Vector2 GlyphOffset;

	public unsafe ushort* GlyphRanges;

	public float GlyphMinAdvanceX;

	public float GlyphMaxAdvanceX;

	public byte MergeMode;

	public uint FontBuilderFlags;

	public float RasterizerMultiply;

	public ushort EllipsisChar;

	public unsafe fixed byte Name[40];

	public unsafe ImFont* DstFont;
}
public struct ImFontConfigPtr
{
	public unsafe ImFontConfig* NativePtr { get; }

	public unsafe IntPtr FontData
	{
		get
		{
			return (IntPtr)NativePtr->FontData;
		}
		set
		{
			NativePtr->FontData = (void*)value;
		}
	}

	public unsafe ref int FontDataSize => ref Unsafe.AsRef<int>(&NativePtr->FontDataSize);

	public unsafe ref bool FontDataOwnedByAtlas => ref Unsafe.AsRef<bool>(&NativePtr->FontDataOwnedByAtlas);

	public unsafe ref int FontNo => ref Unsafe.AsRef<int>(&NativePtr->FontNo);

	public unsafe ref float SizePixels => ref Unsafe.AsRef<float>(&NativePtr->SizePixels);

	public unsafe ref int OversampleH => ref Unsafe.AsRef<int>(&NativePtr->OversampleH);

	public unsafe ref int OversampleV => ref Unsafe.AsRef<int>(&NativePtr->OversampleV);

	public unsafe ref bool PixelSnapH => ref Unsafe.AsRef<bool>(&NativePtr->PixelSnapH);

	public unsafe ref Vector2 GlyphExtraSpacing => ref Unsafe.AsRef<Vector2>(&NativePtr->GlyphExtraSpacing);

	public unsafe ref Vector2 GlyphOffset => ref Unsafe.AsRef<Vector2>(&NativePtr->GlyphOffset);

	public unsafe IntPtr GlyphRanges
	{
		get
		{
			return (IntPtr)NativePtr->GlyphRanges;
		}
		set
		{
			NativePtr->GlyphRanges = (ushort*)(void*)value;
		}
	}

	public unsafe ref float GlyphMinAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->GlyphMinAdvanceX);

	public unsafe ref float GlyphMaxAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->GlyphMaxAdvanceX);

	public unsafe ref bool MergeMode => ref Unsafe.AsRef<bool>(&NativePtr->MergeMode);

	public unsafe ref uint FontBuilderFlags => ref Unsafe.AsRef<uint>(&NativePtr->FontBuilderFlags);

	public unsafe ref float RasterizerMultiply => ref Unsafe.AsRef<float>(&NativePtr->RasterizerMultiply);

	public unsafe ref ushort EllipsisChar => ref Unsafe.AsRef<ushort>(&NativePtr->EllipsisChar);

	public unsafe RangeAccessor<byte> Name => new RangeAccessor<byte>(NativePtr->Name, 40);

	public unsafe ImFontPtr DstFont => new ImFontPtr(NativePtr->DstFont);

	public unsafe ImFontConfigPtr(ImFontConfig* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImFontConfigPtr(IntPtr nativePtr)
	{
		NativePtr = (ImFontConfig*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImFontConfigPtr(ImFontConfig* nativePtr)
	{
		return new ImFontConfigPtr(nativePtr);
	}

	public unsafe static implicit operator ImFontConfig*(ImFontConfigPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImFontConfigPtr(IntPtr nativePtr)
	{
		return new ImFontConfigPtr(nativePtr);
	}

	public unsafe void Destroy()
	{
		ImGuiNative.ImFontConfig_destroy(NativePtr);
	}
}
public struct ImFontGlyph
{
	public uint Colored;

	public uint Visible;

	public uint Codepoint;

	public float AdvanceX;

	public float X0;

	public float Y0;

	public float X1;

	public float Y1;

	public float U0;

	public float V0;

	public float U1;

	public float V1;
}
public struct ImFontGlyphPtr
{
	public unsafe ImFontGlyph* NativePtr { get; }

	public unsafe ref uint Colored => ref Unsafe.AsRef<uint>(&NativePtr->Colored);

	public unsafe ref uint Visible => ref Unsafe.AsRef<uint>(&NativePtr->Visible);

	public unsafe ref uint Codepoint => ref Unsafe.AsRef<uint>(&NativePtr->Codepoint);

	public unsafe ref float AdvanceX => ref Unsafe.AsRef<float>(&NativePtr->AdvanceX);

	public unsafe ref float X0 => ref Unsafe.AsRef<float>(&NativePtr->X0);

	public unsafe ref float Y0 => ref Unsafe.AsRef<float>(&NativePtr->Y0);

	public unsafe ref float X1 => ref Unsafe.AsRef<float>(&NativePtr->X1);

	public unsafe ref float Y1 => ref Unsafe.AsRef<float>(&NativePtr->Y1);

	public unsafe ref float U0 => ref Unsafe.AsRef<float>(&NativePtr->U0);

	public unsafe ref float V0 => ref Unsafe.AsRef<float>(&NativePtr->V0);

	public unsafe ref float U1 => ref Unsafe.AsRef<float>(&NativePtr->U1);

	public unsafe ref float V1 => ref Unsafe.AsRef<float>(&NativePtr->V1);

	public unsafe ImFontGlyphPtr(ImFontGlyph* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImFontGlyphPtr(IntPtr nativePtr)
	{
		NativePtr = (ImFontGlyph*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImFontGlyphPtr(ImFontGlyph* nativePtr)
	{
		return new ImFontGlyphPtr(nativePtr);
	}

	public unsafe static implicit operator ImFontGlyph*(ImFontGlyphPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImFontGlyphPtr(IntPtr nativePtr)
	{
		return new ImFontGlyphPtr(nativePtr);
	}
}
public struct ImFontGlyphRangesBuilder
{
	public ImVector UsedChars;
}
public struct ImFontGlyphRangesBuilderPtr
{
	public unsafe ImFontGlyphRangesBuilder* NativePtr { get; }

	public unsafe ImVector<uint> UsedChars => new ImVector<uint>(NativePtr->UsedChars);

	public unsafe ImFontGlyphRangesBuilderPtr(ImFontGlyphRangesBuilder* nativePtr)
	{
		NativePtr = nativePtr;
	}

	public unsafe ImFontGlyphRangesBuilderPtr(IntPtr nativePtr)
	{
		NativePtr = (ImFontGlyphRangesBuilder*)(void*)nativePtr;
	}

	public unsafe static implicit operator ImFontGlyphRangesBuilderPtr(ImFontGlyphRangesBuilder* nativePtr)
	{
		return new ImFontGlyphRangesBuilderPtr(nativePtr);
	}

	public unsafe static implicit operator ImFontGlyphRangesBuilder*(ImFontGlyphRangesBuilderPtr wrappedPtr)
	{
		return wrappedPtr.NativePtr;
	}

	public static implicit operator ImFontGlyphRangesBuilderPtr(IntPtr nativePtr)
	{
		return new ImFontGlyphRangesBuilderPtr(nativePtr);
	}

	public unsafe void AddChar(ushort c)
	{
		ImGuiNative.ImFontGlyphRangesBuilder_AddChar(NativePtr, c);
	}

	public unsafe void AddRanges(IntPtr ranges)
	{
		ushort* ranges2 = (ushort*)ranges.ToPointer();
		ImGuiNative.ImFontGlyphRangesBuilder_AddRanges(NativePtr, ranges2);
	}

	public unsafe void AddText(string text)
	{
		int num = 0;
		byte* ptr;
		if (text != null)
		{
			num = Encoding.UTF8.GetByteCount(text);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(text, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte* text_end = null;
		ImGuiNative.ImFontGlyphRangesBuilder_AddText(NativePtr, ptr, text_end);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
	}

	public unsafe void BuildRanges(out ImVector out_ranges)
	{
		fixed (ImVector* out_ranges2 = &out_ranges)
		{
			ImGuiNative.ImFontGlyphRangesBuilder_BuildRanges(NativePtr, out_ranges2);
		}
	}

	public unsafe void Clear()
	{
		ImGuiNative.ImFontGlyphRangesBuilder_Clear(NativePtr);
	}

	public unsafe void Destroy()
	{
		ImGuiNative.ImFontGlyphRangesBuilder_destroy(NativePtr);
	}

	public unsafe bool GetBit(uint n)
	{
		return ImGuiNative.ImFontGlyphRangesBuilder_GetBit(NativePtr, n) != 0;
	}

	public unsafe void SetBit(uint n)
	{
		ImGuiNative.ImFontGlyphRangesBuilder_SetBit(NativePtr, n);
	}
}
public static class ImGui
{
	public unsafe static ImGuiPayloadPtr AcceptDragDropPayload(string type)
	{
		int num = 0;
		byte* ptr;
		if (type != null)
		{
			num = Encoding.UTF8.GetByteCount(type);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(type, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiDragDropFlags flags = ImGuiDragDropFlags.None;
		ImGuiPayload* nativePtr = ImGuiNative.igAcceptDragDropPayload(ptr, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return new ImGuiPayloadPtr(nativePtr);
	}

	public unsafe static ImGuiPayloadPtr AcceptDragDropPayload(string type, ImGuiDragDropFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (type != null)
		{
			num = Encoding.UTF8.GetByteCount(type);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(type, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiPayload* nativePtr = ImGuiNative.igAcceptDragDropPayload(ptr, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return new ImGuiPayloadPtr(nativePtr);
	}

	public static void AlignTextToFramePadding()
	{
		ImGuiNative.igAlignTextToFramePadding();
	}

	public unsafe static bool ArrowButton(string str_id, ImGuiDir dir)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igArrowButton(ptr, dir);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool Begin(string name)
	{
		int num = 0;
		byte* ptr;
		if (name != null)
		{
			num = Encoding.UTF8.GetByteCount(name);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(name, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte* p_open = null;
		ImGuiWindowFlags flags = ImGuiWindowFlags.None;
		byte num2 = ImGuiNative.igBegin(ptr, p_open, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool Begin(string name, ref bool p_open)
	{
		int num = 0;
		byte* ptr;
		if (name != null)
		{
			num = Encoding.UTF8.GetByteCount(name);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(name, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte b = (byte)(p_open ? 1 : 0);
		byte* p_open2 = &b;
		ImGuiWindowFlags flags = ImGuiWindowFlags.None;
		byte num2 = ImGuiNative.igBegin(ptr, p_open2, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		p_open = b != 0;
		return num2 != 0;
	}

	public unsafe static bool Begin(string name, ref bool p_open, ImGuiWindowFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (name != null)
		{
			num = Encoding.UTF8.GetByteCount(name);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(name, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte b = (byte)(p_open ? 1 : 0);
		byte* p_open2 = &b;
		byte num2 = ImGuiNative.igBegin(ptr, p_open2, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		p_open = b != 0;
		return num2 != 0;
	}

	public unsafe static bool BeginChild(string str_id)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		Vector2 size = default(Vector2);
		byte border = 0;
		ImGuiWindowFlags flags = ImGuiWindowFlags.None;
		byte num2 = ImGuiNative.igBeginChild_Str(ptr, size, border, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginChild(string str_id, Vector2 size)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte border = 0;
		ImGuiWindowFlags flags = ImGuiWindowFlags.None;
		byte num2 = ImGuiNative.igBeginChild_Str(ptr, size, border, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginChild(string str_id, Vector2 size, bool border)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte border2 = (byte)(border ? 1 : 0);
		ImGuiWindowFlags flags = ImGuiWindowFlags.None;
		byte num2 = ImGuiNative.igBeginChild_Str(ptr, size, border2, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginChild(string str_id, Vector2 size, bool border, ImGuiWindowFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte border2 = (byte)(border ? 1 : 0);
		byte num2 = ImGuiNative.igBeginChild_Str(ptr, size, border2, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public static bool BeginChild(uint id)
	{
		Vector2 size = default(Vector2);
		byte border = 0;
		ImGuiWindowFlags flags = ImGuiWindowFlags.None;
		return ImGuiNative.igBeginChild_ID(id, size, border, flags) != 0;
	}

	public static bool BeginChild(uint id, Vector2 size)
	{
		byte border = 0;
		ImGuiWindowFlags flags = ImGuiWindowFlags.None;
		return ImGuiNative.igBeginChild_ID(id, size, border, flags) != 0;
	}

	public static bool BeginChild(uint id, Vector2 size, bool border)
	{
		byte border2 = (byte)(border ? 1 : 0);
		ImGuiWindowFlags flags = ImGuiWindowFlags.None;
		return ImGuiNative.igBeginChild_ID(id, size, border2, flags) != 0;
	}

	public static bool BeginChild(uint id, Vector2 size, bool border, ImGuiWindowFlags flags)
	{
		byte border2 = (byte)(border ? 1 : 0);
		return ImGuiNative.igBeginChild_ID(id, size, border2, flags) != 0;
	}

	public static bool BeginChildFrame(uint id, Vector2 size)
	{
		ImGuiWindowFlags flags = ImGuiWindowFlags.None;
		return ImGuiNative.igBeginChildFrame(id, size, flags) != 0;
	}

	public static bool BeginChildFrame(uint id, Vector2 size, ImGuiWindowFlags flags)
	{
		return ImGuiNative.igBeginChildFrame(id, size, flags) != 0;
	}

	public unsafe static bool BeginCombo(string label, string preview_value)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		int num2 = 0;
		byte* ptr2;
		if (preview_value != null)
		{
			num2 = Encoding.UTF8.GetByteCount(preview_value);
			ptr2 = ((num2 <= 2048) ? stackalloc byte[(int)(uint)(num2 + 1)] : Util.Allocate(num2 + 1));
			int utf2 = Util.GetUtf8(preview_value, ptr2, num2);
			ptr2[utf2] = 0;
		}
		else
		{
			ptr2 = null;
		}
		ImGuiComboFlags flags = ImGuiComboFlags.None;
		byte num3 = ImGuiNative.igBeginCombo(ptr, ptr2, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		if (num2 > 2048)
		{
			Util.Free(ptr2);
		}
		return num3 != 0;
	}

	public unsafe static bool BeginCombo(string label, string preview_value, ImGuiComboFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		int num2 = 0;
		byte* ptr2;
		if (preview_value != null)
		{
			num2 = Encoding.UTF8.GetByteCount(preview_value);
			ptr2 = ((num2 <= 2048) ? stackalloc byte[(int)(uint)(num2 + 1)] : Util.Allocate(num2 + 1));
			int utf2 = Util.GetUtf8(preview_value, ptr2, num2);
			ptr2[utf2] = 0;
		}
		else
		{
			ptr2 = null;
		}
		byte num3 = ImGuiNative.igBeginCombo(ptr, ptr2, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		if (num2 > 2048)
		{
			Util.Free(ptr2);
		}
		return num3 != 0;
	}

	public static void BeginDisabled()
	{
		ImGuiNative.igBeginDisabled(1);
	}

	public static void BeginDisabled(bool disabled)
	{
		ImGuiNative.igBeginDisabled((byte)(disabled ? 1 : 0));
	}

	public static bool BeginDragDropSource()
	{
		return ImGuiNative.igBeginDragDropSource(ImGuiDragDropFlags.None) != 0;
	}

	public static bool BeginDragDropSource(ImGuiDragDropFlags flags)
	{
		return ImGuiNative.igBeginDragDropSource(flags) != 0;
	}

	public static bool BeginDragDropTarget()
	{
		return ImGuiNative.igBeginDragDropTarget() != 0;
	}

	public static void BeginGroup()
	{
		ImGuiNative.igBeginGroup();
	}

	public unsafe static bool BeginListBox(string label)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igBeginListBox(ptr, default(Vector2));
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginListBox(string label, Vector2 size)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igBeginListBox(ptr, size);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public static bool BeginMainMenuBar()
	{
		return ImGuiNative.igBeginMainMenuBar() != 0;
	}

	public unsafe static bool BeginMenu(string label)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte enabled = 1;
		byte num2 = ImGuiNative.igBeginMenu(ptr, enabled);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginMenu(string label, bool enabled)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte enabled2 = (byte)(enabled ? 1 : 0);
		byte num2 = ImGuiNative.igBeginMenu(ptr, enabled2);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public static bool BeginMenuBar()
	{
		return ImGuiNative.igBeginMenuBar() != 0;
	}

	public unsafe static bool BeginPopup(string str_id)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiWindowFlags flags = ImGuiWindowFlags.None;
		byte num2 = ImGuiNative.igBeginPopup(ptr, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginPopup(string str_id, ImGuiWindowFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igBeginPopup(ptr, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginPopupContextItem()
	{
		byte* str_id = null;
		ImGuiPopupFlags popup_flags = ImGuiPopupFlags.MouseButtonRight;
		return ImGuiNative.igBeginPopupContextItem(str_id, popup_flags) != 0;
	}

	public unsafe static bool BeginPopupContextItem(string str_id)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiPopupFlags popup_flags = ImGuiPopupFlags.MouseButtonRight;
		byte num2 = ImGuiNative.igBeginPopupContextItem(ptr, popup_flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginPopupContextItem(string str_id, ImGuiPopupFlags popup_flags)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igBeginPopupContextItem(ptr, popup_flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginPopupContextVoid()
	{
		byte* str_id = null;
		ImGuiPopupFlags popup_flags = ImGuiPopupFlags.MouseButtonRight;
		return ImGuiNative.igBeginPopupContextVoid(str_id, popup_flags) != 0;
	}

	public unsafe static bool BeginPopupContextVoid(string str_id)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiPopupFlags popup_flags = ImGuiPopupFlags.MouseButtonRight;
		byte num2 = ImGuiNative.igBeginPopupContextVoid(ptr, popup_flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginPopupContextVoid(string str_id, ImGuiPopupFlags popup_flags)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igBeginPopupContextVoid(ptr, popup_flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginPopupContextWindow()
	{
		byte* str_id = null;
		ImGuiPopupFlags popup_flags = ImGuiPopupFlags.MouseButtonRight;
		return ImGuiNative.igBeginPopupContextWindow(str_id, popup_flags) != 0;
	}

	public unsafe static bool BeginPopupContextWindow(string str_id)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiPopupFlags popup_flags = ImGuiPopupFlags.MouseButtonRight;
		byte num2 = ImGuiNative.igBeginPopupContextWindow(ptr, popup_flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginPopupContextWindow(string str_id, ImGuiPopupFlags popup_flags)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igBeginPopupContextWindow(ptr, popup_flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginPopupModal(string name)
	{
		int num = 0;
		byte* ptr;
		if (name != null)
		{
			num = Encoding.UTF8.GetByteCount(name);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(name, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte* p_open = null;
		ImGuiWindowFlags flags = ImGuiWindowFlags.None;
		byte num2 = ImGuiNative.igBeginPopupModal(ptr, p_open, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginPopupModal(string name, ref bool p_open)
	{
		int num = 0;
		byte* ptr;
		if (name != null)
		{
			num = Encoding.UTF8.GetByteCount(name);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(name, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte b = (byte)(p_open ? 1 : 0);
		byte* p_open2 = &b;
		ImGuiWindowFlags flags = ImGuiWindowFlags.None;
		byte num2 = ImGuiNative.igBeginPopupModal(ptr, p_open2, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		p_open = b != 0;
		return num2 != 0;
	}

	public unsafe static bool BeginPopupModal(string name, ref bool p_open, ImGuiWindowFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (name != null)
		{
			num = Encoding.UTF8.GetByteCount(name);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(name, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte b = (byte)(p_open ? 1 : 0);
		byte* p_open2 = &b;
		byte num2 = ImGuiNative.igBeginPopupModal(ptr, p_open2, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		p_open = b != 0;
		return num2 != 0;
	}

	public unsafe static bool BeginTabBar(string str_id)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiTabBarFlags flags = ImGuiTabBarFlags.None;
		byte num2 = ImGuiNative.igBeginTabBar(ptr, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginTabBar(string str_id, ImGuiTabBarFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igBeginTabBar(ptr, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginTabItem(string label)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte* p_open = null;
		ImGuiTabItemFlags flags = ImGuiTabItemFlags.None;
		byte num2 = ImGuiNative.igBeginTabItem(ptr, p_open, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginTabItem(string label, ref bool p_open)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte b = (byte)(p_open ? 1 : 0);
		byte* p_open2 = &b;
		ImGuiTabItemFlags flags = ImGuiTabItemFlags.None;
		byte num2 = ImGuiNative.igBeginTabItem(ptr, p_open2, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		p_open = b != 0;
		return num2 != 0;
	}

	public unsafe static bool BeginTabItem(string label, ref bool p_open, ImGuiTabItemFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte b = (byte)(p_open ? 1 : 0);
		byte* p_open2 = &b;
		byte num2 = ImGuiNative.igBeginTabItem(ptr, p_open2, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		p_open = b != 0;
		return num2 != 0;
	}

	public unsafe static bool BeginTable(string str_id, int column)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiTableFlags flags = ImGuiTableFlags.None;
		Vector2 outer_size = default(Vector2);
		float inner_width = 0f;
		byte num2 = ImGuiNative.igBeginTable(ptr, column, flags, outer_size, inner_width);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginTable(string str_id, int column, ImGuiTableFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		Vector2 outer_size = default(Vector2);
		float inner_width = 0f;
		byte num2 = ImGuiNative.igBeginTable(ptr, column, flags, outer_size, inner_width);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginTable(string str_id, int column, ImGuiTableFlags flags, Vector2 outer_size)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		float inner_width = 0f;
		byte num2 = ImGuiNative.igBeginTable(ptr, column, flags, outer_size, inner_width);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool BeginTable(string str_id, int column, ImGuiTableFlags flags, Vector2 outer_size, float inner_width)
	{
		int num = 0;
		byte* ptr;
		if (str_id != null)
		{
			num = Encoding.UTF8.GetByteCount(str_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(str_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igBeginTable(ptr, column, flags, outer_size, inner_width);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public static void BeginTooltip()
	{
		ImGuiNative.igBeginTooltip();
	}

	public static void Bullet()
	{
		ImGuiNative.igBullet();
	}

	public unsafe static void BulletText(string fmt)
	{
		int num = 0;
		byte* ptr;
		if (fmt != null)
		{
			num = Encoding.UTF8.GetByteCount(fmt);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(fmt, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiNative.igBulletText(ptr);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
	}

	public unsafe static bool Button(string label)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igButton(ptr, default(Vector2));
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool Button(string label, Vector2 size)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igButton(ptr, size);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public static float CalcItemWidth()
	{
		return ImGuiNative.igCalcItemWidth();
	}

	public unsafe static bool Checkbox(string label, ref bool v)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte b = (byte)(v ? 1 : 0);
		byte* v2 = &b;
		byte num2 = ImGuiNative.igCheckbox(ptr, v2);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		v = b != 0;
		return num2 != 0;
	}

	public unsafe static bool CheckboxFlags(string label, ref int flags, int flags_value)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		fixed (int* flags2 = &flags)
		{
			byte num2 = ImGuiNative.igCheckboxFlags_IntPtr(ptr, flags2, flags_value);
			if (num > 2048)
			{
				Util.Free(ptr);
			}
			return num2 != 0;
		}
	}

	public unsafe static bool CheckboxFlags(string label, ref uint flags, uint flags_value)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		fixed (uint* flags2 = &flags)
		{
			byte num2 = ImGuiNative.igCheckboxFlags_UintPtr(ptr, flags2, flags_value);
			if (num > 2048)
			{
				Util.Free(ptr);
			}
			return num2 != 0;
		}
	}

	public static void CloseCurrentPopup()
	{
		ImGuiNative.igCloseCurrentPopup();
	}

	public unsafe static bool CollapsingHeader(string label)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiTreeNodeFlags flags = ImGuiTreeNodeFlags.None;
		byte num2 = ImGuiNative.igCollapsingHeader_TreeNodeFlags(ptr, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool CollapsingHeader(string label, ImGuiTreeNodeFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igCollapsingHeader_TreeNodeFlags(ptr, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool CollapsingHeader(string label, ref bool p_visible)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte b = (byte)(p_visible ? 1 : 0);
		byte* p_visible2 = &b;
		ImGuiTreeNodeFlags flags = ImGuiTreeNodeFlags.None;
		byte num2 = ImGuiNative.igCollapsingHeader_BoolPtr(ptr, p_visible2, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		p_visible = b != 0;
		return num2 != 0;
	}

	public unsafe static bool CollapsingHeader(string label, ref bool p_visible, ImGuiTreeNodeFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte b = (byte)(p_visible ? 1 : 0);
		byte* p_visible2 = &b;
		byte num2 = ImGuiNative.igCollapsingHeader_BoolPtr(ptr, p_visible2, flags);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		p_visible = b != 0;
		return num2 != 0;
	}

	public unsafe static bool ColorButton(string desc_id, Vector4 col)
	{
		int num = 0;
		byte* ptr;
		if (desc_id != null)
		{
			num = Encoding.UTF8.GetByteCount(desc_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(desc_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiColorEditFlags flags = ImGuiColorEditFlags.None;
		byte num2 = ImGuiNative.igColorButton(ptr, col, flags, default(Vector2));
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool ColorButton(string desc_id, Vector4 col, ImGuiColorEditFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (desc_id != null)
		{
			num = Encoding.UTF8.GetByteCount(desc_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(desc_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igColorButton(ptr, col, flags, default(Vector2));
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public unsafe static bool ColorButton(string desc_id, Vector4 col, ImGuiColorEditFlags flags, Vector2 size)
	{
		int num = 0;
		byte* ptr;
		if (desc_id != null)
		{
			num = Encoding.UTF8.GetByteCount(desc_id);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(desc_id, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		byte num2 = ImGuiNative.igColorButton(ptr, col, flags, size);
		if (num > 2048)
		{
			Util.Free(ptr);
		}
		return num2 != 0;
	}

	public static uint ColorConvertFloat4ToU32(Vector4 @in)
	{
		return ImGuiNative.igColorConvertFloat4ToU32(@in);
	}

	public unsafe static void ColorConvertHSVtoRGB(float h, float s, float v, out float out_r, out float out_g, out float out_b)
	{
		fixed (float* out_r2 = &out_r)
		{
			fixed (float* out_g2 = &out_g)
			{
				fixed (float* out_b2 = &out_b)
				{
					ImGuiNative.igColorConvertHSVtoRGB(h, s, v, out_r2, out_g2, out_b2);
				}
			}
		}
	}

	public unsafe static void ColorConvertRGBtoHSV(float r, float g, float b, out float out_h, out float out_s, out float out_v)
	{
		fixed (float* out_h2 = &out_h)
		{
			fixed (float* out_s2 = &out_s)
			{
				fixed (float* out_v2 = &out_v)
				{
					ImGuiNative.igColorConvertRGBtoHSV(r, g, b, out_h2, out_s2, out_v2);
				}
			}
		}
	}

	public unsafe static Vector4 ColorConvertU32ToFloat4(uint @in)
	{
		Vector4 result = default(Vector4);
		ImGuiNative.igColorConvertU32ToFloat4(&result, @in);
		return result;
	}

	public unsafe static bool ColorEdit3(string label, ref Vector3 col)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiColorEditFlags flags = ImGuiColorEditFlags.None;
		fixed (Vector3* col2 = &col)
		{
			byte num2 = ImGuiNative.igColorEdit3(ptr, col2, flags);
			if (num > 2048)
			{
				Util.Free(ptr);
			}
			return num2 != 0;
		}
	}

	public unsafe static bool ColorEdit3(string label, ref Vector3 col, ImGuiColorEditFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		fixed (Vector3* col2 = &col)
		{
			byte num2 = ImGuiNative.igColorEdit3(ptr, col2, flags);
			if (num > 2048)
			{
				Util.Free(ptr);
			}
			return num2 != 0;
		}
	}

	public unsafe static bool ColorEdit4(string label, ref Vector4 col)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiColorEditFlags flags = ImGuiColorEditFlags.None;
		fixed (Vector4* col2 = &col)
		{
			byte num2 = ImGuiNative.igColorEdit4(ptr, col2, flags);
			if (num > 2048)
			{
				Util.Free(ptr);
			}
			return num2 != 0;
		}
	}

	public unsafe static bool ColorEdit4(string label, ref Vector4 col, ImGuiColorEditFlags flags)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		fixed (Vector4* col2 = &col)
		{
			byte num2 = ImGuiNative.igColorEdit4(ptr, col2, flags);
			if (num > 2048)
			{
				Util.Free(ptr);
			}
			return num2 != 0;
		}
	}

	public unsafe static bool ColorPicker3(string label, ref Vector3 col)
	{
		int num = 0;
		byte* ptr;
		if (label != null)
		{
			num = Encoding.UTF8.GetByteCount(label);
			ptr = ((num <= 2048) ? stackalloc byte[(int)(uint)(num + 1)] : Util.Allocate(num + 1));
			int utf = Util.GetUtf8(label, ptr, num);
			ptr[utf] = 0;
		}
		else
		{
			ptr = null;
		}
		ImGuiColorEditFlags flags = ImGuiColorEdi

plugins/AdventureGuide/System.Runtime.CompilerServices.Unsafe.dll

Decompiled a month ago
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;

[assembly: AssemblyProduct("Microsoft® .NET Framework")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyFileVersion("4.0.0.0")]
[assembly: AssemblyInformationalVersion("4.0.0.0")]
[assembly: AssemblyTitle("System.Runtime.CompilerServices.Unsafe")]
[assembly: AssemblyDescription("System.Runtime.CompilerServices.Unsafe")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyCopyright("© Microsoft Corporation.  All rights reserved.")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: CLSCompliant(false)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyVersion("4.0.4.1")]
namespace System.Runtime.CompilerServices
{
	public static class Unsafe : Object
	{
		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static T Read<T>(void* source)
		{
			return Unsafe.Read<T>(source);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static T ReadUnaligned<T>(void* source)
		{
			return Unsafe.ReadUnaligned<T>(source);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static T ReadUnaligned<T>(ref byte source)
		{
			return Unsafe.ReadUnaligned<T>(ref source);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static void Write<T>(void* destination, T value)
		{
			Unsafe.Write(destination, value);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static void WriteUnaligned<T>(void* destination, T value)
		{
			Unsafe.WriteUnaligned(destination, value);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static void WriteUnaligned<T>(ref byte destination, T value)
		{
			Unsafe.WriteUnaligned(ref destination, value);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static void Copy<T>(void* destination, ref T source)
		{
			Unsafe.Write(destination, source);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static void Copy<T>(ref T destination, void* source)
		{
			destination = Unsafe.Read<T>(source);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static void* AsPointer<T>(ref T value)
		{
			return Unsafe.AsPointer(ref value);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static int SizeOf<T>()
		{
			return Unsafe.SizeOf<T>();
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static void CopyBlock(void* destination, void* source, uint byteCount)
		{
			// IL cpblk instruction
			Unsafe.CopyBlock(destination, source, byteCount);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static void CopyBlock(ref byte destination, ref byte source, uint byteCount)
		{
			// IL cpblk instruction
			Unsafe.CopyBlock(ref destination, ref source, byteCount);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static void CopyBlockUnaligned(void* destination, void* source, uint byteCount)
		{
			// IL cpblk instruction
			Unsafe.CopyBlockUnaligned(destination, source, byteCount);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static void CopyBlockUnaligned(ref byte destination, ref byte source, uint byteCount)
		{
			// IL cpblk instruction
			Unsafe.CopyBlockUnaligned(ref destination, ref source, byteCount);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static void InitBlock(void* startAddress, byte value, uint byteCount)
		{
			// IL initblk instruction
			Unsafe.InitBlock(startAddress, value, byteCount);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static void InitBlock(ref byte startAddress, byte value, uint byteCount)
		{
			// IL initblk instruction
			Unsafe.InitBlock(ref startAddress, value, byteCount);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static void InitBlockUnaligned(void* startAddress, byte value, uint byteCount)
		{
			// IL initblk instruction
			Unsafe.InitBlockUnaligned(startAddress, value, byteCount);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static void InitBlockUnaligned(ref byte startAddress, byte value, uint byteCount)
		{
			// IL initblk instruction
			Unsafe.InitBlockUnaligned(ref startAddress, value, byteCount);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static T As<T>(object o) where T : class
		{
			return (T)o;
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static ref T AsRef<T>(void* source)
		{
			return ref *(T*)source;
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static ref T AsRef<T>(in T source)
		{
			return ref source;
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static ref TTo As<TFrom, TTo>(ref TFrom source)
		{
			return ref Unsafe.As<TFrom, TTo>(ref source);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static ref T Add<T>(ref T source, int elementOffset)
		{
			return ref Unsafe.Add(ref source, elementOffset);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static void* Add<T>(void* source, int elementOffset)
		{
			return (byte*)source + (nint)elementOffset * (nint)Unsafe.SizeOf<T>();
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static ref T Add<T>(ref T source, System.IntPtr elementOffset)
		{
			return ref Unsafe.Add(ref source, elementOffset);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static ref T AddByteOffset<T>(ref T source, System.IntPtr byteOffset)
		{
			return ref Unsafe.AddByteOffset(ref source, byteOffset);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static ref T Subtract<T>(ref T source, int elementOffset)
		{
			return ref Unsafe.Subtract(ref source, elementOffset);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public unsafe static void* Subtract<T>(void* source, int elementOffset)
		{
			return (byte*)source - (nint)elementOffset * (nint)Unsafe.SizeOf<T>();
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static ref T Subtract<T>(ref T source, System.IntPtr elementOffset)
		{
			return ref Unsafe.Subtract(ref source, elementOffset);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static ref T SubtractByteOffset<T>(ref T source, System.IntPtr byteOffset)
		{
			return ref Unsafe.SubtractByteOffset(ref source, byteOffset);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static System.IntPtr ByteOffset<T>(ref T origin, ref T target)
		{
			return Unsafe.ByteOffset(target: ref target, origin: ref origin);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static bool AreSame<T>(ref T left, ref T right)
		{
			return Unsafe.AreSame(ref left, ref right);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static bool IsAddressGreaterThan<T>(ref T left, ref T right)
		{
			return Unsafe.IsAddressGreaterThan(ref left, ref right);
		}

		[MethodImpl(256)]
		[NonVersionable]
		public static bool IsAddressLessThan<T>(ref T left, ref T right)
		{
			return Unsafe.IsAddressLessThan(ref left, ref right);
		}
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class NonVersionableAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
}