diff --git a/Code/CSRender/CSRender/CompareTIFF.cs b/Code/CSRender/CSRender/CompareTIFF.cs index 9c87e7a04bc443667e47c00e803039b96ec7d90f..89840faafd02476e68b9ffc7896ae2fe30083d9f 100644 --- a/Code/CSRender/CSRender/CompareTIFF.cs +++ b/Code/CSRender/CSRender/CompareTIFF.cs @@ -231,5 +231,18 @@ namespace CSRender return DataNumSet.ToArray(); } + //前回のログが内部に残っていれば削除(エラー防止) + public static void deleteOldLog(string inLogPath) + { + if (System.IO.Directory.EnumerateFileSystemEntries(inLogPath).Any()) + { + DirectoryInfo logDirctory = new DirectoryInfo(inLogPath); + FileInfo[] logFiles = logDirctory.GetFiles(); + foreach (FileInfo delFile in logFiles) + { + delFile.Delete(); + } + } + } } } diff --git a/Code/CSRender/CSRender/MainWindow.xaml.cs b/Code/CSRender/CSRender/MainWindow.xaml.cs index 6e7c3f65e46b7153755fbe81ff622954351f6060..98dcbbf966b4910fb5a8bb5de64586907e816b90 100644 --- a/Code/CSRender/CSRender/MainWindow.xaml.cs +++ b/Code/CSRender/CSRender/MainWindow.xaml.cs @@ -117,6 +117,19 @@ namespace CSRender string colorMargin = GradationBox.Text; string removePoint = SmallDiffBox.Text; string shadingOff = VisualBox.Text; + //検版処理関係の変数 + string appPath = System.Reflection.Assembly.GetExecutingAssembly().Location; //モジュールのパスを取得 + string appDirectory = appPath.Substring(0, appPath.LastIndexOf(@"\") + 1); //モジュールの存在するディレクトリを取得 + string workDir = System.IO.Path.Combine(appDirectory, "PureVerify.Data", "RipVerify");//PureVerifyのworkパス + string exePath = System.IO.Path.Combine(workDir, "bin", "x64");//exeのpathを取得 + int allPDFNum = 0; //検版するPDFの総数 + int NGPDFNum = 0; //検版でNGだったPDFの総数 + bool reportFlag = false; //レポート名を変えるかどうか判別するフラグ + string reportContentsInfo = "";//レポートに記述する内容 + bool pageFlag = false; //ページ数の指定かあるかどうかのフラグ + string selectedPage = ""; //指定されたページ数 + bool dummyFlag = false; //ダミーのファイルを作るかどうかのフラグ + string dummyFileName = "";//ダミーのファイル名 //対象フォルダのpathチェック if (!Directory.Exists(targetBoxText) && !File.Exists(targetBoxText)) @@ -149,13 +162,10 @@ namespace CSRender } //検版対象がファイル名の場合、ファイル名が対象とリファレンスとで一致しなくても検版するように仕込み - bool dummyFlag = false; - string dummyFileName = ""; if (File.Exists(referenceBoxText) && File.Exists(targetBoxText)) { dummyFileName = SelectFileTarget(dummyFlag, targetBoxText, referenceBoxText, workBoxText); } - //出力ファイルpathのチェック if (!Directory.Exists(workBoxText) && !File.Exists(workBoxText)) @@ -172,13 +182,15 @@ namespace CSRender reviveButton();//終了前にメニューを復帰 return; } - + + //前回のログが内部に残っていれば削除(エラー防止) + CompareTIFF.deleteOldLog(System.IO.Path.Combine(workDir, "report")); + string workLogPath = System.IO.Path.Combine(workBoxText, "report");//reportフォルダのパス checkDirPath(workLogPath);//なければ作成 string outDiffPath = System.IO.Path.Combine(workBoxText, "OUT_DIFF");//DIFF画像の出力先パス checkDirPath(outDiffPath);//なければ作成 - - bool reportFlag = false; + try { //検版レポートの入力チェック @@ -195,8 +207,6 @@ namespace CSRender ripTime.Start();//計測開始 //必要に応じてページ引数を指定 - bool pageFlag = false; - string selectedPage = ""; if (PageRange.Text == "指定") { pageFlag = true; @@ -259,8 +269,7 @@ namespace CSRender ResultConsole.Text += "< TIFF変換完了 >\r\n"; ResultConsole.ScrollToEnd(); DoEvents(); - - string reportContentsInfo = ""; + try { //レポートへの出力内容を編集 @@ -272,10 +281,7 @@ namespace CSRender string WorkCategory = "検版レポートの編集"; ExceptionMessage(ex, workLogPath, WorkCategory); } - - string workDir = ""; - int allPDFNum = 0; - int NGPDFNum = 0; + //この時点での出力文字列を取得 string tiffString = ResultConsole.Text; try @@ -285,22 +291,7 @@ namespace CSRender //検版対象ファイル名の取得 string[] inspectionTargets = GetTargetList(targetBoxText, referenceBoxText); allPDFNum = getNumOfTiff(inspectionTargets, targetTIFFPath);//検版する画像ファイルの総数 - string appPath = System.Reflection.Assembly.GetExecutingAssembly().Location; //モジュールのパスを取得 - string appDirectory = appPath.Substring(0, appPath.LastIndexOf(@"\") + 1); //モジュールの存在するディレクトリを取得 - workDir = System.IO.Path.Combine(appDirectory, "PureVerify.Data", "RipVerify"); - //前回のログが内部に残っていれば削除(エラー防止) - if(System.IO.Directory.EnumerateFileSystemEntries(System.IO.Path.Combine(workDir, "report")).Any()) - { - DirectoryInfo logDirctory = new DirectoryInfo(System.IO.Path.Combine(workDir, "report")); - FileInfo[] logFiles = logDirctory.GetFiles(); - foreach (FileInfo delFile in logFiles) - { - delFile.Delete(); - } - } - //exeのpathを取得 - string exePath = System.IO.Path.Combine(workDir, "bin", "x64"); - + //隠しメニューの数値を初期化 allNumBox.Text = allPDFNum.ToString(); NGNumBox.Text = "0";