Commit abf4d4bb authored by tsuji's avatar tsuji

PureVerifyの.envファイルを自動設定できるように改良

parent c1b1cd01
...@@ -16,6 +16,7 @@ using System.Windows.Controls.Primitives; ...@@ -16,6 +16,7 @@ using System.Windows.Controls.Primitives;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Microsoft.Win32; using Microsoft.Win32;
using MSAPI = Microsoft.WindowsAPICodePack; using MSAPI = Microsoft.WindowsAPICodePack;
using System.IO;
namespace CSRender namespace CSRender
{ {
...@@ -82,15 +83,6 @@ namespace CSRender ...@@ -82,15 +83,6 @@ namespace CSRender
//参照ボタンClickでフォルダ選択のダイアログを表示(対象フォルダ) //参照ボタンClickでフォルダ選択のダイアログを表示(対象フォルダ)
private void TagetButton_Click(object sender, RoutedEventArgs e) private void TagetButton_Click(object sender, RoutedEventArgs e)
{ {
//ファイル選択の場合
//var selectFile = new OpenFileDialog();
//selectFile.Title = "ファイルを選択してください";
//selectFile.InitialDirectory = @"C:";
//if ((bool)selectFile.ShowDialog())
//{
//FileName = selectFile.FileName;
//FileSelected(this, new EventArgs());
//}
//フォルダ選択の場合 //フォルダ選択の場合
var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog();
...@@ -108,15 +100,6 @@ namespace CSRender ...@@ -108,15 +100,6 @@ namespace CSRender
//参照ボタンClickでフォルダ選択のダイアログを表示(リファレンスフォルダ) //参照ボタンClickでフォルダ選択のダイアログを表示(リファレンスフォルダ)
private void ReferenceButton_Click(object sender, RoutedEventArgs e) private void ReferenceButton_Click(object sender, RoutedEventArgs e)
{ {
//ファイル選択の場合
//var selectFile = new OpenFileDialog();
//selectFile.Title = "ファイルを選択してください";
//selectFile.InitialDirectory = @"C:";
//if ((bool)selectFile.ShowDialog())
//{
//FileName = selectFile.FileName;
//FileSelected(this, new EventArgs());
//}
//フォルダ選択の場合 //フォルダ選択の場合
var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog();
...@@ -134,15 +117,6 @@ namespace CSRender ...@@ -134,15 +117,6 @@ namespace CSRender
//参照ボタンClickでフォルダ選択のダイアログを表示(作業フォルダ) //参照ボタンClickでフォルダ選択のダイアログを表示(作業フォルダ)
private void WorkButton_Click(object sender, RoutedEventArgs e) private void WorkButton_Click(object sender, RoutedEventArgs e)
{ {
//ファイル選択の場合
//var selectFile = new OpenFileDialog();
//selectFile.Title = "ファイルを選択してください";
//selectFile.InitialDirectory = @"C:";
//if ((bool)selectFile.ShowDialog())
//{
//FileName = selectFile.FileName;
//FileSelected(this, new EventArgs());
//}
//フォルダ選択の場合 //フォルダ選択の場合
var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog();
...@@ -161,15 +135,6 @@ namespace CSRender ...@@ -161,15 +135,6 @@ namespace CSRender
//参照ボタンClickでフォルダ選択のダイアログを表示(検版レポートパス) //参照ボタンClickでフォルダ選択のダイアログを表示(検版レポートパス)
private void ReportButton_Click(object sender, RoutedEventArgs e) private void ReportButton_Click(object sender, RoutedEventArgs e)
{ {
//ファイル選択の場合
//var selectFile = new OpenFileDialog();
//selectFile.Title = "ファイルを選択してください";
//selectFile.InitialDirectory = @"C:";
//if ((bool)selectFile.ShowDialog())
//{
//FileName = selectFile.FileName;
//FileSelected(this, new EventArgs());
//}
//フォルダ選択の場合 //フォルダ選択の場合
var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog(); var selectFile = new MSAPI::Dialogs.CommonOpenFileDialog();
...@@ -183,5 +148,35 @@ namespace CSRender ...@@ -183,5 +148,35 @@ namespace CSRender
//共通部分 //共通部分
reportBox.Text = selectFile.FileName + @"\"; reportBox.Text = selectFile.FileName + @"\";
} }
private void EditEnvFile()
{
string appPath = System.Reflection.Assembly.GetExecutingAssembly().Location; //モジュールのパスを取得
string appDirectory = appPath.Substring(0, appPath.LastIndexOf(@"\") + 1); //モジュールの存在するディレクトリを取得
string dataPath = System.IO.Path.Combine("PureVerify.Data", "RipVerify", "setup", "PureVerifyDlg.env");
string envFilePath = System.IO.Path.Combine(appDirectory, dataPath);//PureVerifyDlg.envまでのフルパス
//.envファイルに記述する内容
string equiosCenterPath = System.IO.Path.Combine(appDirectory, "PureVerify.Data", "EquiosCenter");//EquiosCenterのフルパス
string workFolderPath = System.IO.Path.Combine(appDirectory, "PureVerify.Data", "RipVerify");//内部作業フォルダのフルパス
string writeText = "**EquiosCenter: \"" + equiosCenterPath + "\"\r\n";
writeText += "**WorkDirRoot: \"" + workFolderPath + "\"\r\n";
writeText += "**InspQuality: \"3\"\r\n";
writeText += "**MarkDistance: \"50\"\r\n";
writeText += "**ReportEncodeType: \"1\"\r\n";
writeText += "**WndPosLeft: \"348\"\r\n";
writeText += "**WndPosTop: \"125\"\r\n";
writeText += "**WndPosRight: \"933\"\r\n";
writeText += "**WndPosBottom: \"556\"\r\n";
writeText += "**ShowOKList: \"1\"\r\n";
// StreamWriterオブジェクトのインスタンスを生成
StreamWriter streamWriter = new StreamWriter(envFilePath, false, Encoding.GetEncoding("Shift_JIS"));
// Writeメソッドで文字列データを書き込む
streamWriter.Write(writeText);
// StreamWriterオブジェクトを閉じる
streamWriter.Close();
}
} }
} }
...@@ -50,6 +50,9 @@ namespace CSRender ...@@ -50,6 +50,9 @@ namespace CSRender
FilePattern.Add((new ComboBoxSet { Id = 7, Item = "BMP" })); FilePattern.Add((new ComboBoxSet { Id = 7, Item = "BMP" }));
FileSelect.ItemsSource = FilePattern; FileSelect.ItemsSource = FilePattern;
//PureVerifyの内部変数(PureVerifyDlg.env)を編集
EditEnvFile();
//デフォルトに前回の設定値を表示 //デフォルトに前回の設定値を表示
ResolutionBox.Value = Properties.Settings.Default.resolutionSetting; ResolutionBox.Value = Properties.Settings.Default.resolutionSetting;
FileSelect.Text = Properties.Settings.Default.formatSetting; FileSelect.Text = Properties.Settings.Default.formatSetting;
...@@ -126,6 +129,9 @@ namespace CSRender ...@@ -126,6 +129,9 @@ namespace CSRender
"\nもう一度設定してください。", "The specified reference file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information); "\nもう一度設定してください。", "The specified reference file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information);
ResultConsole.Text += " 指定された作業フォルダを発見できませんでした\r\n"; ResultConsole.Text += " 指定された作業フォルダを発見できませんでした\r\n";
ResultConsole.Text += "<TIFF変換中止>\r\n"; ResultConsole.Text += "<TIFF変換中止>\r\n";
workBox.Text = "";
Properties.Settings.Default.workSpaceSetting = workBox.Text;
Properties.Settings.Default.Save();
return; return;
} }
...@@ -135,11 +141,6 @@ namespace CSRender ...@@ -135,11 +141,6 @@ namespace CSRender
string removePoint = SmallDiffBox.Text; string removePoint = SmallDiffBox.Text;
string shadingOff = VisualBox.Text; string shadingOff = VisualBox.Text;
//TIFF画像の生成
ResultConsole.Text += "<TIFF変換開始>\r\n";
ResultConsole.Text += " 対象ファイルをTIFF画像に変換中\r\n";
DoEvents();
//必要に応じてページ引数を指定 //必要に応じてページ引数を指定
bool pageFlag = false; bool pageFlag = false;
string selectedPage = ""; string selectedPage = "";
...@@ -149,6 +150,11 @@ namespace CSRender ...@@ -149,6 +150,11 @@ namespace CSRender
selectedPage = pageBox.Text; selectedPage = pageBox.Text;
} }
//TIFF画像の生成
ResultConsole.Text += "<TIFF変換開始>\r\n";
ResultConsole.Text += " 対象ファイルをTIFF画像に変換中\r\n";
DoEvents();
//対象フォルダ //対象フォルダ
string targetTIFFPath = System.IO.Path.Combine(workBox.Text, "work", "targetTIFF"); string targetTIFFPath = System.IO.Path.Combine(workBox.Text, "work", "targetTIFF");
if (Directory.Exists(targetTIFFPath))//指定先にTIFF用フォルダがあるか if (Directory.Exists(targetTIFFPath))//指定先にTIFF用フォルダがあるか
...@@ -314,6 +320,9 @@ namespace CSRender ...@@ -314,6 +320,9 @@ namespace CSRender
"\nもう一度設定してください。", "The specified reference file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information); "\nもう一度設定してください。", "The specified reference file or folder does not exist", MessageBoxButton.OK, MessageBoxImage.Information);
ResultConsole.Text += " 指定された作業フォルダを発見できませんでした\r\n"; ResultConsole.Text += " 指定された作業フォルダを発見できませんでした\r\n";
ResultConsole.Text += "<変換中止>\r\n"; ResultConsole.Text += "<変換中止>\r\n";
workBox.Text = "";
Properties.Settings.Default.workSpaceSetting = "";
Properties.Settings.Default.Save();
return; return;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment