Decompiled source of SkipPassword v1.0.0

BepInEx\plugins\SkipPassword.dll

Decompiled a day 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 Steamworks;
using Steamworks.Data;
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("SkipPassword")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SkipPassword")]
[assembly: AssemblyTitle("SkipPassword")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 SkipPassword
{
	[BepInPlugin("com.riggola.skippassword", "SkipPassword", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.riggola.skippassword";

		public const string PluginName = "SkipPassword";

		public const string PluginVersion = "1.0.0";

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("com.riggola.skippassword").PatchAll(typeof(SkipHostPasswordPatch));
			Log.LogInfo((object)"SkipPassword v1.0.0 loaded");
		}
	}
	[HarmonyPatch(typeof(MenuPagePassword), "Start")]
	internal static class SkipHostPasswordPatch
	{
		private static readonly FieldRef<SteamManager, Lobby> CurrentLobbyRef = AccessTools.FieldRefAccess<SteamManager, Lobby>("currentLobby");

		[HarmonyPostfix]
		private static void AutoSkipWhenHosting(MenuPagePassword __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)SteamManager.instance == (Object)null))
			{
				Lobby val = CurrentLobbyRef.Invoke(SteamManager.instance);
				SteamId id = ((Lobby)(ref val)).Id;
				if (!((SteamId)(ref id)).IsValid)
				{
					Plugin.Log.LogInfo((object)"Hosting detected - auto-skipping password popup");
					__instance.ConfirmButton();
				}
			}
		}
	}
}