[ArchiveTools] Make it easier to rebuild to TGZ

This commit is contained in:
Matt Nadareski
2017-01-30 23:16:05 -08:00
parent 70393e4c15
commit 9b42dffba4
4 changed files with 29 additions and 46 deletions

View File

@@ -417,18 +417,6 @@ namespace SabreTools.Helper.Tools
return outputs;
}
/// <summary>
/// Get the romba path for a file based on the rom's SHA-1
/// </summary>
/// <param name="rom">Rom to get the sha1 from</param>
/// <param name="baseOutDir">Base output folder</param>
/// <returns>Formatted path string to use</returns>
public static string GetRombaPath(Rom rom, string baseOutDir)
{
string subfolder = Path.Combine(rom.SHA1.Substring(0, 2), rom.SHA1.Substring(2, 2), rom.SHA1.Substring(4, 2), rom.SHA1.Substring(6, 2));
return Path.Combine(baseOutDir, subfolder);
}
/// <summary>
/// Get the XmlTextReader associated with a file, if possible
/// </summary>
@@ -458,32 +446,6 @@ namespace SabreTools.Helper.Tools
return xtr;
}
/// <summary>
/// Move a file to a named, Romba-style subdirectory
/// </summary>
/// <param name="rom">Rom to get the sha1 from</param>
/// <param name="baseOutDir">Base output folder</param>
/// <param name="filename">Name of the file to be moved</param>
/// <param name="logger">Logger object for file and console output</param>
public static void MoveToRombaFolder(Rom rom, string baseOutDir, string filename, Logger logger)
{
string outDir = GetRombaPath(rom, baseOutDir);
if (!Directory.Exists(outDir))
{
Directory.CreateDirectory(outDir);
}
try
{
File.Move(filename, Path.Combine(outDir, Path.GetFileName(filename)));
}
catch (Exception ex)
{
logger.Warning(ex.ToString());
File.Delete(filename);
}
}
/// <summary>
/// Detect and replace header(s) to the given file
/// </summary>