diff --git a/RombaSharp/Partials/RombaSharp_Inits.cs b/RombaSharp/Partials/RombaSharp_Inits.cs index c494e9fa..4540cbe5 100644 --- a/RombaSharp/Partials/RombaSharp_Inits.cs +++ b/RombaSharp/Partials/RombaSharp_Inits.cs @@ -116,8 +116,9 @@ namespace SabreTools /// /// Wrap building all files from a set of DATs /// - /// - private static void InitBuild(List inputs) + /// List of input DATs to rebuild from + /// True if files should be copied to output, false for rebuild + private static void InitBuild(List inputs, bool copy) { // Verify the filenames Dictionary foundDats = GetValidDats(inputs); @@ -166,7 +167,23 @@ namespace SabreTools { if (File.Exists(Path.Combine(depot, filename))) { - ArchiveTools.ExtractArchive(Path.Combine(depot, filename), _tmpdir, asl, _logger); + if (copy) + { + if (!Directory.Exists(Path.Combine(outputFolder, Path.GetDirectoryName(filename)))) + { + Directory.CreateDirectory(Path.Combine(outputFolder, Path.GetDirectoryName(filename))); + } + + try + { + File.Copy(Path.Combine(depot, filename), Path.Combine(outputFolder, filename), true); + } + catch { } + } + else + { + ArchiveTools.ExtractArchive(Path.Combine(depot, filename), _tmpdir, asl, _logger); + } continue; } } @@ -175,10 +192,13 @@ namespace SabreTools } // Now that we have extracted everything, we rebuild to the output folder - List temp = new List(); - temp.Add(_tmpdir); - SimpleSort ss = new SimpleSort(datFile, temp, outputFolder, "", false, false, false, true, false, false, asl, false, _logger); - ss.StartProcessing(); + if (!copy) + { + List temp = new List(); + temp.Add(_tmpdir); + SimpleSort ss = new SimpleSort(datFile, temp, outputFolder, "", false, false, false, true, false, false, asl, false, _logger); + ss.StartProcessing(); + } } dbc.Dispose(); diff --git a/RombaSharp/RombaSharp.cs b/RombaSharp/RombaSharp.cs index 777bebb7..cb79cc70 100644 --- a/RombaSharp/RombaSharp.cs +++ b/RombaSharp/RombaSharp.cs @@ -71,6 +71,7 @@ namespace SabreTools bool help = false, archive = false, build = false, + copy = false, dbstats = false, diffdat = false, dir2dat = false, @@ -104,6 +105,9 @@ namespace SabreTools case "build": build = true; break; + case "-copy": + copy = true; + break; case "dbstats": dbstats = true; break; @@ -201,7 +205,7 @@ namespace SabreTools // For each specified DAT file it creates the torrentzip files else if (build) { - InitBuild(inputs); + InitBuild(inputs, copy); } // Prints db stats diff --git a/SabreTools.Helper/Data/Build.cs b/SabreTools.Helper/Data/Build.cs index 65968f4d..00e2d596 100644 --- a/SabreTools.Helper/Data/Build.cs +++ b/SabreTools.Helper/Data/Build.cs @@ -83,6 +83,7 @@ namespace SabreTools.Helper helptext.Add(" archive Adds ROM files from the specified directories to depot"); helptext.Add(" -only-needed Only archive ROM files in database"); helptext.Add(" build For each specified DAT file it creates TZip files"); + helptext.Add(" -copy Copy files instead of rebuilding"); helptext.Add(" dbstats Prints db stats"); helptext.Add(" diffdat Creates a DAT file for entries found in the new DAT"); helptext.Add(" -new= DAT to compare to");