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,16 +83,7 @@ namespace CSRender ...@@ -82,16 +83,7 @@ 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();
selectFile.IsFolderPicker = true; selectFile.IsFolderPicker = true;
...@@ -108,16 +100,7 @@ namespace CSRender ...@@ -108,16 +100,7 @@ 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();
selectFile.IsFolderPicker = true; selectFile.IsFolderPicker = true;
...@@ -134,16 +117,7 @@ namespace CSRender ...@@ -134,16 +117,7 @@ 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();
selectFile.IsFolderPicker = true; selectFile.IsFolderPicker = true;
...@@ -161,16 +135,7 @@ namespace CSRender ...@@ -161,16 +135,7 @@ 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();
selectFile.IsFolderPicker = true; selectFile.IsFolderPicker = true;
...@@ -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();
}
} }
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d" mc:Ignorable="d"
Title="CSRender" Height="475" Width="600" Background="#FFF3F4F4" MinWidth="600" MinHeight="330"> Title="CSRender" Height="475" Width="600" Background="#FFF3F4F4" MinWidth="600" MinHeight="330">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="135"/> <ColumnDefinition Width="135"/>
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<Button x:Name="closeButton" Content="Close" Height="22" Margin="0,1.333,45.333,0" Grid.Row="10" VerticalAlignment="Top" Grid.Column="2" Grid.ColumnSpan="2" Grid.RowSpan="2" HorizontalAlignment="Right" Width="77" Click="CloseButton_Click"/> <Button x:Name="closeButton" Content="Close" Height="22" Margin="0,1.333,45.333,0" Grid.Row="10" VerticalAlignment="Top" Grid.Column="2" Grid.ColumnSpan="2" Grid.RowSpan="2" HorizontalAlignment="Right" Width="77" Click="CloseButton_Click"/>
<Label Content="位置ズレ許容量(0 - 2):" Margin="0.333,0.333,30,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="7" Height="29" Grid.RowSpan="2" Grid.Column="1"/> <Label Content="位置ズレ許容量(0 - 2):" Margin="0.333,0.333,30,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="7" Height="29" Grid.RowSpan="2" Grid.Column="1"/>
<StackPanel Grid.Column="1" Grid.Row="7" Orientation="Horizontal" HorizontalAlignment="Left" Margin="154.333,3.333,0,3.667" Width="27" Background="WhiteSmoke" Grid.ColumnSpan="2"> <StackPanel Grid.Column="1" Grid.Row="7" Orientation="Horizontal" HorizontalAlignment="Left" Margin="154.333,3.333,0,3.667" Width="27" Background="WhiteSmoke" Grid.ColumnSpan="2">
<WindowsFormsHost Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="27" Background="Orange"> <WindowsFormsHost Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="27" Background="Orange">
<wfc:NumericUpDown x:Name="PositionBox" x:FieldModifier="public" Maximum="2" Minimum="0" Value="2" ReadOnly="False" Width="27" Margin="10,10,0,0" BorderStyle="FixedSingle"/> <wfc:NumericUpDown x:Name="PositionBox" x:FieldModifier="public" Maximum="2" Minimum="0" Value="2" ReadOnly="False" Width="27" Margin="10,10,0,0" BorderStyle="FixedSingle"/>
</WindowsFormsHost> </WindowsFormsHost>
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
</StackPanel> </StackPanel>
<Label Content="諧調差許容量(0 - 255):" Margin="13,0.333,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="7" Height="29" Grid.RowSpan="2" Grid.Column="2" HorizontalAlignment="Left" Width="163" Grid.ColumnSpan="2"/> <Label Content="諧調差許容量(0 - 255):" Margin="13,0.333,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="7" Height="29" Grid.RowSpan="2" Grid.Column="2" HorizontalAlignment="Left" Width="163" Grid.ColumnSpan="2"/>
<StackPanel Grid.Column="2" Grid.Row="7" Orientation="Horizontal" HorizontalAlignment="Left" Margin="175,4.333,0,2.667" Width="40" Background="WhiteSmoke" Grid.ColumnSpan="2"> <StackPanel Grid.Column="2" Grid.Row="7" Orientation="Horizontal" HorizontalAlignment="Left" Margin="175,4.333,0,2.667" Width="40" Background="WhiteSmoke" Grid.ColumnSpan="2">
<WindowsFormsHost Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="40" Background="Orange"> <WindowsFormsHost Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="40" Background="Orange">
<wfc:NumericUpDown x:Name="GradationBox" x:FieldModifier="public" Maximum="255" Minimum="0" Value="60" ReadOnly="False" Width="40" Margin="10,10,0,0" BorderStyle="FixedSingle"/> <wfc:NumericUpDown x:Name="GradationBox" x:FieldModifier="public" Maximum="255" Minimum="0" Value="60" ReadOnly="False" Width="40" Margin="10,10,0,0" BorderStyle="FixedSingle"/>
</WindowsFormsHost> </WindowsFormsHost>
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
</StackPanel> </StackPanel>
<Label Content="視覚的あいまい量(0 - 7):" Margin="13,0.333,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="8" Height="29" Grid.RowSpan="2" Grid.Column="2" HorizontalAlignment="Left" Width="163" Grid.ColumnSpan="2"/> <Label Content="視覚的あいまい量(0 - 7):" Margin="13,0.333,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="8" Height="29" Grid.RowSpan="2" Grid.Column="2" HorizontalAlignment="Left" Width="163" Grid.ColumnSpan="2"/>
<StackPanel Grid.Column="2" Grid.Row="8" Orientation="Horizontal" Margin="175,5.333,0,1.667" Background="WhiteSmoke" HorizontalAlignment="Left" Width="40" Grid.ColumnSpan="2"> <StackPanel Grid.Column="2" Grid.Row="8" Orientation="Horizontal" Margin="175,5.333,0,1.667" Background="WhiteSmoke" HorizontalAlignment="Left" Width="40" Grid.ColumnSpan="2">
<WindowsFormsHost Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="40" Background="Orange"> <WindowsFormsHost Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="40" Background="Orange">
<wfc:NumericUpDown x:Name="VisualBox" x:FieldModifier="public" Maximum="7" Minimum="0" Value="5" ReadOnly="False" Width="40" Margin="10,10,0,0" BorderStyle="FixedSingle"/> <wfc:NumericUpDown x:Name="VisualBox" x:FieldModifier="public" Maximum="7" Minimum="0" Value="5" ReadOnly="False" Width="40" Margin="10,10,0,0" BorderStyle="FixedSingle"/>
......
...@@ -32,7 +32,7 @@ namespace CSRender ...@@ -32,7 +32,7 @@ namespace CSRender
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
//ページ入力メニューの設定 //ページ入力メニューの設定
PagePattern.Add((new ComboBoxSet { Id = 1, Item = "全ページ"})); PagePattern.Add((new ComboBoxSet { Id = 1, Item = "全ページ"}));
PagePattern.Add((new ComboBoxSet { Id = 2, Item = "指定" })); PagePattern.Add((new ComboBoxSet { Id = 2, Item = "指定" }));
...@@ -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用フォルダがあるか
...@@ -221,7 +227,7 @@ namespace CSRender ...@@ -221,7 +227,7 @@ namespace CSRender
ResultConsole.Text += " 検版レポートのパス:"; ResultConsole.Text += " 検版レポートのパス:";
ResultConsole.Text += System.IO.Path.Combine(workBox.Text, "report", PDFName); ResultConsole.Text += System.IO.Path.Combine(workBox.Text, "report", PDFName);
ResultConsole.Text += "\r\n"; ResultConsole.Text += "\r\n";
//パラメータを次回初期値用に保存 //パラメータを次回初期値用に保存
Properties.Settings.Default.resolutionSetting = ResolutionBox.Value; Properties.Settings.Default.resolutionSetting = ResolutionBox.Value;
Properties.Settings.Default.formatSetting = FileSelect.Text; Properties.Settings.Default.formatSetting = FileSelect.Text;
...@@ -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