Decompiled source of Watermark v1.1.1

LBoL-AddWatermark.dll

Decompiled a year 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.Logging;
using HarmonyLib;
using LBoL.Presentation.UI.Panels;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("LBoL.Base")]
[assembly: IgnoresAccessChecksTo("LBoL.ConfigData")]
[assembly: IgnoresAccessChecksTo("LBoL.Core")]
[assembly: IgnoresAccessChecksTo("LBoL.EntityLib")]
[assembly: IgnoresAccessChecksTo("LBoL.Presentation")]
[assembly: IgnoresAccessChecksTo("Untitled.ConfigDataBuilder.Base")]
[assembly: AssemblyCompany("LBoL-AddWatermark")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LBoL-AddWatermark")]
[assembly: AssemblyTitle("LBoL-AddWatermark")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AddWatermark
{
	public class API
	{
		public const string GUID = "neo.lbol.tools.watermark";

		public static void ActivateWatermark()
		{
			Plugin.activateWatermark = true;
			if ((Object)(object)Plugin.watermarkRef != (Object)null)
			{
				Plugin.watermarkRef.SetActive(true);
			}
		}
	}
	[BepInPlugin("neo.lbol.tools.watermark", "Add MODDED watermark", "1.1.1")]
	[BepInProcess("LBoL.exe")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(SystemBoard), "OnEnterGameRun")]
		private class SystemBoard_Patch
		{
			public static void Postfix(SystemBoard __instance)
			{
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Expected O, but got Unknown
				//IL_0149: 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)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					Transform parent = ((Component)__instance.gameVersion).gameObject.transform.parent;
					int num = 0;
					GameObject val = null;
					float? num2 = null;
					foreach (Transform item in ((Component)parent).transform)
					{
						Transform val2 = item;
						if (((Component)val2).gameObject.activeSelf && ((Object)((Component)val2).gameObject).name != "Hint")
						{
							num++;
							if (!num2.HasValue)
							{
								num2 = val2.localPosition.y;
							}
						}
						if (((Object)((Component)val2).gameObject).name == "watermark")
						{
							val = ((Component)val2).gameObject;
						}
					}
					if ((Object)(object)val == (Object)null)
					{
						val = Object.Instantiate<GameObject>(((Component)__instance.gameVersion).gameObject, ((Component)parent).transform);
						((Object)val).name = "watermark";
						TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
						((TMP_Text)component).text = "MODDED";
						val.transform.SetAsLastSibling();
						val.transform.localPosition = new Vector3(val.transform.localPosition.x, num2.Value - (float)(num * 50), 0f);
						val.SetActive(activateWatermark);
					}
					watermarkRef = val;
				}
				catch (Exception ex)
				{
					log.LogError((object)ex);
				}
			}
		}

		public const string version = "1.1.1";

		private static readonly Harmony harmony = new Harmony("neo.lbol.tools.watermark");

		internal static ManualLogSource log;

		internal static GameObject watermarkRef = null;

		internal static bool activateWatermark = false;

		private void Awake()
		{
			log = ((BaseUnityPlugin)this).Logger;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			harmony.PatchAll();
		}

		private void OnDestroy()
		{
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}