mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ArchiveTools] Make it easier to rebuild to TGZ
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user