Decompiled source of Sam And Friends Poster Pack v1.0.0

plugins/CustomFolderPack/CustomPosterPackInstaller3.dll

Decompiled 2 weeks ago
using System;
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("CustomPosterPackInstaller3")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomPosterPackInstaller3")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8fecdd50-244f-428d-9d27-b533f886b560")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CustomPosterPackInstaller;

[BepInPlugin("SamAndFriends.CustomPosterPackInstaller", "Custom Poster Pack Installer", "1.0.1")]
public class PosterInstaller : BaseUnityPlugin
{
	private void Awake()
	{
		try
		{
			string pluginPath = Paths.PluginPath;
			string sourceRoot = Path.GetDirectoryName(((object)this).GetType().Assembly.Location);
			string path = Path.Combine(sourceRoot, "imports");
			if (!Directory.Exists(path))
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Poster imports folder not found.");
				return;
			}
			string text = Directory.GetFiles(pluginPath, "SomeStuff.dll", SearchOption.AllDirectories).FirstOrDefault(delegate(string file)
			{
				string text7 = sourceRoot;
				char directorySeparatorChar = Path.DirectorySeparatorChar;
				return !file.StartsWith(text7 + directorySeparatorChar, StringComparison.OrdinalIgnoreCase);
			});
			if (text == null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"SmoothReserves was not found.");
				return;
			}
			string text2 = Path.Combine(Path.GetDirectoryName(text), "imports");
			Directory.CreateDirectory(text2);
			string[] directories = Directory.GetDirectories(path);
			foreach (string text3 in directories)
			{
				string text4 = Path.Combine(text2, Path.GetFileName(text3));
				Directory.CreateDirectory(text4);
				string[] files = Directory.GetFiles(text3, "*", SearchOption.AllDirectories);
				foreach (string text5 in files)
				{
					string path2 = text5.Substring(text3.Length + 1);
					string text6 = Path.Combine(text4, path2);
					Directory.CreateDirectory(Path.GetDirectoryName(text6));
					File.Copy(text5, text6, overwrite: true);
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Custom posters installed successfully.");
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)ex);
		}
	}
}