private void btn_btn_protect_Click(object sender, RoutedEventArgs e) { if (Files.Count <= 0 || string.IsNullOrEmpty(ThreadCount.Text)) { return; } int threadCount = int.Parse(ThreadCount.Text); FileEncoding = GetEncoding(EncodeType.SelectedValue.ToString()); System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); fbd.Description = "请选择输出目录"; fbd.ShowNewFolderButton = true; isFastCode = FastDecode.IsChecked == null ? false : (bool)FastDecode.IsChecked; isSpecialCharacters = SpecialCharacters.IsChecked == null ? false : (bool)SpecialCharacters.IsChecked; PackerEncoding = (ECMAScriptPacker.PackerEncoding)EncodingWay.SelectedItem; if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { FailureFileList.Clear(); OutPutDirPath = fbd.SelectedPath; ProgressBar.IsIndeterminate = false; ProgressBar.Visibility = Visibility.Visible; ProgressBar.Maximum = double.Parse(FileCount.Text); ProgressBar.Minimum = 0; StopAllThread(); EncodingThreadList.Clear(); for (int i = 0; i < threadCount; ++i) { Thread encodingThread = new Thread(new ParameterizedThreadStart(encodingHandler)); encodingThread.IsBackground = true; EncodingThreadList.Add(encodingThread); encodingThread.Start(encodingThread); } } }
private void btn_btn_protect_Click(object sender, RoutedEventArgs e) { if (Files.Count <= 0 || string.IsNullOrEmpty(ThreadCount.Text) ) return; int threadCount = int.Parse(ThreadCount.Text); FileEncoding = GetEncoding(EncodeType.SelectedValue.ToString()); System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); fbd.Description = "请选择输出目录"; fbd.ShowNewFolderButton = true; isFastCode = FastDecode.IsChecked == null ? false : (bool)FastDecode.IsChecked; isSpecialCharacters = SpecialCharacters.IsChecked == null ? false : (bool)SpecialCharacters.IsChecked; PackerEncoding = (ECMAScriptPacker.PackerEncoding)EncodingWay.SelectedItem; if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { FailureFileList.Clear(); OutPutDirPath = fbd.SelectedPath; ProgressBar.IsIndeterminate = false; ProgressBar.Visibility = Visibility.Visible; ProgressBar.Maximum = double.Parse(FileCount.Text); ProgressBar.Minimum = 0; StopAllThread(); EncodingThreadList.Clear(); for (int i = 0; i < threadCount; ++i) { Thread encodingThread = new Thread(new ParameterizedThreadStart(encodingHandler)); encodingThread.IsBackground = true; EncodingThreadList.Add(encodingThread); encodingThread.Start(encodingThread); } } }