mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 20:43:09 +00:00
GFPAK : Fix deleting file entries from improper folder indices
This commit is contained in:
parent
e636da8d19
commit
32093a1822
1 changed files with 7 additions and 13 deletions
|
@ -962,22 +962,16 @@ namespace FirstPlugin
|
|||
|
||||
public bool DeleteFile(ArchiveFileInfo archiveFileInfo)
|
||||
{
|
||||
int index = 0;
|
||||
foreach (FileEntry file in files)
|
||||
int removeindex = files.IndexOf((FileEntry)archiveFileInfo);
|
||||
foreach (var folder in folders)
|
||||
{
|
||||
//Remove folder references first
|
||||
//Regenerate the indices after
|
||||
foreach (var folder in folders)
|
||||
{
|
||||
for (int f = 0; f < folder.FileCount; f++)
|
||||
if (folder.hashes[f].Index == index)
|
||||
folder.hashes.RemoveAt(f);
|
||||
}
|
||||
|
||||
|
||||
index++;
|
||||
for (int f = 0; f < folder.FileCount; f++)
|
||||
if (folder.hashes[f].Index == removeindex)
|
||||
folder.hashes.RemoveAt(f);
|
||||
}
|
||||
|
||||
RegenerateFileIndices();
|
||||
|
||||
files.Remove((FileEntry)archiveFileInfo);
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue