private void ExecuteButton_Click(object sender, EventArgs e) { try { if (TargetFolderTextBox.Text == "") { MessageBox.Show("読み込み対象のファイルが格納されているフォルダーを選択して下さい。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FolderBrowserDialog dlg = new FolderBrowserDialog(); dlg.Description = "出力先のフォルダーを選択してください。"; if (dlg.ShowDialog() == DialogResult.Cancel) { return; } var bc = new BookCombination(TargetFolderTextBox.Text, dlg.SelectedPath); bc.Run(); MessageBox.Show("正常終了", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
static void Execute() { foreach (var folder in System.IO.Directory.GetDirectories(Properties.Settings.Default.TargetFolder)) { var bc = new BookCombination(folder, Properties.Settings.Default.OutputParentFolder); bc.Run(); } }