Decompiled source of AllSongs v1.0.0

plugins/AllSongs.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.IO;
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 Microsoft.CodeAnalysis;
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: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("AllSongs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Changes your \"all songs\" collection button")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AllSongs")]
[assembly: AssemblyTitle("AllSongs")]
[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 AllSongs
{
	[BepInPlugin("AllSongs", "AllSongs", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(LevelSelectController), "Start")]
		public static class LevelSelectStartPatches
		{
			[HarmonyPriority(0)]
			public static void Postfix()
			{
				OverwriteAllSongs();
			}
		}

		[HarmonyPatch(typeof(LevelSelectController), "selectNewCollection")]
		public static class LevelSelectSelectCollectionPatches
		{
			[HarmonyPriority(0)]
			public static void Postfix()
			{
				OverwriteAllSongs();
			}
		}

		internal static Plugin Instance;

		internal static ManualLogSource Log;

		public void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("AllSongs").PatchAll();
		}

		private static void OverwriteAllSongs()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			if (GlobalVariables.all_track_collections.Count > GlobalVariables.chosen_collection_index && !(GlobalVariables.all_track_collections[GlobalVariables.chosen_collection_index]._unique_id != "all"))
			{
				GameObject val = GameObject.Find("MainCanvas/FullScreenPanel/btn_COLLECTIONS/img_albumshadow");
				GameObject gameObject = ((Component)val.transform.Find("img_albumtop")).gameObject;
				Image component = gameObject.GetComponent<Image>();
				component.useSpriteMesh = true;
				((Graphic)component).color = Color.white;
				byte[] array = File.ReadAllBytes(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location) + "/Assets/all_songs.png");
				Texture2D val2 = new Texture2D(0, 0);
				ImageConversion.LoadImage(val2, array);
				component.sprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), Vector2.zero, 300f);
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "AllSongs";

		public const string PLUGIN_NAME = "AllSongs";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}