From 95ab77bcc1c3dfb9794dbddb665b4105e7f18f86 Mon Sep 17 00:00:00 2001 From: tsuji Date: Thu, 2 Dec 2021 14:15:09 +0900 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E9=83=A8=E3=82=A2=E3=83=97=E3=83=AA?= =?UTF-8?q?=E3=82=B1=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=AE=E5=8F=82?= =?UTF-8?q?=E7=85=A7=E6=96=B9=E6=B3=95=E3=82=92=E3=82=AB=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=83=87=E3=82=A3=E3=83=AC=E3=82=AF=E3=83=88=E3=83=AA?= =?UTF-8?q?=E3=82=92=E7=94=A8=E3=81=84=E3=81=AA=E3=81=84=E5=BD=A2=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/CSRender/CSRender/CompareTIFF.cs | 9 +++--- Code/CSRender/CSRender/MainWindow.xaml.cs | 38 ++++++++++++++++++++--- Code/CSRender/CSRender/OurputTIFF.cs | 5 +-- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/Code/CSRender/CSRender/CompareTIFF.cs b/Code/CSRender/CSRender/CompareTIFF.cs index 6443997..dfd231b 100644 --- a/Code/CSRender/CSRender/CompareTIFF.cs +++ b/Code/CSRender/CSRender/CompareTIFF.cs @@ -26,9 +26,10 @@ namespace CSRender { //実行用コンソールの呼び出し ProcessStartInfo processStartInfo = new ProcessStartInfo(); - string stCurrentDir = System.IO.Directory.GetCurrentDirectory(); + string appPath = System.Reflection.Assembly.GetExecutingAssembly().Location; //モジュールのパスを取得 + string appDirectory = appPath.Substring(0, appPath.LastIndexOf(@"\") + 1); //モジュールの存在するディレクトリを取得 string exePath = System.IO.Path.Combine("PureVerify.Data", "RipVerify", "bin", "x64"); - processStartInfo.FileName = System.IO.Path.Combine(stCurrentDir, exePath, "PureVerify.exe"); + processStartInfo.FileName = System.IO.Path.Combine(appDirectory, exePath, "PureVerify.exe"); processStartInfo.CreateNoWindow = true; // コマンドプロンプトを非表示 processStartInfo.UseShellExecute = false; // シェル機能オフ processStartInfo.RedirectStandardOutput = true;//標準出力をリダイレクト @@ -43,7 +44,7 @@ namespace CSRender processStartInfo.Arguments += referenceDir; //EquiosCenterの場所 - string EquiosCenter = System.IO.Path.Combine(stCurrentDir, "PureVerify.Data", "EquiosCenter"); + string EquiosCenter = System.IO.Path.Combine(appDirectory, "PureVerify.Data", "EquiosCenter"); processStartInfo.Arguments += " /equios "; processStartInfo.Arguments += EquiosCenter; @@ -51,7 +52,7 @@ namespace CSRender processStartInfo.Arguments += " /work "; //processStartInfo.Arguments += workPath; - string workDir = System.IO.Path.Combine(stCurrentDir, "PureVerify.Data", "RipVerify"); + string workDir = System.IO.Path.Combine(appDirectory, "PureVerify.Data", "RipVerify"); processStartInfo.Arguments += workDir; //検版の指定(2だとNGログ検版(LOG-Diff)になる) diff --git a/Code/CSRender/CSRender/MainWindow.xaml.cs b/Code/CSRender/CSRender/MainWindow.xaml.cs index 321397e..ecbe3f4 100644 --- a/Code/CSRender/CSRender/MainWindow.xaml.cs +++ b/Code/CSRender/CSRender/MainWindow.xaml.cs @@ -111,7 +111,27 @@ namespace CSRender private void CloseButton_Click(object sender, RoutedEventArgs e) => Close(); - //比較ボタン実行 + /// + /// 比較ボタンを実行する。 + /// + /// 選択された対象フォルダ(ファイル)のパス + /// アプリケーションのメインウインドウ + /// 出力メニューのテキストボックス + /// 選択されたリファレンスフォルダ(ファイル)のパス + /// 選択された作業フォルダのパス + /// 位置ズレ許容量のパラメータ + /// 諧調差許容量のパラメータ + /// 微小差異許容量のパラメータ + /// 視覚的あいまい量のパラメータ + /// ページ範囲を指定するかどうかを示すフラグ + /// TIFF変換するページ範囲 + /// 検査範囲を選択するプルダウンメニューで選択された内容の文字列 + /// 入力されたページを表す文字列 + /// 対象フォルダのTIFF画像を配置するフォルダのパス + /// リファレンスフォルダのTIFF画像を配置するフォルダのパス + /// PureVerify内部の作業フォルダのパス + /// 検版レポートのファイル名 + private void CompareButtonClick(object sender, RoutedEventArgs e) { //対象フォルダのpathチェック @@ -202,6 +222,7 @@ namespace CSRender //レポートを出力 outputLog(System.IO.Path.Combine(workDir, "report")); + //レポート名を取得 string PDFName = CompareTIFF.getReportName(workDir); //指定先にレポートを移動 @@ -211,7 +232,7 @@ namespace CSRender ResultConsole.Text += " 検版レポートのパス:"; ResultConsole.Text += System.IO.Path.Combine(workBox.Text, "report", PDFName); ResultConsole.Text += "\r\n"; - + //パラメータを次回初期値用に保存 Properties.Settings.Default.resolutionSetting = ResolutionBox.Text; Properties.Settings.Default.formatSetting = FileSelect.Text; @@ -222,10 +243,17 @@ namespace CSRender Properties.Settings.Default.Save(); } - //UIに検版結果を出力 + /// + /// UIに検版結果を出力する。 + /// + /// 作業フォルダ内のlogファイルを全て格納する配列 + /// 作成されたlogファイルの名称logString + /// logファイルを読み取るリーダー + /// リーダーで読み取った行の文字列 + /// リーダーがその時点で読み込んでいる行数 private void outputLog(string workDir) { - //logファイルを読み取り + //logファイルを読み取り(1行ずつ) string[] reportFiles = System.IO.Directory.GetFiles(workDir, "*.log", System.IO.SearchOption.TopDirectoryOnly); string logfileName = reportFiles[0]; StreamReader logString = new StreamReader(logfileName, Encoding.GetEncoding("Shift-JIS"));//Shift-JISでエンコーディング @@ -250,7 +278,7 @@ namespace CSRender //TIFFボタンを実行 private void TIFFButtonClick(object sender, RoutedEventArgs e) { - + //出力メニューにメッセージを出力 ResultConsole.Text += "<変換開始>\r\n"; ResultConsole.Text += " PDFを" + FileSelect.Text + "に変換します\r\n"; ResultConsole.Text += "\r\n"; diff --git a/Code/CSRender/CSRender/OurputTIFF.cs b/Code/CSRender/CSRender/OurputTIFF.cs index 9195796..048f2c1 100644 --- a/Code/CSRender/CSRender/OurputTIFF.cs +++ b/Code/CSRender/CSRender/OurputTIFF.cs @@ -26,8 +26,9 @@ namespace CSRender { //実行用コンソール呼び出し ProcessStartInfo processStartInfo = new ProcessStartInfo(); - string stCurrentDir = System.IO.Directory.GetCurrentDirectory(); - processStartInfo.FileName = System.IO.Path.Combine(stCurrentDir, "CSRender.Data", "CSRender.exe"); + string appPath = System.Reflection.Assembly.GetExecutingAssembly().Location; //モジュールのパスを取得 + string appDirectory = appPath.Substring(0, appPath.LastIndexOf(@"\") + 1); //モジュールの存在するディレクトリを取得 + processStartInfo.FileName = System.IO.Path.Combine(appDirectory, "CSRender.Data", "CSRender.exe"); processStartInfo.CreateNoWindow = true; // コマンドプロンプトを非表示 processStartInfo.UseShellExecute = false; // シェル機能オフ processStartInfo.RedirectStandardOutput = true;//標準出力をリダイレクト -- 2.22.0