mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Implement partial packing
This commit is contained in:
@@ -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);
|
||||||
|
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user