Decompiled source of DriverSkin v1.0.0

DriverSkin.dll

Decompiled a day 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.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using ModelReplacement;
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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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 DriverSkin
{
	public class MRDRIVERSKIN : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			Assets.PopulateAssets();
			if ((Object)(object)Assets.MainAssetBundle == (Object)null)
			{
				return null;
			}
			GameObject obj = Assets.MainAssetBundle.LoadAsset<GameObject>("DriverSkin");
			if ((Object)(object)obj == (Object)null)
			{
				Plugin.Log.LogError((object)"Prefab 'DriverSkin' not found in bundle");
			}
			return obj;
		}
	}
	[BepInPlugin("cambonium.DriverSkin", "DriverSkin", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log { get; private set; }

		public static ConfigEntry<string> SuitNames { get; private set; }

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			SuitNames = ((BaseUnityPlugin)this).Config.Bind<string>("Suits to Replace Settings", "Suits to enable Model for", "DriverSkin", "Comma-separated suit names (MoreSuits suit = png name in the moresuits folder).");
			Assets.PopulateAssets();
			string[] array = SuitNames.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries);
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].Trim();
				if (text.Length != 0)
				{
					ModelReplacementAPI.RegisterSuitModelReplacement(text, typeof(MRDRIVERSKIN));
					Log.LogInfo((object)("Registered DriverSkin model for suit '" + text + "'"));
				}
			}
			Log.LogInfo((object)"DriverSkin v1.0.0 loaded");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "cambonium.DriverSkin";

		public const string PLUGIN_NAME = "DriverSkin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	public static class Assets
	{
		public const string AssetBundleName = "driverskin";

		public static AssetBundle MainAssetBundle { get; private set; }

		public static void PopulateAssets()
		{
			if (!((Object)(object)MainAssetBundle != (Object)null))
			{
				string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "driverskin");
				if (File.Exists(text))
				{
					MainAssetBundle = AssetBundle.LoadFromFile(text);
				}
				if ((Object)(object)MainAssetBundle == (Object)null)
				{
					Plugin.Log.LogError((object)("Failed to load asset bundle 'driverskin' from " + text));
				}
				else
				{
					Plugin.Log.LogInfo((object)("Loaded asset bundle: " + text));
				}
			}
		}
	}
}