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(true); if (settingsDlg.ShowDialog() != true) return; Stopwatch sw = new Stopwatch(); sw.Start(); Wildcard wildcard = new Wildcard(settingsDlg.Wildcard, false); bool? conversion = settingsDlg.Convert; FileSystemExtractionTarget target = new FileSystemExtractionTarget(); foreach (IUiLeafsAccessor accessor in archives.AccessToCheckedLeafs(wildcard, conversion, null)) accessor.Extract(target); sw.Stop(); if (sw.ElapsedMilliseconds / 1000 > 2) MessageBox.Show($"Распаковка завершена за {sw.Elapsed.ToString(@"d\.hh\:mm\:ss")}.", Lang.Message.Done.Title, MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show(ex.ToString(), Lang.Message.Error.Title, 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); } }