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("Упаковка завершена за {0}.", sw.Elapsed.ToString(@"d\.hh\:mm\:ss")), "Готово!", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error); } }
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 void Patch(DirectoryInfo translationDir, GameLocationInfo gameLocation) { if (CancelEvent.IsSet()) return; Dictionary<string, string> dic = ReadStrings(translationDir); if (CancelEvent.IsSet()) return; FileSystemInjectionSource source = new FileSystemInjectionSource(); source.RegisterStrings(dic); UiArchiveTreeBuilder builder = new UiArchiveTreeBuilder(gameLocation); UiArchives archives = builder.Build(); Position = 0; Maximum = archives.Count; foreach (UiContainerNode archive in archives) { Check(archive); OnProgress(1); } if (CancelEvent.IsSet()) return; IUiLeafsAccessor[] accessors = archives.AccessToCheckedLeafs(new Wildcard("*"), null, false).ToArray(); Position = 0; Maximum = accessors.Length; UiInjectionManager manager = new UiInjectionManager(); foreach (IUiLeafsAccessor accessor in accessors) { accessor.Inject(source, manager); OnProgress(1); } manager.WriteListings(); }