Commit b62febbc authored by AP matsuo koji's avatar AP matsuo koji 😲

Ver3.0.2

* native
* date Folder
* 上書き時の連番
parent 3a849104
......@@ -38,6 +38,7 @@ image:V300UI.png[]
[cols="a,a,a", options="header, autowidth"]
|===
| Version | 日付 | 内容
| Ver3.0.2 | 2026/04/20 | Nativeフォーマット追加、日付フォルダ作成を追加
| Ver3.0.1 | 2026/01/25-03/19| 微修正
| Ver3.0.0 | 2024/11/28|GUI更新、drawio作成、ヘルプページOPEN追加
| Ver2.0.0 | 2023/9/13 |GUI更新、雛形フォーマット追加
......@@ -48,6 +49,12 @@ image:V300UI.png[]
|===
== Detail
=== Ver 3.0.2
* Nativeフォーマット追加、config.adoc不要のシンプルなもの
* 日付フォルダ作成オプション追加
=== Ver 3.0.1
* doctypeをbookからarticleに初期値を変更
......
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -48,6 +48,9 @@ namespace GetADoc
// //RightClickCheckbox.Visibility = Visibility.Collapsed; //チェックボックスがONになっていれば非表示(過去に右クリック登録済み)
//}
ToggleButton.IsOn = Properties.Settings.Default.languageSetting;
FolderDatePicker.SelectedDate = DateTime.Today;
DateFolderNameBox.Text = "";
SetDateFolderOptionState();
//Pathの初期設定(引数指定で起動していれば引数のpath、指定していなければ前回の値)
string[] argPathBox = Environment.GetCommandLineArgs();
......@@ -117,6 +120,84 @@ namespace GetADoc
ADocNameBox.Focus();
}
private void DateFolderOptionChanged(object sender, RoutedEventArgs e)
{
DeleteCompLabel(sender, e);
SetDateFolderOptionState();
}
private void SetDateFolderOptionState()
{
bool isEnabled = DateFolderCheckbox.IsChecked == true;
if (FolderDatePicker != null)
{
FolderDatePicker.IsEnabled = isEnabled;
}
if (DateFolderNameBox != null)
{
DateFolderNameBox.IsEnabled = isEnabled;
}
}
private string GetOutputFolderPath(string baseFolderPath)
{
if (DateFolderCheckbox.IsChecked != true)
{
return baseFolderPath + @"\";
}
if (!FolderDatePicker.SelectedDate.HasValue)
{
string errMsg = "日付を指定してください";
if (ToggleButton.IsOn)
{
errMsg = "Please select a date.";
}
CustomMsgBox.Show(mainWindow, errMsg, "Date", MessageBoxButton.OK, MessageBoxImage.Warning);
return null;
}
string folderName = DateFolderNameBox.Text == null ? string.Empty : DateFolderNameBox.Text.Trim();
char[] invalidFolderChars = System.IO.Path.GetInvalidFileNameChars();
if (folderName.IndexOfAny(invalidFolderChars) >= 0)
{
folderName = new string(folderName.Where(c => invalidFolderChars.Contains(c) == false).ToArray());
string errMsg = "フォルダ名に使用できない文字が存在したため\n一部フォルダ名を修正しました。\nもう一度作成ボタンをクリックしてください。";
if (ToggleButton.IsOn)
{
errMsg = "Some folder names have been modified because they contained invalid characters. Please click the Create button again.";
}
CustomMsgBox.Show(mainWindow, errMsg, "Renamed this folder", MessageBoxButton.OK, MessageBoxImage.Warning);
DateFolderNameBox.Text = folderName;
return null;
}
string dateFolderName = FolderDatePicker.SelectedDate.Value.ToString("yyyyMMdd");
if (folderName != string.Empty)
{
dateFolderName += "_" + folderName;
}
return System.IO.Path.Combine(baseFolderPath, dateFolderName) + @"\";
}
private string GetSequentialFileName(string filePath, string fileName)
{
string sequentialFileName = fileName;
int index = 1;
while (File.Exists(System.IO.Path.Combine(filePath, sequentialFileName + ".adoc")))
{
sequentialFileName = fileName + "_" + index;
index++;
}
return sequentialFileName;
}
//保存Pathのチェックボックスをクリックする(ONにする)と登録したPahtをTextBoxに表示  //2024/12/27 保存Path廃止
//private void MyPathClick(object sender, RoutedEventArgs e)
//{
......@@ -257,7 +338,11 @@ namespace GetADoc
fileName = "t";
}
//テキストボック1から保存場所を取得
var filePath = FolderPathBox.Text + @"\";
var filePath = GetOutputFolderPath(FolderPathBox.Text);
if (filePath == null)
{
return;
}
// ファイル名に使用不可の文字が含まれている場合の処理
char[] NgChars = System.IO.Path.GetInvalidFileNameChars();
......@@ -277,8 +362,16 @@ namespace GetADoc
return;
}
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
fileName = GetSequentialFileName(filePath, fileName);
ADocNameBox.Text = fileName;
//指定したフォルダに同名の.adocや既存の付属ファイル(config.adocなど)がある場合の処理
if (File.Exists(System.IO.Path.Combine(filePath, fileName + ".adoc")) || File.Exists(System.IO.Path.Combine(filePath, "config.adoc"))
if (File.Exists(System.IO.Path.Combine(filePath, "config.adoc"))
|| Directory.Exists(System.IO.Path.Combine(filePath, "Images")) || Directory.Exists(System.IO.Path.Combine(filePath, "icons"))
|| Directory.Exists(System.IO.Path.Combine(filePath, "Sub_First")) || Directory.Exists(System.IO.Path.Combine(filePath, "Sub_Second")))
{
......@@ -412,6 +505,9 @@ namespace GetADoc
label2.Content = "ドキュメント名:";
label4.Content = "オプション:";
label5.Content = "文書フォーマット:";
DateFolderCheckbox.Content = "日付フォルダ作成";
//label7.Content = "日付:";
//label8.Content = "フォルダ名:";
CompletedLabel.Content = "作成が完了しました!";
......@@ -453,6 +549,9 @@ namespace GetADoc
label2.Content = "File Name";
label4.Content = "Oputions";
label5.Content = "Format";
DateFolderCheckbox.Content = "Create dated folder";
//label7.Content = "Date:";
//label8.Content = "Folder Name:";
CompletedLabel.Content = "Completed!";
......
......@@ -51,5 +51,5 @@ using System.Windows;
// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.0.1")]
[assembly: AssemblyFileVersion("3.0.0.1")]
[assembly: AssemblyVersion("3.0.0.2")]
[assembly: AssemblyFileVersion("3.0.0.2")]
......@@ -25,8 +25,6 @@ namespace GetADoc
//バッチファイルの実行
public static void runBatch(bool icon, bool screen, bool sepa, bool free, bool language, bool drawio, string fileName, string filePath, string tempType)
{
//コンソール呼び出し
ProcessStartInfo processStartInfo = new ProcessStartInfo();
string appPath = System.Reflection.Assembly.GetExecutingAssembly().Location; //モジュールのパスを取得
......@@ -87,7 +85,7 @@ namespace GetADoc
}
else if (tempType == "Native")
{
processStartInfo.Arguments += "/Templete Native ";
processStartInfo.Arguments += "/Template Native ";
}
else
{
......@@ -96,7 +94,7 @@ namespace GetADoc
//既存の生成物が指定先フォルダに存在する場合は上書きする
processStartInfo.Arguments += "/Force ";
var pathAndName = System.IO.Path.Combine(filePath, fileName);
pathAndName = "\"" + pathAndName + "\"";
processStartInfo.Arguments += pathAndName;
......@@ -105,8 +103,6 @@ namespace GetADoc
Process process = Process.Start(processStartInfo);
process.WaitForExit();
process.Close();
}
/// <summary>
......
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