Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of NameFix v1.0.1
plugins/NameFix.dll
Decompiled 2 years agousing System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using GameNetcodeStuff; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("NameFix")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NameFix")] [assembly: AssemblyCopyright("Copyright © BlueAmulet 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9a85f7c4-c974-4bff-b83a-5cbcde42b246")] [assembly: AssemblyFileVersion("1.0.1")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.1.0")] namespace NameFix { [BepInPlugin("BlueAmulet.NameFix", "NameFix", "1.0.1")] public class NameFix : BaseUnityPlugin { internal const string Name = "NameFix"; internal const string Author = "BlueAmulet"; internal const string ID = "BlueAmulet.NameFix"; internal const string Version = "1.0.1"; public void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Harmony val = new Harmony("BlueAmulet.NameFix"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Applying Harmony patches"); val.PatchAll(Assembly.GetExecutingAssembly()); int num = 0; foreach (MethodBase patchedMethod in val.GetPatchedMethods()) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched " + patchedMethod.DeclaringType.Name + "." + patchedMethod.Name)); num++; } ((BaseUnityPlugin)this).Logger.LogInfo((object)(num + " patches applied")); } public static string NoPunctuation(string input) { return new string(input.Where((char c) => char.IsLetterOrDigit(c) || c == '_').ToArray()); } } } namespace NameFix.Patches { [HarmonyPatch] internal static class NameSanitizePatch { [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "NoPunctuation")] public static bool Prefix1(ref string __result, string input) { __result = NameFix.NoPunctuation(input); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(GameNetworkManager), "NoPunctuation")] public static bool Prefix2(ref string __result, string input) { __result = NameFix.NoPunctuation(input); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "NoPunctuation")] public static bool Prefix3(ref string __result, string input) { __result = NameFix.NoPunctuation(input); return false; } } }