From 9dc65c09baf7fef8f786f8e5ba84d1d6f9eb6797 Mon Sep 17 00:00:00 2001 From: tsuji Date: Wed, 23 Mar 2022 11:46:14 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=82=BD=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=82=92=E9=9D=9E=E8=A1=A8=E7=A4=BA=E5=8C=96=E3=81=97=E3=80=81?= =?UTF-8?q?=E4=BD=9C=E6=A5=AD=E9=80=B2=E6=8D=97=E3=82=92=E3=83=A1=E3=83=8B?= =?UTF-8?q?=E3=83=A5=E3=83=BC=E3=81=B8=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/CSRender/CSRender/CompareTIFF.cs | 52 ++++++++-- Code/CSRender/CSRender/MainWindow.xaml | 5 +- Code/CSRender/CSRender/MainWindow.xaml.cs | 113 +++++++++++++++++++--- 3 files changed, 147 insertions(+), 23 deletions(-) diff --git a/Code/CSRender/CSRender/CompareTIFF.cs b/Code/CSRender/CSRender/CompareTIFF.cs index 97bb072..af25128 100644 --- a/Code/CSRender/CSRender/CompareTIFF.cs +++ b/Code/CSRender/CSRender/CompareTIFF.cs @@ -21,7 +21,7 @@ namespace CSRender { class CompareTIFF { - public static void runPureVerify(string targetDir, string referenceDir, string workPath, + public static int[] runPureVerify(string targetDir, string referenceDir, string workPath, string shiftPixel, string colorMargin, string removePoint, string shadingOff, bool reportFlag, string reportName, string inDiffPath, string inTargetFileName, DateTime inDateTime, string inReportInfo) { @@ -91,7 +91,7 @@ namespace CSRender processStartInfo.Arguments += "\" "; //レポートファイル名を設定 - string timeForReport = "【" + inDateTime.ToString("yyMMdd_HHmm") + "】" + ".pdf"; + string timeForReport = "[" + inDateTime.ToString("yyMMdd_HHmm") + "]" + ".pdf"; string TargetName = System.IO.Path.Combine(reportName, inTargetFileName + ".pdf" + timeForReport); processStartInfo.Arguments += "/inspReport \""; processStartInfo.Arguments += TargetName; @@ -120,15 +120,23 @@ namespace CSRender //processStartInfo.Arguments += System.IO.Path.Combine(appDirectory, textPath); processStartInfo.Arguments += reportInfoPath; + //コンソールへの出力を制御 + processStartInfo.Arguments += " /consoleOut "; + processStartInfo.Arguments += "2";//0:新規のコンソールに出力、1:親コンソールに出力(無い場合は新規に)、2:NULLコンソールに出力 + //CSRender.exeを実行 Process process = Process.Start(processStartInfo); process.BeginOutputReadLine(); process.WaitForExit(); process.Close(); - //NGの含まれる場合レポート名の頭に【NG】を付与 + //NGの数を取得 + int[] NGOfThisFile = getNgOfPDF(logFileName); + + //NGの含まれる場合レポート名の頭に【NG_】を付与 NGReportName(TargetName, reportName); - + + return NGOfThisFile.ToArray(); } //指定先にレポートを移動 @@ -171,8 +179,10 @@ namespace CSRender { foreach (var oldPathName in NGreportFileName) { + string oldNGName = System.IO.Path.GetFileNameWithoutExtension(oldPathName); + oldNGName = oldNGName.Substring(0, oldNGName.Length - 4) + ".pdf"; string oldFile = System.IO.Path.GetFileName(oldPathName); - File.Copy(oldPathName, System.IO.Path.Combine(inReportPath, "【NG】" + oldFile), true); + File.Copy(oldPathName, System.IO.Path.Combine(inReportPath, "NG_" + oldNGName), true); File.Delete(oldPathName); } } @@ -181,11 +191,41 @@ namespace CSRender foreach (var beforePathName in OKreportFileName) { string oldFile = System.IO.Path.GetFileName(beforePathName); - File.Copy(beforePathName, System.IO.Path.Combine(inReportPath, "【OK】" + oldFile), true); + File.Copy(beforePathName, System.IO.Path.Combine(inReportPath, "OK_" + oldFile), true); File.Delete(beforePathName); } } } + //NG画像の数を取得 + public static int[] getNgOfPDF(string inLogPath) + { + string tranceNGString = File.ReadLines(inLogPath, Encoding.GetEncoding("Shift-JIS")).Skip(16).First();//17行目を抽出 + tranceNGString = tranceNGString.Replace("NG", "");//不要な部分をカット + tranceNGString = tranceNGString.Replace(":", ""); + tranceNGString = tranceNGString.Replace(" ", ""); + + string tranceAllString = File.ReadLines(inLogPath, Encoding.GetEncoding("Shift-JIS")).Skip(14).First();//15行目を抽出 + tranceAllString = tranceAllString.Replace("ALL", "");//不要な部分をカット + tranceAllString = tranceAllString.Replace(":", ""); + tranceAllString = tranceAllString.Replace(" ", ""); + + int NGDataNum = 0; + int AllDataNum = 0; + try + { + NGDataNum = Int32.Parse(tranceNGString); + AllDataNum = Int32.Parse(tranceAllString); + } + catch (FormatException e) + { + NGDataNum = 0; + AllDataNum = 0; + } + int[] DataNumSet = { NGDataNum, AllDataNum }; + + return DataNumSet.ToArray(); + } + } } diff --git a/Code/CSRender/CSRender/MainWindow.xaml b/Code/CSRender/CSRender/MainWindow.xaml index dc93b0f..bd9ae72 100644 --- a/Code/CSRender/CSRender/MainWindow.xaml +++ b/Code/CSRender/CSRender/MainWindow.xaml @@ -77,7 +77,7 @@ - +