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
75aec1ee
Commit
75aec1ee
authored
Sep 21, 2022
by
tsuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
検版実行中のキャンセル処理を追加
parent
6c87f8dd
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
512 additions
and
222 deletions
+512
-222
CompareTIFF.cs
root/gui/Code/CSRender/CSRender/CompareTIFF.cs
+2
-1
FilePathSelect.cs
root/gui/Code/CSRender/CSRender/FilePathSelect.cs
+20
-0
MainWindow.xaml
root/gui/Code/CSRender/CSRender/MainWindow.xaml
+6
-5
MainWindow.xaml.cs
root/gui/Code/CSRender/CSRender/MainWindow.xaml.cs
+373
-176
OurputTIFF.cs
root/gui/Code/CSRender/CSRender/OurputTIFF.cs
+111
-40
No files found.
root/gui/Code/CSRender/CSRender/CompareTIFF.cs
View file @
75aec1ee
...
...
@@ -146,7 +146,8 @@ namespace CSRender
//指定先にレポートを移動
internal
static
void
moveReport
(
string
resultPath
,
string
workPath
)
{
string
reportPath
=
System
.
IO
.
Path
.
Combine
(
resultPath
,
"report"
,
"Log"
);
//string reportPath = System.IO.Path.Combine(resultPath, "report", "Log");
string
reportPath
=
System
.
IO
.
Path
.
Combine
(
resultPath
,
"Log"
);
if
(!
Directory
.
Exists
(
reportPath
))
//指定先にreportフォルダがあるか
{
Directory
.
CreateDirectory
(
reportPath
);
//なければ新規でreportフォルダを作成
...
...
root/gui/Code/CSRender/CSRender/FilePathSelect.cs
View file @
75aec1ee
...
...
@@ -338,5 +338,25 @@ namespace CSRender
Directory
.
CreateDirectory
(
inDirPath
);
//同名のディレクトリを作成
}
//キャンセルが実行されたときに、途中で生成したファイル群を削除
private
void
DelDirCancel
(
string
inWorkPath
)
{
try
{
if
(
Directory
.
Exists
(
System
.
IO
.
Path
.
Combine
(
inWorkPath
,
"OUT_DIFF"
)))
{
Directory
.
Delete
(
System
.
IO
.
Path
.
Combine
(
inWorkPath
,
"OUT_DIFF"
),
true
);
//OUT_DIFFを削除
}
if
(
Directory
.
Exists
(
System
.
IO
.
Path
.
Combine
(
inWorkPath
,
"work"
)))
{
Directory
.
Delete
(
System
.
IO
.
Path
.
Combine
(
inWorkPath
,
"work"
),
true
);
//作業(work)ディレクトリを削除
}
}
catch
(
Exception
ex
)
{
return
;
}
}
}
}
root/gui/Code/CSRender/CSRender/MainWindow.xaml
View file @
75aec1ee
...
...
@@ -62,9 +62,9 @@
</ComboBox.Background>
</ComboBox>
</StackPanel>
<Label Content="出力形式:" Margin="
41,0,11,1.667
" VerticalAlignment="Bottom" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="9" Height="29" Grid.RowSpan="2"/>
<Label Content="出力形式:" Margin="
9,0,43,2
" VerticalAlignment="Bottom" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="9" Height="29" Grid.RowSpan="2"/>
<Label x:Name="pageLabel" Content="指定ページ:" Margin="1,27.667,91.667,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="5" Height="29" IsEnabled="{Binding PageRange_SelectionChanged}" Grid.RowSpan="3" Grid.Column="1"/>
<StackPanel HorizontalAlignment="Left" Margin="
119,2.333,0,0.333
" Grid.Row="10" Width="71" Grid.RowSpan="2" Grid.ColumnSpan="2" >
<StackPanel HorizontalAlignment="Left" Margin="
84,2,0,0
" Grid.Row="10" Width="71" Grid.RowSpan="2" Grid.ColumnSpan="2" >
<ComboBox x:Name="FileSelect" SelectedValuePath="Id" DisplayMemberPath="Item" Height="21" SelectedValue="1" Margin="0,0,9.667,0" BorderBrush="#FF3A3A3A" >
<ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
...
...
@@ -78,9 +78,10 @@
TextWrapping="Wrap" Text="1,2,4-6" VerticalAlignment="Top" FontSize="14" IsEnabled="{Binding PageRange_SelectionChanged}" Grid.ColumnSpan="3"
InputMethod.IsInputMethodSuspended="True" PreviewKeyDown="PageBox_PreviewKeyDown" PreviewTextInput="PageBox_PreviewTextInput" LostFocus="PageBox_LostFocus" CommandManager.PreviewExecuted="PageBox_PreviewExecuted" BorderBrush="#FF595959"/>
<TextBox x:Name="ResultConsole" Margin="44,6.667,44.333,8.667" Grid.Row="9" Grid.ColumnSpan="4" VerticalScrollBarVisibility="Auto" FontSize="14" IsReadOnly="True" HorizontalScrollBarVisibility="Auto" BorderBrush="#FF595959" Panel.ZIndex="1"/>
<Button x:Name="TIFFButton" Content="画像出力" HorizontalAlignment="Left" Height="22" Margin="52,2.333,0,0" Grid.Row="10" VerticalAlignment="Top" Width="82" Click="TIFFButtonClick" Grid.Column="1"/>
<Button x:Name="CompareButton" Content="比較" HorizontalAlignment="Left" Height="22" Margin="143,2.333,0,0" Grid.Row="10" VerticalAlignment="Top" Width="82" Grid.Column="1" Click="CompareButtonClick" Grid.ColumnSpan="2"/>
<Button x:Name="closeButton" Content="Close" Height="22" Margin="0,2.333,45.333,0" Grid.Row="10" VerticalAlignment="Top" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Right" Width="77" Click="CloseButton_Click"/>
<Button x:Name="TIFFButton" Content="画像出力" HorizontalAlignment="Left" Height="22" Margin="17,2,0,0" Grid.Row="10" VerticalAlignment="Top" Width="70" Click="TIFFButtonClick" Grid.Column="1"/>
<Button x:Name="CompareButton" Content="比較" HorizontalAlignment="Left" Height="22" Margin="96,2,0,0" Grid.Row="10" VerticalAlignment="Top" Width="70" Grid.Column="1" Click="CompareButtonClick"/>
<Button x:Name="closeButton" Content="Close" Height="22" Margin="0,2.333,45.333,0" Grid.Row="10" VerticalAlignment="Top" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Right" Width="70" Click="CloseButton_Click"/>
<Button x:Name="cancelButton" Content="Cancel" Height="22" Margin="0,2,39,0" Grid.Row="10" VerticalAlignment="Top" Grid.Column="2" HorizontalAlignment="Right" Width="70" Click="CancelButton_Click"/>
<Label Content="位置ズレ許容量(0 - 2):" Margin="1,0.667,29.667,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="153,4.667,0,2.333" Width="32" Background="WhiteSmoke">
...
...
root/gui/Code/CSRender/CSRender/MainWindow.xaml.cs
View file @
75aec1ee
This diff is collapsed.
Click to expand it.
root/gui/Code/CSRender/CSRender/OurputTIFF.cs
View file @
75aec1ee
...
...
@@ -16,13 +16,18 @@ using System.Windows.Controls.Primitives;
using
System.Text.RegularExpressions
;
using
System.Diagnostics
;
using
System.IO
;
using
System.Threading
;
namespace
CSRender
{
class
OutputTIFF
partial
class
OutputTIFF
{
public
static
string
runCSRender
(
string
resolutionNum
,
string
outputFile
,
bool
pageFlag
,
string
filePage
,
string
targetPath
,
string
workPath
)
public
static
void
runCSRender
(
string
resolutionNum
,
string
outputFile
,
bool
pageFlag
,
string
filePage
,
string
targetPath
,
string
workPath
,
CancellationToken
inCanceller
,
bool
inCanFlag
)
{
//string resuletString = "";
try
{
//実行用コンソール呼び出し
ProcessStartInfo
processStartInfo
=
new
ProcessStartInfo
();
...
...
@@ -63,11 +68,77 @@ namespace CSRender
//CSRender.exeを実行
Process
process
=
Process
.
Start
(
processStartInfo
);
string
resuletString
=
process
.
StandardOutput
.
ReadToEnd
();
process
.
WaitForExit
();
Boolean
ProcEndFlag
=
false
;
if
(
inCanceller
.
IsCancellationRequested
)
{
process
.
Kill
();
inCanceller
.
ThrowIfCancellationRequested
();
//process.Close();
// if (Directory.Exists(System.IO.Path.Combine(inWorkPath, "OUT_DIFF")))
// {
// Directory.Delete(System.IO.Path.Combine(inWorkPath, "OUT_DIFF"), true);//OUT_DIFFを削除
// }
// if (Directory.Exists(System.IO.Path.Combine(inWorkPath, "work")))
// {
// Directory.Delete(System.IO.Path.Combine(inWorkPath, "work"), true);//作業(work)ディレクトリを削除
// }
return
;
}
////string resuletString = process.StandardOutput.ReadToEnd();
//resuletString = process.StandardOutput.ReadToEnd();
//resuletString = await ReadLineAsync(process, resuletString);
//process.WaitForExit();
while
(!
ProcEndFlag
)
{
if
(
inCanceller
.
IsCancellationRequested
)
{
process
.
Kill
();
inCanceller
.
ThrowIfCancellationRequested
();
return
;
}
ProcEndFlag
=
process
.
WaitForExit
(
10000
);
}
process
.
Close
();
}
catch
(
OperationCanceledException
)
{
return
;
}
return
resuletString
;
return
;
}
private
async
static
Task
<
string
>
ReadLineAsync
(
Process
inProc
,
string
inLineStr
)
{
inLineStr
=
await
inProc
.
StandardOutput
.
ReadToEndAsync
();
return
inLineStr
;
}
//public static async Task<string>runExe(string resolutionNum, string outputFile,
// bool pageFlag, string filePage, string targetPath, string workPath, CancellationToken inCanceller)
//{
// string resuletString = "";
// try
// {
// await Task.Run(async () =>
// //await Task.Factory.StartNew(() =>
// {
// resuletString =
// OutputTIFF.runCSRender(resolutionNum, outputFile, pageFlag, filePage, targetPath, workPath, inCanceller);
// }, inCanceller);
// }
// catch(OperationCanceledException)
// {
// return "Canceled";
// }
// 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