Fix the cracks in the armor

This commit is contained in:
Matt Nadareski
2020-08-27 20:56:50 -07:00
parent 7cd413bea1
commit 335f160ace
6 changed files with 70 additions and 77 deletions

View File

@@ -51,7 +51,7 @@ namespace RombaSharp.Features
DatFile datfile = DatFile.Create(); DatFile datfile = DatFile.Create();
datfile.Header.Name = string.IsNullOrWhiteSpace(name) ? "untitled" : name; datfile.Header.Name = string.IsNullOrWhiteSpace(name) ? "untitled" : name;
datfile.Header.Description = description; datfile.Header.Description = description;
datfile.PopulateFromDir(source, bare: true, asFiles: TreatAsFiles.AaruFormats | TreatAsFiles.CHDs); datfile.PopulateFromDir(source, asFiles: TreatAsFiles.AaruFormats | TreatAsFiles.CHDs);
datfile.Write(outDir: outdat); datfile.Write(outDir: outdat);
} }
} }

View File

@@ -195,6 +195,34 @@ namespace SabreTools.Library.DatFiles
Header.ConditionalCopy(datHeader); Header.ConditionalCopy(datHeader);
} }
/// <summary>
/// Fill the header values based on existing Header and path
/// </summary>
/// <param name="path">Path used for creating a name, if necessary</param>
/// <param name="bare">True if the date should be omitted from name and description, false otherwise</param>
public void FillHeaderFromPath(string path, bool bare)
{
// If the description is defined but not the name, set the name from the description
if (string.IsNullOrWhiteSpace(Header.Name) && !string.IsNullOrWhiteSpace(Header.Description))
{
Header.Name = Header.Description;
}
// If the name is defined but not the description, set the description from the name
else if (!string.IsNullOrWhiteSpace(Header.Name) && string.IsNullOrWhiteSpace(Header.Description))
{
Header.Description = Header.Name + (bare ? string.Empty : $" ({Header.Date})");
}
// If neither the name or description are defined, set them from the automatic values
else if (string.IsNullOrWhiteSpace(Header.Name) && string.IsNullOrWhiteSpace(Header.Description))
{
string[] splitpath = path.TrimEnd(Path.DirectorySeparatorChar).Split(Path.DirectorySeparatorChar);
Header.Name = splitpath.Last();
Header.Description = Header.Name + (bare ? string.Empty : $" ({Header.Date})");
}
}
#endregion #endregion
#region Converting and Updating #region Converting and Updating
@@ -2098,50 +2126,22 @@ namespace SabreTools.Library.DatFiles
/// </summary> /// </summary>
/// <param name="basePath">Base folder to be used in creating the DAT</param> /// <param name="basePath">Base folder to be used in creating the DAT</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="bare">True if the date should be omitted from the DAT, false otherwise</param>
/// <param name="asFiles">TreatAsFiles representing CHD and Archive scanning</param> /// <param name="asFiles">TreatAsFiles representing CHD and Archive scanning</param>
/// <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="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="extras">ExtraIni object to apply to the DatFile</param>
/// <param name="filter">Filter object to be passed to the DatItem level</param>
/// <param name="useTags">True if DatFile tags override splitting, false otherwise</param>
/// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually /// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
public bool PopulateFromDir( public bool PopulateFromDir(
string basePath, string basePath,
Hash omitFromScan = Hash.DeepHashes, Hash omitFromScan = Hash.DeepHashes,
bool bare = false,
TreatAsFiles asFiles = 0x00, TreatAsFiles 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 copyFiles = false)
ExtraIni extras = null,
Filter filter = null,
bool useTags = false)
{ {
// If the description is defined but not the name, set the name from the description
if (string.IsNullOrWhiteSpace(Header.Name) && !string.IsNullOrWhiteSpace(Header.Description))
{
Header.Name = Header.Description;
}
// If the name is defined but not the description, set the description from the name
else if (!string.IsNullOrWhiteSpace(Header.Name) && string.IsNullOrWhiteSpace(Header.Description))
{
Header.Description = Header.Name + (bare ? string.Empty : $" ({Header.Date})");
}
// If neither the name or description are defined, set them from the automatic values
else if (string.IsNullOrWhiteSpace(Header.Name) && string.IsNullOrWhiteSpace(Header.Description))
{
string[] splitpath = basePath.TrimEnd(Path.DirectorySeparatorChar).Split(Path.DirectorySeparatorChar);
Header.Name = splitpath.Last();
Header.Description = Header.Name + (bare ? string.Empty : $" ({Header.Date})");
}
// Clean the temp directory path // Clean the temp directory path
Globals.TempDir = DirectoryExtensions.Ensure(Globals.TempDir, temp: true); Globals.TempDir = DirectoryExtensions.Ensure(Globals.TempDir, temp: true);
@@ -2204,14 +2204,6 @@ namespace SabreTools.Library.DatFiles
if (Globals.TempDir != Path.GetTempPath()) if (Globals.TempDir != Path.GetTempPath())
DirectoryExtensions.TryDelete(Globals.TempDir); DirectoryExtensions.TryDelete(Globals.TempDir);
// If we have valid extras, perform the application now
if (extras != null && extras != default(ExtraIni))
ApplyExtras(extras);
// If we have a valid filter, perform the filtering now
if (filter != null && filter != default(Filter))
ApplyFilter(filter, useTags);
return true; return true;
} }
@@ -2346,8 +2338,7 @@ namespace SabreTools.Library.DatFiles
omitFromScan: omitFromScan, omitFromScan: omitFromScan,
date: addDate, date: addDate,
header: Header.HeaderSkipper, header: Header.HeaderSkipper,
aaruFormatAsFiles: asFiles.HasFlag(TreatAsFiles.AaruFormats), asFiles: asFiles);
chdsAsFiles: asFiles.HasFlag(TreatAsFiles.CHDs));
ProcessFileHelper(item, DatItem.Create(baseFile), basePath, string.Empty); ProcessFileHelper(item, DatItem.Create(baseFile), basePath, string.Empty);
} }
@@ -2676,7 +2667,7 @@ namespace SabreTools.Library.DatFiles
/// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param> /// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param>
/// <param name="outputFormat">Output format that files should be written to</param> /// <param name="outputFormat">Output format that files should be written to</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="asFiles">TreatAsFiles representing CHD and Archive scanning</param> /// <param name="asFiles">TreatAsFiles representing special format scanning</param>
/// <returns>True if rebuilding was a success, false otherwise</returns> /// <returns>True if rebuilding was a success, false otherwise</returns>
public bool RebuildGeneric( public bool RebuildGeneric(
List<string> inputs, List<string> inputs,
@@ -2811,7 +2802,7 @@ namespace SabreTools.Library.DatFiles
/// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param> /// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param>
/// <param name="outputFormat">Output format that files should be written to</param> /// <param name="outputFormat">Output format that files should be written to</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="asFiles">TreatAsFiles representing CHD and Archive scanning</param> /// <param name="asFiles">TreatAsFiles representing special format scanning</param>
private void RebuildGenericHelper( private void RebuildGenericHelper(
string file, string file,
string outDir, string outDir,
@@ -2837,8 +2828,7 @@ namespace SabreTools.Library.DatFiles
file, file,
omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes), omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes),
header: Header.HeaderSkipper, header: Header.HeaderSkipper,
aaruFormatAsFiles: asFiles.HasFlag(TreatAsFiles.AaruFormats), asFiles: asFiles);
chdsAsFiles: asFiles.HasFlag(TreatAsFiles.CHDs));
DatItem externalDatItem = null; DatItem externalDatItem = null;
if (externalFileInfo.Type == FileType.AaruFormat) if (externalFileInfo.Type == FileType.AaruFormat)
@@ -2876,8 +2866,7 @@ namespace SabreTools.Library.DatFiles
BaseFile internalFileInfo = FileExtensions.GetInfo( BaseFile internalFileInfo = FileExtensions.GetInfo(
file, file,
omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes), omitFromScan: (quickScan ? Hash.SecureHashes : Hash.DeepHashes),
aaruFormatAsFiles: asFiles.HasFlag(TreatAsFiles.AaruFormats), asFiles: asFiles);
chdsAsFiles: asFiles.HasFlag(TreatAsFiles.CHDs));
DatItem internalDatItem = null; DatItem internalDatItem = null;
if (internalFileInfo.Type == FileType.AaruFormat) if (internalFileInfo.Type == FileType.AaruFormat)
@@ -2937,7 +2926,7 @@ namespace SabreTools.Library.DatFiles
outputFormat = OutputFormat.Folder; outputFormat = OutputFormat.Folder;
} }
// If we have a disk or media, change it into a Rom for later use // If we have a Disk or Media, change it into a Rom for later use
if (datItem.ItemType == ItemType.Disk) if (datItem.ItemType == ItemType.Disk)
datItem = (datItem as Disk).ConvertToRom(); datItem = (datItem as Disk).ConvertToRom();
if (datItem.ItemType == ItemType.Media) if (datItem.ItemType == ItemType.Media)
@@ -3266,10 +3255,9 @@ namespace SabreTools.Library.DatFiles
PopulateFromDir( PopulateFromDir(
input, input,
quickScan ? Hash.SecureHashes : Hash.DeepHashes, quickScan ? Hash.SecureHashes : Hash.DeepHashes,
bare: true, asFiles: asFiles);
asFiles: asFiles, ApplyExtras(extras);
extras: extras, ApplyFilter(filter, false);
filter: filter);
} }
// Setup the fixdat // Setup the fixdat
@@ -3465,22 +3453,26 @@ namespace SabreTools.Library.DatFiles
{ {
nodump.Items.Add(key, item); nodump.Items.Add(key, item);
} }
// If the file has a SHA-512 // If the file has a SHA-512
else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA512))) else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA512)))
{ {
sha512.Items.Add(key, item); sha512.Items.Add(key, item);
} }
// If the file has a SHA-384 // If the file has a SHA-384
else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA384))) else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA384)))
{ {
sha384.Items.Add(key, item); sha384.Items.Add(key, item);
} }
// If the file has a SHA-256 // If the file has a SHA-256
else if ((item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).SHA256)) else if ((item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).SHA256))
|| (item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA256))) || (item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).SHA256)))
{ {
sha256.Items.Add(key, item); sha256.Items.Add(key, item);
} }
// If the file has a SHA-1 // If the file has a SHA-1
else if ((item.ItemType == ItemType.Disk && !string.IsNullOrWhiteSpace((item as Disk).SHA1)) else if ((item.ItemType == ItemType.Disk && !string.IsNullOrWhiteSpace((item as Disk).SHA1))
|| (item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).SHA1)) || (item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).SHA1))
@@ -3488,6 +3480,7 @@ namespace SabreTools.Library.DatFiles
{ {
sha1.Items.Add(key, item); sha1.Items.Add(key, item);
} }
#if NET_FRAMEWORK #if NET_FRAMEWORK
// If the file has a RIPEMD160 // If the file has a RIPEMD160
else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).RIPEMD160))) else if ((item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).RIPEMD160)))
@@ -3495,11 +3488,11 @@ namespace SabreTools.Library.DatFiles
ripemd160.Items.Add(key, item); ripemd160.Items.Add(key, item);
} }
#endif #endif
// If the file has an MD5 // If the file has an MD5
else if ((item.ItemType == ItemType.Disk && !string.IsNullOrWhiteSpace((item as Disk).MD5)) else if ((item.ItemType == ItemType.Disk && !string.IsNullOrWhiteSpace((item as Disk).MD5))
|| (item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).MD5) || (item.ItemType == ItemType.Media && !string.IsNullOrWhiteSpace((item as Media).MD5))
|| (item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).MD5))) || (item.ItemType == ItemType.Rom && !string.IsNullOrWhiteSpace((item as Rom).MD5)))
)
{ {
md5.Items.Add(key, item); md5.Items.Add(key, item);
} }
@@ -3714,8 +3707,8 @@ namespace SabreTools.Library.DatFiles
List<DatItem> items = Items[key]; List<DatItem> items = Items[key];
foreach (DatItem item in items) foreach (DatItem item in items)
{ {
// If the file is a Disk // If the file is a Disk
if (item.ItemType == ItemType.Disk) if (item.ItemType == ItemType.Disk)
diskdat.Items.Add(key, item); diskdat.Items.Add(key, item);
// If the file is a Media // If the file is a Media
@@ -3930,7 +3923,6 @@ namespace SabreTools.Library.DatFiles
} }
} }
return; return;
} }

View File

@@ -339,10 +339,9 @@ namespace SabreTools.Library.IO
/// <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="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="aaruFormatAsFiles">True if AaruFormats should be treated like regular files, false otherwise</param> /// <param name="asFiles">TreatAsFiles representing special format scanning</param>
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
/// <returns>Populated BaseFile object if success, empty one on error</returns> /// <returns>Populated BaseFile object if success, empty one on error</returns>
public static BaseFile GetInfo(string input, Hash omitFromScan = 0x0, bool date = false, string header = null, bool aaruFormatAsFiles = true, bool chdsAsFiles = true) public static BaseFile GetInfo(string input, Hash omitFromScan = 0x0, bool date = false, string header = null, TreatAsFiles asFiles = 0x00)
{ {
// Add safeguard if file doesn't exist // Add safeguard if file doesn't exist
if (!File.Exists(input)) if (!File.Exists(input))
@@ -363,7 +362,7 @@ namespace SabreTools.Library.IO
// 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);
baseFile = outputStream.GetInfo(omitFromScan: omitFromScan, keepReadOpen: false, aaruFormatAsFiles: aaruFormatAsFiles, chdsAsFiles: chdsAsFiles); baseFile = outputStream.GetInfo(omitFromScan: omitFromScan, keepReadOpen: false, asFiles: asFiles);
// Dispose of the streams // Dispose of the streams
outputStream.Dispose(); outputStream.Dispose();
@@ -372,12 +371,12 @@ namespace SabreTools.Library.IO
// Otherwise, just get the info // Otherwise, just get the info
else else
{ {
baseFile = TryOpenRead(input).GetInfo(omitFromScan: omitFromScan, keepReadOpen: false, aaruFormatAsFiles: aaruFormatAsFiles, chdsAsFiles: chdsAsFiles); baseFile = TryOpenRead(input).GetInfo(omitFromScan: omitFromScan, keepReadOpen: false, asFiles: asFiles);
} }
} }
else else
{ {
baseFile = TryOpenRead(input).GetInfo(omitFromScan: omitFromScan, keepReadOpen: false, aaruFormatAsFiles: aaruFormatAsFiles, chdsAsFiles: chdsAsFiles); baseFile = TryOpenRead(input).GetInfo(omitFromScan: omitFromScan, keepReadOpen: false, asFiles: asFiles);
} }
// Add unique data from the file // Add unique data from the file

View File

@@ -45,12 +45,11 @@ namespace SabreTools.Library.IO
/// <param name="size">Size of the input stream</param> /// <param name="size">Size of the input stream</param>
/// <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="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="aaruFormatAsFiles">True if AaruFormats should be treated like regular files, false otherwise</param> /// <param name="asFiles">TreatAsFiles representing special format scanning</param>
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
/// <returns>Populated BaseFile object if success, empty one on error</returns> /// <returns>Populated BaseFile object if success, empty one on error</returns>
public static BaseFile GetInfo(this Stream input, long size = -1, Hash omitFromScan = 0x0, bool keepReadOpen = false, bool aaruFormatAsFiles = true, bool chdsAsFiles = true) public static BaseFile GetInfo(this Stream input, long size = -1, Hash omitFromScan = 0x0, bool keepReadOpen = false, TreatAsFiles asFiles = 0x00)
{ {
return GetInfoAsync(input, size, omitFromScan, keepReadOpen, aaruFormatAsFiles, chdsAsFiles).ConfigureAwait(false).GetAwaiter().GetResult(); return GetInfoAsync(input, size, omitFromScan, keepReadOpen, asFiles).ConfigureAwait(false).GetAwaiter().GetResult();
} }
/// <summary> /// <summary>
@@ -60,17 +59,16 @@ namespace SabreTools.Library.IO
/// <param name="size">Size of the input stream</param> /// <param name="size">Size of the input stream</param>
/// <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="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="aaruFormatAsFiles">True if AaruFormats should be treated like regular files, false otherwise</param> /// <param name="asFiles">TreatAsFiles representing special format scanning</param>
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
/// <returns>Populated BaseFile object if success, empty one on error</returns> /// <returns>Populated BaseFile object if success, empty one on error</returns>
public static async Task<BaseFile> GetInfoAsync(Stream input, long size = -1, Hash omitFromScan = 0x0, bool keepReadOpen = false, bool aaruFormatAsFiles = true, bool chdsAsFiles = true) public static async Task<BaseFile> GetInfoAsync(Stream input, long size = -1, Hash omitFromScan = 0x0, bool keepReadOpen = false, TreatAsFiles asFiles = 0x00)
{ {
// If we want to automatically set the size // If we want to automatically set the size
if (size == -1) if (size == -1)
size = input.Length; size = input.Length;
// We first check to see if it's an AaruFormat if we have to // We first check to see if it's an AaruFormat if we have to
if (!aaruFormatAsFiles) if (!asFiles.HasFlag(TreatAsFiles.AaruFormats))
{ {
var aaruFormat = AaruFormat.Create(input); var aaruFormat = AaruFormat.Create(input);
input.SeekIfPossible(); input.SeekIfPossible();
@@ -86,7 +84,7 @@ namespace SabreTools.Library.IO
} }
// Then, we first check to see if it's a CHD if we have to // Then, we first check to see if it's a CHD if we have to
if (!chdsAsFiles) if (!asFiles.HasFlag(TreatAsFiles.CHDs))
{ {
var chd = CHDFile.Create(input); var chd = CHDFile.Create(input);
input.SeekIfPossible(); input.SeekIfPossible();

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using SabreTools.Library.Data; using SabreTools.Library.Data;
using SabreTools.Library.DatFiles;
using SabreTools.Library.FileTypes; using SabreTools.Library.FileTypes;
using SabreTools.Library.IO; using SabreTools.Library.IO;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
@@ -118,7 +119,7 @@ namespace SabreTools.Library.Skippers
// 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
if (!nostore) if (!nostore)
{ {
BaseFile baseFile = FileExtensions.GetInfo(newfile, aaruFormatAsFiles: true, chdsAsFiles: true); BaseFile baseFile = FileExtensions.GetInfo(newfile, asFiles: TreatAsFiles.AaruFormats | TreatAsFiles.CHDs);
DatabaseTools.AddHeaderToDatabase(hstr, Utilities.ByteArrayToString(baseFile.SHA1), rule.SourceFile); DatabaseTools.AddHeaderToDatabase(hstr, Utilities.ByteArrayToString(baseFile.SHA1), rule.SourceFile);
} }
@@ -138,7 +139,7 @@ namespace SabreTools.Library.Skippers
Directory.CreateDirectory(outDir); Directory.CreateDirectory(outDir);
// First, get the SHA-1 hash of the file // First, get the SHA-1 hash of the file
BaseFile baseFile = FileExtensions.GetInfo(file, aaruFormatAsFiles: true, chdsAsFiles: true); BaseFile baseFile = FileExtensions.GetInfo(file, asFiles: TreatAsFiles.AaruFormats | TreatAsFiles.CHDs);
// 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(Utilities.ByteArrayToString(baseFile.SHA1)); List<string> headers = DatabaseTools.RetrieveHeadersFromDatabase(Utilities.ByteArrayToString(baseFile.SHA1));

View File

@@ -77,21 +77,24 @@ namespace SabreTools.Features
// Clone the base Dat for information // Clone the base Dat for information
DatFile datdata = DatFile.Create(basedat.Header); DatFile datdata = DatFile.Create(basedat.Header);
// Get the base path and fill the header, if needed
string basePath = Path.GetFullPath(path); string basePath = Path.GetFullPath(path);
datdata.FillHeaderFromPath(basePath, noAutomaticDate);
// Now populate from the path
bool success = datdata.PopulateFromDir( bool success = datdata.PopulateFromDir(
basePath, basePath,
omitFromScan, omitFromScan,
noAutomaticDate,
asFiles, asFiles,
skipFileType, skipFileType,
addBlankFiles, addBlankFiles,
addFileDates, addFileDates,
copyFiles, copyFiles);
Extras,
Filter);
if (success) if (success)
{ {
datdata.ApplyExtras(Extras);
datdata.ApplyFilter(Filter, false);
datdata.Write(OutputDir); datdata.Write(OutputDir);
} }
else else