Commit 04535f2d authored by tsuji's avatar tsuji

ファイル重複時のフリーズ等を修正

parent a3468ff8
......@@ -116,11 +116,48 @@ namespace GetADoc
{
fileName = fileName.Replace(allNg, string.Empty);
}
MessageBox.Show("ファイル名に使用できない文字が存在したため\n一部ファイル名を修正しました。\nもう一度作成ボタンをクリックしてください。", "Renamed this file", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show("ファイル名に使用できない文字が存在したため\n一部ファイル名を修正しました。" +
"\nもう一度作成ボタンをクリックしてください。", "Renamed this file", MessageBoxButton.OK, MessageBoxImage.Warning);
box2.Text = fileName;
return;
}
//指定したフォルダに同名の.adocや既存の付属ファイル(config.adocなど)がある場合の処理
if (File.Exists(System.IO.Path.Combine(filePath, fileName + ".adoc")) || File.Exists(System.IO.Path.Combine(filePath, "config.adoc")))
{
MessageBoxResult OverwriteADoc = MessageBox.Show("これから生成するファイルと同名のファイルが既に存在します" +
"\n既存のファイルを上書きしますか?",
"指定したフォルダに既存のファイルが存在します",
MessageBoxButton.YesNo);
if (OverwriteADoc == MessageBoxResult.Yes)
{
File.Delete(filePath + fileName + ".adoc");
File.Delete(System.IO.Path.Combine(filePath, "config.adoc"));
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")))
{
Directory.Delete(System.IO.Path.Combine(filePath, "icons"), true);
}
if (Directory.Exists(System.IO.Path.Combine(filePath, "Sub_First")))
{
Directory.Delete(System.IO.Path.Combine(filePath, "Sub_First"), true);
}
if (Directory.Exists(System.IO.Path.Combine(filePath, "Sub_Second")))
{
Directory.Delete(System.IO.Path.Combine(filePath, "Sub_Second"), true);
}
}
else if(OverwriteADoc == MessageBoxResult.No)
{
MessageBox.Show("別のフォルダを指定してください");
return;
}
}
//バッチファイルの実行
ProcessStartInfo processStartInfo = new ProcessStartInfo();
string stCurrentDir = System.IO.Directory.GetCurrentDirectory();
......@@ -151,7 +188,7 @@ namespace GetADoc
//指定されたフォルダに生成物を移動
File.Move(System.IO.Path.Combine(stCurrentDir, fileName + ".adoc"), filePath + fileName + ".adoc");
File.Move(System.IO.Path.Combine(stCurrentDir, "config.adoc"), filePath + "/config.adoc");
File.Move(System.IO.Path.Combine(stCurrentDir, "config.adoc"), System.IO.Path.Combine(filePath, "config.adoc"));
Directory.Move(System.IO.Path.Combine(stCurrentDir, "Images"), System.IO.Path.Combine(filePath, "Images"));
if (checkbox2.IsChecked == true)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment