Decompiled source of LethalCloudBan v1.0.1

LethalCloudBan.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LobbyImprovements;
using Microsoft.CodeAnalysis;
using Netcode.Transports.Facepunch;
using Newtonsoft.Json;
using Steamworks.Data;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("uk.1a3.lobbyimprovements")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("chuxiaaaa")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("LethalCloudBan")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+4754aadea706fc63b7ae0280000ed4997e7c8218")]
[assembly: AssemblyProduct("LethalCloudBan")]
[assembly: AssemblyTitle("LethalCloudBan")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
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;
		}
	}
}
internal static class LCMPluginInfo
{
	public const string PLUGIN_GUID = "LethalCloudBan";

	public const string PLUGIN_NAME = "LethalCloudBan";

	public const string PLUGIN_VERSION = "1.0.1";
}
namespace LethalMod
{
	[BepInPlugin("LethalCloudBan", "LethalCloudBan", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		public static BlacklistApiClient Client;

		public static ManualLogSource ManualLog;

		public static ConfigEntry<string> ServerIp;

		public void Awake()
		{
			ManualLog = ((BaseUnityPlugin)this).Logger;
			ServerIp = ((BaseUnityPlugin)this).Config.Bind<string>("Server", "IP", "http://localhost:6179", (ConfigDescription)null);
			HttpClient httpClient = new HttpClient();
			httpClient.Timeout = TimeSpan.FromSeconds(3.0);
			Client = new BlacklistApiClient(ServerIp.Value);
			Harmony.CreateAndPatchAll(typeof(Patches), (string)null);
		}
	}
	public static class Patches
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass8_0
		{
			public List<BlacklistItem> blacklistItems;

			public bool isDone;

			internal void <CheckBlackListCoroutine>b__0(List<BlacklistItem> result)
			{
				blacklistItems = result;
				isDone = true;
			}
		}

		[CompilerGenerated]
		private sealed class <CheckBlackListCoroutine>d__8 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ulong ownerClientId;

			public ulong steamId;

			private <>c__DisplayClass8_0 <>8__1;

			private IEnumerator <queryCoroutine>5__2;

			private string <reason>5__3;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<queryCoroutine>5__2 = null;
				<reason>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass8_0();
					<>8__1.blacklistItems = null;
					<>8__1.isDone = false;
					<queryCoroutine>5__2 = Plugin.Client.GetByValueAsync(steamId.ToString(), delegate(List<BlacklistItem> result)
					{
						<>8__1.blacklistItems = result;
						<>8__1.isDone = true;
					});
					<>2__current = <queryCoroutine>5__2;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (<>8__1.blacklistItems != null && <>8__1.blacklistItems.Count > 0)
					{
						<reason>5__3 = "你已被加入云端黑名单\r\n原因:" + <>8__1.blacklistItems[0].Reason + "\r\n如需申诉请加Q群:\r\n1090975552";
						Plugin.ManualLog.LogInfo((object)$"踢出黑名单玩家 {steamId}: {<>8__1.blacklistItems[0].Reason}");
						NetworkManager.Singleton.DisconnectClient(ownerClientId, <reason>5__3);
						<reason>5__3 = null;
					}
					return false;
				}
			}

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

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

		public static Dictionary<uint, ulong> ConnectionIdtoSteamIdMap { get; set; } = new Dictionary<uint, ulong>();


		public static uint ClientIdToTransportId(ulong SenderClientId)
		{
			if (SenderClientId == 0)
			{
				return 0u;
			}
			NetworkConnectionManager value = Traverse.Create((object)NetworkManager.Singleton).Field("ConnectionManager").GetValue<NetworkConnectionManager>();
			ulong value2 = Traverse.Create((object)value).Method("ClientIdToTransportId", new object[1] { SenderClientId }).GetValue<ulong>();
			return (uint)value2;
		}

		[HarmonyPatch(typeof(FacepunchTransport), "Steamworks.ISocketManager.OnConnecting")]
		[HarmonyPrefix]
		[HarmonyWrapSafe]
		public static bool FacepunchTransportOnConnecting(ref Connection connection, ref ConnectionInfo info)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			NetIdentity value = Traverse.Create((object)info).Field<NetIdentity>("identity").Value;
			if (ConnectionIdtoSteamIdMap.ContainsKey(((Connection)(ref connection)).Id))
			{
				ConnectionIdtoSteamIdMap[((Connection)(ref connection)).Id] = ((NetIdentity)(ref value)).SteamId.Value;
			}
			else
			{
				ConnectionIdtoSteamIdMap.Add(((Connection)(ref connection)).Id, ((NetIdentity)(ref value)).SteamId.Value);
			}
			return true;
		}

		[HarmonyPatch(typeof(FacepunchTransport), "Steamworks.ISocketManager.OnDisconnected")]
		[HarmonyPrefix]
		[HarmonyWrapSafe]
		public static void FacepunchTransportOnDisconnected(ref Connection connection, ref ConnectionInfo info)
		{
			//IL_0018: 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)
			NetworkManager singleton = NetworkManager.Singleton;
			if (singleton != null && singleton.IsListening)
			{
				NetIdentity value = Traverse.Create((object)info).Field<NetIdentity>("identity").Value;
				ConnectionIdtoSteamIdMap.Remove(((Connection)(ref connection)).Id);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "ConnectionApproval")]
		[HarmonyWrapSafe]
		[HarmonyPriority(0)]
		[HarmonyAfter(new string[] { "mattymatty.LobbyControl" })]
		private static void Postfix(ConnectionApprovalRequest request, ConnectionApprovalResponse response)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (request.ClientNetworkId != 0 && response.Approved)
			{
				ulong num = ClientIdToTransportId(request.ClientNetworkId);
				if (ConnectionIdtoSteamIdMap.TryGetValue((uint)num, out var value))
				{
					((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(CheckBlackListCoroutine(request.ClientNetworkId, value));
				}
			}
		}

		[IteratorStateMachine(typeof(<CheckBlackListCoroutine>d__8))]
		public static IEnumerator CheckBlackListCoroutine(ulong ownerClientId, ulong steamId)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CheckBlackListCoroutine>d__8(0)
			{
				ownerClientId = ownerClientId,
				steamId = steamId
			};
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(StartOfRound), "KickPlayer")]
		public static void KickPlayer(int playerObjToKick)
		{
			ulong playerSteamId = StartOfRound.Instance.allPlayerScripts[playerObjToKick].playerSteamId;
			if (General_Patches.steamBanReasons.ContainsKey(playerSteamId))
			{
				((MonoBehaviour)StartOfRound.Instance).StartCoroutine(Plugin.Client.AddAsync(new BlacklistItem
				{
					BlackValue = playerSteamId.ToString(),
					Reason = General_Patches.steamBanReasons[playerSteamId],
					CreatedTime = DateTime.Now,
					Creator = StartOfRound.Instance.localPlayerController.playerSteamId.ToString(),
					Id = Guid.NewGuid(),
					IsActive = true
				}, null));
			}
		}
	}
	public class BlacklistItem
	{
		public Guid Id { get; set; }

		public string Creator { get; set; }

		public string Key { get; set; }

		public DateTime CreatedTime { get; set; }

		public string Reason { get; set; }

		public string BlackValue { get; set; }

		public bool IsActive { get; set; }
	}
	public class InsecureCertificateHandler : CertificateHandler
	{
		public override bool ValidateCertificate(byte[] certificateData)
		{
			return true;
		}
	}
	public class BlacklistApiClient
	{
		[CompilerGenerated]
		private sealed class <AddAsync>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public BlacklistItem item;

			public Action<bool> successCallback;

			public BlacklistApiClient <>4__this;

			private string <keyPath>5__1;

			private string <key>5__2;

			private string <json>5__3;

			private byte[] <bodyRaw>5__4;

			private UnityWebRequest <request>5__5;

			private UploadHandlerRaw <uploadHandler>5__6;

			private DownloadHandlerBuffer <downloadHandler>5__7;

			private bool <success>5__8;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<keyPath>5__1 = null;
				<key>5__2 = null;
				<json>5__3 = null;
				<bodyRaw>5__4 = null;
				<request>5__5 = null;
				<uploadHandler>5__6 = null;
				<downloadHandler>5__7 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: Expected O, but got Unknown
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: Expected O, but got Unknown
				//IL_0117: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Expected O, but got Unknown
				//IL_018f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Invalid comparison between Unknown and I4
				//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<keyPath>5__1 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "LethalCloudBanKey.txt");
						if (!File.Exists(<keyPath>5__1))
						{
							Plugin.ManualLog.LogWarning((object)("未找到授权 Key 文件: " + <keyPath>5__1));
							successCallback?.Invoke(obj: false);
							return false;
						}
						<key>5__2 = File.ReadAllText(<keyPath>5__1);
						item.Key = <key>5__2;
						<json>5__3 = JsonConvert.SerializeObject((object)item);
						<bodyRaw>5__4 = Encoding.UTF8.GetBytes(<json>5__3);
						<request>5__5 = new UnityWebRequest(<>4__this._baseUrl, "POST");
						<>1__state = -3;
						<request>5__5.certificateHandler = (CertificateHandler)(object)new InsecureCertificateHandler();
						<uploadHandler>5__6 = new UploadHandlerRaw(<bodyRaw>5__4);
						<downloadHandler>5__7 = new DownloadHandlerBuffer();
						<request>5__5.uploadHandler = (UploadHandler)(object)<uploadHandler>5__6;
						<request>5__5.downloadHandler = (DownloadHandler)(object)<downloadHandler>5__7;
						<request>5__5.SetRequestHeader("Content-Type", "application/json");
						<>2__current = <request>5__5.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						<success>5__8 = false;
						if ((int)<request>5__5.result == 1)
						{
							Plugin.ManualLog.LogInfo((object)("成功添加黑名单: " + item.BlackValue));
							<success>5__8 = true;
						}
						else
						{
							Plugin.ManualLog.LogError((object)$"添加黑名单失败 [{<request>5__5.result}]: {<request>5__5.error}");
							if (!string.IsNullOrEmpty(<request>5__5.downloadHandler.text))
							{
								Plugin.ManualLog.LogError((object)("服务器响应: " + <request>5__5.downloadHandler.text));
							}
						}
						successCallback?.Invoke(<success>5__8);
						<uploadHandler>5__6 = null;
						<downloadHandler>5__7 = null;
						<>m__Finally1();
						<request>5__5 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<request>5__5 != null)
				{
					((IDisposable)<request>5__5).Dispose();
				}
			}

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

		[CompilerGenerated]
		private sealed class <GetByValueAsync>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string value;

			public Action<List<BlacklistItem>> resultCallback;

			public BlacklistApiClient <>4__this;

			private string <url>5__1;

			private UnityWebRequest <request>5__2;

			private List<BlacklistItem> <result>5__3;

			private Exception <ex>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<url>5__1 = null;
				<request>5__2 = null;
				<result>5__3 = null;
				<ex>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Invalid comparison between Unknown and I4
				//IL_0136: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<url>5__1 = <>4__this._baseUrl + "/by-value?blackValue=" + Uri.EscapeDataString(value);
						<request>5__2 = UnityWebRequest.Get(<url>5__1);
						<>1__state = -3;
						<request>5__2.certificateHandler = (CertificateHandler)(object)new InsecureCertificateHandler();
						<>2__current = <request>5__2.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						<result>5__3 = null;
						if ((int)<request>5__2.result == 1)
						{
							try
							{
								if (!string.IsNullOrEmpty(<request>5__2.downloadHandler.text))
								{
									<result>5__3 = JsonConvert.DeserializeObject<List<BlacklistItem>>(<request>5__2.downloadHandler.text);
								}
							}
							catch (Exception ex)
							{
								<ex>5__4 = ex;
								Plugin.ManualLog.LogError((object)("解析黑名单数据失败: " + <ex>5__4.Message));
							}
						}
						else
						{
							Plugin.ManualLog.LogWarning((object)$"黑名单查询失败 [{<request>5__2.result}]: {<request>5__2.error}");
						}
						resultCallback?.Invoke(<result>5__3);
						<result>5__3 = null;
						<>m__Finally1();
						<request>5__2 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<request>5__2 != null)
				{
					((IDisposable)<request>5__2).Dispose();
				}
			}

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

		private readonly string _baseUrl;

		public BlacklistApiClient(string serverIp)
		{
			ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
			string text = serverIp.TrimEnd('/');
			_baseUrl = text + "/api/blacklist";
		}

		[IteratorStateMachine(typeof(<GetByValueAsync>d__2))]
		public IEnumerator GetByValueAsync(string value, Action<List<BlacklistItem>> resultCallback)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetByValueAsync>d__2(0)
			{
				<>4__this = this,
				value = value,
				resultCallback = resultCallback
			};
		}

		[IteratorStateMachine(typeof(<AddAsync>d__3))]
		public IEnumerator AddAsync(BlacklistItem item, Action<bool> successCallback)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AddAsync>d__3(0)
			{
				<>4__this = this,
				item = item,
				successCallback = successCallback
			};
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}