public static void TrashEntries(IMEPackage pcc, IEnumerable <IEntry> itemsToTrash) { ExportEntry trashTopLevel = pcc.Exports.FirstOrDefault(x => x.idxLink == 0 && x.ObjectName == UnrealPackageFile.TrashPackageName); IEntry packageClass = pcc.getEntryOrAddImport("Core.Package"); foreach (IEntry entry in itemsToTrash) { if (entry == trashTopLevel || entry.ObjectName == "Trash") //don't trash what's already been trashed { continue; } trashTopLevel = TrashEntry(entry, trashTopLevel, packageClass); } pcc.RemoveTrailingTrash(); }
public static void TrashEntries(IMEPackage pcc, IEnumerable <IEntry> itemsToTrash) { ExportEntry trashTopLevel = pcc.Exports.FirstOrDefault(x => x.idxLink == 0 && x.ObjectName == UnrealPackageFile.TrashPackageName); ImportEntry packageImport = pcc.Imports.FirstOrDefault(x => x.GetFullPath == "Core.Package"); if (packageImport == null) { ImportEntry coreImport = pcc.Imports.FirstOrDefault(x => x.GetFullPath == "Core"); if (coreImport == null) { //really small file coreImport = new ImportEntry(pcc) { idxObjectName = pcc.FindNameOrAdd("Core"), idxClassName = pcc.FindNameOrAdd("Package"), idxLink = 0, idxPackageFile = pcc.FindNameOrAdd("Core") }; pcc.addImport(coreImport); } //Package isn't an import, could be one of the 2DA files or other small ones packageImport = new ImportEntry(pcc) { idxObjectName = pcc.FindNameOrAdd("Package"), idxClassName = pcc.FindNameOrAdd("Class"), idxLink = coreImport.UIndex, idxPackageFile = pcc.FindNameOrAdd("Core") }; pcc.addImport(packageImport); } foreach (IEntry entry in itemsToTrash) { if (entry == trashTopLevel || entry.ObjectName == "Trash") //don't trash what's already been trashed { continue; } trashTopLevel = TrashEntry(entry, trashTopLevel, packageImport.UIndex); } pcc.RemoveTrailingTrash(); }