Decompiled source of Gen2Replacement v0.0.5

Genshin2Replace.dll

Decompiled 10 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 BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ModelReplacement;
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("Genshin2Replace")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Genshin2Replace")]
[assembly: AssemblyTitle("Genshin2Replace")]
[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 GenshinModelReplacement
{
	public class NahidaReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Nahida";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void AddModelScripts()
		{
			base.UseNoPostProcessing = true;
		}
	}
	public class PaimonReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Paimon";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void AddModelScripts()
		{
			base.UseNoPostProcessing = true;
		}
	}
	public class BuffPaimonReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Buff Paimon";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void AddModelScripts()
		{
			base.UseNoPostProcessing = true;
		}
	}
	public class XingquiReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Xingqui";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void AddModelScripts()
		{
			base.UseNoPostProcessing = true;
		}
	}
	public class BaizhuReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Bishu";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void AddModelScripts()
		{
			base.UseNoPostProcessing = true;
		}
	}
	public class ChongyunReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Chongyun";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void AddModelScripts()
		{
			base.UseNoPostProcessing = true;
		}
	}
	public class KleeReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Klee";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void AddModelScripts()
		{
			base.UseNoPostProcessing = true;
		}
	}
	public class DionaReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Diona";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void AddModelScripts()
		{
			base.UseNoPostProcessing = true;
		}
	}
	public class LumineReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Lumine";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void AddModelScripts()
		{
			base.UseNoPostProcessing = true;
		}
	}
	public class AyayaReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Ayaka alt";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void AddModelScripts()
		{
			base.UseNoPostProcessing = true;
		}
	}
	[BepInPlugin("Tissa.GenshinModelReplacement", "Paimon Black Company", "0.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigFile config;

		public void InitConfig()
		{
		}

		private void Awake()
		{
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			config = ((BaseUnityPlugin)this).Config;
			InitConfig();
			Assets.PopulateAssets();
			ModelReplacementAPI.RegisterSuitModelReplacement("Nahida", typeof(NahidaReplacement));
			ModelReplacementAPI.RegisterSuitModelReplacement("Paimon", typeof(PaimonReplacement));
			ModelReplacementAPI.RegisterSuitModelReplacement("Buff Paimon", typeof(BuffPaimonReplacement));
			ModelReplacementAPI.RegisterSuitModelReplacement("Xingqui", typeof(XingquiReplacement));
			ModelReplacementAPI.RegisterSuitModelReplacement("Baizhu", typeof(BaizhuReplacement));
			ModelReplacementAPI.RegisterSuitModelReplacement("Klee", typeof(KleeReplacement));
			ModelReplacementAPI.RegisterSuitModelReplacement("Diona", typeof(DionaReplacement));
			ModelReplacementAPI.RegisterSuitModelReplacement("Chongyun", typeof(ChongyunReplacement));
			ModelReplacementAPI.RegisterSuitModelReplacement("Lumine", typeof(LumineReplacement));
			ModelReplacementAPI.RegisterSuitModelReplacement("Ayaka alt", typeof(AyayaReplacement));
			Harmony val = new Harmony("Tissa.GenshinModelReplacement");
			val.PatchAll();
		}
	}
	public static class Assets
	{
		public static string mainAssetBundleName = "g2bundle";

		public static AssetBundle MainAssetBundle = null;

		private static string GetAssemblyName()
		{
			return Assembly.GetExecutingAssembly().GetName().Name;
		}

		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)
		{
		}
	}
}