[TGZTest, ArchiveTools] Add Romba depot output

This commit is contained in:
Matt Nadareski
2016-08-25 10:26:52 -07:00
parent 668e25152a
commit 0e4b76f1b3
2 changed files with 29 additions and 6 deletions

View File

@@ -596,9 +596,10 @@ namespace SabreTools.Helper
/// </summary>
/// <param name="input">File to write from</param>
/// <param name="outdir">Directory to write archive to</param>
/// <param name="romba">True if files should be output in Romba depot folders, false otherwise</param>
/// <param name="logger">Logger object for file and console output</param>
/// <returns>True if the write was a success, false otherwise</returns>
public static bool WriteTorrentGZ(string input, string outdir, Logger logger)
public static bool WriteTorrentGZ(string input, string outdir, bool romba, Logger logger)
{
// Check that the input file exists
if (!File.Exists(input))
@@ -668,6 +669,19 @@ namespace SabreTools.Helper
}
}
// If we're in romba mode, create the subfolder and move the file
if (romba)
{
string subfolder = Path.Combine(rom.SHA1.Substring(0, 2), rom.SHA1.Substring(2, 2), rom.SHA1.Substring(4, 2), rom.SHA1.Substring(6, 2));
outdir = Path.Combine(outdir, subfolder);
if (!Directory.Exists(outdir))
{
Directory.CreateDirectory(outdir);
}
File.Move(input, Path.Combine(outdir, input));
}
return true;
}