mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[RombaSharp] Create copy flag
This commit is contained in:
@@ -116,8 +116,9 @@ namespace SabreTools
|
||||
/// <summary>
|
||||
/// Wrap building all files from a set of DATs
|
||||
/// </summary>
|
||||
/// <param name="inputs"></param>
|
||||
private static void InitBuild(List<string> inputs)
|
||||
/// <param name="inputs">List of input DATs to rebuild from</param>
|
||||
/// <param name="copy">True if files should be copied to output, false for rebuild</param>
|
||||
private static void InitBuild(List<string> inputs, bool copy)
|
||||
{
|
||||
// Verify the filenames
|
||||
Dictionary<string, string> foundDats = GetValidDats(inputs);
|
||||
@@ -165,8 +166,24 @@ namespace SabreTools
|
||||
if (_depots[depot].Item2)
|
||||
{
|
||||
if (File.Exists(Path.Combine(depot, filename)))
|
||||
{
|
||||
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,11 +192,14 @@ namespace SabreTools
|
||||
}
|
||||
|
||||
// Now that we have extracted everything, we rebuild to the output folder
|
||||
if (!copy)
|
||||
{
|
||||
List<string> temp = new List<string>();
|
||||
temp.Add(_tmpdir);
|
||||
SimpleSort ss = new SimpleSort(datFile, temp, outputFolder, "", false, false, false, true, false, false, asl, false, _logger);
|
||||
ss.StartProcessing();
|
||||
}
|
||||
}
|
||||
|
||||
dbc.Dispose();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user