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>
|
/// <summary>
|
||||||
/// Wrap building all files from a set of DATs
|
/// Wrap building all files from a set of DATs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inputs"></param>
|
/// <param name="inputs">List of input DATs to rebuild from</param>
|
||||||
private static void InitBuild(List<string> inputs)
|
/// <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
|
// Verify the filenames
|
||||||
Dictionary<string, string> foundDats = GetValidDats(inputs);
|
Dictionary<string, string> foundDats = GetValidDats(inputs);
|
||||||
@@ -166,7 +167,23 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
if (File.Exists(Path.Combine(depot, filename)))
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,10 +192,13 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now that we have extracted everything, we rebuild to the output folder
|
// Now that we have extracted everything, we rebuild to the output folder
|
||||||
List<string> temp = new List<string>();
|
if (!copy)
|
||||||
temp.Add(_tmpdir);
|
{
|
||||||
SimpleSort ss = new SimpleSort(datFile, temp, outputFolder, "", false, false, false, true, false, false, asl, false, _logger);
|
List<string> temp = new List<string>();
|
||||||
ss.StartProcessing();
|
temp.Add(_tmpdir);
|
||||||
|
SimpleSort ss = new SimpleSort(datFile, temp, outputFolder, "", false, false, false, true, false, false, asl, false, _logger);
|
||||||
|
ss.StartProcessing();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbc.Dispose();
|
dbc.Dispose();
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ namespace SabreTools
|
|||||||
bool help = false,
|
bool help = false,
|
||||||
archive = false,
|
archive = false,
|
||||||
build = false,
|
build = false,
|
||||||
|
copy = false,
|
||||||
dbstats = false,
|
dbstats = false,
|
||||||
diffdat = false,
|
diffdat = false,
|
||||||
dir2dat = false,
|
dir2dat = false,
|
||||||
@@ -104,6 +105,9 @@ namespace SabreTools
|
|||||||
case "build":
|
case "build":
|
||||||
build = true;
|
build = true;
|
||||||
break;
|
break;
|
||||||
|
case "-copy":
|
||||||
|
copy = true;
|
||||||
|
break;
|
||||||
case "dbstats":
|
case "dbstats":
|
||||||
dbstats = true;
|
dbstats = true;
|
||||||
break;
|
break;
|
||||||
@@ -201,7 +205,7 @@ namespace SabreTools
|
|||||||
// For each specified DAT file it creates the torrentzip files
|
// For each specified DAT file it creates the torrentzip files
|
||||||
else if (build)
|
else if (build)
|
||||||
{
|
{
|
||||||
InitBuild(inputs);
|
InitBuild(inputs, copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints db stats
|
// Prints db stats
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ namespace SabreTools.Helper
|
|||||||
helptext.Add(" archive Adds ROM files from the specified directories to depot");
|
helptext.Add(" archive Adds ROM files from the specified directories to depot");
|
||||||
helptext.Add(" -only-needed Only archive ROM files in database");
|
helptext.Add(" -only-needed Only archive ROM files in database");
|
||||||
helptext.Add(" build For each specified DAT file it creates TZip files");
|
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(" dbstats Prints db stats");
|
||||||
helptext.Add(" diffdat Creates a DAT file for entries found in the new DAT");
|
helptext.Add(" diffdat Creates a DAT file for entries found in the new DAT");
|
||||||
helptext.Add(" -new= DAT to compare to");
|
helptext.Add(" -new= DAT to compare to");
|
||||||
|
|||||||
Reference in New Issue
Block a user