Decompiled source of AlwaysBackpack v0.0.2

AlwaysBackpack.dll

Decompiled a week 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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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: AssemblyCompany("AlwaysBackpack")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("AlwaysBackpack")]
[assembly: AssemblyTitle("AlwaysBackpack")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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 AlwaysBackpack
{
	[HarmonyPatch(typeof(PlayerItemManager))]
	public static class PlayerItemManagerUpdatePatch
	{
		private static bool _backpackLoaded;

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		public static void Update(PlayerItemManager __instance)
		{
			if (_backpackLoaded)
			{
				if (Input.GetKeyDown((KeyCode)98))
				{
					_backpackLoaded = false;
				}
			}
			else if (Object.op_Implicit((Object)(object)__instance) && Object.op_Implicit((Object)(object)TerminalManager.instance) && Object.op_Implicit((Object)(object)TerminalManager.instance.activeStation))
			{
				__instance.ChangeInventorySize(Plugin.GetInstance().GetInventorySize());
				Plugin.GetInstance().GetLogger().LogInfo((object)$"Changed inventory size to {Plugin.GetInstance().GetInventorySize()}");
				_backpackLoaded = true;
			}
		}
	}
	[BepInPlugin("AlwaysBackpack", "AlwaysBackpack", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private static Plugin _instance;

		private ConfigEntry<int> _configInventorySize;

		private void Awake()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			if ((Object)(object)_instance != (Object)null)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			_instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"You suddenly feel like you have a permanent backpack.");
			_configInventorySize = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "InventorySize", 7, "The size of the inventory");
			Harmony val = new Harmony("AlwaysBackpack");
			val.PatchAll();
		}

		public static Plugin GetInstance()
		{
			return _instance;
		}

		public ManualLogSource GetLogger()
		{
			return Logger;
		}

		public int GetInventorySize()
		{
			return _configInventorySize.Value;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "AlwaysBackpack";

		public const string PLUGIN_NAME = "AlwaysBackpack";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}