Decompiled source of ModFixerOne v1.3.2

patchers/ModFixerOnePreloader.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using Mono.Cecil;
using Mono.Cecil.Cil;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ModFixerOnePreloader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ModFixerOnePreloader")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("dfae1e99-3b26-43c4-bd5c-40f86cb3a6d1")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.1.0")]
[module: UnverifiableCode]
namespace ModFixerOne;

public static class Injection
{
	public static void AddFied(this TypeDefinition typeDefinition, string fieldName, TypeReference fieldType)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Expected O, but got Unknown
		FieldDefinition val = new FieldDefinition(fieldName, (FieldAttributes)6, fieldType);
		typeDefinition.Fields.Add(val);
	}

	public static MethodDefinition AddMethod(this TypeDefinition typeDefinition, string methodName, TypeReference returnType, TypeReference[] parmeterTypes)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Expected O, but got Unknown
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		MethodDefinition val = new MethodDefinition(methodName, (MethodAttributes)6, returnType);
		foreach (TypeReference val2 in parmeterTypes)
		{
			((MethodReference)val).Parameters.Add(new ParameterDefinition(val2));
		}
		typeDefinition.Methods.Add(val);
		return val;
	}

	internal static void RefreshTraffic(AssemblyDefinition assembly)
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		ILProcessor iLProcessor = assembly.MainModule.GetType("PlanetTransport").AddMethod("RefreshTraffic", assembly.MainModule.TypeSystem.Void, (TypeReference[])(object)new TypeReference[1] { assembly.MainModule.TypeSystem.Int32 }).Body.GetILProcessor();
		iLProcessor.Emit(OpCodes.Ldarg_0);
		iLProcessor.Emit(OpCodes.Ldarg_1);
		MethodDefinition val = ((IEnumerable<MethodDefinition>)((IEnumerable<TypeDefinition>)assembly.MainModule.Types).First((TypeDefinition t) => ((MemberReference)t).FullName == "PlanetTransport").Methods).First((MethodDefinition m) => ((MemberReference)m).Name == "RefreshStationTraffic");
		iLProcessor.Emit(OpCodes.Call, (MethodReference)(object)val);
		iLProcessor.Emit(OpCodes.Ret);
	}

	internal static TypeDefinition Language(AssemblyDefinition assembly)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Expected O, but got Unknown
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Expected O, but got Unknown
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Expected O, but got Unknown
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Expected O, but got Unknown
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Expected O, but got Unknown
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Expected O, but got Unknown
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Expected O, but got Unknown
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		TypeDefinition val = new TypeDefinition("", "Language", (TypeAttributes)257, assembly.MainModule.ImportReference(typeof(Enum)));
		FieldAttributes val2 = (FieldAttributes)32854;
		val.Fields.Add(new FieldDefinition("value__", (FieldAttributes)1542, assembly.MainModule.TypeSystem.Int32));
		val.Fields.Add(new FieldDefinition("zhCN", val2, (TypeReference)(object)val)
		{
			Constant = 0
		});
		val.Fields.Add(new FieldDefinition("enUS", val2, (TypeReference)(object)val)
		{
			Constant = 1
		});
		val.Fields.Add(new FieldDefinition("frFR", val2, (TypeReference)(object)val)
		{
			Constant = 2
		});
		val.Fields.Add(new FieldDefinition("Max", val2, (TypeReference)(object)val)
		{
			Constant = 3
		});
		assembly.MainModule.Types.Add(val);
		TypeDefinition obj = ((IEnumerable<TypeDefinition>)assembly.MainModule.Types).First((TypeDefinition t) => ((MemberReference)t).FullName == "Localization");
		FieldDefinition val3 = new FieldDefinition("lang", (FieldAttributes)22, (TypeReference)(object)val);
		obj.Fields.Add(val3);
		MethodDefinition val4 = new MethodDefinition("get_language", (MethodAttributes)22, (TypeReference)(object)val);
		ILProcessor iLProcessor = val4.Body.GetILProcessor();
		iLProcessor.Emit(OpCodes.Ldsfld, (FieldReference)(object)val3);
		iLProcessor.Emit(OpCodes.Ret);
		obj.Methods.Add(val4);
		return val;
	}

	internal static void StringTranslate(AssemblyDefinition assembly, TypeDefinition enumType)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Expected O, but got Unknown
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Expected O, but got Unknown
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Expected O, but got Unknown
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Expected O, but got Unknown
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Expected O, but got Unknown
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		TypeDefinition val = new TypeDefinition("", "StringTranslate", (TypeAttributes)1, assembly.MainModule.TypeSystem.Object);
		assembly.MainModule.Types.Add(val);
		MethodDefinition val2 = new MethodDefinition("Translate", (MethodAttributes)22, assembly.MainModule.TypeSystem.String);
		((MethodReference)val2).Parameters.Add(new ParameterDefinition("s", (ParameterAttributes)0, assembly.MainModule.TypeSystem.String));
		val.Methods.Add(val2);
		ILProcessor iLProcessor = val2.Body.GetILProcessor();
		iLProcessor.Emit(OpCodes.Ldarg_0);
		MethodDefinition val3 = ((IEnumerable<MethodDefinition>)((IEnumerable<TypeDefinition>)assembly.MainModule.Types).First((TypeDefinition t) => ((MemberReference)t).FullName == "Localization").Methods).First((MethodDefinition m) => ((MemberReference)m).Name == "Translate");
		iLProcessor.Emit(OpCodes.Call, (MethodReference)(object)val3);
		iLProcessor.Emit(OpCodes.Ret);
		val2 = new MethodDefinition("Translate", (MethodAttributes)22, assembly.MainModule.TypeSystem.String);
		((MethodReference)val2).Parameters.Add(new ParameterDefinition("s", (ParameterAttributes)0, assembly.MainModule.TypeSystem.String));
		((MethodReference)val2).Parameters.Add(new ParameterDefinition("_", (ParameterAttributes)0, (TypeReference)(object)enumType));
		val.Methods.Add(val2);
		ILProcessor iLProcessor2 = val2.Body.GetILProcessor();
		iLProcessor2.Emit(OpCodes.Ldarg_0);
		val3 = ((IEnumerable<MethodDefinition>)((IEnumerable<TypeDefinition>)assembly.MainModule.Types).First((TypeDefinition t) => ((MemberReference)t).FullName == "Localization").Methods).First((MethodDefinition m) => ((MemberReference)m).Name == "Translate");
		iLProcessor2.Emit(OpCodes.Call, (MethodReference)(object)val3);
		iLProcessor2.Emit(OpCodes.Ret);
	}

	internal static void StringProto(AssemblyDefinition assembly)
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Expected O, but got Unknown
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Expected O, but got Unknown
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Expected O, but got Unknown
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: 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)
		TypeDefinition val = ((IEnumerable<TypeDefinition>)assembly.MainModule.Types).First((TypeDefinition t) => ((MemberReference)t).FullName == "Proto");
		TypeDefinition val2 = new TypeDefinition("", "StringProto", (TypeAttributes)1, assembly.MainModule.TypeSystem.Object)
		{
			BaseType = (TypeReference)(object)val
		};
		CustomAttribute val3 = new CustomAttribute(assembly.MainModule.ImportReference((MethodBase)typeof(SerializableAttribute).GetConstructor(Type.EmptyTypes)));
		val2.CustomAttributes.Add(val3);
		MethodDefinition val4 = new MethodDefinition(".ctor", (MethodAttributes)6150, assembly.MainModule.TypeSystem.Void);
		ILProcessor iLProcessor = val4.Body.GetILProcessor();
		iLProcessor.Emit(OpCodes.Ldarg_0);
		iLProcessor.Emit(OpCodes.Call, assembly.MainModule.ImportReference((MethodReference)(object)((IEnumerable<MethodDefinition>)val.Methods).First((MethodDefinition m) => ((MemberReference)m).Name == ".ctor")));
		iLProcessor.Emit(OpCodes.Ret);
		val2.Methods.Add(val4);
		assembly.MainModule.Types.Add(val2);
		val2.AddFied("ZHCN", assembly.MainModule.TypeSystem.String);
		val2.AddFied("ENUS", assembly.MainModule.TypeSystem.String);
		val2.AddFied("FRFR", assembly.MainModule.TypeSystem.String);
	}
}
public static class Preloader
{
	public static ManualLogSource logSource = Logger.CreateLogSource("ModFixerOne Preloader");

	public static IEnumerable<string> Guids;

	public static IEnumerable<string> TargetDLLs { get; } = new string[1] { "Assembly-CSharp.dll" };


	public static void Patch(AssemblyDefinition assembly)
	{
		ModifyMainGame(assembly);
	}

	public static void Finish()
	{
		RemoveProcessFiler();
	}

	private static void ModifyMainGame(AssemblyDefinition assembly)
	{
		try
		{
			assembly.MainModule.GetType("UIGame").AddFied("inventory", (TypeReference)(object)assembly.MainModule.GetType("UIStorageGrid"));
			logSource.LogDebug((object)"UIStorageGrid UIGame.inventory");
			assembly.MainModule.GetType("StationComponent").AddFied("name", assembly.MainModule.TypeSystem.String);
			logSource.LogDebug((object)"string StationComponent.name");
			Injection.RefreshTraffic(assembly);
			logSource.LogDebug((object)"void PlanetTransport.RefreshTraffic(int)");
			TypeDefinition enumType = Injection.Language(assembly);
			logSource.LogDebug((object)"enum Language { zhCN, enUS, frFR, Max }");
			logSource.LogDebug((object)"public static Language Localization.get_language()");
			Injection.StringTranslate(assembly, enumType);
			logSource.LogDebug((object)"public static string StringTranslate.Translate(this string s)");
			Injection.StringProto(assembly);
			logSource.LogDebug((object)"public StringProto");
		}
		catch (Exception ex)
		{
			logSource.LogError((object)"Error when patching!");
			logSource.LogError((object)ex);
		}
	}

	private static void RemoveProcessFiler()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Expected O, but got Unknown
		try
		{
			Harmony val = new Harmony("ModFixerOnePreloader");
			val.Patch((MethodBase)AccessTools.Method(typeof(TypeLoader), "FindPluginTypes", (Type[])null, (Type[])null).MakeGenericMethod(typeof(PluginInfo)), (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(Preloader), "PostFindPluginTypes", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)AccessTools.Method(typeof(Utility), "TopologicalSort", (Type[])null, (Type[])null).MakeGenericMethod(typeof(string)), (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(Preloader), "PostTopologicalSort", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
		catch (Exception ex)
		{
			logSource.LogError((object)"Remove process filter & change load order fail!");
			logSource.LogError((object)ex);
		}
	}

	private static void PostFindPluginTypes(Dictionary<string, List<PluginInfo>> __result)
	{
		try
		{
			int num = 0;
			foreach (List<PluginInfo> value in __result.Values)
			{
				foreach (PluginInfo item in value)
				{
					if (item.Processes.Any())
					{
						AccessTools.Property(typeof(PluginInfo), "Processes").SetValue(item, new List<BepInProcess>());
						num++;
					}
				}
			}
			logSource.LogDebug((object)$"Remove process filter from {num} plugins.");
		}
		catch (Exception ex)
		{
			logSource.LogWarning((object)"Can't remove process filter!");
			logSource.LogWarning((object)ex);
		}
	}

	private static void PostTopologicalSort(ref IEnumerable<string> __result)
	{
		IEnumerable<string> enumerable = __result.Where((string item) => item != "starfi5h.plugin.ModFixerOne");
		if (enumerable.Count() != __result.Count())
		{
			__result = new string[1] { "starfi5h.plugin.ModFixerOne" }.Concat(enumerable);
			logSource.LogDebug((object)"Move ModFixerOne to first plugin to load.");
		}
		Guids = __result;
	}
}

plugins/ModFixerOne.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using ModFixerOne.Mods;
using xiaoye97;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ModFixerOne")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.2.0")]
[assembly: AssemblyInformationalVersion("1.3.2")]
[assembly: AssemblyProduct("ModFixerOne")]
[assembly: AssemblyTitle("ModFixerOne")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.2.0")]
[module: UnverifiableCode]
namespace ModFixerOne
{
	public static class Common_Patch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameData), "Import")]
		public static void CheckAferImport()
		{
			if (GameMain.history.constructionDroneMovement > 4)
			{
				Plugin.Log.LogWarning((object)$"Drone Task Points fix: {GameMain.history.constructionDroneMovement} => 4");
				GameMain.history.constructionDroneMovement = 4;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Localization), "NotifyLanguageChange")]
		public static void SwitchLanguage()
		{
			try
			{
				FieldInfo fieldInfo = AccessTools.Field(typeof(Localization), "lang");
				if (fieldInfo != null)
				{
					object value = Enum.ToObject(fieldInfo.FieldType, (!Localization.isZHCN) ? 1 : 0);
					fieldInfo.SetValue(null, value);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
			}
		}

		public static IEnumerable<CodeInstruction> UIInventory_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			try
			{
				return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldfld && ((FieldInfo)i.operand).Name == "inventory"), (string)null)
				}).Repeat((Action<CodeMatcher>)delegate(CodeMatcher matcher)
				{
					matcher.SetAndAdvance(OpCodes.Ldfld, (object)AccessTools.Field(typeof(UIGame), "inventoryWindow"));
				}, (Action<string>)null).InstructionEnumeration();
			}
			catch (Exception)
			{
				Plugin.Log.LogWarning((object)"UIInventory_Transpiler fail!");
				return instructions;
			}
		}
	}
	public static class Fixer_Patch
	{
		public static string ErrorMessage = "";

		public static void OnAwake()
		{
			try
			{
				Harmony harmony = Plugin.Instance.Harmony;
				if (!IsVaild())
				{
					ErrorMessage = "Can't find injected fields or methods!\n Please make sure that ModFixerOnePreloader.dll is installed in BepInEx\\patchers.";
					Plugin.Log.LogWarning((object)ErrorMessage);
					harmony.PatchAll(typeof(Fixer_Patch));
				}
				else if (ErrorMessage != "")
				{
					ErrorMessage = "Error occurred when patching following mods:" + ErrorMessage;
					harmony.PatchAll(typeof(Fixer_Patch));
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
			}
		}

		public static void OnStart()
		{
			try
			{
				Harmony harmony = Plugin.Instance.Harmony;
				if (!IsVaild())
				{
					ErrorMessage = "Can't find injected fields or methods!\n Please make sure that ModFixerOnePreloader.dll is installed in BepInEx\\patchers.";
					Plugin.Log.LogWarning((object)ErrorMessage);
					harmony.PatchAll(typeof(Fixer_Patch));
					return;
				}
				harmony.PatchAll(typeof(Common_Patch));
				LDBTool_Patch.Init(harmony);
				if (ErrorMessage != "")
				{
					ErrorMessage = "Error occurred when patching following mods:" + ErrorMessage;
					harmony.PatchAll(typeof(Fixer_Patch));
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(VFPreload), "InvokeOnLoadWorkEnded")]
		internal static void InvokeOnLoadWorkEnded()
		{
			try
			{
				ShowMessageBox();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
			}
		}

		private static void ShowMessageBox()
		{
			UIMessageBox.Show("Mod Fixer One Error", ErrorMessage, Localization.Translate("确定"), 3);
		}

		private static bool IsVaild()
		{
			if (typeof(UIGame).GetField("inventory") == null)
			{
				return false;
			}
			if (typeof(PlanetTransport).GetMethod("RefreshTraffic") == null)
			{
				return false;
			}
			if (AccessTools.TypeByName("Language") == null)
			{
				return false;
			}
			if (AccessTools.TypeByName("StringTranslate") == null)
			{
				return false;
			}
			if (AccessTools.TypeByName("StringProto") == null)
			{
				return false;
			}
			return true;
		}
	}
	[BepInPlugin("starfi5h.plugin.ModFixerOne", "ModFixerOne", "1.3.2")]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "starfi5h.plugin.ModFixerOne";

		public const string NAME = "ModFixerOne";

		public const string VERSION = "1.3.2";

		public static ManualLogSource Log;

		public static Plugin Instance { get; private set; }

		public Harmony Harmony { get; private set; }

		public void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony = new Harmony("starfi5h.plugin.ModFixerOne");
			Fixer_Patch.OnAwake();
		}

		public void Start()
		{
			Fixer_Patch.OnStart();
		}

		[Conditional("DEBUG")]
		public void OnDestroy()
		{
			Harmony.UnpatchSelf();
			Harmony = null;
		}
	}
}
namespace ModFixerOne.Mods
{
	public static class LDBTool_Patch
	{
		private class Warper
		{
			[HarmonyPrefix]
			[HarmonyPatch(typeof(LDBTool), "PreAddProto", new Type[]
			{
				typeof(ProtoType),
				typeof(Proto)
			})]
			private static bool PreAddProto_Guard(ProtoType protoType)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Invalid comparison between Unknown and I4
				return (int)protoType != 7;
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(ProtoIndex), "GetAllProtoTypes")]
			private static void GetAllProtoTypes(ref Type[] __result)
			{
				if (__result[__result.Length - 1].FullName == "StringProto")
				{
					Plugin.Log.LogDebug((object)"Remove StringProto from LDBTool ProtoTypes array");
					Type[] array = new Type[__result.Length - 1];
					Array.Copy(__result, array, array.Length);
					__result = array;
				}
			}
		}

		public const string NAME = "LDBTool";

		public const string GUID = "me.xiaoye97.plugin.Dyson.LDBTool";

		public const string VERSION = "3.0.1";

		public static void Init(Harmony harmony)
		{
			if (!Chainloader.PluginInfos.TryGetValue("me.xiaoye97.plugin.Dyson.LDBTool", out var _))
			{
				return;
			}
			try
			{
				harmony.PatchAll(typeof(Warper));
				Plugin.Log.LogInfo((object)"LDBTool - OK");
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)"LDBTool - Fail! Last target version: 3.0.1");
				Fixer_Patch.ErrorMessage += "\nLDBTool (last target version: 3.0.1)";
				Plugin.Log.LogDebug((object)ex);
			}
		}
	}
	public static class Nebula_Patch
	{
		private static class Warper
		{
		}

		public const string NAME = "NebulaMultiplayerMod";

		public const string GUID = "dsp.nebula-multiplayer";

		public const string VERSION = "0.9.0";

		public static void OnAwake(Harmony harmony)
		{
			Preloader.Guids.Contains("dsp.nebula-multiplayer");
		}
	}
}