Decompiled source of LethalLogoMod v1.0.0

plugins/Ashk3000-LethalLogoMod/LethalLogoMod.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
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: AssemblyTitle("LethalLogoMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalLogoMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bee81a15-23f9-448c-ae11-c0d7f50d816a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LethalLogoMod;

[BepInPlugin("com.ashk3000.LethalLogoMod", "Lethal Logo Mod", "1.0.0")]
public class LethalLogoMod : BaseUnityPlugin
{
	public const string modGUID = "com.ashk3000.LethalLogoMod";

	public const string modName = "Lethal Logo Mod";

	public const string modVersion = "1.0.0";

	public static ConfigEntry<string> imagePath;

	private readonly Harmony harmony = new Harmony("com.ashk3000.LethalLogoMod");

	private void Awake()
	{
		string text = Path.Combine(Paths.ConfigPath, "logo.png");
		imagePath = ((BaseUnityPlugin)this).Config.Bind<string>("File", "ImagePath", text, "Location of the logo. Its best with a 545 by 249 transparent PNG with no anti-aliasing.");
		string text2 = Path.Combine(Paths.PluginPath, "Ashk3000-LethalLogoMod", "default.png");
		if (imagePath.Value == text && !File.Exists(imagePath.Value) && File.Exists(text2))
		{
			File.Copy(text2, text);
		}
		harmony.PatchAll(typeof(MenuManagerPatch));
	}
}
[HarmonyPatch(typeof(MenuManager))]
internal class MenuManagerPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	private static void Postfix()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Expected O, but got Unknown
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)GameObject.Find("HeaderImage") != (Object)null && File.Exists(LethalLogoMod.imagePath.Value))
		{
			Texture2D val = new Texture2D(545, 249, (TextureFormat)4, false);
			byte[] array = File.ReadAllBytes(LethalLogoMod.imagePath.Value);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)0;
			Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(272.5f, 124.5f), 100f);
			GameObject.Find("HeaderImage").GetComponent<Image>().sprite = sprite;
		}
	}
}