Decompiled source of ActualPrinterIcon v1.0.1

plugins/viliger-ActualPrinterIcon/ActualPrinterIcon.dll

Decompiled 3 months ago
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 HG.Reflection;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ActualPrinterIcon")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ActualPrinterIcon")]
[assembly: AssemblyTitle("ActualPrinterIcon")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace RoR2_PrintersIcon;

[BepInPlugin("com.Viliger.ActualPrinterIcon", "ActualPrinterIcon", "1.0.1")]
public class ActualPrinterIcon : BaseUnityPlugin
{
	public void Awake()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		Sprite sprite = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "actualprintericon")).LoadAsset<Sprite>("texDuplicatorIconOutline");
		AddPingInfoOverride(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Duplicator/Duplicator.prefab").WaitForCompletion(), sprite);
		AddPingInfoOverride(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/DuplicatorLarge/DuplicatorLarge.prefab").WaitForCompletion(), sprite);
		AddPingInfoOverride(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/DuplicatorMilitary/DuplicatorMilitary.prefab").WaitForCompletion(), sprite);
		AddPingInfoOverride(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/DuplicatorWild/DuplicatorWild.prefab").WaitForCompletion(), sprite);
	}

	private void AddPingInfoOverride(GameObject duplicator, Sprite sprite)
	{
		if (Object.op_Implicit((Object)(object)duplicator))
		{
			duplicator.AddComponent<PingInfoProvider>().pingIconOverride = sprite;
		}
	}
}