Decompiled source of Cherrypicked TouhouPlayerModels v0.1.1

BepInEx/plugins/Touhou LC Build.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Touhou LC Build")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Touhou LC Build")]
[assembly: AssemblyTitle("Touhou LC Build")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ModelReplacement
{
	public class MRMAI : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Mai";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRMARISA : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Marisa";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRMAYUMI : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Mayumi";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRPATCHOULI : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Patchouli";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRMOKOU : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Mokou";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRYOSHIKA : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Yoshika";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRSEKIBANKI : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Sekibanki";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRYUKARI : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Yukari";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRNITORI : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Nitori";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRCIRNO : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Cirno";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRYUYUKO : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Yuyuko";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRSUIKA : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Suika";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	[BepInPlugin("legonzaur.better_touhou_models", "better_touhou_models", "0.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			Assets.PopulateAssets();
			ModelReplacementAPI.RegisterSuitModelReplacement("Cirno", typeof(MRCIRNO));
			ModelReplacementAPI.RegisterSuitModelReplacement("Mai", typeof(MRMAI));
			ModelReplacementAPI.RegisterSuitModelReplacement("Marisa", typeof(MRMARISA));
			ModelReplacementAPI.RegisterSuitModelReplacement("Mayumi", typeof(MRMAYUMI));
			ModelReplacementAPI.RegisterSuitModelReplacement("Mokou", typeof(MRMOKOU));
			ModelReplacementAPI.RegisterSuitModelReplacement("Nitori", typeof(MRNITORI));
			ModelReplacementAPI.RegisterSuitModelReplacement("Patchouli", typeof(MRPATCHOULI));
			ModelReplacementAPI.RegisterSuitModelReplacement("Sekibanki", typeof(MRSEKIBANKI));
			ModelReplacementAPI.RegisterSuitModelReplacement("Suika", typeof(MRSUIKA));
			ModelReplacementAPI.RegisterSuitModelReplacement("Yoshika", typeof(MRYOSHIKA));
			ModelReplacementAPI.RegisterSuitModelReplacement("Yukari", typeof(MRYUKARI));
			ModelReplacementAPI.RegisterSuitModelReplacement("Yuyuko", typeof(MRYUYUKO));
			Harmony val = new Harmony("legonzaur.better_touhou_models");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin legonzaur.better_touhou_models is loaded!");
		}
	}
	public static class Assets
	{
		public static string mainAssetBundleName = "templatebundle";

		public static AssetBundle MainAssetBundle = null;

		private static string GetAssemblyName()
		{
			return Assembly.GetExecutingAssembly().GetName().Name.Replace(" ", "_");
		}

		public static void PopulateAssets()
		{
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				Console.WriteLine(GetAssemblyName() + "." + mainAssetBundleName);
				using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName);
				MainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}