Commit de2bbc4c authored by tsuji's avatar tsuji

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

parent 399ed706
......@@ -22,7 +22,7 @@ namespace CSRender
class CompareTIFF
{
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();
......@@ -76,13 +76,16 @@ namespace CSRender
processStartInfo.Arguments += "\" /shadingoff \"";
processStartInfo.Arguments += shadingOff;
processStartInfo.Arguments += "\"";
if (reportFlag == true)
{
processStartInfo.Arguments += " /inspReport \"";
processStartInfo.Arguments += reportName;
processStartInfo.Arguments += "\"";
}
//CSRender.exeを実行
Process process = Process.Start(processStartInfo);
//ResultConsole.Text = process.StandardOutput.ReadToEnd();
//process.OutputDataReceived += process_DataReceived;
process.BeginOutputReadLine();
//ResultConsole.ScrollToEnd();
process.WaitForExit();
process.Close();
......
......@@ -62,6 +62,21 @@ namespace CSRender
workBox.Text = dropFiles[0];
workBox.Focus();
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でフォルダ選択のダイアログを表示(対象フォルダ)
......@@ -140,6 +155,33 @@ namespace CSRender
}
//共通部分
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
referenceBox.AddHandler(TextBox.DropEvent, new DragEventHandler(RefBox_Drop), true);
workBox.AddHandler(TextBox.DragOverEvent, new DragEventHandler(textBox_PreviewDragOver), 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ボタン実行
......@@ -188,7 +190,7 @@ namespace CSRender
string targetTIFFPath = System.IO.Path.Combine(workBox.Text, "work", "targetTIFF");
if (Directory.Exists(targetTIFFPath))//指定先にTIFF用フォルダがあるか
{
Directory.Delete(targetTIFFPath,true);//あれば古いTIFF用フォルダを削除(前回作業時の生成物との混同防止)
Directory.Delete(targetTIFFPath, true);//あれば古いTIFF用フォルダを削除(前回作業時の生成物との混同防止)
}
Directory.CreateDirectory(targetTIFFPath);//新規でTIFF用フォルダを作成
......@@ -203,7 +205,7 @@ namespace CSRender
string referenceTIFFPath = System.IO.Path.Combine(workBox.Text, "work", "referenceTIFF");
if (Directory.Exists(referenceTIFFPath))//指定先にTIFF用フォルダがあるか
{
Directory.Delete(referenceTIFFPath,true);//あれば古いTIFF用フォルダを削除(前回作業時の生成物との混同防止)
Directory.Delete(referenceTIFFPath, true);//あれば古いTIFF用フォルダを削除(前回作業時の生成物との混同防止)
}
Directory.CreateDirectory(referenceTIFFPath);//新規でTIFF用フォルダを作成
......@@ -214,16 +216,40 @@ namespace CSRender
ResultConsole.Text += "<TIFF変換完了>\r\n\r\n";
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の実行
//string workDir = CompareTIFF.runPureVerify(targetBox.Text, referenceBox.Text, 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"));
//レポート名を取得
string PDFName = CompareTIFF.getReportName(workDir);
string PDFName = "";
if (reportBox.Text != "")
{
PDFName = reportBox.Text;
}
else
{
PDFName = CompareTIFF.getReportName(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