private void importWordlistButton_MouseDown(object sender, MouseButtonEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Wordlist file | *.txt"; ofd.FilterIndex = 1; ofd.ShowDialog(); try { // Add the wordlist to the runner ((Runner)Caller).SetWordlist(WordlistManagerViewModel.FileToWordlist(ofd.FileName)); ((MainDialog)Parent).Close(); } catch { } }
private void wordlistsListView_Drop(object sender, System.Windows.DragEventArgs e) { try { try { myTask?.Dispose(); } catch { } if (addToWordlistsCheckBox.IsChecked.GetValueOrDefault()) { myTask = Task.Run(() => { string[] wordlists = (string[])e.Data.GetData(System.Windows.DataFormats.FileDrop); foreach (string path in wordlists.Where(w => w.EndsWith(".txt"))) { try { var wordlist = WordlistManagerViewModel.FileToWordlist(path); Dispatcher.Invoke(() => wordlist.RemoveDup = removeDupCheckBox.IsChecked.GetValueOrDefault()); Dispatcher.Invoke(() => vm.Add(wordlist)); } catch { } } }); } else { var wordlistPath = ((string[])e.Data.GetData(System.Windows.DataFormats.FileDrop))[0]; if (!wordlistPath.EndsWith(".txt") || !File.Exists(wordlistPath)) { return; } var wordlist = WordlistManagerViewModel.FileToWordlist(wordlistPath); wordlist.RemoveDup = removeDupCheckBox.IsChecked.GetValueOrDefault(); ((Runner)Caller).SetWordlist(wordlist); ((MainDialog)Parent).Close(); } } catch (Exception ex) { SB.Logger.Log(ex.Message, RuriLib.LogLevel.Error, true); } }
private void importWordlistButton_MouseDown(object sender, MouseButtonEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Wordlist file | *.txt"; ofd.FilterIndex = 1; if (ofd.ShowDialog() == DialogResult.OK) { pathTextBox.Text = ofd.FileName; if (addToWordlistsCheckBox.IsChecked.GetValueOrDefault()) { try { var wordlist = WordlistManagerViewModel.FileToWordlist(ofd.FileName); wordlist.RemoveDup = removeDupCheckBox.IsChecked.GetValueOrDefault(); vm.Add(wordlist); } catch (Exception ex) { SB.Logger.Log(ex.Message, RuriLib.LogLevel.Error, true); } } else { try { // Add the wordlist to the runner var wordlist = WordlistManagerViewModel.FileToWordlist(ofd.FileName); wordlist.RemoveDup = removeDupCheckBox.IsChecked.GetValueOrDefault(); ((Runner)Caller).SetWordlist(wordlist); ((MainDialog)Parent).Close(); } catch { } } } }