Decompiled source of Draven VRMs v1.0.3

BepInEx/plugins/Draven_VRMs/DravenVRMHelper.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;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("Draven")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Helper plugin to copy VRMs to game root.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("DravenVRMHelper")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace DravenVRMHelper;

[BepInPlugin("DravenVRMHelper", "My first plugin", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"My first plugin 1.0.0 is loading...");
		string targetPath = Path.Combine(Paths.GameRootPath, "VRMs");
		string[] array = new string[3]
		{
			Path.Combine(Paths.PluginPath, "Draven-Draven_VRMs", "Draven_VRMs", "VRMs"),
			Path.Combine(Paths.PluginPath, "Draven_VRMs", "VRMs"),
			Path.Combine(Paths.PluginPath, "Draven_VRMs", "Draven_VRMs", "VRMs")
		};
		string[] array2 = array;
		foreach (string text in array2)
		{
			if (Directory.Exists(text))
			{
				CopyVRMs(text, targetPath);
				return;
			}
		}
		((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find VRMs source folder in any expected location.");
	}

	private void CopyVRMs(string sourcePath, string targetPath)
	{
		try
		{
			if (!Directory.Exists(targetPath))
			{
				Directory.CreateDirectory(targetPath);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Created VRMs folder in game root.");
			}
			string[] files = Directory.GetFiles(sourcePath);
			foreach (string text in files)
			{
				string fileName = Path.GetFileName(text);
				string destFileName = Path.Combine(targetPath, fileName);
				File.Copy(text, destFileName, overwrite: true);
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Copied VRM: " + fileName));
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"VRM files copied successfully!");
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Error copying VRMs: " + ex.Message));
		}
	}
}
public static class MyPluginInfo
{
	public const string PLUGIN_GUID = "DravenVRMHelper";

	public const string PLUGIN_NAME = "My first plugin";

	public const string PLUGIN_VERSION = "1.0.0";
}