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(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(String.Format(Lang.Message.Done.ExtractionCompleteFormat, 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); } }