Decompiled source of ModList v1.0.1

ModList.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI;
using RoR2;
using RoR2.UI;
using UnityEngine;

[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("com.riskofresources.ModList")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Lists loaded mods at the end of a run")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+ffab8bdccea881bf724cdeb9dc05d185c7d0bae9")]
[assembly: AssemblyProduct("com.riskofresources.ModList")]
[assembly: AssemblyTitle("com.riskofresources.ModList")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 ModList
{
	[BepInPlugin("com.riskofresources.ModList", "com.riskofresources.ModList", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.riskofresources.ModList is loaded!");
			GameEndReportPanelController.SetDisplayData += new hook_SetDisplayData(RunReportOnGenerate);
		}

		private void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			GameEndReportPanelController.SetDisplayData -= new hook_SetDisplayData(RunReportOnGenerate);
		}

		private void RunReportOnGenerate(orig_SetDisplayData orig, GameEndReportPanelController self, DisplayData newDisplayData)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			LogPlugins();
			orig.Invoke(self, newDisplayData);
		}

		private static void LogPlugins()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)ConsoleWindow.instance))
			{
				Object.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/UI/ConsoleWindow")).GetComponent<ConsoleWindow>();
			}
			int prevMaxMessages = Console.maxMessages.value;
			int num2 = (Console.maxMessages.value = 2 * (Chainloader.PluginInfos.Count + 1) + prevMaxMessages);
			int newMaxMessageValue = num2;
			Console.SaveArchiveConVars += new hook_SaveArchiveConVars(ConsoleOnSaveArchiveConVars);
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine();
			stringBuilder.AppendLine("---- Loaded Plugins ----");
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				stringBuilder.AppendLine(((object)pluginInfo.Value).ToString());
			}
			Debug.Log((object)stringBuilder.ToString());
			void ConsoleOnSaveArchiveConVars(orig_SaveArchiveConVars orig, Console self)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Expected O, but got Unknown
				if (Console.maxMessages.value == newMaxMessageValue)
				{
					Console.maxMessages.value = prevMaxMessages;
				}
				orig.Invoke(self);
				Console.SaveArchiveConVars -= new hook_SaveArchiveConVars(ConsoleOnSaveArchiveConVars);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.riskofresources.ModList";

		public const string PLUGIN_NAME = "com.riskofresources.ModList";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}