private void DeCompressButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { if (SelectedItemList != null) { string startPath = Path.Combine(ListFiles.varListPath, SelectedItemList.Name); if (Path.GetExtension(startPath).ToUpper() == ".ZIP") { try { string decompPath = Path.Combine(ListFiles.varListPath, Path.GetFileNameWithoutExtension(SelectedItemList.Name)); //Directory.CreateDirectory(decompPath); ZipFile.ExtractToDirectory(startPath, decompPath); ListFiles.OutDirAndFiles(RightListFile, ListFiles.varListPath); } catch (System.IO.IOException) { MessageBoxResult res = MessageBox.Show("Файл уже существует. Заменить файл?", "Предупреждение", MessageBoxButton.YesNo); if (res == MessageBoxResult.Yes) { string decompPath = Path.Combine(ListFiles.varListPath, Path.GetFileNameWithoutExtension(SelectedItemList.Name)); Directory.Delete(decompPath, true); ZipFile.ExtractToDirectory(startPath, decompPath); } else { return; } } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка"); } }
void checkThread(Thread thread) { while (thread.IsAlive) { } LoadScreenStop(); Dispatcher.Invoke(() => ListFiles.OutDirAndFiles(RightListFile, ListFiles.varListPath)); }
void checkHashThread(Thread thread, string file) { while (thread.IsAlive) { } LoadScreenStop(); Dispatcher.Invoke(() => ListFiles.OutDirAndFiles(RightListFile, ListFiles.varListPath)); hashWin hw = null; Dispatcher.Invoke(() => hw = new hashWin(file, hash)); Dispatcher.Invoke(() => hw.Show()); }
private void RightSearchDirButton_Click(object sender, RoutedEventArgs e) { try { if (RightSearchDirText.Text != null && RightSearchDirText.Text != "") { ListFiles.OutDirAndFiles(RightListFile, RightSearchDirText.Text); } else { MainWindow mainWindow = new MainWindow(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }