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.ExtraMusicforDroneBoomBox", "Extra Music for DroneBoomBox", "1.0.5")]
public class MusicInjector : BaseUnityPlugin
{
private string modDirectoryPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Extra Music for DroneBoomBox loaded!");
string pluginPath = Paths.PluginPath;
string text = (from dir in Directory.GetDirectories(pluginPath, "*XiaohaiMod-DroneBoomBox*", SearchOption.TopDirectoryOnly)
select Path.Combine(dir, "Music")).FirstOrDefault();
if (text == null)
{
((BaseUnityPlugin)this).Logger.LogError((object)"No directory containing 'XiaohaiMod-DroneBoomBox' found in the plugins folder.");
return;
}
((BaseUnityPlugin)this).Logger.LogInfo((object)("Original music folder found at: " + text));
if (!Directory.Exists(text))
{
Directory.CreateDirectory(text);
((BaseUnityPlugin)this).Logger.LogInfo((object)("Original music folder created at: " + text));
}
if (Directory.Exists(modDirectoryPath))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("Mod directory found at: " + modDirectoryPath));
CopyMp3Files(modDirectoryPath, text);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Music files successfully copied to the original music folder.");
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)("Mod directory not found at: " + modDirectoryPath + ". Please ensure the .mp3 files are in the same directory as the .dll."));
}
}
private void CopyMp3Files(string sourceDir, string destDir)
{
DirectoryInfo directoryInfo = new DirectoryInfo(sourceDir);
FileInfo[] files = directoryInfo.GetFiles("*.mp3");
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));
}
}
}