mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Reduce who cares about date
This commit is contained in:
@@ -1973,7 +1973,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <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="outDir">Output directory to </param>
|
/// <param name="outDir">Output directory to </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>
|
||||||
public bool PopulateFromDir(
|
public bool PopulateFromDir(
|
||||||
@@ -1981,7 +1980,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
TreatAsFile asFiles = 0x00,
|
TreatAsFile asFiles = 0x00,
|
||||||
SkipFileType skipFileType = SkipFileType.None,
|
SkipFileType skipFileType = SkipFileType.None,
|
||||||
bool addBlanks = false,
|
bool addBlanks = false,
|
||||||
bool addDate = false,
|
|
||||||
bool quickScan = false)
|
bool quickScan = false)
|
||||||
{
|
{
|
||||||
// Clean the temp directory path
|
// Clean the temp directory path
|
||||||
@@ -1996,7 +1994,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, quickScan);
|
CheckFileForHashes(item, basePath, asFiles, skipFileType, addBlanks, 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
|
||||||
@@ -2043,7 +2041,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
asFiles,
|
asFiles,
|
||||||
skipFileType,
|
skipFileType,
|
||||||
addBlanks,
|
addBlanks,
|
||||||
addDate,
|
|
||||||
quickScan);
|
quickScan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2064,7 +2061,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <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="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,
|
||||||
@@ -2072,7 +2068,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
TreatAsFile asFiles,
|
TreatAsFile asFiles,
|
||||||
SkipFileType skipFileType,
|
SkipFileType skipFileType,
|
||||||
bool addBlanks,
|
bool addBlanks,
|
||||||
bool addDate,
|
|
||||||
bool quickScan)
|
bool quickScan)
|
||||||
{
|
{
|
||||||
// If we're in depot mode, process it separately
|
// If we're in depot mode, process it separately
|
||||||
@@ -2085,7 +2080,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
// If we have an archive and we're supposed to scan it
|
// If we have an archive and we're supposed to scan it
|
||||||
if (archive != null && !asFiles.HasFlag(TreatAsFile.Archive))
|
if (archive != null && !asFiles.HasFlag(TreatAsFile.Archive))
|
||||||
extracted = archive.GetChildren(date: addDate);
|
extracted = archive.GetChildren();
|
||||||
|
|
||||||
// If the file should be skipped based on type, do so now
|
// If the file should be skipped based on type, do so now
|
||||||
if ((extracted != null && skipFileType == SkipFileType.Archive)
|
if ((extracted != null && skipFileType == SkipFileType.Archive)
|
||||||
@@ -2096,7 +2091,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)
|
if (extracted == null)
|
||||||
ProcessFile(item, basePath, addDate, asFiles);
|
ProcessFile(item, basePath, asFiles);
|
||||||
|
|
||||||
// Otherwise, add all of the found items
|
// Otherwise, add all of the found items
|
||||||
else
|
else
|
||||||
@@ -2179,12 +2174,11 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">File to be added</param>
|
/// <param name="item">File to be added</param>
|
||||||
/// <param name="basePath">Path the represents the parent directory</param>
|
/// <param name="basePath">Path the represents the parent directory</param>
|
||||||
/// <param name="addDate">True if dates should be archived for all files, false otherwise</param>
|
|
||||||
/// <param name="asFiles">TreatAsFiles representing CHD and Archive scanning</param>
|
/// <param name="asFiles">TreatAsFiles representing CHD and Archive scanning</param>
|
||||||
private void ProcessFile(string item, string basePath, bool addDate, TreatAsFile asFiles)
|
private void ProcessFile(string item, string basePath, TreatAsFile asFiles)
|
||||||
{
|
{
|
||||||
Globals.Logger.Verbose($"'{Path.GetFileName(item)}' treated like a file");
|
Globals.Logger.Verbose($"'{Path.GetFileName(item)}' treated like a file");
|
||||||
BaseFile baseFile = FileExtensions.GetInfo(item, addDate, Header.HeaderSkipper, asFiles);
|
BaseFile baseFile = FileExtensions.GetInfo(item, date: true, header: Header.HeaderSkipper, asFiles: asFiles);
|
||||||
DatItem datItem = DatItem.Create(baseFile);
|
DatItem datItem = DatItem.Create(baseFile);
|
||||||
ProcessFileHelper(item, datItem, basePath, string.Empty);
|
ProcessFileHelper(item, datItem, basePath, string.Empty);
|
||||||
}
|
}
|
||||||
@@ -2576,7 +2570,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
// Now get all extracted items from the archive
|
// Now get all extracted items from the archive
|
||||||
if (archive != null)
|
if (archive != null)
|
||||||
entries = archive.GetChildren(date: date);
|
entries = archive.GetChildren();
|
||||||
|
|
||||||
// If the entries list is null, we encountered an error or have a file and should scan externally
|
// If the entries list is null, we encountered an error or have a file and should scan externally
|
||||||
if (entries == null && File.Exists(file))
|
if (entries == null && File.Exists(file))
|
||||||
|
|||||||
@@ -153,10 +153,8 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of DatItem objects from the header values in an archive
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
|
||||||
/// <returns>List of DatItem objects representing the found data</returns>
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
public override abstract List<BaseFile> GetChildren();
|
||||||
public override abstract List<BaseFile> GetChildren(bool date = false);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of empty folders in an archive
|
/// Generate a list of empty folders in an archive
|
||||||
|
|||||||
@@ -256,16 +256,15 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of immediate children from the current folder
|
/// Generate a list of immediate children from the current folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
|
||||||
/// <returns>List of BaseFile objects representing the found data</returns>
|
/// <returns>List of BaseFile objects representing the found data</returns>
|
||||||
public virtual List<BaseFile> GetChildren(bool date = false)
|
public virtual List<BaseFile> GetChildren()
|
||||||
{
|
{
|
||||||
if (_children == null || _children.Count == 0)
|
if (_children == null || _children.Count == 0)
|
||||||
{
|
{
|
||||||
_children = new List<BaseFile>();
|
_children = new List<BaseFile>();
|
||||||
foreach (string file in Directory.EnumerateFiles(this.Filename, "*", SearchOption.TopDirectoryOnly))
|
foreach (string file in Directory.EnumerateFiles(this.Filename, "*", SearchOption.TopDirectoryOnly))
|
||||||
{
|
{
|
||||||
BaseFile nf = FileExtensions.GetInfo(file, date: date);
|
BaseFile nf = FileExtensions.GetInfo(file);
|
||||||
_children.Add(nf);
|
_children.Add(nf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using System.Linq;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
using SabreTools.Library.DatFiles;
|
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
using SabreTools.Library.IO;
|
using SabreTools.Library.IO;
|
||||||
using SabreTools.Library.Tools;
|
using SabreTools.Library.Tools;
|
||||||
@@ -189,10 +188,8 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of DatItem objects from the header values in an archive
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
|
||||||
/// <returns>List of DatItem objects representing the found data</returns>
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
public override List<BaseFile> GetChildren()
|
||||||
public override List<BaseFile> GetChildren(bool date = false)
|
|
||||||
{
|
{
|
||||||
if (_children == null || _children.Count == 0)
|
if (_children == null || _children.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -235,7 +232,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
BaseFile gzipEntryRom = gzstream.GetInfo();
|
BaseFile gzipEntryRom = gzstream.GetInfo();
|
||||||
gzipEntryRom.Filename = gz.Filename(0);
|
gzipEntryRom.Filename = gz.Filename(0);
|
||||||
gzipEntryRom.Parent = gamename;
|
gzipEntryRom.Parent = gamename;
|
||||||
gzipEntryRom.Date = (date && gz.TimeStamp > 0 ? gz.TimeStamp.ToString() : null);
|
gzipEntryRom.Date = (gz.TimeStamp > 0 ? gz.TimeStamp.ToString() : null);
|
||||||
_children.Add(gzipEntryRom);
|
_children.Add(gzipEntryRom);
|
||||||
gzstream.Dispose();
|
gzstream.Dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using SabreTools.Library.DatFiles;
|
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
|
|
||||||
namespace SabreTools.Library.FileTypes
|
namespace SabreTools.Library.FileTypes
|
||||||
@@ -78,10 +77,8 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of DatItem objects from the header values in an archive
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
|
||||||
/// <returns>List of DatItem objects representing the found data</returns>
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
public override List<BaseFile> GetChildren()
|
||||||
public override List<BaseFile> GetChildren(bool date = false)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using SabreTools.Library.DatFiles;
|
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
|
|
||||||
namespace SabreTools.Library.FileTypes
|
namespace SabreTools.Library.FileTypes
|
||||||
@@ -78,10 +77,8 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of DatItem objects from the header values in an archive
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
|
||||||
/// <returns>List of DatItem objects representing the found data</returns>
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
public override List<BaseFile> GetChildren()
|
||||||
public override List<BaseFile> GetChildren(bool date = false)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
using SabreTools.Library.DatFiles;
|
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
using SabreTools.Library.IO;
|
using SabreTools.Library.IO;
|
||||||
using SharpCompress.Archives;
|
using SharpCompress.Archives;
|
||||||
@@ -175,10 +174,8 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of DatItem objects from the header values in an archive
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
|
||||||
/// <returns>List of DatItem objects representing the found data</returns>
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
public override List<BaseFile> GetChildren()
|
||||||
public override List<BaseFile> GetChildren(bool date = false)
|
|
||||||
{
|
{
|
||||||
List<BaseFile> found = new List<BaseFile>();
|
List<BaseFile> found = new List<BaseFile>();
|
||||||
string gamename = Path.GetFileNameWithoutExtension(this.Filename);
|
string gamename = Path.GetFileNameWithoutExtension(this.Filename);
|
||||||
@@ -196,7 +193,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
Filename = entry.Key,
|
Filename = entry.Key,
|
||||||
Size = entry.Size,
|
Size = entry.Size,
|
||||||
CRC = BitConverter.GetBytes(entry.Crc),
|
CRC = BitConverter.GetBytes(entry.Crc),
|
||||||
Date = (date && entry.LastModifiedTime != null ? entry.LastModifiedTime?.ToString("yyyy/MM/dd hh:mm:ss") : null),
|
Date = (entry.LastModifiedTime != null ? entry.LastModifiedTime?.ToString("yyyy/MM/dd hh:mm:ss") : null),
|
||||||
|
|
||||||
Parent = gamename,
|
Parent = gamename,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
using SabreTools.Library.DatFiles;
|
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
using SabreTools.Library.IO;
|
using SabreTools.Library.IO;
|
||||||
using SabreTools.Library.Tools;
|
using SabreTools.Library.Tools;
|
||||||
@@ -259,10 +258,8 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of DatItem objects from the header values in an archive
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
|
||||||
/// <returns>List of DatItem objects representing the found data</returns>
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
public override List<BaseFile> GetChildren()
|
||||||
public override List<BaseFile> GetChildren(bool date = false)
|
|
||||||
{
|
{
|
||||||
List<BaseFile> found = new List<BaseFile>();
|
List<BaseFile> found = new List<BaseFile>();
|
||||||
string gamename = Path.GetFileNameWithoutExtension(this.Filename);
|
string gamename = Path.GetFileNameWithoutExtension(this.Filename);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
using SabreTools.Library.DatFiles;
|
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
using SabreTools.Library.IO;
|
using SabreTools.Library.IO;
|
||||||
using SabreTools.Library.Tools;
|
using SabreTools.Library.Tools;
|
||||||
@@ -180,10 +179,8 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of DatItem objects from the header values in an archive
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
|
||||||
/// <returns>List of DatItem objects representing the found data</returns>
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
public override List<BaseFile> GetChildren()
|
||||||
public override List<BaseFile> GetChildren(bool date = false)
|
|
||||||
{
|
{
|
||||||
List<BaseFile> found = new List<BaseFile>();
|
List<BaseFile> found = new List<BaseFile>();
|
||||||
string gamename = Path.GetFileNameWithoutExtension(this.Filename);
|
string gamename = Path.GetFileNameWithoutExtension(this.Filename);
|
||||||
@@ -201,7 +198,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
Filename = entry.Key,
|
Filename = entry.Key,
|
||||||
Size = entry.Size,
|
Size = entry.Size,
|
||||||
CRC = BitConverter.GetBytes(entry.Crc),
|
CRC = BitConverter.GetBytes(entry.Crc),
|
||||||
Date = (date && entry.LastModifiedTime != null ? entry.LastModifiedTime?.ToString("yyyy/MM/dd hh:mm:ss") : null),
|
Date = (entry.LastModifiedTime != null ? entry.LastModifiedTime?.ToString("yyyy/MM/dd hh:mm:ss") : null),
|
||||||
|
|
||||||
Parent = gamename,
|
Parent = gamename,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using System.IO;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
using SabreTools.Library.DatFiles;
|
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
using SabreTools.Library.IO;
|
using SabreTools.Library.IO;
|
||||||
using SabreTools.Library.Tools;
|
using SabreTools.Library.Tools;
|
||||||
@@ -181,10 +180,8 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of DatItem objects from the header values in an archive
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
|
||||||
/// <returns>List of DatItem objects representing the found data</returns>
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
public override List<BaseFile> GetChildren()
|
||||||
public override List<BaseFile> GetChildren(bool date = false)
|
|
||||||
{
|
{
|
||||||
if (_children == null || _children.Count == 0)
|
if (_children == null || _children.Count == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using SabreTools.Library.DatFiles;
|
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
|
|
||||||
namespace SabreTools.Library.FileTypes
|
namespace SabreTools.Library.FileTypes
|
||||||
@@ -78,10 +77,8 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of DatItem objects from the header values in an archive
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
|
||||||
/// <returns>List of DatItem objects representing the found data</returns>
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
public override List<BaseFile> GetChildren()
|
||||||
public override List<BaseFile> GetChildren(bool date = false)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using SabreTools.Library.Data;
|
using SabreTools.Library.Data;
|
||||||
using SabreTools.Library.DatFiles;
|
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
using SabreTools.Library.IO;
|
using SabreTools.Library.IO;
|
||||||
using SabreTools.Library.Tools;
|
using SabreTools.Library.Tools;
|
||||||
@@ -260,10 +259,8 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of DatItem objects from the header values in an archive
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
|
||||||
/// <returns>List of DatItem objects representing the found data</returns>
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
public override List<BaseFile> GetChildren()
|
||||||
public override List<BaseFile> GetChildren(bool date = false)
|
|
||||||
{
|
{
|
||||||
List<BaseFile> found = new List<BaseFile>();
|
List<BaseFile> found = new List<BaseFile>();
|
||||||
string gamename = Path.GetFileNameWithoutExtension(this.Filename);
|
string gamename = Path.GetFileNameWithoutExtension(this.Filename);
|
||||||
@@ -312,7 +309,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
Filename = newname,
|
Filename = newname,
|
||||||
Size = newsize,
|
Size = newsize,
|
||||||
CRC = newcrc,
|
CRC = newcrc,
|
||||||
Date = (date ? convertedDate : null),
|
Date = convertedDate,
|
||||||
|
|
||||||
Parent = gamename,
|
Parent = gamename,
|
||||||
});
|
});
|
||||||
@@ -324,7 +321,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
zipEntryRom.Filename = zf.Filename(i);
|
zipEntryRom.Filename = zf.Filename(i);
|
||||||
zipEntryRom.Parent = gamename;
|
zipEntryRom.Parent = gamename;
|
||||||
string convertedDate = zf.LastModified(i).ToString("yyyy/MM/dd hh:mm:ss");
|
string convertedDate = zf.LastModified(i).ToString("yyyy/MM/dd hh:mm:ss");
|
||||||
zipEntryRom.Date = (date ? convertedDate : null);
|
zipEntryRom.Date = convertedDate;
|
||||||
found.Add(zipEntryRom);
|
found.Add(zipEntryRom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using SabreTools.Library.Data;
|
|
||||||
using SabreTools.Library.DatFiles;
|
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
|
|
||||||
namespace SabreTools.Library.FileTypes
|
namespace SabreTools.Library.FileTypes
|
||||||
@@ -79,10 +77,8 @@ namespace SabreTools.Library.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a list of DatItem objects from the header values in an archive
|
/// Generate a list of DatItem objects from the header values in an archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">True if entry dates should be included, false otherwise (default)</param>
|
|
||||||
/// <returns>List of DatItem objects representing the found data</returns>
|
/// <returns>List of DatItem objects representing the found data</returns>
|
||||||
/// <remarks>TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually</remarks>
|
public override List<BaseFile> GetChildren()
|
||||||
public override List<BaseFile> GetChildren(bool date = false)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -339,11 +339,10 @@ namespace SabreTools.Library.IO
|
|||||||
/// Retrieve file information for a single file
|
/// Retrieve file information for a single file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input">Filename to get information from</param>
|
/// <param name="input">Filename to get information from</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="asFiles">TreatAsFiles representing special format scanning</param>
|
/// <param name="asFiles">TreatAsFiles representing special format scanning</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, bool date = false, string header = null, TreatAsFile asFiles = 0x00)
|
public static BaseFile GetInfo(string input, string header = null, TreatAsFile asFiles = 0x00)
|
||||||
{
|
{
|
||||||
// Add safeguard if file doesn't exist
|
// Add safeguard if file doesn't exist
|
||||||
if (!File.Exists(input))
|
if (!File.Exists(input))
|
||||||
@@ -384,7 +383,7 @@ namespace SabreTools.Library.IO
|
|||||||
|
|
||||||
// Add unique data from the file
|
// Add unique data from the file
|
||||||
baseFile.Filename = Path.GetFileName(input);
|
baseFile.Filename = Path.GetFileName(input);
|
||||||
baseFile.Date = (date ? new FileInfo(input).LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss") : string.Empty);
|
baseFile.Date = new FileInfo(input).LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss");
|
||||||
|
|
||||||
return baseFile;
|
return baseFile;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,10 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: We might not want to remove higher order hashes in the future
|
// TODO: We might not want to remove higher order hashes in the future
|
||||||
datFile.ApplyCleaning(new Cleaner() { ExcludeFields = Hash.DeepHashes.AsFields() });
|
// TODO: We might not want to remove dates in the future
|
||||||
|
Cleaner dfdCleaner = new Cleaner() { ExcludeFields = Hash.DeepHashes.AsFields() };
|
||||||
|
dfdCleaner.ExcludeFields.Add(Field.DatItem_Date);
|
||||||
|
datFile.ApplyCleaning(dfdCleaner);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -66,11 +66,13 @@ namespace SabreTools.Features
|
|||||||
var skipFileType = GetSkipFileType(features);
|
var skipFileType = GetSkipFileType(features);
|
||||||
var splitType = GetSplitType(features);
|
var splitType = GetSplitType(features);
|
||||||
|
|
||||||
// Apply the omit from scan values to the cleaner
|
// Apply the specialized field removals to the cleaner
|
||||||
if (Cleaner.ExcludeFields == null)
|
if (Cleaner.ExcludeFields == null)
|
||||||
Cleaner.ExcludeFields = new List<Field>();
|
Cleaner.ExcludeFields = new List<Field>();
|
||||||
|
|
||||||
Cleaner.ExcludeFields.AddRange(omitFromScan.AsFields());
|
Cleaner.ExcludeFields.AddRange(omitFromScan.AsFields());
|
||||||
|
if (!addFileDates)
|
||||||
|
Cleaner.ExcludeFields.Add(Field.DatItem_Date);
|
||||||
|
|
||||||
// Create a new DATFromDir object and process the inputs
|
// Create a new DATFromDir object and process the inputs
|
||||||
DatFile basedat = DatFile.Create(Header);
|
DatFile basedat = DatFile.Create(Header);
|
||||||
@@ -94,7 +96,6 @@ namespace SabreTools.Features
|
|||||||
asFiles,
|
asFiles,
|
||||||
skipFileType,
|
skipFileType,
|
||||||
addBlankFiles,
|
addBlankFiles,
|
||||||
addFileDates,
|
|
||||||
quickScan: omitFromScan == Hash.SecureHashes);
|
quickScan: omitFromScan == Hash.SecureHashes);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
|
|||||||
Reference in New Issue
Block a user