Decompiled source of MoreRevamp v1.0.1

MoreRevamp.dll

Decompiled 4 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoreRevamp")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d0362a7946d8bf72407c094189ee19adef3eba60")]
[assembly: AssemblyProduct("MoreRevamp")]
[assembly: AssemblyTitle("MoreRevamp")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace MoreRevamp
{
	[BepInPlugin("com.github.end-4.moreRevamp", "MoreRevamp", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		public static Sprite? SourceSprite;

		public static float SourcePPU;

		public static string SOURCE_BUTTON_NAME = "Border";

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("MoreRevamp").PatchAll();
			Log.LogInfo((object)"Patches applied");
		}

		private void Update()
		{
			if (!((Object)(object)SourceSprite != (Object)null))
			{
				GameObject obj = GameObject.Find(SOURCE_BUTTON_NAME);
				Image val = ((obj != null) ? obj.GetComponent<Image>() : null);
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val.sprite == (Object)null))
				{
					SourceSprite = val.sprite;
					SourcePPU = val.pixelsPerUnitMultiplier * 7f / 4f;
				}
			}
		}
	}
	[HarmonyPatch(typeof(Image), "OnEnable")]
	public static class ImagePatch
	{
		[HarmonyPostfix]
		public static void Postfix(Image __instance)
		{
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Plugin.SourceSprite == (Object)null))
			{
				GameObject gameObject = ((Component)__instance).gameObject;
				string text = ((Object)gameObject).name;
				while ((Object)(object)gameObject.transform.parent != (Object)null)
				{
					gameObject = ((Component)gameObject.transform.parent).gameObject;
					text = ((Object)gameObject).name + "/" + text;
				}
				string text2 = ((Object)__instance).name.ToLower();
				if ((!((Object)(object)((Component)__instance).GetComponent<HudOpenEffect>() != (Object)null) || ((Object)(object)((Component)__instance).GetComponent<Button>() != (Object)null && text.Contains("Skippables"))) && !text2.Contains("upvote") && !text2.Contains("downvote") && !text2.Contains("thumbnail") && ((((Object)__instance).name == "Border" && text.Contains("ConfigurationMenu(Clone)")) || ((Object)(object)((Component)__instance).GetComponent<Button>() != (Object)null && (text.Contains("ConcretePanel(Clone)") || text.Contains("PresetPanel(Clone)") || text.Contains("PluginConfigField") || text.Contains("Skippables"))) || ((Object)__instance).name == "RankIcon(Clone)" || ((Object)__instance).name == "SearchBar(Clone)"))
				{
					RectTransform rectTransform = ((Graphic)__instance).rectTransform;
					Vector2 sizeDelta = rectTransform.sizeDelta;
					Color color = ((Graphic)__instance).color;
					__instance.sprite = Plugin.SourceSprite;
					__instance.pixelsPerUnitMultiplier = Plugin.SourcePPU;
					rectTransform.sizeDelta = sizeDelta;
					((Graphic)__instance).color = color;
				}
			}
		}
	}
}