mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Remove unnecessary removers, clarify hashes
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
using SabreTools.Core;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.DatItems;
|
using SabreTools.DatItems;
|
||||||
using SabreTools.DatItems.Formats;
|
using SabreTools.DatItems.Formats;
|
||||||
@@ -67,8 +68,8 @@ have a current entry in the DAT index.";
|
|||||||
DatFile df = DatFile.Create();
|
DatFile df = DatFile.Create();
|
||||||
foreach (string dir in onlyDirs)
|
foreach (string dir in onlyDirs)
|
||||||
{
|
{
|
||||||
DatFromDir.PopulateFromDir(df, dir, asFiles: TreatAsFile.NonArchive);
|
DatFromDir.PopulateFromDir(df, dir, asFiles: TreatAsFile.NonArchive, hashes: Hash.Standard);
|
||||||
DatFromDir.PopulateFromDir(df, dir, asFiles: TreatAsFile.All);
|
DatFromDir.PopulateFromDir(df, dir, asFiles: TreatAsFile.All, hashes: Hash.Standard);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create an empty Dat for files that need to be rebuilt
|
// Create an empty Dat for files that need to be rebuilt
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
using SabreTools.Core;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.DatTools;
|
using SabreTools.DatTools;
|
||||||
using SabreTools.FileTypes;
|
using SabreTools.FileTypes;
|
||||||
using SabreTools.Filtering;
|
|
||||||
using SabreTools.Help;
|
using SabreTools.Help;
|
||||||
using SabreTools.IO;
|
using SabreTools.IO;
|
||||||
|
|
||||||
@@ -53,16 +53,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;
|
||||||
DatFromDir.PopulateFromDir(datfile, source, asFiles: TreatAsFile.NonArchive);
|
DatFromDir.PopulateFromDir(datfile, source, asFiles: TreatAsFile.NonArchive, hashes: Hash.Standard);
|
||||||
Remover remover = new Remover();
|
|
||||||
remover.PopulateExclusionsFromList(new List<string>
|
|
||||||
{
|
|
||||||
"DatItem.SHA256",
|
|
||||||
"DatItem.SHA384",
|
|
||||||
"DatItem.SHA512",
|
|
||||||
"DatItem.SpamSum",
|
|
||||||
});
|
|
||||||
remover.ApplyRemovals(datfile);
|
|
||||||
Writer.Write(datfile, outdat);
|
Writer.Write(datfile, outdat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
using SabreTools.Core;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.DatItems;
|
using SabreTools.DatItems;
|
||||||
using SabreTools.DatItems.Formats;
|
using SabreTools.DatItems.Formats;
|
||||||
@@ -65,7 +66,7 @@ contents of any changed dats.";
|
|||||||
// First get a list of SHA-1's from the input DATs
|
// First get a list of SHA-1's from the input DATs
|
||||||
DatFile datroot = DatFile.Create();
|
DatFile datroot = DatFile.Create();
|
||||||
datroot.Header.Type = "SuperDAT";
|
datroot.Header.Type = "SuperDAT";
|
||||||
DatFromDir.PopulateFromDir(datroot, _dats, asFiles: TreatAsFile.NonArchive);
|
DatFromDir.PopulateFromDir(datroot, _dats, asFiles: TreatAsFile.NonArchive, hashes: Hash.Standard);
|
||||||
datroot.Items.BucketBy(ItemKey.SHA1, DedupeType.None);
|
datroot.Items.BucketBy(ItemKey.SHA1, DedupeType.None);
|
||||||
|
|
||||||
// Create a List of dat hashes in the database (SHA-1)
|
// Create a List of dat hashes in the database (SHA-1)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
using SabreTools.Core;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.DatItems;
|
using SabreTools.DatItems;
|
||||||
using SabreTools.DatItems.Formats;
|
using SabreTools.DatItems.Formats;
|
||||||
@@ -66,7 +67,7 @@ namespace RombaSharp.Features
|
|||||||
|
|
||||||
// Now rescan the depot itself
|
// Now rescan the depot itself
|
||||||
DatFile depot = DatFile.Create();
|
DatFile depot = DatFile.Create();
|
||||||
DatFromDir.PopulateFromDir(depot, depotname, asFiles: TreatAsFile.NonArchive);
|
DatFromDir.PopulateFromDir(depot, depotname, asFiles: TreatAsFile.NonArchive, hashes: Hash.Standard);
|
||||||
depot.Items.BucketBy(ItemKey.SHA1, DedupeType.None);
|
depot.Items.BucketBy(ItemKey.SHA1, DedupeType.None);
|
||||||
|
|
||||||
// Set the base queries to use
|
// Set the base queries to use
|
||||||
|
|||||||
@@ -154,20 +154,12 @@ Reset the internal state: reset();";
|
|||||||
// Assume there could be multiple
|
// Assume there could be multiple
|
||||||
foreach (string input in command.Arguments)
|
foreach (string input in command.Arguments)
|
||||||
{
|
{
|
||||||
DatTools.DatFromDir.PopulateFromDir(datFile, input);
|
DatTools.DatFromDir.PopulateFromDir(datFile, input, hashes: Hash.Standard);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: We might not want to remove higher order hashes in the future
|
|
||||||
// TODO: We might not want to remove dates in the future
|
// TODO: We might not want to remove dates in the future
|
||||||
Remover dfdRemover = new Remover();
|
Remover dfdRemover = new Remover();
|
||||||
dfdRemover.PopulateExclusionsFromList(new List<string>
|
dfdRemover.PopulateExclusionsFromList(new List<string> { "DatItem.Date" });
|
||||||
{
|
|
||||||
"DatItem.SHA256",
|
|
||||||
"DatItem.SHA384",
|
|
||||||
"DatItem.SHA512",
|
|
||||||
"DatItem.SpamSum",
|
|
||||||
"DatItem.Date",
|
|
||||||
});
|
|
||||||
dfdRemover.ApplyRemovals(datFile);
|
dfdRemover.ApplyRemovals(datFile);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user