Remove copy files flag

This commit is contained in:
Matt Nadareski
2020-09-18 10:52:13 -07:00
parent e1cb29880d
commit 6eac80805f
5 changed files with 10 additions and 40 deletions

View File

@@ -1975,16 +1975,13 @@ namespace SabreTools.Library.DatFiles
/// <param name="addBlanks">True if blank items should be created for empty folders, false otherwise</param>
/// <param name="addDate">True if dates should be archived for all files, false otherwise</param>
/// <param name="outDir">Output directory to </param>
/// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param>
/// <param name="quickScan">True if archive header should be used, false otherwise</param>
/// TODO: Look into removing "copyFiles". I don't think it's useful anymore
public bool PopulateFromDir(
string basePath,
TreatAsFile asFiles = 0x00,
SkipFileType skipFileType = SkipFileType.None,
bool addBlanks = false,
bool addDate = false,
bool copyFiles = false,
bool quickScan = false)
{
// Clean the temp directory path
@@ -1999,7 +1996,7 @@ namespace SabreTools.Library.DatFiles
List<string> files = Directory.EnumerateFiles(basePath, "*", SearchOption.AllDirectories).ToList();
Parallel.ForEach(files, Globals.ParallelOptions, item =>
{
CheckFileForHashes(item, basePath, asFiles, skipFileType, addBlanks, addDate, copyFiles, quickScan);
CheckFileForHashes(item, basePath, asFiles, skipFileType, addBlanks, addDate, quickScan);
});
// Now find all folders that are empty, if we are supposed to
@@ -2047,7 +2044,6 @@ namespace SabreTools.Library.DatFiles
skipFileType,
addBlanks,
addDate,
copyFiles,
quickScan);
}
@@ -2069,7 +2065,6 @@ namespace SabreTools.Library.DatFiles
/// <param name="skipFileType">Type of files that should be skipped</param>
/// <param name="addBlanks">True if blank items should be created for empty folders, false otherwise</param>
/// <param name="addDate">True if dates should be archived for all files, false otherwise</param>
/// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param>
/// <param name="quickScan">True if archive header should be used, false otherwise</param>
private void CheckFileForHashes(
string item,
@@ -2078,18 +2073,14 @@ namespace SabreTools.Library.DatFiles
SkipFileType skipFileType,
bool addBlanks,
bool addDate,
bool copyFiles,
bool quickScan)
{
// If we're in depot mode, process it separately
if (CheckDepotFile(item))
return;
// If we're copying files, copy it first and get the new filename
(string newItem, string newBasePath) = CopyIfNeeded(item, basePath, copyFiles);
// Initialize possible archive variables
BaseArchive archive = BaseArchive.Create(newItem, quickScan);
BaseArchive archive = BaseArchive.Create(item, quickScan);
List<BaseFile> extracted = null;
// If we have an archive and we're supposed to scan it
@@ -2105,15 +2096,11 @@ namespace SabreTools.Library.DatFiles
// If the extracted list is null, just scan the item itself
if (extracted == null)
ProcessFile(newItem, newBasePath, addDate, asFiles);
ProcessFile(item, basePath, addDate, asFiles);
// Otherwise, add all of the found items
else
ProcessArchive(newItem, newBasePath, addBlanks, archive, extracted);
// Cue to delete the file if it's a copy
if (copyFiles && item != newItem)
DirectoryExtensions.TryDelete(newBasePath);
ProcessArchive(item, basePath, addBlanks, archive, extracted);
}
/// <summary>

View File

@@ -390,12 +390,6 @@ Options:
information in the output DAT. The output format is standardized as
"yyyy/MM/dd HH:mm:ss".
-cf, --copy-files Copy files to the temp directory before parsing
If this flag is set, then all files that are going to be parsed are
moved to the temporary directory before being hashed. This can be
helpful in cases where the temp folder is located on an SSD and the
user wants to take advantage of this.
-h=, --header= Set a header skipper to use, blank means all
Set the header special field for the output DAT(s). In file
rebuilding, this flag allows for either all copier headers (using "")

View File

@@ -157,6 +157,12 @@ Below are originally from SabreTools / DATabase -
-out= Output directory
out= Output directory
-cf, --copy-files Copy files to the temp directory before parsing
If this flag is set, then all files that are going to be parsed are
moved to the temporary directory before being hashed. This can be
helpful in cases where the temp folder is located on an SSD and the
user wants to take advantage of this.
-cv, --convert Enable conversion of input files to unarchived folders
Using a folder or set of folders, rebuild to another folder.

View File

@@ -206,20 +206,6 @@ namespace SabreTools.Features
}
}
internal const string CopyFilesValue = "copy-files";
internal static Library.Help.Feature CopyFilesFlag
{
get
{
return new Library.Help.Feature(
CopyFilesValue,
new List<string>() { "-cf", "--copy-files" },
"Copy files to the temp directory before parsing",
Library.Help.FeatureType.Flag,
longDescription: "If this flag is set, then all files that are going to be parsed are moved to the temporary directory before being hashed. This can be helpful in cases where the temp folder is located on an SSD and the user wants to take advantage of this.");
}
}
internal const string DatDeviceNonMergedValue = "dat-device-non-merged";
internal static Library.Help.Feature DatDeviceNonMergedFlag
{

View File

@@ -45,7 +45,6 @@ namespace SabreTools.Features
AddHeaderFeatures();
AddFeature(AddBlankFilesFlag);
AddFeature(AddDateFlag);
AddFeature(CopyFilesFlag);
AddFeature(HeaderStringInput);
AddFeature(ExtraIniListInput);
AddFilteringFeatures();
@@ -62,7 +61,6 @@ namespace SabreTools.Features
bool addBlankFiles = GetBoolean(features, AddBlankFilesValue);
bool addFileDates = GetBoolean(features, AddDateValue);
TreatAsFile asFiles = GetTreatAsFiles(features);
bool copyFiles = GetBoolean(features, CopyFilesValue);
bool noAutomaticDate = GetBoolean(features, NoAutomaticDateValue);
var omitFromScan = GetOmitFromScan(features);
var skipFileType = GetSkipFileType(features);
@@ -97,7 +95,6 @@ namespace SabreTools.Features
skipFileType,
addBlankFiles,
addFileDates,
copyFiles,
quickScan: omitFromScan == Hash.SecureHashes);
if (success)