From 7723391844994b6e5a005058ee63873d573a53e7 Mon Sep 17 00:00:00 2001 From: zhangt Date: Tue, 11 Feb 2025 17:14:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?new:=E6=96=B0=E5=A2=9E=E5=A4=9A=E7=A7=8D?= =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 10 +- src/EasyTidy.Util/Renamer.cs | 173 +++++++++++++++--- .../TaskOrchestrationViewModel.cs | 16 +- .../ContentDialogs/AddTaskContentDialog.xaml | 44 +++++ 4 files changed, 214 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1a57f3..ce82e85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,8 @@ -# 更新日志 (工作日) +# 更新日志 (元宵节) -- 新增:winget下载方式 感谢@YU-7 -- 优化:优化任务删除逻辑 -- 修复:修复高级规则的结果与实际不符的情况。 -- 修复:更新程序不生效的BUG #77 -- 修复:最小化启动不生效的BUG #78 +- 新增:正则替换跟普通替换重命名方式 +- 新增:重命名规则组合方式,可各种规则自由组合,也可跟自定义前缀进行组合 +- 新增:重命名获取上级目录名称跟获取源文件名称 #79 ## 版本说明 diff --git a/src/EasyTidy.Util/Renamer.cs b/src/EasyTidy.Util/Renamer.cs index 1182389..d0eef49 100644 --- a/src/EasyTidy.Util/Renamer.cs +++ b/src/EasyTidy.Util/Renamer.cs @@ -17,6 +17,10 @@ public partial class Renamer private const string RSTRING_ALPHA_PARAMETER = "rstringalpha"; private const string RSTRING_DIGIT_PARAMETER = "rstringdigit"; private const string RUUIDV4_PARAMETER = "ruuidv4"; + private const string FOLDER_PARAMETER = "source"; + private const string PARENT_PARAMETER = "parent"; + private const string REGEX_PARAMETER = "regex"; + private const string REPLACE_PARAMETER = "replace"; /// /// 解析模板参数 @@ -38,28 +42,11 @@ public static string ParseTemplate(string source, string target) { string[] parameters = match.Groups[1].Value.Split(','); - // 判断不同的模板参数类型并处理 - if (match.Value.Contains(INCREMENT_PARAMETER) || match.Value.Contains("start") || match.Value.Contains("padding") || match.Value.Equals("${}")) - { - return ParseIncrement(parameters); - } - else if (match.Value.Contains(RSTRING_ALNUM_PARAMETER)) - { - return ParseRandom(parameters, "alnum"); - } - else if (match.Value.Contains(RSTRING_ALPHA_PARAMETER)) - { - return ParseRandom(parameters, "alpha"); - } - else if (match.Value.Contains(RSTRING_DIGIT_PARAMETER)) - { - return ParseRandom(parameters, "digit"); - } - else if (match.Value.Contains(RUUIDV4_PARAMETER)) - { - return GenerateUUID(); - } - return match.Value; + // 获取处理方法 + Func templateHandler = GetTemplateHandler(match.Value, source); + + // 执行模板处理 + return templateHandler != null ? templateHandler(parameters) : match.Value; }); // 替换日期模板 @@ -68,6 +55,90 @@ public static string ParseTemplate(string source, string target) return File.Exists(source) ? ReplaceFileName(source, result) : result; } + // 获取模板参数处理方法 + private static Func GetTemplateHandler(string matchValue, string source) + { + if (matchValue.Contains(INCREMENT_PARAMETER) || matchValue.Contains("start") || matchValue.Contains("padding") || matchValue.Equals("${}")) + { + return ParseIncrement; + } + else if (matchValue.Contains(RSTRING_ALNUM_PARAMETER)) + { + return parameters => ParseRandom(parameters, "alnum"); + } + else if (matchValue.Contains(RSTRING_ALPHA_PARAMETER)) + { + return parameters => ParseRandom(parameters, "alpha"); + } + else if (matchValue.Contains(RSTRING_DIGIT_PARAMETER)) + { + return parameters => ParseRandom(parameters, "digit"); + } + else if (matchValue.Contains(RUUIDV4_PARAMETER)) + { + return _ => GenerateUUID(); + } + else if (matchValue.Contains(PARENT_PARAMETER) || matchValue.Contains(FOLDER_PARAMETER)) + { + return _ => GetFolderNameFromSource(source, matchValue); + } + else if (matchValue.Contains(REGEX_PARAMETER)) + { + return parameters => RegexReplaceHandler(parameters, source); + } + else if (matchValue.Contains(REPLACE_PARAMETER)) + { + return parameters => ReplaceHandler(parameters, source); + } + + return null; // 如果没有匹配到处理方法,返回null + } + + /// + /// 根据传入的 source(文件或目录路径)获取目录名称。 + /// 如果 source 是目录,则返回其名称; + /// 如果 source 是文件,则返回文件所在目录的名称; + /// 如果 source 不存在,则返回空字符串。 + /// + /// 文件或目录的完整路径 + /// 目录名称或空字符串 + private static string GetFolderNameFromSource(string source, string matchValue) + { + if (Directory.Exists(source)) + { + // 获取上一级目录名称 + if (matchValue.Contains(PARENT_PARAMETER)) + { + return GetParentFolderName(source); + } + // 其他情况直接返回文件夹名称 + return new DirectoryInfo(source).Name; + } + else if (File.Exists(source) && matchValue.Contains(PARENT_PARAMETER)) + { + // source 为文件,获取其所在目录 + string directory = Path.GetDirectoryName(source); + return !string.IsNullOrEmpty(directory) ? new DirectoryInfo(directory).Name : string.Empty; + } + else if (File.Exists(source) && matchValue.Contains(FOLDER_PARAMETER)) + { + // source 为文件,获取其所在目录 + string fileName = Path.GetFileNameWithoutExtension(source); + return !string.IsNullOrEmpty(fileName) ? fileName : string.Empty; + } + return string.Empty; + } + + private static string GetParentFolderName(string source) + { + if (Directory.Exists(source)) + { + DirectoryInfo parentDirectory = Directory.GetParent(source); + return parentDirectory?.Name ?? string.Empty; + } + return string.Empty; + } + /// /// 使用生成的新文件名替换 source 文件路径中的文件名,并返回完整路径 /// @@ -237,4 +308,62 @@ public static string GenerateUUID() /// [GeneratedRegex(@"\$\{(.*?)\}")] private static partial Regex TemplateRegex(); + + /// + /// 正则替换 + /// + /// 解析的参数 + /// 要修改的源文件或者文件夹名称 + /// + private static string RegexReplaceHandler(string[] parameters, string source) + { + if (parameters.Length < 2) return string.Empty; + + // 路径预处理 + source = File.Exists(source) ? Path.GetFileNameWithoutExtension(source) + : Directory.Exists(source) ? new DirectoryInfo(source).Name + : source; + + string pattern = parameters[0].Replace("regex=", ""); + string replacement = parameters[1] ?? string.Empty; + + return Regex.Replace(source, pattern, replacement, RegexOptions.Compiled); + } + + /// + /// 替换处理 + /// + /// 替换参数 + /// 原名称 + /// + private static string ReplaceHandler(string[] parameters, string source) + { + if (parameters.Length < 2) return string.Empty; + + // 路径预处理 + source = File.Exists(source) ? Path.GetFileNameWithoutExtension(source) + : Directory.Exists(source) ? new DirectoryInfo(source).Name + : source; + + string oldValue = parameters[0].Replace("replace=",""); + string newValue = parameters[1]; + bool caseSensitive = parameters.Length > 2 && bool.TryParse(parameters[2], out bool result) && result; + + StringComparison comparison = caseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; + + return ReplaceWithComparison(source, oldValue, newValue, comparison); + } + + // 自定义字符串替换,支持大小写敏感控制 + private static string ReplaceWithComparison(string input, string oldValue, string newValue, StringComparison comparison) + { + int index = input.IndexOf(oldValue, comparison); + if (index < 0) + { + return input; // 没找到匹配项,返回原始字符串 + } + + return string.Concat(input.AsSpan(0, index), newValue, input.AsSpan(index + oldValue.Length)); + } + } diff --git a/src/EasyTidy/ViewModels/TaskOrchestration/TaskOrchestrationViewModel.cs b/src/EasyTidy/ViewModels/TaskOrchestration/TaskOrchestrationViewModel.cs index 6e95d14..853ea8f 100644 --- a/src/EasyTidy/ViewModels/TaskOrchestration/TaskOrchestrationViewModel.cs +++ b/src/EasyTidy/ViewModels/TaskOrchestration/TaskOrchestrationViewModel.cs @@ -32,6 +32,7 @@ public TaskOrchestrationViewModel(IThemeSelectorService themeSelectorService) DateTimeModel = new ObservableCollection(); CounterModel = new ObservableCollection(); RandomizerModel = new ObservableCollection(); + ReplaceModel = new ObservableCollection(); InitializeRenameModel(); } @@ -96,6 +97,9 @@ public TaskOrchestrationViewModel(IThemeSelectorService themeSelectorService) [ObservableProperty] public ObservableCollection _randomizerModel; + [ObservableProperty] + public ObservableCollection _replaceModel; + [ObservableProperty] private bool _isExecuting = false; @@ -261,7 +265,8 @@ private IEnumerable GetAllPatterns() { return DateTimeModel.Select(x => x.Code) .Concat(CounterModel.Select(x => x.Code)) - .Concat(RandomizerModel.Select(x => x.Code)); + .Concat(RandomizerModel.Select(x => x.Code)) + .Concat(ReplaceModel.Select(x => x.Code)); } // 判断 sourcePath 是否为桌面路径 @@ -951,6 +956,15 @@ private void InitializeRenameModel() RandomizerModel.Add(new PatternSnippetModel("${rstringalpha=13}", "RandomizerCheatSheet_Alpha".GetLocalized())); RandomizerModel.Add(new PatternSnippetModel("${rstringdigit=36}", "RandomizerCheatSheet_Digit".GetLocalized())); RandomizerModel.Add(new PatternSnippetModel("${ruuidv4}", "RandomizerCheatSheet_Uuid".GetLocalized())); + + // 初始化替换方式 + ReplaceModel.Add(new PatternSnippetModel("${source}", "ReplaceCheatSheet_ReplaceSource")); + ReplaceModel.Add(new PatternSnippetModel("${parent}", "ReplaceCheatSheet_ReplaceParent")); + ReplaceModel.Add(new PatternSnippetModel("${replace=old,new,false}", "ReplaceCheatSheet_Replace")); + ReplaceModel.Add(new PatternSnippetModel("${replace=old,new,true}", "ReplaceCheatSheet_ReplaceIgnoreCase")); + ReplaceModel.Add(new PatternSnippetModel("${replace=old,,false}", "ReplaceCheatSheet_ReplaceDelete")); + ReplaceModel.Add(new PatternSnippetModel("${regex=^foo,new}", "ReplaceCheatSheet_ReplaceRegex")); + ReplaceModel.Add(new PatternSnippetModel("${regex=^foo,}", "ReplaceCheatSheet_ReplaceRegexDelete")); } private async Task ClearNotificationAfterDelay(int delayMilliseconds) diff --git a/src/EasyTidy/Views/ContentDialogs/AddTaskContentDialog.xaml b/src/EasyTidy/Views/ContentDialogs/AddTaskContentDialog.xaml index 050e4da..65cf84a 100644 --- a/src/EasyTidy/Views/ContentDialogs/AddTaskContentDialog.xaml +++ b/src/EasyTidy/Views/ContentDialogs/AddTaskContentDialog.xaml @@ -210,6 +210,8 @@ + + @@ -334,6 +336,48 @@ + + + + + + + + + + + + + + + + + From 48b28099307873be6fc7b08cd7f3e4a1941087e1 Mon Sep 17 00:00:00 2001 From: Rick Date: Tue, 11 Feb 2025 21:36:52 +0800 Subject: [PATCH 2/2] build:1.2.1.212 --- CHANGELOG.md | 2 +- src/EasyTidy.Model/AppConfig.cs | 4 +-- src/EasyTidy/EasyTidy.csproj | 2 +- .../MultilingualResources/EasyTidy.fr-FR.xlf | 32 +++++++++++++++++++ .../MultilingualResources/EasyTidy.ja-JP.xlf | 32 +++++++++++++++++++ .../EasyTidy.qps-ploc.xlf | 32 +++++++++++++++++++ .../MultilingualResources/EasyTidy.zh-CN.xlf | 32 +++++++++++++++++++ .../EasyTidy.zh-Hant.xlf | 32 +++++++++++++++++++ .../MultilingualResources/EasyTidy.zh-TW.xlf | 32 +++++++++++++++++++ src/EasyTidy/Strings/en-US/Resources.resw | 24 ++++++++++++++ src/EasyTidy/Strings/fr-FR/Resources.resw | 24 ++++++++++++++ src/EasyTidy/Strings/ja-JP/Resources.resw | 24 ++++++++++++++ src/EasyTidy/Strings/zh-CN/Resources.resw | 24 ++++++++++++++ src/EasyTidy/Strings/zh-Hant/Resources.resw | 24 ++++++++++++++ src/EasyTidy/Strings/zh-TW/Resources.resw | 24 ++++++++++++++ .../TaskOrchestrationViewModel.cs | 14 ++++---- .../ContentDialogs/AddTaskContentDialog.xaml | 2 +- 17 files changed, 348 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce82e85..9ae717d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ ## 更新日志详情 -- **[Full Changelog](https://github.com/SaboZhang/EasyTidy/compare/1.2.0.0120...1.2.1.208)** +- **[Full Changelog](https://github.com/SaboZhang/EasyTidy/compare/1.2.1.208...1.2.2.212)** ## 下载链接 diff --git a/src/EasyTidy.Model/AppConfig.cs b/src/EasyTidy.Model/AppConfig.cs index 5fbea07..2d273bd 100644 --- a/src/EasyTidy.Model/AppConfig.cs +++ b/src/EasyTidy.Model/AppConfig.cs @@ -5,8 +5,8 @@ namespace EasyTidy.Model; public partial class AppConfig : JsonSettings, IVersionable { - [EnforcedVersion("1.2.1.208")] - public virtual Version Version { get; set; } = new Version(1, 2, 1, 208); + [EnforcedVersion("1.2.2.212")] + public virtual Version Version { get; set; } = new Version(1, 2, 2, 212); public override string FileName { get; set; } = Constants.AppConfigPath; diff --git a/src/EasyTidy/EasyTidy.csproj b/src/EasyTidy/EasyTidy.csproj index f8d8df3..b727ee2 100644 --- a/src/EasyTidy/EasyTidy.csproj +++ b/src/EasyTidy/EasyTidy.csproj @@ -12,7 +12,7 @@ win-$(Platform).pubxml true true - 1.2.1.208 + 1.2.2.212 true 10.0.22621.0 10.0.22621.45 diff --git a/src/EasyTidy/MultilingualResources/EasyTidy.fr-FR.xlf b/src/EasyTidy/MultilingualResources/EasyTidy.fr-FR.xlf index f017275..099e21e 100644 --- a/src/EasyTidy/MultilingualResources/EasyTidy.fr-FR.xlf +++ b/src/EasyTidy/MultilingualResources/EasyTidy.fr-FR.xlf @@ -1856,6 +1856,38 @@ Execute on close Exécuter à la fermeture + + source file name + Nom du fichier d'origine + + + Parent directory name + Nom du répertoire parent + + + Replace specified characters case-insensitively + Remplacer indifféremment les caractères spécifiés par des minuscules ou des majuscules + + + Replace specified string with case sensitivity + Remplacer la chaîne spécifiée avec la sensibilité à la casse + + + Replace the specified character with an empty character + Remplacer le caractère spécifié par un caractère vide + + + Replace with specific character by regex + Remplacer par un caractère spécifique par regex + + + Replace the specified characters with spaces using regex + Remplacer les caractères spécifiés par des espaces en utilisant regex + + + Substitute with a regular expression or specified characters + Substituer par une expression régulière ou des caractères spécifiés + diff --git a/src/EasyTidy/MultilingualResources/EasyTidy.ja-JP.xlf b/src/EasyTidy/MultilingualResources/EasyTidy.ja-JP.xlf index d84da26..e094264 100644 --- a/src/EasyTidy/MultilingualResources/EasyTidy.ja-JP.xlf +++ b/src/EasyTidy/MultilingualResources/EasyTidy.ja-JP.xlf @@ -1856,6 +1856,38 @@ Execute on close 閉じると実行する + + source file name + ソースファイル名 + + + Parent directory name + 親ディレクトリ名 + + + Replace specified characters case-insensitively + 指定された文字を大文字小文字に関係なく置き換えます + + + Replace specified string with case sensitivity + 指定した文字列を大文字小文字を区別して置換する + + + Replace the specified character with an empty character + 指定された文字を空文字に置換する + + + Replace with specific character by regex + 正規表現で特定の文字に置き換える + + + Replace the specified characters with spaces using regex + 正規表現を使用して指定された文字をスペースに置き換える + + + Substitute with a regular expression or specified characters + 正規表現または指定された文字で置換します + diff --git a/src/EasyTidy/MultilingualResources/EasyTidy.qps-ploc.xlf b/src/EasyTidy/MultilingualResources/EasyTidy.qps-ploc.xlf index 5bc275f..0bd22bc 100644 --- a/src/EasyTidy/MultilingualResources/EasyTidy.qps-ploc.xlf +++ b/src/EasyTidy/MultilingualResources/EasyTidy.qps-ploc.xlf @@ -1856,6 +1856,38 @@ Execute on close Execute on close + + source file name + source file name + + + Parent directory name + Parent directory name + + + Replace specified characters case-insensitively + Replace specified characters case-insensitively + + + Replace specified string with case sensitivity + Replace specified string with case sensitivity + + + Replace the specified character with an empty character + Replace the specified character with an empty character + + + Replace with specific character by regex + Replace with specific character by regex + + + Replace the specified characters with spaces using regex + Replace the specified characters with spaces using regex + + + Substitute with a regular expression or specified characters + Substitute with a regular expression or specified characters + diff --git a/src/EasyTidy/MultilingualResources/EasyTidy.zh-CN.xlf b/src/EasyTidy/MultilingualResources/EasyTidy.zh-CN.xlf index 9c65409..8f4ce7f 100644 --- a/src/EasyTidy/MultilingualResources/EasyTidy.zh-CN.xlf +++ b/src/EasyTidy/MultilingualResources/EasyTidy.zh-CN.xlf @@ -1856,6 +1856,38 @@ Execute on close 关闭时执行 + + source file name + 源文件名称 + + + Parent directory name + 上级目录名称 + + + Replace specified characters case-insensitively + 替换指定字符串不区分大小写 + + + Replace specified string with case sensitivity + 替换指定字符串区分大小写 + + + Replace the specified character with an empty character + 替换指定字符串为空 + + + Replace with specific character by regex + 使用正则替换为指定字符串 + + + Replace the specified characters with spaces using regex + 使用正则替换为空字符 + + + Substitute with a regular expression or specified characters + 使用正则表达式或者指定字符替换 + diff --git a/src/EasyTidy/MultilingualResources/EasyTidy.zh-Hant.xlf b/src/EasyTidy/MultilingualResources/EasyTidy.zh-Hant.xlf index 3c8f410..d7964ac 100644 --- a/src/EasyTidy/MultilingualResources/EasyTidy.zh-Hant.xlf +++ b/src/EasyTidy/MultilingualResources/EasyTidy.zh-Hant.xlf @@ -1856,6 +1856,38 @@ Execute on close 關閉時執行 + + source file name + 原始檔案名稱 + + + Parent directory name + 上級目錄名稱 + + + Replace specified characters case-insensitively + 取代指定字串不分大小寫 + + + Replace specified string with case sensitivity + 替換指定字串區分大小寫 + + + Replace the specified character with an empty character + 替換指定字串為空 + + + Replace with specific character by regex + 以正規取代為指定字串 + + + Replace the specified characters with spaces using regex + 以正規取代為空字元 + + + Substitute with a regular expression or specified characters + 使用正則表達式或者指定字符替換 + diff --git a/src/EasyTidy/MultilingualResources/EasyTidy.zh-TW.xlf b/src/EasyTidy/MultilingualResources/EasyTidy.zh-TW.xlf index da525cc..e3327fb 100644 --- a/src/EasyTidy/MultilingualResources/EasyTidy.zh-TW.xlf +++ b/src/EasyTidy/MultilingualResources/EasyTidy.zh-TW.xlf @@ -1856,6 +1856,38 @@ Execute on close 關閉時執行 + + source file name + 原始檔案名稱 + + + Parent directory name + 上級目錄名稱 + + + Replace specified characters case-insensitively + 取代指定字串不分大小寫 + + + Replace specified string with case sensitivity + 替換指定字串區分大小寫 + + + Replace the specified character with an empty character + 替換指定字串為空 + + + Replace with specific character by regex + 使用正则替换为指定字符串 + + + Replace the specified characters with spaces using regex + 以正規取代為空字元 + + + Substitute with a regular expression or specified characters + 使用正則表達式或者指定字符替換 + diff --git a/src/EasyTidy/Strings/en-US/Resources.resw b/src/EasyTidy/Strings/en-US/Resources.resw index 1c93d82..08d6b34 100644 --- a/src/EasyTidy/Strings/en-US/Resources.resw +++ b/src/EasyTidy/Strings/en-US/Resources.resw @@ -1494,4 +1494,28 @@ Execute on close + + source file name + + + Parent directory name + + + Replace specified characters case-insensitively + + + Replace specified string with case sensitivity + + + Replace the specified character with an empty character + + + Replace with specific character by regex + + + Replace the specified characters with spaces using regex + + + Substitute with a regular expression or specified characters + \ No newline at end of file diff --git a/src/EasyTidy/Strings/fr-FR/Resources.resw b/src/EasyTidy/Strings/fr-FR/Resources.resw index f75c137..8b04881 100644 --- a/src/EasyTidy/Strings/fr-FR/Resources.resw +++ b/src/EasyTidy/Strings/fr-FR/Resources.resw @@ -1357,4 +1357,28 @@ Exécuter à la fermeture + + Nom du fichier d'origine + + + Nom du répertoire parent + + + Remplacer indifféremment les caractères spécifiés par des minuscules ou des majuscules + + + Remplacer la chaîne spécifiée avec la sensibilité à la casse + + + Remplacer le caractère spécifié par un caractère vide + + + Remplacer par un caractère spécifique par regex + + + Remplacer les caractères spécifiés par des espaces en utilisant regex + + + Substituer par une expression régulière ou des caractères spécifiés + \ No newline at end of file diff --git a/src/EasyTidy/Strings/ja-JP/Resources.resw b/src/EasyTidy/Strings/ja-JP/Resources.resw index 42b2b02..96ff849 100644 --- a/src/EasyTidy/Strings/ja-JP/Resources.resw +++ b/src/EasyTidy/Strings/ja-JP/Resources.resw @@ -1357,4 +1357,28 @@ 閉じると実行する + + ソースファイル名 + + + 親ディレクトリ名 + + + 指定された文字を大文字小文字に関係なく置き換えます + + + 指定した文字列を大文字小文字を区別して置換する + + + 指定された文字を空文字に置換する + + + 正規表現で特定の文字に置き換える + + + 正規表現を使用して指定された文字をスペースに置き換える + + + 正規表現または指定された文字で置換します + \ No newline at end of file diff --git a/src/EasyTidy/Strings/zh-CN/Resources.resw b/src/EasyTidy/Strings/zh-CN/Resources.resw index 1f6156a..38d80e6 100644 --- a/src/EasyTidy/Strings/zh-CN/Resources.resw +++ b/src/EasyTidy/Strings/zh-CN/Resources.resw @@ -1375,4 +1375,28 @@ 关闭时执行 + + 源文件名称 + + + 上级目录名称 + + + 替换指定字符串不区分大小写 + + + 替换指定字符串区分大小写 + + + 替换指定字符串为空 + + + 使用正则替换为指定字符串 + + + 使用正则替换为空字符 + + + 使用正则表达式或者指定字符替换 + \ No newline at end of file diff --git a/src/EasyTidy/Strings/zh-Hant/Resources.resw b/src/EasyTidy/Strings/zh-Hant/Resources.resw index 7068dfa..02d5616 100644 --- a/src/EasyTidy/Strings/zh-Hant/Resources.resw +++ b/src/EasyTidy/Strings/zh-Hant/Resources.resw @@ -1354,4 +1354,28 @@ 關閉時執行 + + 原始檔案名稱 + + + 上級目錄名稱 + + + 取代指定字串不分大小寫 + + + 替換指定字串區分大小寫 + + + 替換指定字串為空 + + + 以正規取代為指定字串 + + + 以正規取代為空字元 + + + 使用正則表達式或者指定字符替換 + \ No newline at end of file diff --git a/src/EasyTidy/Strings/zh-TW/Resources.resw b/src/EasyTidy/Strings/zh-TW/Resources.resw index 33a1545..1019507 100644 --- a/src/EasyTidy/Strings/zh-TW/Resources.resw +++ b/src/EasyTidy/Strings/zh-TW/Resources.resw @@ -1354,4 +1354,28 @@ 關閉時執行 + + 原始檔案名稱 + + + 上級目錄名稱 + + + 取代指定字串不分大小寫 + + + 替換指定字串區分大小寫 + + + 替換指定字串為空 + + + 使用正则替换为指定字符串 + + + 以正規取代為空字元 + + + 使用正則表達式或者指定字符替換 + \ No newline at end of file diff --git a/src/EasyTidy/ViewModels/TaskOrchestration/TaskOrchestrationViewModel.cs b/src/EasyTidy/ViewModels/TaskOrchestration/TaskOrchestrationViewModel.cs index 853ea8f..0d08573 100644 --- a/src/EasyTidy/ViewModels/TaskOrchestration/TaskOrchestrationViewModel.cs +++ b/src/EasyTidy/ViewModels/TaskOrchestration/TaskOrchestrationViewModel.cs @@ -958,13 +958,13 @@ private void InitializeRenameModel() RandomizerModel.Add(new PatternSnippetModel("${ruuidv4}", "RandomizerCheatSheet_Uuid".GetLocalized())); // 初始化替换方式 - ReplaceModel.Add(new PatternSnippetModel("${source}", "ReplaceCheatSheet_ReplaceSource")); - ReplaceModel.Add(new PatternSnippetModel("${parent}", "ReplaceCheatSheet_ReplaceParent")); - ReplaceModel.Add(new PatternSnippetModel("${replace=old,new,false}", "ReplaceCheatSheet_Replace")); - ReplaceModel.Add(new PatternSnippetModel("${replace=old,new,true}", "ReplaceCheatSheet_ReplaceIgnoreCase")); - ReplaceModel.Add(new PatternSnippetModel("${replace=old,,false}", "ReplaceCheatSheet_ReplaceDelete")); - ReplaceModel.Add(new PatternSnippetModel("${regex=^foo,new}", "ReplaceCheatSheet_ReplaceRegex")); - ReplaceModel.Add(new PatternSnippetModel("${regex=^foo,}", "ReplaceCheatSheet_ReplaceRegexDelete")); + ReplaceModel.Add(new PatternSnippetModel("${source}", "ReplaceCheatSheet_ReplaceSource".GetLocalized())); + ReplaceModel.Add(new PatternSnippetModel("${parent}", "ReplaceCheatSheet_ReplaceParent".GetLocalized())); + ReplaceModel.Add(new PatternSnippetModel("${replace=old,new,false}", "ReplaceCheatSheet_Replace".GetLocalized())); + ReplaceModel.Add(new PatternSnippetModel("${replace=old,new,true}", "ReplaceCheatSheet_ReplaceIgnoreCase".GetLocalized())); + ReplaceModel.Add(new PatternSnippetModel("${replace=old,,false}", "ReplaceCheatSheet_ReplaceDelete".GetLocalized())); + ReplaceModel.Add(new PatternSnippetModel("${regex=^foo,new}", "ReplaceCheatSheet_ReplaceRegex".GetLocalized())); + ReplaceModel.Add(new PatternSnippetModel("${regex=^foo,}", "ReplaceCheatSheet_ReplaceRegexDelete".GetLocalized())); } private async Task ClearNotificationAfterDelay(int delayMilliseconds) diff --git a/src/EasyTidy/Views/ContentDialogs/AddTaskContentDialog.xaml b/src/EasyTidy/Views/ContentDialogs/AddTaskContentDialog.xaml index 65cf84a..f0cee65 100644 --- a/src/EasyTidy/Views/ContentDialogs/AddTaskContentDialog.xaml +++ b/src/EasyTidy/Views/ContentDialogs/AddTaskContentDialog.xaml @@ -338,7 +338,7 @@