Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KenPanCS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QCD
Tools
KenPanCS
Commits
abf4d4bb
Commit
abf4d4bb
authored
Dec 09, 2021
by
tsuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PureVerifyの.envファイルを自動設定できるように改良
parent
c1b1cd01
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
51 deletions
+55
-51
FilePathSelect.cs
Code/CSRender/CSRender/FilePathSelect.cs
+35
-40
MainWindow.xaml
Code/CSRender/CSRender/MainWindow.xaml
+4
-4
MainWindow.xaml.cs
Code/CSRender/CSRender/MainWindow.xaml.cs
+16
-7
No files found.
Code/CSRender/CSRender/FilePathSelect.cs
View file @
abf4d4bb
...
...
@@ -16,6 +16,7 @@ using System.Windows.Controls.Primitives;
using
System.Text.RegularExpressions
;
using
Microsoft.Win32
;
using
MSAPI
=
Microsoft
.
WindowsAPICodePack
;
using
System.IO
;
namespace
CSRender
{
...
...
@@ -82,15 +83,6 @@ namespace CSRender
//参照ボタンClickでフォルダ選択のダイアログを表示(対象フォルダ)
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
();
...
...
@@ -108,15 +100,6 @@ namespace CSRender
//参照ボタンClickでフォルダ選択のダイアログを表示(リファレンスフォルダ)
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
();
...
...
@@ -134,15 +117,6 @@ namespace CSRender
//参照ボタンClickでフォルダ選択のダイアログを表示(作業フォルダ)
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
();
...
...
@@ -161,15 +135,6 @@ namespace CSRender
//参照ボタンClickでフォルダ選択のダイアログを表示(検版レポートパス)
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
();
...
...
@@ -183,5 +148,35 @@ namespace CSRender
//共通部分
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
();
}
}
}
Code/CSRender/CSRender/MainWindow.xaml
View file @
abf4d4bb
Code/CSRender/CSRender/MainWindow.xaml.cs
View file @
abf4d4bb
...
...
@@ -50,6 +50,9 @@ namespace CSRender
FilePattern
.
Add
((
new
ComboBoxSet
{
Id
=
7
,
Item
=
"BMP"
}));
FileSelect
.
ItemsSource
=
FilePattern
;
//PureVerifyの内部変数(PureVerifyDlg.env)を編集
EditEnvFile
();
//デフォルトに前回の設定値を表示
ResolutionBox
.
Value
=
Properties
.
Settings
.
Default
.
resolutionSetting
;
FileSelect
.
Text
=
Properties
.
Settings
.
Default
.
formatSetting
;
...
...
@@ -126,6 +129,9 @@ namespace CSRender
"\nもう一度設定してください。"
,
"The specified reference file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
ResultConsole
.
Text
+=
" 指定された作業フォルダを発見できませんでした\r\n"
;
ResultConsole
.
Text
+=
"<TIFF変換中止>\r\n"
;
workBox
.
Text
=
""
;
Properties
.
Settings
.
Default
.
workSpaceSetting
=
workBox
.
Text
;
Properties
.
Settings
.
Default
.
Save
();
return
;
}
...
...
@@ -135,11 +141,6 @@ namespace CSRender
string
removePoint
=
SmallDiffBox
.
Text
;
string
shadingOff
=
VisualBox
.
Text
;
//TIFF画像の生成
ResultConsole
.
Text
+=
"<TIFF変換開始>\r\n"
;
ResultConsole
.
Text
+=
" 対象ファイルをTIFF画像に変換中\r\n"
;
DoEvents
();
//必要に応じてページ引数を指定
bool
pageFlag
=
false
;
string
selectedPage
=
""
;
...
...
@@ -149,6 +150,11 @@ namespace CSRender
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"
);
if
(
Directory
.
Exists
(
targetTIFFPath
))
//指定先にTIFF用フォルダがあるか
...
...
@@ -314,6 +320,9 @@ namespace CSRender
"\nもう一度設定してください。"
,
"The specified reference file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
ResultConsole
.
Text
+=
" 指定された作業フォルダを発見できませんでした\r\n"
;
ResultConsole
.
Text
+=
"<変換中止>\r\n"
;
workBox
.
Text
=
""
;
Properties
.
Settings
.
Default
.
workSpaceSetting
=
""
;
Properties
.
Settings
.
Default
.
Save
();
return
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment