From d6fd2b0f9a50159592fed3868da49859fc67178d Mon Sep 17 00:00:00 2001 From: nsnail Date: Wed, 30 Nov 2022 16:48:40 +0800 Subject: [PATCH] 1.0.1 (#1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 1.0.0 * v1.0.1 + guid工具 * 随机数bug --- .gitattributes | 63 ++++++++++++++ .gitignore | 23 +++++ .tgitconfig | 4 + Directory.Build.props | 7 ++ README.md | 2 +- build.ps1 | 3 + code-format.cmd | 3 + dot.sln | 22 +++++ dot.sln.DotSettings | 45 ++++++++++ git-clean.ps1 | 1 + src/.editorconfig | 41 +++++++++ src/Convert2Lf/Main.cs | 113 +++++++++++++++++++++++++ src/Convert2Lf/Option.cs | 11 +++ src/GlobalUsings.cs | 2 + src/Guid/Main.cs | 17 ++++ src/Guid/Option.cs | 8 ++ src/IOption.cs | 3 + src/ITool.cs | 6 ++ src/Program.cs | 32 +++++++ src/Random/Main.cs | 66 +++++++++++++++ src/Random/Option.cs | 21 +++++ src/RemoveTrailingWhiteSpace/Main.cs | 103 ++++++++++++++++++++++ src/RemoveTrailingWhiteSpace/Option.cs | 11 +++ src/Text/Main.cs | 106 +++++++++++++++++++++++ src/Text/Option.cs | 8 ++ src/Tool.cs | 62 ++++++++++++++ src/ToolsFactory.cs | 19 +++++ src/TrimUtf8Bom/Main.cs | 90 ++++++++++++++++++++ src/TrimUtf8Bom/Option.cs | 11 +++ src/dot.csproj | 32 +++++++ 30 files changed, 934 insertions(+), 1 deletion(-) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .tgitconfig create mode 100644 Directory.Build.props create mode 100644 build.ps1 create mode 100644 code-format.cmd create mode 100644 dot.sln create mode 100644 dot.sln.DotSettings create mode 100644 git-clean.ps1 create mode 100644 src/.editorconfig create mode 100644 src/Convert2Lf/Main.cs create mode 100644 src/Convert2Lf/Option.cs create mode 100644 src/GlobalUsings.cs create mode 100644 src/Guid/Main.cs create mode 100644 src/Guid/Option.cs create mode 100644 src/IOption.cs create mode 100644 src/ITool.cs create mode 100644 src/Program.cs create mode 100644 src/Random/Main.cs create mode 100644 src/Random/Option.cs create mode 100644 src/RemoveTrailingWhiteSpace/Main.cs create mode 100644 src/RemoveTrailingWhiteSpace/Option.cs create mode 100644 src/Text/Main.cs create mode 100644 src/Text/Option.cs create mode 100644 src/Tool.cs create mode 100644 src/ToolsFactory.cs create mode 100644 src/TrimUtf8Bom/Main.cs create mode 100644 src/TrimUtf8Bom/Option.cs create mode 100644 src/dot.csproj diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a1e1e97 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..03eec4a --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +build +bin +obj +packages +Migrations +_gsdata_ +_ReSharper* +TestResults +app_data +nuget.config +*.suo +*.user +*.log +*.pubxml +*.publish.xml +.svn +.vs +*.dbmdl +*.jfm +*.exe +.idea +node_modules +dist \ No newline at end of file diff --git a/.tgitconfig b/.tgitconfig new file mode 100644 index 0000000..c98b9ad --- /dev/null +++ b/.tgitconfig @@ -0,0 +1,4 @@ +[hook "startcommit"] + cmdline = code-format.cmd + wait = true + show = true \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..371971c --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,7 @@ + + + ../build/temp/bin + ../build/temp/obj + ../build/temp/obj + + \ No newline at end of file diff --git a/README.md b/README.md index 48d3148..0c85949 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # dot -功能全面的实用工具-程序员的瑞士军刀 +功能全面的实用工具-程序员的瑞士军刀 \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..58318bd --- /dev/null +++ b/build.ps1 @@ -0,0 +1,3 @@ +dotnet build +dotnet publish -c Release -r win-x64 --sc -p:PublishSingleFile=true -o ./build/win-x64 +rm -r ./build/temp \ No newline at end of file diff --git a/code-format.cmd b/code-format.cmd new file mode 100644 index 0000000..82c9512 --- /dev/null +++ b/code-format.cmd @@ -0,0 +1,3 @@ +dot trim-utf8-bom +dot remove-whitespace +dot convert-lf \ No newline at end of file diff --git a/dot.sln b/dot.sln new file mode 100644 index 0000000..d27bc7f --- /dev/null +++ b/dot.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dot", "src\dot.csproj", "{E7608D54-4A3B-4B4B-ADA0-7852987CA21F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E7608D54-4A3B-4B4B-ADA0-7852987CA21F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E7608D54-4A3B-4B4B-ADA0-7852987CA21F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E7608D54-4A3B-4B4B-ADA0-7852987CA21F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E7608D54-4A3B-4B4B-ADA0-7852987CA21F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/dot.sln.DotSettings b/dot.sln.DotSettings new file mode 100644 index 0000000..f7cba85 --- /dev/null +++ b/dot.sln.DotSettings @@ -0,0 +1,45 @@ + + <?xml version="1.0" encoding="utf-16"?> +<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> + <TypePattern> + <Entry> + <Entry.SortBy> + <Kind> + <Kind.Order> + <DeclarationKind>Interface</DeclarationKind> + <DeclarationKind>Class</DeclarationKind> + <DeclarationKind>Enum</DeclarationKind> + <DeclarationKind>Struct</DeclarationKind> + <DeclarationKind>Delegate</DeclarationKind> + <DeclarationKind>Event</DeclarationKind> + <DeclarationKind>Constant</DeclarationKind> + <DeclarationKind>Field</DeclarationKind> + <DeclarationKind>Property</DeclarationKind> + <DeclarationKind>Constructor</DeclarationKind> + <DeclarationKind>Destructor</DeclarationKind> + <DeclarationKind>Indexer</DeclarationKind> + <DeclarationKind>Method</DeclarationKind> + </Kind.Order> + </Kind> + <Access> + <Access.Order> + <AccessModifier>Private</AccessModifier> + <AccessModifier>PrivateProtected</AccessModifier> + <AccessModifier>Protected</AccessModifier> + <AccessModifier>ProtectedInternal</AccessModifier> + <AccessModifier>Internal</AccessModifier> + <AccessModifier>Public</AccessModifier> + </Access.Order> + </Access> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> +</Patterns> + <Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /> + <Policy Inspect="True" Prefix="_" Suffix="" Style="AA_BB" /> + <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + False + HINT + \ No newline at end of file diff --git a/git-clean.ps1 b/git-clean.ps1 new file mode 100644 index 0000000..5f7b39a --- /dev/null +++ b/git-clean.ps1 @@ -0,0 +1 @@ +git reset --hard | git clean -d -fx . \ No newline at end of file diff --git a/src/.editorconfig b/src/.editorconfig new file mode 100644 index 0000000..9b11293 --- /dev/null +++ b/src/.editorconfig @@ -0,0 +1,41 @@ +[*] +indent_style = space +indent_size = 4 +tab_width = 4 + + +# ReSharper properties +resharper_align_linq_query = true +resharper_align_multiline_argument = true +resharper_align_multiline_array_and_object_initializer = true +resharper_align_multiline_binary_patterns = true +resharper_align_multiline_calls_chain = true +resharper_align_multiline_extends_list = true +resharper_align_multiline_parameter = true +resharper_align_multiline_property_pattern = true +resharper_align_multiline_switch_expression = true +resharper_align_multiple_declaration = true +resharper_align_multline_type_parameter_constrains = true +resharper_align_multline_type_parameter_list = true +resharper_align_tuple_components = true +resharper_allow_comment_after_lbrace = true +resharper_csharp_empty_block_style = together_same_line +resharper_csharp_outdent_commas = true +resharper_csharp_stick_comment = false +resharper_csharp_wrap_before_comma = true +resharper_indent_nested_foreach_stmt = true +resharper_indent_nested_for_stmt = true +resharper_indent_nested_while_stmt = true +resharper_indent_preprocessor_if = usual_indent +resharper_indent_preprocessor_other = usual_indent +resharper_int_align = true +resharper_keep_existing_arrangement = false +resharper_place_linq_into_on_new_line = false +resharper_place_simple_switch_expression_on_single_line = true +resharper_wrap_before_eq = true +resharper_wrap_chained_method_calls = chop_if_long +resharper_wrap_switch_expression = chop_if_long + +# Microsoft .NET properties +csharp_indent_braces = false +csharp_new_line_before_open_brace = local_functions, methods, types \ No newline at end of file diff --git a/src/Convert2Lf/Main.cs b/src/Convert2Lf/Main.cs new file mode 100644 index 0000000..eb6b801 --- /dev/null +++ b/src/Convert2Lf/Main.cs @@ -0,0 +1,113 @@ +using System.Diagnostics.CodeAnalysis; + +namespace Dot.Convert2Lf; + +public sealed class Main : Tool