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
1bf2445a
Commit
1bf2445a
authored
Feb 09, 2022
by
tsuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ファイルごとでのレポート出力に修正
parent
c687b6cc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
163 additions
and
42 deletions
+163
-42
App.config
Code/CSRender/CSRender/App.config
+3
-0
CompareTIFF.cs
Code/CSRender/CSRender/CompareTIFF.cs
+45
-10
FilePathSelect.cs
Code/CSRender/CSRender/FilePathSelect.cs
+22
-10
MainWindow.xaml.cs
Code/CSRender/CSRender/MainWindow.xaml.cs
+78
-22
Settings.Designer.cs
Code/CSRender/CSRender/Properties/Settings.Designer.cs
+12
-0
Settings.settings
Code/CSRender/CSRender/Properties/Settings.settings
+3
-0
No files found.
Code/CSRender/CSRender/App.config
View file @
1bf2445a
...
...
@@ -37,6 +37,9 @@
<
setting
name
=
"targetSetting"
serializeAs
=
"String"
>
<
value
/>
</
setting
>
<
setting
name
=
"reportPathSetting"
serializeAs
=
"String"
>
<
value
/>
</
setting
>
</
CSRender
.
Properties
.
Settings
>
</
userSettings
>
<!--
runtime
-->
...
...
Code/CSRender/CSRender/CompareTIFF.cs
View file @
1bf2445a
...
...
@@ -23,7 +23,7 @@ namespace CSRender
{
public
static
string
runPureVerify
(
string
targetDir
,
string
referenceDir
,
string
workPath
,
string
shiftPixel
,
string
colorMargin
,
string
removePoint
,
string
shadingOff
,
bool
reportFlag
,
string
reportName
,
string
inDiffPath
)
bool
reportFlag
,
string
reportName
,
string
inDiffPath
,
string
inTargetFileName
,
DateTime
inDateTime
)
{
//実行用コンソールの呼び出し
ProcessStartInfo
processStartInfo
=
new
ProcessStartInfo
();
...
...
@@ -77,17 +77,31 @@ namespace CSRender
processStartInfo
.
Arguments
+=
"\" /shadingoff \""
;
processStartInfo
.
Arguments
+=
shadingOff
;
processStartInfo
.
Arguments
+=
"\" "
;
if
(
reportFlag
==
true
)
{
//対象ファイル名を設定
inTargetFileName
=
System
.
IO
.
Path
.
GetFileNameWithoutExtension
(
inTargetFileName
);
processStartInfo
.
Arguments
+=
"/inspTiff \""
;
processStartInfo
.
Arguments
+=
inTargetFileName
+
".pdf"
;
processStartInfo
.
Arguments
+=
"\" "
;
//レポートファイル名を設定
string
timeForReport
=
"【"
+
inDateTime
.
ToString
(
"yyMMdd_HHmm"
)
+
"】"
+
".pdf"
;
string
TargetName
=
System
.
IO
.
Path
.
Combine
(
reportName
,
"report_"
+
inTargetFileName
+
".pdf"
+
timeForReport
);
processStartInfo
.
Arguments
+=
"/inspReport \""
;
processStartInfo
.
Arguments
+=
reportName
;
processStartInfo
.
Arguments
+=
TargetName
;
processStartInfo
.
Arguments
+=
"\" "
;
//Logファイル名を設定
string
logFileName
=
System
.
IO
.
Path
.
Combine
(
workDir
,
"report"
,
inTargetFileName
+
".pdf.log"
);
processStartInfo
.
Arguments
+=
"/pureVLog \""
;
processStartInfo
.
Arguments
+=
logFileName
;
processStartInfo
.
Arguments
+=
"\" "
;
}
//差異画像の出力
processStartInfo
.
Arguments
+=
"/
topPageInfo
"
;
processStartInfo
.
Arguments
+=
"/
outDiff \"
"
;
processStartInfo
.
Arguments
+=
inDiffPath
;
processStartInfo
.
Arguments
+=
" "
;
processStartInfo
.
Arguments
+=
"
\"
"
;
//レポート記述内容の参照先
processStartInfo
.
Arguments
+=
"/topPageInfo "
;
...
...
@@ -100,13 +114,16 @@ namespace CSRender
process
.
WaitForExit
();
process
.
Close
();
//NGの含まれる場合レポート名の頭に【NG】を付与
NGReportName
(
TargetName
,
reportName
);
return
workDir
;
}
//指定先にレポートを移動
public
static
void
moveReport
(
string
resultPath
,
string
workPath
)
{
string
reportPath
=
System
.
IO
.
Path
.
Combine
(
resultPath
,
"report"
);
string
reportPath
=
System
.
IO
.
Path
.
Combine
(
resultPath
,
"report"
,
"Log"
);
if
(!
Directory
.
Exists
(
reportPath
))
//指定先にreportフォルダがあるか
{
Directory
.
CreateDirectory
(
reportPath
);
//なければ新規でreportフォルダを作成
...
...
@@ -130,5 +147,23 @@ namespace CSRender
return
ReportName
;
}
//NGの含まれる検版レポート名を編集
public
static
void
NGReportName
(
string
inTargetName
,
string
inReportPath
)
{
//string searchName = "report_" + inTargetName;
string
searchfile
=
System
.
IO
.
Path
.
GetFileNameWithoutExtension
(
inTargetName
)
+
"&*"
;
var
reportFileName
=
Directory
.
GetFiles
(
inReportPath
,
searchfile
);
if
(
reportFileName
.
Length
>
0
)
{
foreach
(
var
oldPathName
in
reportFileName
)
{
string
oldFile
=
System
.
IO
.
Path
.
GetFileName
(
oldPathName
);
File
.
Copy
(
oldPathName
,
System
.
IO
.
Path
.
Combine
(
inReportPath
,
"【NG】"
+
oldFile
),
true
);
File
.
Delete
(
oldPathName
);
}
}
}
}
}
Code/CSRender/CSRender/FilePathSelect.cs
View file @
1bf2445a
...
...
@@ -74,7 +74,7 @@ namespace CSRender
var
dropFiles
=
e
.
Data
.
GetData
(
System
.
Windows
.
DataFormats
.
FileDrop
)
as
string
[];
if
(
dropFiles
==
null
)
return
;
//カーソルを終端に置く
reportBox
.
Text
=
dropFiles
[
0
]
+
@"\"
;
reportBox
.
Text
=
dropFiles
[
0
];
reportBox
.
Focus
();
reportBox
.
Select
(
this
.
reportBox
.
Text
.
Length
,
0
);
}
...
...
@@ -159,7 +159,7 @@ namespace CSRender
{
Directory
.
CreateDirectory
(
System
.
IO
.
Path
.
Combine
(
selectFile
.
FileName
,
"report"
));
}
//reportBox.Text = System.IO.Path.Combine(selectFile.FileName, "report")
+ @"\"
;
//reportBox.Text = System.IO.Path.Combine(selectFile.FileName, "report");
}
//参照ボタンClickでフォルダ選択のダイアログを表示(検版レポートパス)
...
...
@@ -172,7 +172,7 @@ namespace CSRender
selectFile
.
Title
=
"フォルダを選択してください"
;
if
(
Directory
.
Exists
(
workBox
.
Text
))
//前回値が存在する場合はそのフォルダを初期値として表示
{
selectFile
.
InitialDirectory
=
workBox
.
Text
.
Substring
(
0
,
work
Box
.
Text
.
LastIndexOf
(
@"\"
));
selectFile
.
InitialDirectory
=
workBox
.
Text
.
Substring
(
0
,
report
Box
.
Text
.
LastIndexOf
(
@"\"
));
}
else
{
...
...
@@ -183,7 +183,7 @@ namespace CSRender
return
;
}
//共通部分
reportBox
.
Text
=
selectFile
.
FileName
+
@"\"
;
reportBox
.
Text
=
selectFile
.
FileName
;
reportBox
.
Focus
();
reportBox
.
Select
(
this
.
reportBox
.
Text
.
Length
,
0
);
}
...
...
@@ -221,12 +221,17 @@ namespace CSRender
//レポート出力パスの確認
private
bool
checkReportPath
()
{
bool
reportFlag
=
fals
e
;
string
pdfReportPath
=
""
;
string
pdfReportName
=
""
;
int
directoryCount
=
0
;
bool
reportFlag
=
tru
e
;
//
string pdfReportPath = "";
//
string pdfReportName = "";
//
int directoryCount = 0;
if
(
reportBox
.
Text
!=
""
)
//入力があるか
{
if
(!
Directory
.
Exists
(
reportBox
.
Text
))
{
Directory
.
CreateDirectory
(
reportBox
.
Text
);
}
/*
directoryCount = reportBox.Text.Split(char.Parse(@"\")).Length - 1;//入力文字列がファイル名のみかディレクトリも含むか
if (directoryCount == 0)//ファイル名のみならば作業ディレクトリのreportフォルダに出力
{
...
...
@@ -254,8 +259,15 @@ namespace CSRender
}
reportBox.Text = pdfReportPath + pdfReportName;
reportBox.Focus();
reportBox
.
Select
(
this
.
reportBox
.
Text
.
Length
,
0
);
reportFlag
=
true
;
reportBox.Select(this.reportBox.Text.Length, 0);*/
}
else
{
reportBox
.
Text
=
System
.
IO
.
Path
.
Combine
(
workBox
.
Text
,
"report"
);
if
(!
Directory
.
Exists
(
System
.
IO
.
Path
.
Combine
(
workBox
.
Text
,
"report"
)))
{
Directory
.
CreateDirectory
(
System
.
IO
.
Path
.
Combine
(
workBox
.
Text
,
"report"
));
}
}
return
reportFlag
;
}
...
...
Code/CSRender/CSRender/MainWindow.xaml.cs
View file @
1bf2445a
...
...
@@ -63,6 +63,7 @@ namespace CSRender
workBox
.
Text
=
Properties
.
Settings
.
Default
.
workSpaceSetting
;
targetBox
.
Text
=
Properties
.
Settings
.
Default
.
targetSetting
;
referenceBox
.
Text
=
Properties
.
Settings
.
Default
.
referenceSetting
;
reportBox
.
Text
=
Properties
.
Settings
.
Default
.
reportPathSetting
;
//ドラッグ&ドロップイベントの追加
targetBox
.
AddHandler
(
TextBox
.
DragOverEvent
,
new
DragEventHandler
(
textBox_PreviewDragOver
),
true
);
...
...
@@ -166,6 +167,7 @@ namespace CSRender
logText
+=
ex
.
Message
+
"\n"
+
ex
.
StackTrace
+
Environment
.
NewLine
;
File
.
AppendAllText
(
System
.
IO
.
Path
.
Combine
(
workLogPath
,
"CSRender.log"
),
logText
);
reportBox
.
Text
=
""
;
checkReportPath
();
//referenceErrorFlag = true;
}
...
...
@@ -255,7 +257,7 @@ namespace CSRender
var
allRipTime
=
$"
{
timeResult
}
"
.
Substring
(
0
,
8
);
ResultConsole
.
Text
+=
" [RIP処理時間 "
+
allRipTime
+
"]\r\n"
;
ResultConsole
.
Text
+=
"<TIFF変換完了>\r\n
\r\n
"
;
ResultConsole
.
Text
+=
"<TIFF変換完了>\r\n"
;
ResultConsole
.
ScrollToEnd
();
DoEvents
();
...
...
@@ -277,10 +279,23 @@ namespace CSRender
string
workDir
=
""
;
try
{
// 日付取得
DateTime
NowTime
=
DateTime
.
Now
;
//検版対象ファイル名の取得
string
[]
inspectionTargets
=
GetTargetList
(
targetBox
.
Text
,
referenceBox
.
Text
);
foreach
(
var
targetPDFName
in
inspectionTargets
)
{
//PureVerifyの実行
workDir
=
CompareTIFF
.
runPureVerify
(
targetTIFFPath
,
referenceTIFFPath
,
workBox
.
Text
,
shiftPixel
,
colorMargin
,
removePoint
,
shadingOff
,
reportFlag
,
reportBox
.
Text
,
outDiffPath
);
,
shiftPixel
,
colorMargin
,
removePoint
,
shadingOff
,
reportFlag
,
reportBox
.
Text
,
outDiffPath
,
targetPDFName
,
NowTime
);
}
//string targetPDFName = "";
//PureVerifyの実行
//workDir = CompareTIFF.runPureVerify(targetTIFFPath, referenceTIFFPath, workBox.Text
//, shiftPixel, colorMargin, removePoint, shadingOff, reportFlag, reportBox.Text, outDiffPath, targetPDFName);
}
catch
(
Exception
ex
)
{
...
...
@@ -358,6 +373,7 @@ namespace CSRender
Properties
.
Settings
.
Default
.
workSpaceSetting
=
workBox
.
Text
;
Properties
.
Settings
.
Default
.
targetSetting
=
targetBox
.
Text
;
Properties
.
Settings
.
Default
.
referenceSetting
=
referenceBox
.
Text
;
Properties
.
Settings
.
Default
.
reportPathSetting
=
reportBox
.
Text
;
Properties
.
Settings
.
Default
.
Save
();
}
...
...
@@ -372,30 +388,44 @@ namespace CSRender
private
void
outputLog
(
string
workDir
)
{
//logファイルを読み取り(1行ずつ)
string
[]
reportFiles
=
System
.
IO
.
Directory
.
GetFiles
(
workDir
,
"*.log"
,
System
.
IO
.
SearchOption
.
TopDirectoryOnly
);
string
logfileName
=
reportFiles
[
0
];
string
[]
reportFiles
=
System
.
IO
.
Directory
.
GetFiles
(
workDir
,
"*.pdf.log"
,
System
.
IO
.
SearchOption
.
TopDirectoryOnly
);
foreach
(
var
logfileName
in
reportFiles
)
{
string
cutLogPath
=
System
.
IO
.
Path
.
GetFileName
(
logfileName
);
string
outputFileName
=
"\r\n【"
+
cutLogPath
.
Remove
(
cutLogPath
.
IndexOf
(
".log"
))
+
"】"
;
ResultConsole
.
Text
+=
outputFileName
+
"\r\n"
;
StreamReader
logString
=
new
StreamReader
(
logfileName
,
Encoding
.
GetEncoding
(
"Shift-JIS"
));
//Shift-JISでエンコーディング
string
tranceString
=
""
;
int
lineCount
=
0
;
//int lineCount = 0;
//ファイルから読み取った結果をUIに出力
while
(
logString
.
EndOfStream
==
false
)
{
tranceString
=
logString
.
ReadLine
();
/*
lineCount++;
//logファイルにある処理日時表示を除去
if
(
lineCount
==
14
||
lineCount
==
19
||
lineCount
==
36
||
lineCount
==
37
||
lineCount
==
38
||
lineCount
==
39
)
if (lineCount == 14 || lineCount == 20 || lineCount == 37 || lineCount == 38 || lineCount == 39 || lineCount == 40
)
{
tranceString
=
tranceString
.
Substring
(
0
,
66
);
tranceString = tranceString.Substring(0,
66);
}
if
(
lineCount
>
13
&&
lineCount
<
40
)
//必要なところだけをUIに記述
if (lineCount > 13 && lineCount < 41
)//必要なところだけをUIに記述
{
ResultConsole.Text += tranceString + "\r\n";
ResultConsole.ScrollToEnd();
DoEvents();
}
*/
ResultConsole
.
Text
+=
tranceString
+
"\r\n"
;
ResultConsole
.
ScrollToEnd
();
DoEvents
();
}
logString
.
Close
();
}
//string logfileName = reportFiles[0];
}
/// <summary>
...
...
@@ -519,6 +549,32 @@ namespace CSRender
streamWriter
.
Close
();
}
/// <summary>
/// 検版対象のPDFリストを作成する
/// </summary>
private
string
[]
GetTargetList
(
string
inTargetDir
,
string
inRefarenceDir
)
{
string
[]
targetPDFList
=
getPDFName
(
inTargetDir
);
string
[]
refPDFList
=
getPDFName
(
inRefarenceDir
);
List
<
string
>
InspectionPDFs
=
new
List
<
string
>();
;
int
i
=
0
;
foreach
(
var
refPDF
in
refPDFList
)
{
refPDFList
[
i
]
=
System
.
IO
.
Path
.
GetFileName
(
refPDF
);
i
++;
}
foreach
(
var
tarPDF
in
targetPDFList
)
{
if
(
refPDFList
.
Contains
(
System
.
IO
.
Path
.
GetFileName
(
tarPDF
)))
{
InspectionPDFs
.
Add
(
tarPDF
);
}
}
return
InspectionPDFs
.
ToArray
();
}
/// <summary>
/// TIFF画像化を実行する
...
...
Code/CSRender/CSRender/Properties/Settings.Designer.cs
View file @
1bf2445a
...
...
@@ -130,5 +130,17 @@ namespace CSRender.Properties {
this
[
"targetSetting"
]
=
value
;
}
}
[
global
::
System
.
Configuration
.
UserScopedSettingAttribute
()]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Configuration
.
DefaultSettingValueAttribute
(
""
)]
public
string
reportPathSetting
{
get
{
return
((
string
)(
this
[
"reportPathSetting"
]));
}
set
{
this
[
"reportPathSetting"
]
=
value
;
}
}
}
}
Code/CSRender/CSRender/Properties/Settings.settings
View file @
1bf2445a
...
...
@@ -29,5 +29,8 @@
<Setting
Name=
"targetSetting"
Type=
"System.String"
Scope=
"User"
>
<Value
Profile=
"(Default)"
/>
</Setting>
<Setting
Name=
"reportPathSetting"
Type=
"System.String"
Scope=
"User"
>
<Value
Profile=
"(Default)"
/>
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
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