Implement partial packing

This commit is contained in:
Matt Nadareski
2020-08-28 21:10:02 -07:00
parent 2a5a5516d9
commit e76d19033f
2 changed files with 18 additions and 1 deletions

View File

@@ -2479,6 +2479,10 @@ namespace SabreTools.Library.DatFiles
if (fileinfo == null) if (fileinfo == null)
continue; continue;
// If we have partial, just ensure we are sorted correctly
if (outputFormat == OutputFormat.Folder && Header.ForcePacking == PackingFlag.Partial)
Items.BucketBy(Field.DatItem_SHA1, DedupeType.None);
// If there are no items in the hash, we continue // If there are no items in the hash, we continue
if (Items[hash] == null || Items[hash].Count == 0) if (Items[hash] == null || Items[hash].Count == 0)
continue; continue;
@@ -2909,9 +2913,23 @@ namespace SabreTools.Library.DatFiles
Globals.Logger.User($"{(inverse ? "No matches" : "Matches")} found for '{Path.GetFileName(datItem.Name)}', rebuilding accordingly..."); Globals.Logger.User($"{(inverse ? "No matches" : "Matches")} found for '{Path.GetFileName(datItem.Name)}', rebuilding accordingly...");
rebuilt = true; rebuilt = true;
// Special case for partial packing mode
bool shouldCheck = false;
if (outputFormat == OutputFormat.Folder && Header.ForcePacking == PackingFlag.Partial)
{
shouldCheck = true;
Items.BucketBy(Field.Machine_Name, DedupeType.None, lower: false);
}
// Now loop through the list and rebuild accordingly // Now loop through the list and rebuild accordingly
foreach (DatItem item in dupes) foreach (DatItem item in dupes)
{ {
// If we should check for the items in the machine
if (shouldCheck && Items[item.Machine.Name].Count > 1)
outputFormat = OutputFormat.Folder;
else if (shouldCheck && Items[item.Machine.Name].Count == 1)
outputFormat = OutputFormat.ParentFolder;
// Get the output archive, if possible // Get the output archive, if possible
Folder outputArchive = Folder.Create(outputFormat); Folder outputArchive = Folder.Create(outputFormat);

View File

@@ -854,7 +854,6 @@ namespace SabreTools.Library.DatItems
if (key == null) if (key == null)
key = "null"; key = "null";
key = WebUtility.HtmlEncode(key);
break; break;
case Field.DatItem_MD5: case Field.DatItem_MD5: