Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DescomprimirAudios v1.0.1
BepInEx/patchers/DescomprimirAudios/DescomprimirAudios.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Mono.Cecil; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("DescomprimirAudios")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("DescomprimirAudios")] [assembly: AssemblyTitle("DescomprimirAudios")] [assembly: AssemblyVersion("1.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DescomprimirAudios { public static class DescomprimirAudiosPatcher { public const string PatcherName = "DescomprimirAudios"; public const string PatcherVersion = "1.0.1"; private const string NombreZip = "CustomAudio.zip"; private const string NombreDll = "CustomAudio.dll"; private const string NombreCarpeta = "CustomAudio"; private const string SufijoTemporal = ".descomprimiendo"; private static readonly ManualLogSource Log = Logger.CreateLogSource("DescomprimirAudios"); public static IEnumerable<string> TargetDLLs => new string[0]; public static void Patch(AssemblyDefinition assembly) { } public static void Initialize() { if (!Directory.Exists(Paths.PluginPath)) { return; } string[] files = Directory.GetFiles(Paths.PluginPath, "CustomAudio.zip", SearchOption.AllDirectories); foreach (string text in files) { string directoryName = Path.GetDirectoryName(text); if (File.Exists(Path.Combine(directoryName, "CustomAudio.dll"))) { try { Procesar(text, directoryName); } catch (Exception ex) { Log.LogError((object)(Path.GetFileName(directoryName) + ": no se pudo descomprimir CustomAudio.zip. El mod seguirá sin sus sonidos. " + ex)); } } } } private static void Procesar(string zip, string carpetaMod) { string fileName = Path.GetFileName(carpetaMod); string text = Path.Combine(carpetaMod, "CustomAudio"); if (TieneArchivos(text)) { Log.LogInfo((object)(fileName + ": los audios ya están descomprimidos, no hay nada que hacer.")); return; } string text2 = text + ".descomprimiendo"; try { if (Directory.Exists(text2)) { Directory.Delete(text2, recursive: true); } int num = Extraer(zip, text2); if (num == 0) { Log.LogWarning((object)(fileName + ": CustomAudio.zip no trae ningún archivo; no se toca nada.")); return; } if (Directory.Exists(text)) { Directory.Delete(text, recursive: true); } Directory.Move(RaizDeAudios(text2), text); Log.LogInfo((object)(fileName + ": descomprimidos " + num + " audios en CustomAudio.")); } finally { if (Directory.Exists(text2)) { Directory.Delete(text2, recursive: true); } } } private static bool TieneArchivos(string carpeta) { if (Directory.Exists(carpeta)) { return Directory.GetFiles(carpeta, "*", SearchOption.AllDirectories).Length != 0; } return false; } private static int Extraer(string zip, string carpeta) { string fullPath = Path.GetFullPath(carpeta); char directorySeparatorChar = Path.DirectorySeparatorChar; string value = fullPath + directorySeparatorChar; int num = 0; using FileStream stream = File.OpenRead(zip); using ZipArchive zipArchive = new ZipArchive(stream, ZipArchiveMode.Read); foreach (ZipArchiveEntry entry in zipArchive.Entries) { string fullPath2 = Path.GetFullPath(Path.Combine(carpeta, entry.FullName)); if (!fullPath2.StartsWith(value, StringComparison.OrdinalIgnoreCase)) { throw new InvalidDataException("el zip trae una ruta que sale de su carpeta: " + entry.FullName); } if (string.IsNullOrEmpty(entry.Name)) { Directory.CreateDirectory(fullPath2); continue; } Directory.CreateDirectory(Path.GetDirectoryName(fullPath2)); using (Stream stream2 = entry.Open()) { using FileStream destination = File.Create(fullPath2); stream2.CopyTo(destination); } num++; } return num; } private static string RaizDeAudios(string temporal) { string text = Path.Combine(temporal, "CustomAudio"); if (!Directory.Exists(text) || Directory.GetFiles(temporal).Length != 0 || Directory.GetDirectories(temporal).Length != 1) { return temporal; } return text; } } }