Decompiled source of DefaultGameName v0.0.0

DefaultGameName.dll

Decompiled 4 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
using VoidManager.Utilities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("DefaultGameName")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DefaultGameName")]
[assembly: AssemblyTitle("DefaultGameName")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DefaultGameName
{
	internal static class MyPluginInfo
	{
		internal const string PLUGIN_GUID = "id107.defaultgamename";

		internal const string PLUGIN_NAME = "DefaultGameName";

		internal const string PLUGIN_VERSION = "0.0.0";
	}
	[BepInPlugin("id107.defaultgamename", "DefaultGameName", "0.0.0")]
	[BepInProcess("Void Crew.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BepinPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "id107.defaultgamename");
			Configs.Load(this);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin id107.defaultgamename is loaded!");
		}
	}
	internal class Configs
	{
		internal static ConfigEntry<string> GameNameConfig;

		internal static void Load(BepinPlugin plugin)
		{
			GameNameConfig = ((BaseUnityPlugin)plugin).Config.Bind<string>("DefaultGameName", "GameName", "Custom Name Room", (ConfigDescription)null);
		}
	}
	internal class GUI : ModSettingsMenu
	{
		public override string Name()
		{
			return "Default Game Name";
		}

		public override void Draw()
		{
			GUITools.DrawTextField<string>("Game Name", ref Configs.GameNameConfig, 80f);
		}
	}
	[HarmonyPatch]
	internal class HostGameNamePatchPatch
	{
		internal static bool SetName;

		[HarmonyTargetMethod]
		private static MethodBase GetMethod()
		{
			return AccessTools.Method(AccessTools.TypeByName("VoidManager.MPModChecks.HostGameNamePatch"), "SetGameName", new Type[1] { typeof(string) }, (Type[])null);
		}

		[HarmonyPrefix]
		private static void SetGameName(ref string name)
		{
			if (SetName)
			{
				SetName = false;
				name = Configs.GameNameConfig.Value;
			}
		}
	}
	[HarmonyPatch(typeof(PhotonService))]
	internal class PhotonServicePatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("PhotonCreateRoom")]
		private static void PhotonCreateRoom()
		{
			HostGameNamePatchPatch.SetName = true;
		}
	}
	public class VoidManagerPlugin : VoidPlugin
	{
		public override MultiplayerType MPType => (MultiplayerType)3;

		public override string Author => "18107";

		public override string Description => "Changes the default game name";
	}
}