Beispiel #1
0
        private IEnumerable <UiNode> EnumerateNodes(UiNodePath path, int level)
        {
            UiNodePathElement element = path[level];

            if (element == null)
            {
                yield break;
            }

            foreach (UiNode node in GetChilds().Where(node => element.IsMatch(node)))
            {
                if (path.IsLast(level))
                {
                    yield return(node);
                }
                else
                {
                    UiContainerNode container = node as UiContainerNode;
                    if (container == null)
                    {
                        continue;
                    }

                    foreach (UiNode child in container.EnumerateNodes(path, level + 1))
                    {
                        yield return(child);
                    }
                }
            }
        }
        private ImgbArchiveAccessor CreateAccessor()
        {
            UiArchives archives = InteractionService.GameLocation.Provide().ArchivesTree.Result;

            UiNodePathBuilder pathBuilder = new UiNodePathBuilder(5);

            pathBuilder.Add(UiNodeType.Group);
            pathBuilder.Add(UiNodeType.Group, new Wildcard(UiArchiveExtension.Xgr.ToString()));
            pathBuilder.Add(UiNodeType.Directory, new Wildcard("gui"));
            pathBuilder.Add(UiNodeType.Directory, new Wildcard("resident"));
            if (InteractionService.GamePart == FFXIIIGamePart.Part1)
            {
                pathBuilder.Add(UiNodeType.FileTable, new Wildcard("system.win32.xgr"));
            }
            else
            {
                pathBuilder.Add(UiNodeType.FileTable, new Wildcard("system_jp.win32.xgr"));
            }
            UiNodePath path = pathBuilder.Build();

            foreach (UiContainerNode archive in archives)
            {
                foreach (UiWpdTableLeaf leaf in (archive.EnumerateNodes(path)).SelectMany(system => system.GetChilds()).OfType <UiWpdTableLeaf>())
                {
                    return(leaf.Listing.Accessor);
                }
            }

            switch (InteractionService.GamePart)
            {
            case FFXIIIGamePart.Part1:
                return(CreateAccessorV1());

            case FFXIIIGamePart.Part2:
                return(CreateAccessorV2());

            default:
                throw new NotSupportedException(InteractionService.GamePart.ToString());
            }
        }
Beispiel #3
0
 public IEnumerable <UiNode> EnumerateNodes(UiNodePath path)
 {
     return(EnumerateNodes(path, 0));
 }