Decompiled source of VBCan v1.0.0

KlutzyBubbles-VBCan.dll

Decompiled a year 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;

[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("KlutzyBubbles-VBCan")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Replaces the red soda can with a vb can")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c8e87d8707ca93fe12408205bdb6ec0e04c135d6")]
[assembly: AssemblyProduct("KlutzyBubbles-VBCan")]
[assembly: AssemblyTitle("KlutzyBubbles-VBCan")]
[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 VBCan
{
	internal class Patches
	{
		[HarmonyPatch(typeof(GrabbableObject), "SetScrapValue")]
		[HarmonyPostfix]
		private static void SetScrapValuePatch(GrabbableObject __instance)
		{
			if (__instance.itemProperties.itemName == "Red soda" && (Object)(object)__instance.mainObjectRenderer != (Object)null)
			{
				Material[] materials = ((Renderer)__instance.mainObjectRenderer).materials;
				for (int i = 0; i < materials.Length; i++)
				{
					materials[i].mainTexture = (Texture)(object)Plugin.texture;
				}
			}
		}
	}
	[BepInPlugin("KlutzyBubbles-VBCan", "KlutzyBubbles-VBCan", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Texture2D texture;

		public static ManualLogSource StaticLogger;

		private void Awake()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			StaticLogger = ((BaseUnityPlugin)this).Logger;
			try
			{
				string path = Directory.GetFiles(Path.Combine(Paths.PluginPath, "KlutzyBubbles-VBCan"), "vb.png")[0];
				texture = new Texture2D(2, 2);
				ImageConversion.LoadImage(texture, File.ReadAllBytes(path));
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Unable to load VB can texture with error: " + ex.Message));
			}
			new Harmony("KlutzyBubbles-VBCan").PatchAll(typeof(Patches));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin KlutzyBubbles-VBCan is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "KlutzyBubbles-VBCan";

		public const string PLUGIN_NAME = "KlutzyBubbles-VBCan";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}