Commit de2bbc4c authored by tsuji's avatar tsuji

検版レポートの名前指定機能を追加

parent 399ed706
...@@ -22,7 +22,7 @@ namespace CSRender ...@@ -22,7 +22,7 @@ namespace CSRender
class CompareTIFF class CompareTIFF
{ {
public static string runPureVerify(string targetDir, string referenceDir, string workPath, public static string runPureVerify(string targetDir, string referenceDir, string workPath,
string shiftPixel, string colorMargin, string removePoint, string shadingOff) string shiftPixel, string colorMargin, string removePoint, string shadingOff, bool reportFlag, string reportName)
{ {
//実行用コンソールの呼び出し //実行用コンソールの呼び出し
ProcessStartInfo processStartInfo = new ProcessStartInfo(); ProcessStartInfo processStartInfo = new ProcessStartInfo();
...@@ -76,13 +76,16 @@ namespace CSRender ...@@ -76,13 +76,16 @@ namespace CSRender
processStartInfo.Arguments += "\" /shadingoff \""; processStartInfo.Arguments += "\" /shadingoff \"";
processStartInfo.Arguments += shadingOff; processStartInfo.Arguments += shadingOff;
processStartInfo.Arguments += "\""; processStartInfo.Arguments += "\"";
if (reportFlag == true)
{
processStartInfo.Arguments += " /inspReport \"";
processStartInfo.Arguments += reportName;
processStartInfo.Arguments += "\"";
}
//CSRender.exeを実行 //CSRender.exeを実行
Process process = Process.Start(processStartInfo); Process process = Process.Start(processStartInfo);
//ResultConsole.Text = process.StandardOutput.ReadToEnd();
//process.OutputDataReceived += process_DataReceived;
process.BeginOutputReadLine(); process.BeginOutputReadLine();
//ResultConsole.ScrollToEnd();
process.WaitForExit(); process.WaitForExit();
process.Close(); process.Close();
......
...@@ -62,6 +62,21 @@ namespace CSRender ...@@ -62,6 +62,21 @@ namespace CSRender
workBox.Text = dropFiles[0]; workBox.Text = dropFiles[0];
workBox.Focus(); workBox.Focus();
workBox.Select(this.workBox.Text.Length, 0); workBox.Select(this.workBox.Text.Length, 0);
if (reportBox.Text == "")//検版レポートが未入力ならば作業フォルダ先に指定
{
reportBox.Text = System.IO.Path.Combine(workBox.Text, "report");
reportBox.Text += @"\";
}
}
private void ReportBox_Drop(object sender, System.Windows.DragEventArgs e)
{
var dropFiles = e.Data.GetData(System.Windows.DataFormats.FileDrop) as string[];
if (dropFiles == null) return;
//カーソルを終端に置く
reportBox.Text = dropFiles[0] + @"\";
reportBox.Focus();
reportBox.Select(this.reportBox.Text.Length, 0);
} }
//参照ボタンClickでフォルダ選択のダイアログを表示(対象フォルダ) //参照ボタンClickでフォルダ選択のダイアログを表示(対象フォルダ)
...@@ -140,6 +155,33 @@ namespace CSRender ...@@ -140,6 +155,33 @@ namespace CSRender
} }
//共通部分 //共通部分
workBox.Text = selectFile.FileName; workBox.Text = selectFile.FileName;
reportBox.Text = System.IO.Path.Combine(selectFile.FileName, "report") + @"\";
}
//参照ボタンClickでフォルダ選択のダイアログを表示(検版レポートパス)
private void ReportButton_Click(object sender, RoutedEventArgs e)
{
//ファイル選択の場合
//var selectFile = new OpenFileDialog();
//selectFile.Title = "ファイルを選択してください";
//selectFile.InitialDirectory = @"C:";
//if ((bool)selectFile.ShowDialog())
//{
//FileName = selectFile.FileName;
//FileSelected(this, new EventArgs());
//}
//フォルダ選択の場合
var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog();
selectFile.IsFolderPicker = true;
selectFile.Title = "フォルダを選択してください";
selectFile.InitialDirectory = @"C:";
if (selectFile.ShowDialog() != MSAPI::Dialogs.CommonFileDialogResult.Ok)
{
return;
}
//共通部分
reportBox.Text = selectFile.FileName + @"\";
} }
} }
} }
This diff is collapsed.
...@@ -105,6 +105,8 @@ namespace CSRender ...@@ -105,6 +105,8 @@ namespace CSRender
referenceBox.AddHandler(TextBox.DropEvent, new DragEventHandler(RefBox_Drop), true); referenceBox.AddHandler(TextBox.DropEvent, new DragEventHandler(RefBox_Drop), true);
workBox.AddHandler(TextBox.DragOverEvent, new DragEventHandler(textBox_PreviewDragOver), true); workBox.AddHandler(TextBox.DragOverEvent, new DragEventHandler(textBox_PreviewDragOver), true);
workBox.AddHandler(TextBox.DropEvent, new DragEventHandler(WorkBox_Drop), true); workBox.AddHandler(TextBox.DropEvent, new DragEventHandler(WorkBox_Drop), true);
reportBox.AddHandler(TextBox.DragOverEvent, new DragEventHandler(textBox_PreviewDragOver), true);
reportBox.AddHandler(TextBox.DropEvent, new DragEventHandler(ReportBox_Drop), true);
} }
//Closeボタン実行 //Closeボタン実行
...@@ -188,7 +190,7 @@ namespace CSRender ...@@ -188,7 +190,7 @@ namespace CSRender
string targetTIFFPath = System.IO.Path.Combine(workBox.Text, "work", "targetTIFF"); string targetTIFFPath = System.IO.Path.Combine(workBox.Text, "work", "targetTIFF");
if (Directory.Exists(targetTIFFPath))//指定先にTIFF用フォルダがあるか if (Directory.Exists(targetTIFFPath))//指定先にTIFF用フォルダがあるか
{ {
Directory.Delete(targetTIFFPath,true);//あれば古いTIFF用フォルダを削除(前回作業時の生成物との混同防止) Directory.Delete(targetTIFFPath, true);//あれば古いTIFF用フォルダを削除(前回作業時の生成物との混同防止)
} }
Directory.CreateDirectory(targetTIFFPath);//新規でTIFF用フォルダを作成 Directory.CreateDirectory(targetTIFFPath);//新規でTIFF用フォルダを作成
...@@ -203,7 +205,7 @@ namespace CSRender ...@@ -203,7 +205,7 @@ namespace CSRender
string referenceTIFFPath = System.IO.Path.Combine(workBox.Text, "work", "referenceTIFF"); string referenceTIFFPath = System.IO.Path.Combine(workBox.Text, "work", "referenceTIFF");
if (Directory.Exists(referenceTIFFPath))//指定先にTIFF用フォルダがあるか if (Directory.Exists(referenceTIFFPath))//指定先にTIFF用フォルダがあるか
{ {
Directory.Delete(referenceTIFFPath,true);//あれば古いTIFF用フォルダを削除(前回作業時の生成物との混同防止) Directory.Delete(referenceTIFFPath, true);//あれば古いTIFF用フォルダを削除(前回作業時の生成物との混同防止)
} }
Directory.CreateDirectory(referenceTIFFPath);//新規でTIFF用フォルダを作成 Directory.CreateDirectory(referenceTIFFPath);//新規でTIFF用フォルダを作成
...@@ -214,16 +216,40 @@ namespace CSRender ...@@ -214,16 +216,40 @@ namespace CSRender
ResultConsole.Text += "<TIFF変換完了>\r\n\r\n"; ResultConsole.Text += "<TIFF変換完了>\r\n\r\n";
DoEvents(); DoEvents();
//検版レポートの入力チェック
bool reportFlag = false;
string pdfReportPath = "";
if (reportBox.Text != "")//入力があるか
{
pdfReportPath = reportBox.Text.Substring(0, reportBox.Text.LastIndexOf(@"\"));
if (!Directory.Exists(pdfReportPath))//指定先のフォルダが存在するか
{
Directory.CreateDirectory(pdfReportPath);
}
if (reportBox.Text.Substring(reportBox.Text.Length - 4) != ".pdf")//入力に拡張子がついているか
{
reportBox.Text += ".pdf";
}
reportFlag = true;
}
//PureVerifyの実行 //PureVerifyの実行
//string workDir = CompareTIFF.runPureVerify(targetBox.Text, referenceBox.Text, workBox.Text);
string workDir = CompareTIFF.runPureVerify(targetTIFFPath, referenceTIFFPath, workBox.Text string workDir = CompareTIFF.runPureVerify(targetTIFFPath, referenceTIFFPath, workBox.Text
, shiftPixel, colorMargin, removePoint, shadingOff); , shiftPixel, colorMargin, removePoint, shadingOff, reportFlag, reportBox.Text);
//レポートを出力 //レポートを出力
outputLog(System.IO.Path.Combine(workDir, "report")); outputLog(System.IO.Path.Combine(workDir, "report"));
//レポート名を取得 //レポート名を取得
string PDFName = CompareTIFF.getReportName(workDir); string PDFName = "";
if (reportBox.Text != "")
{
PDFName = reportBox.Text;
}
else
{
PDFName = CompareTIFF.getReportName(workDir);
}
//指定先にレポートを移動 //指定先にレポートを移動
CompareTIFF.moveReport(workBox.Text, workDir); CompareTIFF.moveReport(workBox.Text, workDir);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment