diff --git a/RPGMakerDecrypter.MVMZ/ProjectReconstructor.cs b/RPGMakerDecrypter.MVMZ/ProjectReconstructor.cs index 2cd60bb..8f54e7a 100644 --- a/RPGMakerDecrypter.MVMZ/ProjectReconstructor.cs +++ b/RPGMakerDecrypter.MVMZ/ProjectReconstructor.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Linq; namespace RPGMakerDecrypter.MVMZ { @@ -9,6 +10,7 @@ public abstract class ProjectReconstructor "audio", "css", "data", + "dataex", "effects", "fonts", "icon", @@ -34,14 +36,32 @@ public virtual void Reconstruct(string deploymentPath, string outputPath) Directory.CreateDirectory(outputPath); } + // Get all top-level subdirectories and create lowercase-to-original mapping + var sourceDirectories = Directory.Exists(deploymentPath) + ? Directory.GetDirectories(deploymentPath, "*", SearchOption.TopDirectoryOnly) + : new string[0]; + var sourceDirectoryMap = sourceDirectories.ToDictionary( + directoryPath => Path.GetFileName(directoryPath).ToLowerInvariant(), + directoryPath => Path.GetFileName(directoryPath)); + foreach (var directory in _directories) { - CopyDirectory(Path.Combine(deploymentPath, directory), Path.Combine(outputPath, directory)); + // Find actual directory name (case-insensitive) + if (sourceDirectoryMap.TryGetValue(directory.ToLowerInvariant(), out var actualDirectoryName)) + { + CopyDirectory( + Path.Combine(deploymentPath, actualDirectoryName), + Path.Combine(outputPath, actualDirectoryName)); + } } foreach (var file in _files) { - File.Copy(Path.Combine(deploymentPath, file), Path.Combine(outputPath, file)); + var sourceFile = Path.Combine(deploymentPath, file); + if (File.Exists(sourceFile)) + { + File.Copy(sourceFile, Path.Combine(outputPath, file)); + } } CreateProjectFile(outputPath); @@ -69,4 +89,4 @@ private void CopyDirectory(string sourceDir, string destinationDir) } } } -} \ No newline at end of file +}