public void Execute(object parameter) { try { UiArchives archives = _archivesProvider(); if (archives == null) { return; } UiGameFileCommanderSettingsWindow settingsDlg = new UiGameFileCommanderSettingsWindow(false); if (settingsDlg.ShowDialog() != true) { return; } Stopwatch sw = new Stopwatch(); sw.Start(); Wildcard wildcard = new Wildcard(settingsDlg.Wildcard, false); bool? compression = settingsDlg.Compression; bool? conversion = settingsDlg.Convert; UiInjectionManager manager = new UiInjectionManager(); FileSystemInjectionSource source = new FileSystemInjectionSource(); foreach (IUiLeafsAccessor accessor in archives.AccessToCheckedLeafs(wildcard, conversion, compression)) { accessor.Inject(source, manager); } manager.WriteListings(); if (sw.ElapsedMilliseconds / 1000 > 2) { MessageBox.Show(String.Format(Lang.Message.Done.InjectionCompleteFormat, sw.Elapsed), Lang.Message.Done.Title, MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), Lang.Message.Error.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }
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()); } }
private async Task RefreshContent(GameLocationInfo obj) { try { if (CheckAccess()) { _treeNodes = await obj.ArchivesTree; _treeView.ItemsSource = _treeNodes; SelectNode(); IsEnabled = true; } else { await Dispatcher.Invoke(async() => await RefreshContent(obj)); } } catch (Exception ex) { ClearContent(); UiHelper.ShowError(this, ex); } }