From 67012275ece21fef9af24f25339b81ba633df4dd Mon Sep 17 00:00:00 2001 From: tsuji Date: Tue, 14 Dec 2021 10:13:34 +0900 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E3=81=98=E3=83=87=E3=82=A3=E3=83=AC?= =?UTF-8?q?=E3=82=AF=E3=83=88=E3=83=AA=E3=81=A7=EF=BC=92=E5=9B=9E=E7=9B=AE?= =?UTF-8?q?=E3=82=92=E5=AE=9F=E8=A1=8C=E3=81=99=E3=82=8B=E3=81=A8Image?= =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AB=E3=83=80=E3=81=8C=E5=88=9D=E6=9C=9F?= =?UTF-8?q?=E5=8C=96=E3=81=95=E3=82=8C=E3=82=8B=E4=B8=8D=E5=85=B7=E5=90=88?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GetADoc/MainWindow.xaml.cs | 2 +- GetADoc/RunBatch.cs | 42 +++++++------------------------------- 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/GetADoc/MainWindow.xaml.cs b/GetADoc/MainWindow.xaml.cs index 27b8f1f..b75d8ff 100644 --- a/GetADoc/MainWindow.xaml.cs +++ b/GetADoc/MainWindow.xaml.cs @@ -148,7 +148,7 @@ namespace GetADoc MessageBoxButton.YesNo, MessageBoxImage.None); if (OverwriteADoc == MessageBoxResult.Yes) { - RunBatch.deleteFolder(filePath, fileName, IconFlag, SepaFlag); + } else if (OverwriteADoc == MessageBoxResult.No) { diff --git a/GetADoc/RunBatch.cs b/GetADoc/RunBatch.cs index 0c0c2b4..e695441 100644 --- a/GetADoc/RunBatch.cs +++ b/GetADoc/RunBatch.cs @@ -22,38 +22,10 @@ namespace GetADoc return inFileName; } - //先に同名フォルダが存在すれば削除(エラー回避のため) - public static void deleteFolder(string filePath, string fileName, bool icon, bool sepa) - { - File.Delete(filePath + fileName + ".adoc"); - File.Delete(System.IO.Path.Combine(filePath, "config.adoc")); - if(sepa == true) - { - File.Delete(System.IO.Path.Combine(filePath, "IncDoc.adoc")); - } - if (Directory.Exists(System.IO.Path.Combine(filePath, "Images"))) - { - Directory.Delete(System.IO.Path.Combine(filePath, "Images"), true); - } - if (Directory.Exists(System.IO.Path.Combine(filePath, "icons")) && icon == true) - { - Directory.Delete(System.IO.Path.Combine(filePath, "icons"), true); - } - if (Directory.Exists(System.IO.Path.Combine(filePath, "Sub_First")) && sepa == true) - { - Directory.Delete(System.IO.Path.Combine(filePath, "Sub_First"), true); - } - if (Directory.Exists(System.IO.Path.Combine(filePath, "Sub_Second")) && sepa == true) - { - Directory.Delete(System.IO.Path.Combine(filePath, "Sub_Second"), true); - } - } - //バッチファイルの実行 public static void runBatch(bool icon, bool screen, bool sepa, string fileName, string filePath) { - //テンポラリフォルダの作成 - var tempPath = TemporaryFolder.MakeTempFolder(); + //コンソール呼び出し ProcessStartInfo processStartInfo = new ProcessStartInfo(); @@ -77,7 +49,11 @@ namespace GetADoc { processStartInfo.Arguments += "/SepaDoc "; } - var pathAndName = System.IO.Path.Combine(tempPath, fileName); + + //既存の生成物が指定先フォルダに存在する場合は上書きする + processStartInfo.Arguments += "/Force "; + + var pathAndName = System.IO.Path.Combine(filePath, fileName); processStartInfo.Arguments += pathAndName; //GetADoc.batを実行 @@ -85,11 +61,7 @@ namespace GetADoc process.WaitForExit(); process.Close(); - //指定されたフォルダに生成物を移動 - RunBatch.MoveDirectory(tempPath, filePath); - - //テンポラリフォルダの消去 - TemporaryFolder.DeleteTempFolder(tempPath); + } /// -- 2.22.0