diff --git a/Code/CSRender/CSRender/CSRender.csproj b/Code/CSRender/CSRender/CSRender.csproj
index f3d53b54f6358675b43dd04e100ef3247032dbe6..be27c240e06b5723d19cd9b86826d8a37b170ec1 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 6648fd625cc142dd60ea76e560ff0adc69684aea..5d96870da9ee9a08dc9532c8d37b6907196b9ce0 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 d0441a98a829c59bbcbddb4359f5e8830c4e5aac..64c4a4664b4f99f7373cddeff8370de59dd4e5aa 100644
--- a/Code/CSRender/CSRender/MainWindow.xaml
+++ b/Code/CSRender/CSRender/MainWindow.xaml
@@ -71,7 +71,7 @@
-
+
diff --git a/Code/CSRender/CSRender/MainWindow.xaml.cs b/Code/CSRender/CSRender/MainWindow.xaml.cs
index 216f69cafc613ab1d3065d24eda5171ebcbac334..deef3f6aeba1c210c28300a6dd0c0b509f46ca5a 100644
--- a/Code/CSRender/CSRender/MainWindow.xaml.cs
+++ b/Code/CSRender/CSRender/MainWindow.xaml.cs
@@ -15,6 +15,8 @@ using System.Windows.Shapes;
using System.Windows.Controls.Primitives;
using System.Text.RegularExpressions;
using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.IO;
namespace CSRender
{
@@ -65,9 +67,156 @@ namespace CSRender
workBox.AddHandler(TextBox.DropEvent, new DragEventHandler(WorkBox_Drop), true);
}
- //Closeボタン
+ //Closeボタン実行
private void CloseButton_Click(object sender, RoutedEventArgs e) =>
Close();
+
+ //比較ボタン実行
+ private void CompareButtonClick(object sender, RoutedEventArgs e)
+ {
+ //対象フォルダのpathチェック
+ if (!Directory.Exists(targetBox.Text) && !File.Exists(targetBox.Text))
+ {
+ CustomMsgBox.Show(mainWindow, "指定されたファイルあるいはフォルダが存在しません。" +
+ "\nもう一度設定してください。", "The specified file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information);
+ return;
+ }
+
+ //リファレンスファイルのpathチェック
+ if (!Directory.Exists(referenceBox.Text) && !File.Exists(referenceBox.Text))
+ {
+ CustomMsgBox.Show(mainWindow, "指定されたリファレンスファイルあるいはフォルダが存在しません。" +
+ "\nもう一度設定してください。", "The specified reference file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information);
+ return;
+ }
+
+ //出力ファイルpathのチェック
+ if (!Directory.Exists(workBox.Text) && !File.Exists(workBox.Text))
+ {
+ CustomMsgBox.Show(mainWindow, "指定された作業フォルダが存在しません。" +
+ "\nもう一度設定してください。", "The specified reference file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information);
+ return;
+ }
+
+ //TIFF画像の生成
+ ResultConsole.Text += "\r\n";
+ ResultConsole.Text += " 対象ファイルをTIFF画像に変換中\r\n";
+
+ //必要に応じてページ引数を指定
+ bool pageFlag = false;
+ string selectedPage = "";
+ if (PageRange.Text == "指定")
+ {
+ pageFlag = true;
+ selectedPage = pageBox.Text;
+ }
+
+ //対象フォルダ
+ string targetTIFFPath = System.IO.Path.Combine(workBox.Text, "work", "targetTIFF");
+ if (!Directory.Exists(targetTIFFPath))//指定先にTIFF用フォルダがあるか
+ {
+ Directory.CreateDirectory(targetTIFFPath);//なければ新規でTIFF用フォルダを作成
+ }
+
+ //CSRenderの実行
+ string targetTIFFResult =
+ OutputTIFF.runCSRender(ResolutionBox.Text, "TIFF", pageFlag, selectedPage, targetBox.Text, targetTIFFPath);
+
+ ResultConsole.Text += " リファレンスファイルをTIFF画像に変換中\r\n";
+
+ //リファレンスフォルダ
+ string referenceTIFFPath = System.IO.Path.Combine(workBox.Text, "work", "referenceTIFF");
+ if (!Directory.Exists(referenceTIFFPath))//指定先にTIFF用フォルダがあるか
+ {
+ Directory.CreateDirectory(referenceTIFFPath);//なければ新規でTIFF用フォルダを作成
+ }
+
+ //CSRenderの実行
+ string referenceTIFFResult =
+ OutputTIFF.runCSRender(ResolutionBox.Text, "TIFF", pageFlag, selectedPage, referenceBox.Text, referenceTIFFPath);
+
+ ResultConsole.Text += "\r\n\r\n";
+
+ //PureVerifyの実行
+ //string workDir = CompareTIFF.runPureVerify(targetBox.Text, referenceBox.Text, workBox.Text);
+ string workDir = CompareTIFF.runPureVerify(targetTIFFPath, referenceTIFFPath, workBox.Text);
+
+ //レポートを出力
+ outputLog(System.IO.Path.Combine(workDir, "report"));
+
+ //指定先にレポートを移動
+ CompareTIFF.moveReport(workBox.Text, workDir);
+
+ }
+
+ //UIに検版結果を出力
+ private void outputLog(string workDir)
+ {
+ //logファイルを読み取り
+ 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でエンコーディング
+ string tranceString = "";
+ int lineCount = 0;
+ //ファイルから読み取った結果をUIに出力
+ while (logString.EndOfStream == false)
+ {
+ tranceString = logString.ReadLine();
+ lineCount++;
+ if (lineCount > 13 && lineCount < 40)//必要なところだけをUIに記述
+ {
+ ResultConsole.Text += tranceString + "\r\n";
+ ResultConsole.ScrollToEnd();
+ }
+ }
+ logString.Close();
+
+ }
+
+ //TIFFボタンを実行
+ private void TIFFButtonClick(object sender, RoutedEventArgs e)
+ {
+
+ ResultConsole.Text += "<変換開始>\r\n";
+ ResultConsole.Text += "PDFを" + FileSelect.Text + "に変換します\r\n";
+ ResultConsole.Text += "\r\n";
+
+ //必要に応じてページ引数を指定
+ bool pageFlag = false;
+ string selectedPage = "";
+ if (PageRange.Text == "指定")
+ {
+ pageFlag = true;
+ selectedPage = pageBox.Text;
+ }
+
+ //対象フォルダのpathが存在するかチェック
+ if (!Directory.Exists(targetBox.Text) && !File.Exists(targetBox.Text))
+ {
+ CustomMsgBox.Show(mainWindow, "指定されたファイルあるいはフォルダが存在しません。" +
+ "\nもう一度TIFF出力する対象を設定してください。", "The specified file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information);
+ return;
+ }
+
+ //出力フォルダのpathチェック
+ if (workBox.Text != "")
+ {
+ 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;
+ }
+ }
+
+ //CSRenderの実行
+ string TIFFresult =
+ OutputTIFF.runCSRender(ResolutionBox.Text, FileSelect.Text, pageFlag, selectedPage, targetBox.Text, workBox.Text);
+
+ ResultConsole.Text += TIFFresult;
+ ResultConsole.Text += "\r\n<変換終了>\r\n";
+ ResultConsole.ScrollToEnd();
+ }
}
}
diff --git a/Code/CSRender/CSRender/OurputTIFF.cs b/Code/CSRender/CSRender/OurputTIFF.cs
new file mode 100644
index 0000000000000000000000000000000000000000..91957967009319d3fd52aa42736edb8366406dae
--- /dev/null
+++ b/Code/CSRender/CSRender/OurputTIFF.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Windows.Controls.Primitives;
+using System.Text.RegularExpressions;
+using System.Diagnostics;
+using System.IO;
+
+namespace CSRender
+{
+ class OutputTIFF
+ {
+ public static string runCSRender(string resolutionNum, string outputFile,
+ bool pageFlag, string filePage, string targetPath, string workPath)
+ {
+ //実行用コンソール呼び出し
+ ProcessStartInfo processStartInfo = new ProcessStartInfo();
+ string stCurrentDir = System.IO.Directory.GetCurrentDirectory();
+ processStartInfo.FileName = System.IO.Path.Combine(stCurrentDir, "CSRender.Data", "CSRender.exe");
+ processStartInfo.CreateNoWindow = true; // コマンドプロンプトを非表示
+ processStartInfo.UseShellExecute = false; // シェル機能オフ
+ processStartInfo.RedirectStandardOutput = true;//標準出力をリダイレクト
+
+ //解像度の引数
+ processStartInfo.Arguments = "/D ";
+ processStartInfo.Arguments += resolutionNum;
+
+ //出力ファイル形式の引数
+ processStartInfo.Arguments += " /";
+ processStartInfo.Arguments += outputFile;
+ processStartInfo.Arguments += " ";
+
+ //必要に応じてページ引数を指定
+ if (pageFlag == true)
+ {
+ processStartInfo.Arguments += "/P \"";
+ processStartInfo.Arguments += filePage;
+ processStartInfo.Arguments += "\" ";
+ }
+
+ //指定ファイル
+ processStartInfo.Arguments += "/F ";
+ processStartInfo.Arguments += targetPath;
+
+ //出力フォルダ
+ if (workPath != "")
+ {
+ processStartInfo.Arguments += " /O ";
+ processStartInfo.Arguments += workPath;
+ }
+
+ //CSRender.exeを実行
+ Process process = Process.Start(processStartInfo);
+ string resuletString = process.StandardOutput.ReadToEnd();
+ process.WaitForExit();
+ process.Close();
+
+ return resuletString;
+ }
+ }
+}
diff --git a/Code/CSRender/CSRender/TIFFButtonsSetting.cs b/Code/CSRender/CSRender/TIFFButtonsSetting.cs
deleted file mode 100644
index f0e1424fe92ca8e4eecae5dbbfd4acc84698300b..0000000000000000000000000000000000000000
--- a/Code/CSRender/CSRender/TIFFButtonsSetting.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using System.Windows.Controls.Primitives;
-using System.Text.RegularExpressions;
-using System.Diagnostics;
-using System.IO;
-
-namespace CSRender
-{
- public partial class MainWindow : Window
- {
- private void TIFFButtonClick(object sender, RoutedEventArgs e)
- {
- ProcessStartInfo processStartInfo = new ProcessStartInfo();
- string stCurrentDir = System.IO.Directory.GetCurrentDirectory();
- processStartInfo.FileName = System.IO.Path.Combine(stCurrentDir, "CSRender.Data", "CSRender.exe");
- processStartInfo.CreateNoWindow = true; // コマンドプロンプトを非表示
- processStartInfo.UseShellExecute = false; // シェル機能オフ
- processStartInfo.RedirectStandardOutput = true;//標準出力をリダイレクト
-
- //解像度の引数
- if (NumericScroll1.Value < 9)
- {
- CustomMsgBox.Show(mainWindow, "解像度が正しく設定されていません。" +
- "\nもう一度設定してください。", "The resolution value is not set correctly", MessageBoxButton.OK, MessageBoxImage.Information);
- ResolutionBox.Text = "9";
- return;
- }
- processStartInfo.Arguments = "/D ";
- processStartInfo.Arguments += ResolutionBox.Text;
-
- //出力ファイル形式の引数
- processStartInfo.Arguments += " /";
- processStartInfo.Arguments += FileSelect.Text;
- processStartInfo.Arguments += " ";
-
- //必要に応じてページ引数を指定
- if (PageRange.Text == "指定")
- {
- processStartInfo.Arguments += "/P \"";
- processStartInfo.Arguments += pageBox.Text;
- processStartInfo.Arguments += "\" ";
- }
-
- //指定ファイル
- 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 += "/F ";
- processStartInfo.Arguments += targetBox.Text;
-
- //出力フォルダ
- if(workBox.Text != "")
- {
- 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 += " /O ";
- processStartInfo.Arguments += workBox.Text;
- }
-
- //CSRender.exeを実行
- Process process = Process.Start(processStartInfo);
- ResultConsole.Text = process.StandardOutput.ReadToEnd();
- ResultConsole.ScrollToEnd();
- process.WaitForExit();
- process.Close();
- }
- }
-}