Commit 40d853de authored by tsuji's avatar tsuji

PureVerifyの処理をマルチタスク化

parent 1bf2445a
...@@ -21,7 +21,7 @@ namespace CSRender ...@@ -21,7 +21,7 @@ namespace CSRender
{ {
class CompareTIFF class CompareTIFF
{ {
public static string runPureVerify(string targetDir, string referenceDir, string workPath, public static void 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, string inDiffPath, string inTargetFileName, DateTime inDateTime) bool reportFlag, string reportName, string inDiffPath, string inTargetFileName, DateTime inDateTime)
{ {
...@@ -99,6 +99,11 @@ namespace CSRender ...@@ -99,6 +99,11 @@ namespace CSRender
processStartInfo.Arguments += "\" "; processStartInfo.Arguments += "\" ";
//差異画像の出力 //差異画像の出力
inDiffPath = System.IO.Path.Combine(inDiffPath, inTargetFileName);
if (!Directory.Exists(inDiffPath))
{
Directory.CreateDirectory(inDiffPath);
}
processStartInfo.Arguments += "/outDiff \""; processStartInfo.Arguments += "/outDiff \"";
processStartInfo.Arguments += inDiffPath; processStartInfo.Arguments += inDiffPath;
processStartInfo.Arguments += "\" "; processStartInfo.Arguments += "\" ";
...@@ -117,7 +122,7 @@ namespace CSRender ...@@ -117,7 +122,7 @@ namespace CSRender
//NGの含まれる場合レポート名の頭に【NG】を付与 //NGの含まれる場合レポート名の頭に【NG】を付与
NGReportName(TargetName, reportName); NGReportName(TargetName, reportName);
return workDir; //return workDir;
} }
//指定先にレポートを移動 //指定先にレポートを移動
......
...@@ -105,8 +105,13 @@ namespace CSRender ...@@ -105,8 +105,13 @@ namespace CSRender
private void CompareButtonClick(object sender, RoutedEventArgs e) private void CompareButtonClick(object sender, RoutedEventArgs e)
{ {
string workBoxText = workBox.Text;
string reportBoxText = reportBox.Text;
string targetBoxText = targetBox.Text;
string referenceBoxText = referenceBox.Text;
//対象フォルダのpathチェック //対象フォルダのpathチェック
if (!Directory.Exists(targetBox.Text) && !File.Exists(targetBox.Text)) if (!Directory.Exists(targetBoxText) && !File.Exists(targetBoxText))
{ {
CustomMsgBox.Show(mainWindow, "指定されたファイルあるいはフォルダが存在しません。" + CustomMsgBox.Show(mainWindow, "指定されたファイルあるいはフォルダが存在しません。" +
"\nもう一度設定してください。", "The specified file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information); "\nもう一度設定してください。", "The specified file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information);
...@@ -119,7 +124,7 @@ namespace CSRender ...@@ -119,7 +124,7 @@ namespace CSRender
} }
//リファレンスファイルのpathチェック //リファレンスファイルのpathチェック
if (!Directory.Exists(referenceBox.Text) && !File.Exists(referenceBox.Text)) if (!Directory.Exists(referenceBoxText) && !File.Exists(referenceBoxText))
{ {
CustomMsgBox.Show(mainWindow, "指定されたリファレンスファイルあるいはフォルダが存在しません。" + CustomMsgBox.Show(mainWindow, "指定されたリファレンスファイルあるいはフォルダが存在しません。" +
"\nもう一度設定してください。", "The specified reference file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information); "\nもう一度設定してください。", "The specified reference file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information);
...@@ -132,7 +137,7 @@ namespace CSRender ...@@ -132,7 +137,7 @@ namespace CSRender
} }
//出力ファイルpathのチェック //出力ファイルpathのチェック
if (!Directory.Exists(workBox.Text) && !File.Exists(workBox.Text)) if (!Directory.Exists(workBoxText) && !File.Exists(workBoxText))
{ {
CustomMsgBox.Show(mainWindow, "指定された作業フォルダが存在しません。" + CustomMsgBox.Show(mainWindow, "指定された作業フォルダが存在しません。" +
"\nもう一度設定してください。", "The work space folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information); "\nもう一度設定してください。", "The work space folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information);
...@@ -140,12 +145,12 @@ namespace CSRender ...@@ -140,12 +145,12 @@ namespace CSRender
ResultConsole.Text += "<TIFF変換中止>\r\n"; ResultConsole.Text += "<TIFF変換中止>\r\n";
ResultConsole.ScrollToEnd(); ResultConsole.ScrollToEnd();
workBox.Text = ""; workBox.Text = "";
Properties.Settings.Default.workSpaceSetting = workBox.Text; Properties.Settings.Default.workSpaceSetting = workBoxText;
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
return; return;
} }
string workLogPath = System.IO.Path.Combine(workBox.Text, "report"); string workLogPath = System.IO.Path.Combine(workBoxText, "report");
string outDiffPath = System.IO.Path.Combine(workBox.Text, "OUT_DIFF");//DIFF画像の出力先パス string outDiffPath = System.IO.Path.Combine(workBoxText, "OUT_DIFF");//DIFF画像の出力先パス
if (!Directory.Exists(outDiffPath)) if (!Directory.Exists(outDiffPath))
{ {
Directory.CreateDirectory(outDiffPath);//DIFF画像の出力先パスが無ければ作成 Directory.CreateDirectory(outDiffPath);//DIFF画像の出力先パスが無ければ作成
...@@ -197,7 +202,7 @@ namespace CSRender ...@@ -197,7 +202,7 @@ namespace CSRender
DoEvents(); DoEvents();
//対象フォルダ //対象フォルダ
string targetTIFFPath = System.IO.Path.Combine(workBox.Text, "work", "targetTIFF"); string targetTIFFPath = System.IO.Path.Combine(workBoxText, "work", "targetTIFF");
if (Directory.Exists(targetTIFFPath))//指定先にTIFF用フォルダがあるか if (Directory.Exists(targetTIFFPath))//指定先にTIFF用フォルダがあるか
{ {
Directory.Delete(targetTIFFPath, true);//あれば古いTIFF用フォルダを削除(前回作業時の生成物との混同防止) Directory.Delete(targetTIFFPath, true);//あれば古いTIFF用フォルダを削除(前回作業時の生成物との混同防止)
...@@ -208,7 +213,7 @@ namespace CSRender ...@@ -208,7 +213,7 @@ namespace CSRender
try try
{ {
string targetTIFFResult = string targetTIFFResult =
OutputTIFF.runCSRender(ResolutionBox.Text, "TIFF", pageFlag, selectedPage, targetBox.Text, targetTIFFPath); OutputTIFF.runCSRender(ResolutionBox.Text, "TIFF", pageFlag, selectedPage, targetBoxText, targetTIFFPath);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -227,7 +232,7 @@ namespace CSRender ...@@ -227,7 +232,7 @@ namespace CSRender
DoEvents(); DoEvents();
//リファレンスフォルダ //リファレンスフォルダ
string referenceTIFFPath = System.IO.Path.Combine(workBox.Text, "work", "referenceTIFF"); string referenceTIFFPath = System.IO.Path.Combine(workBoxText, "work", "referenceTIFF");
if (Directory.Exists(referenceTIFFPath))//指定先にTIFF用フォルダがあるか if (Directory.Exists(referenceTIFFPath))//指定先にTIFF用フォルダがあるか
{ {
Directory.Delete(referenceTIFFPath, true);//あれば古いTIFF用フォルダを削除(前回作業時の生成物との混同防止) Directory.Delete(referenceTIFFPath, true);//あれば古いTIFF用フォルダを削除(前回作業時の生成物との混同防止)
...@@ -238,7 +243,7 @@ namespace CSRender ...@@ -238,7 +243,7 @@ namespace CSRender
try try
{ {
string referenceTIFFResult = string referenceTIFFResult =
OutputTIFF.runCSRender(ResolutionBox.Text, "TIFF", pageFlag, selectedPage, referenceBox.Text, referenceTIFFPath); OutputTIFF.runCSRender(ResolutionBox.Text, "TIFF", pageFlag, selectedPage, referenceBoxText, referenceTIFFPath);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -264,7 +269,7 @@ namespace CSRender ...@@ -264,7 +269,7 @@ namespace CSRender
try try
{ {
//レポートへの出力内容を編集 //レポートへの出力内容を編集
editReport(allRipTime, workBox.Text); editReport(allRipTime, workBoxText);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -283,19 +288,19 @@ namespace CSRender ...@@ -283,19 +288,19 @@ namespace CSRender
// 日付取得 // 日付取得
DateTime NowTime = DateTime.Now; DateTime NowTime = DateTime.Now;
//検版対象ファイル名の取得 //検版対象ファイル名の取得
string[] inspectionTargets = GetTargetList(targetBox.Text, referenceBox.Text); string[] inspectionTargets = GetTargetList(targetBoxText, referenceBoxText);
foreach (var targetPDFName in inspectionTargets) string appPath = System.Reflection.Assembly.GetExecutingAssembly().Location; //モジュールのパスを取得
string appDirectory = appPath.Substring(0, appPath.LastIndexOf(@"\") + 1); //モジュールの存在するディレクトリを取得
workDir = System.IO.Path.Combine(appDirectory, "PureVerify.Data", "RipVerify");
Parallel.ForEach(inspectionTargets, targetPDFName =>
{ {
//PureVerifyの実行 //PureVerifyの実行
workDir = CompareTIFF.runPureVerify(targetTIFFPath, referenceTIFFPath, workBox.Text CompareTIFF.runPureVerify(targetTIFFPath, referenceTIFFPath, workBoxText
, shiftPixel, colorMargin, removePoint, shadingOff, reportFlag, reportBox.Text, , shiftPixel, colorMargin, removePoint, shadingOff, reportFlag, reportBoxText,
outDiffPath, targetPDFName, NowTime); outDiffPath, targetPDFName, NowTime);
} });
//string targetPDFName = "";
//PureVerifyの実行
//workDir = CompareTIFF.runPureVerify(targetTIFFPath, referenceTIFFPath, workBox.Text
//, shiftPixel, colorMargin, removePoint, shadingOff, reportFlag, reportBox.Text, outDiffPath, targetPDFName);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -332,7 +337,7 @@ namespace CSRender ...@@ -332,7 +337,7 @@ namespace CSRender
//レポート名を取得 //レポート名を取得
if (reportBox.Text != "") if (reportBox.Text != "")
{ {
PDFName = reportBox.Text; PDFName = reportBoxText;
} }
else else
{ {
...@@ -352,15 +357,15 @@ namespace CSRender ...@@ -352,15 +357,15 @@ namespace CSRender
} }
//指定先にレポートを移動 //指定先にレポートを移動
CompareTIFF.moveReport(workBox.Text, workDir); CompareTIFF.moveReport(workBoxText, workDir);
//レポートのパスを表示 //レポートのパスを表示
ResultConsole.Text += " 検版レポートのパス:"; ResultConsole.Text += " 検版レポートのパス:";
ResultConsole.Text += System.IO.Path.Combine(workBox.Text, "report", PDFName); ResultConsole.Text += System.IO.Path.Combine(workBoxText, "report", PDFName);
ResultConsole.Text += "\r\n"; ResultConsole.Text += "\r\n";
if(reportBox.Text == "") if(reportBox.Text == "")
{ {
reportBox.Text = System.IO.Path.Combine(workBox.Text, "report", PDFName); reportBox.Text = System.IO.Path.Combine(workBoxText, "report", PDFName);
} }
//パラメータを次回初期値用に保存 //パラメータを次回初期値用に保存
...@@ -370,10 +375,10 @@ namespace CSRender ...@@ -370,10 +375,10 @@ namespace CSRender
Properties.Settings.Default.colorMarginSetting = GradationBox.Value; Properties.Settings.Default.colorMarginSetting = GradationBox.Value;
Properties.Settings.Default.removePointSetting = SmallDiffBox.Value; Properties.Settings.Default.removePointSetting = SmallDiffBox.Value;
Properties.Settings.Default.shadingOffSetting = VisualBox.Value; Properties.Settings.Default.shadingOffSetting = VisualBox.Value;
Properties.Settings.Default.workSpaceSetting = workBox.Text; Properties.Settings.Default.workSpaceSetting = workBoxText;
Properties.Settings.Default.targetSetting = targetBox.Text; Properties.Settings.Default.targetSetting = targetBoxText;
Properties.Settings.Default.referenceSetting = referenceBox.Text; Properties.Settings.Default.referenceSetting = referenceBoxText;
Properties.Settings.Default.reportPathSetting = reportBox.Text; Properties.Settings.Default.reportPathSetting = reportBoxText;
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
} }
......
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