diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3835b13 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,1077 @@ + +# dotnet format +# +# https://github.com/dotnet/format +# https://kent-boogaart.com/blog/editorconfig-reference-for-c-developers +# +# Installation: +# +# dotnet tool install -g dotnet-format +# +# Examples Description +# +# dotnet format +# Formats the project or solution in the current directory. +# +# dotnet format -f +# Formats a particular folder and subfolders. +# +# dotnet format -w +# Formats a specific project or solution. +# +# dotnet format -v diag +# Formats with very verbose logging. +# +# dotnet format --files Programs.cs,Utility\Logging.cs +# Formats the files Program.cs and Utility\Logging.cs +# +# dotnet format --check --dry-run +# Formats but does not save. Returns a non-zero exit code if +# any files would have been changed. +# +# Usages +# +# dotnet format -v d -w fixeol.csproj +# + +# top-most EditorConfig file +root = true + +# +# All files +# +[*] + +# Key: indent_style +# Valid values: space|tab +# Supports code style option: no +indent_style = space + +# (Please don't specify an indent_size here; that has too many unintended consequences.) + +# +# Code files +# +[*.{cs,csx,vb,vbx,cshtml}] + +# Key: indent_size +# Valid values: (any integer) +# Supports code style option: no +indent_size = 4 + +# Key: tab_width +# Valid values: (any integer) +# Supports code style option: no +tab_width = 4 + +# Key: insert_final_newline +# Valid values: true|false +# Supports code style option: no +insert_final_newline = true + +charset = utf-8-bom + +trim_trailing_whitespace = true + +# Key: end_of_line +# Valid values: lf|cr|crlf +# Supports code style option: no +end_of_line = lf + +# +# XML project files +# +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] + +# Key: indent_size +# Valid values: (any integer) +# Supports code style option: no +indent_size = 4 + +# +# XML config files +# +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] + +# Key: indent_size +# Valid values: (any integer) +# Supports code style option: no +indent_size = 4 + +# +# JSON files +# +[*.json] + +# Key: indent_size +# Valid values: (any integer) +# Supports code style option: no +indent_size = 4 + +# +# Powershell files +# +[*.ps1] + +# Key: indent_size +# Valid values: (any integer) +# Supports code style option: no +indent_size = 4 + +# +# Shell script files +# +[*.sh] + +# Key: indent_size +# Valid values: (any integer) +# Supports code style option: no +indent_size = 4 + +# +# Dotnet diagnostic settings +# + +# [*.{cs,vb}] +# dotnet_diagnostic.xUnit2018.severity = none # "do not compare an object's exact type to the abstract class" is a valid assert, but very noisy right now + + +############################### +# .NET Coding Conventions # +############################### + +[*.{cs,vb}] +# dotnet_diagnostic.xUnit2018.severity = none # "do not compare an object's exact type to the abstract class" is a valid assert, but very noisy right now + +# +# Organize usings +# + +# Key: dotnet_sort_system_directives_first +# Valid values: true|false +# Supports code style option: no +# // dotnet_sort_system_directives_first = true +# using System; +# using Foo; +# // dotnet_sort_system_directives_first = false +# using Foo; +# using System; +dotnet_sort_system_directives_first = true + +dotnet_separate_import_directive_groups = false + +# +# Avoid "this." if not necessary +# + +# Key: dotnet_style_qualification_for_field +# Valid values: true|false +# Supports code style option: yes +# // dotnet_style_qualification_for_field = true:error +# this.foo = 86; +# // dotnet_style_qualification_for_field = false:error +# foo = 86; +dotnet_style_qualification_for_field = false:refactoring + +# Key: dotnet_style_qualification_for_property +# Valid values: true|false +# Supports code style option: yes +# // dotnet_style_qualification_for_property = true:error +# this.Foo = 86; +# // dotnet_style_qualification_for_property = false:error +# Foo = 86; +dotnet_style_qualification_for_property = false:refactoring + +# Key: dotnet_style_qualification_for_method +# Valid values: true|false +# Supports code style option: yes +# // dotnet_style_qualification_for_method = true:error +# this.Foo(); +# // dotnet_style_qualification_for_method = false:error +# Foo(); +dotnet_style_qualification_for_method = false:refactoring + +# Key: dotnet_style_qualification_for_event +# Valid values: true|false +# Supports code style option: yes +# // dotnet_style_qualification_for_event = true:error +# this.FooHappened += OnFoo; +# // dotnet_style_qualification_for_event = false:error +# FooHappened += OnFoo; +dotnet_style_qualification_for_event = false:refactoring + +# +# Use language keywords instead of framework type names for type references +# + +# Key: dotnet_style_predefined_type_for_locals_parameters_members +# Valid values: true|false +# Supports code style option: yes +# // dotnet_style_predefined_type_for_locals_parameters_members = true:error +# public void Foo(int bar) +# { +# } +# // dotnet_style_predefined_type_for_locals_parameters_members = false:error +# public void Foo(Int32 bar) +# { +# } +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion + +# Key: dotnet_style_predefined_type_for_member_access +# Valid values: true|false +# Supports code style option: yes +# // dotnet_style_predefined_type_for_member_access = true:error +# var foo = int.MinValue; +# // dotnet_style_predefined_type_for_member_access = false:error +# var foo = Int32.MinValue; +dotnet_style_predefined_type_for_member_access = true:suggestion + +# +# Suggest more modern language features when available +# + +# Key: dotnet_style_object_initializer +# Valid values: true|false +# Supports code style option: yes +# // dotnet_style_object_initializer = true:error +# var foo = new Foo +# { +# Value = 86 +# }; +# // dotnet_style_object_initializer = false:error +# var foo = new Foo(); +# foo.Value = 86; +dotnet_style_object_initializer = true:suggestion + +# Key: dotnet_style_collection_initializer +# Valid values: true|false +# Supports code style option: yes +# // dotnet_style_collection_initializer = true:error +# var foos = new List { 86, 95 }; +# // dotnet_style_collection_initializer = false:error +# var foo = new List(); +# foo.Add(86); +# foo.Add(95); +dotnet_style_collection_initializer = true:suggestion + +# Key: dotnet_style_coalesce_expression +# Valid values: true|false +# Supports code style option: yes +# // dotnet_style_coalesce_expression = true:error +# var foo = bar ?? baz; +# // dotnet_style_coalesce_expression = false:error +# var foo = bar != null ? bar : baz; +dotnet_style_coalesce_expression = true:suggestion + +# Key: dotnet_style_null_propagation +# Valid values: true|false +# Supports code style option: yes +# // dotnet_style_null_propagation = true:error +# var foo = foo?.GetSomething(); +# // dotnet_style_null_propagation = false:error +# var foo = foo == null ? null : foo.GetSomething(); +dotnet_style_null_propagation = true:suggestion + +# Key: dotnet_style_explicit_tuple_names +# Valid values: true|false +# Supports code style option: yes +# // dotnet_style_explicit_tuple_names = true:error +# (int foo, int bar) data = GetData(); +# var foo = data.foo; +# // dotnet_style_explicit_tuple_names = false:error +# (int foo, int bar) data = GetData(); +# var foo = data.Item1; +dotnet_style_explicit_tuple_names = true:suggestion + +# +# Parentheses preferences +# + +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent + +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent + +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent + +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent + +# +# Modifier preferences +# + +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion + +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent + +dotnet_style_readonly_field = true:suggestion + +# +# Expression-level preferences +# + +# Key: csharp_prefer_braces +# Valid values: true|false +# Supports code style option: yes +# // csharp_prefer_braces = true:error +# if (foo) +# { +# return; +# } +# // csharp_prefer_braces = false:error +# if (foo) +# return; +csharp_prefer_braces = true:error + +csharp_style_deconstructed_variable_declaration = true:suggestion + +# Key: csharp_prefer_simple_default_expression +# Valid values: true|false +# Supports code style option: yes +# NOTE: this requires C# 7.1 +# // csharp_prefer_simple_default_expression = true:error +# public void Foo(int? i = default); +# // csharp_prefer_simple_default_expression = false:error +# public void Foo(int? i = default(int)); +csharp_prefer_simple_default_expression = true:suggestion + +csharp_style_pattern_local_over_anonymous_function = true:suggestion + +# Key: csharp_style_inlined_variable_declaration +# Valid values: true|false +# Supports code style option: yes +# // csharp_style_inlined_variable_declaration = true:error +# if (this.TryParseFoo(out var foo)) +# { +# } +# // csharp_style_inlined_variable_declaration = false:error +# int foo; +# if (this.TryParseFoo(out foo)) +# { +# } +csharp_style_inlined_variable_declaration = true:refactoring + +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent + +# dotnet_style_prefer_inferred_tuple_names = true:suggestion + +# dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion + +# dotnet_style_prefer_auto_properties = true:silent + +dotnet_style_prefer_conditional_expression_over_assignment = true:silent + +# dotnet_style_prefer_conditional_expression_over_return = true:silent + + +############################### +# Naming Conventions # +############################### + +# Style Definitions +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# Use PascalCase for constant fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.applicable_accessibilities = * +dotnet_naming_symbols.constant_fields.required_modifiers = const + +############################### +# C# Code Style Rules # +############################### + +[*.cs] + +# +# var preferences +# + +# Key: csharp_style_var_for_built_in_types +# Valid values: true|false +# Supports code style option: yes +# // csharp_style_var_for_built_in_types = true:error +# var foo = 86; +# // csharp_style_var_for_built_in_types = false:error +# int foo = 86; +csharp_style_var_for_built_in_types = true + +# Key: csharp_style_var_when_type_is_apparent +# Valid values: true|false +# Supports code style option: yes +# // csharp_style_var_when_type_is_apparent = true:error +# var foo = new List(); +# // csharp_style_var_when_type_is_apparent = false:error +# List foo = new List(); +csharp_style_var_when_type_is_apparent = true + +# Key: csharp_style_var_elsewhere +# Valid values: true|false +# Supports code style option: yes +# // csharp_style_var_elsewhere = true:error +# var foo = this.Foo(); +# // csharp_style_var_elsewhere = false:error +# Foo foo = this.Foo(); +csharp_style_var_elsewhere = true + +# +# Expression-bodied members +# + +# Key: csharp_style_expression_bodied_methods +# Valid values: true|false|when_on_single_line +# Supports code style option: yes +# // csharp_style_expression_bodied_methods = true:error +# public int Foo() => 86; +# // csharp_style_expression_bodied_methods = false:error +# public int Foo() +# { +# return 86; +# } +csharp_style_expression_bodied_methods = true:suggestion + +# Key: csharp_style_expression_bodied_constructors +# Valid values: true|false|when_on_single_line +# Supports code style option: yes +# // csharp_style_expression_bodied_constructors = true:error +# public Foo() => this.foo = 86; +# // csharp_style_expression_bodied_constructors = false:error +# public Foo() +# { +# this.foo = 86; +# } +csharp_style_expression_bodied_constructors = true:when_on_single_line + +# Key: csharp_style_expression_bodied_operators +# Valid values: true|false|when_on_single_line +# Supports code style option: yes +# // csharp_style_expression_bodied_operators = true:error +# public static int operator +(Foo first, Foo second) => first.Bar + second.Bar; +# // csharp_style_expression_bodied_operators = false:error +# public static int operator +(Foo first, Foo second) +# { +# return first.Bar + second.Bar; +# } +csharp_style_expression_bodied_operators = true:suggestion + +# Key: csharp_style_expression_bodied_properties +# Valid values: true|false|when_on_single_line +# Supports code style option: yes +# // csharp_style_expression_bodied_properties = true:error +# public int Foo => 86; +# // csharp_style_expression_bodied_properties = false:error +# public int Foo +# { +# get { return 86; } +# } +csharp_style_expression_bodied_properties = true:suggestion + +# Key: csharp_style_expression_bodied_indexers +# Valid values: true|false|when_on_single_line +# Supports code style option: yes +# // csharp_style_expression_bodied_indexers = true:error +# public int this[int i] => 86; +# // csharp_style_expression_bodied_indexers = false:error +# public int this[int i] +# { +# get { return 86; } +# } +csharp_style_expression_bodied_indexers = true:suggestion + +# Key: csharp_style_expression_bodied_accessors +# Valid values: true|false|when_on_single_line +# Supports code style option: yes +# // csharp_style_expression_bodied_accessors = true:error +# private int foo; +# public int Foo +# { +# get => this.foo; +# set => this.foo = value; +# } +# // csharp_style_expression_bodied_accessors = false:error +# private int foo; +# public int Foo +# { +# get { return this.foo; } +# set { this.foo = value; } +# } +csharp_style_expression_bodied_accessors = true:suggestion + +# +# Pattern-matching preferences +# + +# Key: csharp_style_pattern_matching_over_is_with_cast_check +# Valid values: true|false +# Supports code style option: yes +# // csharp_style_pattern_matching_over_is_with_cast_check = true:error +# if (foo is int i) +# { +# } +# // csharp_style_pattern_matching_over_is_with_cast_check = false:error +# if (foo is int) +# { +# var i = (int)foo; +# } +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion + +# Key: csharp_style_pattern_matching_over_as_with_null_check +# Valid values: true|false +# Supports code style option: yes +# // csharp_style_pattern_matching_over_as_with_null_check = true:error +# if (foo is string s) +# { +# } +# // csharp_style_pattern_matching_over_as_with_null_check = false:error +# var s = foo as string; +# if (s != null) +# { +# } +csharp_style_pattern_matching_over_as_with_null_check = false:suggestion + +# +# Null-checking preferences +# + +# Key: csharp_style_throw_expression +# Valid values: true|false +# Supports code style option: yes +# // csharp_style_throw_expression = true:error +# this.foo = bar ?? throw new ArgumentNullException(nameof(bar)); +# // csharp_style_throw_expression = false:error +# if (bar == null) +# { +# throw new ArgumentNullException(nameof(bar)); +# } +# this.foo = bar; +csharp_style_throw_expression = true:suggestion + +# Key: csharp_style_conditional_delegate_call +# Valid values: true|false +# Supports code style option: yes +# // csharp_style_conditional_delegate_call = true:error +# this.foo?.Invoke(bar); +# // csharp_style_conditional_delegate_call = false:error +# if (this.foo != null) +# { +# this.foo(bar); +# } +csharp_style_conditional_delegate_call = true:suggestion + + +############################### +# C# Formatting Rules # +############################### + +# +# New line preferences +# + +# Key: csharp_new_line_before_open_brace +# Valid values: all|accessors|types|methods|properties|indexers|events|anonymous_methods|control_blocks|anonymous_types|object_collection_array_initalizers|lambdas|local_functions +# Supports code style option: no +# // csharp_new_line_before_open_brace = all +# public void Foo() +# { +# if (foo) +# { +# } +# } +# // csharp_new_line_before_open_brace = methods +# public void Foo() +# { +# if (foo) { +# } +# } +# // csharp_new_line_before_open_brace = methods,control_blocks +# public void Foo() +# { +# if (foo) +# { +# } +# } +csharp_new_line_before_open_brace = types,methods + +# Key: csharp_new_line_before_else +# Valid values: true|false +# Supports code style option: no +# // csharp_new_line_before_else = true +# if (foo) +# { +# } +# else +# { +# } +# // csharp_new_line_before_else = false +# if (foo) +# { +# } else +# { +# } +csharp_new_line_before_else = false + +# Key: csharp_new_line_before_catch +# Valid values: true|false +# Supports code style option: no +# // csharp_new_line_before_catch = true +# try +# { +# } +# catch +# { +# } +# // csharp_new_line_before_catch = false +# try +# { +# } catch +# { +# } +csharp_new_line_before_catch = false + +# Key: csharp_new_line_before_finally +# Valid values: true|false +# Supports code style option: no +# // csharp_new_line_before_finally = true +# try +# { +# } +# catch +# { +# } +# finally +# { +# } +# // csharp_new_line_before_finally = false +# try +# { +# } +# catch +# { +# } finally +# { +# } +csharp_new_line_before_finally = false + +# Key: csharp_new_line_before_members_in_object_initializers +# Valid values: true|false +# Supports code style option: no +# // csharp_new_line_before_members_in_object_initializers = true +# var foo = new Foo +# { +# A = 86, +# B = 95 +# }; +# // csharp_new_line_before_members_in_object_initializers = false +# var foo = new Foo +# { +# A = 86, B = 95 +# }; +csharp_new_line_before_members_in_object_initializers = true + +# Key: csharp_new_line_before_members_in_anonymous_types +# Valid values: true|false +# Supports code style option: no +# // csharp_new_line_before_members_in_anonymous_types = true +# var foo = new +# { +# A = 86, +# B = 95 +# }; +# // csharp_new_line_before_members_in_anonymous_types = false +# var foo = new +# { +# A = 86, B = 95 +# }; +csharp_new_line_before_members_in_anonymous_types = true + +# Key: csharp_new_line_between_query_expression_clauses +# Valid values: true|false +# Supports code style option: no +# NOTE: this option does not appear to have any effect, so I’ve documented what I believe is the intended effect. +# // csharp_new_line_between_query_expression_clauses = true +# var result = from x in xs +# select x; +# // csharp_new_line_between_query_expression_clauses = false +# var result = from x in xs select x; +csharp_new_line_between_query_expression_clauses = true + +# +# Indentation preferences +# + +# Key: csharp_indent_block_contents +# Valid values: true|false +# Supports code style option: no +# // csharp_indent_block_contents = true +# if (foo) +# { +# var bar = 86; +# } +# // csharp_indent_block_contents = false +# if (foo) +# { +# var bar = 86; +# } +csharp_indent_block_contents = true + +# Key: csharp_indent_braces +# Valid values: true|false +# Supports code style option: no +# // csharp_indent_braces = true +# public void foo() +# { +# } +# // csharp_indent_braces = false +# public void foo() +# { +# } +csharp_indent_braces = false + +# Key: csharp_indent_case_contents +# Valid values: true|false +# Supports code style option: no +# // csharp_indent_case_contents = true +# switch (foo) +# { +# case 86: +# break; +# case 95: +# break; +# } +# // csharp_indent_case_contents = false +# switch (foo) +# { +# case 86: +# break; +# case 95: +# break; +# } +csharp_indent_case_contents = true + +# Key: csharp_indent_labels +# Valid values: flush_left|one_less_than_current|no_change +# Supports code style option: no +# // csharp_indent_labels = flush_left +# public class C +# { +# public void M() +# { +# foo: +# var x = 86; +# } +# } +# // csharp_indent_labels = one_less_than_current +# public class C +# { +# public void M() +# { +# foo: +# var x = 86; +# } +# } +# // csharp_indent_labels = no_change +# public class C +# { +# public void M() +# { +# foo: +# var x = 86; +# } +# } +csharp_indent_labels = one_less_than_current + +# Key: csharp_indent_switch_labels +# Valid values: true|false +# Supports code style option: no +# // csharp_indent_switch_labels = true +# switch (foo) +# { +# case 86: +# break; +# case 95: +# break; +# } +# // csharp_indent_switch_labels = false +# switch (foo) +# { +# case 86: +# break; +# case 95: +# break; +# } +csharp_indent_switch_labels = true + +# +# Space preferences +# + +# Key: csharp_space_before_comma +# Valid values: true|false +# Supports code style option: no +# // csharp_space_before_comma = true +# var foo = new[] { 1 , 2 , 3 }; +# // csharp_space_before_comma = false +# var foo = new[] { 1, 2, 3 }; +csharp_space_before_comma = false + +# Key: csharp_space_after_cast +# Valid values: true|false +# Supports code style option: no +# // csharp_space_after_cast = true +# var foo = (int) bar; +# // csharp_space_after_cast = false +# var foo = (int)bar; +csharp_space_after_cast = false + +# Key: csharp_space_after_keywords_in_control_flow_statements +# Valid values: true|false +# Supports code style option: no +# // csharp_space_after_keywords_in_control_flow_statements = true +# if (foo) +# { +# } +# while (foo) +# { +# } +# // csharp_space_after_keywords_in_control_flow_statements = false +# if(foo) +# { +# } +# while(foo) +# { +# } +csharp_space_after_keywords_in_control_flow_statements = true + +# Key: csharp_space_after_semicolon_in_for_statement +# Valid values: true|false +# Supports code style option: no +# // csharp_space_after_semicolon_in_for_statement = true +# for (var foo = 0; foo < 10; ++foo) +# { +# } +# // csharp_space_after_semicolon_in_for_statement = false +# for (var foo = 0;foo < 10;++foo) +# { +# } +csharp_space_after_semicolon_in_for_statement = true + +# Key: csharp_space_before_semicolon_in_for_statement +# Valid values: true|false +# Supports code style option: no +# // csharp_space_before_semicolon_in_for_statement = true +# for (var foo = 0 ; foo < 10 ; ++foo) +# { +# } +# // csharp_space_before_semicolon_in_for_statement = false +# for (var foo = 0; foo < 10; ++foo) +# { +# } +csharp_space_before_semicolon_in_for_statement = false + +# Key: csharp_space_around_declaration_statements +# Valid values: ignore|do_not_ignore +# Supports code style option: no +# // csharp_space_around_declaration_statements = ignore +# var foo = 86; +# // csharp_space_around_declaration_statements = do_not_ignore +# var foo = 86; +csharp_space_around_declaration_statements = do_not_ignore + +# Key: csharp_space_between_parentheses +# Valid values: none|expressions|type_casts|control_flow_statements +# Supports code style option: no +# // csharp_space_between_parentheses = none +# var foo = (int)bar; +# while (foo < 86) +# { +# ++foo; +# } +# // csharp_space_between_parentheses = type_casts +# var foo = ( int )bar; +# while (foo < 86) +# { +# ++foo; +# } +# // csharp_space_between_parentheses = type_casts,control_flow_statements +# var foo = ( int )bar; +# while ( foo < 86 ) +# { +# ++foo; +# } +csharp_space_between_parentheses = none + +# Key: csharp_space_before_colon_in_inheritance_clause +# Valid values: true|false +# Supports code style option: no +# // csharp_space_before_colon_in_inheritance_clause = true +# public class Foo : Bar +# // csharp_space_before_colon_in_inheritance_clause = false +# public class Foo: Bar +csharp_space_before_colon_in_inheritance_clause = true + +# Key: csharp_space_after_colon_in_inheritance_clause +# Valid values: true|false +# Supports code style option: no +# // csharp_space_after_colon_in_inheritance_clause = true +# public class Foo : Bar +# // csharp_space_after_colon_in_inheritance_clause = false +# public class Foo :Bar +csharp_space_after_colon_in_inheritance_clause = true + +# Key: csharp_space_around_binary_operators +# Valid values: before_and_after|ignore|none +# Supports code style option: no +# NOTE: currently thwarted by this bug. +# // csharp_space_around_binary_operators = before_and_after +# var foo = 86 + 86; +# // csharp_space_around_binary_operators = ignore +# var foo = 86+ 86; +# // csharp_space_around_binary_operators = none +# var foo = 86+86; +csharp_space_around_binary_operators = before_and_after + +# Key: csharp_space_between_method_declaration_name_and_open_parenthesis +# Valid values: true|false +# Supports code style option: no +# // csharp_space_between_method_declaration_name_and_open_parenthesis = true +# public void Foo () +# { +# } +# // csharp_space_between_method_declaration_name_and_open_parenthesis = false +# public void Foo() +# { +# } +csharp_space_between_method_declaration_name_and_open_parenthesis = false + +# Key: csharp_space_between_method_declaration_empty_parameter_list_parentheses +# Valid values: true|false +# Supports code style option: no +# // csharp_space_between_method_declaration_empty_parameter_list_parentheses = true +# public void Foo( ) +# { +# } +# // csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +# public void Foo() +# { +# } +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false + +# Key: csharp_space_between_method_declaration_parameter_list_parentheses +# Valid values: true|false +# Supports code style option: no +# // csharp_space_between_method_declaration_parameter_list_parentheses = true +# public void Foo( int bar ) +# { +# } +# // csharp_space_between_method_declaration_parameter_list_parentheses = false +# public void Foo(int bar) +# { +# } +csharp_space_between_method_declaration_parameter_list_parentheses = true + +# Key: csharp_space_between_method_call_name_and_opening_parenthesis +# Valid values: true|false +# Supports code style option: no +# // csharp_space_between_method_call_name_and_opening_parenthesis = true +# this.Foo (); +# // csharp_space_between_method_call_name_and_opening_parenthesis = false +# this.Foo(); +csharp_space_between_method_call_name_and_opening_parenthesis = false + +# Key: csharp_space_between_method_call_empty_parameter_list_parentheses +# Valid values: true|false +# Supports code style option: no +# // csharp_space_between_method_call_empty_parameter_list_parentheses = true +# this.Foo( ); +# // csharp_space_between_method_call_empty_parameter_list_parentheses = false +# this.Foo(); +csharp_space_between_method_call_empty_parameter_list_parentheses = false + +# Key: csharp_space_between_method_call_parameter_list_parentheses +# Valid values: true|false +# Supports code style option: no +# // csharp_space_between_method_call_parameter_list_parentheses = true +# this.Foo( 86 ); +# // csharp_space_between_method_call_parameter_list_parentheses = false +# this.Foo(86); +csharp_space_between_method_call_parameter_list_parentheses = false + +# Key: csharp_space_after_comma +# Valid values: true|false +# Supports code style option: no +# // csharp_space_after_comma = true +# var foo = new[] { 1, 2, 3 }; +# // csharp_space_after_comma = false +# var foo = new[] { 1,2,3 }; +csharp_space_after_comma = true + +# Key: csharp_space_after_dot +# Valid values: true|false +# Supports code style option: no +# // csharp_space_after_dot = true +# this. Foo(); +# // csharp_space_after_dot = false +# this.Foo(); +csharp_space_after_dot = false + +# Key: csharp_space_before_dot +# Valid values: true|false +# Supports code style option: no +# // csharp_space_before_dot = true +# this .Foo(); +# // csharp_space_before_dot = false +# this.Foo(); +csharp_space_before_dot = false + +# Key: csharp_space_between_square_brackets +# Valid values: true|false +# Supports code style option: no +# // csharp_space_between_square_brackets = true +# foo[ 86 ] = 95; +# // csharp_space_between_square_brackets = false +# foo[86] = 95; +csharp_space_between_square_brackets = false + +# Key: csharp_space_before_open_square_brackets +# Valid values: true|false +# Supports code style option: no +# // csharp_space_before_open_square_brackets = true +# var foo = bar [86]; +# // csharp_space_before_open_square_brackets = false +# var foo = bar[86]; +csharp_space_before_open_square_brackets = false + +# Key: csharp_space_between_empty_square_brackets +# Valid values: true|false +# Supports code style option: no +# // csharp_space_between_empty_square_brackets = true +# var foo = new [ ] { 86, 95 }; +# // csharp_space_between_empty_square_brackets = false +# var foo = new [] { 86, 95 }; +csharp_space_between_empty_square_brackets = false + +# +# Wrapping preferences +# + +# Key: csharp_preserve_single_line_statements +# Valid values: true|false +# Supports code style option: no +# // csharp_preserve_single_line_statements = true +# if (true) DoSomething(); +# // csharp_preserve_single_line_statements = false +# if (true) +# DoSomething(); +csharp_preserve_single_line_statements = false + +# Key: csharp_preserve_single_line_blocks +# Valid values: true|false +# Supports code style option: no +# // csharp_preserve_single_line_blocks = true +# { DoSomething(); } +# // csharp_preserve_single_line_blocks = false +# { +# DoSomething(); +# } +csharp_preserve_single_line_blocks = true diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..511886c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,139 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for COMMAND PROMPT diff (only). +# 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 +############################################################################### +# Explicitly declare text files you want to always be normalized and converted +# to _NATIVE_ line-endings on checkout. +# *.css text +############################################################################### +# Explicitly declare files that will always have LF line endings on checkout. +# *.conf text eol=lf +############################################################################### + + +############################################################################### +# Force SYSTEM NATIVE line-endings. (ie: crlf on Windows, lf on Linux, etc.) +############################################################################### + +# example +#*.c text + +############################################################################### +# Force LF line-endings. +############################################################################### +# C/C++ +*.c text eol=lf +*.h text eol=lf +*.mk text eol=lf + +# C# +*.cs text eol=lf diff=csharp + +# Web +*.css text eol=lf +*.scss text eol=lf +*.js text eol=lf +*.htm text eol=lf +*.html text eol=lf + +# Misc. +*.txt text eol=lf +Makefile text eol=lf + +*.conf text eol=lf +*.config text eol=lf +*.go text eol=lf +*.jinja text eol=lf +*.json text eol=lf +*.sh text eol=lf +*.sls text eol=lf + +############################################################################### +# Force CRLF line-endings. +############################################################################### +*.bat eol=crlf +*.BAT eol=crlf +*.cmd eol=crlf +*.CMD eol=crlf + +############################################################################### +# Behavior for common image file formats: +# +# Explicitly Denote all files that are truly binary and should not be modified. +############################################################################### +*.bmp binary +*.gif binary +*.jpg binary +*.png binary +*.tif binary +*.tiff binary + +*.ai binary +*.pdn binary +*.psd binary + +############################################################################### +# Behavior for common document formats: +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. +############################################################################### +*.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 + +*.md diff=astextplain +*.MD diff=astextplain +*.markdown diff=astextplain +*.Markdown diff=astextplain + + +############################################################################### +# Set the merge driver for Visual Studio 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 +*.sln text eol=lf +*.csproj text eol=lf +*.vbproj text eol=lf +*.vcxproj text eol=lf +*.vcproj text eol=lf +*.dbproj text eol=lf +*.fsproj text eol=lf +*.lsproj text eol=lf +*.wixproj text eol=lf +*.modelproj text eol=lf +*.sqlproj text eol=lf +*.wwaproj text eol=lf diff --git a/.github/workflows/dotnet-core-build.yml b/.github/workflows/dotnet-core-build.yml new file mode 100644 index 0000000..9dc1f1c --- /dev/null +++ b/.github/workflows/dotnet-core-build.yml @@ -0,0 +1,46 @@ +name: dotnet-core-build + +on: + push: + branches: [ master, develop ] + pull_request: + branches: [ master, develop ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + # dotnet: [ '2.2.x', '3.0.x', '3.1.x' ] + dotnet: [ '3.1.202' ] + name: dotnet core ${{ matrix.dotnet }} + steps: + - name: Get variables + run: | + echo ::set-env name=APP_NAME::sortxml + echo APP_NAME=${{ env.APP_NAME }} + echo ::set-env name=TAG_NAME::${GITHUB_REF#refs/*/} + echo TAG_NAME=${{ env.TAG_NAME }} + + - name: Get source + uses: actions/checkout@v2 + # ref: ${github.ref##*/} + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v1.4.0 + with: + dotnet-version: ${{ matrix.dotnet }} + + - name: Restore + run: dotnet restore + + - name: Format + run: | + dotnet tool install -g dotnet-format + dotnet format -v d -w ${{ env.APP_NAME }}.csproj + + - name: Build + run: dotnet build --configuration Release + + - name: Test + run: dotnet test --verbosity normal diff --git a/.github/workflows/dotnet-core-release.yml b/.github/workflows/dotnet-core-release.yml new file mode 100644 index 0000000..77f7903 --- /dev/null +++ b/.github/workflows/dotnet-core-release.yml @@ -0,0 +1,161 @@ +name: dotnet-core-release + +on: + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + # dotnet: [ '2.2.x', '3.0.x', '3.1.x' ] + dotnet: [ '3.1.202' ] + name: dotnet core ${{ matrix.dotnet }} + steps: + - name: Get variables + run: | + echo ::set-env name=APP_NAME::sortxml + echo ::set-env name=TAG_NAME::${GITHUB_REF#refs/*/} + + - name: Get source + uses: actions/checkout@master + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v1.4.0 + with: + dotnet-version: ${{ matrix.dotnet }} + + # - name: Restore + # run: dotnet restore + + # - name: Build + # run: dotnet build --no-restore --configuration Release + + - name: Test + run: dotnet test --verbosity normal + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ env.TAG_NAME }} + draft: false + prerelease: false + + - name: "Publish: win-x64" + run: | + dotnet restore --runtime win-x64 + dotnet publish --nologo --configuration Release --runtime win-x64 --framework netcoreapp3.1 --output ./win-x64/ --self-contained false + zip --junk-paths ./${{ env.APP_NAME }}-win-x64-${{ env.TAG_NAME }}.zip ./win-x64/* + + - name: "Upload: win-x64" + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ env.APP_NAME }}-win-x64-${{ env.TAG_NAME }}.zip + asset_name: ${{ env.APP_NAME }}-win-x64-${{ env.TAG_NAME }}.zip + asset_content_type: application/zip + + - name: "Publish: win-x86" + run: | + dotnet restore --runtime win-x86 + dotnet publish --nologo --configuration Release --runtime win-x86 --framework netcoreapp3.1 --output ./win-x86/ --self-contained false + zip -o -7 --junk-paths ./${{ env.APP_NAME }}-win-x86-${{ env.TAG_NAME }}.zip ./win-x86/* + + - name: "Upload: win-x86" + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ env.APP_NAME }}-win-x86-${{ env.TAG_NAME }}.zip + asset_name: ${{ env.APP_NAME }}-win-x86-${{ env.TAG_NAME }}.zip + asset_content_type: application/zip + + - name: "Publish: win-arm" + run: | + dotnet restore --runtime win-arm + dotnet publish --nologo --configuration Release --runtime win-arm --framework netcoreapp3.1 --output ./win-arm/ --self-contained false + zip -o -7 --junk-paths ./${{ env.APP_NAME }}-win-arm-${{ env.TAG_NAME }}.zip ./win-arm/* + + - name: "Upload: win-arm" + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ env.APP_NAME }}-win-arm-${{ env.TAG_NAME }}.zip + asset_name: ${{ env.APP_NAME }}-win-arm-${{ env.TAG_NAME }}.zip + asset_content_type: application/zip + + # - name: "Publish: win-x64-self-contained" + # run: | + # dotnet restore + # dotnet publish --nologo --configuration Release --runtime win-x64 --framework netcoreapp3.1 --output ./win-x64-self-contained/ --self-contained true + # zip --junk-paths ./${{ env.APP_NAME }}-win-x64-self-contained-${{ env.TAG_NAME }}.zip ./win-x64-self-contained/* + + # - name: "Upload: win-x64-self-contained" + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_path: ./${{ env.APP_NAME }}-win-x64-self-contained-${{ env.TAG_NAME }}.zip + # asset_name: ${{ env.APP_NAME }}-win-x64-self-contained-${{ env.TAG_NAME }}.zip + # asset_content_type: application/zip + + - name: "Publish: linux-x64" + run: | + dotnet restore --runtime linux-x64 + dotnet publish --nologo --configuration Release --runtime linux-x64 --framework netcoreapp3.1 --output ./publish/linux-x64/ --self-contained false + zip -o -7 --junk-paths ./${{ env.APP_NAME }}-linux-x64-${{ env.TAG_NAME }}.zip ./publish/linux-x64/* + + - name: "Upload: linux-x64" + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ env.APP_NAME }}-linux-x64-${{ env.TAG_NAME }}.zip + asset_name: ${{ env.APP_NAME }}-linux-x64-${{ env.TAG_NAME }}.zip + asset_content_type: application/zip + + - name: "Publish: linux-arm" + run: | + dotnet restore --runtime linux-arm + dotnet publish --nologo --configuration Release --runtime linux-arm --framework netcoreapp3.1 --output ./publish/linux-arm/ --self-contained false + zip -o -7 --junk-paths ./${{ env.APP_NAME }}-linux-arm-${{ env.TAG_NAME }}.zip ./publish/linux-arm/* + + - name: "Upload: linux-arm" + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ env.APP_NAME }}-linux-arm-${{ env.TAG_NAME }}.zip + asset_name: ${{ env.APP_NAME }}-linux-arm-${{ env.TAG_NAME }}.zip + asset_content_type: application/zip + + - name: "Publish: osx-x64" + run: | + dotnet restore --runtime osx-x64 + dotnet publish --nologo --configuration Release --runtime osx-x64 --framework netcoreapp3.1 --output ./publish/osx-x64/ --self-contained false + zip -o -7 --junk-paths ./${{ env.APP_NAME }}-osx-x64-${{ env.TAG_NAME }}.zip ./publish/osx-x64/* + + - name: "Upload: osx-x64" + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ env.APP_NAME }}-osx-x64-${{ env.TAG_NAME }}.zip + asset_name: ${{ env.APP_NAME }}-osx-x64-${{ env.TAG_NAME }}.zip + asset_content_type: application/zip diff --git a/.gitignore b/.gitignore index b1c1c47..46deff2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,416 +1,25 @@ -### VisualStudio - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - - -### VisualStudioCode - +### VisualStudioCode .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json - - -### Windows - -# Windows thumbnail cache files + +### VisualStudio +*.suo +*.user +.vs/ +[Bb]in/ +[Oo]bj/ + +### Windows Thumbs.db ehthumbs.db ehthumbs_vista.db +Desktop.ini -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - - -### MacOS - -# General -.DS_Store +### macOS +*.DS_Store .AppleDouble .LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - - -### Linux - -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - - diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5c08972 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,50 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": "sortxml: b.xml", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "sortxml: build", + "program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/sortxml.dll", + "args": [ + "${workspaceFolder}/tests/b.xml", + "${workspaceFolder}/tests/b_sorted.xml", + ], + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": "sortxml: c.xml", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "sortxml: build", + "program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/sortxml.dll", + "args": [ + "${workspaceFolder}/tests/c.xml", + "${workspaceFolder}/tests/c_sorted.xml", + ], + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": "sortxml: g.xml", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "sortxml: build", + "program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/sortxml.dll", + "args": [ + "${workspaceFolder}/tests/g.xml", + "${workspaceFolder}/tests/g_sorted.xml", + ], + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "stopAtEntry": false + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..119b1dd --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "editor.formatOnSave": true, + "editor.insertSpaces": false, +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..45629df --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,39 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "sortxml: build", + "command": "dotnet", + "type": "process", + "group": { + "kind": "build", + "isDefault": true + }, + "args": [ + "build", + "-c", + "Debug", + "${workspaceFolder}/sortxml.csproj", + ], + "problemMatcher": "$msCompile" + }, + { + "label": "sortxml: build release", + "command": "dotnet", + "type": "process", + "group": { + "kind": "build", + "isDefault": true + }, + "args": [ + "publish", + "-c", + "Release", + "-r", + "win10-x64", + "${workspaceFolder}/sortxml.csproj", + ], + "problemMatcher": "$msCompile" + } + ] +} diff --git a/App.config b/App.config deleted file mode 100644 index e3c7cdc..0000000 --- a/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/LICENSE b/LICENSE index 19878df..4187523 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Kody Brown +Copyright (c) 2014-2020 Kody Brown Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/Program.cs b/Program.cs index 67d8255..1179385 100644 --- a/Program.cs +++ b/Program.cs @@ -1,321 +1,330 @@ -/*! - Copyright (C) 2014 Kody Brown (@wasatchwizard) - - MIT License: - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. -*/ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Text; -using System.Xml; - -namespace sortxml -{ - class Program - { - static bool sort_node = true, - sort_attr = true, - pretty = true, - pause = false, - overwriteSelf = false; - static StringComparison - sort_node_comp = StringComparison.CurrentCulture, // Default to case-sensitive sorting. - sort_attr_comp = StringComparison.CurrentCulture; - - static string primary_attr = ""; - - static int Main( string[] arguments ) - { - XmlDocument doc; - string inf = "", - outf = ""; - - doc = new XmlDocument(); - - for (int i = 0; i < arguments.Length; i++) { - string a = arguments[i]; - - if (a[0] == '-' || a[0] == '/' || a[0] == '!') { - while (a[0] == '-' || a[0] == '/') { - a = a.Substring(1); - } - string al = a.ToLower(); - - if (al.Equals("?") || al.Equals("help")) { - usage(); - return 0; - - } else if (al.Equals("p") || al.Equals("pause")) { - pause = true; - } else if (al.Equals("i") || al.StartsWith("casei") || al.StartsWith("case-i")) { - sort_node_comp = StringComparison.CurrentCultureIgnoreCase; - sort_attr_comp = StringComparison.CurrentCultureIgnoreCase; - } else if (al.Equals("!i") || al.StartsWith("cases") || al.StartsWith("case-s")) { - sort_node_comp = StringComparison.CurrentCulture; - sort_attr_comp = StringComparison.CurrentCulture; - } else if (al.Equals("s") || al.Equals("sort") || al.StartsWith("sortall") || al.StartsWith("sort-all")) { - sort_node = true; - sort_attr = true; - } else if (al.Equals("!s") || al.Equals("!sort") || al.StartsWith("!sortall") || al.StartsWith("!sort-all")) { - sort_node = false; - sort_attr = false; - } else if (al.StartsWith("sortn") || al.StartsWith("sort-n")) { - sort_node = true; - } else if (al.StartsWith("!sortn") || al.StartsWith("!sort-n")) { - sort_node = false; - } else if (al.StartsWith("sorta") || al.StartsWith("sort-a")) { - sort_attr = true; - } else if (al.StartsWith("!sorta") || al.StartsWith("!sort-a")) { - sort_attr = false; - } else if (al.StartsWith("pretty") || al.StartsWith("!pretty")) { - pretty = al.StartsWith("pretty"); - } else if (al.StartsWith("overwrite") || al.StartsWith("!overwrite")) { - overwriteSelf = al.StartsWith("overwrite"); - } else if (al.StartsWith("primary:")) { - primary_attr = al.Substring("primary:".Length); - } - } else { - if (inf.Length == 0) { - inf = a; - } else if (outf.Length == 0) { - outf = a; - } else { - Console.WriteLine("**** Unknown command: " + a); - } - } - } - - if (inf.Length == 0) { - usage(); - return 1; - } - - try { - doc.LoadXml(File.ReadAllText(inf)); - doc.PreserveWhitespace = !pretty; - } catch (Exception ex) { - Console.WriteLine("**** Could not load input file"); - Console.WriteLine(ex.Message); - return 100; - } - - if (sort_attr) { - if (primary_attr == null || primary_attr.Length == 0) { - primary_attr = "GUID"; - } - SortNodeAttrs(doc.DocumentElement); - } - if (sort_node) { - SortNodes(doc.DocumentElement); - } - - if (outf.Length == 0 && overwriteSelf) { - outf = inf; - } - - if (outf.Length > 0) { - try { - doc.Save(outf); - } catch (Exception ex) { - Console.WriteLine("**** Could not save output file"); - Console.WriteLine(ex.Message); - return 101; - } - } else { - doc.Save(Console.Out); - } - - if (pause) { - Console.Write("Press any key to quit: "); - Console.ReadKey(true); - Console.WriteLine(); - } - - return 0; - } - - static void SortNodes( XmlNode node ) - { - // Go down to the furthest child and start there.. - // That is so I can include child nodes in the current node's sort, - // if all of it's attributes match.. - for (int i = 0, len = node.ChildNodes.Count; i < len; i++) { - SortNodes(node.ChildNodes[i]); - } - - // Remove, sort, then re-add the node's children. - if (sort_node && node.ChildNodes != null && node.ChildNodes.Count > 0) { - List nodes = new List(node.ChildNodes.Count); - - for (int i = node.ChildNodes.Count - 1; i >= 0; i--) { - nodes.Add(node.ChildNodes[i]); - node.RemoveChild(node.ChildNodes[i]); - } - - nodes.Sort(SortDelegate); - - for (int i = 0; i < nodes.Count; i++) { - node.AppendChild(nodes[i]); - } - } - } - - static int SortDelegate( XmlNode a, XmlNode b ) - { - XmlAttribute aa, bb; - XmlAttributeCollection col1, col2; - int result; - - result = string.Compare(a.Name, b.Name, sort_node_comp); - - // NOTE: Always sort the _nodes_ based on its attributes (when the - // name matches), but don't actually sort the node's attributes. - // (Sorting attributes is done before node sorting happens, - // if specified). - if (result == 0) { - col1 = (a.Attributes.Count >= b.Attributes.Count) ? a.Attributes : b.Attributes; - col2 = (a.Attributes.Count >= b.Attributes.Count) ? b.Attributes : a.Attributes; - - for (int i = 0; i < col1.Count; i++) { - if (i < col2.Count) { - aa = col1[i]; - bb = col2[i]; - result = string.Compare(aa.Name, bb.Name, sort_attr_comp); - if (result == 0) { - result = string.Compare(aa.Value, bb.Value, sort_attr_comp); - if (result != 0) { - return result; - } - // Attribute name and value match.. continue loop. - } else { - return result; - } - } else { - return 1; - } - } - - // If we get here, that means that the node's attributes (and values) all match.. - // TODO: Should we go down into the child node collections for sorting? - // See example `c.xml`.. - //Console.WriteLine(a.Name + "==" + b.Name + " all attributes matched"); - } - - return result; - } - - static void SortNodeAttrs( XmlNode node ) - { - // Remove, sort, then re-add the node's attributes. - if (sort_attr && node.Attributes != null && node.Attributes.Count > 0) { - SortXmlAttributeCollection(node.Attributes); - } - - // Sort the children node's attributes also. - for (int i = 0, len = node.ChildNodes.Count; i < len; i++) { - SortNodeAttrs(node.ChildNodes[i]); - } - } - - static void SortXmlAttributeCollection( XmlAttributeCollection col ) - { - // Remove, sort, then re-add the attributes to the collection. - if (sort_attr && col != null && col.Count > 0) { - List attrs = new List(col.Count); - - for (int i = col.Count - 1; i >= 0; i--) { - attrs.Add(col[i]); - col.RemoveAt(i); - } - - SortAttributeList(attrs); - - for (int i = 0; i < attrs.Count; i++) { - col.Append(attrs[i]); - } - } - } - - static void SortAttributeList( List attrs ) - { - int result; - - attrs.Sort(delegate( XmlAttribute a, XmlAttribute b ) - { - result = string.Compare(a.Name, b.Name, sort_attr_comp); - if (result == 0) { - return string.Compare(a.Value, b.Value, sort_attr_comp); - } else if (primary_attr.Length > 0) { - // If a primary_attr is specified, it is always made the first attribute! - if (a.Name.Equals(primary_attr, sort_attr_comp)) { - return -1; - } else if (b.Name.Equals(primary_attr, sort_attr_comp)) { - return 1; - } - } - return result; - }); - } - - static void usage() - { - Console.Write(GetEmbeddedReadme()); - } - - public static string GetEmbeddedReadme() - { - Assembly asm; - Stream strm; - string result; - - asm = Assembly.GetExecutingAssembly(); - strm = asm.GetManifestResourceStream("sortxml.README.md"); - - if (strm == null) { - return string.Empty; - } - - result = ""; - - using (StreamReader reader = new StreamReader(strm)) { - result = reader.ReadToEnd(); - reader.Close(); - } - - // clean it up just a tiny bit.. - List ar = new List(result.Trim().Split(new char[] { '\n' })); - - ar.RemoveRange(0, 3); - - for (int i = 0; i < ar.Count; i++) { - if (ar[i].StartsWith(" ")) { - ar[i] = ar[i].Substring(2); - } - } - - ar.Add(""); - - return string.Join(Environment.NewLine, ar); - } - } -} +/*! + Copyright (c) 2014-2020 Kody Brown (@wasatchwizard) + + MIT License: + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Text; +using System.Xml; + +namespace sortxml +{ + class Program + { + static bool sort_node = true; + static bool sort_attr = true; + static bool pretty = true; + static bool pause = false; + static bool overwriteSelf = false; + static StringComparison sort_node_comp = StringComparison.CurrentCulture; // Default to case-sensitive sorting. + static StringComparison sort_attr_comp = StringComparison.CurrentCulture; + + static string primary_attr = ""; + + static int Main( string[] arguments ) + { + var inf = ""; + var outf = ""; + + var doc = new XmlDocument(); + + for (var i = 0; i < arguments.Length; i++) { + var a = arguments[i]; + + if (a[0] == '-' || a[0] == '/' || a[0] == '!') { + while (a[0] == '-' || a[0] == '/') { + a = a.Substring(1); + } + var al = a.ToLower(); + + if (al.Equals("?") || al.Equals("help")) { + usage(); + return 0; + + } else if (al.Equals("p") || al.Equals("pause")) { + pause = true; + } else if (al.Equals("i") || al.StartsWith("casei") || al.StartsWith("case-i")) { + sort_node_comp = StringComparison.CurrentCultureIgnoreCase; + sort_attr_comp = StringComparison.CurrentCultureIgnoreCase; + } else if (al.Equals("!i") || al.StartsWith("cases") || al.StartsWith("case-s")) { + sort_node_comp = StringComparison.CurrentCulture; + sort_attr_comp = StringComparison.CurrentCulture; + } else if (al.Equals("s") || al.Equals("sort") || al.StartsWith("sortall") || al.StartsWith("sort-all")) { + sort_node = true; + sort_attr = true; + } else if (al.Equals("!s") || al.Equals("!sort") || al.StartsWith("!sortall") || al.StartsWith("!sort-all")) { + sort_node = false; + sort_attr = false; + } else if (al.StartsWith("sortn") || al.StartsWith("sort-n")) { + sort_node = true; + } else if (al.StartsWith("!sortn") || al.StartsWith("!sort-n")) { + sort_node = false; + } else if (al.StartsWith("sorta") || al.StartsWith("sort-a")) { + sort_attr = true; + } else if (al.StartsWith("!sorta") || al.StartsWith("!sort-a")) { + sort_attr = false; + } else if (al.StartsWith("pretty") || al.StartsWith("!pretty")) { + pretty = al.StartsWith("pretty"); + } else if (al.StartsWith("overwrite") || al.StartsWith("!overwrite")) { + overwriteSelf = al.StartsWith("overwrite"); + } else if (al.StartsWith("primary:")) { + primary_attr = al.Substring("primary:".Length); + } + } else { + if (inf.Length == 0) { + inf = a; + } else if (outf.Length == 0) { + outf = a; + } else { + Console.WriteLine("**** Unknown command: " + a); + } + } + } + + if (inf.Length == 0) { + usage(); + return 1; + } + + try { + doc.LoadXml(File.ReadAllText(inf)); + doc.PreserveWhitespace = !pretty; + } catch (Exception ex) { + Console.WriteLine("**** Could not load input file"); + Console.WriteLine(ex.Message); + return 100; + } + + if (sort_attr) { + if (string.IsNullOrEmpty(primary_attr)) { + primary_attr = "GUID"; + } + SortNodeAttrs(doc.DocumentElement); + } + if (sort_node) { + SortNodes(doc.DocumentElement); + } + + if (outf.Length == 0 && overwriteSelf) { + outf = inf; + } + + if (outf.Length > 0) { + try { + doc.Save(outf); + } catch (Exception ex) { + Console.WriteLine("**** Could not save output file"); + Console.WriteLine(ex.Message); + return 101; + } + } else { + doc.Save(Console.Out); + } + + if (pause) { + Console.Write("Press any key to quit: "); + Console.ReadKey(true); + Console.WriteLine(); + } + + return 0; + } + + static void SortNodes( XmlNode node ) + { + // Go down to the furthest child and start there.. + // That is so I can include child nodes in the current node's sort, + // if all of it's attributes match.. + for (int i = 0, len = node.ChildNodes.Count; i < len; i++) { + SortNodes(node.ChildNodes[i]); + } + + // Remove, sort, then re-add the node's children. + if (sort_node && node.ChildNodes != null && node.ChildNodes.Count > 0) { + var nodes = new List(node.ChildNodes.Count); + + for (var i = node.ChildNodes.Count - 1; i >= 0; i--) { + nodes.Add(node.ChildNodes[i]); + node.RemoveChild(node.ChildNodes[i]); + } + + nodes.Sort(SortDelegate); + + for (var i = 0; i < nodes.Count; i++) { + node.AppendChild(nodes[i]); + } + } + } + + static int SortDelegate( XmlNode a, XmlNode b ) + { + var result = string.Compare(a.Name, b.Name, sort_node_comp); + + // NOTE: Always sort the _nodes_ based on its attributes (when the + // name matches), but don't actually sort the node's attributes. + // Sorting attributes, if specified, is done before node sorting happens.. + + if (result == 0) { + var col1 = (a.Attributes.Count >= b.Attributes.Count) ? a.Attributes : b.Attributes; + var col2 = (a.Attributes.Count >= b.Attributes.Count) ? b.Attributes : a.Attributes; + + for (var i = 0; i < col1.Count; i++) { + if (i < col2.Count) { + var aa = col1[i]; + var bb = col2[i]; + result = string.Compare(aa.Name, bb.Name, sort_attr_comp); + if (result == 0) { + result = string.Compare(aa.Value, bb.Value, sort_attr_comp); + if (result != 0) { + return result; + } + // Attribute name and value match.. continue loop. + } else { + return result; + } + } else { + return 1; + } + } + + // If we get here, that means that the node's attributes (and values) all match.. + // TODO: Should we go down into the child node collections for sorting? + // See example `c.xml`.. + //Console.WriteLine(a.Name + "==" + b.Name + " all attributes matched"); + } + + return result; + } + + static void SortNodeAttrs( XmlNode node ) + { + // Remove, sort, then re-add the node's attributes. + if (sort_attr && node.Attributes != null && node.Attributes.Count > 0) { + SortXmlAttributeCollection(node.Attributes); + } + + // Sort the children node's attributes also. + for (int i = 0, len = node.ChildNodes.Count; i < len; i++) { + SortNodeAttrs(node.ChildNodes[i]); + } + } + + static void SortXmlAttributeCollection( XmlAttributeCollection col ) + { + // Remove, sort, then re-add the attributes to the collection. + if (sort_attr && col != null && col.Count > 0) { + var attrs = new List(col.Count); + + for (var i = col.Count - 1; i >= 0; i--) { + attrs.Add(col[i]); + col.RemoveAt(i); + } + + SortAttributeList(attrs); + + for (var i = 0; i < attrs.Count; i++) { + col.Append(attrs[i]); + } + } + } + + static void SortAttributeList( List attrs ) + { + attrs.Sort(delegate ( XmlAttribute a, XmlAttribute b ) { + var result = string.Compare(a.Name, b.Name, sort_attr_comp); + if (result == 0) { + return string.Compare(a.Value, b.Value, sort_attr_comp); + } else if (!string.IsNullOrEmpty(primary_attr)) { + // If a primary_attr is specified, it is always made the first attribute! + if (a.Name.Equals(primary_attr, sort_attr_comp)) { + return -1; + } else if (b.Name.Equals(primary_attr, sort_attr_comp)) { + return 1; + } + } + return result; + }); + } + + static void usage() + { + Console.WriteLine("sortxml"); + Console.WriteLine(""); + Console.WriteLine("This is a small utility that sorts (and prettifies) xml files."); + Console.WriteLine("It uses the Microsoft XML .NET namespace."); + Console.WriteLine(""); + Console.WriteLine("Copyright (c) 2014-2020 Kody Brown (@wasatchwizard)"); + Console.WriteLine(""); + Console.WriteLine(" USAGE: sortxml.exe [options] infile [outfile]"); + Console.WriteLine(""); + Console.WriteLine(" infile The name of the file to sort, etc."); + Console.WriteLine(""); + Console.WriteLine(" outfile The name of the file to save the output to."); + Console.WriteLine(" If outfile is omitted, the output is written to stdout,"); + Console.WriteLine(" unless `--overwrite` is specified, in which case the"); + Console.WriteLine(" output is written back to infile, overwriting it."); + Console.WriteLine(""); + Console.WriteLine(" OPTIONS:"); + Console.WriteLine(""); + Console.WriteLine(" /p --pause Pauses when finished."); + Console.WriteLine(""); + Console.WriteLine(" --pretty Ignores the input format and makes the output look nice."); + Console.WriteLine(" This is the default."); + Console.WriteLine(""); + Console.WriteLine(" /s --sort Sort both the nodes and attributes."); + Console.WriteLine(" --sort-node Sort the nodes."); + Console.WriteLine(" --sort-attr Sort the attributes."); + Console.WriteLine(" If a sort is specified, '--pretty' is assumed."); + Console.WriteLine(" If a sort is NOT is specified, both nodes and attributes"); + Console.WriteLine(" will be sorted."); + Console.WriteLine(""); + Console.WriteLine(" /i --case-insensitive"); + Console.WriteLine(" Sorts node and attributes without regard to letter case."); + Console.WriteLine(" !i --case-sensitive"); + Console.WriteLine(" Sorts node and attributes case-sensitively."); + Console.WriteLine(" If neither option is specified, uses case-sensitive sort."); + Console.WriteLine(""); + Console.WriteLine(" --overwrite Writes back to the infile."); + Console.WriteLine(" Only used if outfile is not specified."); + Console.WriteLine(""); + Console.WriteLine(" Prefix an option with '!' to turn it off."); + Console.WriteLine(" The '!' can be applied with or without one of the other prefixes."); + Console.WriteLine(" The '/' and '--' prefixes are interchangable."); + Console.WriteLine(""); + Console.WriteLine("The default is to output pretty and sorted nodes and attributes:"); + Console.WriteLine(""); + Console.WriteLine(" > type sample.xml"); + Console.WriteLine(" "); + Console.WriteLine(""); + Console.WriteLine(" > sortxml.exe sample.xml"); + Console.WriteLine(" "); + Console.WriteLine(" "); + Console.WriteLine(" "); + Console.WriteLine(" "); + Console.WriteLine(" "); + + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs deleted file mode 100644 index 40e48c4..0000000 --- a/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("sortxml")] -[assembly: AssemblyDescription("sort xml files")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("sortxml")] -[assembly: AssemblyCopyright("Copyright (C) 2014 @wasatchwizard")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c56283ba-afbb-4b4c-b8be-2018bb239370")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Properties/PublishProfiles/any.pubxml b/Properties/PublishProfiles/any.pubxml new file mode 100644 index 0000000..e95e5ad --- /dev/null +++ b/Properties/PublishProfiles/any.pubxml @@ -0,0 +1,14 @@ + + + + + FileSystem + Release + Any CPU + netcoreapp3.1 + bin\Release\netcoreapp3.1\publish\ + false + + diff --git a/Properties/PublishProfiles/linux-arm.pubxml b/Properties/PublishProfiles/linux-arm.pubxml new file mode 100644 index 0000000..923eb5b --- /dev/null +++ b/Properties/PublishProfiles/linux-arm.pubxml @@ -0,0 +1,17 @@ + + + + + FileSystem + Release + Any CPU + netcoreapp3.1 + bin\Release\netcoreapp3.1\linux-arm\publish\ + linux-arm + false + False + False + + diff --git a/Properties/PublishProfiles/linux-x64.pubxml b/Properties/PublishProfiles/linux-x64.pubxml new file mode 100644 index 0000000..90d9ed3 --- /dev/null +++ b/Properties/PublishProfiles/linux-x64.pubxml @@ -0,0 +1,17 @@ + + + + + FileSystem + Release + x64 + netcoreapp3.1 + bin\Release\netcoreapp3.1\linux-x64\publish\ + linux-x64 + false + False + False + + diff --git a/Properties/PublishProfiles/macos-x64.pubxml b/Properties/PublishProfiles/macos-x64.pubxml new file mode 100644 index 0000000..062adb4 --- /dev/null +++ b/Properties/PublishProfiles/macos-x64.pubxml @@ -0,0 +1,17 @@ + + + + + FileSystem + Release + x64 + netcoreapp3.1 + bin\Release\netcoreapp3.1\macos-x64\publish\ + osx-x64 + false + False + False + + diff --git a/Properties/PublishProfiles/win-arm.pubxml b/Properties/PublishProfiles/win-arm.pubxml new file mode 100644 index 0000000..539d2f2 --- /dev/null +++ b/Properties/PublishProfiles/win-arm.pubxml @@ -0,0 +1,17 @@ + + + + + FileSystem + Release + Any CPU + netcoreapp3.1 + bin\Release\netcoreapp3.1\win-arm\publish\ + win-arm + false + True + True + + diff --git a/Properties/PublishProfiles/win-x64.pubxml b/Properties/PublishProfiles/win-x64.pubxml new file mode 100644 index 0000000..66fe643 --- /dev/null +++ b/Properties/PublishProfiles/win-x64.pubxml @@ -0,0 +1,17 @@ + + + + + FileSystem + Release + x64 + netcoreapp3.1 + bin\Release\netcoreapp3.1\win-x64\publish\ + win-x64 + false + True + True + + diff --git a/Properties/PublishProfiles/win-x86.pubxml b/Properties/PublishProfiles/win-x86.pubxml new file mode 100644 index 0000000..a14da98 --- /dev/null +++ b/Properties/PublishProfiles/win-x86.pubxml @@ -0,0 +1,17 @@ + + + + + FileSystem + Release + x86 + netcoreapp3.1 + bin\Release\netcoreapp3.1\win-x86\publish\ + win-x86 + false + True + True + + diff --git a/README.md b/README.md index 07073d4..613c775 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,81 @@ -sortxml -======= +# sortxml -This is a very simple utility that prettifies and sorts xml files. -It uses the Microsoft XML .NET namespace. +![dotnet-core-build](https://github.com/kodybrown/sortxml/workflows/dotnet-core-build/badge.svg) +![dotnet-core-release](https://github.com/kodybrown/sortxml/workflows/dotnet-core-release/badge.svg) -Copyright 2014 Kody Brown (@wasatchwizard) +Simple utility that sorts (and prettifies) xml files. It uses the Microsoft XML .NET namespace. - USAGE: sortxml.exe [options] infile [outfile] +---- - infile The name of the file to sort, etc. +## Build - outfile The name of the file to save the output to. - If outfile is omitted, the output is written to stdout, - unless `--overwrite` is specified, in which case the - output is written back to infile, overwriting it. +```powershell +dotnet build .\sortxml.csproj -c Debug /property:AssemblyVersion=$(GitVersion -ShowVariable SemVer) /property:Version=$(GitVersion -ShowVariable InformationalVersion) /property:FileVersion=$(GitVersion -ShowVariable SemVer) +dotnet publish .\sortxml.csproj -c Debug -r win-x64 /property:AssemblyVersion=$(GitVersion -ShowVariable SemVer) /property:Version=$(GitVersion -ShowVariable InformationalVersion) /property:FileVersion=$(GitVersion -ShowVariable SemVer) +``` - OPTIONS: +* Install GitVersion from here: https://github.com/GitTools/GitVersion/releases. +* Build platforms: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog. - /p --pause Pauses when finished. +## Code Format - --pretty Ignores the input format and makes the output look nice. - This is the default. +There is an .editorconfig and matching omnisharp.json file included. - /s --sort Sort both the nodes and attributes. - --sort-node Sort the nodes. - --sort-attr Sort the attributes. - If a sort is specified, '--pretty' is assumed. - If a sort is NOT is specified, both nodes and attributes - will be sorted. +Installing and using the dotnet format tool. - /i --case-insensitive - Sorts node and attributes without regard to letter case. - !i --case-sensitive - Sorts node and attributes case-sensitively. - If neither option is specified, uses case-sensitive sort. +```powershell +dotnet tool install -g dotnet-format +dotnet format -w sortxml.csproj +``` - --overwrite Writes back to the infile. - Only used if outfile is not specified. +## Usage - Prefix an option with '!' to turn it off. - The '!' can be applied with or without one of the other prefixes. - The '/' and '--' prefixes are interchangable. +```text +USAGE: sortxml.exe [options] infile [outfile] + + infile The name of the file to sort, etc. + + outfile The name of the file to save the output to. + If outfile is omitted, the output is written to stdout, + unless `--overwrite` is specified, in which case the + output is written back to infile, overwriting it. + +OPTIONS: + + /p --pause Pauses when finished. + + --pretty Ignores the input format and makes the output look nice. + This is the default. + + /s --sort Sort both the nodes and attributes. + --sort-node Sort the nodes. + --sort-attr Sort the attributes. + If a sort is specified, '--pretty' is assumed. + If a sort is NOT is specified, both nodes and attributes + will be sorted. + + /i --case-insensitive + Sorts node and attributes without regard to letter case. + !i --case-sensitive + Sorts node and attributes case-sensitively. + If neither option is specified, uses case-sensitive sort. + + --overwrite Writes back to the infile. + Only used if outfile is not specified. + +Prefix an option with '!' to turn it off. +The '!' can be applied with or without one of the other prefixes. +The '/' and '--' prefixes are interchangable. The default is to output pretty and sorted nodes and attributes: - > type sample.xml - +> type sample.xml + - > sortxml.exe sample.xml - - - - - +> sortxml.exe sample.xml + + + + + +``` diff --git a/omnisharp.json b/omnisharp.json new file mode 100644 index 0000000..fca1c96 --- /dev/null +++ b/omnisharp.json @@ -0,0 +1,52 @@ +{ + "FormattingOptions": { + "UseTabs": true, + "SpacingAfterMethodDeclarationName": false, + "SpaceWithinMethodDeclarationParenthesis": true, + "SpaceBetweenEmptyMethodDeclarationParentheses": false, + "SpaceAfterMethodCallName": false, + "SpaceWithinMethodCallParentheses": false, + "SpaceBetweenEmptyMethodCallParentheses": false, + "SpaceAfterControlFlowStatementKeyword": true, + "SpaceWithinExpressionParentheses": false, + "SpaceWithinCastParentheses": false, + "SpaceWithinOtherParentheses": false, + "SpaceAfterCast": false, + "SpacesIgnoreAroundVariableDeclaration": false, + "SpaceBeforeOpenSquareBracket": false, + "SpaceBetweenEmptySquareBrackets": false, + "SpaceWithinSquareBrackets": false, + "SpaceAfterColonInBaseTypeDeclaration": true, + "SpaceAfterComma": true, + "SpaceAfterDot": false, + "SpaceAfterSemicolonsInForStatement": true, + "SpaceBeforeColonInBaseTypeDeclaration": true, + "SpaceBeforeComma": false, + "SpaceBeforeDot": false, + "SpaceBeforeSemicolonsInForStatement": false, + "SpacingAroundBinaryOperator": "single", + "IndentBraces": false, + "IndentBlock": true, + "IndentSwitchSection": true, + "IndentSwitchCaseSection": true, + "IndentSwitchCaseSectionWhenBlock": true, + "LabelPositioning": "oneLess", + "WrappingPreserveSingleLine": true, + "WrappingKeepStatementsOnSingleLine": true, + "NewLinesForBracesInTypes": true, + "NewLinesForBracesInMethods": true, + "NewLinesForBracesInProperties": false, + "NewLinesForBracesInAccessors": false, + "NewLinesForBracesInAnonymousMethods": false, + "NewLinesForBracesInControlBlocks": false, + "NewLinesForBracesInAnonymousTypes": false, + "NewLinesForBracesInObjectCollectionArrayInitializers": false, + "NewLinesForBracesInLambdaExpressionBody": false, + "NewLineForElse": false, + "NewLineForCatch": false, + "NewLineForFinally": false, + "NewLineForMembersInObjectInit": false, + "NewLineForMembersInAnonymousTypes": false, + "NewLineForClausesInQuery": true + } +} diff --git a/sortxml.csproj b/sortxml.csproj index c41abc4..70753fb 100644 --- a/sortxml.csproj +++ b/sortxml.csproj @@ -1,65 +1,43 @@ - - - - - Debug - AnyCPU - {F015ED1D-89EF-4251-9788-D581536501F2} - Exe - Properties - sortxml - sortxml - v4.5 - 512 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - OnBuildSuccess - - - - - - - - - - - - - - - - - - - - - if exist "%25bin%25\$(TargetFileName)" xcopy "$(TargetPath)" "%25bin%25" /y - - - \ No newline at end of file + + + Exe + netcoreapp3.1 + sortxml + Bricksoft.PowerTools + sortxml + sortxml + 2.1.2005.3015 + Simple utility that sorts (and prettifies) xml files. + + thewizard@wasatchwizard.com + Copyright (c) 2014-2020 Kody Brown + https://github.com/kodybrown/sortxml + AnyCPU;x64;x86 + Bricksoft.sortxml + sortxml.Program + + + true + + + true + + + true + + + true + none + false + + + true + none + false + + + true + none + false + + diff --git a/sortxml.sln b/sortxml.sln index 4a106b9..ab31c1b 100644 --- a/sortxml.sln +++ b/sortxml.sln @@ -1,22 +1,34 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.30110.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sortxml", "sortxml.csproj", "{F015ED1D-89EF-4251-9788-D581536501F2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F015ED1D-89EF-4251-9788-D581536501F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F015ED1D-89EF-4251-9788-D581536501F2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F015ED1D-89EF-4251-9788-D581536501F2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F015ED1D-89EF-4251-9788-D581536501F2}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30104.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sortxml", "sortxml.csproj", "{F015ED1D-89EF-4251-9788-D581536501F2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F015ED1D-89EF-4251-9788-D581536501F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F015ED1D-89EF-4251-9788-D581536501F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F015ED1D-89EF-4251-9788-D581536501F2}.Debug|x64.ActiveCfg = Debug|x64 + {F015ED1D-89EF-4251-9788-D581536501F2}.Debug|x64.Build.0 = Debug|x64 + {F015ED1D-89EF-4251-9788-D581536501F2}.Debug|x86.ActiveCfg = Debug|x86 + {F015ED1D-89EF-4251-9788-D581536501F2}.Debug|x86.Build.0 = Debug|x86 + {F015ED1D-89EF-4251-9788-D581536501F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F015ED1D-89EF-4251-9788-D581536501F2}.Release|Any CPU.Build.0 = Release|Any CPU + {F015ED1D-89EF-4251-9788-D581536501F2}.Release|x64.ActiveCfg = Release|x64 + {F015ED1D-89EF-4251-9788-D581536501F2}.Release|x64.Build.0 = Release|x64 + {F015ED1D-89EF-4251-9788-D581536501F2}.Release|x86.ActiveCfg = Release|x86 + {F015ED1D-89EF-4251-9788-D581536501F2}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/test_files/b.xml b/test_files/b.xml new file mode 100644 index 0000000..e081cdb --- /dev/null +++ b/test_files/b.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + diff --git a/test_files/b_handsorted.xml b/test_files/b_handsorted.xml new file mode 100644 index 0000000..5f00fa9 --- /dev/null +++ b/test_files/b_handsorted.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + diff --git a/tests/b_sorted.xml b/test_files/b_sorted.xml similarity index 77% rename from tests/b_sorted.xml rename to test_files/b_sorted.xml index bc94277..1b2298a 100644 --- a/tests/b_sorted.xml +++ b/test_files/b_sorted.xml @@ -1,59 +1,59 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + \ No newline at end of file diff --git a/tests/c.xml b/test_files/c.xml similarity index 96% rename from tests/c.xml rename to test_files/c.xml index b14a61d..0651af8 100644 --- a/tests/c.xml +++ b/test_files/c.xml @@ -1,35 +1,35 @@ - - - -
- - SurroundsWith - - locgettext - Kody Brown - Outputs: Loc.GetText("") - - - ll -
- - - -
- -
- - Expansion - - return false - Kody Brown - Outputs: return false - - - rf -
- - - -
+ + + +
+ + SurroundsWith + + locgettext + Kody Brown + Outputs: Loc.GetText("") + + + ll +
+ + + +
+ +
+ + Expansion + + return false + Kody Brown + Outputs: return false + + + rf +
+ + + +
\ No newline at end of file diff --git a/tests/c_handsorted.xml b/test_files/c_handsorted.xml similarity index 96% rename from tests/c_handsorted.xml rename to test_files/c_handsorted.xml index 7cf02da..c44bfe6 100644 --- a/tests/c_handsorted.xml +++ b/test_files/c_handsorted.xml @@ -1,35 +1,35 @@ - - - -
- Kody Brown - Outputs: Loc.GetText("") - - - ll - - SurroundsWith - - locgettext -
- - - -
- -
- Kody Brown - Outputs: return false - - - rf - - Expansion - - return false -
- - - -
-
+ + + +
+ Kody Brown + Outputs: Loc.GetText("") + + + ll + + SurroundsWith + + locgettext +
+ + + +
+ +
+ Kody Brown + Outputs: return false + + + rf + + Expansion + + return false +
+ + + +
+
diff --git a/tests/c_sorted.xml b/test_files/c_sorted.xml similarity index 96% rename from tests/c_sorted.xml rename to test_files/c_sorted.xml index 718e7e5..dac82e7 100644 --- a/tests/c_sorted.xml +++ b/test_files/c_sorted.xml @@ -1,35 +1,35 @@ - - - -
- Kody Brown - Outputs: return false - - - rf - - Expansion - - return false -
- - - -
- -
- Kody Brown - Outputs: Loc.GetText("") - - - ll - - SurroundsWith - - locgettext -
- - - -
+ + + +
+ Kody Brown + Outputs: return false + + + rf + + Expansion + + return false +
+ + + +
+ +
+ Kody Brown + Outputs: Loc.GetText("") + + + ll + + SurroundsWith + + locgettext +
+ + + +
\ No newline at end of file diff --git a/tests/d.xml b/test_files/d.xml similarity index 96% rename from tests/d.xml rename to test_files/d.xml index a563c94..904d8c9 100644 --- a/tests/d.xml +++ b/test_files/d.xml @@ -1,54 +1,54 @@ - - - -
- Check if object is not null (if stmt) - Kody Brown - Check if object is not null (if stmt) - notnull - - Expansion - -
- - - - obj - The object to check for null. - objValue - - - - - - -
- - -
- Check if object is null (if stmt) - Kody Brown - Check if object is null (if stmt) - isnull - - Expansion - -
- - - - obj - The object to check for null. - objValue - - - - - - -
+ + + +
+ Check if object is not null (if stmt) + Kody Brown + Check if object is not null (if stmt) + notnull + + Expansion + +
+ + + + obj + The object to check for null. + objValue + + + + + + +
+ + +
+ Check if object is null (if stmt) + Kody Brown + Check if object is null (if stmt) + isnull + + Expansion + +
+ + + + obj + The object to check for null. + objValue + + + + + + +
\ No newline at end of file diff --git a/tests/d_handsorted.xml b/test_files/d_handsorted.xml similarity index 96% rename from tests/d_handsorted.xml rename to test_files/d_handsorted.xml index aed8d83..04f4b29 100644 --- a/tests/d_handsorted.xml +++ b/test_files/d_handsorted.xml @@ -1,53 +1,53 @@ - - - -
- Kody Brown - Check if object is not null (if stmt) - notnull - - Expansion - - Check if object is not null (if stmt) -
- - - - - - - objValue - obj - The object to check for null. - - - -
- -
- Kody Brown - Check if object is null (if stmt) - isnull - - Expansion - - Check if object is null (if stmt) -
- - - - - - - objValue - obj - The object to check for null. - - - -
-
+ + + +
+ Kody Brown + Check if object is not null (if stmt) + notnull + + Expansion + + Check if object is not null (if stmt) +
+ + + + + + + objValue + obj + The object to check for null. + + + +
+ +
+ Kody Brown + Check if object is null (if stmt) + isnull + + Expansion + + Check if object is null (if stmt) +
+ + + + + + + objValue + obj + The object to check for null. + + + +
+
diff --git a/tests/d_sorted.xml b/test_files/d_sorted.xml similarity index 96% rename from tests/d_sorted.xml rename to test_files/d_sorted.xml index e2656bd..c6ef071 100644 --- a/tests/d_sorted.xml +++ b/test_files/d_sorted.xml @@ -1,49 +1,49 @@ - - - -
- Kody Brown - Check if object is null (if stmt) - isnull - - Expansion - - Check if object is null (if stmt) -
- - - - - objValue - obj - The object to check for null. - - - -
- -
- Kody Brown - Check if object is not null (if stmt) - notnull - - Expansion - - Check if object is not null (if stmt) -
- - - - - objValue - obj - The object to check for null. - - - -
+ + + +
+ Kody Brown + Check if object is null (if stmt) + isnull + + Expansion + + Check if object is null (if stmt) +
+ + + + + objValue + obj + The object to check for null. + + + +
+ +
+ Kody Brown + Check if object is not null (if stmt) + notnull + + Expansion + + Check if object is not null (if stmt) +
+ + + + + objValue + obj + The object to check for null. + + + +
\ No newline at end of file diff --git a/tests/e.xml b/test_files/e.xml similarity index 96% rename from tests/e.xml rename to test_files/e.xml index 3db5440..3e63931 100644 --- a/tests/e.xml +++ b/test_files/e.xml @@ -1,40 +1,40 @@ - - - -
- - Expansion - - return true - Kody Brown - Outputs: return true - - - rt -
- - - - - -
- - -
- - Expansion - - return false - Kody Brown - Outputs: return false - - - rf -
- - - - - -
+ + + +
+ + Expansion + + return true + Kody Brown + Outputs: return true + + + rt +
+ + + + + +
+ + +
+ + Expansion + + return false + Kody Brown + Outputs: return false + + + rf +
+ + + + + +
\ No newline at end of file diff --git a/tests/e_handsorted.xml b/test_files/e_handsorted.xml similarity index 96% rename from tests/e_handsorted.xml rename to test_files/e_handsorted.xml index 9fc7d6f..f81612d 100644 --- a/tests/e_handsorted.xml +++ b/test_files/e_handsorted.xml @@ -1,39 +1,39 @@ - - - -
- Kody Brown - Outputs: return true - - - rt - - Expansion - - return true -
- - - - - -
- -
- Kody Brown - Outputs: return false - - - rf - - Expansion - - return false -
- - - - - -
-
+ + + +
+ Kody Brown + Outputs: return true + + + rt + + Expansion + + return true +
+ + + + + +
+ +
+ Kody Brown + Outputs: return false + + + rf + + Expansion + + return false +
+ + + + + +
+
diff --git a/tests/e_sorted.xml b/test_files/e_sorted.xml similarity index 96% rename from tests/e_sorted.xml rename to test_files/e_sorted.xml index 2c78d01..6b61e8e 100644 --- a/tests/e_sorted.xml +++ b/test_files/e_sorted.xml @@ -1,35 +1,35 @@ - - - -
- Kody Brown - Outputs: return false - - - rf - - Expansion - - return false -
- - - -
- -
- Kody Brown - Outputs: return true - - - rt - - Expansion - - return true -
- - - -
+ + + +
+ Kody Brown + Outputs: return false + + + rf + + Expansion + + return false +
+ + + +
+ +
+ Kody Brown + Outputs: return true + + + rt + + Expansion + + return true +
+ + + +
\ No newline at end of file diff --git a/tests/f.xml b/test_files/f.xml similarity index 96% rename from tests/f.xml rename to test_files/f.xml index f170dd8..4a9837f 100644 --- a/tests/f.xml +++ b/test_files/f.xml @@ -1,98 +1,98 @@ - - - -
- Check if string is not null and not empty (trimmed) - Kody Brown - Check if string is not null and not empty (trimmed) - notnull - - Expansion - -
- - - - str - The variable to check for null and length. - strValue - - - - - - -
- - -
- Check if string is null or empty (trimmed) - Kody Brown - Check if string is null or empty (trimmed) - isnull - - Expansion - -
- - - - str - The variable to check for null and length. - strValue - - - - - - -
- - -
- Check if string is not null and not empty - Kody Brown - Check if string is non-null and not empty - notnull - - Expansion - -
- - - - str - The variable to check for null and length. - strValue - - - - - - -
- - -
- Check if string is null or empty - Kody Brown - Check if string is null or empty - isnull - - Expansion - -
- - - - str - The variable to check for null and length. - strValue - - - - - - -
+ + + +
+ Check if string is not null and not empty (trimmed) + Kody Brown + Check if string is not null and not empty (trimmed) + notnull + + Expansion + +
+ + + + str + The variable to check for null and length. + strValue + + + + + + +
+ + +
+ Check if string is null or empty (trimmed) + Kody Brown + Check if string is null or empty (trimmed) + isnull + + Expansion + +
+ + + + str + The variable to check for null and length. + strValue + + + + + + +
+ + +
+ Check if string is not null and not empty + Kody Brown + Check if string is non-null and not empty + notnull + + Expansion + +
+ + + + str + The variable to check for null and length. + strValue + + + + + + +
+ + +
+ Check if string is null or empty + Kody Brown + Check if string is null or empty + isnull + + Expansion + +
+ + + + str + The variable to check for null and length. + strValue + + + + + + +
\ No newline at end of file diff --git a/tests/f_handsorted.xml b/test_files/f_handsorted.xml similarity index 97% rename from tests/f_handsorted.xml rename to test_files/f_handsorted.xml index 622240b..2818a92 100644 --- a/tests/f_handsorted.xml +++ b/test_files/f_handsorted.xml @@ -1,87 +1,87 @@ - - - -
- Kody Brown - Check if string is not null and not empty (trimmed) - notnull - - Expansion - - Check if string is not null and not empty (trimmed) -
- - - - - strValue - str - The variable to check for null and length. - - - -
- -
- Kody Brown - Check if string is null or empty (trimmed) - isnull - - Expansion - - Check if string is null or empty (trimmed) -
- - - - - strValue - str - The variable to check for null and length. - - - -
- -
- Kody Brown - Check if string is non-null and not empty - notnull - - Expansion - - Check if string is not null and not empty -
- - - - - strValue - str - The variable to check for null and length. - - - -
- -
- Kody Brown - Check if string is null or empty - isnull - - Expansion - - Check if string is null or empty -
- - - - - strValue - str - The variable to check for null and length. - - - -
-
+ + + +
+ Kody Brown + Check if string is not null and not empty (trimmed) + notnull + + Expansion + + Check if string is not null and not empty (trimmed) +
+ + + + + strValue + str + The variable to check for null and length. + + + +
+ +
+ Kody Brown + Check if string is null or empty (trimmed) + isnull + + Expansion + + Check if string is null or empty (trimmed) +
+ + + + + strValue + str + The variable to check for null and length. + + + +
+ +
+ Kody Brown + Check if string is non-null and not empty + notnull + + Expansion + + Check if string is not null and not empty +
+ + + + + strValue + str + The variable to check for null and length. + + + +
+ +
+ Kody Brown + Check if string is null or empty + isnull + + Expansion + + Check if string is null or empty +
+ + + + + strValue + str + The variable to check for null and length. + + + +
+
diff --git a/tests/f_sorted.xml b/test_files/f_sorted.xml similarity index 97% rename from tests/f_sorted.xml rename to test_files/f_sorted.xml index ed1944d..8de1821 100644 --- a/tests/f_sorted.xml +++ b/test_files/f_sorted.xml @@ -1,87 +1,87 @@ - - - -
- Kody Brown - Check if string is null or empty - isnull - - Expansion - - Check if string is null or empty -
- - - - - strValue - str - The variable to check for null and length. - - - -
- -
- Kody Brown - Check if string is non-null and not empty - notnull - - Expansion - - Check if string is not null and not empty -
- - - - - strValue - str - The variable to check for null and length. - - - -
- -
- Kody Brown - Check if string is null or empty (trimmed) - isnull - - Expansion - - Check if string is null or empty (trimmed) -
- - - - - strValue - str - The variable to check for null and length. - - - -
- -
- Kody Brown - Check if string is not null and not empty (trimmed) - notnull - - Expansion - - Check if string is not null and not empty (trimmed) -
- - - - - strValue - str - The variable to check for null and length. - - - -
+ + + +
+ Kody Brown + Check if string is null or empty + isnull + + Expansion + + Check if string is null or empty +
+ + + + + strValue + str + The variable to check for null and length. + + + +
+ +
+ Kody Brown + Check if string is non-null and not empty + notnull + + Expansion + + Check if string is not null and not empty +
+ + + + + strValue + str + The variable to check for null and length. + + + +
+ +
+ Kody Brown + Check if string is null or empty (trimmed) + isnull + + Expansion + + Check if string is null or empty (trimmed) +
+ + + + + strValue + str + The variable to check for null and length. + + + +
+ +
+ Kody Brown + Check if string is not null and not empty (trimmed) + notnull + + Expansion + + Check if string is not null and not empty (trimmed) +
+ + + + + strValue + str + The variable to check for null and length. + + + +
\ No newline at end of file diff --git a/test_files/g.xml b/test_files/g.xml new file mode 100644 index 0000000..e4350db --- /dev/null +++ b/test_files/g.xml @@ -0,0 +1,43 @@ + + + + + Check if string is null or empty (trimmed) + + + + + + + + + + Check if string is not null and not empty (trimmed) + + + + + + + + + + + + + + + Check if string is not null and not empty + + + + + Check if string is null or empty + + + + + + + + \ No newline at end of file diff --git a/test_files/g_handsorted.xml b/test_files/g_handsorted.xml new file mode 100644 index 0000000..000291f --- /dev/null +++ b/test_files/g_handsorted.xml @@ -0,0 +1,35 @@ + + + + + + + + Check if string is not null and not empty (trimmed) + + + + + + + + Check if string is null or empty (trimmed) + + + + + + + + Check if string is null or empty + + + + + + + + Check if string is not null and not empty + + + \ No newline at end of file diff --git a/test_files/g_sorted.xml b/test_files/g_sorted.xml new file mode 100644 index 0000000..0793b25 --- /dev/null +++ b/test_files/g_sorted.xml @@ -0,0 +1,35 @@ + + + + + + + + Check if string is null or empty + + + + + + + + Check if string is not null and not empty + + + + + + + + Check if string is not null and not empty (trimmed) + + + + + + + + Check if string is null or empty (trimmed) + + + \ No newline at end of file diff --git a/tests/b.xml b/tests/b.xml deleted file mode 100644 index 86875b5..0000000 --- a/tests/b.xml +++ /dev/null @@ -1,2 +0,0 @@ - -2 \ No newline at end of file diff --git a/tests/b_handsorted.xml b/tests/b_handsorted.xml deleted file mode 100644 index bc94277..0000000 --- a/tests/b_handsorted.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - - - - - - \ No newline at end of file