Decompiled source of Scrumptious nudity pack v1.0.0

plugins/AtlyssTextureSwapper_v2.0.dll

Decompiled a year ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Atlyss_Drag_n_Drop_TextureSwapper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Atlyss_Drag_n_Drop_TextureSwapper")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("aaa5b7b5-ee4b-435d-87b4-98aacb077baf")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Atlyss_Drag_n_Drop_TextureSwapper;

[BepInPlugin("atlyss.mod.Slaps.Atlyss_Drag_n_Drop_TextureSwapper", "Atlyss_Drag_n_Drop_TextureSwapper", "1.0")]
public class Atlyss_Drag_n_Drop_TextureSwapper : BaseUnityPlugin
{
	[HarmonyPatch]
	private class textureSwapper_patch
	{
		[HarmonyPatch(typeof(GameManager), "Awake")]
		[HarmonyPostfix]
		public static void textureSwapper_prefix(GameManager __instance)
		{
			loadTextures();
		}

		[HarmonyPatch(typeof(LoadSceneManager), "Disable_LoadScreen")]
		[HarmonyPostfix]
		public static void textureSwapper_prefix(LoadSceneManager __instance)
		{
			loadTextures();
		}

		[HarmonyPatch(typeof(ChatBehaviour), "UserCode_Rpc_RecieveChatMessage__String__Boolean__ChatChannel")]
		[HarmonyPostfix]
		public static void sizeUncap_stopSendPrefixChat(ChatBehaviour __instance, ref string message, ref bool _isEmoteMessage, ref ChatChannel _chatChannel)
		{
			if (message.ToLower() == "/refresh".ToLower())
			{
				loadTextures();
			}
		}
	}

	public void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		Harmony val = new Harmony("atlyss.mod.Slaps.Atlyss_Drag_n_Drop_TextureSwapper");
		Harmony.DEBUG = false;
		val.PatchAll();
		loadTextures();
	}

	public static void getFolders(string filePath, List<string> images)
	{
		string[] directories = Directory.GetDirectories(filePath);
		foreach (string text in directories)
		{
			string[] files = Directory.GetFiles(text);
			foreach (string item in files)
			{
				images.Add(item);
			}
			getFolders(text, images);
		}
	}

	public static void loadTextures()
	{
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Expected O, but got Unknown
		string text = Directory.GetCurrentDirectory() + "/BepInEx/plugins/modTextures";
		if (!Directory.Exists(text))
		{
			Directory.CreateDirectory(text);
		}
		List<string> list = new List<string>();
		string[] files = Directory.GetFiles(text);
		foreach (string item in files)
		{
			list.Add(item);
		}
		getFolders(text, list);
		Object[] array = Resources.FindObjectsOfTypeAll(typeof(Texture2D));
		foreach (string item2 in list)
		{
			string[] array2 = item2.Split('\\', '.');
			int num = array2.Length - 2;
			Object[] array3 = array;
			for (int i = 0; i < array3.Length; i++)
			{
				Texture2D val = (Texture2D)array3[i];
				if (((Object)val).name == array2[num])
				{
					byte[] array4 = File.ReadAllBytes(item2);
					ImageConversion.LoadImage(val, array4);
				}
			}
		}
	}
}