Decompiled source of BarberMaterialTweaks v1.1.1

BarberMaterialTweaks.dll

Decompiled a week 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("BarberMaterialTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Tweaks and fixes for the Barber's materials")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ca68c33ab84db165555453e04dc3bed5eed60642")]
[assembly: AssemblyProduct("BarberMaterialTweaks")]
[assembly: AssemblyTitle("BarberMaterialTweaks")]
[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 BarberMaterialTweaks
{
	[BepInPlugin("dopadream.lethalcompany.BarberMaterialTweaks", "BarberMaterialTweaks", "1.1.1")]
	[BepInIncompatibility("dopadream.lethalcompany.ClaySurgeonMod")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch]
		private class BarberMaterialTweaksPatches
		{
			[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
			[HarmonyPatch(typeof(ClaySurgeonAI), "Awake")]
			[HarmonyPostfix]
			private static void ClaySurgeonAIPostStart(ClaySurgeonAI __instance, ref Material ___thisMaterial)
			{
				___thisMaterial = Object.Instantiate<Material>(clayTex);
				((Renderer)__instance.scissorBlades[0]).sharedMaterial = ___thisMaterial;
				((Renderer)__instance.scissorBlades[1]).sharedMaterial = ___thisMaterial;
				((Renderer)__instance.skin).sharedMaterial = ___thisMaterial;
			}
		}

		private const string PLUGIN_GUID = "dopadream.lethalcompany.BarberMaterialTweaks";

		private const string PLUGIN_NAME = "BarberMaterialTweaks";

		private const string PLUGIN_VERSION = "1.1.1";

		internal static ManualLogSource Logger;

		internal static Material clayTex;

		private void Awake()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			try
			{
				AssetBundle obj = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "BarberMaterialTweaks"));
				Object obj2 = obj.LoadAsset("ScissorGuyTex 1", typeof(Material));
				clayTex = (Material)(object)((obj2 is Material) ? obj2 : null);
				obj.Unload(false);
			}
			catch
			{
				Logger.LogError((object)"Encountered some error loading asset bundle. Did you install the plugin correctly?");
				return;
			}
			new Harmony("dopadream.lethalcompany.BarberMaterialTweaks").PatchAll();
			Logger.LogInfo((object)"BarberMaterialTweaks v1.1.1 loaded");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BarberMaterialTweaks";

		public const string PLUGIN_NAME = "BarberMaterialTweaks";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}