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
9b4210c1
Commit
9b4210c1
authored
Nov 16, 2021
by
tsuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
比較ボタンをクリックしたときにTIFF出力を行うように修正
parent
24fda800
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
242 additions
and
60 deletions
+242
-60
CSRender.csproj
Code/CSRender/CSRender/CSRender.csproj
+2
-2
CompareTIFF.cs
Code/CSRender/CSRender/CompareTIFF.cs
+17
-56
MainWindow.xaml
Code/CSRender/CSRender/MainWindow.xaml
+1
-1
MainWindow.xaml.cs
Code/CSRender/CSRender/MainWindow.xaml.cs
+150
-1
OurputTIFF.cs
Code/CSRender/CSRender/OurputTIFF.cs
+72
-0
No files found.
Code/CSRender/CSRender/CSRender.csproj
View file @
9b4210c1
...
...
@@ -72,9 +72,9 @@
<DependentUpon>
App.xaml
</DependentUpon>
<SubType>
Code
</SubType>
</Compile>
<Compile
Include=
"Compare
ButtonSetting
.cs"
/>
<Compile
Include=
"Compare
TIFF
.cs"
/>
<Compile
Include=
"CustomMsgBox.cs"
/>
<Compile
Include=
"
TIFFButtonsSetting
.cs"
/>
<Compile
Include=
"
OurputTIFF
.cs"
/>
<Compile
Include=
"ComboBox.cs"
/>
<Compile
Include=
"FilePathSelect.cs"
/>
<Compile
Include=
"MainWindow.xaml.cs"
>
...
...
Code/CSRender/CSRender/Compare
ButtonSetting
.cs
→
Code/CSRender/CSRender/Compare
TIFF
.cs
View file @
9b4210c1
...
...
@@ -19,10 +19,11 @@ using System.IO;
namespace
CSRender
{
public
partial
class
MainWindow
:
Window
class
CompareTIFF
{
p
rivate
void
CompareButtonClick
(
object
sender
,
RoutedEventArgs
e
)
p
ublic
static
string
runPureVerify
(
string
targetDir
,
string
referenceDir
,
string
workPath
)
{
//実行用コンソールの呼び出し
ProcessStartInfo
processStartInfo
=
new
ProcessStartInfo
();
string
stCurrentDir
=
System
.
IO
.
Directory
.
GetCurrentDirectory
();
string
exePath
=
System
.
IO
.
Path
.
Combine
(
"PureVerify.Data"
,
"RipVerify"
,
"bin"
,
"x64"
);
...
...
@@ -34,23 +35,11 @@ namespace CSRender
//引数設定
//指定ファイル
processStartInfo
.
Arguments
=
"/tar "
;
if
(!
Directory
.
Exists
(
targetBox
.
Text
)
&&
!
File
.
Exists
(
targetBox
.
Text
))
//pathのチェック
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定されたファイルあるいはフォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
processStartInfo
.
Arguments
+=
targetBox
.
Text
;
processStartInfo
.
Arguments
+=
targetDir
;
//リファレンスファイル
if
(!
Directory
.
Exists
(
referenceBox
.
Text
)
&&
!
File
.
Exists
(
referenceBox
.
Text
))
//pathのチェック
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定されたリファレンスファイルあるいはフォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified reference file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
processStartInfo
.
Arguments
+=
" /ref "
;
processStartInfo
.
Arguments
+=
reference
Box
.
Text
;
processStartInfo
.
Arguments
+=
reference
Dir
;
//EquiosCenterの場所
string
EquiosCenter
=
System
.
IO
.
Path
.
Combine
(
stCurrentDir
,
"PureVerify.Data"
,
"EquiosCenter_small"
);
...
...
@@ -59,17 +48,10 @@ namespace CSRender
//出力ファイル形式の引数
processStartInfo
.
Arguments
+=
" /work "
;
if
(!
Directory
.
Exists
(
workBox
.
Text
)
&&
!
File
.
Exists
(
workBox
.
Text
))
//pathのチェック
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定された作業フォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified reference file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
//processStartInfo.Arguments += workBox.Text;
string
workDir
=
System
.
IO
.
Path
.
Combine
(
stCurrentDir
,
"PureVerify.Data"
,
"RipVerify"
);
processStartInfo
.
Arguments
+=
workDir
;
//processStartInfo.Arguments += workPath;
string
workDir
=
System
.
IO
.
Path
.
Combine
(
stCurrentDir
,
"PureVerify.Data"
,
"RipVerify"
);
processStartInfo
.
Arguments
+=
workDir
;
//検版の指定(2だとNGログ検版(LOG-Diff)になる)
processStartInfo
.
Arguments
+=
" /operation \"1\""
;
...
...
@@ -85,19 +67,24 @@ namespace CSRender
//CSRender.exeを実行
Process
process
=
Process
.
Start
(
processStartInfo
);
//ResultConsole.Text = process.StandardOutput.ReadToEnd();
process
.
OutputDataReceived
+=
process_DataReceived
;
//
process.OutputDataReceived += process_DataReceived;
process
.
BeginOutputReadLine
();
//ResultConsole.ScrollToEnd();
process
.
WaitForExit
();
process
.
Close
();
//指定先にレポートを移動
string
reportPath
=
System
.
IO
.
Path
.
Combine
(
workBox
.
Text
,
"report"
);
return
workDir
;
}
//指定先にレポートを移動
public
static
void
moveReport
(
string
resultPath
,
string
workPath
)
{
string
reportPath
=
System
.
IO
.
Path
.
Combine
(
resultPath
,
"report"
);
if
(!
Directory
.
Exists
(
reportPath
))
//指定先にreportフォルダがあるか
{
Directory
.
CreateDirectory
(
reportPath
);
//なければ新規でreportフォルダを作成
}
var
allReport
=
Directory
.
EnumerateFiles
(
System
.
IO
.
Path
.
Combine
(
work
Dir
,
"report"
)
var
allReport
=
Directory
.
EnumerateFiles
(
System
.
IO
.
Path
.
Combine
(
work
Path
,
"report"
)
,
"*"
,
SearchOption
.
TopDirectoryOnly
);
//reportフォルダ内の全てのファイルを取得
foreach
(
string
file
in
allReport
)
{
...
...
@@ -105,31 +92,5 @@ namespace CSRender
File
.
Move
(
file
,
System
.
IO
.
Path
.
Combine
(
reportPath
,
fileTarget
));
//指定先に移動
}
}
//コンソール出力を読み取りする関数
public
void
process_DataReceived
(
object
sender
,
DataReceivedEventArgs
e
)
{
string
VerifyResult
=
e
.
Data
;
Dispatcher
.
BeginInvoke
(
new
Action
(()
=>
{
ResultConsole
.
Text
=
VerifyResult
;
ResultConsole
.
ScrollToEnd
();
}));
}
private
string
outputLog
(
string
workDir
)
{
StreamReader
logString
=
new
StreamReader
(
System
.
IO
.
Path
.
Combine
(
workDir
,
"report"
+
"hironimo.txt"
));
string
toString
=
""
;
string
tranceString
=
logString
+
toString
;
string
cutString
=
"*****************************************************"
+
"\r\n"
+
"Number of Processors = 8"
+
"\r\n"
+
"HostName = I-N-21-00008"
+
"\r\n"
+
"PlatformId = 0"
+
"\r\n"
+
"PureVerifyMainSetUp.txt"
+
"\r\n"
+
" MakeThreadNums = 0"
+
" PDFREPORT_SPLIT_PAGENUM = 32"
+
"\r\n"
+
"*****************************************************"
;
string
outputString
=
tranceString
.
Replace
(
cutString
,
""
);
return
outputString
;
}
}
}
Code/CSRender/CSRender/MainWindow.xaml
View file @
9b4210c1
...
...
@@ -71,7 +71,7 @@
</StackPanel>
<TextBox x:Name="pageBox" Grid.Column="1" Height="23" Margin="192,3.667,11.333,0" Grid.Row="5"
TextWrapping="Wrap" Text="1,2,4-6" VerticalAlignment="Top" FontSize="14" IsEnabled="{Binding PageRange_SelectionChanged}"/>
<TextBox x:Name="ResultConsole" Margin="55,10.333,55.333,10" Grid.Row="6"
TextWrapping="Wrap" Grid.ColumnSpan="3" VerticalScrollBarVisibility="Auto" FontSize="14" IsReadOnly="True
"/>
<TextBox x:Name="ResultConsole" Margin="55,10.333,55.333,10" Grid.Row="6"
Grid.ColumnSpan="3" VerticalScrollBarVisibility="Auto" FontSize="14" IsReadOnly="True" HorizontalScrollBarVisibility="Auto
"/>
<Button x:Name="TIFFButton" Content="TIFF出力" HorizontalAlignment="Left" Height="22" Margin="54,1,0,0" Grid.Row="7" VerticalAlignment="Top" Width="82" Grid.RowSpan="2" Click="TIFFButtonClick"/>
<Button x:Name="CompareButton" Content="比較" HorizontalAlignment="Left" Height="22" Margin="13,1,0,0" Grid.Row="7" VerticalAlignment="Top" Width="82" Grid.Column="1" Grid.RowSpan="2" Click="CompareButtonClick"/>
<Button x:Name="closeButton" Content="Close" Height="22" Margin="0,1,55.333,0" Grid.Row="7" VerticalAlignment="Top" Grid.Column="1" Grid.ColumnSpan="2" Grid.RowSpan="2" HorizontalAlignment="Right" Width="77" Click="CloseButton_Click"/>
...
...
Code/CSRender/CSRender/MainWindow.xaml.cs
View file @
9b4210c1
...
...
@@ -15,6 +15,8 @@ using System.Windows.Shapes;
using
System.Windows.Controls.Primitives
;
using
System.Text.RegularExpressions
;
using
System.Collections.ObjectModel
;
using
System.Diagnostics
;
using
System.IO
;
namespace
CSRender
{
...
...
@@ -65,9 +67,156 @@ namespace CSRender
workBox
.
AddHandler
(
TextBox
.
DropEvent
,
new
DragEventHandler
(
WorkBox_Drop
),
true
);
}
//Closeボタン
//Closeボタン
実行
private
void
CloseButton_Click
(
object
sender
,
RoutedEventArgs
e
)
=>
Close
();
//比較ボタン実行
private
void
CompareButtonClick
(
object
sender
,
RoutedEventArgs
e
)
{
//対象フォルダのpathチェック
if
(!
Directory
.
Exists
(
targetBox
.
Text
)
&&
!
File
.
Exists
(
targetBox
.
Text
))
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定されたファイルあるいはフォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
//リファレンスファイルのpathチェック
if
(!
Directory
.
Exists
(
referenceBox
.
Text
)
&&
!
File
.
Exists
(
referenceBox
.
Text
))
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定されたリファレンスファイルあるいはフォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified reference file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
//出力ファイルpathのチェック
if
(!
Directory
.
Exists
(
workBox
.
Text
)
&&
!
File
.
Exists
(
workBox
.
Text
))
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定された作業フォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified reference file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
//TIFF画像の生成
ResultConsole
.
Text
+=
"<TIFF変換開始>\r\n"
;
ResultConsole
.
Text
+=
" 対象ファイルをTIFF画像に変換中\r\n"
;
//必要に応じてページ引数を指定
bool
pageFlag
=
false
;
string
selectedPage
=
""
;
if
(
PageRange
.
Text
==
"指定"
)
{
pageFlag
=
true
;
selectedPage
=
pageBox
.
Text
;
}
//対象フォルダ
string
targetTIFFPath
=
System
.
IO
.
Path
.
Combine
(
workBox
.
Text
,
"work"
,
"targetTIFF"
);
if
(!
Directory
.
Exists
(
targetTIFFPath
))
//指定先にTIFF用フォルダがあるか
{
Directory
.
CreateDirectory
(
targetTIFFPath
);
//なければ新規でTIFF用フォルダを作成
}
//CSRenderの実行
string
targetTIFFResult
=
OutputTIFF
.
runCSRender
(
ResolutionBox
.
Text
,
"TIFF"
,
pageFlag
,
selectedPage
,
targetBox
.
Text
,
targetTIFFPath
);
ResultConsole
.
Text
+=
" リファレンスファイルをTIFF画像に変換中\r\n"
;
//リファレンスフォルダ
string
referenceTIFFPath
=
System
.
IO
.
Path
.
Combine
(
workBox
.
Text
,
"work"
,
"referenceTIFF"
);
if
(!
Directory
.
Exists
(
referenceTIFFPath
))
//指定先にTIFF用フォルダがあるか
{
Directory
.
CreateDirectory
(
referenceTIFFPath
);
//なければ新規でTIFF用フォルダを作成
}
//CSRenderの実行
string
referenceTIFFResult
=
OutputTIFF
.
runCSRender
(
ResolutionBox
.
Text
,
"TIFF"
,
pageFlag
,
selectedPage
,
referenceBox
.
Text
,
referenceTIFFPath
);
ResultConsole
.
Text
+=
"<TIFF変換完了>\r\n\r\n"
;
//PureVerifyの実行
//string workDir = CompareTIFF.runPureVerify(targetBox.Text, referenceBox.Text, workBox.Text);
string
workDir
=
CompareTIFF
.
runPureVerify
(
targetTIFFPath
,
referenceTIFFPath
,
workBox
.
Text
);
//レポートを出力
outputLog
(
System
.
IO
.
Path
.
Combine
(
workDir
,
"report"
));
//指定先にレポートを移動
CompareTIFF
.
moveReport
(
workBox
.
Text
,
workDir
);
}
//UIに検版結果を出力
private
void
outputLog
(
string
workDir
)
{
//logファイルを読み取り
string
[]
reportFiles
=
System
.
IO
.
Directory
.
GetFiles
(
workDir
,
"*.log"
,
System
.
IO
.
SearchOption
.
TopDirectoryOnly
);
string
logfileName
=
reportFiles
[
0
];
StreamReader
logString
=
new
StreamReader
(
logfileName
,
Encoding
.
GetEncoding
(
"Shift-JIS"
));
//Shift-JISでエンコーディング
string
tranceString
=
""
;
int
lineCount
=
0
;
//ファイルから読み取った結果をUIに出力
while
(
logString
.
EndOfStream
==
false
)
{
tranceString
=
logString
.
ReadLine
();
lineCount
++;
if
(
lineCount
>
13
&&
lineCount
<
40
)
//必要なところだけをUIに記述
{
ResultConsole
.
Text
+=
tranceString
+
"\r\n"
;
ResultConsole
.
ScrollToEnd
();
}
}
logString
.
Close
();
}
//TIFFボタンを実行
private
void
TIFFButtonClick
(
object
sender
,
RoutedEventArgs
e
)
{
ResultConsole
.
Text
+=
"<変換開始>\r\n"
;
ResultConsole
.
Text
+=
"PDFを"
+
FileSelect
.
Text
+
"に変換します\r\n"
;
ResultConsole
.
Text
+=
"\r\n"
;
//必要に応じてページ引数を指定
bool
pageFlag
=
false
;
string
selectedPage
=
""
;
if
(
PageRange
.
Text
==
"指定"
)
{
pageFlag
=
true
;
selectedPage
=
pageBox
.
Text
;
}
//対象フォルダのpathが存在するかチェック
if
(!
Directory
.
Exists
(
targetBox
.
Text
)
&&
!
File
.
Exists
(
targetBox
.
Text
))
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定されたファイルあるいはフォルダが存在しません。"
+
"\nもう一度TIFF出力する対象を設定してください。"
,
"The specified file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
//出力フォルダのpathチェック
if
(
workBox
.
Text
!=
""
)
{
if
(!
Directory
.
Exists
(
workBox
.
Text
)
&&
!
File
.
Exists
(
workBox
.
Text
))
//pathのチェック
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定された作業フォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified reference file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
}
//CSRenderの実行
string
TIFFresult
=
OutputTIFF
.
runCSRender
(
ResolutionBox
.
Text
,
FileSelect
.
Text
,
pageFlag
,
selectedPage
,
targetBox
.
Text
,
workBox
.
Text
);
ResultConsole
.
Text
+=
TIFFresult
;
ResultConsole
.
Text
+=
"\r\n<変換終了>\r\n"
;
ResultConsole
.
ScrollToEnd
();
}
}
}
Code/CSRender/CSRender/
TIFFButtonsSetting
.cs
→
Code/CSRender/CSRender/
OurputTIFF
.cs
View file @
9b4210c1
...
...
@@ -19,10 +19,12 @@ using System.IO;
namespace
CSRender
{
public
partial
class
MainWindow
:
Window
class
OutputTIFF
{
private
void
TIFFButtonClick
(
object
sender
,
RoutedEventArgs
e
)
public
static
string
runCSRender
(
string
resolutionNum
,
string
outputFile
,
bool
pageFlag
,
string
filePage
,
string
targetPath
,
string
workPath
)
{
//実行用コンソール呼び出し
ProcessStartInfo
processStartInfo
=
new
ProcessStartInfo
();
string
stCurrentDir
=
System
.
IO
.
Directory
.
GetCurrentDirectory
();
processStartInfo
.
FileName
=
System
.
IO
.
Path
.
Combine
(
stCurrentDir
,
"CSRender.Data"
,
"CSRender.exe"
);
...
...
@@ -31,58 +33,40 @@ namespace CSRender
processStartInfo
.
RedirectStandardOutput
=
true
;
//標準出力をリダイレクト
//解像度の引数
if
(
NumericScroll1
.
Value
<
9
)
{
CustomMsgBox
.
Show
(
mainWindow
,
"解像度が正しく設定されていません。"
+
"\nもう一度設定してください。"
,
"The resolution value is not set correctly"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
ResolutionBox
.
Text
=
"9"
;
return
;
}
processStartInfo
.
Arguments
=
"/D "
;
processStartInfo
.
Arguments
+=
ResolutionBox
.
Text
;
processStartInfo
.
Arguments
+=
resolutionNum
;
//出力ファイル形式の引数
processStartInfo
.
Arguments
+=
" /"
;
processStartInfo
.
Arguments
+=
FileSelect
.
Text
;
processStartInfo
.
Arguments
+=
outputFile
;
processStartInfo
.
Arguments
+=
" "
;
//必要に応じてページ引数を指定
if
(
PageRange
.
Text
==
"指定"
)
if
(
pageFlag
==
true
)
{
processStartInfo
.
Arguments
+=
"/P \""
;
processStartInfo
.
Arguments
+=
pageBox
.
Text
;
processStartInfo
.
Arguments
+=
filePage
;
processStartInfo
.
Arguments
+=
"\" "
;
}
//指定ファイル
if
(!
Directory
.
Exists
(
targetBox
.
Text
)
&&
!
File
.
Exists
(
targetBox
.
Text
))
//pathが存在するかチェック
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定されたファイルあるいはフォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
processStartInfo
.
Arguments
+=
"/F "
;
processStartInfo
.
Arguments
+=
target
Box
.
Text
;
processStartInfo
.
Arguments
+=
target
Path
;
//出力フォルダ
if
(
workBox
.
Text
!=
""
)
if
(
workPath
!=
""
)
{
if
(!
Directory
.
Exists
(
workBox
.
Text
)
&&
!
File
.
Exists
(
workBox
.
Text
))
//pathのチェック
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定された作業フォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified reference file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
processStartInfo
.
Arguments
+=
" /O "
;
processStartInfo
.
Arguments
+=
work
Box
.
Text
;
processStartInfo
.
Arguments
+=
work
Path
;
}
//CSRender.exeを実行
Process
process
=
Process
.
Start
(
processStartInfo
);
ResultConsole
.
Text
=
process
.
StandardOutput
.
ReadToEnd
();
ResultConsole
.
ScrollToEnd
();
string
resuletString
=
process
.
StandardOutput
.
ReadToEnd
();
process
.
WaitForExit
();
process
.
Close
();
return
resuletString
;
}
}
}
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