mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SabreTools] Rename a couple variables
This commit is contained in:
@@ -178,7 +178,7 @@ namespace RombaSharp
|
|||||||
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers((onlyNeeded ? 0 : 1), (onlyNeeded ? 0 : 1), (onlyNeeded ? 0 : 1), (onlyNeeded ? 0 : 1));
|
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers((onlyNeeded ? 0 : 1), (onlyNeeded ? 0 : 1), (onlyNeeded ? 0 : 1), (onlyNeeded ? 0 : 1));
|
||||||
need.RebuildGeneric(onlyDirs, _depots.Keys.ToList()[0], false /*quickScan*/, false /*date*/,
|
need.RebuildGeneric(onlyDirs, _depots.Keys.ToList()[0], false /*quickScan*/, false /*date*/,
|
||||||
false /*delete*/, false /*inverse*/, OutputFormat.TorrentGzip, true /*romba*/, asl, false /*updateDat*/,
|
false /*delete*/, false /*inverse*/, OutputFormat.TorrentGzip, true /*romba*/, asl, false /*updateDat*/,
|
||||||
null /*headerToCheckAgainst*/, true /* ignorechd */);
|
null /*headerToCheckAgainst*/, true /* chdsAsFiles */);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -254,7 +254,7 @@ namespace RombaSharp
|
|||||||
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
||||||
datdata.PopulateFromDir(input, Hash.DeepHashes /* omitFromScan */, true /* bare */, false /* archivesAsFiles */,
|
datdata.PopulateFromDir(input, Hash.DeepHashes /* omitFromScan */, true /* bare */, false /* archivesAsFiles */,
|
||||||
SkipFileType.None, false /* addBlanks */, false /* addDate */, _tmpdir /* tempDir */, false /* copyFiles */,
|
SkipFileType.None, false /* addBlanks */, false /* addDate */, _tmpdir /* tempDir */, false /* copyFiles */,
|
||||||
null /* headerToCheckAgainst */, true /* ignorechd */);
|
null /* headerToCheckAgainst */, true /* chdsAsFiles */);
|
||||||
datdata.WriteToFile("");
|
datdata.WriteToFile("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3475,9 +3475,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <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="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
public bool PopulateFromDir(string basePath, Hash omitFromScan, bool bare, bool archivesAsFiles, SkipFileType skipFileType,
|
public bool PopulateFromDir(string basePath, Hash omitFromScan, bool bare, bool archivesAsFiles, SkipFileType skipFileType,
|
||||||
bool addBlanks, bool addDate, string tempDir, bool copyFiles, string headerToCheckAgainst, bool ignorechd)
|
bool addBlanks, bool addDate, string tempDir, bool copyFiles, string headerToCheckAgainst, bool chdsAsFiles)
|
||||||
{
|
{
|
||||||
// If the description is defined but not the name, set the name from the description
|
// If the description is defined but not the name, set the name from the description
|
||||||
if (String.IsNullOrEmpty(Name) && !String.IsNullOrEmpty(Description))
|
if (String.IsNullOrEmpty(Name) && !String.IsNullOrEmpty(Description))
|
||||||
@@ -3508,7 +3508,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
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, ignorechd);
|
addBlanks, addDate, tempDir, copyFiles, headerToCheckAgainst, chdsAsFiles);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Find all top-level subfolders
|
// Find all top-level subfolders
|
||||||
@@ -3519,7 +3519,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Parallel.ForEach(subfiles, Globals.ParallelOptions, subitem =>
|
Parallel.ForEach(subfiles, Globals.ParallelOptions, subitem =>
|
||||||
{
|
{
|
||||||
CheckFileForHashes(subitem, basePath, omitFromScan, bare, archivesAsFiles, skipFileType,
|
CheckFileForHashes(subitem, basePath, omitFromScan, bare, archivesAsFiles, skipFileType,
|
||||||
addBlanks, addDate, tempDir, copyFiles, headerToCheckAgainst, ignorechd);
|
addBlanks, addDate, tempDir, copyFiles, headerToCheckAgainst, chdsAsFiles);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3576,7 +3576,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
else if (File.Exists(basePath))
|
else if (File.Exists(basePath))
|
||||||
{
|
{
|
||||||
CheckFileForHashes(basePath, Path.GetDirectoryName(Path.GetDirectoryName(basePath)), omitFromScan, bare, archivesAsFiles,
|
CheckFileForHashes(basePath, Path.GetDirectoryName(Path.GetDirectoryName(basePath)), omitFromScan, bare, archivesAsFiles,
|
||||||
skipFileType, addBlanks, addDate, tempDir, copyFiles, headerToCheckAgainst, ignorechd);
|
skipFileType, addBlanks, addDate, tempDir, copyFiles, headerToCheckAgainst, chdsAsFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that we're done, delete the temp folder (if it's not the default)
|
// Now that we're done, delete the temp folder (if it's not the default)
|
||||||
@@ -3603,9 +3603,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="tempDir">Name of the directory to create a temp folder in (blank is current directory)</param>
|
/// <param name="tempDir">Name of the directory to create a temp folder in (blank is current directory)</param>
|
||||||
/// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param>
|
/// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
private void CheckFileForHashes(string item, string basePath, Hash omitFromScan, bool bare, bool archivesAsFiles,
|
private void CheckFileForHashes(string item, string basePath, Hash omitFromScan, bool bare, bool archivesAsFiles,
|
||||||
SkipFileType skipFileType, bool addBlanks, bool addDate, string tempDir, bool copyFiles, string headerToCheckAgainst, bool ignorechd)
|
SkipFileType skipFileType, bool addBlanks, bool addDate, string tempDir, bool copyFiles, string headerToCheckAgainst, bool chdsAsFiles)
|
||||||
{
|
{
|
||||||
// Define the temporary directory
|
// Define the temporary directory
|
||||||
string tempSubDir = Path.GetFullPath(Path.Combine(tempDir, Path.GetRandomFileName())) + Path.DirectorySeparatorChar;
|
string tempSubDir = Path.GetFullPath(Path.Combine(tempDir, Path.GetRandomFileName())) + Path.DirectorySeparatorChar;
|
||||||
@@ -3670,7 +3670,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 || archivesAsFiles)
|
||||||
{
|
{
|
||||||
ProcessFile(newItem, "", newBasePath, omitFromScan, addDate, headerToCheckAgainst, ignorechd);
|
ProcessFile(newItem, "", newBasePath, omitFromScan, addDate, headerToCheckAgainst, chdsAsFiles);
|
||||||
}
|
}
|
||||||
// Otherwise, add all of the found items
|
// Otherwise, add all of the found items
|
||||||
else
|
else
|
||||||
@@ -3718,12 +3718,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="omitFromScan">Hash flag saying what hashes should not be calculated</param>
|
/// <param name="omitFromScan">Hash flag saying what hashes should not be calculated</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="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
private void ProcessFile(string item, string parent, string basePath, Hash omitFromScan,
|
private void ProcessFile(string item, string parent, string basePath, Hash omitFromScan,
|
||||||
bool addDate, string headerToCheckAgainst, bool ignorechd)
|
bool addDate, string headerToCheckAgainst, bool chdsAsFiles)
|
||||||
{
|
{
|
||||||
Globals.Logger.Verbose("'{0}' treated like a file", Path.GetFileName(item));
|
Globals.Logger.Verbose("'{0}' treated like a file", Path.GetFileName(item));
|
||||||
DatItem datItem = FileTools.GetFileInfo(item, omitFromScan: omitFromScan, date: addDate, header: headerToCheckAgainst, ignorechd: ignorechd);
|
DatItem datItem = FileTools.GetFileInfo(item, omitFromScan: omitFromScan, date: addDate, header: headerToCheckAgainst, chdsAsFiles: chdsAsFiles);
|
||||||
|
|
||||||
ProcessFileHelper(item, datItem, basePath, parent);
|
ProcessFileHelper(item, datItem, basePath, parent);
|
||||||
}
|
}
|
||||||
@@ -4048,11 +4048,11 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="archiveScanLevel">ArchiveScanLevel representing the archive handling levels</param>
|
/// <param name="archiveScanLevel">ArchiveScanLevel representing the archive handling levels</param>
|
||||||
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param>
|
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
/// <returns>True if rebuilding was a success, false otherwise</returns>
|
/// <returns>True if rebuilding was a success, false otherwise</returns>
|
||||||
public bool RebuildGeneric(List<string> inputs, string outDir, bool quickScan, bool date,
|
public bool RebuildGeneric(List<string> inputs, string outDir, bool quickScan, bool date,
|
||||||
bool delete, bool inverse, OutputFormat outputFormat, bool romba, ArchiveScanLevel archiveScanLevel, bool updateDat,
|
bool delete, bool inverse, OutputFormat outputFormat, bool romba, ArchiveScanLevel archiveScanLevel, bool updateDat,
|
||||||
string headerToCheckAgainst, bool ignorechd)
|
string headerToCheckAgainst, bool chdsAsFiles)
|
||||||
{
|
{
|
||||||
#region Perform setup
|
#region Perform setup
|
||||||
|
|
||||||
@@ -4132,7 +4132,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
Globals.Logger.User("Checking file: {0}", input);
|
Globals.Logger.User("Checking file: {0}", input);
|
||||||
RebuildGenericHelper(input, outDir, quickScan, date, delete, inverse,
|
RebuildGenericHelper(input, outDir, quickScan, date, delete, inverse,
|
||||||
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, ignorechd);
|
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, chdsAsFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the input is a directory
|
// If the input is a directory
|
||||||
@@ -4143,7 +4143,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
Globals.Logger.User("Checking file: {0}", file);
|
Globals.Logger.User("Checking file: {0}", file);
|
||||||
RebuildGenericHelper(file, outDir, quickScan, date, delete, inverse,
|
RebuildGenericHelper(file, outDir, quickScan, date, delete, inverse,
|
||||||
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, ignorechd);
|
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, chdsAsFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4179,10 +4179,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="archiveScanLevel">ArchiveScanLevel representing the archive handling levels</param>
|
/// <param name="archiveScanLevel">ArchiveScanLevel representing the archive handling levels</param>
|
||||||
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param>
|
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
private void RebuildGenericHelper(string file, string outDir, bool quickScan, bool date,
|
private void RebuildGenericHelper(string file, string outDir, bool quickScan, bool date,
|
||||||
bool delete, bool inverse, OutputFormat outputFormat, bool romba, ArchiveScanLevel archiveScanLevel, bool updateDat,
|
bool delete, bool inverse, OutputFormat outputFormat, bool romba, ArchiveScanLevel archiveScanLevel, bool updateDat,
|
||||||
string headerToCheckAgainst, bool ignorechd)
|
string headerToCheckAgainst, bool chdsAsFiles)
|
||||||
{
|
{
|
||||||
// If we somehow have a null filename, return
|
// If we somehow have a null filename, return
|
||||||
if (file == null)
|
if (file == null)
|
||||||
@@ -4202,7 +4202,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
||||||
DatItem fileinfo = FileTools.GetFileInfo(file, omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes),
|
DatItem fileinfo = FileTools.GetFileInfo(file, omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes),
|
||||||
header: headerToCheckAgainst, ignorechd: ignorechd);
|
header: headerToCheckAgainst, chdsAsFiles: chdsAsFiles);
|
||||||
usedExternally = RebuildIndividualFile(fileinfo, file, outDir, date, inverse, outputFormat,
|
usedExternally = RebuildIndividualFile(fileinfo, file, outDir, date, inverse, outputFormat,
|
||||||
romba, updateDat, null /* isZip */, headerToCheckAgainst);
|
romba, updateDat, null /* isZip */, headerToCheckAgainst);
|
||||||
}
|
}
|
||||||
@@ -4233,7 +4233,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
if (entries == null && File.Exists(file))
|
if (entries == null && File.Exists(file))
|
||||||
{
|
{
|
||||||
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
||||||
DatItem fileinfo = FileTools.GetFileInfo(file, omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes), ignorechd: ignorechd);
|
DatItem fileinfo = FileTools.GetFileInfo(file, omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes), chdsAsFiles: chdsAsFiles);
|
||||||
usedExternally = RebuildIndividualFile(fileinfo, file, outDir, date, inverse, outputFormat,
|
usedExternally = RebuildIndividualFile(fileinfo, file, outDir, date, inverse, outputFormat,
|
||||||
romba, updateDat, null /* isZip */, headerToCheckAgainst);
|
romba, updateDat, null /* isZip */, headerToCheckAgainst);
|
||||||
}
|
}
|
||||||
@@ -4743,9 +4743,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="hashOnly">True if only hashes should be checked, false for full file information</param>
|
/// <param name="hashOnly">True if only hashes should be checked, false for full file information</param>
|
||||||
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
/// <returns>True if verification was a success, false otherwise</returns>
|
/// <returns>True if verification was a success, false otherwise</returns>
|
||||||
public bool VerifyGeneric(List<string> inputs, bool hashOnly, bool quickScan, string headerToCheckAgainst, bool ignorechd)
|
public bool VerifyGeneric(List<string> inputs, bool hashOnly, bool quickScan, string headerToCheckAgainst, bool chdsAsFiles)
|
||||||
{
|
{
|
||||||
// TODO: We want the cross section of what's the folder and what's in the DAT. Right now, it just has what's in the DAT that's not in the folder
|
// TODO: We want the cross section of what's the folder and what's in the DAT. Right now, it just has what's in the DAT that's not in the folder
|
||||||
bool success = true;
|
bool success = true;
|
||||||
@@ -4756,7 +4756,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
||||||
PopulateFromDir(input, (quickScan ? Hash.SecureHashes : Hash.DeepHashes) /* omitFromScan */, true /* bare */, false /* archivesAsFiles */,
|
PopulateFromDir(input, (quickScan ? Hash.SecureHashes : Hash.DeepHashes) /* omitFromScan */, true /* bare */, false /* archivesAsFiles */,
|
||||||
SkipFileType.None, false /* addBlanks */, false /* addDate */, "" /* tempDir */, false /* copyFiles */, headerToCheckAgainst, ignorechd);
|
SkipFileType.None, false /* addBlanks */, false /* addDate */, "" /* tempDir */, false /* copyFiles */, headerToCheckAgainst, chdsAsFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the fixdat
|
// Setup the fixdat
|
||||||
|
|||||||
@@ -212,10 +212,10 @@ namespace SabreTools.Library.Tools
|
|||||||
/// <param name="offset">Set a >0 number for getting hash for part of the file, 0 otherwise (default)</param>
|
/// <param name="offset">Set a >0 number for getting hash for part of the file, 0 otherwise (default)</param>
|
||||||
/// <param name="date">True if the file Date should be included, false otherwise (default)</param>
|
/// <param name="date">True if the file Date should be included, false otherwise (default)</param>
|
||||||
/// <param name="header">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="header">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
/// <returns>Populated DatItem object if success, empty one on error</returns>
|
/// <returns>Populated DatItem object if success, empty one on error</returns>
|
||||||
public static DatItem GetFileInfo(string input, Hash omitFromScan = 0x0,
|
public static DatItem GetFileInfo(string input, Hash omitFromScan = 0x0,
|
||||||
long offset = 0, bool date = false, string header = null, bool ignorechd = true)
|
long offset = 0, bool date = false, string header = null, bool chdsAsFiles = true)
|
||||||
{
|
{
|
||||||
// Add safeguard if file doesn't exist
|
// Add safeguard if file doesn't exist
|
||||||
if (!File.Exists(input))
|
if (!File.Exists(input))
|
||||||
@@ -238,7 +238,7 @@ namespace SabreTools.Library.Tools
|
|||||||
|
|
||||||
// Transform the stream and get the information from it
|
// Transform the stream and get the information from it
|
||||||
rule.TransformStream(inputStream, outputStream, keepReadOpen: false, keepWriteOpen: true);
|
rule.TransformStream(inputStream, outputStream, keepReadOpen: false, keepWriteOpen: true);
|
||||||
datItem = GetStreamInfo(outputStream, outputStream.Length, omitFromScan: omitFromScan, keepReadOpen: false, ignorechd: ignorechd);
|
datItem = GetStreamInfo(outputStream, outputStream.Length, omitFromScan: omitFromScan, keepReadOpen: false, chdsAsFiles: chdsAsFiles);
|
||||||
|
|
||||||
// Dispose of the streams
|
// Dispose of the streams
|
||||||
outputStream.Dispose();
|
outputStream.Dispose();
|
||||||
@@ -248,13 +248,13 @@ namespace SabreTools.Library.Tools
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
long length = new FileInfo(input).Length;
|
long length = new FileInfo(input).Length;
|
||||||
datItem = GetStreamInfo(TryOpenRead(input), length, omitFromScan, offset, keepReadOpen: false, ignorechd: ignorechd);
|
datItem = GetStreamInfo(TryOpenRead(input), length, omitFromScan, offset, keepReadOpen: false, chdsAsFiles: chdsAsFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
long length = new FileInfo(input).Length;
|
long length = new FileInfo(input).Length;
|
||||||
datItem = GetStreamInfo(TryOpenRead(input), length, omitFromScan, offset, keepReadOpen: false, ignorechd: ignorechd);
|
datItem = GetStreamInfo(TryOpenRead(input), length, omitFromScan, offset, keepReadOpen: false, chdsAsFiles: chdsAsFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add unique data from the file
|
// Add unique data from the file
|
||||||
@@ -439,7 +439,7 @@ namespace SabreTools.Library.Tools
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now add the information to the database if it's not already there
|
// Now add the information to the database if it's not already there
|
||||||
Rom rom = (Rom)GetFileInfo(newfile, ignorechd: true);
|
Rom rom = (Rom)GetFileInfo(newfile, chdsAsFiles: true);
|
||||||
DatabaseTools.AddHeaderToDatabase(hstr, rom.SHA1, rule.SourceFile);
|
DatabaseTools.AddHeaderToDatabase(hstr, rom.SHA1, rule.SourceFile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -538,7 +538,7 @@ namespace SabreTools.Library.Tools
|
|||||||
}
|
}
|
||||||
|
|
||||||
// First, get the SHA-1 hash of the file
|
// First, get the SHA-1 hash of the file
|
||||||
Rom rom = (Rom)GetFileInfo(file, ignorechd: true);
|
Rom rom = (Rom)GetFileInfo(file, chdsAsFiles: true);
|
||||||
|
|
||||||
// Retrieve a list of all related headers from the database
|
// Retrieve a list of all related headers from the database
|
||||||
List<string> headers = DatabaseTools.RetrieveHeadersFromDatabase(rom.SHA1);
|
List<string> headers = DatabaseTools.RetrieveHeadersFromDatabase(rom.SHA1);
|
||||||
@@ -762,13 +762,13 @@ namespace SabreTools.Library.Tools
|
|||||||
/// <param name="omitFromScan">Hash flag saying what hashes should not be calculated (defaults to none)</param>
|
/// <param name="omitFromScan">Hash flag saying what hashes should not be calculated (defaults to none)</param>
|
||||||
/// <param name="offset">Set a >0 number for getting hash for part of the file, 0 otherwise (default)</param>
|
/// <param name="offset">Set a >0 number for getting hash for part of the file, 0 otherwise (default)</param>
|
||||||
/// <param name="keepReadOpen">True if the underlying read stream should be kept open, false otherwise</param>
|
/// <param name="keepReadOpen">True if the underlying read stream should be kept open, false otherwise</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
/// <returns>Populated DatItem object if success, empty one on error</returns>
|
/// <returns>Populated DatItem object if success, empty one on error</returns>
|
||||||
public static DatItem GetStreamInfo(Stream input, long size, Hash omitFromScan = 0x0,
|
public static DatItem GetStreamInfo(Stream input, long size, Hash omitFromScan = 0x0,
|
||||||
long offset = 0, bool keepReadOpen = false, bool ignorechd = true)
|
long offset = 0, bool keepReadOpen = false, bool chdsAsFiles = true)
|
||||||
{
|
{
|
||||||
// We first check to see if it's a CHD
|
// We first check to see if it's a CHD
|
||||||
if (ignorechd == false && IsValidCHD(input))
|
if (chdsAsFiles == false && IsValidCHD(input))
|
||||||
{
|
{
|
||||||
// Seek to the starting position, if one is set
|
// Seek to the starting position, if one is set
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace SabreTools
|
|||||||
/// <param name="superdat">True to enable SuperDAT-style reading, false otherwise</param>
|
/// <param name="superdat">True to enable SuperDAT-style reading, false otherwise</param>
|
||||||
/// <param name="omitFromScan">Hash flag saying what hashes should not be calculated</param>
|
/// <param name="omitFromScan">Hash flag saying what hashes should not be calculated</param>
|
||||||
/// <param name="removeDateFromAutomaticName">True if the date should be omitted from the DAT, false otherwise</param>
|
/// <param name="removeDateFromAutomaticName">True if the date should be omitted from the DAT, false otherwise</param>
|
||||||
/// <param name="parseArchivesAsFiles">True if archives should be treated as files, false otherwise</param>
|
/// <param name="archivesAsFiles">True if archives should be treated as files, false otherwise</param>
|
||||||
/// <param name="skipFileType">Type of files that should be skipped on scan</param>
|
/// <param name="skipFileType">Type of files that should be skipped on scan</param>
|
||||||
/// <param name="addBlankFilesForEmptyFolder">True if blank items should be created for empty folders, false otherwise</param>
|
/// <param name="addBlankFilesForEmptyFolder">True if blank items should be created for empty folders, false otherwise</param>
|
||||||
/// <param name="addFileDates">True if dates should be archived for all files, false otherwise</param>
|
/// <param name="addFileDates">True if dates should be archived for all files, false otherwise</param>
|
||||||
@@ -52,7 +52,7 @@ namespace SabreTools
|
|||||||
/// <param name="outDir">Name of the directory to output the DAT to (blank is the current directory)</param>
|
/// <param name="outDir">Name of the directory to output the DAT to (blank is the current directory)</param>
|
||||||
/// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param>
|
/// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
private static void InitDatFromDir(List<string> inputs,
|
private static void InitDatFromDir(List<string> inputs,
|
||||||
/* Normal DAT header info */
|
/* Normal DAT header info */
|
||||||
string filename,
|
string filename,
|
||||||
@@ -75,7 +75,7 @@ namespace SabreTools
|
|||||||
bool superdat,
|
bool superdat,
|
||||||
Hash omitFromScan,
|
Hash omitFromScan,
|
||||||
bool removeDateFromAutomaticName,
|
bool removeDateFromAutomaticName,
|
||||||
bool parseArchivesAsFiles,
|
bool archivesAsFiles,
|
||||||
SkipFileType skipFileType,
|
SkipFileType skipFileType,
|
||||||
bool addBlankFilesForEmptyFolder,
|
bool addBlankFilesForEmptyFolder,
|
||||||
bool addFileDates,
|
bool addFileDates,
|
||||||
@@ -85,7 +85,7 @@ namespace SabreTools
|
|||||||
string outDir,
|
string outDir,
|
||||||
bool copyFiles,
|
bool copyFiles,
|
||||||
string headerToCheckAgainst,
|
string headerToCheckAgainst,
|
||||||
bool ignorechd)
|
bool chdsAsFiles)
|
||||||
{
|
{
|
||||||
ForcePacking fp = ForcePacking.None;
|
ForcePacking fp = ForcePacking.None;
|
||||||
switch (forcepack?.ToLowerInvariant())
|
switch (forcepack?.ToLowerInvariant())
|
||||||
@@ -136,8 +136,8 @@ namespace SabreTools
|
|||||||
DatFile datdata = new DatFile(basedat);
|
DatFile datdata = new DatFile(basedat);
|
||||||
|
|
||||||
string basePath = Path.GetFullPath(path);
|
string basePath = Path.GetFullPath(path);
|
||||||
bool success = datdata.PopulateFromDir(basePath, omitFromScan, removeDateFromAutomaticName, parseArchivesAsFiles,
|
bool success = datdata.PopulateFromDir(basePath, omitFromScan, removeDateFromAutomaticName, archivesAsFiles,
|
||||||
skipFileType, addBlankFilesForEmptyFolder, addFileDates, tempDir, copyFiles, headerToCheckAgainst, ignorechd);
|
skipFileType, addBlankFilesForEmptyFolder, addFileDates, tempDir, copyFiles, headerToCheckAgainst, chdsAsFiles);
|
||||||
|
|
||||||
// If it was a success, write the DAT out
|
// If it was a success, write the DAT out
|
||||||
if (success)
|
if (success)
|
||||||
@@ -331,10 +331,10 @@ namespace SabreTools
|
|||||||
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param>
|
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
private static void InitSort(List<string> datfiles, List<string> inputs, string outDir, bool quickScan, bool date, bool delete,
|
private static void InitSort(List<string> datfiles, List<string> inputs, string outDir, bool quickScan, bool date, bool delete,
|
||||||
bool inverse, OutputFormat outputFormat, bool romba, int sevenzip, int gz, int rar, int zip, bool updateDat, string headerToCheckAgainst,
|
bool inverse, OutputFormat outputFormat, bool romba, int sevenzip, int gz, int rar, int zip, bool updateDat, string headerToCheckAgainst,
|
||||||
SplitType splitType, bool ignorechd)
|
SplitType splitType, bool chdsAsFiles)
|
||||||
{
|
{
|
||||||
// Get the archive scanning level
|
// Get the archive scanning level
|
||||||
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(sevenzip, gz, rar, zip);
|
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(sevenzip, gz, rar, zip);
|
||||||
@@ -354,7 +354,7 @@ namespace SabreTools
|
|||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|
||||||
datdata.RebuildGeneric(inputs, outDir, quickScan, date, delete, inverse, outputFormat, romba, asl,
|
datdata.RebuildGeneric(inputs, outDir, quickScan, date, delete, inverse, outputFormat, romba, asl,
|
||||||
updateDat, headerToCheckAgainst, ignorechd);
|
updateDat, headerToCheckAgainst, chdsAsFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -743,9 +743,9 @@ namespace SabreTools
|
|||||||
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
||||||
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
|
||||||
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
||||||
/// <param name="ignorechd">True if CHDs should be treated like regular files, false otherwise</param>
|
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
|
||||||
private static void InitVerify(List<string> datfiles, List<string> inputs, bool hashOnly, bool quickScan,
|
private static void InitVerify(List<string> datfiles, List<string> inputs, bool hashOnly, bool quickScan,
|
||||||
string headerToCheckAgainst, SplitType splitType, bool ignorechd)
|
string headerToCheckAgainst, SplitType splitType, bool chdsAsFiles)
|
||||||
{
|
{
|
||||||
// Get the archive scanning level
|
// Get the archive scanning level
|
||||||
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(1, 1, 1, 1);
|
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(1, 1, 1, 1);
|
||||||
@@ -764,7 +764,7 @@ namespace SabreTools
|
|||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|
||||||
datdata.VerifyGeneric(inputs, hashOnly, quickScan, headerToCheckAgainst, ignorechd);
|
datdata.VerifyGeneric(inputs, hashOnly, quickScan, headerToCheckAgainst, chdsAsFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -90,7 +90,9 @@ namespace SabreTools
|
|||||||
// User flags
|
// User flags
|
||||||
bool addBlankFilesForEmptyFolder = false,
|
bool addBlankFilesForEmptyFolder = false,
|
||||||
addFileDates = false,
|
addFileDates = false,
|
||||||
|
archivesAsFiles = false,
|
||||||
basedat = false,
|
basedat = false,
|
||||||
|
chdsAsFiles = false,
|
||||||
cleanGameNames = false,
|
cleanGameNames = false,
|
||||||
copyFiles = false,
|
copyFiles = false,
|
||||||
datPrefix = false,
|
datPrefix = false,
|
||||||
@@ -98,12 +100,10 @@ namespace SabreTools
|
|||||||
descAsName = false,
|
descAsName = false,
|
||||||
excludeOf = false,
|
excludeOf = false,
|
||||||
hashOnly = false,
|
hashOnly = false,
|
||||||
ignorechd = false,
|
|
||||||
inplace = true,
|
inplace = true,
|
||||||
inverse = false,
|
inverse = false,
|
||||||
merge = false,
|
merge = false,
|
||||||
oneGameOneRegion = false,
|
oneGameOneRegion = false,
|
||||||
parseArchivesAsFiles = false,
|
|
||||||
quickScan = false,
|
quickScan = false,
|
||||||
quotes = false,
|
quotes = false,
|
||||||
remext = false,
|
remext = false,
|
||||||
@@ -374,7 +374,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-f":
|
case "-f":
|
||||||
case "--files":
|
case "--files":
|
||||||
parseArchivesAsFiles = true;
|
archivesAsFiles = true;
|
||||||
break;
|
break;
|
||||||
case "-gdd":
|
case "-gdd":
|
||||||
case "--game-dedup":
|
case "--game-dedup":
|
||||||
@@ -394,7 +394,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-ic":
|
case "-ic":
|
||||||
case "--ignore-chd":
|
case "--ignore-chd":
|
||||||
ignorechd = true;
|
chdsAsFiles = true;
|
||||||
break;
|
break;
|
||||||
case "-in":
|
case "-in":
|
||||||
case "--inverse":
|
case "--inverse":
|
||||||
@@ -1254,8 +1254,8 @@ namespace SabreTools
|
|||||||
if (datFromDir)
|
if (datFromDir)
|
||||||
{
|
{
|
||||||
InitDatFromDir(inputs, filename, name, description, category, version, author, email, homepage, url, comment,
|
InitDatFromDir(inputs, filename, name, description, category, version, author, email, homepage, url, comment,
|
||||||
forcepack, excludeOf, sceneDateStrip, datFormat, romba, superdat, omitFromScan, removeDateFromAutomaticName, parseArchivesAsFiles,
|
forcepack, excludeOf, sceneDateStrip, datFormat, romba, superdat, omitFromScan, removeDateFromAutomaticName, archivesAsFiles,
|
||||||
skipFileType, addBlankFilesForEmptyFolder, addFileDates, tempDir, outDir, copyFiles, header, ignorechd);
|
skipFileType, addBlankFilesForEmptyFolder, addFileDates, tempDir, outDir, copyFiles, header, chdsAsFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're in header extract and remove mode
|
// If we're in header extract and remove mode
|
||||||
@@ -1274,7 +1274,7 @@ namespace SabreTools
|
|||||||
else if (sort)
|
else if (sort)
|
||||||
{
|
{
|
||||||
InitSort(datfiles, inputs, outDir, quickScan, addFileDates, delete, inverse,
|
InitSort(datfiles, inputs, outDir, quickScan, addFileDates, delete, inverse,
|
||||||
outputFormat, romba, sevenzip, gz, rar, zip, updateDat, header, splitType, ignorechd);
|
outputFormat, romba, sevenzip, gz, rar, zip, updateDat, header, splitType, chdsAsFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're using the sorter from depot
|
// If we're using the sorter from depot
|
||||||
@@ -1326,7 +1326,7 @@ namespace SabreTools
|
|||||||
// If we're using the verifier
|
// If we're using the verifier
|
||||||
else if (verify)
|
else if (verify)
|
||||||
{
|
{
|
||||||
InitVerify(datfiles, inputs, hashOnly, quickScan, header, splitType, ignorechd);
|
InitVerify(datfiles, inputs, hashOnly, quickScan, header, splitType, chdsAsFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're using the depot verifier
|
// If we're using the depot verifier
|
||||||
|
|||||||
Reference in New Issue
Block a user