Decompiled source of StopFoodDecay Updated v2.1.0

plugins/StopFoodDecay.dll

Decompiled 3 days 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("StopFoodDecay")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StopFoodDecay")]
[assembly: AssemblyTitle("StopFoodDecay")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 StopFoodDecay
{
	[BepInPlugin("com.stopfooddecay.mod", "Stop Food Decay", "2.1.0")]
	public class StopFoodDecayMod : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Item), "OnAwake")]
		private class Item_OnAwake_Patch
		{
			private static void Postfix(Item __instance)
			{
				RemovePerishable(__instance);
			}
		}

		public const string GUID = "com.stopfooddecay.mod";

		public const string NAME = "Stop Food Decay";

		public const string VERSION = "2.1.0";

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("com.stopfooddecay.mod").PatchAll();
			Item[] array = Object.FindObjectsOfType<Item>();
			for (int i = 0; i < array.Length; i++)
			{
				RemovePerishable(array[i]);
			}
			((BaseUnityPlugin)this).Logger.LogMessage((object)"Stop Food Decay v2.1.0 loaded successfully!");
		}

		private static void RemovePerishable(Item item)
		{
			if (!((Object)(object)item == (Object)null))
			{
				Perishable component = ((Component)item).GetComponent<Perishable>();
				if ((Object)(object)component != (Object)null)
				{
					Object.Destroy((Object)(object)component);
				}
			}
		}
	}
}