Decompiled source of DumbSprays v1.1.0

ExtraImagesForSprayMod.dll

Decompiled 2 weeks ago
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ExtraMusicforDroneBoomBox")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExtraMusicforDroneBoomBox")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1095bd70-163c-4b94-8a92-55e04b96b739")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.ZeroTails.ExtraImagesForSprayMod", "Extra Images For SprayMod", "1.0.0")]
public class ImageInjector : BaseUnityPlugin
{
	private string modDirectoryPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

	public void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Extra Images For SprayMod loaded!");
		string pluginPath = Paths.PluginPath;
		string text = (from dir in Directory.GetDirectories(pluginPath, "*SprayMod*", SearchOption.TopDirectoryOnly)
			select Path.Combine(dir, "Images")).FirstOrDefault();
		if (text == null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"No directory containing 'SprayMod' found in the plugins folder.");
			return;
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Target images folder found at: " + text));
		if (!Directory.Exists(text))
		{
			Directory.CreateDirectory(text);
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Target images folder created at: " + text));
		}
		if (Directory.Exists(modDirectoryPath))
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Mod directory found at: " + modDirectoryPath));
			CopyPngFiles(modDirectoryPath, text);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Image files successfully copied to the target images folder.");
		}
		else
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Mod directory not found at: " + modDirectoryPath + ". Please ensure the .png files are in the same directory as the .dll."));
		}
	}

	private void CopyPngFiles(string sourceDir, string destDir)
	{
		DirectoryInfo directoryInfo = new DirectoryInfo(sourceDir);
		FileInfo[] files = directoryInfo.GetFiles("*.png");
		FileInfo[] array = files;
		foreach (FileInfo fileInfo in array)
		{
			string text = Path.Combine(destDir, fileInfo.Name);
			fileInfo.CopyTo(text, overwrite: true);
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Copied " + fileInfo.Name + " to " + text));
		}
	}
}