diff --git a/SabreTools.Helper/SabreTools.Helper.csproj b/SabreTools.Helper/SabreTools.Helper.csproj index 1deb42ea..9a36d4cc 100644 --- a/SabreTools.Helper/SabreTools.Helper.csproj +++ b/SabreTools.Helper/SabreTools.Helper.csproj @@ -106,7 +106,7 @@ Resources.fr-FR.resx - + diff --git a/SabreTools.Helper/Tools/ArchiveTools.cs b/SabreTools.Helper/Tools/FileTools.cs similarity index 99% rename from SabreTools.Helper/Tools/ArchiveTools.cs rename to SabreTools.Helper/Tools/FileTools.cs index 9789e4ac..2f6dd4ac 100644 --- a/SabreTools.Helper/Tools/ArchiveTools.cs +++ b/SabreTools.Helper/Tools/FileTools.cs @@ -11,7 +11,7 @@ using System.Text.RegularExpressions; namespace SabreTools.Helper { - public class ArchiveTools + public class FileTools { #region Archive Writing @@ -573,7 +573,7 @@ namespace SabreTools.Helper #endregion - #region Archive Information Methods + #region File Information Methods /// /// Generate a list of RomData objects from the header values in an archive @@ -828,7 +828,7 @@ namespace SabreTools.Helper shouldExternalProcess = true; shouldInternalProcess = true; - ArchiveType? archiveType = ArchiveTools.GetCurrentArchiveType(input, logger); + ArchiveType? archiveType = FileTools.GetCurrentArchiveType(input, logger); switch (archiveType) { case null: diff --git a/SabreTools/DATFromDir.cs b/SabreTools/DATFromDir.cs index 519bc17f..7a649bc3 100644 --- a/SabreTools/DATFromDir.cs +++ b/SabreTools/DATFromDir.cs @@ -346,7 +346,7 @@ namespace SabreTools // Special case for if we are in Romba mode (all names are supposed to be SHA-1 hashes) if (_datdata.Romba) { - Rom rom = ArchiveTools.GetTorrentGZFileInfo(item, _logger); + Rom rom = FileTools.GetTorrentGZFileInfo(item, _logger); // If the rom is valid, write it out if (rom.Name != null) @@ -386,12 +386,12 @@ namespace SabreTools // If both deep hash skip flags are set, do a quickscan if (_noMD5 && _noSHA1) { - ArchiveType? type = ArchiveTools.GetCurrentArchiveType(item, _logger); + ArchiveType? type = FileTools.GetCurrentArchiveType(item, _logger); // If we have an archive, scan it if (type != null) { - List extracted = ArchiveTools.GetArchiveFileInfo(item, _logger); + List extracted = FileTools.GetArchiveFileInfo(item, _logger); foreach (Rom rom in extracted) { lastparent = ProcessFileHelper(item, rom, sw, _basePath, @@ -409,7 +409,7 @@ namespace SabreTools // Otherwise, attempt to extract the files to the temporary directory else { - bool encounteredErrors = ArchiveTools.ExtractArchive(item, + bool encounteredErrors = FileTools.ExtractArchive(item, tempdir, (_archivesAsFiles ? ArchiveScanLevel.External : ArchiveScanLevel.Internal), (!_archivesAsFiles && _enableGzip ? ArchiveScanLevel.Internal : ArchiveScanLevel.External), diff --git a/SimpleSort/SimpleSort.cs b/SimpleSort/SimpleSort.cs index c14f5853..9837da78 100644 --- a/SimpleSort/SimpleSort.cs +++ b/SimpleSort/SimpleSort.cs @@ -487,7 +487,7 @@ namespace SabreTools // Get if the file should be scanned internally and externally bool shouldExternalScan, shouldInternalScan; - ArchiveTools.GetInternalExternalProcess(input, _7z, _gz, _rar, _zip, _logger, out shouldExternalScan, out shouldInternalScan); + FileTools.GetInternalExternalProcess(input, _7z, _gz, _rar, _zip, _logger, out shouldExternalScan, out shouldInternalScan); // Hash and match the external files if (shouldExternalScan) @@ -540,11 +540,11 @@ namespace SabreTools { if (_tgz) { - ArchiveTools.WriteTorrentGZ(input, _outdir, _romba, _logger); + FileTools.WriteTorrentGZ(input, _outdir, _romba, _logger); } else { - ArchiveTools.WriteToManagedArchive(input, _outdir, found); + FileTools.WriteToManagedArchive(input, _outdir, found); } } } @@ -607,11 +607,11 @@ namespace SabreTools { if (_tgz) { - ArchiveTools.WriteTorrentGZ(newinput, _outdir, _romba, _logger); + FileTools.WriteTorrentGZ(newinput, _outdir, _romba, _logger); } else { - ArchiveTools.WriteToManagedArchive(newinput, _outdir, found); + FileTools.WriteToManagedArchive(newinput, _outdir, found); } } @@ -653,11 +653,11 @@ namespace SabreTools _logger.Log("Matched name: " + newfound.Name); if (_tgz) { - ArchiveTools.WriteTorrentGZ(input, _outdir, _romba, _logger); + FileTools.WriteTorrentGZ(input, _outdir, _romba, _logger); } else { - ArchiveTools.WriteToManagedArchive(input, _outdir, newfound); + FileTools.WriteToManagedArchive(input, _outdir, newfound); } } } @@ -681,7 +681,7 @@ namespace SabreTools if (_quickScan) { _logger.Log("Beginning quick scan of contents from '" + input + "'"); - List internalRomData = ArchiveTools.GetArchiveFileInfo(input, _logger); + List internalRomData = FileTools.GetArchiveFileInfo(input, _logger); _logger.Log(internalRomData.Count + " entries found in '" + input + "'"); // If the list is populated, then the file was a filled archive @@ -711,7 +711,7 @@ namespace SabreTools { // Copy file to output directory _logger.Log("Rebuilding file '" + Path.GetFileName(rom.Name) + "' to '" + found.Name + "'"); - string outfile = ArchiveTools.ExtractSingleItemFromArchive(input, rom.Name, _tempdir, _logger); + string outfile = FileTools.ExtractSingleItemFromArchive(input, rom.Name, _tempdir, _logger); if (File.Exists(outfile)) { string gamedir = Path.Combine(_outdir, found.Machine.Name); @@ -734,16 +734,16 @@ namespace SabreTools if (Build.MonoEnvironment || _tgz) { - string outfile = ArchiveTools.ExtractSingleItemFromArchive(input, rom.Name, _tempdir, _logger); + string outfile = FileTools.ExtractSingleItemFromArchive(input, rom.Name, _tempdir, _logger); if (File.Exists(outfile)) { if (_tgz) { - ArchiveTools.WriteTorrentGZ(outfile, _outdir, _romba, _logger); + FileTools.WriteTorrentGZ(outfile, _outdir, _romba, _logger); } else { - ArchiveTools.WriteToManagedArchive(outfile, _outdir, found); + FileTools.WriteToManagedArchive(outfile, _outdir, found); } try @@ -756,7 +756,7 @@ namespace SabreTools else { string archiveFileName = Path.Combine(_outdir, found.Machine + ".zip"); - ArchiveTools.CopyFileBetweenManagedArchives(input, archiveFileName, rom.Name, found.Name, _logger); + FileTools.CopyFileBetweenManagedArchives(input, archiveFileName, rom.Name, found.Name, _logger); } } } @@ -766,7 +766,7 @@ namespace SabreTools else { // Now, if the file is a supported archive type, also run on all files within - bool encounteredErrors = ArchiveTools.ExtractArchive(input, _tempdir, _7z, _gz, _rar, _zip, _logger); + bool encounteredErrors = FileTools.ExtractArchive(input, _tempdir, _7z, _gz, _rar, _zip, _logger); // Remove the current file if we are in recursion so it's not picked up in the next step if (recurse) @@ -832,13 +832,13 @@ namespace SabreTools List roms = new List(); if (_quickScan) { - roms = ArchiveTools.GetArchiveFileInfo(Path.GetFullPath(archive), _logger); + roms = FileTools.GetArchiveFileInfo(Path.GetFullPath(archive), _logger); } // Otherwise, extract it and get info one by one else { string temparcdir = Path.Combine(_tempdir, Path.GetFileNameWithoutExtension(archive)); - ArchiveTools.ExtractArchive(Path.GetFullPath(archive), temparcdir, _logger); + FileTools.ExtractArchive(Path.GetFullPath(archive), temparcdir, _logger); foreach (string tempfile in Directory.EnumerateFiles(temparcdir, "*", SearchOption.AllDirectories)) { roms.Add(RomTools.GetSingleFileInfo(Path.GetFullPath(tempfile))); diff --git a/TGZTest/TGZTest.cs b/TGZTest/TGZTest.cs index afa95e6d..ccbedeb2 100644 --- a/TGZTest/TGZTest.cs +++ b/TGZTest/TGZTest.cs @@ -272,20 +272,20 @@ namespace SabreTools // Get if the file should be scanned internally and externally bool shouldExternalProcess, shouldInternalProcess; - ArchiveTools.GetInternalExternalProcess(input, _7z, _gz, _rar, _zip, _logger, out shouldExternalProcess, out shouldInternalProcess); + FileTools.GetInternalExternalProcess(input, _7z, _gz, _rar, _zip, _logger, out shouldExternalProcess, out shouldInternalProcess); // Do an external scan of the file, if necessary if (shouldExternalProcess) { _logger.User("Processing file " + input); - success &= ArchiveTools.WriteTorrentGZ(input, _outdir, _romba, _logger); + success &= FileTools.WriteTorrentGZ(input, _outdir, _romba, _logger); } // Process the file as an archive, if necessary if (shouldInternalProcess) { // Now, if the file is a supported archive type, also run on all files within - bool encounteredErrors = ArchiveTools.ExtractArchive(input, _tempdir, _7z, _gz, _rar, _zip, _logger); + bool encounteredErrors = FileTools.ExtractArchive(input, _tempdir, _7z, _gz, _rar, _zip, _logger); // If no errors were encountered, we loop through the temp directory if (!encounteredErrors) @@ -294,7 +294,7 @@ namespace SabreTools foreach (string file in Directory.EnumerateFiles(_tempdir, "*", SearchOption.AllDirectories)) { _logger.User("Processing extracted file " + file); - success &= ArchiveTools.WriteTorrentGZ(file, _outdir, _romba, _logger); + success &= FileTools.WriteTorrentGZ(file, _outdir, _romba, _logger); } } }