From 7168901befe11ba0d600253e497e0bf2b8b80667 Mon Sep 17 00:00:00 2001 From: nsnail Date: Thu, 1 Dec 2022 15:55:14 +0800 Subject: [PATCH] =?UTF-8?q?=20=E5=A4=9A=E8=AF=AD=E8=A8=80=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code-format.cmd | 6 +- src/Convert2Lf/Option.cs | 4 - src/DirOption.cs | 6 +- src/Lang/Strings.Designer.cs | 47 +++++++--- src/Lang/Strings.en-US.resx | 86 +++++++++++++++++++ src/Lang/Strings.resx | 13 ++- src/RemoveTrailingWhiteSpace/Option.cs | 4 - .../Main.cs | 23 +++-- src/RmBlank/Option.cs | 4 + src/{TrimUtf8Bom => RmBom}/Main.cs | 20 ++++- src/RmBom/Option.cs | 4 + src/Text/Main.cs | 4 + src/Text/Option.cs | 2 +- src/{Convert2Lf => ToLf}/Main.cs | 21 ++++- src/ToLf/Option.cs | 4 + src/Tool.cs | 20 +++-- src/ToolsFactory.cs | 16 ++-- src/TrimUtf8Bom/Option.cs | 4 - src/dot.csproj | 2 +- 19 files changed, 231 insertions(+), 59 deletions(-) delete mode 100644 src/Convert2Lf/Option.cs create mode 100644 src/Lang/Strings.en-US.resx delete mode 100644 src/RemoveTrailingWhiteSpace/Option.cs rename src/{RemoveTrailingWhiteSpace => RmBlank}/Main.cs (82%) create mode 100644 src/RmBlank/Option.cs rename src/{TrimUtf8Bom => RmBom}/Main.cs (83%) create mode 100644 src/RmBom/Option.cs rename src/{Convert2Lf => ToLf}/Main.cs (86%) create mode 100644 src/ToLf/Option.cs delete mode 100644 src/TrimUtf8Bom/Option.cs diff --git a/code-format.cmd b/code-format.cmd index 82c9512..253fbb5 100644 --- a/code-format.cmd +++ b/code-format.cmd @@ -1,3 +1,3 @@ -dot trim-utf8-bom -dot remove-whitespace -dot convert-lf \ No newline at end of file +dot rm-bom +dot rm-blank +dot tolf \ No newline at end of file diff --git a/src/Convert2Lf/Option.cs b/src/Convert2Lf/Option.cs deleted file mode 100644 index 7f3384d..0000000 --- a/src/Convert2Lf/Option.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace Dot.Convert2Lf; - -[Verb("convert-lf", HelpText = nameof(Strings.ConvertEndOfLineToLF), ResourceType = typeof(Strings))] -public class Option : DirOption { } \ No newline at end of file diff --git a/src/DirOption.cs b/src/DirOption.cs index 62c3017..a86564a 100644 --- a/src/DirOption.cs +++ b/src/DirOption.cs @@ -2,10 +2,14 @@ namespace Dot; public class DirOption : IOption { - [Option('f', "filter", Required = false, HelpText = nameof(Strings.FileSearchPattern), Default = "*.*" + [Option('f', "filter", HelpText = nameof(Strings.FileSearchPattern), Default = "*.*" , ResourceType = typeof(Strings))] public string Filter { get; set; } [Value(0, HelpText = nameof(Strings.FolderPath), Default = ".", ResourceType = typeof(Strings))] public string Path { get; set; } + + + [Option('r', "readonly", HelpText = nameof(Strings.ReadOnly), Default = false, ResourceType = typeof(Strings))] + public bool ReadOnly { get; set; } } \ No newline at end of file diff --git a/src/Lang/Strings.Designer.cs b/src/Lang/Strings.Designer.cs index 2a141ff..b053a6d 100644 --- a/src/Lang/Strings.Designer.cs +++ b/src/Lang/Strings.Designer.cs @@ -113,15 +113,6 @@ namespace Dot.Lang { } } - /// - /// Looks up a localized string similar to 要处理的文本(默认取取剪贴板值). - /// - public static string HelpForTextArg0 { - get { - return ResourceManager.GetString("HelpForTextArg0", resourceCulture); - } - } - /// /// Looks up a localized string similar to 输入文本为空. /// @@ -131,6 +122,15 @@ namespace Dot.Lang { } } + /// + /// Looks up a localized string similar to 没有需要处理的文件. + /// + public static string NoFileToBeProcessed { + get { + return ResourceManager.GetString("NoFileToBeProcessed", resourceCulture); + } + } + /// /// Looks up a localized string similar to 指定的路径“{0}”不存在. /// @@ -140,6 +140,15 @@ namespace Dot.Lang { } } + /// + /// Looks up a localized string similar to 按下任意键继续.... + /// + public static string PressAnyKey { + get { + return ResourceManager.GetString("PressAnyKey", resourceCulture); + } + } + /// /// Looks up a localized string similar to BitSet 1:[0-9],2:[a-z],4:[A-Z],8:[ascii.0x21-0x2F]. /// @@ -167,6 +176,15 @@ namespace Dot.Lang { } } + /// + /// Looks up a localized string similar to 只读模式(仅做测试,不实际修改). + /// + public static string ReadOnly { + get { + return ResourceManager.GetString("ReadOnly", resourceCulture); + } + } + /// /// Looks up a localized string similar to 移除文件尾部换行和空格. /// @@ -186,7 +204,7 @@ namespace Dot.Lang { } /// - /// Looks up a localized string similar to 查找文件...OK. + /// Looks up a localized string similar to {0} 个文件. /// public static string SearchingFileOK { get { @@ -203,6 +221,15 @@ namespace Dot.Lang { } } + /// + /// Looks up a localized string similar to 要处理的文本(默认取取剪贴板值). + /// + public static string TextTobeProcessed { + get { + return ResourceManager.GetString("TextTobeProcessed", resourceCulture); + } + } + /// /// Looks up a localized string similar to 移除文件的uf8 bom. /// diff --git a/src/Lang/Strings.en-US.resx b/src/Lang/Strings.en-US.resx new file mode 100644 index 0000000..d9d42b0 --- /dev/null +++ b/src/Lang/Strings.en-US.resx @@ -0,0 +1,86 @@ + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + The input text is empty + + + Find files... + + + The specified path "{0}" does not exist + + + Find files...OK + + + Read: {0}/{1}, processed: {2}, skipped: {3} + + + Text encoding tool + + + {0}(copied to clipboard) + + + File wildcards + + + Directory path to be processed + + + Convert newline characters to LF + + + GUID tool + + + Use uppercase output + + + Random password generator + + + Password length + + + BitSet 1:[0-9],2:[a-z],4:[A-Z],8:[ascii.0x21-0x2F] + + + Remove line breaks and spaces at the end of the file + + + Remove the uf8 bom of the file + + + Text to be processed (clipboard value is taken by default) + + + Press any key to continue... + + + Read-only mode (only for testing, no actual modification) + + + No documents to be processed + + \ No newline at end of file diff --git a/src/Lang/Strings.resx b/src/Lang/Strings.resx index 7dc2879..49467fb 100644 --- a/src/Lang/Strings.resx +++ b/src/Lang/Strings.resx @@ -34,7 +34,7 @@ 指定的路径“{0}”不存在 - 查找文件...OK + {0} 个文件 已读取:{0}/{1},处理:{2},跳过:{3} @@ -42,7 +42,7 @@ 文本编码工具 - + 要处理的文本(默认取取剪贴板值) @@ -82,4 +82,13 @@ 移除文件的uf8 bom + + 按下任意键继续... + + + 只读模式(仅做测试,不实际修改) + + + 没有需要处理的文件 + \ No newline at end of file diff --git a/src/RemoveTrailingWhiteSpace/Option.cs b/src/RemoveTrailingWhiteSpace/Option.cs deleted file mode 100644 index 4a4ee03..0000000 --- a/src/RemoveTrailingWhiteSpace/Option.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace Dot.RemoveTrailingWhiteSpace; - -[Verb("remove-whitespace", HelpText = nameof(Strings.RemoveTrailingWhiteSpaces), ResourceType = typeof(Strings))] -public class Option : DirOption { } \ No newline at end of file diff --git a/src/RemoveTrailingWhiteSpace/Main.cs b/src/RmBlank/Main.cs similarity index 82% rename from src/RemoveTrailingWhiteSpace/Main.cs rename to src/RmBlank/Main.cs index becca13..d1af5bc 100644 --- a/src/RemoveTrailingWhiteSpace/Main.cs +++ b/src/RmBlank/Main.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; using NSExt.Extensions; -namespace Dot.RemoveTrailingWhiteSpace; +namespace Dot.RmBlank; public sealed class Main : Tool