|
22 | 22 | using xivModdingFramework.Resources;
|
23 | 23 | using xivModdingFramework.SqPack.DataContainers;
|
24 | 24 | using xivModdingFramework.SqPack.FileTypes;
|
| 25 | +using xivModdingFramework.Textures.FileTypes; |
25 | 26 | using xivModdingFramework.Variants.FileTypes;
|
26 | 27 | using static xivModdingFramework.Cache.XivCache;
|
27 | 28 |
|
@@ -490,6 +491,76 @@ public override int GetHashCode()
|
490 | 491 | return Info.ToString().GetHashCode();
|
491 | 492 | }
|
492 | 493 |
|
| 494 | + /// <summary> |
| 495 | + /// Retrieves ALL files used by this root. |
| 496 | + /// </summary> |
| 497 | + /// <param name="index"></param> |
| 498 | + /// <param name="modlist"></param> |
| 499 | + /// <returns></returns> |
| 500 | + public async Task<SortedSet<string>> GetAllFiles(IndexFile index = null, ModList modlist = null) |
| 501 | + { |
| 502 | + |
| 503 | + var df = IOUtil.GetDataFileFromPath(Info.GetRootFile()); |
| 504 | + |
| 505 | + var _imc = new Imc(XivCache.GameInfo.GameDirectory); |
| 506 | + var _mdl = new Mdl(XivCache.GameInfo.GameDirectory, df); |
| 507 | + var _dat = new Dat(XivCache.GameInfo.GameDirectory); |
| 508 | + var _index = new Index(XivCache.GameInfo.GameDirectory); |
| 509 | + var _mtrl = new Mtrl(XivCache.GameInfo.GameDirectory); |
| 510 | + var _modding = new Modding(XivCache.GameInfo.GameDirectory); |
| 511 | + var _atex = new ATex(XivCache.GameInfo.GameDirectory, df); |
| 512 | + |
| 513 | + var files = new HashSet<string>(); |
| 514 | + |
| 515 | + if (index == null) |
| 516 | + { |
| 517 | + index = await _index.GetIndexFile(df); |
| 518 | + modlist = await _modding.GetModListAsync(); |
| 519 | + } |
| 520 | + |
| 521 | + ItemMetadata originalMetadata = await ItemMetadata.GetFromCachedIndex(this, index); |
| 522 | + |
| 523 | + var originalModelPaths = await GetModelFiles(index, modlist); |
| 524 | + var originalMaterialPaths = await GetMaterialFiles(-1, index, modlist); |
| 525 | + var originalTexturePaths = await GetTextureFiles(-1, index, modlist); |
| 526 | + |
| 527 | + var originalVfxPaths = new HashSet<string>(); |
| 528 | + if (Imc.UsesImc(this)) |
| 529 | + { |
| 530 | + var avfxSets = originalMetadata.ImcEntries.Select(x => x.Vfx).Distinct(); |
| 531 | + foreach (var avfx in avfxSets) |
| 532 | + { |
| 533 | + var avfxStuff = await ATex.GetVfxPath(Info, avfx); |
| 534 | + if (String.IsNullOrEmpty(avfxStuff.Folder) || String.IsNullOrEmpty(avfxStuff.File)) continue; |
| 535 | + |
| 536 | + var path = avfxStuff.Folder + "/" + avfxStuff.File; |
| 537 | + if (index.FileExists(path)) |
| 538 | + { |
| 539 | + originalVfxPaths.Add(path); |
| 540 | + var ttpaths = await _atex.GetAtexPaths(path); |
| 541 | + foreach (var ttp in ttpaths) |
| 542 | + { |
| 543 | + originalVfxPaths.Add(ttp.Path); |
| 544 | + } |
| 545 | + } |
| 546 | + } |
| 547 | + } |
| 548 | + |
| 549 | + var af = originalModelPaths.Select(x => x).Union( |
| 550 | + originalMaterialPaths.Select(x => x)).Union( |
| 551 | + originalTexturePaths.Select(x => x)).Union( |
| 552 | + originalVfxPaths.Select(x => x)); |
| 553 | + |
| 554 | + var allFiles = new SortedSet<string>(); |
| 555 | + foreach (var f in af) |
| 556 | + { |
| 557 | + allFiles.Add(f); |
| 558 | + } |
| 559 | + |
| 560 | + allFiles.Add(Info.GetRootFile()); |
| 561 | + |
| 562 | + return allFiles; |
| 563 | + } |
493 | 564 |
|
494 | 565 | /// <summary>
|
495 | 566 | /// Gets all the model files in this dependency chain.
|
|
0 commit comments