mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Remove copy files flag
This commit is contained in:
@@ -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="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="addDate">True if dates should be archived for all files, false otherwise</param>
|
||||||
/// <param name="outDir">Output directory to </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>
|
/// <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(
|
public bool PopulateFromDir(
|
||||||
string basePath,
|
string basePath,
|
||||||
TreatAsFile asFiles = 0x00,
|
TreatAsFile asFiles = 0x00,
|
||||||
SkipFileType skipFileType = SkipFileType.None,
|
SkipFileType skipFileType = SkipFileType.None,
|
||||||
bool addBlanks = false,
|
bool addBlanks = false,
|
||||||
bool addDate = false,
|
bool addDate = false,
|
||||||
bool copyFiles = false,
|
|
||||||
bool quickScan = false)
|
bool quickScan = false)
|
||||||
{
|
{
|
||||||
// Clean the temp directory path
|
// Clean the temp directory path
|
||||||
@@ -1999,7 +1996,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
List<string> files = Directory.EnumerateFiles(basePath, "*", SearchOption.AllDirectories).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, 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
|
// Now find all folders that are empty, if we are supposed to
|
||||||
@@ -2047,7 +2044,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
skipFileType,
|
skipFileType,
|
||||||
addBlanks,
|
addBlanks,
|
||||||
addDate,
|
addDate,
|
||||||
copyFiles,
|
|
||||||
quickScan);
|
quickScan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2069,7 +2065,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="skipFileType">Type of files that should be skipped</param>
|
/// <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="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="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>
|
/// <param name="quickScan">True if archive header should be used, false otherwise</param>
|
||||||
private void CheckFileForHashes(
|
private void CheckFileForHashes(
|
||||||
string item,
|
string item,
|
||||||
@@ -2078,18 +2073,14 @@ namespace SabreTools.Library.DatFiles
|
|||||||
SkipFileType skipFileType,
|
SkipFileType skipFileType,
|
||||||
bool addBlanks,
|
bool addBlanks,
|
||||||
bool addDate,
|
bool addDate,
|
||||||
bool copyFiles,
|
|
||||||
bool quickScan)
|
bool quickScan)
|
||||||
{
|
{
|
||||||
// If we're in depot mode, process it separately
|
// If we're in depot mode, process it separately
|
||||||
if (CheckDepotFile(item))
|
if (CheckDepotFile(item))
|
||||||
return;
|
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
|
// Initialize possible archive variables
|
||||||
BaseArchive archive = BaseArchive.Create(newItem, quickScan);
|
BaseArchive archive = BaseArchive.Create(item, quickScan);
|
||||||
List<BaseFile> extracted = null;
|
List<BaseFile> extracted = null;
|
||||||
|
|
||||||
// If we have an archive and we're supposed to scan it
|
// 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 the extracted list is null, just scan the item itself
|
||||||
if (extracted == null)
|
if (extracted == null)
|
||||||
ProcessFile(newItem, newBasePath, addDate, asFiles);
|
ProcessFile(item, basePath, addDate, asFiles);
|
||||||
|
|
||||||
// Otherwise, add all of the found items
|
// Otherwise, add all of the found items
|
||||||
else
|
else
|
||||||
ProcessArchive(newItem, newBasePath, addBlanks, archive, extracted);
|
ProcessArchive(item, basePath, addBlanks, archive, extracted);
|
||||||
|
|
||||||
// Cue to delete the file if it's a copy
|
|
||||||
if (copyFiles && item != newItem)
|
|
||||||
DirectoryExtensions.TryDelete(newBasePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -390,12 +390,6 @@ Options:
|
|||||||
information in the output DAT. The output format is standardized as
|
information in the output DAT. The output format is standardized as
|
||||||
"yyyy/MM/dd HH:mm:ss".
|
"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
|
-h=, --header= Set a header skipper to use, blank means all
|
||||||
Set the header special field for the output DAT(s). In file
|
Set the header special field for the output DAT(s). In file
|
||||||
rebuilding, this flag allows for either all copier headers (using "")
|
rebuilding, this flag allows for either all copier headers (using "")
|
||||||
|
|||||||
@@ -157,6 +157,12 @@ Below are originally from SabreTools / DATabase -
|
|||||||
-out= Output directory
|
-out= Output directory
|
||||||
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
|
-cv, --convert Enable conversion of input files to unarchived folders
|
||||||
Using a folder or set of folders, rebuild to another folder.
|
Using a folder or set of folders, rebuild to another folder.
|
||||||
|
|
||||||
|
|||||||
@@ -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 const string DatDeviceNonMergedValue = "dat-device-non-merged";
|
||||||
internal static Library.Help.Feature DatDeviceNonMergedFlag
|
internal static Library.Help.Feature DatDeviceNonMergedFlag
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ namespace SabreTools.Features
|
|||||||
AddHeaderFeatures();
|
AddHeaderFeatures();
|
||||||
AddFeature(AddBlankFilesFlag);
|
AddFeature(AddBlankFilesFlag);
|
||||||
AddFeature(AddDateFlag);
|
AddFeature(AddDateFlag);
|
||||||
AddFeature(CopyFilesFlag);
|
|
||||||
AddFeature(HeaderStringInput);
|
AddFeature(HeaderStringInput);
|
||||||
AddFeature(ExtraIniListInput);
|
AddFeature(ExtraIniListInput);
|
||||||
AddFilteringFeatures();
|
AddFilteringFeatures();
|
||||||
@@ -62,7 +61,6 @@ namespace SabreTools.Features
|
|||||||
bool addBlankFiles = GetBoolean(features, AddBlankFilesValue);
|
bool addBlankFiles = GetBoolean(features, AddBlankFilesValue);
|
||||||
bool addFileDates = GetBoolean(features, AddDateValue);
|
bool addFileDates = GetBoolean(features, AddDateValue);
|
||||||
TreatAsFile asFiles = GetTreatAsFiles(features);
|
TreatAsFile asFiles = GetTreatAsFiles(features);
|
||||||
bool copyFiles = GetBoolean(features, CopyFilesValue);
|
|
||||||
bool noAutomaticDate = GetBoolean(features, NoAutomaticDateValue);
|
bool noAutomaticDate = GetBoolean(features, NoAutomaticDateValue);
|
||||||
var omitFromScan = GetOmitFromScan(features);
|
var omitFromScan = GetOmitFromScan(features);
|
||||||
var skipFileType = GetSkipFileType(features);
|
var skipFileType = GetSkipFileType(features);
|
||||||
@@ -97,7 +95,6 @@ namespace SabreTools.Features
|
|||||||
skipFileType,
|
skipFileType,
|
||||||
addBlankFiles,
|
addBlankFiles,
|
||||||
addFileDates,
|
addFileDates,
|
||||||
copyFiles,
|
|
||||||
quickScan: omitFromScan == Hash.SecureHashes);
|
quickScan: omitFromScan == Hash.SecureHashes);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
|
|||||||
Reference in New Issue
Block a user