Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GetAdocUI
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
GetAdocUI
Commits
7a73afe9
Commit
7a73afe9
authored
Nov 25, 2021
by
tsuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update RunBatch.cs
・tmpフォルダからフォルダ丸ごとコピーする形に修正 ・コードを整理
parent
e9f2953b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
56 deletions
+29
-56
MainWindow.xaml
GetADoc/MainWindow.xaml
+5
-5
MainWindow.xaml.cs
GetADoc/MainWindow.xaml.cs
+22
-22
RunBatch.cs
GetADoc/RunBatch.cs
+2
-29
GetADocGUI.exe
Release/GetADocGUI.exe
+0
-0
GetADocGUI.pdb
Release/GetADocGUI.pdb
+0
-0
No files found.
GetADoc/MainWindow.xaml
View file @
7a73afe9
...
@@ -23,17 +23,17 @@
...
@@ -23,17 +23,17 @@
AsciiDocの雛形を作成します
AsciiDocの雛形を作成します
</Label>
</Label>
<Label x:Name="label1" Content="作成先のフォルダ:" HorizontalAlignment="Left" Margin="10,40,0,0" VerticalAlignment="Top" Height="26" Width="94"/>
<Label x:Name="label1" Content="作成先のフォルダ:" HorizontalAlignment="Left" Margin="10,40,0,0" VerticalAlignment="Top" Height="26" Width="94"/>
<TextBox x:Name="
box1
" Margin="10,67,8.667,2" AllowDrop="True" Drop="textBox_Drop" DragOver="textBox_PreviewDragOver" Panel.ZIndex="6" Grid.ColumnSpan="3" GotFocus="DeleteCompLabel">
<TextBox x:Name="
FolderPathBox
" Margin="10,67,8.667,2" AllowDrop="True" Drop="textBox_Drop" DragOver="textBox_PreviewDragOver" Panel.ZIndex="6" Grid.ColumnSpan="3" GotFocus="DeleteCompLabel">
<フォルダ指定>
<フォルダ指定>
</TextBox>
</TextBox>
<Label x:Name="label2" Content="ドキュメント名:" Grid.Row="1" HorizontalAlignment="Left" Margin="10,11,0,0" VerticalAlignment="Top" Height="26" Width="92"/>
<Label x:Name="label2" Content="ドキュメント名:" Grid.Row="1" HorizontalAlignment="Left" Margin="10,11,0,0" VerticalAlignment="Top" Height="26" Width="92"/>
<TextBox x:Name="
box2
" Margin="10,37,9.667,18" Grid.Row="1" AllowDrop="True" Panel.ZIndex="2" Grid.ColumnSpan="2" GotFocus="DeleteCompLabel"/>
<TextBox x:Name="
ADocNameBox
" Margin="10,37,9.667,18" Grid.Row="1" AllowDrop="True" Panel.ZIndex="2" Grid.ColumnSpan="2" GotFocus="DeleteCompLabel"/>
<Label x:Name="label3" Content="(.adoc)" HorizontalAlignment="Left" Margin="1.333,32,0,13" Grid.Row="1" Width="45" Grid.Column="2"/>
<Label x:Name="label3" Content="(.adoc)" HorizontalAlignment="Left" Margin="1.333,32,0,13" Grid.Row="1" Width="45" Grid.Column="2"/>
<Button x:Name="button1" Content="参照" Grid.Column="3" HorizontalAlignment="Left" Margin="12.333,66,0,0" VerticalAlignment="Top" Width="46" Click="button1_Click" Panel.ZIndex="2" Height="20" GotFocus="DeleteCompLabel"/>
<Button x:Name="button1" Content="参照" Grid.Column="3" HorizontalAlignment="Left" Margin="12.333,66,0,0" VerticalAlignment="Top" Width="46" Click="button1_Click" Panel.ZIndex="2" Height="20" GotFocus="DeleteCompLabel"/>
<Button x:Name="button2" Content="作成" Grid.Column="3" Margin="6.333,0.667,0,0" Grid.Row="3" Panel.ZIndex="2" Click="button2_Click" Height="31" VerticalAlignment="Top" HorizontalAlignment="Left" Width="62" GotFocus="DeleteCompLabel"/>
<Button x:Name="button2" Content="作成" Grid.Column="3" Margin="6.333,0.667,0,0" Grid.Row="3" Panel.ZIndex="2" Click="button2_Click" Height="31" VerticalAlignment="Top" HorizontalAlignment="Left" Width="62" GotFocus="DeleteCompLabel"/>
<CheckBox x:Name="
checkbox1
" Content="SCREEN Logo" Grid.Row="3" Margin="7,9.667,2,-3.333" Panel.ZIndex="2" Height="53" VerticalAlignment="Top" GotFocus="DeleteCompLabel"/>
<CheckBox x:Name="
ScreenCheckbox
" Content="SCREEN Logo" Grid.Row="3" Margin="7,9.667,2,-3.333" Panel.ZIndex="2" Height="53" VerticalAlignment="Top" GotFocus="DeleteCompLabel"/>
<CheckBox x:Name="
checkbox2
" Content="カスタムアイコン" Grid.Row="3" Margin="5,9.667,1.667,-16.333" Panel.ZIndex="2" Grid.Column="1" Height="66" VerticalAlignment="Top" GotFocus="DeleteCompLabel"/>
<CheckBox x:Name="
IconCheckbox
" Content="カスタムアイコン" Grid.Row="3" Margin="5,9.667,1.667,-16.333" Panel.ZIndex="2" Grid.Column="1" Height="66" VerticalAlignment="Top" GotFocus="DeleteCompLabel"/>
<CheckBox x:Name="
checkbox3
" Content="分割ドキュメント" Grid.Row="3" Margin="4.333,9.667,8.667,-16.333" Panel.ZIndex="2" Grid.Column="2" Height="66" VerticalAlignment="Top" GotFocus="DeleteCompLabel"/>
<CheckBox x:Name="
SepaDocCheckbox
" Content="分割ドキュメント" Grid.Row="3" Margin="4.333,9.667,8.667,-16.333" Panel.ZIndex="2" Grid.Column="2" Height="66" VerticalAlignment="Top" GotFocus="DeleteCompLabel"/>
<TextBox x:Name="allBox" TextWrapping="Wrap" Grid.ColumnSpan="4" Grid.RowSpan="4" Opacity="0" Cursor="Arrow" Margin="0,0,0.333,-0.333"/>
<TextBox x:Name="allBox" TextWrapping="Wrap" Grid.ColumnSpan="4" Grid.RowSpan="4" Opacity="0" Cursor="Arrow" Margin="0,0,0.333,-0.333"/>
<Label x:Name="CompletedLabel" Content="作成が完了しました!" Grid.Column="2" HorizontalAlignment="Left" Margin="51.333,32,0,0" Grid.Row="1" VerticalAlignment="Top" Grid.ColumnSpan="2" Width="139" Visibility="Hidden" FontWeight="Bold" Foreground="#FFD70B0B"/>
<Label x:Name="CompletedLabel" Content="作成が完了しました!" Grid.Column="2" HorizontalAlignment="Left" Margin="51.333,32,0,0" Grid.Row="1" VerticalAlignment="Top" Grid.ColumnSpan="2" Width="139" Visibility="Hidden" FontWeight="Bold" Foreground="#FFD70B0B"/>
</Grid>
</Grid>
...
...
GetADoc/MainWindow.xaml.cs
View file @
7a73afe9
...
@@ -30,16 +30,16 @@ namespace GetADoc
...
@@ -30,16 +30,16 @@ namespace GetADoc
InitializeComponent
();
InitializeComponent
();
//デフォルトに前回の設定を表示
//デフォルトに前回の設定を表示
box1
.
Text
=
Properties
.
Settings
.
Default
.
box1Setting
;
FolderPathBox
.
Text
=
Properties
.
Settings
.
Default
.
box1Setting
;
checkbox1
.
IsChecked
=
Properties
.
Settings
.
Default
.
checkbox1Setting
;
ScreenCheckbox
.
IsChecked
=
Properties
.
Settings
.
Default
.
checkbox1Setting
;
checkbox2
.
IsChecked
=
Properties
.
Settings
.
Default
.
checkbox2Setting
;
IconCheckbox
.
IsChecked
=
Properties
.
Settings
.
Default
.
checkbox2Setting
;
checkbox3
.
IsChecked
=
Properties
.
Settings
.
Default
.
checkbox3Setting
;
SepaDocCheckbox
.
IsChecked
=
Properties
.
Settings
.
Default
.
checkbox3Setting
;
//ドラッグ&ドロップイベントの追加
//ドラッグ&ドロップイベントの追加
allBox
.
AddHandler
(
TextBox
.
DragOverEvent
,
new
DragEventHandler
(
textBox_PreviewDragOver
),
true
);
allBox
.
AddHandler
(
TextBox
.
DragOverEvent
,
new
DragEventHandler
(
textBox_PreviewDragOver
),
true
);
allBox
.
AddHandler
(
TextBox
.
DropEvent
,
new
DragEventHandler
(
textBox_Drop
),
true
);
allBox
.
AddHandler
(
TextBox
.
DropEvent
,
new
DragEventHandler
(
textBox_Drop
),
true
);
box1
.
AddHandler
(
TextBox
.
DragOverEvent
,
new
DragEventHandler
(
textBox_PreviewDragOver
),
true
);
FolderPathBox
.
AddHandler
(
TextBox
.
DragOverEvent
,
new
DragEventHandler
(
textBox_PreviewDragOver
),
true
);
box1
.
AddHandler
(
TextBox
.
DropEvent
,
new
DragEventHandler
(
textBox_Drop
),
true
);
FolderPathBox
.
AddHandler
(
TextBox
.
DropEvent
,
new
DragEventHandler
(
textBox_Drop
),
true
);
}
}
//フォルダ指定のためにファイルをドラッグ
//フォルダ指定のためにファイルをドラッグ
...
@@ -68,9 +68,9 @@ namespace GetADoc
...
@@ -68,9 +68,9 @@ namespace GetADoc
dropFiles
[
0
]
=
dropFiles
[
0
].
Substring
(
0
,
dropFiles
[
0
].
LastIndexOf
(
@"\"
));
dropFiles
[
0
]
=
dropFiles
[
0
].
Substring
(
0
,
dropFiles
[
0
].
LastIndexOf
(
@"\"
));
}
}
box1
.
Text
=
dropFiles
[
0
];
FolderPathBox
.
Text
=
dropFiles
[
0
];
box1
.
Focus
();
FolderPathBox
.
Focus
();
box1
.
Select
(
this
.
box1
.
Text
.
Length
,
0
);
FolderPathBox
.
Select
(
this
.
FolderPathBox
.
Text
.
Length
,
0
);
}
}
//参照ボタンClickでフォルダ選択のダイアログを表示
//参照ボタンClickでフォルダ選択のダイアログを表示
...
@@ -84,7 +84,7 @@ namespace GetADoc
...
@@ -84,7 +84,7 @@ namespace GetADoc
{
{
return
;
return
;
}
}
box1
.
Text
=
selectFile
.
FileName
;
FolderPathBox
.
Text
=
selectFile
.
FileName
;
}
}
//作成ボタンClickでチェックボックスで要求された仕様のADocファイル一式を指定先フォルダに生成
//作成ボタンClickでチェックボックスで要求された仕様のADocファイル一式を指定先フォルダに生成
...
@@ -94,21 +94,21 @@ namespace GetADoc
...
@@ -94,21 +94,21 @@ namespace GetADoc
bool
IconFlag
=
false
;
bool
IconFlag
=
false
;
bool
SCREENFlag
=
false
;
bool
SCREENFlag
=
false
;
bool
SepaFlag
=
false
;
bool
SepaFlag
=
false
;
if
(
checkbox2
.
IsChecked
==
true
)
//Iconsチェックボックスがオンのとき
if
(
IconCheckbox
.
IsChecked
==
true
)
//Iconsチェックボックスがオンのとき
{
{
IconFlag
=
true
;
IconFlag
=
true
;
}
}
if
(
checkbox1
.
IsChecked
==
true
)
//SCREEN Logoチェックボックスがオンのとき
if
(
ScreenCheckbox
.
IsChecked
==
true
)
//SCREEN Logoチェックボックスがオンのとき
{
{
SCREENFlag
=
true
;
SCREENFlag
=
true
;
}
}
if
(
checkbox3
.
IsChecked
==
true
)
//分割ドキュチェックボックスがオンのとき
if
(
SepaDocCheckbox
.
IsChecked
==
true
)
//分割ドキュチェックボックスがオンのとき
{
{
SepaFlag
=
true
;
SepaFlag
=
true
;
}
}
//ファイルパスが指定されていない or 指定したフォルダが存在しない場合
//ファイルパスが指定されていない or 指定したフォルダが存在しない場合
if
(
box1
.
Text
==
""
||
!
Directory
.
Exists
(
box1
.
Text
))
if
(
FolderPathBox
.
Text
==
""
||
!
Directory
.
Exists
(
FolderPathBox
.
Text
))
{
{
CustomMsgBox
.
Show
(
mainWindow
,
"保存先が存在しません"
,
"Save destination does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Warning
);
CustomMsgBox
.
Show
(
mainWindow
,
"保存先が存在しません"
,
"Save destination does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Warning
);
Properties
.
Settings
.
Default
.
box1Setting
=
""
;
//記憶していたパスを初期化
Properties
.
Settings
.
Default
.
box1Setting
=
""
;
//記憶していたパスを初期化
...
@@ -117,13 +117,13 @@ namespace GetADoc
...
@@ -117,13 +117,13 @@ namespace GetADoc
}
}
// テキストボックス2からfile名を取得
// テキストボックス2からfile名を取得
var
fileName
=
box2
.
Text
;
var
fileName
=
ADocNameBox
.
Text
;
if
(
box2
.
Text
==
""
)
if
(
ADocNameBox
.
Text
==
""
)
{
{
fileName
=
"t"
;
fileName
=
"t"
;
}
}
//テキストボック1から保存場所を取得
//テキストボック1から保存場所を取得
var
filePath
=
box1
.
Text
+
@"\"
;
var
filePath
=
FolderPathBox
.
Text
+
@"\"
;
// ファイル名に使用不可の文字が含まれている場合の処理
// ファイル名に使用不可の文字が含まれている場合の処理
char
[]
NgChars
=
System
.
IO
.
Path
.
GetInvalidFileNameChars
();
char
[]
NgChars
=
System
.
IO
.
Path
.
GetInvalidFileNameChars
();
...
@@ -133,7 +133,7 @@ namespace GetADoc
...
@@ -133,7 +133,7 @@ namespace GetADoc
fileName
=
RunBatch
.
NameCalibration
(
fileName
);
fileName
=
RunBatch
.
NameCalibration
(
fileName
);
CustomMsgBox
.
Show
(
mainWindow
,
"ファイル名に使用できない文字が存在したため\n一部ファイル名を修正しました。"
+
CustomMsgBox
.
Show
(
mainWindow
,
"ファイル名に使用できない文字が存在したため\n一部ファイル名を修正しました。"
+
"\nもう一度作成ボタンをクリックしてください。"
,
"Renamed this file"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Warning
);
"\nもう一度作成ボタンをクリックしてください。"
,
"Renamed this file"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Warning
);
box2
.
Text
=
fileName
;
ADocNameBox
.
Text
=
fileName
;
return
;
return
;
}
}
...
@@ -165,10 +165,10 @@ namespace GetADoc
...
@@ -165,10 +165,10 @@ namespace GetADoc
CompletedLabel
.
Visibility
=
Visibility
.
Visible
;
CompletedLabel
.
Visibility
=
Visibility
.
Visible
;
//指定されたファイルパスとチェックボックスを保存
//指定されたファイルパスとチェックボックスを保存
Properties
.
Settings
.
Default
.
box1Setting
=
box1
.
Text
;
Properties
.
Settings
.
Default
.
box1Setting
=
FolderPathBox
.
Text
;
Properties
.
Settings
.
Default
.
checkbox1Setting
=
((
bool
)
checkbox1
.
IsChecked
);
Properties
.
Settings
.
Default
.
checkbox1Setting
=
((
bool
)
ScreenCheckbox
.
IsChecked
);
Properties
.
Settings
.
Default
.
checkbox2Setting
=
((
bool
)
checkbox2
.
IsChecked
);
Properties
.
Settings
.
Default
.
checkbox2Setting
=
((
bool
)
IconCheckbox
.
IsChecked
);
Properties
.
Settings
.
Default
.
checkbox3Setting
=
((
bool
)
checkbox3
.
IsChecked
);
Properties
.
Settings
.
Default
.
checkbox3Setting
=
((
bool
)
SepaDocCheckbox
.
IsChecked
);
Properties
.
Settings
.
Default
.
Save
();
Properties
.
Settings
.
Default
.
Save
();
}
}
...
...
GetADoc/RunBatch.cs
View file @
7a73afe9
...
@@ -85,44 +85,17 @@ namespace GetADoc
...
@@ -85,44 +85,17 @@ namespace GetADoc
process
.
Close
();
process
.
Close
();
//指定されたフォルダに生成物を移動
//指定されたフォルダに生成物を移動
RunBatch
.
Move
Product
(
icon
,
sepa
,
fileName
,
tempPath
,
filePath
);
RunBatch
.
Move
Directory
(
tempPath
,
filePath
);
//テンポラリフォルダの消去
//テンポラリフォルダの消去
TemporaryFolder
.
DeleteTempFolder
(
tempPath
);
TemporaryFolder
.
DeleteTempFolder
(
tempPath
);
}
}
//生成物を指定先フォルダへ移動
static
public
void
MoveProduct
(
bool
icon
,
bool
sepa
,
string
fileName
,
string
tempPath
,
string
filePath
)
{
/*
個別移動ではなく、フォルダ全体を移動した方がよいが、とりあえずそのまま。理由:内部コマンドで生成物が増えたらまた追加修正が必要である。
*/
File
.
Move
(
System
.
IO
.
Path
.
Combine
(
tempPath
,
fileName
+
".adoc"
),
filePath
+
fileName
+
".adoc"
);
File
.
Move
(
System
.
IO
.
Path
.
Combine
(
tempPath
,
"config.adoc"
),
System
.
IO
.
Path
.
Combine
(
filePath
,
"config.adoc"
));
MoveDirectory
(
System
.
IO
.
Path
.
Combine
(
tempPath
,
"Images"
),
System
.
IO
.
Path
.
Combine
(
filePath
,
"Images"
));
// Directory.Move -> local MoveDirectory
if
(
icon
==
true
)
{
MoveDirectory
(
System
.
IO
.
Path
.
Combine
(
tempPath
,
"icons"
),
System
.
IO
.
Path
.
Combine
(
filePath
,
"icons"
));
// Directory.Move -> local MoveDirectory
}
if
(
sepa
==
true
)
{
File
.
Move
(
System
.
IO
.
Path
.
Combine
(
tempPath
,
"IncDoc.adoc"
),
System
.
IO
.
Path
.
Combine
(
filePath
,
"IncDoc.adoc"
));
MoveDirectory
(
System
.
IO
.
Path
.
Combine
(
tempPath
,
"Sub_First"
),
System
.
IO
.
Path
.
Combine
(
filePath
,
"Sub_First"
));
// Directory.Move -> local MoveDirectory
MoveDirectory
(
System
.
IO
.
Path
.
Combine
(
tempPath
,
"Sub_Second"
),
System
.
IO
.
Path
.
Combine
(
filePath
,
"Sub_Second"
));
// Directory.Move -> local MoveDirectory
}
}
/// <summary>
/// <summary>
/// ディレクトリを移動する。
/// ディレクトリを移動する。
/// </summary>
/// </summary>
/// <param name="sourceDirName">移動するディレクトリ</param>
/// <param name="sourceDirName">移動するディレクトリ</param>
/// <param name="destDirName">移動先のディレクトリ</param>
/// <param name="destDirName">移動先のディレクトリ</param>
/*
ref: https://johobase.com/copy-directory-csharp/ [ディレクトリ(フォルダー)をコピーする [C#]]
最後に追加して、移動元のディレクトリをサブディレクトリ、ファイルを含めて削除
Directory.Delete(sourceDirName, true);
*/
public
static
void
MoveDirectory
(
string
sourceDirName
,
string
destDirName
)
public
static
void
MoveDirectory
(
string
sourceDirName
,
string
destDirName
)
{
{
// コピー先のディレクトリがないかどうか判定する
// コピー先のディレクトリがないかどうか判定する
...
@@ -151,7 +124,7 @@ namespace GetADoc
...
@@ -151,7 +124,7 @@ namespace GetADoc
string
[]
dirs
=
Directory
.
GetDirectories
(
sourceDirName
);
string
[]
dirs
=
Directory
.
GetDirectories
(
sourceDirName
);
foreach
(
string
dir
in
dirs
)
foreach
(
string
dir
in
dirs
)
{
{
// コピー元のディレクトリのサブディレクトリで自メソッド(
Copy
Directory)を再帰的に呼び出す
// コピー元のディレクトリのサブディレクトリで自メソッド(
Move
Directory)を再帰的に呼び出す
MoveDirectory
(
dir
,
destDirName
+
Path
.
GetFileName
(
dir
));
MoveDirectory
(
dir
,
destDirName
+
Path
.
GetFileName
(
dir
));
}
}
Directory
.
Delete
(
sourceDirName
,
true
);
// 追加: 最後に元のフォルダを削除する
Directory
.
Delete
(
sourceDirName
,
true
);
// 追加: 最後に元のフォルダを削除する
...
...
Release/GetADocGUI.exe
View file @
7a73afe9
No preview for this file type
Release/GetADocGUI.pdb
View file @
7a73afe9
No preview for this file type
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