private void BForm_Load(object sender, EventArgs e) { Text += " " + Application.ProductVersion; Show(); Update(); using (AH2 ah = new AH2()) using (WaitNow wn = new WaitNow()) { wn.Cover(this); foreach (String fp in alfs) { AppendIt(fp); } Application.DoEvents(); } }
private void bSave_Click(object sender, EventArgs e) { if (fbdSave.ShowDialog(this) != DialogResult.OK) return; String saveDir = fbdSave.SelectedPath; List<Parm> parms = Decide(); int total = 0, ok = 0; int c = 1; using (AH2 ah2 = new AH2()) using (WaitNow wn = new WaitNow()) { wn.Cover(this); foreach (Parm parm in parms) { if (parm.cat.Length == 0) continue; String fpOut; while (true) { fpOut = Path.Combine(saveDir, String.Format("分割#{0:0000}.pdf", c)); if (File.Exists(fpOut)) { c++; continue; } break; } ProcessStartInfo psi = new ProcessStartInfo(EUt.pdftk, " " + parm.input + " cat " + parm.cat + " output \"" + fpOut + "\""); psi.UseShellExecute = false; psi.CreateNoWindow = true; Process p = Process.Start(psi); p.Start(); p.WaitForExit(); total++; ok += (p.ExitCode == 0) ? 1 : 0; } } if (total == 0) { MessageBox.Show(this, "何も保存していません。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (ok == total) { MessageBox.Show(this, "分割&保存は、すべて成功しました。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (ok != 0) { MessageBox.Show(this, "分割&保存は、部分的に成功しました。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { MessageBox.Show(this, "分割&保存は、すべて失敗しました。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void bSave_Click(object sender, EventArgs e) { if (fbdSave.ShowDialog(this) != DialogResult.OK) { return; } String saveDir = fbdSave.SelectedPath; List <Parm> parms = Decide(); int total = 0, ok = 0; int c = 1; using (AH2 ah2 = new AH2()) using (WaitNow wn = new WaitNow()) { wn.Cover(this); foreach (Parm parm in parms) { if (parm.cat.Length == 0) { continue; } String fpOut; while (true) { fpOut = Path.Combine(saveDir, String.Format("分割#{0:0000}.pdf", c)); if (File.Exists(fpOut)) { c++; continue; } break; } ProcessStartInfo psi = new ProcessStartInfo(EUt.pdftk, " " + parm.input + " cat " + parm.cat + " output \"" + fpOut + "\""); psi.UseShellExecute = false; psi.CreateNoWindow = true; Process p = Process.Start(psi); p.Start(); p.WaitForExit(); total++; ok += (p.ExitCode == 0) ? 1 : 0; } } if (total == 0) { MessageBox.Show(this, "何も保存していません。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (ok == total) { MessageBox.Show(this, "分割&保存は、すべて成功しました。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (ok != 0) { MessageBox.Show(this, "分割&保存は、部分的に成功しました。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { MessageBox.Show(this, "分割&保存は、すべて失敗しました。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }