From 9b4210c1264030c01e4e8b618062fd5643551741 Mon Sep 17 00:00:00 2001 From: tsuji Date: Tue, 16 Nov 2021 16:13:55 +0900 Subject: [PATCH] =?UTF-8?q?=E6=AF=94=E8=BC=83=E3=83=9C=E3=82=BF=E3=83=B3?= =?UTF-8?q?=E3=82=92=E3=82=AF=E3=83=AA=E3=83=83=E3=82=AF=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=81=A8=E3=81=8D=E3=81=ABTIFF=E5=87=BA=E5=8A=9B=E3=82=92?= =?UTF-8?q?=E8=A1=8C=E3=81=86=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/CSRender.csproj | 4 +- ...CompareButtonSetting.cs => CompareTIFF.cs} | 73 ++------- Code/CSRender/CSRender/MainWindow.xaml | 2 +- Code/CSRender/CSRender/MainWindow.xaml.cs | 151 +++++++++++++++++- Code/CSRender/CSRender/OurputTIFF.cs | 72 +++++++++ Code/CSRender/CSRender/TIFFButtonsSetting.cs | 88 ---------- 6 files changed, 242 insertions(+), 148 deletions(-) rename Code/CSRender/CSRender/{CompareButtonSetting.cs => CompareTIFF.cs} (50%) create mode 100644 Code/CSRender/CSRender/OurputTIFF.cs delete mode 100644 Code/CSRender/CSRender/TIFFButtonsSetting.cs diff --git a/Code/CSRender/CSRender/CSRender.csproj b/Code/CSRender/CSRender/CSRender.csproj index f3d53b5..be27c24 100644 --- a/Code/CSRender/CSRender/CSRender.csproj +++ b/Code/CSRender/CSRender/CSRender.csproj @@ -72,9 +72,9 @@ App.xaml Code - + - + diff --git a/Code/CSRender/CSRender/CompareButtonSetting.cs b/Code/CSRender/CSRender/CompareTIFF.cs similarity index 50% rename from Code/CSRender/CSRender/CompareButtonSetting.cs rename to Code/CSRender/CSRender/CompareTIFF.cs index 6648fd6..5d96870 100644 --- a/Code/CSRender/CSRender/CompareButtonSetting.cs +++ b/Code/CSRender/CSRender/CompareTIFF.cs @@ -19,10 +19,11 @@ using System.IO; namespace CSRender { - public partial class MainWindow : Window + class CompareTIFF { - private void CompareButtonClick(object sender, RoutedEventArgs e) + public static string runPureVerify(string targetDir, string referenceDir, string workPath) { + //実行用コンソールの呼び出し ProcessStartInfo processStartInfo = new ProcessStartInfo(); string stCurrentDir = System.IO.Directory.GetCurrentDirectory(); string exePath = System.IO.Path.Combine("PureVerify.Data", "RipVerify", "bin", "x64"); @@ -34,23 +35,11 @@ namespace CSRender //引数設定 //指定ファイル processStartInfo.Arguments = "/tar "; - if (!Directory.Exists(targetBox.Text) && !File.Exists(targetBox.Text))//pathのチェック - { - CustomMsgBox.Show(mainWindow, "指定されたファイルあるいはフォルダが存在しません。" + - "\nもう一度設定してください。", "The specified file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information); - return; - } - processStartInfo.Arguments += targetBox.Text; + processStartInfo.Arguments += targetDir; //リファレンスファイル - if (!Directory.Exists(referenceBox.Text) && !File.Exists(referenceBox.Text))//pathのチェック - { - CustomMsgBox.Show(mainWindow, "指定されたリファレンスファイルあるいはフォルダが存在しません。" + - "\nもう一度設定してください。", "The specified reference file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information); - return; - } processStartInfo.Arguments += " /ref "; - processStartInfo.Arguments += referenceBox.Text; + processStartInfo.Arguments += referenceDir; //EquiosCenterの場所 string EquiosCenter = System.IO.Path.Combine(stCurrentDir, "PureVerify.Data", "EquiosCenter_small"); @@ -59,17 +48,10 @@ namespace CSRender //出力ファイル形式の引数 processStartInfo.Arguments += " /work "; - - if (!Directory.Exists(workBox.Text) && !File.Exists(workBox.Text))//pathのチェック - { - CustomMsgBox.Show(mainWindow, "指定された作業フォルダが存在しません。" + - "\nもう一度設定してください。", "The specified reference file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information); - return; - } - //processStartInfo.Arguments += workBox.Text; - string workDir = System.IO.Path.Combine(stCurrentDir, "PureVerify.Data", "RipVerify"); - processStartInfo.Arguments += workDir; + //processStartInfo.Arguments += workPath; + string workDir = System.IO.Path.Combine(stCurrentDir, "PureVerify.Data", "RipVerify"); + processStartInfo.Arguments += workDir; //検版の指定(2だとNGログ検版(LOG-Diff)になる) processStartInfo.Arguments += " /operation \"1\""; @@ -85,19 +67,24 @@ namespace CSRender //CSRender.exeを実行 Process process = Process.Start(processStartInfo); //ResultConsole.Text = process.StandardOutput.ReadToEnd(); - process.OutputDataReceived += process_DataReceived; + //process.OutputDataReceived += process_DataReceived; process.BeginOutputReadLine(); //ResultConsole.ScrollToEnd(); process.WaitForExit(); process.Close(); - //指定先にレポートを移動 - string reportPath = System.IO.Path.Combine(workBox.Text, "report"); + return workDir; + } + + //指定先にレポートを移動 + public static void moveReport(string resultPath, string workPath) + { + string reportPath = System.IO.Path.Combine(resultPath, "report"); if (!Directory.Exists(reportPath))//指定先にreportフォルダがあるか { Directory.CreateDirectory(reportPath);//なければ新規でreportフォルダを作成 } - var allReport = Directory.EnumerateFiles(System.IO.Path.Combine(workDir, "report") + var allReport = Directory.EnumerateFiles(System.IO.Path.Combine(workPath, "report") , "*", SearchOption.TopDirectoryOnly);//reportフォルダ内の全てのファイルを取得 foreach (string file in allReport) { @@ -105,31 +92,5 @@ namespace CSRender File.Move(file, System.IO.Path.Combine(reportPath, fileTarget));//指定先に移動 } } - - //コンソール出力を読み取りする関数 - public void process_DataReceived(object sender, DataReceivedEventArgs e) - { - string VerifyResult = e.Data; - Dispatcher.BeginInvoke(new Action(() => - { - ResultConsole.Text = VerifyResult; - ResultConsole.ScrollToEnd(); - })); - } - - private string outputLog(string workDir) - { - StreamReader logString = new StreamReader(System.IO.Path.Combine(workDir, "report" + "hironimo.txt")); - string toString = ""; - string tranceString = logString + toString; - string cutString = "*****************************************************" + "\r\n" - + "Number of Processors = 8" + "\r\n" - + "HostName = I-N-21-00008" + "\r\n" - + "PlatformId = 0" + "\r\n" + "PureVerifyMainSetUp.txt" + "\r\n" - + " MakeThreadNums = 0" + " PDFREPORT_SPLIT_PAGENUM = 32" + "\r\n" - + "*****************************************************"; - string outputString = tranceString.Replace(cutString, ""); - return outputString; - } } } diff --git a/Code/CSRender/CSRender/MainWindow.xaml b/Code/CSRender/CSRender/MainWindow.xaml index d0441a9..64c4a46 100644 --- a/Code/CSRender/CSRender/MainWindow.xaml +++ b/Code/CSRender/CSRender/MainWindow.xaml @@ -71,7 +71,7 @@ - +