public UiArchives Build() { string[] lists = _gameLocation.EnumerateListingFiless().ToArray(); ConcurrentBag <UiArchiveNode> nodes = new ConcurrentBag <UiArchiveNode>(); Parallel.ForEach(lists, fileName => { ArchiveAccessor accessor = new ArchiveAccessor(GetBinaryFilePath(fileName), fileName); nodes.Add(new UiArchiveNode(accessor, null)); }); return(new UiArchives(nodes.OrderBy(n => n.Name).ToArray())); }
private ImgbArchiveAccessor CreateAccessorV2() { GameLocationInfo gameLocation = InteractionService.GameLocation.Provide(); string binaryPath = Path.Combine(gameLocation.SystemDirectory, "white_imgc.win32.bin"); string listingPath = Path.Combine(gameLocation.SystemDirectory, "filelistc.win32.bin"); ArchiveAccessor accessor = new ArchiveAccessor(binaryPath, listingPath); ArchiveListing listing = ArchiveListingReaderV1.Read(accessor, null, null); ArchiveEntry xgrEntry = listing.Single(n => n.Name.EndsWith(@"gui/resident/system.win32.xgr")); ArchiveEntry imgbEntry = listing.Single(n => n.Name.EndsWith(@"gui/resident/system.win32.imgb")); return(new ImgbArchiveAccessor(listing, xgrEntry, imgbEntry)); }
private bool TryAddZoneListing(ArchiveListing parentListing, ArchiveEntry entry, string entryPath) { if (_areasDirectory == null) { return(false); } if (!entryPath.StartsWith("zone/filelist")) { return(false); } // Slip an empty archives if (entryPath.EndsWith("2")) { return(false); } string binaryName; switch (InteractionService.GamePart) { case FFXIIIGamePart.Part1: binaryName = $"white_{entryPath.Substring(14, 5)}_img{(entryPath.EndsWith("2") ? "2" : string.Empty)}.win32.bin"; break; case FFXIIIGamePart.Part2: binaryName = $"white_{entryPath.Substring(14, 6)}_img{(entryPath.EndsWith("2") ? "2" : string.Empty)}.win32.bin"; break; default: throw new NotSupportedException("InteractionService.GamePart"); } string binaryPath = Path.Combine(_areasDirectory, binaryName); if (!File.Exists(binaryPath)) { return(false); } ArchiveAccessor accessor = parentListing.Accessor.CreateDescriptor(binaryPath, entry); ConcurrentBag <UiNode> container = ProvideRootNodeChilds(UiArchiveExtension.Bin); container.Add(new UiArchiveNode(accessor, parentListing)); return(true); }
public UiArchiveNode(ArchiveAccessor accessor, ArchiveListing parentListing) : base(accessor.ListingEntry.Name, UiNodeType.Archive) { _accessor = accessor; _parentListing = parentListing; }