mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile] Use tempdir checking, misc cleanup
This commit is contained in:
@@ -3452,33 +3452,21 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clean the temp directory path
|
// Clean the temp directory path
|
||||||
tempDir = (String.IsNullOrWhiteSpace(tempDir) ? Path.GetTempPath() : tempDir);
|
tempDir = Utilities.EnsureTempDirectory(tempDir);
|
||||||
|
|
||||||
// Process the input
|
// Process the input
|
||||||
if (Directory.Exists(basePath))
|
if (Directory.Exists(basePath))
|
||||||
{
|
{
|
||||||
Globals.Logger.Verbose("Folder found: {0}", basePath);
|
Globals.Logger.Verbose("Folder found: {0}", basePath);
|
||||||
|
|
||||||
// Process the files in the main folder
|
// Process the files in the main folder or any subfolder
|
||||||
List<string> files = Directory.EnumerateFiles(basePath, "*", SearchOption.TopDirectoryOnly).ToList();
|
List<string> files = Directory.EnumerateFiles(basePath, "*", SearchOption.AllDirectories).ToList();
|
||||||
Parallel.ForEach(files, Globals.ParallelOptions, item =>
|
Parallel.ForEach(files, Globals.ParallelOptions, item =>
|
||||||
{
|
{
|
||||||
CheckFileForHashes(item, basePath, omitFromScan, bare, archivesAsFiles, skipFileType,
|
CheckFileForHashes(item, basePath, omitFromScan, bare, archivesAsFiles, skipFileType,
|
||||||
addBlanks, addDate, tempDir, copyFiles, headerToCheckAgainst, chdsAsFiles);
|
addBlanks, addDate, tempDir, copyFiles, headerToCheckAgainst, chdsAsFiles);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Find all top-level subfolders
|
|
||||||
files = Directory.EnumerateDirectories(basePath, "*", SearchOption.TopDirectoryOnly).ToList();
|
|
||||||
foreach (string item in files)
|
|
||||||
{
|
|
||||||
List<string> subfiles = Directory.EnumerateFiles(item, "*", SearchOption.AllDirectories).ToList();
|
|
||||||
Parallel.ForEach(subfiles, Globals.ParallelOptions, subitem =>
|
|
||||||
{
|
|
||||||
CheckFileForHashes(subitem, basePath, omitFromScan, bare, archivesAsFiles, skipFileType,
|
|
||||||
addBlanks, addDate, tempDir, copyFiles, headerToCheckAgainst, chdsAsFiles);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now find all folders that are empty, if we are supposed to
|
// Now find all folders that are empty, if we are supposed to
|
||||||
if (!Romba && addBlanks)
|
if (!Romba && addBlanks)
|
||||||
{
|
{
|
||||||
@@ -3574,7 +3562,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
// Add the list if it doesn't exist already
|
// Add the list if it doesn't exist already
|
||||||
Rom rom = new Rom(baseFile);
|
Rom rom = new Rom(baseFile);
|
||||||
Add(rom.Size + "-" + rom.CRC, rom);
|
Add(Utilities.GetKeyFromDatItem(rom, SortedBy.CRC), rom);
|
||||||
Globals.Logger.User("File added: {0}", Path.GetFileNameWithoutExtension(item) + Environment.NewLine);
|
Globals.Logger.User("File added: {0}", Path.GetFileNameWithoutExtension(item) + Environment.NewLine);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3615,7 +3603,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the extracted list is null, just scan the item itself
|
// If the extracted list is null, just scan the item itself
|
||||||
if (extracted == null || archivesAsFiles)
|
if (extracted == null)
|
||||||
{
|
{
|
||||||
ProcessFile(newItem, "", newBasePath, omitFromScan, addDate, headerToCheckAgainst, chdsAsFiles);
|
ProcessFile(newItem, "", newBasePath, omitFromScan, addDate, headerToCheckAgainst, chdsAsFiles);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user