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
2c78b201
Commit
2c78b201
authored
Mar 18, 2022
by
tsuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
リファレンスするファイルが発見できなかった場合の動作を修正
parent
e7d0cfdc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
7 deletions
+92
-7
CompareTIFF.cs
Code/CSRender/CSRender/CompareTIFF.cs
+1
-1
MainWindow.xaml.cs
Code/CSRender/CSRender/MainWindow.xaml.cs
+91
-6
No files found.
Code/CSRender/CSRender/CompareTIFF.cs
View file @
2c78b201
Code/CSRender/CSRender/MainWindow.xaml.cs
View file @
2c78b201
...
@@ -138,6 +138,33 @@ namespace CSRender
...
@@ -138,6 +138,33 @@ namespace CSRender
return
;
return
;
}
}
//検版対象がファイル名の場合、ファイル名が対象とリファレンスとで一致しなくても検版するように仕込み
bool
dummyFlag
=
false
;
string
dummyFileName
=
""
;
if
(
File
.
Exists
(
referenceBoxText
)
&&
File
.
Exists
(
targetBoxText
))
{
//対象とリファレンスが同名ファイルであるか確認
string
TarFileName
=
System
.
IO
.
Path
.
GetFileName
(
referenceBoxText
);
string
RefFileName
=
System
.
IO
.
Path
.
GetFileName
(
targetBoxText
);
if
(
TarFileName
!=
RefFileName
)
{
//指定した作業フォルダ内にダミー用フォルダを設定(無ければ生成)
string
dummyDir
=
System
.
IO
.
Path
.
Combine
(
workBoxText
,
"Dummy"
);
if
(!
Directory
.
Exists
(
dummyDir
))
{
Directory
.
CreateDirectory
(
dummyDir
);
}
string
dummyTarDir
=
System
.
IO
.
Path
.
Combine
(
dummyDir
,
"Target"
);
if
(!
Directory
.
Exists
(
dummyTarDir
))
{
Directory
.
CreateDirectory
(
dummyTarDir
);
}
string
dummyRefDir
=
System
.
IO
.
Path
.
Combine
(
dummyDir
,
"Reference"
);
if
(!
Directory
.
Exists
(
dummyRefDir
))
{
Directory
.
CreateDirectory
(
dummyRefDir
);
}
//ダミーファイルを作成
dummyFileName
=
createDummyFile
(
targetBoxText
,
dummyTarDir
,
dummyFileName
);
dummyFileName
=
createDummyFile
(
referenceBoxText
,
dummyRefDir
,
dummyFileName
);
dummyFlag
=
true
;
//検版対象をダミーに指定
targetBoxText
=
dummyTarDir
;
referenceBoxText
=
dummyRefDir
;
}
}
//出力ファイルpathのチェック
//出力ファイルpathのチェック
if
(!
Directory
.
Exists
(
workBoxText
)
&&
!
File
.
Exists
(
workBoxText
))
if
(!
Directory
.
Exists
(
workBoxText
)
&&
!
File
.
Exists
(
workBoxText
))
{
{
...
@@ -374,8 +401,22 @@ namespace CSRender
...
@@ -374,8 +401,22 @@ namespace CSRender
//referenceErrorFlag = true;
//referenceErrorFlag = true;
}
}
try
{
//指定先にレポートを移動
//指定先にレポートを移動
CompareTIFF
.
moveReport
(
workBoxText
,
workDir
);
CompareTIFF
.
moveReport
(
workBoxText
,
workDir
);
}
catch
(
Exception
ex
)
{
CustomMsgBox
.
Show
(
mainWindow
,
ex
.
Message
,
"例外が発生しました"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Warning
);
//ログ記述
DateTime
faileTIme
=
DateTime
.
Now
;
string
logText
=
"["
+
faileTIme
+
"]"
+
Environment
.
NewLine
;
logText
+=
"例外の生じた処理:ログファイルの移動"
+
Environment
.
NewLine
;
logText
+=
ex
.
Message
+
"\n"
+
ex
.
StackTrace
+
Environment
.
NewLine
;
File
.
AppendAllText
(
System
.
IO
.
Path
.
Combine
(
workLogPath
,
"CSRender.log"
),
logText
);
//referenceErrorFlag = true;
}
//レポートのパスを表示
//レポートのパスを表示
ResultConsole
.
Text
+=
" 検版レポートのパス:"
;
ResultConsole
.
Text
+=
" 検版レポートのパス:"
;
...
@@ -386,9 +427,23 @@ namespace CSRender
...
@@ -386,9 +427,23 @@ namespace CSRender
reportBox
.
Text
=
System
.
IO
.
Path
.
Combine
(
workBoxText
,
"report"
,
PDFName
);
reportBox
.
Text
=
System
.
IO
.
Path
.
Combine
(
workBoxText
,
"report"
,
PDFName
);
}
}
//リファレンスファイルを発見できず検版回数0の場合、メッセージを出力して通知
if
(
allPDFNum
==
0
)
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定先のリファレンスフォルダから、対象フォルダ内のファイルと対応するファイルを発見できませんでした。"
,
"検版対象を発見できませんでした。"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Warning
);
}
//生成したレポートinf.txtを全削除
//生成したレポートinf.txtを全削除
deleteReportTexts
();
deleteReportTexts
();
//生成したダミーファイルを削除
if
(
dummyFlag
)
{
deleteDummyFile
(
System
.
IO
.
Path
.
Combine
(
workBoxText
,
"Dummy"
,
"Target"
),
dummyFileName
);
deleteDummyFile
(
System
.
IO
.
Path
.
Combine
(
workBoxText
,
"Dummy"
,
"Reference"
),
dummyFileName
);
}
//パラメータを次回初期値用に保存
//パラメータを次回初期値用に保存
Properties
.
Settings
.
Default
.
resolutionSetting
=
ResolutionBox
.
Value
;
Properties
.
Settings
.
Default
.
resolutionSetting
=
ResolutionBox
.
Value
;
Properties
.
Settings
.
Default
.
formatSetting
=
FileSelect
.
Text
;
Properties
.
Settings
.
Default
.
formatSetting
=
FileSelect
.
Text
;
...
@@ -397,8 +452,8 @@ namespace CSRender
...
@@ -397,8 +452,8 @@ namespace CSRender
Properties
.
Settings
.
Default
.
removePointSetting
=
SmallDiffBox
.
Value
;
Properties
.
Settings
.
Default
.
removePointSetting
=
SmallDiffBox
.
Value
;
Properties
.
Settings
.
Default
.
shadingOffSetting
=
VisualBox
.
Value
;
Properties
.
Settings
.
Default
.
shadingOffSetting
=
VisualBox
.
Value
;
Properties
.
Settings
.
Default
.
workSpaceSetting
=
workBoxText
;
Properties
.
Settings
.
Default
.
workSpaceSetting
=
workBoxText
;
Properties
.
Settings
.
Default
.
targetSetting
=
targetBoxText
;
Properties
.
Settings
.
Default
.
targetSetting
=
targetBox
.
Text
;
Properties
.
Settings
.
Default
.
referenceSetting
=
referenceBoxText
;
Properties
.
Settings
.
Default
.
referenceSetting
=
referenceBox
.
Text
;
Properties
.
Settings
.
Default
.
reportPathSetting
=
reportBoxText
;
Properties
.
Settings
.
Default
.
reportPathSetting
=
reportBoxText
;
Properties
.
Settings
.
Default
.
Save
();
Properties
.
Settings
.
Default
.
Save
();
...
@@ -555,10 +610,18 @@ namespace CSRender
...
@@ -555,10 +610,18 @@ namespace CSRender
/// 指定ディレクトリ内のPDFファイル名を取得する
/// 指定ディレクトリ内のPDFファイル名を取得する
/// </summary>
/// </summary>
private
string
[]
getPDFName
(
string
targetDir
)
private
string
[]
getPDFName
(
string
targetDir
)
{
if
(
File
.
Exists
(
targetDir
))
{
string
[]
targetFiles
=
{
targetDir
};
return
targetFiles
;
}
else
{
{
string
[]
targetFiles
=
System
.
IO
.
Directory
.
GetFiles
(
targetDir
,
"*.pdf"
,
System
.
IO
.
SearchOption
.
TopDirectoryOnly
);
string
[]
targetFiles
=
System
.
IO
.
Directory
.
GetFiles
(
targetDir
,
"*.pdf"
,
System
.
IO
.
SearchOption
.
TopDirectoryOnly
);
return
targetFiles
;
return
targetFiles
;
}
}
}
/// <summary>
/// <summary>
/// 指定ディレクトリ内のPDFファイルのページ数を取得する
/// 指定ディレクトリ内のPDFファイルのページ数を取得する
...
@@ -836,6 +899,28 @@ namespace CSRender
...
@@ -836,6 +899,28 @@ namespace CSRender
return
InspectionPDFs
.
ToArray
();
return
InspectionPDFs
.
ToArray
();
}
}
/// <summary>
/// ダミーのPDFファイルを作成する
/// </summary>
private
string
createDummyFile
(
string
inTargetPath
,
string
inDummyDir
,
string
inFileName
)
{
string
TargetDir
=
System
.
IO
.
Path
.
GetDirectoryName
(
inTargetPath
);
//ファイルパスを取得
string
TargetFile
=
System
.
IO
.
Path
.
GetFileName
(
inTargetPath
);
//ファイル名を取得
if
(
inFileName
==
""
)
//名前が空ならパスから取得した名前を代入
{
inFileName
=
TargetFile
;
}
File
.
Copy
(
inTargetPath
,
System
.
IO
.
Path
.
Combine
(
inDummyDir
,
inFileName
),
true
);
return
inFileName
;
}
/// <summary>
/// ダミーのPDFファイルを削除する
/// </summary>
private
void
deleteDummyFile
(
string
inDummyPath
,
string
inDummyName
)
{
File
.
Delete
(
System
.
IO
.
Path
.
Combine
(
inDummyPath
,
inDummyName
));
}
/// <summary>
/// <summary>
/// TIFF画像化を実行する
/// TIFF画像化を実行する
...
...
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