diff --git a/.editorconfig b/.editorconfig index 23f6e20f9..452e00f28 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,101 +1,30 @@ -# Remove the line below if you want to inherit .editorconfig settings from higher directories root = true - #### Core EditorConfig Options #### -# All files [*] -# General charset = utf-8 trim_trailing_whitespace = true -# Indentation and spacing indent_size = 4 -indent_style =tab +indent_style = tab tab_width = 4 -# New line preferences end_of_line = crlf insert_final_newline = true -dotnet_style_readonly_field=true:suggestion - -# Project files -[*.{csproj,targets,yml}] -indent_size = 2 -[NuGet.config] -indent_size = 2 +[*.yml] +intend_size = 2 +indent_style = space +insert_final_newline = false -# Solution files [*.sln] indent_style = tab tab_width = 4 -#### .NET Coding Conventions #### - -# C# files [*.cs] -csharp_style_namespace_declarations = file_scoped:error -dotnet_diagnostic.IDE0161.severity = error - -# Organize usings -dotnet_separate_import_directive_groups = true -dotnet_sort_system_directives_first = true - -# this. and Me. preferences -dotnet_style_qualification_for_event = true:warning -dotnet_style_qualification_for_field = true:warning -dotnet_style_qualification_for_method = true:warning -dotnet_style_qualification_for_property = true:warning - -# Language keywords vs BCL types preferences -dotnet_style_predefined_type_for_locals_parameters_members = true:error -dotnet_style_predefined_type_for_member_access = true:warning - -# Parentheses preferences -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion -dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:suggestion - -# Modifier preferences -dotnet_style_require_accessibility_modifiers = for_non_interface_members - -# Expression-level preferences -dotnet_style_coalesce_expression = true:warning -dotnet_style_collection_initializer = true -dotnet_style_explicit_tuple_names = true:warning -dotnet_style_null_propagation = true:warning -dotnet_style_object_initializer = true -dotnet_style_operator_placement_when_wrapping = beginning_of_line -dotnet_style_prefer_auto_properties = true:suggestion -dotnet_style_prefer_compound_assignment = true:warning -dotnet_style_prefer_conditional_expression_over_assignment = true:warning -dotnet_style_prefer_conditional_expression_over_return = true:warning -dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning -dotnet_style_prefer_inferred_tuple_names = true:warning -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:error -dotnet_style_prefer_simplified_boolean_expressions = true -dotnet_style_prefer_simplified_interpolation = true - -# Field preferences -dotnet_style_readonly_field = true:warning - -# Parameter preferences dotnet_code_quality_unused_parameters = non_public - -# Suppression preferences dotnet_remove_unnecessary_suppression_exclusions = none - -#### C# Coding Conventions #### - -# var preferences -csharp_style_var_elsewhere = true:suggestion -csharp_style_var_for_built_in_types = true:suggestion -csharp_style_var_when_type_is_apparent = true:warning - -# Expression-bodied members csharp_style_expression_bodied_accessors = when_on_single_line:warning csharp_style_expression_bodied_constructors = false:warning csharp_style_expression_bodied_indexers = when_on_single_line:warning @@ -104,26 +33,15 @@ csharp_style_expression_bodied_local_functions = when_on_single_line:warning csharp_style_expression_bodied_methods = when_on_single_line:warning csharp_style_expression_bodied_operators = when_on_single_line:warning csharp_style_expression_bodied_properties = when_on_single_line:warning - -# Pattern matching preferences csharp_style_pattern_matching_over_as_with_null_check = true:warning csharp_style_pattern_matching_over_is_with_cast_check = true:warning csharp_style_prefer_not_pattern = true:warning csharp_style_prefer_pattern_matching = false csharp_style_prefer_switch_expression = true - -# Null-checking preferences csharp_style_conditional_delegate_call = false - -# Modifier preferences csharp_prefer_static_local_function = true:warning -csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async - -# Code-block preferences csharp_prefer_braces = false:suggestion csharp_prefer_simple_using_statement = true - -# Expression-level preferences csharp_prefer_simple_default_expression = true:warning csharp_style_deconstructed_variable_declaration = true csharp_style_implicit_object_creation_when_type_is_apparent = true @@ -134,155 +52,3906 @@ csharp_style_prefer_range_operator = true csharp_style_throw_expression = false:warning csharp_style_unused_value_assignment_preference = discard_variable:silent csharp_style_unused_value_expression_statement_preference = discard_variable - -# 'using' directive preferences -csharp_using_directive_placement = outside_namespace:error - -#### C# Formatting Rules #### - -# New line preferences -csharp_new_line_before_catch = true -csharp_new_line_before_else = true -csharp_new_line_before_finally = true csharp_new_line_before_members_in_anonymous_types = true -csharp_new_line_before_members_in_object_initializers = true -csharp_new_line_before_open_brace = all -csharp_new_line_between_query_expression_clauses = true - -# Indentation preferences csharp_indent_block_contents = true -csharp_indent_braces = false csharp_indent_case_contents = true csharp_indent_case_contents_when_block = false csharp_indent_labels = one_less_than_current -csharp_indent_switch_labels = true - -# Space preferences -csharp_space_after_cast = false -csharp_space_after_colon_in_inheritance_clause = true -csharp_space_after_comma = true -csharp_space_after_dot = false -csharp_space_after_keywords_in_control_flow_statements = true -csharp_space_after_semicolon_in_for_statement = true -csharp_space_around_binary_operators = before_and_after -csharp_space_around_declaration_statements = ignore -csharp_space_before_colon_in_inheritance_clause = true -csharp_space_before_comma = false -csharp_space_before_dot = false -csharp_space_before_open_square_brackets = false -csharp_space_before_semicolon_in_for_statement = false -csharp_space_between_empty_square_brackets = false -csharp_space_between_method_call_empty_parameter_list_parentheses = false -csharp_space_between_method_call_name_and_opening_parenthesis = false -csharp_space_between_method_call_parameter_list_parentheses = false -csharp_space_between_method_declaration_empty_parameter_list_parentheses = false -csharp_space_between_method_declaration_name_and_open_parenthesis = false -csharp_space_between_method_declaration_parameter_list_parentheses = false -csharp_space_between_parentheses = false -csharp_space_between_square_brackets = false - -# Wrapping preferences -csharp_preserve_single_line_blocks = true csharp_preserve_single_line_statements = true - -#### Naming styles #### - -# Naming rules - dotnet_naming_rule.interface_should_be_begins_with_i.severity = error dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i - dotnet_naming_rule.private_static_readonly_fields_convention.severity = error dotnet_naming_rule.private_static_readonly_fields_convention.symbols = private_static_fields_readonly dotnet_naming_rule.private_static_readonly_fields_convention.style = private_static_camel_case - dotnet_naming_rule.private_static_fields_convention.severity = error dotnet_naming_rule.private_static_fields_convention.symbols = private_static_field_props dotnet_naming_rule.private_static_fields_convention.style = private_static_camel_case - dotnet_naming_rule.readonly.severity = error dotnet_naming_rule.readonly.symbols = readonly dotnet_naming_rule.readonly.style = underscore_prefixed_camel_case - dotnet_naming_rule.private_field_should_be_underscore_prefixed_camel_case.severity = error dotnet_naming_rule.private_field_should_be_underscore_prefixed_camel_case.symbols = private_fields dotnet_naming_rule.private_field_should_be_underscore_prefixed_camel_case.style = underscore_prefixed_camel_case - dotnet_naming_rule.types_should_be_pascal_case.severity = error dotnet_naming_rule.types_should_be_pascal_case.symbols = types dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case - dotnet_naming_rule.const_fields_should_be_all_upper.severity = error dotnet_naming_rule.const_fields_should_be_all_upper.symbols = const_fields dotnet_naming_rule.const_fields_should_be_all_upper.style = constant_style - dotnet_naming_rule.constants_should_be_upper_case.severity = error dotnet_naming_rule.constants_should_be_upper_case.symbols = constants dotnet_naming_rule.constants_should_be_upper_case.style = constant_style - dotnet_naming_rule.private_props_not_allowed.severity = error dotnet_naming_rule.private_props_not_allowed.symbols = private_prop dotnet_naming_rule.private_props_not_allowed.style = constant_style - -# Symbol specifications - dotnet_naming_symbols.interface.applicable_kinds = interface dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.interface.required_modifiers = - dotnet_naming_symbols.private_static_fields_readonly.applicable_kinds = field dotnet_naming_symbols.private_static_fields_readonly.applicable_accessibilities = private dotnet_naming_symbols.private_static_fields_readonly.required_modifiers = static, readonly - dotnet_naming_symbols.private_static_field_props.applicable_kinds = field, property dotnet_naming_symbols.private_static_field_props.applicable_accessibilities = private dotnet_naming_symbols.private_static_field_props.required_modifiers = static - dotnet_naming_symbols.private_prop.applicable_kinds = property dotnet_naming_symbols.private_prop.applicable_accessibilities = private dotnet_naming_symbols.private_prop.required_modifiers = - dotnet_naming_symbols.constants.applicable_kinds = field, local dotnet_naming_symbols.constants.required_modifiers = const - dotnet_naming_symbols.const_fields.applicable_kinds = field, property dotnet_naming_symbols.const_fields.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.const_fields.required_modifiers = const - dotnet_naming_symbols.readonly.applicable_kinds = field, property dotnet_naming_symbols.readonly.applicable_accessibilities = private dotnet_naming_symbols.readonly.required_modifiers = readonly - dotnet_naming_symbols.private_fields.applicable_kinds = field dotnet_naming_symbols.private_fields.applicable_accessibilities = private, private_protected dotnet_naming_symbols.private_fields.required_modifiers = - dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.types.required_modifiers = - -# Naming styles - dotnet_naming_style.pascal_case.required_prefix = dotnet_naming_style.pascal_case.required_suffix = dotnet_naming_style.pascal_case.word_separator = dotnet_naming_style.pascal_case.capitalization = pascal_case - dotnet_naming_style.begins_with_i.required_prefix = I dotnet_naming_style.begins_with_i.required_suffix = dotnet_naming_style.begins_with_i.word_separator = dotnet_naming_style.begins_with_i.capitalization = pascal_case - dotnet_naming_style.underscore_prefixed_camel_case.required_prefix = _ dotnet_naming_style.underscore_prefixed_camel_case.required_suffix = dotnet_naming_style.underscore_prefixed_camel_case.word_separator = dotnet_naming_style.underscore_prefixed_camel_case.capitalization = camel_case - dotnet_naming_style.private_static_camel_case.required_prefix = s_ dotnet_naming_style.private_static_camel_case.capitalization = camel_case - dotnet_naming_style.constant_style.required_prefix = dotnet_naming_style.constant_style.required_suffix = dotnet_naming_style.constant_style.word_separator = _ dotnet_naming_style.constant_style.capitalization = all_upper +csharp_indent_braces = false +csharp_indent_switch_labels = true +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all +csharp_new_line_between_query_expression_clauses = true +csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion +csharp_preserve_single_line_blocks = true +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false +csharp_style_namespace_declarations = file_scoped:error +csharp_style_prefer_utf8_string_literals = true:suggestion +csharp_style_var_elsewhere = true:suggestion +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:warning +csharp_using_directive_placement = outside_namespace:error +dotnet_diagnostic.ide0161.severity = error +dotnet_diagnostic.bc40000.severity = warning +dotnet_diagnostic.bc400005.severity = warning +dotnet_diagnostic.bc40008.severity = warning +dotnet_diagnostic.bc40056.severity = warning +dotnet_diagnostic.bc42016.severity = warning +dotnet_diagnostic.bc42024.severity = warning +dotnet_diagnostic.bc42025.severity = warning +dotnet_diagnostic.bc42104.severity = warning +dotnet_diagnostic.bc42105.severity = warning +dotnet_diagnostic.bc42106.severity = warning +dotnet_diagnostic.bc42107.severity = warning +dotnet_diagnostic.bc42304.severity = warning +dotnet_diagnostic.bc42309.severity = warning +dotnet_diagnostic.bc42322.severity = warning +dotnet_diagnostic.bc42349.severity = warning +dotnet_diagnostic.bc42353.severity = warning +dotnet_diagnostic.bc42354.severity = warning +dotnet_diagnostic.bc42355.severity = warning +dotnet_diagnostic.bc42356.severity = warning +dotnet_diagnostic.bc42358.severity = warning +dotnet_diagnostic.bc42504.severity = warning +dotnet_diagnostic.bc42505.severity = warning +dotnet_diagnostic.ca2252.severity = error +dotnet_diagnostic.cs0067.severity = warning +dotnet_diagnostic.cs0078.severity = warning +dotnet_diagnostic.cs0108.severity = warning +dotnet_diagnostic.cs0109.severity = warning +dotnet_diagnostic.cs0114.severity = warning +dotnet_diagnostic.cs0162.severity = warning +dotnet_diagnostic.cs0164.severity = warning +dotnet_diagnostic.cs0168.severity = warning +dotnet_diagnostic.cs0169.severity = warning +dotnet_diagnostic.cs0183.severity = warning +dotnet_diagnostic.cs0184.severity = warning +dotnet_diagnostic.cs0197.severity = warning +dotnet_diagnostic.cs0219.severity = warning +dotnet_diagnostic.cs0252.severity = warning +dotnet_diagnostic.cs0253.severity = warning +dotnet_diagnostic.cs0282.severity = warning +dotnet_diagnostic.cs0414.severity = warning +dotnet_diagnostic.cs0420.severity = warning +dotnet_diagnostic.cs0458.severity = warning +dotnet_diagnostic.cs0464.severity = warning +dotnet_diagnostic.cs0465.severity = warning +dotnet_diagnostic.cs0469.severity = warning +dotnet_diagnostic.cs0472.severity = warning +dotnet_diagnostic.cs0612.severity = warning +dotnet_diagnostic.cs0618.severity = warning +dotnet_diagnostic.cs0628.severity = warning +dotnet_diagnostic.cs0642.severity = warning +dotnet_diagnostic.cs0649.severity = warning +dotnet_diagnostic.cs0652.severity = warning +dotnet_diagnostic.cs0657.severity = warning +dotnet_diagnostic.cs0658.severity = warning +dotnet_diagnostic.cs0659.severity = warning +dotnet_diagnostic.cs0660.severity = warning +dotnet_diagnostic.cs0661.severity = warning +dotnet_diagnostic.cs0665.severity = warning +dotnet_diagnostic.cs0672.severity = warning +dotnet_diagnostic.cs0675.severity = warning +dotnet_diagnostic.cs0693.severity = warning +dotnet_diagnostic.cs1030.severity = warning +dotnet_diagnostic.cs1058.severity = warning +dotnet_diagnostic.cs1066.severity = warning +dotnet_diagnostic.cs1522.severity = warning +dotnet_diagnostic.cs1570.severity = warning +dotnet_diagnostic.cs1571.severity = warning +dotnet_diagnostic.cs1572.severity = warning +dotnet_diagnostic.cs1573.severity = warning +dotnet_diagnostic.cs1574.severity = warning +dotnet_diagnostic.cs1580.severity = warning +dotnet_diagnostic.cs1581.severity = warning +dotnet_diagnostic.cs1584.severity = warning +dotnet_diagnostic.cs1587.severity = warning +dotnet_diagnostic.cs1589.severity = warning +dotnet_diagnostic.cs1590.severity = warning +dotnet_diagnostic.cs1591.severity = warning +dotnet_diagnostic.cs1592.severity = warning +dotnet_diagnostic.cs1710.severity = warning +dotnet_diagnostic.cs1711.severity = warning +dotnet_diagnostic.cs1712.severity = warning +dotnet_diagnostic.cs1717.severity = warning +dotnet_diagnostic.cs1723.severity = warning +dotnet_diagnostic.cs1911.severity = warning +dotnet_diagnostic.cs1957.severity = warning +dotnet_diagnostic.cs1981.severity = warning +dotnet_diagnostic.cs1998.severity = warning +dotnet_diagnostic.cs4014.severity = warning +dotnet_diagnostic.cs7022.severity = warning +dotnet_diagnostic.cs7023.severity = warning +dotnet_diagnostic.cs7095.severity = warning +dotnet_diagnostic.cs8073.severity = warning +dotnet_diagnostic.cs8094.severity = warning +dotnet_diagnostic.cs8123.severity = warning +dotnet_diagnostic.cs8321.severity = warning +dotnet_diagnostic.cs8383.severity = warning +dotnet_diagnostic.cs8424.severity = warning +dotnet_diagnostic.cs8425.severity = warning +dotnet_diagnostic.cs8500.severity = warning +dotnet_diagnostic.cs8509.severity = warning +dotnet_diagnostic.cs8519.severity = warning +dotnet_diagnostic.cs8520.severity = warning +dotnet_diagnostic.cs8524.severity = warning +dotnet_diagnostic.cs8597.severity = warning +dotnet_diagnostic.cs8600.severity = warning +dotnet_diagnostic.cs8601.severity = warning +dotnet_diagnostic.cs8602.severity = warning +dotnet_diagnostic.cs8603.severity = warning +dotnet_diagnostic.cs8604.severity = warning +dotnet_diagnostic.cs8605.severity = warning +dotnet_diagnostic.cs8607.severity = warning +dotnet_diagnostic.cs8608.severity = warning +dotnet_diagnostic.cs8609.severity = warning +dotnet_diagnostic.cs8610.severity = warning +dotnet_diagnostic.cs8611.severity = warning +dotnet_diagnostic.cs8612.severity = warning +dotnet_diagnostic.cs8613.severity = warning +dotnet_diagnostic.cs8614.severity = warning +dotnet_diagnostic.cs8615.severity = warning +dotnet_diagnostic.cs8616.severity = warning +dotnet_diagnostic.cs8617.severity = warning +dotnet_diagnostic.cs8618.severity = warning +dotnet_diagnostic.cs8619.severity = warning +dotnet_diagnostic.cs8620.severity = warning +dotnet_diagnostic.cs8621.severity = warning +dotnet_diagnostic.cs8622.severity = warning +dotnet_diagnostic.cs8624.severity = warning +dotnet_diagnostic.cs8625.severity = warning +dotnet_diagnostic.cs8629.severity = warning +dotnet_diagnostic.cs8631.severity = warning +dotnet_diagnostic.cs8632.severity = warning +dotnet_diagnostic.cs8633.severity = warning +dotnet_diagnostic.cs8634.severity = warning +dotnet_diagnostic.cs8643.severity = warning +dotnet_diagnostic.cs8644.severity = warning +dotnet_diagnostic.cs8645.severity = warning +dotnet_diagnostic.cs8655.severity = warning +dotnet_diagnostic.cs8656.severity = warning +dotnet_diagnostic.cs8667.severity = warning +dotnet_diagnostic.cs8669.severity = warning +dotnet_diagnostic.cs8670.severity = warning +dotnet_diagnostic.cs8714.severity = warning +dotnet_diagnostic.cs8762.severity = warning +dotnet_diagnostic.cs8763.severity = warning +dotnet_diagnostic.cs8764.severity = warning +dotnet_diagnostic.cs8765.severity = warning +dotnet_diagnostic.cs8766.severity = warning +dotnet_diagnostic.cs8767.severity = warning +dotnet_diagnostic.cs8768.severity = warning +dotnet_diagnostic.cs8769.severity = warning +dotnet_diagnostic.cs8770.severity = warning +dotnet_diagnostic.cs8774.severity = warning +dotnet_diagnostic.cs8775.severity = warning +dotnet_diagnostic.cs8776.severity = warning +dotnet_diagnostic.cs8777.severity = warning +dotnet_diagnostic.cs8794.severity = warning +dotnet_diagnostic.cs8819.severity = warning +dotnet_diagnostic.cs8824.severity = warning +dotnet_diagnostic.cs8825.severity = warning +dotnet_diagnostic.cs8846.severity = warning +dotnet_diagnostic.cs8847.severity = warning +dotnet_diagnostic.cs8851.severity = warning +dotnet_diagnostic.cs8860.severity = warning +dotnet_diagnostic.cs8892.severity = warning +dotnet_diagnostic.cs8907.severity = warning +dotnet_diagnostic.cs8947.severity = warning +dotnet_diagnostic.cs8960.severity = warning +dotnet_diagnostic.cs8961.severity = warning +dotnet_diagnostic.cs8962.severity = warning +dotnet_diagnostic.cs8963.severity = warning +dotnet_diagnostic.cs8965.severity = warning +dotnet_diagnostic.cs8966.severity = warning +dotnet_diagnostic.cs8971.severity = warning +dotnet_diagnostic.cs8974.severity = warning +dotnet_diagnostic.cs8981.severity = warning +dotnet_diagnostic.cs9042.severity = warning +dotnet_diagnostic.cs9073.severity = warning +dotnet_diagnostic.cs9074.severity = warning +dotnet_diagnostic.cs9080.severity = warning +dotnet_diagnostic.cs9081.severity = warning +dotnet_diagnostic.cs9082.severity = warning +dotnet_diagnostic.cs9083.severity = warning +dotnet_diagnostic.cs9084.severity = warning +dotnet_diagnostic.cs9085.severity = warning +dotnet_diagnostic.cs9086.severity = warning +dotnet_diagnostic.cs9087.severity = warning +dotnet_diagnostic.cs9088.severity = warning +dotnet_diagnostic.cs9089.severity = warning +dotnet_diagnostic.cs9090.severity = warning +dotnet_diagnostic.cs9091.severity = warning +dotnet_diagnostic.cs9092.severity = warning +dotnet_diagnostic.cs9093.severity = warning +dotnet_diagnostic.cs9094.severity = warning +dotnet_diagnostic.cs9095.severity = warning +dotnet_diagnostic.cs9097.severity = warning +dotnet_diagnostic.cs9099.severity = warning +dotnet_diagnostic.cs9100.severity = warning +dotnet_diagnostic.cs9113.severity = warning +dotnet_diagnostic.wme006.severity = warning +dotnet_naming_rule.constants_rule.import_to_resharper = as_predefined +dotnet_naming_rule.constants_rule.severity = warning +dotnet_naming_rule.constants_rule.style = upper_camel_case_style +dotnet_naming_rule.constants_rule.symbols = constants_symbols +dotnet_naming_rule.event_rule.import_to_resharper = as_predefined +dotnet_naming_rule.event_rule.severity = warning +dotnet_naming_rule.event_rule.style = upper_camel_case_style +dotnet_naming_rule.event_rule.symbols = event_symbols +dotnet_naming_rule.interfaces_rule.import_to_resharper = as_predefined +dotnet_naming_rule.interfaces_rule.severity = warning +dotnet_naming_rule.interfaces_rule.style = i_upper_camel_case_style +dotnet_naming_rule.interfaces_rule.symbols = interfaces_symbols +dotnet_naming_rule.locals_rule.import_to_resharper = as_predefined +dotnet_naming_rule.locals_rule.severity = warning +dotnet_naming_rule.locals_rule.style = lower_camel_case_style_1 +dotnet_naming_rule.locals_rule.symbols = locals_symbols +dotnet_naming_rule.local_constants_rule.import_to_resharper = as_predefined +dotnet_naming_rule.local_constants_rule.severity = warning +dotnet_naming_rule.local_constants_rule.style = lower_camel_case_style_1 +dotnet_naming_rule.local_constants_rule.symbols = local_constants_symbols +dotnet_naming_rule.local_functions_rule.import_to_resharper = as_predefined +dotnet_naming_rule.local_functions_rule.severity = warning +dotnet_naming_rule.local_functions_rule.style = upper_camel_case_style +dotnet_naming_rule.local_functions_rule.symbols = local_functions_symbols +dotnet_naming_rule.method_rule.import_to_resharper = as_predefined +dotnet_naming_rule.method_rule.severity = warning +dotnet_naming_rule.method_rule.style = upper_camel_case_style +dotnet_naming_rule.method_rule.symbols = method_symbols +dotnet_naming_rule.parameters_rule.import_to_resharper = as_predefined +dotnet_naming_rule.parameters_rule.severity = warning +dotnet_naming_rule.parameters_rule.style = lower_camel_case_style_1 +dotnet_naming_rule.parameters_rule.symbols = parameters_symbols +dotnet_naming_rule.private_constants_rule.import_to_resharper = as_predefined +dotnet_naming_rule.private_constants_rule.severity = warning +dotnet_naming_rule.private_constants_rule.style = upper_camel_case_style +dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols +dotnet_naming_rule.private_instance_fields_rule.import_to_resharper = as_predefined +dotnet_naming_rule.private_instance_fields_rule.severity = warning +dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style +dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols +dotnet_naming_rule.private_props_not_allowed_rule.import_to_resharper = True +dotnet_naming_rule.private_props_not_allowed_rule.resharper_description = private_props_not_allowed +dotnet_naming_rule.private_props_not_allowed_rule.resharper_guid = 5463b36e-97e1-4c30-9cce-30a590ec863e +dotnet_naming_rule.private_props_not_allowed_rule.resharper_style = s_ + aaBb_AaBb, AA_BB +dotnet_naming_rule.private_props_not_allowed_rule.severity = warning +dotnet_naming_rule.private_props_not_allowed_rule.style = s_lower_camel_case_underscore_tolerant_style +dotnet_naming_rule.private_props_not_allowed_rule.symbols = private_props_not_allowed_symbols +dotnet_naming_rule.private_static_fields_rule.import_to_resharper = as_predefined +dotnet_naming_rule.private_static_fields_rule.severity = warning +dotnet_naming_rule.private_static_fields_rule.style = lower_camel_case_style +dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols +dotnet_naming_rule.private_static_readonly_rule.import_to_resharper = as_predefined +dotnet_naming_rule.private_static_readonly_rule.severity = warning +dotnet_naming_rule.private_static_readonly_rule.style = upper_camel_case_style +dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols +dotnet_naming_rule.property_rule.import_to_resharper = as_predefined +dotnet_naming_rule.property_rule.severity = warning +dotnet_naming_rule.property_rule.style = upper_camel_case_style +dotnet_naming_rule.property_rule.symbols = property_symbols +dotnet_naming_rule.public_fields_rule.import_to_resharper = as_predefined +dotnet_naming_rule.public_fields_rule.severity = warning +dotnet_naming_rule.public_fields_rule.style = upper_camel_case_style +dotnet_naming_rule.public_fields_rule.symbols = public_fields_symbols +dotnet_naming_rule.static_readonly_rule.import_to_resharper = as_predefined +dotnet_naming_rule.static_readonly_rule.severity = warning +dotnet_naming_rule.static_readonly_rule.style = upper_camel_case_style +dotnet_naming_rule.static_readonly_rule.symbols = static_readonly_symbols +dotnet_naming_rule.types_and_namespaces_rule.import_to_resharper = as_predefined +dotnet_naming_rule.types_and_namespaces_rule.severity = warning +dotnet_naming_rule.types_and_namespaces_rule.style = upper_camel_case_style +dotnet_naming_rule.types_and_namespaces_rule.symbols = types_and_namespaces_symbols +dotnet_naming_rule.type_parameters_rule.import_to_resharper = as_predefined +dotnet_naming_rule.type_parameters_rule.severity = warning +dotnet_naming_rule.type_parameters_rule.style = t_upper_camel_case_style +dotnet_naming_rule.type_parameters_rule.symbols = type_parameters_symbols +dotnet_naming_style.i_upper_camel_case_style.capitalization = pascal_case +dotnet_naming_style.i_upper_camel_case_style.required_prefix = I +dotnet_naming_style.lower_camel_case_style.capitalization = camel_case +dotnet_naming_style.lower_camel_case_style.required_prefix = _ +dotnet_naming_style.lower_camel_case_style_1.capitalization = camel_case +dotnet_naming_style.s_lower_camel_case_underscore_tolerant_style.capitalization = camel_case +dotnet_naming_style.s_lower_camel_case_underscore_tolerant_style.required_prefix = s_ +dotnet_naming_style.s_lower_camel_case_underscore_tolerant_style.word_separator = _ +dotnet_naming_style.t_upper_camel_case_style.capitalization = pascal_case +dotnet_naming_style.t_upper_camel_case_style.required_prefix = T +dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case +dotnet_naming_symbols.constants_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected +dotnet_naming_symbols.constants_symbols.applicable_kinds = field +dotnet_naming_symbols.constants_symbols.required_modifiers = const +dotnet_naming_symbols.event_symbols.applicable_accessibilities = * +dotnet_naming_symbols.event_symbols.applicable_kinds = event +dotnet_naming_symbols.interfaces_symbols.applicable_accessibilities = * +dotnet_naming_symbols.interfaces_symbols.applicable_kinds = interface +dotnet_naming_symbols.locals_symbols.applicable_accessibilities = * +dotnet_naming_symbols.locals_symbols.applicable_kinds = local +dotnet_naming_symbols.local_constants_symbols.applicable_accessibilities = * +dotnet_naming_symbols.local_constants_symbols.applicable_kinds = local +dotnet_naming_symbols.local_constants_symbols.required_modifiers = const +dotnet_naming_symbols.local_functions_symbols.applicable_accessibilities = * +dotnet_naming_symbols.local_functions_symbols.applicable_kinds = local_function +dotnet_naming_symbols.method_symbols.applicable_accessibilities = * +dotnet_naming_symbols.method_symbols.applicable_kinds = method +dotnet_naming_symbols.parameters_symbols.applicable_accessibilities = * +dotnet_naming_symbols.parameters_symbols.applicable_kinds = parameter +dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private +dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field +dotnet_naming_symbols.private_constants_symbols.required_modifiers = const +dotnet_naming_symbols.private_instance_fields_symbols.applicable_accessibilities = private +dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field +dotnet_naming_symbols.private_props_not_allowed_symbols.applicable_accessibilities = local,private +dotnet_naming_symbols.private_props_not_allowed_symbols.applicable_kinds = property +dotnet_naming_symbols.private_props_not_allowed_symbols.resharper_applicable_kinds = property +dotnet_naming_symbols.private_props_not_allowed_symbols.resharper_required_modifiers = any +dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private +dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field +dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static +dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private +dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field +dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static,readonly +dotnet_naming_symbols.property_symbols.applicable_accessibilities = * +dotnet_naming_symbols.property_symbols.applicable_kinds = property +dotnet_naming_symbols.public_fields_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected +dotnet_naming_symbols.public_fields_symbols.applicable_kinds = field +dotnet_naming_symbols.static_readonly_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected +dotnet_naming_symbols.static_readonly_symbols.applicable_kinds = field +dotnet_naming_symbols.static_readonly_symbols.required_modifiers = static,readonly +dotnet_naming_symbols.types_and_namespaces_symbols.applicable_accessibilities = * +dotnet_naming_symbols.types_and_namespaces_symbols.applicable_kinds = namespace,class,struct,enum,delegate +dotnet_naming_symbols.type_parameters_symbols.applicable_accessibilities = * +dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter +dotnet_separate_import_directive_groups = true +dotnet_sort_system_directives_first = true +dotnet_style_readonly_field = true:warning +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion +dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:suggestion +dotnet_style_predefined_type_for_locals_parameters_members = true:error +dotnet_style_predefined_type_for_member_access = true:warning +dotnet_style_qualification_for_event = true:warning +dotnet_style_qualification_for_field = true:warning +dotnet_style_qualification_for_method = true:warning +dotnet_style_qualification_for_property = true:warning +dotnet_style_require_accessibility_modifiers = for_non_interface_members +dotnet_style_coalesce_expression = true:warning +dotnet_style_collection_initializer = true +dotnet_style_explicit_tuple_names = true:warning +dotnet_style_null_propagation = true:warning +dotnet_style_object_initializer = true +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_prefer_compound_assignment = true:warning +dotnet_style_prefer_conditional_expression_over_assignment = true:warning +dotnet_style_prefer_conditional_expression_over_return = true:warning +dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning +dotnet_style_prefer_inferred_tuple_names = true:warning +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:error +dotnet_style_prefer_simplified_boolean_expressions = true +dotnet_style_prefer_simplified_interpolation = true +file_header_template = + +# ReSharper properties +resharper_accessor_owner_body = expression_body +resharper_alignment_tab_fill_style = use_spaces +resharper_align_linq_query = true +resharper_align_multiline_argument = false +resharper_align_multiline_array_and_object_initializer = false +resharper_align_multiline_array_initializer = false +resharper_align_multiline_binary_patterns = false +resharper_align_multiline_comments = true +resharper_align_multiline_ctor_init = true +resharper_align_multiline_expression = true +resharper_align_multiline_expression_braces = false +resharper_align_multiline_extends_list = false +resharper_align_multiline_implements_list = true +resharper_align_multiline_list_pattern = false +resharper_align_multiline_property_pattern = false +resharper_align_multiline_statement_conditions = false +resharper_align_multiline_switch_expression = false +resharper_align_multiline_type_argument = false +resharper_align_multiline_type_parameter = false +resharper_align_multline_type_parameter_constrains = false +resharper_align_multline_type_parameter_list = false +resharper_align_tuple_components = false +resharper_align_union_type_usage = true +resharper_allow_alias = true +resharper_allow_comment_after_lbrace = false +resharper_allow_far_alignment = false +resharper_always_use_end_of_line_brace_style = false +resharper_apply_auto_detected_rules = true +resharper_apply_on_completion = true +resharper_arguments_anonymous_function = positional +resharper_arguments_literal = positional +resharper_arguments_named = positional +resharper_arguments_other = positional +resharper_arguments_skip_single = false +resharper_arguments_string_literal = positional +resharper_attribute_style = do_not_touch +resharper_autodetect_indent_settings = true +resharper_blank_lines_after_access_specifier = 0 +resharper_blank_lines_after_block_statements = 1 +resharper_blank_lines_after_case = 0 +resharper_blank_lines_after_control_transfer_statements = 0 +resharper_blank_lines_after_file_scoped_namespace_directive = 1 +resharper_blank_lines_after_imports = 1 +resharper_blank_lines_after_multiline_statements = 0 +resharper_blank_lines_after_options = 1 +resharper_blank_lines_after_start_comment = 1 +resharper_blank_lines_after_using_list = 1 +resharper_blank_lines_around_accessor = 0 +resharper_blank_lines_around_auto_property = 1 +resharper_blank_lines_around_block_case_section = 0 +resharper_blank_lines_around_class_definition = 1 +resharper_blank_lines_around_field = 1 +resharper_blank_lines_around_function_declaration = 0 +resharper_blank_lines_around_function_definition = 1 +resharper_blank_lines_around_global_attribute = 1 +resharper_blank_lines_around_invocable = 1 +resharper_blank_lines_around_local_method = 1 +resharper_blank_lines_around_multiline_case_section = 0 +resharper_blank_lines_around_namespace = 1 +resharper_blank_lines_around_other_declaration = 0 +resharper_blank_lines_around_property = 1 +resharper_blank_lines_around_razor_functions = 1 +resharper_blank_lines_around_razor_helpers = 1 +resharper_blank_lines_around_razor_sections = 1 +resharper_blank_lines_around_region = 1 +resharper_blank_lines_around_single_line_accessor = 0 +resharper_blank_lines_around_single_line_auto_property = 0 +resharper_blank_lines_around_single_line_field = 0 +resharper_blank_lines_around_single_line_function_definition = 0 +resharper_blank_lines_around_single_line_invocable = 0 +resharper_blank_lines_around_single_line_local_method = 1 +resharper_blank_lines_around_single_line_property = 0 +resharper_blank_lines_around_single_line_type = 1 +resharper_blank_lines_around_type = 1 +resharper_blank_lines_before_access_specifier = 1 +resharper_blank_lines_before_block_statements = 0 +resharper_blank_lines_before_case = 0 +resharper_blank_lines_before_control_transfer_statements = 0 +resharper_blank_lines_before_multiline_statements = 0 +resharper_blank_lines_before_single_line_comment = 0 +resharper_blank_lines_inside_namespace = 0 +resharper_blank_lines_inside_region = 1 +resharper_blank_lines_inside_type = 0 +resharper_blank_line_after_pi = true +resharper_braces_for_dowhile = required +resharper_braces_for_fixed = required +resharper_braces_for_for = not_required +resharper_braces_for_foreach = not_required +resharper_braces_for_ifelse = not_required +resharper_braces_for_lock = required +resharper_braces_for_using = required +resharper_braces_for_while = not_required +resharper_braces_redundant = true +resharper_break_template_declaration = line_break +resharper_builtin_type_apply_to_native_integer = false +resharper_can_use_global_alias = false +resharper_configure_await_analysis_mode = disabled +resharper_constructor_or_destructor_body = block_body +resharper_continuous_indent_multiplier = 1 +resharper_continuous_line_indent = single +resharper_cpp_align_first_arg_by_paren = false +resharper_cpp_align_multiline_binary_expressions_chain = false +resharper_cpp_align_multiline_calls_chain = true +resharper_cpp_align_multiline_for_stmt = true +resharper_cpp_align_multiline_parameter = true +resharper_cpp_align_multiple_declaration = true +resharper_cpp_align_ternary = align_not_nested +resharper_cpp_anonymous_method_declaration_braces = next_line +resharper_cpp_case_block_braces = next_line_shifted_2 +resharper_cpp_empty_block_style = multiline +resharper_cpp_indent_switch_labels = false +resharper_cpp_invocable_declaration_braces = next_line +resharper_cpp_keep_blank_lines_in_declarations = 2 +resharper_cpp_max_line_length = 120 +resharper_cpp_new_line_before_catch = true +resharper_cpp_new_line_before_else = true +resharper_cpp_new_line_before_while = true +resharper_cpp_other_braces = next_line +resharper_cpp_space_after_unary_operator = false +resharper_cpp_space_around_binary_operator = true +resharper_cpp_type_declaration_braces = next_line +resharper_cpp_wrap_arguments_style = wrap_if_long +resharper_cpp_wrap_lines = true +resharper_cpp_wrap_parameters_style = wrap_if_long +resharper_csharp_align_first_arg_by_paren = false +resharper_csharp_align_multiline_binary_expressions_chain = true +resharper_csharp_align_multiline_calls_chain = false +resharper_csharp_align_multiline_for_stmt = false +resharper_csharp_align_multiline_parameter = false +resharper_csharp_align_multiple_declaration = false +resharper_csharp_empty_block_style = together +resharper_csharp_keep_blank_lines_in_declarations = 1 +resharper_csharp_max_line_length = 1000 +resharper_csharp_naming_rule.enum_member = AaBb +resharper_csharp_naming_rule.method_property_event = AaBb +resharper_csharp_naming_rule.other = AaBb +resharper_csharp_new_line_before_while = true +resharper_csharp_prefer_qualified_reference = false +resharper_csharp_space_after_unary_operator = false +resharper_csharp_stick_comment = false +resharper_csharp_wrap_arguments_style = wrap_if_long +resharper_csharp_wrap_chained_binary_expressions = wrap_if_long +resharper_csharp_wrap_lines = false +resharper_csharp_wrap_parameters_style = wrap_if_long +resharper_css_brace_style = end_of_line +resharper_css_keep_blank_lines_between_declarations = 1 +resharper_css_max_line_length = 120 +resharper_css_wrap_lines = true +resharper_cxxcli_property_declaration_braces = next_line +resharper_declarations_style = separate_lines +resharper_default_exception_variable_name = e +resharper_default_value_when_type_evident = default_literal +resharper_default_value_when_type_not_evident = default_literal +resharper_delete_quotes_from_solid_values = false +resharper_disable_blank_line_changes = false +resharper_disable_formatter = false +resharper_disable_indenter = false +resharper_disable_int_align = false +resharper_disable_line_break_changes = false +resharper_disable_line_break_removal = false +resharper_disable_space_changes = false +resharper_disable_space_changes_before_trailing_comment = false +resharper_dont_remove_extra_blank_lines = false +resharper_enable_wrapping = false +resharper_enforce_line_ending_style = true +resharper_event_handler_pattern_long = $object$On$event$ +resharper_event_handler_pattern_short = On$event$ +resharper_export_declaration_braces = next_line +resharper_expression_braces = inside +resharper_expression_pars = inside +resharper_extra_spaces = remove_all +resharper_force_attribute_style = join +resharper_force_chop_compound_do_expression = false +resharper_force_chop_compound_if_expression = false +resharper_force_chop_compound_while_expression = false +resharper_force_control_statements_braces = do_not_change +resharper_force_linebreaks_inside_complex_literals = true +resharper_force_variable_declarations_on_new_line = false +resharper_formatter_off_tag = +resharper_formatter_on_tag = +resharper_formatter_tags_accept_regexp = false +resharper_formatter_tags_enabled = false +resharper_format_leading_spaces_decl = false +resharper_free_block_braces = next_line +resharper_function_declaration_return_type_style = do_not_change +resharper_function_definition_return_type_style = do_not_change +resharper_generator_mode = false +resharper_html_attribute_indent = align_by_first_attribute +resharper_html_linebreak_before_elements = body,div,p,form,h1,h2,h3 +resharper_html_max_blank_lines_between_tags = 2 +resharper_html_max_line_length = 120 +resharper_html_pi_attribute_style = on_single_line +resharper_html_space_before_self_closing = false +resharper_html_wrap_lines = true +resharper_ignore_space_preservation = false +resharper_include_prefix_comment_in_indent = false +resharper_indent_access_specifiers_from_class = false +resharper_indent_aligned_ternary = true +resharper_indent_anonymous_method_block = false +resharper_indent_braces_inside_statement_conditions = true +resharper_indent_case_from_select = true +resharper_indent_child_elements = OneIndent +resharper_indent_class_members_from_access_specifiers = false +resharper_indent_comment = true +resharper_indent_export_declaration_members = true +resharper_indent_inside_namespace = true +resharper_indent_invocation_pars = inside +resharper_indent_left_par_inside_expression = false +resharper_indent_member_initializer_list = true +resharper_indent_method_decl_pars = inside +resharper_indent_nested_fixed_stmt = false +resharper_indent_nested_foreach_stmt = false +resharper_indent_nested_for_stmt = false +resharper_indent_nested_lock_stmt = false +resharper_indent_nested_usings_stmt = false +resharper_indent_nested_while_stmt = false +resharper_indent_pars = inside +resharper_align_first_arg_by_paren = false +resharper_csharp_align_multiline_argument = false +resharper_csharp_align_multiline_expression = false +resharper_csharp_align_multiline_extends_list = false +resharper_csharp_allow_far_alignment = true +resharper_csharp_keep_blank_lines_in_code = 1 +resharper_csharp_wrap_after_declaration_lpar = true +resharper_csharp_wrap_before_declaration_rpar = true +resharper_indent_preprocessor_directives = none +resharper_indent_preprocessor_if = no_indent +resharper_indent_preprocessor_other = no_indent +resharper_indent_preprocessor_region = no_indent +resharper_indent_raw_literal_string = indent +resharper_indent_statement_pars = inside +resharper_indent_text = OneIndent +resharper_indent_typearg_angles = inside +resharper_indent_typeparam_angles = inside +resharper_indent_type_constraints = true +resharper_indent_wrapped_function_names = false +resharper_instance_members_qualify_declared_in = this_class, base_class +resharper_int_align = false +resharper_int_align_bitfield_sizes = false +resharper_int_align_comments = false +resharper_int_align_declaration_names = false +resharper_int_align_enum_initializers = false +resharper_int_align_eq = false +resharper_int_align_fix_in_adjacent = true +resharper_js_align_multiline_parameter = false +resharper_js_align_multiple_declaration = false +resharper_js_align_ternary = none +resharper_js_brace_style = end_of_line +resharper_js_empty_block_style = multiline +resharper_js_indent_switch_labels = false +resharper_js_keep_blank_lines_between_declarations = 2 +resharper_js_max_line_length = 120 +resharper_js_new_line_before_catch = false +resharper_js_new_line_before_else = false +resharper_js_new_line_before_finally = false +resharper_js_new_line_before_while = false +resharper_js_space_around_binary_operator = true +resharper_js_stick_comment = true +resharper_js_wrap_arguments_style = chop_if_long +resharper_js_wrap_chained_binary_expressions = chop_if_long +resharper_js_wrap_lines = true +resharper_js_wrap_parameters_style = chop_if_long +resharper_keep_blank_lines_in_code = 2 +resharper_keep_existing_attribute_arrangement = false +resharper_keep_existing_declaration_block_arrangement = false +resharper_keep_existing_declaration_parens_arrangement = true +resharper_keep_existing_embedded_arrangement = true +resharper_keep_existing_embedded_block_arrangement = false +resharper_keep_existing_enum_arrangement = false +resharper_keep_existing_expr_member_arrangement = true +resharper_keep_existing_invocation_parens_arrangement = true +resharper_keep_existing_list_patterns_arrangement = false +resharper_keep_existing_property_patterns_arrangement = false +resharper_keep_existing_switch_expression_arrangement = true +resharper_keep_nontrivial_alias = true +resharper_keep_user_linebreaks = true +resharper_keep_user_wrapping = true +resharper_linebreaks_around_razor_statements = true +resharper_linebreaks_inside_tags_for_elements_longer_than = 2147483647 +resharper_linebreaks_inside_tags_for_elements_with_child_elements = true +resharper_linebreaks_inside_tags_for_multiline_elements = true +resharper_linebreak_before_all_elements = false +resharper_linebreak_before_multiline_elements = true +resharper_linebreak_before_singleline_elements = false +resharper_line_break_after_colon_in_member_initializer_lists = do_not_change +resharper_line_break_after_comma_in_member_initializer_lists = false +resharper_line_break_after_init_statement = do_not_change +resharper_line_break_before_comma_in_member_initializer_lists = false +resharper_line_break_before_requires_clause = do_not_change +resharper_linkage_specification_braces = end_of_line +resharper_linkage_specification_indentation = none +resharper_local_function_body = expression_body +resharper_macro_block_begin = +resharper_macro_block_end = +resharper_max_array_initializer_elements_on_line = 10000 +resharper_max_attribute_length_for_same_line = 50 +resharper_max_enum_members_on_line = 3 +resharper_max_formal_parameters_on_line = 10000 +resharper_max_initializer_elements_on_line = 5 +resharper_max_invocation_arguments_on_line = 10000 +resharper_media_query_style = same_line +resharper_member_initializer_list_style = do_not_change +resharper_method_or_operator_body = expression_body +resharper_min_blank_lines_after_imports = 0 +resharper_min_blank_lines_around_fields = 0 +resharper_min_blank_lines_around_functions = 1 +resharper_min_blank_lines_around_types = 1 +resharper_min_blank_lines_between_declarations = 1 +resharper_namespace_declaration_braces = next_line +resharper_namespace_indentation = all +resharper_nested_ternary_style = expanded +resharper_new_line_before_enumerators = true +resharper_normalize_tag_names = false +resharper_no_indent_inside_elements = html,body,thead,tbody,tfoot +resharper_no_indent_inside_if_element_longer_than = 200 +resharper_null_checking_pattern_style = not_null_pattern +resharper_object_creation_when_type_evident = target_typed +resharper_object_creation_when_type_not_evident = target_typed +resharper_old_engine = false +resharper_options_braces_pointy = false +resharper_outdent_binary_ops = false +resharper_outdent_binary_pattern_ops = false +resharper_outdent_commas = false +resharper_outdent_dots = false +resharper_outdent_namespace_member = false +resharper_outdent_statement_labels = false +resharper_outdent_ternary_ops = false +resharper_parentheses_non_obvious_operations = none, shift, bitwise_and, bitwise_exclusive_or, bitwise_inclusive_or, bitwise +resharper_parentheses_redundancy_style = remove_if_not_clarifies_precedence +resharper_parentheses_same_type_operations = false +resharper_pi_attributes_indent = align_by_first_attribute +resharper_place_accessorholder_attribute_on_same_line = false +resharper_place_accessor_attribute_on_same_line = false +resharper_place_class_decorator_on_the_same_line = false +resharper_place_comments_at_first_column = false +resharper_place_constructor_initializer_on_same_line = false +resharper_place_each_decorator_on_new_line = false +resharper_place_event_attribute_on_same_line = false +resharper_place_expr_accessor_on_single_line = true +resharper_place_expr_method_on_single_line = false +resharper_place_expr_property_on_single_line = false +resharper_place_field_attribute_on_same_line = false +resharper_place_field_decorator_on_the_same_line = false +resharper_place_linq_into_on_new_line = true +resharper_place_method_attribute_on_same_line = false +resharper_place_method_decorator_on_the_same_line = false +resharper_place_namespace_definitions_on_same_line = false +resharper_place_property_attribute_on_same_line = false +resharper_place_property_decorator_on_the_same_line = false +resharper_place_record_field_attribute_on_same_line = true +resharper_place_simple_case_statement_on_same_line = false +resharper_place_simple_embedded_statement_on_same_line = false +resharper_place_simple_initializer_on_single_line = true +resharper_place_simple_list_pattern_on_single_line = true +resharper_place_simple_property_pattern_on_single_line = true +resharper_place_simple_switch_expression_on_single_line = false +resharper_place_template_args_on_new_line = false +resharper_place_type_attribute_on_same_line = false +resharper_place_type_constraints_on_same_line = true +resharper_prefer_explicit_discard_declaration = false +resharper_prefer_separate_deconstructed_variables_declaration = false +resharper_preserve_spaces_inside_tags = pre,textarea +resharper_properties_style = separate_lines_for_nonsingle +resharper_protobuf_brace_style = end_of_line +resharper_protobuf_empty_block_style = together_same_line +resharper_protobuf_max_line_length = 120 +resharper_protobuf_wrap_lines = true +resharper_qualified_using_at_nested_scope = false +resharper_quote_style = doublequoted +resharper_razor_prefer_qualified_reference = true +resharper_remove_blank_lines_near_braces = false +resharper_remove_blank_lines_near_braces_in_code = true +resharper_remove_blank_lines_near_braces_in_declarations = true +resharper_remove_this_qualifier = true +resharper_requires_expression_braces = next_line +resharper_resx_attribute_indent = single_indent +resharper_resx_linebreak_before_elements = +resharper_resx_max_blank_lines_between_tags = 0 +resharper_resx_max_line_length = 2147483647 +resharper_resx_pi_attribute_style = do_not_touch +resharper_resx_space_before_self_closing = false +resharper_resx_wrap_lines = false +resharper_resx_wrap_tags_and_pi = false +resharper_resx_wrap_text = false +resharper_selector_style = same_line +resharper_show_autodetect_configure_formatting_tip = false +resharper_simple_blocks = do_not_change +resharper_simple_block_style = do_not_change +resharper_simple_case_statement_style = do_not_change +resharper_simple_embedded_statement_style = do_not_change +resharper_single_statement_function_style = do_not_change +resharper_sort_attributes = false +resharper_sort_class_selectors = false +resharper_sort_usings = true +resharper_sort_usings_lowercase_first = false +resharper_spaces_around_eq_in_attribute = false +resharper_spaces_around_eq_in_pi_attribute = false +resharper_spaces_inside_tags = false +resharper_space_after_arrow = true +resharper_space_after_attributes = true +resharper_space_after_attribute_target_colon = true +resharper_space_after_cast = false +resharper_space_after_colon = true +resharper_space_after_colon_in_bitfield_declarator = true +resharper_space_after_colon_in_case = true +resharper_space_after_colon_in_inheritance_clause = true +resharper_space_after_colon_in_type_annotation = true +resharper_space_after_comma = true +resharper_space_after_ellipsis_in_parameter_pack = true +resharper_space_after_for_colon = true +resharper_space_after_function_comma = true +resharper_space_after_keywords_in_control_flow_statements = true +resharper_space_after_last_attribute = false +resharper_space_after_last_pi_attribute = false +resharper_space_after_media_colon = true +resharper_space_after_media_comma = true +resharper_space_after_operator_keyword = true +resharper_space_after_operator_not = false +resharper_space_after_property_colon = true +resharper_space_after_property_semicolon = true +resharper_space_after_ptr_in_data_member = true +resharper_space_after_ptr_in_data_members = false +resharper_space_after_ptr_in_method = true +resharper_space_after_ptr_in_nested_declarator = false +resharper_space_after_ref_in_data_member = true +resharper_space_after_ref_in_data_members = false +resharper_space_after_ref_in_method = true +resharper_space_after_selector_comma = true +resharper_space_after_semicolon_in_for_statement = true +resharper_space_after_separator = false +resharper_space_after_ternary_colon = true +resharper_space_after_ternary_quest = true +resharper_space_after_triple_slash = true +resharper_space_after_type_parameter_constraint_colon = true +resharper_space_around_additive_op = true +resharper_space_around_alias_eq = true +resharper_space_around_assignment_op = true +resharper_space_around_assignment_operator = true +resharper_space_around_attribute_match_operator = false +resharper_space_around_deref_in_trailing_return_type = true +resharper_space_around_lambda_arrow = true +resharper_space_around_member_access_operator = false +resharper_space_around_operator = true +resharper_space_around_pipe_or_amper_in_type_usage = true +resharper_space_around_relational_op = true +resharper_space_around_selector_operator = true +resharper_space_around_shift_op = true +resharper_space_around_stmt_colon = true +resharper_space_around_ternary_operator = true +resharper_space_before_array_rank_parentheses = false +resharper_space_before_arrow = true +resharper_space_before_attribute_target_colon = false +resharper_space_before_checked_parentheses = false +resharper_space_before_colon = false +resharper_space_before_colon_in_bitfield_declarator = true +resharper_space_before_colon_in_case = false +resharper_space_before_colon_in_inheritance_clause = true +resharper_space_before_colon_in_type_annotation = false +resharper_space_before_comma = false +resharper_space_before_default_parentheses = false +resharper_space_before_ellipsis_in_parameter_pack = false +resharper_space_before_empty_invocation_parentheses = false +resharper_space_before_empty_method_parentheses = false +resharper_space_before_for_colon = true +resharper_space_before_function_comma = false +resharper_space_before_initializer_braces = false +resharper_space_before_invocation_parentheses = false +resharper_space_before_label_colon = false +resharper_space_before_lambda_parentheses = false +resharper_space_before_media_colon = false +resharper_space_before_media_comma = false +resharper_space_before_method_parentheses = false +resharper_space_before_nameof_parentheses = false +resharper_space_before_new_parentheses = false +resharper_space_before_nullable_mark = false +resharper_space_before_open_square_brackets = false +resharper_space_before_pointer_asterik_declaration = false +resharper_space_before_postfix_operator = false +resharper_space_before_property_colon = false +resharper_space_before_property_semicolon = false +resharper_space_before_ptr_in_abstract_decl = false +resharper_space_before_ptr_in_data_member = false +resharper_space_before_ptr_in_data_members = true +resharper_space_before_ptr_in_method = false +resharper_space_before_ref_in_abstract_decl = false +resharper_space_before_ref_in_data_member = false +resharper_space_before_ref_in_data_members = true +resharper_space_before_ref_in_method = false +resharper_space_before_selector_comma = false +resharper_space_before_semicolon = false +resharper_space_before_semicolon_in_for_statement = false +resharper_space_before_separator = false +resharper_space_before_singleline_accessorholder = true +resharper_space_before_sizeof_parentheses = false +resharper_space_before_template_args = false +resharper_space_before_template_params = true +resharper_space_before_ternary_colon = true +resharper_space_before_ternary_quest = true +resharper_space_before_trailing_comment = true +resharper_space_before_typeof_parentheses = false +resharper_space_before_type_argument_angle = false +resharper_space_before_type_parameters_brackets = false +resharper_space_before_type_parameter_angle = false +resharper_space_before_type_parameter_constraint_colon = true +resharper_space_before_type_parameter_parentheses = true +resharper_space_between_accessors_in_singleline_property = true +resharper_space_between_attribute_sections = true +resharper_space_between_closing_angle_brackets_in_template_args = false +resharper_space_between_empty_square_brackets = false +resharper_space_between_keyword_and_expression = true +resharper_space_between_keyword_and_type = true +resharper_space_between_method_call_empty_parameter_list_parentheses = false +resharper_space_between_method_call_name_and_opening_parenthesis = false +resharper_space_between_method_call_parameter_list_parentheses = false +resharper_space_between_method_declaration_empty_parameter_list_parentheses = false +resharper_space_between_method_declaration_name_and_open_parenthesis = false +resharper_space_between_method_declaration_parameter_list_parentheses = false +resharper_space_between_parentheses_of_control_flow_statements = false +resharper_space_between_square_brackets = false +resharper_space_between_typecast_parentheses = false +resharper_space_colon_after = true +resharper_space_colon_before = false +resharper_space_comma = true +resharper_space_equals = true +resharper_space_inside_braces = true +resharper_space_in_singleline_accessorholder = true +resharper_space_in_singleline_anonymous_method = true +resharper_space_in_singleline_method = true +resharper_space_near_postfix_and_prefix_op = false +resharper_space_within_array_initialization_braces = false +resharper_space_within_array_rank_empty_parentheses = false +resharper_space_within_array_rank_parentheses = false +resharper_space_within_attribute_angles = false +resharper_space_within_attribute_match_brackets = false +resharper_space_within_checked_parentheses = false +resharper_space_within_declaration_parentheses = false +resharper_space_within_default_parentheses = false +resharper_space_within_empty_braces = true +resharper_space_within_empty_initializer_braces = false +resharper_space_within_empty_invocation_parentheses = false +resharper_space_within_empty_method_parentheses = false +resharper_space_within_empty_object_literal_braces = false +resharper_space_within_empty_template_params = false +resharper_space_within_expression_parentheses = false +resharper_space_within_function_parentheses = false +resharper_space_within_import_braces = true +resharper_space_within_initializer_braces = false +resharper_space_within_invocation_parentheses = false +resharper_space_within_media_block = true +resharper_space_within_media_parentheses = false +resharper_space_within_method_parentheses = false +resharper_space_within_nameof_parentheses = false +resharper_space_within_new_parentheses = false +resharper_space_within_object_literal_braces = true +resharper_space_within_parentheses = false +resharper_space_within_property_block = true +resharper_space_within_single_line_array_initializer_braces = true +resharper_space_within_sizeof_parentheses = false +resharper_space_within_slice_pattern = true +resharper_space_within_template_args = false +resharper_space_within_template_argument = false +resharper_space_within_template_params = false +resharper_space_within_tuple_parentheses = false +resharper_space_within_typeof_parentheses = false +resharper_space_within_type_argument_angles = false +resharper_space_within_type_parameters_brackets = false +resharper_space_within_type_parameter_angles = false +resharper_space_within_type_parameter_parentheses = false +resharper_special_else_if_treatment = true +resharper_static_members_qualify_members = none +resharper_static_members_qualify_with = declared_type +resharper_support_vs_event_naming_pattern = true +resharper_termination_style = ensure_semicolon +resharper_toplevel_function_declaration_return_type_style = do_not_change +resharper_toplevel_function_definition_return_type_style = do_not_change +resharper_trailing_comma_in_multiline_lists = false +resharper_trailing_comma_in_singleline_lists = false +resharper_types_braces = end_of_line +resharper_use_continuous_indent_inside_initializer_braces = true +resharper_use_continuous_indent_inside_parens = true +resharper_use_continuous_line_indent_in_expression_braces = false +resharper_use_continuous_line_indent_in_method_pars = false +resharper_use_heuristics_for_body_style = true +resharper_use_indents_from_main_language_in_file = true +resharper_use_indent_from_previous_element = true +resharper_use_indent_from_vs = false +resharper_use_roslyn_logic_for_evident_types = true +resharper_vb_align_multiline_parameter = true +resharper_vb_align_multiple_declaration = true +resharper_vb_keep_blank_lines_in_declarations = 2 +resharper_vb_max_line_length = 120 +resharper_vb_place_field_attribute_on_same_line = true +resharper_vb_place_method_attribute_on_same_line = false +resharper_vb_place_type_attribute_on_same_line = false +resharper_vb_prefer_qualified_reference = false +resharper_vb_space_after_unary_operator = true +resharper_vb_space_around_multiplicative_op = false +resharper_vb_stick_comment = true +resharper_vb_wrap_arguments_style = wrap_if_long +resharper_vb_wrap_lines = true +resharper_vb_wrap_parameters_style = wrap_if_long +resharper_wrap_after_binary_opsign = true +resharper_wrap_after_declaration_lpar = false +resharper_wrap_after_dot = false +resharper_wrap_after_dot_in_method_calls = false +resharper_wrap_after_expression_lbrace = true +resharper_wrap_after_invocation_lpar = false +resharper_wrap_after_property_in_chained_method_calls = false +resharper_wrap_around_elements = true +resharper_wrap_array_initializer_style = chop_if_long +resharper_wrap_array_literals = chop_if_long +resharper_wrap_base_clause_style = wrap_if_long +resharper_wrap_before_arrow_with_expressions = true +resharper_wrap_before_binary_opsign = false +resharper_wrap_before_binary_pattern_op = true +resharper_wrap_before_colon = false +resharper_wrap_before_comma = false +resharper_wrap_before_comma_in_base_clause = false +resharper_wrap_before_declaration_lpar = false +resharper_wrap_before_declaration_rpar = false +resharper_wrap_before_dot = true +resharper_wrap_before_eq = false +resharper_wrap_before_expression_rbrace = true +resharper_wrap_before_extends_colon = false +resharper_wrap_before_first_method_call = false +resharper_wrap_before_first_type_parameter_constraint = false +resharper_wrap_before_invocation_lpar = false +resharper_wrap_before_invocation_rpar = false +resharper_wrap_before_linq_expression = false +resharper_wrap_before_ternary_opsigns = true +resharper_wrap_before_type_parameter_langle = false +resharper_wrap_braced_init_list_style = wrap_if_long +resharper_wrap_chained_binary_patterns = wrap_if_long +resharper_wrap_chained_method_calls = wrap_if_long +resharper_wrap_ctor_initializer_style = wrap_if_long +resharper_wrap_enumeration_style = chop_if_long +resharper_wrap_enum_declaration = chop_always +resharper_wrap_enum_style = do_not_change +resharper_wrap_extends_list_style = wrap_if_long +resharper_wrap_for_stmt_header_style = chop_if_long +resharper_wrap_imports = chop_if_long +resharper_wrap_list_pattern = wrap_if_long +resharper_wrap_multiple_declaration_style = chop_if_long +resharper_wrap_multiple_type_parameter_constraints_style = chop_if_long +resharper_wrap_object_and_collection_initializer_style = chop_always +resharper_wrap_object_literals = chop_if_long +resharper_wrap_property_pattern = chop_if_long +resharper_wrap_switch_expression = chop_always +resharper_wrap_ternary_expr_style = chop_if_long +resharper_wrap_union_type_usage = chop_if_long +resharper_wrap_verbatim_interpolated_strings = no_wrap +resharper_xmldoc_attribute_indent = single_indent +resharper_xmldoc_linebreak_before_elements = summary,remarks,example,returns,param,typeparam,value,para +resharper_xmldoc_max_blank_lines_between_tags = 0 +resharper_xmldoc_max_line_length = 120 +resharper_xmldoc_pi_attribute_style = do_not_touch +resharper_xmldoc_space_before_self_closing = true +resharper_xmldoc_wrap_lines = true +resharper_xmldoc_wrap_tags_and_pi = true +resharper_xmldoc_wrap_text = true +resharper_xml_attribute_indent = align_by_first_attribute +resharper_xml_linebreak_before_elements = +resharper_xml_max_blank_lines_between_tags = 2 +resharper_xml_max_line_length = 120 +resharper_xml_pi_attribute_style = do_not_touch +resharper_xml_space_before_self_closing = true +resharper_xml_wrap_lines = true +resharper_xml_wrap_tags_and_pi = true +resharper_xml_wrap_text = false + +# ReSharper inspection severities +resharper_abstract_class_constructor_can_be_made_protected_highlighting = hint +resharper_access_rights_in_text_highlighting = warning +resharper_access_to_disposed_closure_highlighting = warning +resharper_access_to_for_each_variable_in_closure_highlighting = warning +resharper_access_to_modified_closure_highlighting = warning +resharper_access_to_static_member_via_derived_type_highlighting = warning +resharper_address_of_marshal_by_ref_object_highlighting = warning +resharper_all_underscore_local_parameter_name_highlighting = warning +resharper_amd_dependency_path_problem_highlighting = none +resharper_amd_external_module_highlighting = suggestion +resharper_angular_html_banana_highlighting = warning +resharper_annotate_can_be_null_parameter_highlighting = none +resharper_annotate_can_be_null_type_member_highlighting = none +resharper_annotate_not_null_parameter_highlighting = none +resharper_annotate_not_null_type_member_highlighting = none +resharper_annotation_conflict_in_hierarchy_highlighting = warning +resharper_annotation_redundancy_at_value_type_highlighting = warning +resharper_annotation_redundancy_in_hierarchy_highlighting = warning +resharper_anonymous_object_destructuring_problem_highlighting = warning +resharper_arguments_style_anonymous_function_highlighting = none +resharper_arguments_style_literal_highlighting = none +resharper_arguments_style_named_expression_highlighting = none +resharper_arguments_style_other_highlighting = none +resharper_arguments_style_string_literal_highlighting = none +resharper_arrange_accessor_owner_body_highlighting = suggestion +resharper_arrange_attributes_highlighting = warning +resharper_arrange_constructor_or_destructor_body_highlighting = none +resharper_arrange_default_value_when_type_evident_highlighting = suggestion +resharper_arrange_default_value_when_type_not_evident_highlighting = hint +resharper_arrange_local_function_body_highlighting = none +resharper_arrange_method_or_operator_body_highlighting = none +resharper_arrange_null_checking_pattern_highlighting = hint +resharper_arrange_object_creation_when_type_evident_highlighting = suggestion +resharper_arrange_object_creation_when_type_not_evident_highlighting = hint +resharper_arrange_redundant_parentheses_highlighting = hint +resharper_arrange_static_member_qualifier_highlighting = hint +resharper_arrange_this_qualifier_highlighting = hint +resharper_arrange_trailing_comma_in_multiline_lists_highlighting = hint +resharper_arrange_trailing_comma_in_singleline_lists_highlighting = hint +resharper_arrange_type_member_modifiers_highlighting = hint +resharper_arrange_type_modifiers_highlighting = hint +resharper_arrange_var_keywords_in_deconstructing_declaration_highlighting = suggestion +resharper_asp_content_placeholder_not_resolved_highlighting = error +resharper_asp_custom_page_parser_filter_type_highlighting = warning +resharper_asp_dead_code_highlighting = warning +resharper_asp_entity_highlighting = warning +resharper_asp_image_highlighting = warning +resharper_asp_invalid_control_type_highlighting = error +resharper_asp_not_resolved_highlighting = error +resharper_asp_ods_method_reference_resolve_error_highlighting = error +resharper_asp_resolve_warning_highlighting = warning +resharper_asp_skin_not_resolved_highlighting = error +resharper_asp_tag_attribute_with_optional_value_highlighting = warning +resharper_asp_theme_not_resolved_highlighting = error +resharper_asp_unused_register_directive_highlighting_highlighting = warning +resharper_asp_warning_highlighting = warning +resharper_assigned_value_is_never_used_highlighting = warning +resharper_assigned_value_wont_be_assigned_to_corresponding_field_highlighting = warning +resharper_assignment_instead_of_discard_highlighting = warning +resharper_assignment_in_conditional_expression_highlighting = warning +resharper_assignment_in_condition_expression_highlighting = warning +resharper_assignment_is_fully_discarded_highlighting = warning +resharper_assign_null_to_not_null_attribute_highlighting = warning +resharper_assign_to_constant_highlighting = error +resharper_assign_to_implicit_global_in_function_scope_highlighting = warning +resharper_asxx_path_error_highlighting = warning +resharper_async_converter_async_await_may_be_elided_highlighting_highlighting = none +resharper_async_converter_async_method_naming_highlighting_highlighting = warning +resharper_async_converter_async_wait_highlighting = hint +resharper_async_converter_configure_await_highlighting_highlighting = none +resharper_async_converter_null_return_as_task_highlighting = warning +resharper_async_iterator_invocation_without_await_foreach_highlighting = warning +resharper_async_void_lambda_highlighting = warning +resharper_async_void_method_highlighting = none +resharper_auto_property_can_be_made_get_only_global_highlighting = suggestion +resharper_auto_property_can_be_made_get_only_local_highlighting = suggestion +resharper_bad_attribute_brackets_spaces_highlighting = warning +resharper_bad_braces_spaces_highlighting = warning +resharper_bad_child_statement_indent_highlighting = warning +resharper_bad_colon_spaces_highlighting = warning +resharper_bad_comma_spaces_highlighting = warning +resharper_bad_control_braces_indent_highlighting = warning +resharper_bad_control_braces_line_breaks_highlighting = warning +resharper_bad_declaration_braces_indent_highlighting = warning +resharper_bad_declaration_braces_line_breaks_highlighting = warning +resharper_bad_empty_braces_line_breaks_highlighting = none +resharper_bad_expression_braces_indent_highlighting = warning +resharper_bad_expression_braces_line_breaks_highlighting = warning +resharper_bad_generic_brackets_spaces_highlighting = warning +resharper_bad_indent_highlighting = warning +resharper_bad_linq_line_breaks_highlighting = warning +resharper_bad_list_line_breaks_highlighting = warning +resharper_bad_member_access_spaces_highlighting = warning +resharper_bad_namespace_braces_indent_highlighting = warning +resharper_bad_parens_line_breaks_highlighting = warning +resharper_bad_parens_spaces_highlighting = warning +resharper_bad_preprocessor_indent_highlighting = warning +resharper_bad_semicolon_spaces_highlighting = warning +resharper_bad_spaces_after_keyword_highlighting = warning +resharper_bad_square_brackets_spaces_highlighting = warning +resharper_bad_switch_braces_indent_highlighting = warning +resharper_bad_symbol_spaces_highlighting = warning +resharper_base_member_has_params_highlighting = warning +resharper_base_method_call_with_default_parameter_highlighting = warning +resharper_base_object_equals_is_object_equals_highlighting = warning +resharper_base_object_get_hash_code_call_in_get_hash_code_highlighting = warning +resharper_bitwise_operator_on_enum_without_flags_highlighting = warning +resharper_blazor_editor_required_highlighting = warning +resharper_block_scope_redeclaration_highlighting = error +resharper_built_in_type_reference_style_for_member_access_highlighting = hint +resharper_built_in_type_reference_style_highlighting = hint +resharper_by_ref_argument_is_volatile_field_highlighting = warning +resharper_caller_callee_using_error_highlighting = error +resharper_caller_callee_using_highlighting = warning +resharper_cannot_apply_equality_operator_to_type_highlighting = warning +resharper_can_simplify_dictionary_lookup_with_try_add_highlighting = warning +resharper_can_simplify_dictionary_lookup_with_try_get_value_highlighting = warning +resharper_catch_all_clause_highlighting = none +resharper_center_tag_is_obsolete_highlighting = warning +resharper_check_for_reference_equality_instead_1_highlighting = suggestion +resharper_check_for_reference_equality_instead_2_highlighting = suggestion +resharper_check_for_reference_equality_instead_3_highlighting = suggestion +resharper_check_for_reference_equality_instead_4_highlighting = suggestion +resharper_check_namespace_highlighting = warning +resharper_class_cannot_be_instantiated_highlighting = warning +resharper_class_can_be_sealed_global_highlighting = hint +resharper_class_can_be_sealed_local_highlighting = hint +resharper_class_highlighting = suggestion +resharper_class_never_instantiated_global_highlighting = none +resharper_class_never_instantiated_local_highlighting = suggestion +resharper_class_with_virtual_members_never_inherited_global_highlighting = suggestion +resharper_class_with_virtual_members_never_inherited_local_highlighting = suggestion +resharper_clear_attribute_is_obsolete_all_highlighting = warning +resharper_clear_attribute_is_obsolete_highlighting = warning +resharper_closure_on_modified_variable_highlighting = warning +resharper_coerced_equals_using_highlighting = warning +resharper_coerced_equals_using_with_null_undefined_highlighting = none +resharper_collection_never_queried_global_highlighting = warning +resharper_collection_never_queried_local_highlighting = warning +resharper_collection_never_updated_global_highlighting = warning +resharper_collection_never_updated_local_highlighting = warning +resharper_comma_not_valid_here_highlighting = error +resharper_comment_typo_highlighting = none +resharper_common_js_external_module_highlighting = suggestion +resharper_compare_non_constrained_generic_with_null_highlighting = none +resharper_compare_of_floats_by_equality_operator_highlighting = warning +resharper_complex_object_destructuring_problem_highlighting = warning +resharper_complex_object_in_context_destructuring_problem_highlighting = warning +resharper_conditional_access_qualifier_is_non_nullable_according_to_api_contract_highlighting = warning +resharper_conditional_ternary_equal_branch_highlighting = warning +resharper_condition_is_always_const_highlighting = warning +resharper_condition_is_always_true_or_false_according_to_nullable_api_contract_highlighting = warning +resharper_condition_is_always_true_or_false_highlighting = hint +resharper_confusing_char_as_integer_in_constructor_highlighting = warning +resharper_constant_conditional_access_qualifier_highlighting = warning +resharper_constant_null_coalescing_condition_highlighting = warning +resharper_consteval_if_is_always_constant_highlighting = warning +resharper_constructor_call_not_used_highlighting = warning +resharper_constructor_initializer_loop_highlighting = warning +resharper_container_annotation_redundancy_highlighting = warning +resharper_contextual_logger_problem_highlighting = warning +resharper_context_value_is_provided_highlighting = none +resharper_contract_annotation_not_parsed_highlighting = warning +resharper_convert_closure_to_method_group_highlighting = suggestion +resharper_convert_conditional_ternary_expression_to_switch_expression_highlighting = hint +resharper_convert_constructor_to_member_initializers_highlighting = suggestion +resharper_convert_if_do_to_while_highlighting = suggestion +resharper_convert_if_statement_to_conditional_ternary_expression_highlighting = suggestion +resharper_convert_if_statement_to_null_coalescing_assignment_highlighting = suggestion +resharper_convert_if_statement_to_null_coalescing_expression_highlighting = suggestion +resharper_convert_if_statement_to_return_statement_highlighting = hint +resharper_convert_if_statement_to_switch_statement_highlighting = hint +resharper_convert_if_to_or_expression_highlighting = suggestion +resharper_convert_nullable_to_short_form_highlighting = suggestion +resharper_convert_switch_statement_to_switch_expression_highlighting = hint +resharper_convert_to_auto_property_highlighting = suggestion +resharper_convert_to_auto_property_when_possible_highlighting = hint +resharper_convert_to_auto_property_with_private_setter_highlighting = hint +resharper_convert_to_compound_assignment_highlighting = hint +resharper_convert_to_constant_global_highlighting = hint +resharper_convert_to_constant_local_highlighting = none +resharper_convert_to_lambda_expression_highlighting = suggestion +resharper_convert_to_local_function_highlighting = suggestion +resharper_convert_to_null_coalescing_compound_assignment_highlighting = suggestion +resharper_convert_to_primary_constructor_highlighting = suggestion +resharper_convert_to_static_class_highlighting = suggestion +resharper_convert_to_using_declaration_highlighting = suggestion +resharper_convert_to_vb_auto_property_highlighting = suggestion +resharper_convert_to_vb_auto_property_when_possible_highlighting = hint +resharper_convert_to_vb_auto_property_with_private_setter_highlighting = hint +resharper_convert_type_check_pattern_to_null_check_highlighting = warning +resharper_convert_type_check_to_null_check_highlighting = warning +resharper_co_variant_array_conversion_highlighting = warning +resharper_cpp_abstract_class_without_specifier_highlighting = warning +resharper_cpp_abstract_final_class_highlighting = warning +resharper_cpp_abstract_virtual_function_call_in_ctor_highlighting = error +resharper_cpp_access_specifier_with_no_declarations_highlighting = suggestion +resharper_cpp_assigned_value_is_never_used_highlighting = warning +resharper_cpp_awaiter_type_is_not_class_highlighting = warning +resharper_cpp_bad_angle_brackets_spaces_highlighting = none +resharper_cpp_bad_braces_spaces_highlighting = none +resharper_cpp_bad_child_statement_indent_highlighting = none +resharper_cpp_bad_colon_spaces_highlighting = none +resharper_cpp_bad_comma_spaces_highlighting = none +resharper_cpp_bad_control_braces_indent_highlighting = none +resharper_cpp_bad_control_braces_line_breaks_highlighting = none +resharper_cpp_bad_declaration_braces_indent_highlighting = none +resharper_cpp_bad_declaration_braces_line_breaks_highlighting = none +resharper_cpp_bad_empty_braces_line_breaks_highlighting = none +resharper_cpp_bad_expression_braces_indent_highlighting = none +resharper_cpp_bad_expression_braces_line_breaks_highlighting = none +resharper_cpp_bad_indent_highlighting = none +resharper_cpp_bad_list_line_breaks_highlighting = none +resharper_cpp_bad_member_access_spaces_highlighting = none +resharper_cpp_bad_namespace_braces_indent_highlighting = none +resharper_cpp_bad_parens_line_breaks_highlighting = none +resharper_cpp_bad_parens_spaces_highlighting = none +resharper_cpp_bad_semicolon_spaces_highlighting = none +resharper_cpp_bad_spaces_after_keyword_highlighting = none +resharper_cpp_bad_square_brackets_spaces_highlighting = none +resharper_cpp_bad_switch_braces_indent_highlighting = none +resharper_cpp_bad_symbol_spaces_highlighting = none +resharper_cpp_boolean_increment_expression_highlighting = warning +resharper_cpp_boost_format_bad_code_highlighting = warning +resharper_cpp_boost_format_legacy_code_highlighting = suggestion +resharper_cpp_boost_format_mixed_args_highlighting = error +resharper_cpp_boost_format_too_few_args_highlighting = error +resharper_cpp_boost_format_too_many_args_highlighting = warning +resharper_cpp_clang_tidy_abseil_cleanup_ctad_highlighting = none +resharper_cpp_clang_tidy_abseil_duration_addition_highlighting = none +resharper_cpp_clang_tidy_abseil_duration_comparison_highlighting = none +resharper_cpp_clang_tidy_abseil_duration_conversion_cast_highlighting = none +resharper_cpp_clang_tidy_abseil_duration_division_highlighting = none +resharper_cpp_clang_tidy_abseil_duration_factory_float_highlighting = none +resharper_cpp_clang_tidy_abseil_duration_factory_scale_highlighting = none +resharper_cpp_clang_tidy_abseil_duration_subtraction_highlighting = none +resharper_cpp_clang_tidy_abseil_duration_unnecessary_conversion_highlighting = none +resharper_cpp_clang_tidy_abseil_faster_strsplit_delimiter_highlighting = none +resharper_cpp_clang_tidy_abseil_no_internal_dependencies_highlighting = none +resharper_cpp_clang_tidy_abseil_no_namespace_highlighting = none +resharper_cpp_clang_tidy_abseil_redundant_strcat_calls_highlighting = none +resharper_cpp_clang_tidy_abseil_string_find_startswith_highlighting = none +resharper_cpp_clang_tidy_abseil_string_find_str_contains_highlighting = none +resharper_cpp_clang_tidy_abseil_str_cat_append_highlighting = none +resharper_cpp_clang_tidy_abseil_time_comparison_highlighting = none +resharper_cpp_clang_tidy_abseil_time_subtraction_highlighting = none +resharper_cpp_clang_tidy_abseil_upgrade_duration_conversions_highlighting = none +resharper_cpp_clang_tidy_altera_id_dependent_backward_branch_highlighting = none +resharper_cpp_clang_tidy_altera_kernel_name_restriction_highlighting = none +resharper_cpp_clang_tidy_altera_single_work_item_barrier_highlighting = none +resharper_cpp_clang_tidy_altera_struct_pack_align_highlighting = none +resharper_cpp_clang_tidy_altera_unroll_loops_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_accept4_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_accept_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_creat_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_dup_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_epoll_create1_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_epoll_create_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_fopen_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_inotify_init1_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_inotify_init_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_memfd_create_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_open_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_pipe2_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_pipe_highlighting = none +resharper_cpp_clang_tidy_android_cloexec_socket_highlighting = none +resharper_cpp_clang_tidy_android_comparison_in_temp_failure_retry_highlighting = none +resharper_cpp_clang_tidy_boost_use_to_string_highlighting = suggestion +resharper_cpp_clang_tidy_bugprone_argument_comment_highlighting = suggestion +resharper_cpp_clang_tidy_bugprone_assert_side_effect_highlighting = warning +resharper_cpp_clang_tidy_bugprone_assignment_in_if_condition_highlighting = none +resharper_cpp_clang_tidy_bugprone_bad_signal_to_kill_thread_highlighting = warning +resharper_cpp_clang_tidy_bugprone_bool_pointer_implicit_conversion_highlighting = none +resharper_cpp_clang_tidy_bugprone_branch_clone_highlighting = warning +resharper_cpp_clang_tidy_bugprone_copy_constructor_init_highlighting = warning +resharper_cpp_clang_tidy_bugprone_dangling_handle_highlighting = warning +resharper_cpp_clang_tidy_bugprone_dynamic_static_initializers_highlighting = warning +resharper_cpp_clang_tidy_bugprone_easily_swappable_parameters_highlighting = none +resharper_cpp_clang_tidy_bugprone_exception_escape_highlighting = none +resharper_cpp_clang_tidy_bugprone_fold_init_type_highlighting = warning +resharper_cpp_clang_tidy_bugprone_forwarding_reference_overload_highlighting = warning +resharper_cpp_clang_tidy_bugprone_forward_declaration_namespace_highlighting = warning +resharper_cpp_clang_tidy_bugprone_implicit_widening_of_multiplication_result_highlighting = warning +resharper_cpp_clang_tidy_bugprone_inaccurate_erase_highlighting = warning +resharper_cpp_clang_tidy_bugprone_incorrect_roundings_highlighting = warning +resharper_cpp_clang_tidy_bugprone_infinite_loop_highlighting = warning +resharper_cpp_clang_tidy_bugprone_integer_division_highlighting = warning +resharper_cpp_clang_tidy_bugprone_lambda_function_name_highlighting = warning +resharper_cpp_clang_tidy_bugprone_macro_parentheses_highlighting = warning +resharper_cpp_clang_tidy_bugprone_macro_repeated_side_effects_highlighting = warning +resharper_cpp_clang_tidy_bugprone_misplaced_operator_in_strlen_in_alloc_highlighting = warning +resharper_cpp_clang_tidy_bugprone_misplaced_pointer_arithmetic_in_alloc_highlighting = warning +resharper_cpp_clang_tidy_bugprone_misplaced_widening_cast_highlighting = warning +resharper_cpp_clang_tidy_bugprone_move_forwarding_reference_highlighting = warning +resharper_cpp_clang_tidy_bugprone_multiple_statement_macro_highlighting = warning +resharper_cpp_clang_tidy_bugprone_narrowing_conversions_highlighting = warning +resharper_cpp_clang_tidy_bugprone_not_null_terminated_result_highlighting = warning +resharper_cpp_clang_tidy_bugprone_no_escape_highlighting = warning +resharper_cpp_clang_tidy_bugprone_parent_virtual_call_highlighting = warning +resharper_cpp_clang_tidy_bugprone_posix_return_highlighting = warning +resharper_cpp_clang_tidy_bugprone_redundant_branch_condition_highlighting = warning +resharper_cpp_clang_tidy_bugprone_reserved_identifier_highlighting = warning +resharper_cpp_clang_tidy_bugprone_shared_ptr_array_mismatch_highlighting = warning +resharper_cpp_clang_tidy_bugprone_signal_handler_highlighting = warning +resharper_cpp_clang_tidy_bugprone_signed_char_misuse_highlighting = warning +resharper_cpp_clang_tidy_bugprone_sizeof_container_highlighting = warning +resharper_cpp_clang_tidy_bugprone_sizeof_expression_highlighting = warning +resharper_cpp_clang_tidy_bugprone_spuriously_wake_up_functions_highlighting = warning +resharper_cpp_clang_tidy_bugprone_standalone_empty_highlighting = warning +resharper_cpp_clang_tidy_bugprone_stringview_nullptr_highlighting = warning +resharper_cpp_clang_tidy_bugprone_string_constructor_highlighting = warning +resharper_cpp_clang_tidy_bugprone_string_integer_assignment_highlighting = warning +resharper_cpp_clang_tidy_bugprone_string_literal_with_embedded_nul_highlighting = warning +resharper_cpp_clang_tidy_bugprone_suspicious_enum_usage_highlighting = warning +resharper_cpp_clang_tidy_bugprone_suspicious_include_highlighting = warning +resharper_cpp_clang_tidy_bugprone_suspicious_memory_comparison_highlighting = warning +resharper_cpp_clang_tidy_bugprone_suspicious_memset_usage_highlighting = warning +resharper_cpp_clang_tidy_bugprone_suspicious_missing_comma_highlighting = warning +resharper_cpp_clang_tidy_bugprone_suspicious_realloc_usage_highlighting = warning +resharper_cpp_clang_tidy_bugprone_suspicious_semicolon_highlighting = warning +resharper_cpp_clang_tidy_bugprone_suspicious_string_compare_highlighting = warning +resharper_cpp_clang_tidy_bugprone_swapped_arguments_highlighting = warning +resharper_cpp_clang_tidy_bugprone_terminating_continue_highlighting = warning +resharper_cpp_clang_tidy_bugprone_throw_keyword_missing_highlighting = warning +resharper_cpp_clang_tidy_bugprone_too_small_loop_variable_highlighting = warning +resharper_cpp_clang_tidy_bugprone_unchecked_optional_access_highlighting = warning +resharper_cpp_clang_tidy_bugprone_undefined_memory_manipulation_highlighting = warning +resharper_cpp_clang_tidy_bugprone_undelegated_constructor_highlighting = warning +resharper_cpp_clang_tidy_bugprone_unhandled_exception_at_new_highlighting = none +resharper_cpp_clang_tidy_bugprone_unhandled_self_assignment_highlighting = warning +resharper_cpp_clang_tidy_bugprone_unused_raii_highlighting = warning +resharper_cpp_clang_tidy_bugprone_unused_return_value_highlighting = warning +resharper_cpp_clang_tidy_bugprone_use_after_move_highlighting = warning +resharper_cpp_clang_tidy_bugprone_virtual_near_miss_highlighting = suggestion +resharper_cpp_clang_tidy_cert_con36_c_highlighting = none +resharper_cpp_clang_tidy_cert_con54_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_dcl03_c_highlighting = none +resharper_cpp_clang_tidy_cert_dcl16_c_highlighting = none +resharper_cpp_clang_tidy_cert_dcl21_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_dcl37_c_highlighting = none +resharper_cpp_clang_tidy_cert_dcl50_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_dcl51_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_dcl54_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_dcl58_cpp_highlighting = warning +resharper_cpp_clang_tidy_cert_dcl59_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_env33_c_highlighting = none +resharper_cpp_clang_tidy_cert_err09_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_err33_c_highlighting = warning +resharper_cpp_clang_tidy_cert_err34_c_highlighting = suggestion +resharper_cpp_clang_tidy_cert_err52_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_err58_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_err60_cpp_highlighting = warning +resharper_cpp_clang_tidy_cert_err61_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_exp42_c_highlighting = none +resharper_cpp_clang_tidy_cert_fio38_c_highlighting = none +resharper_cpp_clang_tidy_cert_flp30_c_highlighting = warning +resharper_cpp_clang_tidy_cert_flp37_c_highlighting = none +resharper_cpp_clang_tidy_cert_mem57_cpp_highlighting = warning +resharper_cpp_clang_tidy_cert_msc30_c_highlighting = none +resharper_cpp_clang_tidy_cert_msc32_c_highlighting = none +resharper_cpp_clang_tidy_cert_msc50_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_msc51_cpp_highlighting = warning +resharper_cpp_clang_tidy_cert_msc54_cpp_highlighting = warning +resharper_cpp_clang_tidy_cert_oop11_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_oop54_cpp_highlighting = none +resharper_cpp_clang_tidy_cert_oop57_cpp_highlighting = warning +resharper_cpp_clang_tidy_cert_oop58_cpp_highlighting = warning +resharper_cpp_clang_tidy_cert_pos44_c_highlighting = none +resharper_cpp_clang_tidy_cert_pos47_c_highlighting = none +resharper_cpp_clang_tidy_cert_sig30_c_highlighting = none +resharper_cpp_clang_tidy_cert_str34_c_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_api_modeling_errno_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_api_modeling_google_g_test_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_api_modeling_llvm_cast_value_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_api_modeling_llvm_return_value_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_api_modeling_std_c_library_functions_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_api_modeling_trust_nonnull_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_api_modeling_trust_returns_nonnull_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_builtin_builtin_functions_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_builtin_no_return_functions_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_call_and_message_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_call_and_message_modeling_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_divide_zero_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_dynamic_type_propagation_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_nonnil_string_constants_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_non_null_param_checker_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_null_dereference_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_stack_address_escape_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_stack_addr_escape_base_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_undefined_binary_operator_result_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_uninitialized_array_subscript_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_uninitialized_assign_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_uninitialized_branch_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_uninitialized_captured_block_variable_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_uninitialized_new_array_size_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_uninitialized_undef_return_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_core_vla_size_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_cplusplus_inner_pointer_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_cplusplus_move_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_cplusplus_new_delete_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_cplusplus_new_delete_leaks_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_cplusplus_placement_new_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_cplusplus_pure_virtual_call_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_cplusplus_self_assignment_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_cplusplus_smart_ptr_modeling_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_cplusplus_string_checker_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_cplusplus_virtual_call_modeling_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_deadcode_dead_stores_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_fuchsia_handle_checker_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_nullability_nullability_base_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_nullability_nullable_dereferenced_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_nullability_nullable_passed_to_nonnull_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_nullability_nullable_returned_from_nonnull_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_nullability_null_passed_to_nonnull_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_nullability_null_returned_from_nonnull_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_optin_cplusplus_uninitialized_object_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_optin_cplusplus_virtual_call_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_optin_mpi_mpi_checker_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_optin_osx_cocoa_localizability_empty_localization_context_checker_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_optin_osx_cocoa_localizability_non_localized_string_checker_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_optin_osx_os_object_c_style_cast_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_optin_performance_gcd_antipattern_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_optin_performance_padding_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_optin_portability_unix_api_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_api_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_at_sync_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_autorelease_write_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_class_release_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_dealloc_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_incompatible_method_types_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_loops_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_missing_super_call_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_nil_arg_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_non_nil_return_value_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_ns_autorelease_pool_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_ns_error_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_obj_c_generics_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_retain_count_base_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_retain_count_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_run_loop_autorelease_leak_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_self_init_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_super_dealloc_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_unused_ivars_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_cocoa_variadic_method_types_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_core_foundation_cf_error_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_core_foundation_cf_number_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_core_foundation_cf_retain_release_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_core_foundation_containers_out_of_bounds_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_core_foundation_containers_pointer_sized_values_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_mig_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_ns_or_cf_error_deref_checker_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_number_object_conversion_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_obj_c_property_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_os_object_retain_count_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_osx_sec_keychain_api_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_float_loop_counter_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_bcmp_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_bcopy_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_bzero_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_decode_value_of_obj_c_type_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_deprecated_or_unsafe_buffer_handling_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_getpw_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_gets_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_mkstemp_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_mktemp_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_rand_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_security_syntax_checker_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_strcpy_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_unchecked_return_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_security_insecure_api_vfork_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_unix_api_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_unix_cstring_bad_size_arg_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_unix_cstring_c_string_modeling_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_unix_cstring_null_arg_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_unix_dynamic_memory_modeling_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_unix_malloc_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_unix_malloc_sizeof_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_unix_mismatched_deallocator_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_unix_vfork_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_valist_copy_to_self_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_valist_uninitialized_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_valist_unterminated_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_valist_valist_base_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_webkit_no_uncounted_member_checker_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_webkit_ref_cntbl_base_virtual_dtor_highlighting = none +resharper_cpp_clang_tidy_clang_analyzer_webkit_uncounted_lambda_captures_checker_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_absolute_value_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_abstract_final_class_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_abstract_vbase_init_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_address_of_packed_member_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_address_of_temporary_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_aix_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_align_mismatch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_alloca_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_alloca_with_align_alignof_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_always_inline_coroutine_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_ambiguous_delete_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_ambiguous_ellipsis_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_ambiguous_macro_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_ambiguous_member_template_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_ambiguous_reversed_operator_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_analyzer_incompatible_plugin_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_anonymous_pack_parens_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_anon_enum_enum_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_arc_bridge_casts_disallowed_in_nonarc_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_arc_maybe_repeated_use_of_weak_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_arc_non_pod_memaccess_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_arc_perform_selector_leaks_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_arc_repeated_use_of_weak_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_arc_retain_cycles_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_arc_unsafe_retained_assign_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_argument_outside_range_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_argument_undefined_behaviour_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_array_bounds_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_array_bounds_pointer_arithmetic_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_array_parameter_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_asm_operand_widths_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_assign_enum_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_assume_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_atimport_in_framework_header_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_atomic_access_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_atomic_alignment_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_atomic_implicit_seq_cst_highlighting = suggestion +resharper_cpp_clang_tidy_clang_diagnostic_atomic_memory_ordering_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_atomic_property_with_user_defined_accessor_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_attribute_packed_for_bitfield_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_attribute_warning_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_at_protocol_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_auto_disable_vptr_sanitizer_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_auto_import_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_auto_storage_class_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_auto_var_id_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_availability_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_avr_rtlib_linking_quirks_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_backslash_newline_escape_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_bad_function_cast_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_binding_in_condition_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_bind_to_temporary_copy_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_bitfield_constant_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_bitfield_enum_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_bitfield_width_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_bitwise_conditional_parentheses_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_bitwise_instead_of_logical_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_bitwise_op_parentheses_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_bit_int_extension_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_block_capture_autoreleasing_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_bool_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_bool_operation_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_braced_scalar_init_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_branch_protection_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_bridge_cast_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_builtin_assume_aligned_alignment_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_builtin_macro_redefined_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_builtin_memcpy_chk_size_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_builtin_requires_header_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_c11_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_c2x_compat_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_c2x_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_c99_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_c99_designator_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_c99_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_called_once_parameter_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_call_to_pure_virtual_from_ctor_dtor_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cast_align_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cast_calling_convention_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cast_function_type_strict_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cast_of_sel_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cast_qual_unrelated_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cf_string_literal_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_char_subscripts_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_clang_cl_pch_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_class_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_class_varargs_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cmse_union_leak_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_comma_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_comment_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_compare_distinct_pointer_types_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_completion_handler_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_complex_component_init_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_compound_token_split_by_macro_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_compound_token_split_by_space_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_compound_token_split_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_conditional_type_mismatch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_conditional_uninitialized_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_config_macros_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_constant_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_constant_evaluated_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_constant_logical_operand_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_constexpr_not_const_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_consumed_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_coroutine_missing_unhandled_exception_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_coro_non_aligned_allocation_funciton_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_covered_switch_default_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp11_compat_deprecated_writable_strings_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp11_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp11_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp11_compat_reserved_user_defined_literal_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp11_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp11_extra_semi_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp11_inline_namespace_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp11_long_long_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp11_narrowing_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp14_attribute_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp14_binary_literal_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp14_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp14_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp14_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp17_attribute_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp17_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp17_compat_mangling_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp17_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp17_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp20_attribute_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp20_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp20_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp20_designator_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp20_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp2a_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp2a_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp2b_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_compat_bind_to_temporary_copy_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_compat_extra_semi_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_compat_local_type_template_args_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_compat_unnamed_type_template_args_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_cpp11_compat_binary_literal_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_cpp11_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_cpp11_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_cpp11_cpp14_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_cpp11_cpp14_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_cpp11_cpp14_cpp17_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp98_cpp11_cpp14_cpp17_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cpp_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cstring_format_directive_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_ctad_maybe_unsupported_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_ctu_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_cuda_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_custom_atomic_properties_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_cxx_attribute_extension_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_dangling_else_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_dangling_field_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_dangling_gsl_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_dangling_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_dangling_initializer_list_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_darwin_sdk_settings_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_date_time_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_dealloc_in_category_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_debug_compression_unavailable_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_declaration_after_statement_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_defaulted_function_deleted_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_delegating_ctor_cycles_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_delete_abstract_non_virtual_dtor_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_delete_incomplete_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_delete_non_abstract_non_virtual_dtor_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_delete_non_virtual_dtor_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_delimited_escape_sequence_extension_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_altivec_src_compat_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_anon_enum_enum_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_array_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_attributes_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_builtins_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_comma_subscript_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_copy_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_copy_with_dtor_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_copy_with_user_provided_copy_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_copy_with_user_provided_dtor_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_coroutine_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_declarations_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_dynamic_exception_spec_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_enum_compare_conditional_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_enum_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_enum_enum_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_enum_float_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_experimental_coroutine_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_implementations_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_increment_bool_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_module_ts_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_non_prototype_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_objc_isa_usage_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_objc_pointer_introspection_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_objc_pointer_introspection_perform_selector_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_pragma_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_register_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_static_analyzer_flag_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_this_capture_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecated_volatile_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_deprecate_lax_vec_conv_all_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_direct_ivar_access_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_disabled_macro_expansion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_distributed_object_modifiers_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_division_by_zero_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_dllexport_explicit_instantiation_decl_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_dllimport_static_field_def_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_dll_attribute_on_redeclaration_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_documentation_deprecated_sync_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_documentation_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_documentation_html_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_documentation_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_documentation_unknown_command_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_dollar_in_identifier_extension_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_double_promotion_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_dtor_name_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_dtor_typedef_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_duplicate_decl_specifier_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_duplicate_enum_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_duplicate_method_arg_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_duplicate_method_match_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_duplicate_protocol_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_dynamic_class_memaccess_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_dynamic_exception_spec_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_embedded_directive_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_empty_body_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_empty_decomposition_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_empty_init_stmt_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_empty_translation_unit_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_encode_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_enum_compare_conditional_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_enum_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_enum_compare_switch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_enum_constexpr_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_enum_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_enum_enum_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_enum_float_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_enum_too_large_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_error_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_exceptions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_excess_initializers_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_exit_time_destructors_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_expansion_to_defined_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_explicit_initialize_call_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_explicit_ownership_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_export_unnamed_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_export_using_directive_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_extern_c_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_extern_initializer_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_extra_qualification_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_extra_semi_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_extra_semi_stmt_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_extra_tokens_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_final_dtor_non_final_class_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_final_macro_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_fixed_enum_extension_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_fixed_point_overflow_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_flag_enum_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_flexible_array_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_float_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_float_equal_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_float_overflow_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_float_zero_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_format_extra_args_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_format_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_format_insufficient_args_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_format_invalid_specifier_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_format_nonliteral_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_format_non_iso_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_format_pedantic_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_format_security_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_format_type_confusion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_format_zero_length_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_fortify_source_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_for_loop_analysis_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_four_char_constants_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_framework_include_private_from_public_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_frame_address_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_frame_larger_than_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_free_nonheap_object_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_function_def_in_objc_container_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_function_multiversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_future_attribute_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gcc_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_global_constructors_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_global_isel_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_alignof_expression_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_anonymous_struct_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_gnu_array_member_paren_init_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_auto_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_binary_literal_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_case_range_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_complex_integer_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_compound_literal_initializer_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_conditional_omitted_operand_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_designator_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_empty_initializer_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_empty_struct_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_flexible_array_initializer_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_flexible_array_union_member_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_folding_constant_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_imaginary_constant_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_include_next_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_inline_cpp_without_extern_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_label_as_value_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_line_marker_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_null_pointer_arithmetic_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_offsetof_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_pointer_arith_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_redeclared_enum_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_statement_expression_from_macro_expansion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_statement_expression_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_static_float_init_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_string_literal_operator_template_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_union_cast_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_variable_sized_type_not_at_end_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gnu_zero_variadic_macro_arguments_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_gpu_maybe_wrong_side_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_header_guard_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_header_hygiene_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_hip_only_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_hlsl_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_idiomatic_parentheses_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_ignored_attributes_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_ignored_availability_without_sdk_settings_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_ignored_optimization_argument_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_ignored_pragmas_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_ignored_pragma_intrinsic_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_ignored_pragma_optimize_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_ignored_qualifiers_highlighting = suggestion +resharper_cpp_clang_tidy_clang_diagnostic_ignored_reference_qualifiers_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicitly_unsigned_literal_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_atomic_properties_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_const_int_float_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_conversion_floating_point_to_bool_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_exception_spec_mismatch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_fallthrough_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_fallthrough_per_function_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_fixed_point_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_float_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_function_declaration_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_int_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_int_float_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_int_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_implicit_retain_self_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_import_preprocessor_directive_pedantic_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_inaccessible_base_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_include_next_absolute_path_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_include_next_outside_header_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incompatible_exception_spec_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incompatible_function_pointer_types_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incompatible_function_pointer_types_strict_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incompatible_library_redeclaration_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incompatible_ms_struct_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incompatible_pointer_types_discards_qualifiers_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incompatible_pointer_types_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incompatible_property_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incompatible_sysroot_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incomplete_framework_module_declaration_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incomplete_implementation_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incomplete_module_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incomplete_setjmp_declaration_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_incomplete_umbrella_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_dllimport_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_missing_destructor_override_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_inconsistent_missing_override_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_increment_bool_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_independent_class_attribute_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_infinite_recursion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_initializer_overrides_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_injected_class_name_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_inline_asm_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_inline_namespace_reopened_noninline_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_inline_new_delete_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_instantiation_after_specialization_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_integer_overflow_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_interrupt_service_routine_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_int_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_int_in_bool_context_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_int_to_pointer_cast_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_int_to_void_pointer_cast_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_constexpr_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_iboutlet_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_initializer_from_system_header_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_ios_deployment_target_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_noreturn_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_no_builtin_names_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_offsetof_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_or_nonexistent_directory_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_partial_specialization_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_pp_token_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_source_encoding_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_token_paste_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_invalid_utf8_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_jump_seh_finally_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_keyword_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_keyword_macro_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_knr_promoted_parameter_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_language_extension_token_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_large_by_value_copy_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_linker_warnings_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_literal_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_literal_range_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_local_type_template_args_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_logical_not_parentheses_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_logical_op_parentheses_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_long_long_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_macro_redefined_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_main_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_main_return_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_malformed_warning_check_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_many_braces_around_scalar_init_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_mathematical_notation_identifier_extension_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_max_tokens_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_max_unsigned_zero_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_memset_transposed_args_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_memsize_comparison_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_method_signatures_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_abstract_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_anon_tag_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cast_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_charize_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_comment_paste_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_const_init_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_cpp_macro_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_default_arg_redefinition_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_drectve_section_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_end_of_file_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_enum_forward_reference_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_enum_value_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_exception_spec_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_exists_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_explicit_constructor_call_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_extra_qualification_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_fixed_enum_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_flexible_array_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_goto_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_inaccessible_base_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_include_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_mutable_reference_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_pure_definition_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_redeclare_static_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_sealed_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_static_assert_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_template_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_template_shadow_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_union_member_reference_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_unqualified_friend_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_using_decl_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_microsoft_void_pseudo_dtor_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_misexpect_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_misleading_indentation_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_mismatched_new_delete_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_mismatched_parameter_types_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_mismatched_return_types_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_mismatched_tags_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_missing_braces_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_missing_constinit_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_missing_declarations_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_missing_exception_spec_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_missing_field_initializers_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_missing_method_return_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_missing_noescape_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_missing_noreturn_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_missing_prototypes_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_missing_prototype_for_cc_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_missing_selector_name_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_missing_sysroot_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_missing_variable_declarations_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_misspelled_assumption_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_modules_ambiguous_internal_linkage_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_modules_import_nested_redundant_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_module_conflict_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_module_file_config_mismatch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_module_file_extension_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_module_import_in_extern_c_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_msvc_not_found_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_multichar_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_multiple_move_vbase_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nested_anon_types_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_newline_eof_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_new_returns_null_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_noderef_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nonnull_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nonportable_include_path_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_nonportable_system_include_path_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_nonportable_vector_initialization_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nontrivial_memaccess_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_non_c_typedef_for_linkage_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_non_literal_null_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_non_modular_include_in_framework_module_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_non_modular_include_in_module_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_non_pod_varargs_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_non_power_of_two_alignment_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_non_virtual_dtor_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nsconsumed_mismatch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nsreturns_mismatch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_ns_object_attribute_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nullability_completeness_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nullability_completeness_on_arrays_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nullability_declspec_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nullability_extension_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nullability_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nullability_inferred_on_nested_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_nullable_to_nonnull_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_null_arithmetic_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_null_character_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_null_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_null_dereference_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_null_pointer_arithmetic_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_null_pointer_subtraction_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_odr_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_old_style_cast_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_opencl_unsupported_rgba_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_openmp51_extensions_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_openmp_clauses_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_openmp_loop_form_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_openmp_mapping_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_openmp_target_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_option_ignored_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_ordered_compare_function_pointers_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_out_of_line_declaration_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_out_of_scope_function_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_overlength_strings_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_overloaded_shift_op_parentheses_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_overloaded_virtual_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_override_init_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_override_module_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_overriding_method_mismatch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_overriding_t_option_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_over_aligned_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_packed_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_packed_non_pod_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_padded_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_parentheses_equality_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_parentheses_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pass_failed_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pch_date_time_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pedantic_core_features_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pedantic_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pedantic_macros_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pessimizing_move_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pointer_arith_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pointer_bool_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pointer_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pointer_integer_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pointer_sign_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pointer_to_enum_cast_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pointer_to_int_cast_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pointer_type_mismatch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_poison_system_directories_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_potentially_evaluated_expression_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pragmas_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pragma_clang_attribute_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pragma_messages_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pragma_once_outside_header_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pragma_pack_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pragma_pack_suspicious_include_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pragma_system_header_outside_header_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_predefined_identifier_outside_function_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_pre_c2x_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_pre_c2x_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_pre_cpp14_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_pre_cpp14_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_pre_cpp17_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_pre_cpp17_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_pre_cpp20_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_pre_cpp20_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_pre_cpp2b_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_pre_cpp2b_compat_pedantic_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_pre_openmp51_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_private_extern_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_private_header_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_private_module_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_profile_instr_missing_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_profile_instr_out_of_date_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_profile_instr_unprofiled_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_property_access_dot_syntax_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_property_attribute_mismatch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_protocol_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_protocol_property_synthesis_ambiguity_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_psabi_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_qualified_void_return_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_quoted_include_in_framework_header_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_range_loop_analysis_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_range_loop_bind_reference_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_range_loop_construct_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_readonly_iboutlet_property_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_read_only_types_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_receiver_expr_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_receiver_forward_class_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_redeclared_class_member_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_redundant_consteval_if_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_redundant_move_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_redundant_parens_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_register_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_reinterpret_base_class_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_reorder_ctor_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_reorder_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_reorder_init_list_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_requires_super_attribute_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_reserved_identifier_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_reserved_id_macro_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_reserved_macro_identifier_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_reserved_user_defined_literal_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_restrict_expansion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_retained_language_linkage_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_return_local_addr_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_return_stack_address_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_return_std_move_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_return_type_c_linkage_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_return_type_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_rewrite_not_bool_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_sarif_format_unstable_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_section_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_selector_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_selector_type_mismatch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_self_assign_field_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_self_assign_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_self_assign_overloaded_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_self_move_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_semicolon_before_method_body_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_sentinel_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_serialized_diagnostics_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_shadow_field_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_shadow_field_in_constructor_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_shadow_field_in_constructor_modified_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_shadow_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_shadow_ivar_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_shadow_uncaptured_local_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_shift_count_negative_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_shift_count_overflow_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_shift_negative_value_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_shift_op_parentheses_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_shift_overflow_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_shift_sign_overflow_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_shorten64_to32_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_signed_enum_bitfield_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_signed_unsigned_wchar_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_sign_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_sign_conversion_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_single_bit_bitfield_constant_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_sizeof_array_argument_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_sizeof_array_decay_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_sizeof_array_div_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_sizeof_pointer_div_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_sizeof_pointer_memaccess_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_slash_u_filename_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_slh_asm_goto_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_sometimes_uninitialized_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_source_uses_openmp_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_spirv_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_spir_compat_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_static_float_init_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_static_inline_explicit_instantiation_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_static_in_inline_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_static_local_in_inline_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_static_self_init_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_stdlibcxx_not_found_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_strict_prototypes_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_strict_selector_match_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_string_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_string_concatenation_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_string_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_string_plus_char_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_string_plus_int_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_strlcpy_strlcat_size_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_strncat_size_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_suggest_destructor_override_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_suggest_override_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_super_class_method_mismatch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_suspicious_bzero_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_switch_bool_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_switch_enum_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_switch_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_sync_fetch_and_nand_semantics_changed_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_target_clones_mixed_specifiers_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_tautological_bitwise_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tautological_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tautological_constant_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tautological_constant_in_range_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tautological_constant_out_of_range_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tautological_objc_bool_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tautological_overlap_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tautological_pointer_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tautological_type_limit_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tautological_undefined_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tautological_unsigned_char_zero_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tautological_unsigned_enum_zero_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tautological_unsigned_zero_compare_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_tautological_value_range_compare_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_tentative_definition_incomplete_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_thread_safety_analysis_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_thread_safety_attributes_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_thread_safety_beta_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_thread_safety_negative_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_thread_safety_precise_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_thread_safety_reference_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_thread_safety_verbose_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_trigraphs_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_typedef_redefinition_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_typename_missing_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_type_safety_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unable_to_open_stats_file_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unaligned_access_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unaligned_qualifier_implicit_cast_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unavailable_declarations_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_undeclared_selector_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_undefined_bool_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_undefined_func_template_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_undefined_inline_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_undefined_internal_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_undefined_internal_type_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_undefined_reinterpret_cast_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_undefined_var_template_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_undef_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_undef_prefix_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_underaligned_exception_object_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unevaluated_expression_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unguarded_availability_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unguarded_availability_new_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unicode_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unicode_homoglyph_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unicode_whitespace_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unicode_zero_width_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_uninitialized_const_reference_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_uninitialized_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unknown_argument_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unknown_attributes_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unknown_cuda_version_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unknown_directives_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unknown_escape_sequence_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unknown_pragmas_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unknown_sanitizers_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unknown_warning_option_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unnamed_type_template_args_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unneeded_internal_declaration_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unneeded_member_function_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unqualified_std_cast_call_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unreachable_code_break_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unreachable_code_fallthrough_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unreachable_code_generic_assoc_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unreachable_code_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unreachable_code_loop_increment_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unreachable_code_return_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unsafe_buffer_usage_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unsequenced_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unsupported_abi_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unsupported_abs_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unsupported_availability_guard_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unsupported_cb_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unsupported_dll_base_class_template_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unsupported_friend_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unsupported_gpopt_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unsupported_nan_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unsupported_target_opt_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unsupported_visibility_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unusable_partial_specialization_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unused_but_set_parameter_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unused_but_set_variable_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unused_comparison_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unused_const_variable_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unused_exception_parameter_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unused_function_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unused_getter_return_value_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unused_label_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unused_lambda_capture_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unused_local_typedef_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unused_macros_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unused_member_function_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unused_parameter_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unused_private_field_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unused_property_ivar_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unused_result_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unused_template_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unused_value_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_unused_variable_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_unused_volatile_lvalue_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_used_but_marked_unused_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_user_defined_literals_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_user_defined_warnings_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_varargs_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_variadic_macros_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_vector_conversion_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_vec_elem_size_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_vexing_parse_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_visibility_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_vla_extension_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_vla_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_void_pointer_to_enum_cast_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_void_pointer_to_int_cast_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_void_ptr_dereference_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_warnings_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_wasm_exception_spec_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_weak_template_vtables_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_weak_vtables_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_writable_strings_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_xor_used_as_pow_highlighting = warning +resharper_cpp_clang_tidy_clang_diagnostic_zero_as_null_pointer_constant_highlighting = none +resharper_cpp_clang_tidy_clang_diagnostic_zero_length_array_highlighting = warning +resharper_cpp_clang_tidy_concurrency_mt_unsafe_highlighting = warning +resharper_cpp_clang_tidy_concurrency_thread_canceltype_asynchronous_highlighting = warning +resharper_cpp_clang_tidy_cppcoreguidelines_avoid_const_or_ref_data_members_highlighting = warning +resharper_cpp_clang_tidy_cppcoreguidelines_avoid_c_arrays_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_avoid_do_while_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_avoid_goto_highlighting = warning +resharper_cpp_clang_tidy_cppcoreguidelines_avoid_magic_numbers_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_avoid_non_const_global_variables_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_avoid_reference_coroutine_parameters_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_c_copy_assignment_signature_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_explicit_virtual_functions_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_init_variables_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_interfaces_global_init_highlighting = warning +resharper_cpp_clang_tidy_cppcoreguidelines_macro_usage_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_narrowing_conversions_highlighting = warning +resharper_cpp_clang_tidy_cppcoreguidelines_non_private_member_variables_in_classes_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_no_malloc_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_owning_memory_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_prefer_member_initializer_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_pro_bounds_array_to_pointer_decay_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_pro_bounds_constant_array_index_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_pro_bounds_pointer_arithmetic_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_pro_type_const_cast_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_pro_type_cstyle_cast_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_pro_type_member_init_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_pro_type_reinterpret_cast_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_pro_type_static_cast_downcast_highlighting = suggestion +resharper_cpp_clang_tidy_cppcoreguidelines_pro_type_union_access_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_pro_type_vararg_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_slicing_highlighting = none +resharper_cpp_clang_tidy_cppcoreguidelines_special_member_functions_highlighting = suggestion +resharper_cpp_clang_tidy_cppcoreguidelines_virtual_class_destructor_highlighting = none +resharper_cpp_clang_tidy_darwin_avoid_spinlock_highlighting = none +resharper_cpp_clang_tidy_darwin_dispatch_once_nonstatic_highlighting = none +resharper_cpp_clang_tidy_fuchsia_default_arguments_calls_highlighting = none +resharper_cpp_clang_tidy_fuchsia_default_arguments_declarations_highlighting = none +resharper_cpp_clang_tidy_fuchsia_header_anon_namespaces_highlighting = none +resharper_cpp_clang_tidy_fuchsia_multiple_inheritance_highlighting = none +resharper_cpp_clang_tidy_fuchsia_overloaded_operator_highlighting = none +resharper_cpp_clang_tidy_fuchsia_statically_constructed_objects_highlighting = none +resharper_cpp_clang_tidy_fuchsia_trailing_return_highlighting = none +resharper_cpp_clang_tidy_fuchsia_virtual_inheritance_highlighting = none +resharper_cpp_clang_tidy_google_build_explicit_make_pair_highlighting = none +resharper_cpp_clang_tidy_google_build_namespaces_highlighting = none +resharper_cpp_clang_tidy_google_build_using_namespace_highlighting = none +resharper_cpp_clang_tidy_google_default_arguments_highlighting = none +resharper_cpp_clang_tidy_google_explicit_constructor_highlighting = none +resharper_cpp_clang_tidy_google_global_names_in_headers_highlighting = none +resharper_cpp_clang_tidy_google_objc_avoid_nsobject_new_highlighting = none +resharper_cpp_clang_tidy_google_objc_avoid_throwing_exception_highlighting = none +resharper_cpp_clang_tidy_google_objc_function_naming_highlighting = none +resharper_cpp_clang_tidy_google_objc_global_variable_declaration_highlighting = none +resharper_cpp_clang_tidy_google_readability_avoid_underscore_in_googletest_name_highlighting = none +resharper_cpp_clang_tidy_google_readability_braces_around_statements_highlighting = none +resharper_cpp_clang_tidy_google_readability_casting_highlighting = none +resharper_cpp_clang_tidy_google_readability_function_size_highlighting = none +resharper_cpp_clang_tidy_google_readability_namespace_comments_highlighting = none +resharper_cpp_clang_tidy_google_readability_todo_highlighting = none +resharper_cpp_clang_tidy_google_runtime_int_highlighting = none +resharper_cpp_clang_tidy_google_runtime_operator_highlighting = warning +resharper_cpp_clang_tidy_google_upgrade_googletest_case_highlighting = suggestion +resharper_cpp_clang_tidy_hicpp_avoid_c_arrays_highlighting = none +resharper_cpp_clang_tidy_hicpp_avoid_goto_highlighting = warning +resharper_cpp_clang_tidy_hicpp_braces_around_statements_highlighting = none +resharper_cpp_clang_tidy_hicpp_deprecated_headers_highlighting = none +resharper_cpp_clang_tidy_hicpp_exception_baseclass_highlighting = suggestion +resharper_cpp_clang_tidy_hicpp_explicit_conversions_highlighting = none +resharper_cpp_clang_tidy_hicpp_function_size_highlighting = none +resharper_cpp_clang_tidy_hicpp_invalid_access_moved_highlighting = none +resharper_cpp_clang_tidy_hicpp_member_init_highlighting = none +resharper_cpp_clang_tidy_hicpp_move_const_arg_highlighting = none +resharper_cpp_clang_tidy_hicpp_multiway_paths_covered_highlighting = warning +resharper_cpp_clang_tidy_hicpp_named_parameter_highlighting = none +resharper_cpp_clang_tidy_hicpp_new_delete_operators_highlighting = none +resharper_cpp_clang_tidy_hicpp_noexcept_move_highlighting = none +resharper_cpp_clang_tidy_hicpp_no_array_decay_highlighting = none +resharper_cpp_clang_tidy_hicpp_no_assembler_highlighting = none +resharper_cpp_clang_tidy_hicpp_no_malloc_highlighting = none +resharper_cpp_clang_tidy_hicpp_signed_bitwise_highlighting = none +resharper_cpp_clang_tidy_hicpp_special_member_functions_highlighting = none +resharper_cpp_clang_tidy_hicpp_static_assert_highlighting = none +resharper_cpp_clang_tidy_hicpp_undelegated_constructor_highlighting = none +resharper_cpp_clang_tidy_hicpp_uppercase_literal_suffix_highlighting = none +resharper_cpp_clang_tidy_hicpp_use_auto_highlighting = none +resharper_cpp_clang_tidy_hicpp_use_emplace_highlighting = none +resharper_cpp_clang_tidy_hicpp_use_equals_default_highlighting = none +resharper_cpp_clang_tidy_hicpp_use_equals_delete_highlighting = none +resharper_cpp_clang_tidy_hicpp_use_noexcept_highlighting = none +resharper_cpp_clang_tidy_hicpp_use_nullptr_highlighting = none +resharper_cpp_clang_tidy_hicpp_use_override_highlighting = none +resharper_cpp_clang_tidy_hicpp_vararg_highlighting = none +resharper_cpp_clang_tidy_highlighting_highlighting = suggestion +resharper_cpp_clang_tidy_linuxkernel_must_check_errs_highlighting = warning +resharper_cpp_clang_tidy_llvmlibc_callee_namespace_highlighting = none +resharper_cpp_clang_tidy_llvmlibc_implementation_in_namespace_highlighting = none +resharper_cpp_clang_tidy_llvmlibc_restrict_system_libc_headers_highlighting = none +resharper_cpp_clang_tidy_llvm_else_after_return_highlighting = none +resharper_cpp_clang_tidy_llvm_header_guard_highlighting = none +resharper_cpp_clang_tidy_llvm_include_order_highlighting = none +resharper_cpp_clang_tidy_llvm_namespace_comment_highlighting = none +resharper_cpp_clang_tidy_llvm_prefer_isa_or_dyn_cast_in_conditionals_highlighting = none +resharper_cpp_clang_tidy_llvm_prefer_register_over_unsigned_highlighting = suggestion +resharper_cpp_clang_tidy_llvm_qualified_auto_highlighting = none +resharper_cpp_clang_tidy_llvm_twine_local_highlighting = none +resharper_cpp_clang_tidy_misc_confusable_identifiers_highlighting = warning +resharper_cpp_clang_tidy_misc_const_correctness_highlighting = none +resharper_cpp_clang_tidy_misc_definitions_in_headers_highlighting = none +resharper_cpp_clang_tidy_misc_misleading_bidirectional_highlighting = warning +resharper_cpp_clang_tidy_misc_misleading_identifier_highlighting = warning +resharper_cpp_clang_tidy_misc_misplaced_const_highlighting = none +resharper_cpp_clang_tidy_misc_new_delete_overloads_highlighting = warning +resharper_cpp_clang_tidy_misc_non_copyable_objects_highlighting = warning +resharper_cpp_clang_tidy_misc_non_private_member_variables_in_classes_highlighting = none +resharper_cpp_clang_tidy_misc_no_recursion_highlighting = none +resharper_cpp_clang_tidy_misc_redundant_expression_highlighting = warning +resharper_cpp_clang_tidy_misc_static_assert_highlighting = suggestion +resharper_cpp_clang_tidy_misc_throw_by_value_catch_by_reference_highlighting = warning +resharper_cpp_clang_tidy_misc_unconventional_assign_operator_highlighting = warning +resharper_cpp_clang_tidy_misc_uniqueptr_reset_release_highlighting = suggestion +resharper_cpp_clang_tidy_misc_unused_alias_decls_highlighting = suggestion +resharper_cpp_clang_tidy_misc_unused_parameters_highlighting = none +resharper_cpp_clang_tidy_misc_unused_using_decls_highlighting = suggestion +resharper_cpp_clang_tidy_misc_use_anonymous_namespace_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_avoid_bind_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_avoid_c_arrays_highlighting = none +resharper_cpp_clang_tidy_modernize_concat_nested_namespaces_highlighting = none +resharper_cpp_clang_tidy_modernize_deprecated_headers_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_deprecated_ios_base_aliases_highlighting = warning +resharper_cpp_clang_tidy_modernize_loop_convert_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_macro_to_enum_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_make_shared_highlighting = none +resharper_cpp_clang_tidy_modernize_make_unique_highlighting = none +resharper_cpp_clang_tidy_modernize_pass_by_value_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_raw_string_literal_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_redundant_void_arg_highlighting = none +resharper_cpp_clang_tidy_modernize_replace_auto_ptr_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_replace_disallow_copy_and_assign_macro_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_replace_random_shuffle_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_return_braced_init_list_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_shrink_to_fit_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_unary_static_assert_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_use_auto_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_use_bool_literals_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_use_default_member_init_highlighting = none +resharper_cpp_clang_tidy_modernize_use_emplace_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_use_equals_default_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_use_equals_delete_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_use_nodiscard_highlighting = hint +resharper_cpp_clang_tidy_modernize_use_noexcept_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_use_nullptr_highlighting = none +resharper_cpp_clang_tidy_modernize_use_override_highlighting = none +resharper_cpp_clang_tidy_modernize_use_trailing_return_type_highlighting = none +resharper_cpp_clang_tidy_modernize_use_transparent_functors_highlighting = suggestion +resharper_cpp_clang_tidy_modernize_use_uncaught_exceptions_highlighting = warning +resharper_cpp_clang_tidy_modernize_use_using_highlighting = none +resharper_cpp_clang_tidy_mpi_buffer_deref_highlighting = warning +resharper_cpp_clang_tidy_mpi_type_mismatch_highlighting = warning +resharper_cpp_clang_tidy_objc_assert_equals_highlighting = warning +resharper_cpp_clang_tidy_objc_avoid_nserror_init_highlighting = warning +resharper_cpp_clang_tidy_objc_dealloc_in_category_highlighting = warning +resharper_cpp_clang_tidy_objc_forbidden_subclassing_highlighting = warning +resharper_cpp_clang_tidy_objc_missing_hash_highlighting = warning +resharper_cpp_clang_tidy_objc_nsdate_formatter_highlighting = none +resharper_cpp_clang_tidy_objc_nsinvocation_argument_lifetime_highlighting = warning +resharper_cpp_clang_tidy_objc_property_declaration_highlighting = warning +resharper_cpp_clang_tidy_objc_super_self_highlighting = warning +resharper_cpp_clang_tidy_openmp_exception_escape_highlighting = warning +resharper_cpp_clang_tidy_openmp_use_default_none_highlighting = warning +resharper_cpp_clang_tidy_performance_faster_string_find_highlighting = suggestion +resharper_cpp_clang_tidy_performance_for_range_copy_highlighting = suggestion +resharper_cpp_clang_tidy_performance_implicit_conversion_in_loop_highlighting = suggestion +resharper_cpp_clang_tidy_performance_inefficient_algorithm_highlighting = suggestion +resharper_cpp_clang_tidy_performance_inefficient_string_concatenation_highlighting = suggestion +resharper_cpp_clang_tidy_performance_inefficient_vector_operation_highlighting = suggestion +resharper_cpp_clang_tidy_performance_move_constructor_init_highlighting = warning +resharper_cpp_clang_tidy_performance_move_const_arg_highlighting = suggestion +resharper_cpp_clang_tidy_performance_noexcept_move_constructor_highlighting = none +resharper_cpp_clang_tidy_performance_no_automatic_move_highlighting = warning +resharper_cpp_clang_tidy_performance_no_int_to_ptr_highlighting = warning +resharper_cpp_clang_tidy_performance_trivially_destructible_highlighting = suggestion +resharper_cpp_clang_tidy_performance_type_promotion_in_math_fn_highlighting = suggestion +resharper_cpp_clang_tidy_performance_unnecessary_copy_initialization_highlighting = suggestion +resharper_cpp_clang_tidy_performance_unnecessary_value_param_highlighting = suggestion +resharper_cpp_clang_tidy_portability_restrict_system_includes_highlighting = none +resharper_cpp_clang_tidy_portability_simd_intrinsics_highlighting = none +resharper_cpp_clang_tidy_portability_std_allocator_const_highlighting = warning +resharper_cpp_clang_tidy_readability_avoid_const_params_in_decls_highlighting = none +resharper_cpp_clang_tidy_readability_braces_around_statements_highlighting = none +resharper_cpp_clang_tidy_readability_const_return_type_highlighting = none +resharper_cpp_clang_tidy_readability_container_contains_highlighting = none +resharper_cpp_clang_tidy_readability_container_data_pointer_highlighting = suggestion +resharper_cpp_clang_tidy_readability_container_size_empty_highlighting = suggestion +resharper_cpp_clang_tidy_readability_convert_member_functions_to_static_highlighting = none +resharper_cpp_clang_tidy_readability_delete_null_pointer_highlighting = suggestion +resharper_cpp_clang_tidy_readability_duplicate_include_highlighting = none +resharper_cpp_clang_tidy_readability_else_after_return_highlighting = none +resharper_cpp_clang_tidy_readability_function_cognitive_complexity_highlighting = none +resharper_cpp_clang_tidy_readability_function_size_highlighting = none +resharper_cpp_clang_tidy_readability_identifier_length_highlighting = none +resharper_cpp_clang_tidy_readability_identifier_naming_highlighting = none +resharper_cpp_clang_tidy_readability_implicit_bool_conversion_highlighting = none +resharper_cpp_clang_tidy_readability_inconsistent_declaration_parameter_name_highlighting = suggestion +resharper_cpp_clang_tidy_readability_isolate_declaration_highlighting = none +resharper_cpp_clang_tidy_readability_magic_numbers_highlighting = none +resharper_cpp_clang_tidy_readability_make_member_function_const_highlighting = none +resharper_cpp_clang_tidy_readability_misleading_indentation_highlighting = none +resharper_cpp_clang_tidy_readability_misplaced_array_index_highlighting = suggestion +resharper_cpp_clang_tidy_readability_named_parameter_highlighting = none +resharper_cpp_clang_tidy_readability_non_const_parameter_highlighting = none +resharper_cpp_clang_tidy_readability_qualified_auto_highlighting = none +resharper_cpp_clang_tidy_readability_redundant_access_specifiers_highlighting = none +resharper_cpp_clang_tidy_readability_redundant_control_flow_highlighting = none +resharper_cpp_clang_tidy_readability_redundant_declaration_highlighting = suggestion +resharper_cpp_clang_tidy_readability_redundant_function_ptr_dereference_highlighting = suggestion +resharper_cpp_clang_tidy_readability_redundant_member_init_highlighting = none +resharper_cpp_clang_tidy_readability_redundant_preprocessor_highlighting = warning +resharper_cpp_clang_tidy_readability_redundant_smartptr_get_highlighting = suggestion +resharper_cpp_clang_tidy_readability_redundant_string_cstr_highlighting = suggestion +resharper_cpp_clang_tidy_readability_redundant_string_init_highlighting = suggestion +resharper_cpp_clang_tidy_readability_simplify_boolean_expr_highlighting = none +resharper_cpp_clang_tidy_readability_simplify_subscript_expr_highlighting = warning +resharper_cpp_clang_tidy_readability_static_accessed_through_instance_highlighting = suggestion +resharper_cpp_clang_tidy_readability_static_definition_in_anonymous_namespace_highlighting = none +resharper_cpp_clang_tidy_readability_string_compare_highlighting = warning +resharper_cpp_clang_tidy_readability_suspicious_call_argument_highlighting = warning +resharper_cpp_clang_tidy_readability_uniqueptr_delete_release_highlighting = suggestion +resharper_cpp_clang_tidy_readability_uppercase_literal_suffix_highlighting = none +resharper_cpp_clang_tidy_readability_use_anyofallof_highlighting = suggestion +resharper_cpp_clang_tidy_zircon_temporary_objects_highlighting = none +resharper_cpp_class_can_be_final_highlighting = hint +resharper_cpp_class_is_incomplete_highlighting = warning +resharper_cpp_class_needs_constructor_because_of_uninitialized_member_highlighting = warning +resharper_cpp_class_never_used_highlighting = warning +resharper_cpp_compile_time_constant_can_be_replaced_with_boolean_constant_highlighting = suggestion +resharper_cpp_concept_never_used_highlighting = warning +resharper_cpp_const_parameter_in_declaration_highlighting = suggestion +resharper_cpp_const_value_function_return_type_highlighting = suggestion +resharper_cpp_coroutine_call_resolve_error_highlighting = warning +resharper_cpp_cv_qualifier_can_not_be_applied_to_reference_highlighting = warning +resharper_cpp_c_style_cast_highlighting = suggestion +resharper_cpp_declaration_hides_local_highlighting = warning +resharper_cpp_declaration_hides_uncaptured_local_highlighting = hint +resharper_cpp_declaration_specifier_without_declarators_highlighting = warning +resharper_cpp_declarator_disambiguated_as_function_highlighting = warning +resharper_cpp_declarator_never_used_highlighting = warning +resharper_cpp_declarator_used_before_initialization_highlighting = error +resharper_cpp_defaulted_special_member_function_is_implicitly_deleted_highlighting = warning +resharper_cpp_default_case_not_handled_in_switch_statement_highlighting = warning +resharper_cpp_default_initialization_with_no_user_constructor_highlighting = warning +resharper_cpp_default_is_used_as_identifier_highlighting = warning +resharper_cpp_deleting_void_pointer_highlighting = warning +resharper_cpp_dependent_template_without_template_keyword_highlighting = warning +resharper_cpp_dependent_type_without_typename_keyword_highlighting = warning +resharper_cpp_deprecated_entity_highlighting = warning +resharper_cpp_deprecated_register_storage_class_specifier_highlighting = warning +resharper_cpp_dereference_operator_limit_exceeded_highlighting = warning +resharper_cpp_discarded_postfix_operator_result_highlighting = suggestion +resharper_cpp_doxygen_syntax_error_highlighting = warning +resharper_cpp_doxygen_undocumented_parameter_highlighting = suggestion +resharper_cpp_doxygen_unresolved_reference_highlighting = warning +resharper_cpp_empty_declaration_highlighting = warning +resharper_cpp_enforce_cv_qualifiers_order_highlighting = none +resharper_cpp_enforce_cv_qualifiers_placement_highlighting = none +resharper_cpp_enforce_do_statement_braces_highlighting = none +resharper_cpp_enforce_for_statement_braces_highlighting = none +resharper_cpp_enforce_function_declaration_style_highlighting = none +resharper_cpp_enforce_if_statement_braces_highlighting = none +resharper_cpp_enforce_nested_namespaces_style_highlighting = hint +resharper_cpp_enforce_overriding_destructor_style_highlighting = suggestion +resharper_cpp_enforce_overriding_function_style_highlighting = suggestion +resharper_cpp_enforce_type_alias_code_style_highlighting = none +resharper_cpp_enforce_while_statement_braces_highlighting = none +resharper_cpp_entity_assigned_but_no_read_highlighting = warning +resharper_cpp_entity_used_only_in_unevaluated_context_highlighting = warning +resharper_cpp_enumerator_never_used_highlighting = warning +resharper_cpp_equal_operands_in_binary_expression_highlighting = warning +resharper_cpp_explicit_specialization_in_non_namespace_scope_highlighting = warning +resharper_cpp_expression_without_side_effects_highlighting = warning +resharper_cpp_final_function_in_final_class_highlighting = suggestion +resharper_cpp_final_non_overriding_virtual_function_highlighting = suggestion +resharper_cpp_forward_enum_declaration_without_underlying_type_highlighting = warning +resharper_cpp_for_loop_can_be_replaced_with_while_highlighting = suggestion +resharper_cpp_functional_style_cast_highlighting = suggestion +resharper_cpp_function_doesnt_return_value_highlighting = warning +resharper_cpp_function_is_not_implemented_highlighting = warning +resharper_cpp_function_result_should_be_used_highlighting = hint +resharper_cpp_header_has_been_already_included_highlighting = hint +resharper_cpp_hidden_function_highlighting = warning +resharper_cpp_hiding_function_highlighting = warning +resharper_cpp_identical_operands_in_binary_expression_highlighting = warning +resharper_cpp_if_can_be_replaced_by_constexpr_if_highlighting = suggestion +resharper_cpp_implicit_default_constructor_not_available_highlighting = warning +resharper_cpp_incompatible_pointer_conversion_highlighting = warning +resharper_cpp_incomplete_switch_statement_highlighting = warning +resharper_cpp_inconsistent_naming_highlighting = hint +resharper_cpp_incorrect_blank_lines_near_braces_highlighting = none +resharper_cpp_initialized_value_is_always_rewritten_highlighting = warning +resharper_cpp_integral_to_pointer_conversion_highlighting = warning +resharper_cpp_invalid_line_continuation_highlighting = warning +resharper_cpp_join_declaration_and_assignment_highlighting = suggestion +resharper_cpp_lambda_capture_never_used_highlighting = warning +resharper_cpp_local_variable_may_be_const_highlighting = suggestion +resharper_cpp_local_variable_might_not_be_initialized_highlighting = warning +resharper_cpp_local_variable_with_non_trivial_dtor_is_never_used_highlighting = none +resharper_cpp_long_float_highlighting = warning +resharper_cpp_member_function_may_be_const_highlighting = suggestion +resharper_cpp_member_function_may_be_static_highlighting = suggestion +resharper_cpp_member_initializers_order_highlighting = suggestion +resharper_cpp_mismatched_class_tags_highlighting = warning +resharper_cpp_missing_blank_lines_highlighting = none +resharper_cpp_missing_include_guard_highlighting = warning +resharper_cpp_missing_indent_highlighting = none +resharper_cpp_missing_keyword_throw_highlighting = warning +resharper_cpp_missing_linebreak_highlighting = none +resharper_cpp_missing_space_highlighting = warning +resharper_cpp_ms_ext_address_of_class_r_value_highlighting = warning +resharper_cpp_ms_ext_binding_r_value_to_lvalue_reference_highlighting = warning +resharper_cpp_ms_ext_copy_elision_in_copy_init_declarator_highlighting = warning +resharper_cpp_ms_ext_double_user_conversion_in_copy_init_highlighting = warning +resharper_cpp_ms_ext_not_initialized_static_const_local_var_highlighting = warning +resharper_cpp_ms_ext_reinterpret_cast_from_nullptr_highlighting = warning +resharper_cpp_multiple_spaces_highlighting = warning +resharper_cpp_must_be_public_virtual_to_implement_interface_highlighting = warning +resharper_cpp_mutable_specifier_on_reference_member_highlighting = warning +resharper_cpp_nodiscard_function_without_return_value_highlighting = warning +resharper_cpp_non_exception_safe_resource_acquisition_highlighting = hint +resharper_cpp_non_explicit_conversion_operator_highlighting = hint +resharper_cpp_non_explicit_converting_constructor_highlighting = hint +resharper_cpp_non_inline_function_definition_in_header_file_highlighting = warning +resharper_cpp_non_inline_variable_definition_in_header_file_highlighting = warning +resharper_cpp_not_all_paths_return_value_highlighting = warning +resharper_cpp_no_discard_expression_highlighting = warning +resharper_cpp_object_member_might_not_be_initialized_highlighting = warning +resharper_cpp_outdent_is_off_prev_level_highlighting = none +resharper_cpp_out_parameter_must_be_written_highlighting = warning +resharper_cpp_parameter_may_be_const_highlighting = hint +resharper_cpp_parameter_may_be_const_ptr_or_ref_highlighting = suggestion +resharper_cpp_parameter_names_mismatch_highlighting = hint +resharper_cpp_parameter_never_used_highlighting = hint +resharper_cpp_parameter_value_is_reassigned_highlighting = warning +resharper_cpp_pass_value_parameter_by_const_reference_highlighting = suggestion +resharper_cpp_pointer_conversion_drops_qualifiers_highlighting = warning +resharper_cpp_pointer_to_integral_conversion_highlighting = warning +resharper_cpp_polymorphic_class_with_non_virtual_public_destructor_highlighting = warning +resharper_cpp_possibly_erroneous_empty_statements_highlighting = warning +resharper_cpp_possibly_uninitialized_member_highlighting = warning +resharper_cpp_possibly_unintended_object_slicing_highlighting = warning +resharper_cpp_precompiled_header_is_not_included_highlighting = error +resharper_cpp_precompiled_header_not_found_highlighting = error +resharper_cpp_printf_bad_format_highlighting = warning +resharper_cpp_printf_extra_arg_highlighting = warning +resharper_cpp_printf_missed_arg_highlighting = error +resharper_cpp_printf_risky_format_highlighting = warning +resharper_cpp_private_special_member_function_is_not_implemented_highlighting = warning +resharper_cpp_range_based_for_incompatible_reference_highlighting = warning +resharper_cpp_redefinition_of_default_argument_in_override_function_highlighting = warning +resharper_cpp_redundant_access_specifier_highlighting = hint +resharper_cpp_redundant_base_class_access_specifier_highlighting = hint +resharper_cpp_redundant_base_class_initializer_highlighting = suggestion +resharper_cpp_redundant_blank_lines_highlighting = none +resharper_cpp_redundant_boolean_expression_argument_highlighting = warning +resharper_cpp_redundant_cast_expression_highlighting = hint +resharper_cpp_redundant_complexity_in_comparison_highlighting = suggestion +resharper_cpp_redundant_const_specifier_highlighting = hint +resharper_cpp_redundant_control_flow_jump_highlighting = hint +resharper_cpp_redundant_dereferencing_and_taking_address_highlighting = suggestion +resharper_cpp_redundant_elaborated_type_specifier_highlighting = hint +resharper_cpp_redundant_else_keyword_highlighting = hint +resharper_cpp_redundant_else_keyword_inside_compound_statement_highlighting = hint +resharper_cpp_redundant_empty_declaration_highlighting = hint +resharper_cpp_redundant_empty_statement_highlighting = hint +resharper_cpp_redundant_inline_specifier_highlighting = hint +resharper_cpp_redundant_lambda_parameter_list_highlighting = hint +resharper_cpp_redundant_linebreak_highlighting = none +resharper_cpp_redundant_member_initializer_highlighting = suggestion +resharper_cpp_redundant_namespace_definition_highlighting = suggestion +resharper_cpp_redundant_parentheses_highlighting = hint +resharper_cpp_redundant_qualifier_highlighting = hint +resharper_cpp_redundant_space_highlighting = warning +resharper_cpp_redundant_static_specifier_on_member_allocation_function_highlighting = hint +resharper_cpp_redundant_static_specifier_on_thread_local_local_variable_highlighting = hint +resharper_cpp_redundant_template_arguments_highlighting = hint +resharper_cpp_redundant_template_keyword_highlighting = warning +resharper_cpp_redundant_typename_keyword_highlighting = warning +resharper_cpp_redundant_void_argument_list_highlighting = suggestion +resharper_cpp_reinterpret_cast_from_void_ptr_highlighting = suggestion +resharper_cpp_remove_redundant_braces_highlighting = none +resharper_cpp_replace_memset_with_zero_initialization_highlighting = suggestion +resharper_cpp_replace_tie_with_structured_binding_highlighting = suggestion +resharper_cpp_return_no_value_in_non_void_function_highlighting = warning +resharper_cpp_smart_pointer_vs_make_function_highlighting = suggestion +resharper_cpp_some_object_members_might_not_be_initialized_highlighting = warning +resharper_cpp_special_function_without_noexcept_specification_highlighting = warning +resharper_cpp_static_assert_failure_highlighting = error +resharper_cpp_static_data_member_in_unnamed_struct_highlighting = warning +resharper_cpp_static_specifier_on_anonymous_namespace_member_highlighting = suggestion +resharper_cpp_string_literal_to_char_pointer_conversion_highlighting = warning +resharper_cpp_tabs_and_spaces_mismatch_highlighting = none +resharper_cpp_tabs_are_disallowed_highlighting = none +resharper_cpp_tabs_outside_indent_highlighting = none +resharper_cpp_template_arguments_can_be_deduced_highlighting = hint +resharper_cpp_template_parameter_never_used_highlighting = hint +resharper_cpp_template_parameter_shadowing_highlighting = warning +resharper_cpp_this_arg_member_func_delegate_ctor_is_unsuported_by_dot_net_core_highlighting = none +resharper_cpp_throw_expression_can_be_replaced_with_rethrow_highlighting = warning +resharper_cpp_too_wide_scope_highlighting = suggestion +resharper_cpp_too_wide_scope_init_statement_highlighting = hint +resharper_cpp_type_alias_never_used_highlighting = warning +resharper_cpp_ue4_blueprint_callable_function_may_be_const_highlighting = hint +resharper_cpp_ue4_blueprint_callable_function_may_be_static_highlighting = hint +resharper_cpp_ue4_coding_standard_naming_violation_warning_highlighting = hint +resharper_cpp_ue4_coding_standard_u_class_naming_violation_error_highlighting = error +resharper_cpp_ue4_probable_memory_issues_with_u_objects_in_container_highlighting = warning +resharper_cpp_ue4_probable_memory_issues_with_u_object_highlighting = warning +resharper_cpp_ue_blueprint_callable_function_unused_highlighting = warning +resharper_cpp_ue_blueprint_implementable_event_not_implemented_highlighting = warning +resharper_cpp_ue_incorrect_engine_directory_highlighting = error +resharper_cpp_ue_non_existent_input_action_highlighting = warning +resharper_cpp_ue_non_existent_input_axis_highlighting = warning +resharper_cpp_ue_source_file_without_predefined_macros_highlighting = warning +resharper_cpp_ue_source_file_without_standard_library_highlighting = error +resharper_cpp_ue_version_file_doesnt_exist_highlighting = error +resharper_cpp_uninitialized_dependent_base_class_highlighting = warning +resharper_cpp_uninitialized_non_static_data_member_highlighting = warning +resharper_cpp_union_member_of_reference_type_highlighting = warning +resharper_cpp_unnamed_namespace_in_header_file_highlighting = warning +resharper_cpp_unnecessary_whitespace_highlighting = warning +resharper_cpp_unreachable_code_highlighting = warning +resharper_cpp_unsigned_zero_comparison_highlighting = warning +resharper_cpp_unused_include_directive_highlighting = warning +resharper_cpp_user_defined_literal_suffix_does_not_start_with_underscore_highlighting = warning +resharper_cpp_use_algorithm_with_count_highlighting = suggestion +resharper_cpp_use_associative_contains_highlighting = suggestion +resharper_cpp_use_auto_for_numeric_highlighting = hint +resharper_cpp_use_auto_highlighting = hint +resharper_cpp_use_elements_view_highlighting = suggestion +resharper_cpp_use_erase_algorithm_highlighting = suggestion +resharper_cpp_use_familiar_template_syntax_for_generic_lambdas_highlighting = suggestion +resharper_cpp_use_of_undeclared_class_highlighting = hint +resharper_cpp_use_range_algorithm_highlighting = suggestion +resharper_cpp_use_std_size_highlighting = suggestion +resharper_cpp_use_structured_binding_highlighting = hint +resharper_cpp_use_type_trait_alias_highlighting = suggestion +resharper_cpp_using_result_of_assignment_as_condition_highlighting = warning +resharper_cpp_u_function_macro_call_has_no_effect_highlighting = warning +resharper_cpp_u_property_macro_call_has_no_effect_highlighting = warning +resharper_cpp_variable_can_be_made_constexpr_highlighting = suggestion +resharper_cpp_virtual_function_call_inside_ctor_highlighting = warning +resharper_cpp_virtual_function_in_final_class_highlighting = warning +resharper_cpp_volatile_parameter_in_declaration_highlighting = suggestion +resharper_cpp_warning_directive_highlighting = warning +resharper_cpp_wrong_includes_order_highlighting = hint +resharper_cpp_wrong_indent_size_highlighting = none +resharper_cpp_wrong_slashes_in_include_directive_highlighting = hint +resharper_cpp_zero_constant_can_be_replaced_with_nullptr_highlighting = suggestion +resharper_cpp_zero_valued_expression_used_as_null_pointer_highlighting = warning +resharper_create_specialized_overload_highlighting = hint +resharper_css_browser_compatibility_highlighting = warning +resharper_css_caniuse_feature_requires_prefix_highlighting = hint +resharper_css_caniuse_unsupported_feature_highlighting = hint +resharper_css_not_resolved_highlighting = error +resharper_css_obsolete_highlighting = hint +resharper_css_property_does_not_override_vendor_property_highlighting = warning +resharper_cyclic_reference_comment_highlighting = none +resharper_c_declaration_with_implicit_int_type_highlighting = warning +resharper_c_sharp_build_cs_invalid_module_name_highlighting = warning +resharper_c_sharp_missing_plugin_dependency_highlighting = warning +resharper_declaration_hides_highlighting = hint +resharper_declaration_is_empty_highlighting = warning +resharper_declaration_visibility_error_highlighting = error +resharper_default_value_attribute_for_optional_parameter_highlighting = warning +resharper_deleting_non_qualified_reference_highlighting = error +resharper_dl_tag_contains_non_dt_or_dd_elements_highlighting = hint +resharper_double_colons_expected_highlighting = error +resharper_double_colons_preferred_highlighting = suggestion +resharper_double_negation_in_pattern_highlighting = suggestion +resharper_double_negation_of_boolean_highlighting = warning +resharper_double_negation_operator_highlighting = suggestion +resharper_duplicate_identifier_error_highlighting = error +resharper_duplicate_reference_comment_highlighting = warning +resharper_duplicate_resource_highlighting = warning +resharper_duplicating_local_declaration_highlighting = warning +resharper_duplicating_parameter_declaration_error_highlighting = error +resharper_duplicating_property_declaration_error_highlighting = error +resharper_duplicating_property_declaration_highlighting = warning +resharper_duplicating_switch_label_highlighting = warning +resharper_elided_trailing_element_highlighting = warning +resharper_empty_constructor_highlighting = warning +resharper_empty_destructor_highlighting = warning +resharper_empty_embedded_statement_highlighting = warning +resharper_empty_for_statement_highlighting = warning +resharper_empty_general_catch_clause_highlighting = warning +resharper_empty_namespace_highlighting = warning +resharper_empty_object_property_declaration_highlighting = error +resharper_empty_region_highlighting = suggestion +resharper_empty_return_value_for_type_annotated_function_highlighting = warning +resharper_empty_statement_highlighting = warning +resharper_empty_title_tag_highlighting = hint +resharper_enforce_do_while_statement_braces_highlighting = none +resharper_enforce_fixed_statement_braces_highlighting = none +resharper_enforce_foreach_statement_braces_highlighting = none +resharper_enforce_for_statement_braces_highlighting = none +resharper_enforce_if_statement_braces_highlighting = warning +resharper_enforce_lock_statement_braces_highlighting = none +resharper_enforce_using_statement_braces_highlighting = none +resharper_enforce_while_statement_braces_highlighting = none +resharper_entity_framework_n_plus_one_incomplete_data_query_highlighting = suggestion +resharper_entity_framework_n_plus_one_incomplete_data_usage_highlighting = warning +resharper_entity_framework_n_plus_one_query_highlighting = suggestion +resharper_entity_framework_n_plus_one_usage_highlighting = warning +resharper_entity_name_captured_only_global_highlighting = warning +resharper_entity_name_captured_only_local_highlighting = warning +resharper_enumerable_sum_in_explicit_unchecked_context_highlighting = warning +resharper_enum_underlying_type_is_int_highlighting = warning +resharper_equal_expression_comparison_highlighting = warning +resharper_error_in_xml_doc_reference_highlighting = error +resharper_es6_feature_highlighting = error +resharper_es7_feature_highlighting = error +resharper_eval_arguments_name_error_highlighting = error +resharper_event_exception_not_documented_highlighting = suggestion +resharper_event_never_invoked_global_highlighting = suggestion +resharper_event_never_subscribed_to_global_highlighting = suggestion +resharper_event_never_subscribed_to_local_highlighting = suggestion +resharper_event_unsubscription_via_anonymous_delegate_highlighting = warning +resharper_exception_not_documented_highlighting = hint +resharper_exception_not_documented_optional_highlighting = none +resharper_exception_not_thrown_highlighting = hint +resharper_exception_not_thrown_optional_highlighting = hint +resharper_exception_passed_as_template_argument_problem_highlighting = warning +resharper_experimental_feature_highlighting = error +resharper_explicit_caller_info_argument_highlighting = warning +resharper_expression_is_always_const_highlighting = warning +resharper_expression_is_always_null_highlighting = warning +resharper_extract_common_property_pattern_highlighting = hint +resharper_field_can_be_made_read_only_global_highlighting = suggestion +resharper_field_can_be_made_read_only_local_highlighting = suggestion +resharper_field_hides_interface_property_with_default_implementation_highlighting = warning +resharper_foreach_can_be_converted_to_query_using_another_get_enumerator_highlighting = hint +resharper_foreach_can_be_partly_converted_to_query_using_another_get_enumerator_highlighting = hint +resharper_format_string_placeholders_mismatch_highlighting = warning +resharper_format_string_problem_highlighting = warning +resharper_for_can_be_converted_to_foreach_highlighting = suggestion +resharper_for_statement_condition_is_true_highlighting = warning +resharper_functions_used_before_declared_highlighting = none +resharper_function_complexity_overflow_highlighting = none +resharper_function_never_returns_highlighting = warning +resharper_function_parameter_named_arguments_highlighting = warning +resharper_function_recursive_on_all_paths_highlighting = warning +resharper_function_used_out_of_scope_highlighting = warning +resharper_gc_suppress_finalize_for_type_without_destructor_highlighting = warning +resharper_generic_enumerator_not_disposed_highlighting = warning +resharper_heap_view_boxing_allocation_highlighting = hint +resharper_heap_view_can_avoid_closure_highlighting = suggestion +resharper_heap_view_closure_allocation_highlighting = hint +resharper_heap_view_delegate_allocation_highlighting = hint +resharper_heap_view_implicit_capture_highlighting = none +resharper_heap_view_object_allocation_evident_highlighting = hint +resharper_heap_view_object_allocation_highlighting = hint +resharper_heap_view_object_allocation_possible_highlighting = hint +resharper_heap_view_possible_boxing_allocation_highlighting = hint +resharper_heuristically_unreachable_code_highlighting = warning +resharper_heuristic_unreachable_code_highlighting = warning +resharper_hex_color_value_with_alpha_highlighting = error +resharper_html_attributes_quotes_highlighting = hint +resharper_html_attribute_not_resolved_highlighting = warning +resharper_html_attribute_value_not_resolved_highlighting = warning +resharper_html_dead_code_highlighting = warning +resharper_html_event_not_resolved_highlighting = warning +resharper_html_id_duplication_highlighting = warning +resharper_html_id_not_resolved_highlighting = warning +resharper_html_obsolete_highlighting = warning +resharper_html_path_error_highlighting = warning +resharper_html_tag_not_closed_highlighting = error +resharper_html_tag_not_resolved_highlighting = warning +resharper_html_tag_should_be_self_closed_highlighting = warning +resharper_html_tag_should_not_be_self_closed_highlighting = warning +resharper_html_warning_highlighting = warning +resharper_identifier_typo_highlighting = none +resharper_if_std_is_constant_evaluated_can_be_replaced_highlighting = suggestion +resharper_implicit_any_error_highlighting = error +resharper_implicit_any_type_warning_highlighting = warning +resharper_import_keyword_not_with_invocation_highlighting = error +resharper_inactive_preprocessor_branch_highlighting = warning +resharper_inconsistently_synchronized_field_highlighting = warning +resharper_inconsistent_context_log_property_naming_highlighting = warning +resharper_inconsistent_function_returns_highlighting = warning +resharper_inconsistent_log_property_naming_highlighting = none +resharper_inconsistent_naming_highlighting = warning +resharper_inconsistent_order_of_locks_highlighting = warning +resharper_incorrect_blank_lines_near_braces_highlighting = warning +resharper_incorrect_operand_in_type_of_comparison_highlighting = warning +resharper_incorrect_triple_slash_location_highlighting = warning +resharper_indexing_by_invalid_range_highlighting = warning +resharper_inheritdoc_consider_usage_highlighting = none +resharper_inheritdoc_invalid_usage_highlighting = warning +resharper_inline_out_variable_declaration_highlighting = suggestion +resharper_inline_temporary_variable_highlighting = hint +resharper_internal_module_highlighting = suggestion +resharper_internal_or_private_member_not_documented_highlighting = warning +resharper_interpolated_string_expression_is_not_i_formattable_highlighting = warning +resharper_introduce_optional_parameters_global_highlighting = suggestion +resharper_introduce_optional_parameters_local_highlighting = suggestion +resharper_introduce_variable_to_apply_guard_highlighting = hint +resharper_int_division_by_zero_highlighting = warning +resharper_int_variable_overflow_highlighting = warning +resharper_int_variable_overflow_in_checked_context_highlighting = warning +resharper_int_variable_overflow_in_unchecked_context_highlighting = warning +resharper_invalid_attribute_value_highlighting = warning +resharper_invalid_json_syntax_highlighting = error +resharper_invalid_task_element_highlighting = none +resharper_invalid_value_highlighting = error +resharper_invalid_value_type_highlighting = warning +resharper_invalid_xml_doc_comment_highlighting = warning +resharper_invert_condition_1_highlighting = hint +resharper_invert_if_highlighting = hint +resharper_invocation_is_skipped_highlighting = hint +resharper_invocation_of_non_function_highlighting = warning +resharper_invoked_expression_maybe_non_function_highlighting = warning +resharper_invoke_as_extension_method_highlighting = suggestion +resharper_is_expression_always_false_highlighting = warning +resharper_is_expression_always_true_highlighting = warning +resharper_iterator_method_result_is_ignored_highlighting = warning +resharper_iterator_never_returns_highlighting = warning +resharper_join_declaration_and_initializer_highlighting = suggestion +resharper_join_declaration_and_initializer_js_highlighting = suggestion +resharper_join_null_check_with_usage_highlighting = suggestion +resharper_json_validation_failed_highlighting = error +resharper_js_path_not_found_highlighting = error +resharper_js_unreachable_code_highlighting = warning +resharper_jump_must_be_in_loop_highlighting = warning +resharper_label_or_semicolon_expected_highlighting = error +resharper_lambda_expression_can_be_made_static_highlighting = none +resharper_lambda_expression_must_be_static_highlighting = suggestion +resharper_lambda_highlighting = suggestion +resharper_lambda_should_not_capture_context_highlighting = warning +resharper_less_specific_overload_than_main_signature_highlighting = warning +resharper_lexical_declaration_needs_block_highlighting = error +resharper_localizable_element_highlighting = warning +resharper_local_function_can_be_made_static_highlighting = none +resharper_local_function_hides_method_highlighting = warning +resharper_local_function_redefined_later_highlighting = warning +resharper_local_variable_hides_member_highlighting = warning +resharper_log_message_is_sentence_problem_highlighting = warning +resharper_long_literal_ending_lower_l_highlighting = warning +resharper_loop_can_be_converted_to_query_highlighting = hint +resharper_loop_can_be_partly_converted_to_query_highlighting = none +resharper_loop_variable_is_never_changed_inside_loop_highlighting = warning +resharper_l_value_is_expected_highlighting = error +resharper_markup_attribute_typo_highlighting = suggestion +resharper_markup_text_typo_highlighting = suggestion +resharper_math_abs_method_is_redundant_highlighting = warning +resharper_math_clamp_min_greater_than_max_highlighting = warning +resharper_meaningless_default_parameter_value_highlighting = warning +resharper_member_can_be_file_local_highlighting = none +resharper_member_can_be_internal_highlighting = none +resharper_member_can_be_made_static_global_highlighting = hint +resharper_member_can_be_made_static_local_highlighting = hint +resharper_member_can_be_private_global_highlighting = none +resharper_member_can_be_private_local_highlighting = suggestion +resharper_member_can_be_protected_global_highlighting = none +resharper_member_can_be_protected_local_highlighting = suggestion +resharper_member_hides_interface_member_with_default_implementation_highlighting = warning +resharper_member_hides_static_from_outer_class_highlighting = warning +resharper_member_initializer_value_ignored_highlighting = warning +resharper_merge_and_pattern_highlighting = suggestion +resharper_merge_cast_with_type_check_highlighting = suggestion +resharper_merge_conditional_expression_highlighting = suggestion +resharper_merge_into_logical_pattern_highlighting = hint +resharper_merge_into_negated_pattern_highlighting = hint +resharper_merge_into_pattern_highlighting = suggestion +resharper_merge_nested_property_patterns_highlighting = suggestion +resharper_merge_sequential_checks_highlighting = hint +resharper_method_has_async_overload_highlighting = suggestion +resharper_method_has_async_overload_with_cancellation_highlighting = suggestion +resharper_method_overload_with_optional_parameter_highlighting = warning +resharper_method_safe_this_highlighting = suggestion +resharper_method_supports_cancellation_highlighting = suggestion +resharper_missing_alt_attribute_in_img_tag_highlighting = hint +resharper_missing_attribute_highlighting = warning +resharper_missing_blank_lines_highlighting = warning +resharper_missing_body_tag_highlighting = warning +resharper_missing_has_own_property_in_foreach_highlighting = warning +resharper_missing_head_and_body_tags_highlighting = warning +resharper_missing_head_tag_highlighting = warning +resharper_missing_indent_highlighting = warning +resharper_missing_linebreak_highlighting = warning +resharper_missing_space_highlighting = warning +resharper_missing_title_tag_highlighting = hint +resharper_missing_xml_doc_highlighting = none +resharper_misuse_of_owner_function_this_highlighting = warning +resharper_more_specific_foreach_variable_type_available_highlighting = suggestion +resharper_more_specific_signature_after_less_specific_highlighting = warning +resharper_move_local_function_after_jump_statement_highlighting = hint +resharper_move_to_existing_positional_deconstruction_pattern_highlighting = hint +resharper_move_variable_declaration_inside_loop_condition_highlighting = suggestion +resharper_multiple_declarations_in_foreach_highlighting = error +resharper_multiple_nullable_attributes_usage_highlighting = warning +resharper_multiple_order_by_highlighting = warning +resharper_multiple_output_tags_highlighting = warning +resharper_multiple_resolve_candidates_in_text_highlighting = warning +resharper_multiple_spaces_highlighting = warning +resharper_multiple_statements_on_one_line_highlighting = warning +resharper_multiple_type_members_on_one_line_highlighting = warning +resharper_must_use_return_value_highlighting = warning +resharper_mvc_action_not_resolved_highlighting = error +resharper_mvc_area_not_resolved_highlighting = error +resharper_mvc_controller_not_resolved_highlighting = error +resharper_mvc_invalid_model_type_highlighting = error +resharper_mvc_masterpage_not_resolved_highlighting = error +resharper_mvc_partial_view_not_resolved_highlighting = error +resharper_mvc_template_not_resolved_highlighting = error +resharper_mvc_view_component_not_resolved_highlighting = error +resharper_mvc_view_component_view_not_resolved_highlighting = error +resharper_mvc_view_not_resolved_highlighting = error +resharper_native_type_prototype_extending_highlighting = warning +resharper_native_type_prototype_overwriting_highlighting = warning +resharper_negation_of_relational_pattern_highlighting = suggestion +resharper_negative_equality_expression_highlighting = suggestion +resharper_negative_index_highlighting = warning +resharper_nested_string_interpolation_highlighting = suggestion +resharper_non_assigned_constant_highlighting = error +resharper_non_atomic_compound_operator_highlighting = warning +resharper_non_constant_equality_expression_has_constant_result_highlighting = warning +resharper_non_parsable_element_highlighting = warning +resharper_non_readonly_member_in_get_hash_code_highlighting = none +resharper_non_volatile_field_in_double_check_locking_highlighting = warning +resharper_not_accessed_field_global_highlighting = suggestion +resharper_not_accessed_field_local_highlighting = warning +resharper_not_accessed_out_parameter_variable_highlighting = warning +resharper_not_accessed_positional_property_global_highlighting = warning +resharper_not_accessed_positional_property_local_highlighting = warning +resharper_not_accessed_variable_highlighting = warning +resharper_not_all_paths_return_value_highlighting = warning +resharper_not_assigned_out_parameter_highlighting = warning +resharper_not_declared_in_parent_culture_highlighting = warning +resharper_not_null_or_required_member_is_not_initialized_highlighting = warning +resharper_not_observable_annotation_redundancy_highlighting = warning +resharper_not_overridden_in_specific_culture_highlighting = warning +resharper_not_resolved_highlighting = warning +resharper_not_resolved_in_text_highlighting = warning +resharper_nullable_warning_suppression_is_used_highlighting = none +resharper_nullness_annotation_conflict_with_jet_brains_annotations_highlighting = warning +resharper_null_coalescing_condition_is_always_not_null_according_to_api_contract_highlighting = warning +resharper_n_unit_async_method_must_be_task_highlighting = warning +resharper_n_unit_attribute_produces_too_many_tests_highlighting = none +resharper_n_unit_auto_fixture_incorrect_argument_type_highlighting = warning +resharper_n_unit_auto_fixture_missed_test_attribute_highlighting = warning +resharper_n_unit_auto_fixture_missed_test_or_test_fixture_attribute_highlighting = warning +resharper_n_unit_auto_fixture_redundant_argument_in_inline_auto_data_attribute_highlighting = warning +resharper_n_unit_duplicate_values_highlighting = warning +resharper_n_unit_ignored_parameter_attribute_highlighting = warning +resharper_n_unit_implicit_unspecified_null_values_highlighting = warning +resharper_n_unit_incorrect_argument_type_highlighting = warning +resharper_n_unit_incorrect_expected_result_type_highlighting = warning +resharper_n_unit_incorrect_range_bounds_highlighting = warning +resharper_n_unit_method_with_parameters_and_test_attribute_highlighting = warning +resharper_n_unit_missing_arguments_in_test_case_attribute_highlighting = warning +resharper_n_unit_non_public_method_with_test_attribute_highlighting = warning +resharper_n_unit_no_values_provided_highlighting = warning +resharper_n_unit_parameter_type_is_not_compatible_with_attribute_highlighting = warning +resharper_n_unit_range_attribute_bounds_are_out_of_range_highlighting = warning +resharper_n_unit_range_step_sign_mismatch_highlighting = warning +resharper_n_unit_range_step_value_must_not_be_zero_highlighting = warning +resharper_n_unit_range_to_value_is_not_reachable_highlighting = warning +resharper_n_unit_redundant_argument_instead_of_expected_result_highlighting = warning +resharper_n_unit_redundant_argument_in_test_case_attribute_highlighting = warning +resharper_n_unit_redundant_expected_result_in_test_case_attribute_highlighting = warning +resharper_n_unit_test_case_attribute_requires_expected_result_highlighting = warning +resharper_n_unit_test_case_result_property_duplicates_expected_result_highlighting = warning +resharper_n_unit_test_case_result_property_is_obsolete_highlighting = warning +resharper_n_unit_test_case_source_cannot_be_resolved_highlighting = warning +resharper_n_unit_test_case_source_must_be_field_property_method_highlighting = warning +resharper_n_unit_test_case_source_must_be_static_highlighting = warning +resharper_n_unit_test_case_source_should_implement_i_enumerable_highlighting = warning +resharper_object_creation_as_statement_highlighting = warning +resharper_object_destructuring_without_parentheses_highlighting = error +resharper_object_literals_are_not_comma_free_highlighting = error +resharper_obsolete_element_error_highlighting = error +resharper_obsolete_element_highlighting = warning +resharper_octal_literals_not_allowed_error_highlighting = error +resharper_ol_tag_contains_non_li_elements_highlighting = hint +resharper_one_way_operation_contract_with_return_type_highlighting = warning +resharper_operation_contract_without_service_contract_highlighting = warning +resharper_operator_is_can_be_used_highlighting = warning +resharper_operator_without_matched_checked_operator_highlighting = warning +resharper_optional_parameter_hierarchy_mismatch_highlighting = warning +resharper_optional_parameter_ref_out_highlighting = warning +resharper_other_tags_inside_script1_highlighting = error +resharper_other_tags_inside_script2_highlighting = error +resharper_other_tags_inside_unclosed_script_highlighting = error +resharper_outdent_is_off_prev_level_highlighting = warning +resharper_output_tag_required_highlighting = warning +resharper_out_parameter_value_is_always_discarded_global_highlighting = suggestion +resharper_out_parameter_value_is_always_discarded_local_highlighting = warning +resharper_overload_signature_inferring_highlighting = hint +resharper_overridden_with_empty_value_highlighting = warning +resharper_overridden_with_same_value_highlighting = suggestion +resharper_parameter_doesnt_make_any_sense_highlighting = warning +resharper_parameter_hides_member_highlighting = warning +resharper_parameter_only_used_for_precondition_check_global_highlighting = suggestion +resharper_parameter_only_used_for_precondition_check_local_highlighting = warning +resharper_parameter_type_can_be_enumerable_global_highlighting = hint +resharper_parameter_type_can_be_enumerable_local_highlighting = hint +resharper_parameter_value_is_not_used_highlighting = warning +resharper_partial_method_parameter_name_mismatch_highlighting = warning +resharper_partial_method_with_single_part_highlighting = warning +resharper_partial_type_with_single_part_highlighting = warning +resharper_pass_string_interpolation_highlighting = hint +resharper_path_not_resolved_highlighting = error +resharper_pattern_always_matches_highlighting = warning +resharper_pattern_is_always_true_or_false_highlighting = warning +resharper_pattern_is_redundant_highlighting = warning +resharper_pattern_never_matches_highlighting = warning +resharper_place_assignment_expression_into_block_highlighting = none +resharper_polymorphic_field_like_event_invocation_highlighting = warning +resharper_positional_property_used_problem_highlighting = warning +resharper_possible_infinite_inheritance_highlighting = warning +resharper_possible_intended_rethrow_highlighting = warning +resharper_possible_interface_member_ambiguity_highlighting = warning +resharper_possible_invalid_cast_exception_highlighting = warning +resharper_possible_invalid_cast_exception_in_foreach_loop_highlighting = warning +resharper_possible_invalid_operation_exception_highlighting = warning +resharper_possible_loss_of_fraction_highlighting = warning +resharper_possible_mistaken_argument_highlighting = warning +resharper_possible_mistaken_call_to_get_type_1_highlighting = warning +resharper_possible_mistaken_call_to_get_type_2_highlighting = warning +resharper_possible_multiple_enumeration_highlighting = warning +resharper_possible_multiple_write_access_in_double_check_locking_highlighting = warning +resharper_possible_null_reference_exception_highlighting = warning +resharper_possible_struct_member_modification_of_non_variable_struct_highlighting = warning +resharper_possible_unintended_linear_search_in_set_highlighting = warning +resharper_possible_unintended_queryable_as_enumerable_highlighting = suggestion +resharper_possible_unintended_reference_comparison_highlighting = warning +resharper_possible_write_to_me_highlighting = warning +resharper_possibly_impure_method_call_on_readonly_variable_highlighting = warning +resharper_possibly_incorrectly_broken_statement_highlighting = warning +resharper_possibly_missing_indexer_initializer_comma_highlighting = warning +resharper_possibly_mistaken_use_of_interpolated_string_insert_highlighting = warning +resharper_possibly_unassigned_property_highlighting = hint +resharper_possibly_unintended_usage_parameterless_get_expression_type_highlighting = error +resharper_private_field_can_be_converted_to_local_variable_highlighting = warning +resharper_private_variable_can_be_made_readonly_highlighting = hint +resharper_property_can_be_made_init_only_global_highlighting = suggestion +resharper_property_can_be_made_init_only_local_highlighting = suggestion +resharper_property_field_keyword_is_never_assigned_highlighting = warning +resharper_property_field_keyword_is_never_used_highlighting = warning +resharper_property_getter_cannot_have_parameters_highlighting = error +resharper_property_not_resolved_highlighting = error +resharper_property_setter_must_have_single_parameter_highlighting = error +resharper_public_constructor_in_abstract_class_highlighting = suggestion +resharper_pure_attribute_on_void_method_highlighting = warning +resharper_qualified_expression_is_null_highlighting = warning +resharper_qualified_expression_maybe_null_highlighting = warning +resharper_raw_string_can_be_simplified_highlighting = hint +resharper_razor_layout_not_resolved_highlighting = error +resharper_razor_section_not_resolved_highlighting = error +resharper_read_access_in_double_check_locking_highlighting = warning +resharper_redundant_abstract_modifier_highlighting = warning +resharper_redundant_accessor_body_highlighting = suggestion +resharper_redundant_always_match_subpattern_highlighting = suggestion +resharper_redundant_anonymous_type_property_name_highlighting = warning +resharper_redundant_argument_default_value_highlighting = warning +resharper_redundant_array_creation_expression_highlighting = hint +resharper_redundant_array_lower_bound_specification_highlighting = warning +resharper_redundant_assignment_highlighting = warning +resharper_redundant_attribute_parentheses_highlighting = hint +resharper_redundant_attribute_suffix_highlighting = warning +resharper_redundant_attribute_usage_property_highlighting = suggestion +resharper_redundant_base_constructor_call_highlighting = warning +resharper_redundant_base_qualifier_highlighting = warning +resharper_redundant_blank_lines_highlighting = warning +resharper_redundant_block_highlighting = warning +resharper_redundant_bool_compare_highlighting = warning +resharper_redundant_caller_argument_expression_default_value_highlighting = warning +resharper_redundant_case_label_highlighting = warning +resharper_redundant_cast_highlighting = warning +resharper_redundant_catch_clause_highlighting = warning +resharper_redundant_check_before_assignment_highlighting = warning +resharper_redundant_collection_initializer_element_braces_highlighting = hint +resharper_redundant_comparison_with_boolean_highlighting = warning +resharper_redundant_configure_await_highlighting = suggestion +resharper_redundant_css_hack_highlighting = warning +resharper_redundant_declaration_semicolon_highlighting = hint +resharper_redundant_default_member_initializer_highlighting = none +resharper_redundant_delegate_creation_highlighting = warning +resharper_redundant_dictionary_contains_key_before_adding_highlighting = warning +resharper_redundant_disable_warning_comment_highlighting = warning +resharper_redundant_discard_designation_highlighting = suggestion +resharper_redundant_else_block_highlighting = warning +resharper_redundant_empty_case_else_highlighting = warning +resharper_redundant_empty_constructor_highlighting = warning +resharper_redundant_empty_finally_block_highlighting = warning +resharper_redundant_empty_object_creation_argument_list_highlighting = hint +resharper_redundant_empty_object_or_collection_initializer_highlighting = warning +resharper_redundant_empty_switch_section_highlighting = warning +resharper_redundant_enumerable_cast_call_highlighting = warning +resharper_redundant_enum_case_label_for_default_section_highlighting = none +resharper_redundant_explicit_array_creation_highlighting = warning +resharper_redundant_explicit_array_size_highlighting = warning +resharper_redundant_explicit_nullable_creation_highlighting = warning +resharper_redundant_explicit_params_array_creation_highlighting = suggestion +resharper_redundant_explicit_positional_property_declaration_highlighting = warning +resharper_redundant_explicit_tuple_component_name_highlighting = warning +resharper_redundant_extends_list_entry_highlighting = warning +resharper_redundant_fixed_pointer_declaration_highlighting = suggestion +resharper_redundant_highlighting = warning +resharper_redundant_if_else_block_highlighting = hint +resharper_redundant_if_statement_then_keyword_highlighting = none +resharper_redundant_immediate_delegate_invocation_highlighting = suggestion +resharper_redundant_intermediate_variable_highlighting = hint +resharper_redundant_is_before_relational_pattern_highlighting = suggestion +resharper_redundant_iterator_keyword_highlighting = warning +resharper_redundant_jump_statement_highlighting = warning +resharper_redundant_lambda_parameter_type_highlighting = warning +resharper_redundant_lambda_signature_parentheses_highlighting = hint +resharper_redundant_linebreak_highlighting = none +resharper_redundant_local_class_name_highlighting = hint +resharper_redundant_local_function_name_highlighting = hint +resharper_redundant_logical_conditional_expression_operand_highlighting = warning +resharper_redundant_me_qualifier_highlighting = warning +resharper_redundant_my_base_qualifier_highlighting = warning +resharper_redundant_my_class_qualifier_highlighting = warning +resharper_redundant_name_qualifier_highlighting = warning +resharper_redundant_not_null_constraint_highlighting = warning +resharper_redundant_nullable_annotation_on_reference_type_constraint_highlighting = warning +resharper_redundant_nullable_annotation_on_type_constraint_has_non_nullable_base_type_highlighting = warning +resharper_redundant_nullable_annotation_on_type_constraint_has_non_nullable_type_kind_highlighting = warning +resharper_redundant_nullable_directive_highlighting = warning +resharper_redundant_nullable_flow_attribute_highlighting = warning +resharper_redundant_nullable_type_mark_highlighting = warning +resharper_redundant_nullness_attribute_with_nullable_reference_types_highlighting = warning +resharper_redundant_overflow_checking_context_highlighting = warning +resharper_redundant_overload_global_highlighting = suggestion +resharper_redundant_overload_local_highlighting = suggestion +resharper_redundant_overridden_member_highlighting = warning +resharper_redundant_params_highlighting = warning +resharper_redundant_parentheses_highlighting = none +resharper_redundant_parent_type_declaration_highlighting = warning +resharper_redundant_pattern_parentheses_highlighting = hint +resharper_redundant_property_parentheses_highlighting = hint +resharper_redundant_property_pattern_clause_highlighting = suggestion +resharper_redundant_qualifier_highlighting = warning +resharper_redundant_query_order_by_ascending_keyword_highlighting = hint +resharper_redundant_range_bound_highlighting = suggestion +resharper_redundant_readonly_modifier_highlighting = suggestion +resharper_redundant_record_class_keyword_highlighting = warning +resharper_redundant_scoped_parameter_modifier_highlighting = warning +resharper_redundant_setter_value_parameter_declaration_highlighting = hint +resharper_redundant_set_contains_before_adding_highlighting = warning +resharper_redundant_space_highlighting = warning +resharper_redundant_string_format_call_highlighting = warning +resharper_redundant_string_interpolation_highlighting = suggestion +resharper_redundant_string_to_char_array_call_highlighting = warning +resharper_redundant_string_type_highlighting = suggestion +resharper_redundant_suppress_nullable_warning_expression_highlighting = warning +resharper_redundant_ternary_expression_highlighting = warning +resharper_redundant_to_string_call_for_value_type_highlighting = hint +resharper_redundant_to_string_call_highlighting = warning +resharper_redundant_type_arguments_of_method_highlighting = warning +resharper_redundant_type_cast_highlighting = warning +resharper_redundant_type_cast_structural_highlighting = warning +resharper_redundant_type_check_in_pattern_highlighting = warning +resharper_redundant_type_declaration_body_highlighting = warning +resharper_redundant_units_highlighting = warning +resharper_redundant_unsafe_context_highlighting = warning +resharper_redundant_using_directive_global_highlighting = warning +resharper_redundant_using_directive_highlighting = warning +resharper_redundant_variable_type_specification_highlighting = hint +resharper_redundant_verbatim_prefix_highlighting = suggestion +resharper_redundant_verbatim_string_prefix_highlighting = suggestion +resharper_redundant_virtual_modifier_highlighting = warning +resharper_redundant_with_cancellation_highlighting = warning +resharper_redundant_with_expression_highlighting = suggestion +resharper_reference_equals_with_value_type_highlighting = warning +resharper_reg_exp_inspections_highlighting = warning +resharper_remove_constructor_invocation_highlighting = none +resharper_remove_redundant_braces_highlighting = suggestion +resharper_remove_redundant_or_statement_false_highlighting = suggestion +resharper_remove_redundant_or_statement_true_highlighting = suggestion +resharper_remove_to_list_1_highlighting = suggestion +resharper_remove_to_list_2_highlighting = suggestion +resharper_replace_auto_property_with_computed_property_highlighting = hint +resharper_replace_conditional_expression_with_null_coalescing_highlighting = suggestion +resharper_replace_indicing_with_array_destructuring_highlighting = hint +resharper_replace_indicing_with_short_hand_properties_after_destructuring_highlighting = hint +resharper_replace_object_pattern_with_var_pattern_highlighting = suggestion +resharper_replace_sequence_equal_with_constant_pattern_highlighting = suggestion +resharper_replace_slice_with_range_indexer_highlighting = hint +resharper_replace_substring_with_range_indexer_highlighting = hint +resharper_replace_undefined_checking_series_with_object_destructuring_highlighting = hint +resharper_replace_with_destructuring_swap_highlighting = hint +resharper_replace_with_field_keyword_highlighting = suggestion +resharper_replace_with_first_or_default_1_highlighting = suggestion +resharper_replace_with_first_or_default_2_highlighting = suggestion +resharper_replace_with_first_or_default_3_highlighting = suggestion +resharper_replace_with_first_or_default_4_highlighting = suggestion +resharper_replace_with_last_or_default_1_highlighting = suggestion +resharper_replace_with_last_or_default_2_highlighting = suggestion +resharper_replace_with_last_or_default_3_highlighting = suggestion +resharper_replace_with_last_or_default_4_highlighting = suggestion +resharper_replace_with_of_type_1_highlighting = suggestion +resharper_replace_with_of_type_2_highlighting = suggestion +resharper_replace_with_of_type_3_highlighting = suggestion +resharper_replace_with_of_type_any_1_highlighting = suggestion +resharper_replace_with_of_type_any_2_highlighting = suggestion +resharper_replace_with_of_type_count_1_highlighting = suggestion +resharper_replace_with_of_type_count_2_highlighting = suggestion +resharper_replace_with_of_type_first_1_highlighting = suggestion +resharper_replace_with_of_type_first_2_highlighting = suggestion +resharper_replace_with_of_type_first_or_default_1_highlighting = suggestion +resharper_replace_with_of_type_first_or_default_2_highlighting = suggestion +resharper_replace_with_of_type_last_1_highlighting = suggestion +resharper_replace_with_of_type_last_2_highlighting = suggestion +resharper_replace_with_of_type_last_or_default_1_highlighting = suggestion +resharper_replace_with_of_type_last_or_default_2_highlighting = suggestion +resharper_replace_with_of_type_long_count_highlighting = suggestion +resharper_replace_with_of_type_single_1_highlighting = suggestion +resharper_replace_with_of_type_single_2_highlighting = suggestion +resharper_replace_with_of_type_single_or_default_1_highlighting = suggestion +resharper_replace_with_of_type_single_or_default_2_highlighting = suggestion +resharper_replace_with_of_type_where_highlighting = suggestion +resharper_replace_with_primary_constructor_parameter_highlighting = suggestion +resharper_replace_with_simple_assignment_false_highlighting = suggestion +resharper_replace_with_simple_assignment_true_highlighting = suggestion +resharper_replace_with_single_assignment_false_highlighting = suggestion +resharper_replace_with_single_assignment_true_highlighting = suggestion +resharper_replace_with_single_call_to_any_highlighting = suggestion +resharper_replace_with_single_call_to_count_highlighting = suggestion +resharper_replace_with_single_call_to_first_highlighting = suggestion +resharper_replace_with_single_call_to_first_or_default_highlighting = suggestion +resharper_replace_with_single_call_to_last_highlighting = suggestion +resharper_replace_with_single_call_to_last_or_default_highlighting = suggestion +resharper_replace_with_single_call_to_single_highlighting = suggestion +resharper_replace_with_single_call_to_single_or_default_highlighting = suggestion +resharper_replace_with_single_or_default_1_highlighting = suggestion +resharper_replace_with_single_or_default_2_highlighting = suggestion +resharper_replace_with_single_or_default_3_highlighting = suggestion +resharper_replace_with_single_or_default_4_highlighting = suggestion +resharper_replace_with_string_is_null_or_empty_highlighting = suggestion +resharper_required_base_types_conflict_highlighting = warning +resharper_required_base_types_direct_conflict_highlighting = warning +resharper_required_base_types_is_not_inherited_highlighting = warning +resharper_requires_fallback_color_highlighting = warning +resharper_resource_item_not_resolved_highlighting = error +resharper_resource_not_resolved_highlighting = error +resharper_resx_not_resolved_highlighting = warning +resharper_return_from_global_scopet_with_value_highlighting = warning +resharper_return_of_task_produced_by_using_variable_highlighting = warning +resharper_return_of_using_variable_highlighting = warning +resharper_return_type_can_be_enumerable_global_highlighting = hint +resharper_return_type_can_be_enumerable_local_highlighting = hint +resharper_return_type_can_be_not_nullable_highlighting = warning +resharper_return_value_of_pure_method_is_not_used_highlighting = warning +resharper_route_templates_action_route_prefix_can_be_extracted_to_controller_route_highlighting = hint +resharper_route_templates_ambiguous_matching_constraint_constructor_highlighting = warning +resharper_route_templates_constraint_argument_cannot_be_converted_highlighting = warning +resharper_route_templates_controller_route_parameter_is_not_passed_to_methods_highlighting = hint +resharper_route_templates_duplicated_parameter_highlighting = warning +resharper_route_templates_matching_constraint_constructor_not_resolved_highlighting = warning +resharper_route_templates_method_missing_route_parameters_highlighting = hint +resharper_route_templates_optional_parameter_can_be_preceded_only_by_single_period_highlighting = warning +resharper_route_templates_optional_parameter_must_be_at_the_end_of_segment_highlighting = warning +resharper_route_templates_parameter_constraint_can_be_specified_highlighting = hint +resharper_route_templates_parameter_type_and_constraints_mismatch_highlighting = warning +resharper_route_templates_parameter_type_can_be_made_stricter_highlighting = suggestion +resharper_route_templates_route_parameter_constraint_not_resolved_highlighting = warning +resharper_route_templates_route_parameter_is_not_passed_to_method_highlighting = hint +resharper_route_templates_route_token_not_resolved_highlighting = warning +resharper_route_templates_symbol_not_resolved_highlighting = warning +resharper_route_templates_syntax_error_highlighting = warning +resharper_safe_cast_is_used_as_type_check_highlighting = suggestion +resharper_same_imports_with_different_name_highlighting = warning +resharper_same_variable_assignment_highlighting = warning +resharper_script_tag_has_both_src_and_content_attributes_highlighting = error +resharper_script_tag_with_content_before_includes_highlighting = hint +resharper_sealed_member_in_sealed_class_highlighting = warning +resharper_separate_control_transfer_statement_highlighting = suggestion +resharper_separate_local_functions_with_jump_statement_highlighting = hint +resharper_service_contract_without_operations_highlighting = warning +resharper_shift_expression_real_shift_count_is_zero_highlighting = warning +resharper_shift_expression_result_equals_zero_highlighting = warning +resharper_shift_expression_right_operand_not_equal_real_count_highlighting = warning +resharper_shift_expression_zero_left_operand_highlighting = warning +resharper_similar_anonymous_type_nearby_highlighting = hint +resharper_similar_expressions_comparison_highlighting = warning +resharper_simplify_conditional_operator_highlighting = suggestion +resharper_simplify_conditional_ternary_expression_highlighting = suggestion +resharper_simplify_i_if_highlighting = suggestion +resharper_simplify_linq_expression_use_all_highlighting = suggestion +resharper_simplify_linq_expression_use_any_highlighting = suggestion +resharper_simplify_linq_expression_use_min_by_and_max_by_highlighting = suggestion +resharper_simplify_string_interpolation_highlighting = suggestion +resharper_specify_a_culture_in_string_conversion_explicitly_highlighting = warning +resharper_specify_string_comparison_highlighting = hint +resharper_specify_variable_type_explicitly_highlighting = hint +resharper_spin_lock_in_readonly_field_highlighting = warning +resharper_stack_alloc_inside_loop_highlighting = warning +resharper_statement_termination_highlighting = warning +resharper_static_member_initializer_referes_to_member_below_highlighting = warning +resharper_static_member_in_generic_type_highlighting = warning +resharper_static_problem_in_text_highlighting = warning +resharper_std_is_constant_evaluated_will_always_evaluate_to_constant_highlighting = warning +resharper_string_compare_is_culture_specific_1_highlighting = warning +resharper_string_compare_is_culture_specific_2_highlighting = warning +resharper_string_compare_is_culture_specific_3_highlighting = warning +resharper_string_compare_is_culture_specific_4_highlighting = warning +resharper_string_compare_is_culture_specific_5_highlighting = warning +resharper_string_compare_is_culture_specific_6_highlighting = warning +resharper_string_compare_to_is_culture_specific_highlighting = warning +resharper_string_concatenation_to_template_string_highlighting = hint +resharper_string_ends_with_is_culture_specific_highlighting = warning +resharper_string_index_of_is_culture_specific_1_highlighting = warning +resharper_string_index_of_is_culture_specific_2_highlighting = warning +resharper_string_index_of_is_culture_specific_3_highlighting = warning +resharper_string_last_index_of_is_culture_specific_1_highlighting = warning +resharper_string_last_index_of_is_culture_specific_2_highlighting = warning +resharper_string_last_index_of_is_culture_specific_3_highlighting = warning +resharper_string_literal_as_interpolation_argument_highlighting = suggestion +resharper_string_literal_typo_highlighting = none +resharper_string_literal_wrong_quotes_highlighting = hint +resharper_string_starts_with_is_culture_specific_highlighting = warning +resharper_structured_message_template_problem_highlighting = warning +resharper_struct_can_be_made_read_only_highlighting = suggestion +resharper_struct_member_can_be_made_read_only_highlighting = none +resharper_suggest_base_type_for_parameter_highlighting = hint +resharper_suggest_base_type_for_parameter_in_constructor_highlighting = hint +resharper_suggest_discard_declaration_var_style_highlighting = hint +resharper_suggest_var_or_type_built_in_types_highlighting = hint +resharper_suggest_var_or_type_deconstruction_declarations_highlighting = hint +resharper_suggest_var_or_type_elsewhere_highlighting = hint +resharper_suggest_var_or_type_simple_types_highlighting = hint +resharper_super_call_highlighting = suggestion +resharper_super_call_prohibits_this_highlighting = error +resharper_suppress_nullable_warning_expression_as_inverted_is_expression_highlighting = warning +resharper_suspicious_instanceof_check_highlighting = warning +resharper_suspicious_lambda_block_highlighting = warning +resharper_suspicious_lock_over_synchronization_primitive_highlighting = warning +resharper_suspicious_math_sign_method_highlighting = warning +resharper_suspicious_parameter_name_in_argument_null_exception_highlighting = warning +resharper_suspicious_this_usage_highlighting = warning +resharper_suspicious_typeof_check_highlighting = warning +resharper_suspicious_type_conversion_global_highlighting = warning +resharper_swap_via_deconstruction_highlighting = suggestion +resharper_switch_expression_handles_some_known_enum_values_with_exception_in_default_highlighting = hint +resharper_switch_statement_for_enum_misses_default_section_highlighting = hint +resharper_switch_statement_handles_some_known_enum_values_with_default_highlighting = hint +resharper_switch_statement_missing_some_enum_cases_no_default_highlighting = hint +resharper_symbol_from_not_copied_locally_reference_used_warning_highlighting = warning +resharper_syntax_is_not_allowed_highlighting = warning +resharper_tabs_and_spaces_mismatch_highlighting = warning +resharper_tabs_are_disallowed_highlighting = none +resharper_tabs_outside_indent_highlighting = warning +resharper_tail_recursive_call_highlighting = hint +resharper_tasks_not_loaded_highlighting = warning +resharper_template_duplicate_property_problem_highlighting = warning +resharper_template_format_string_problem_highlighting = warning +resharper_template_is_not_compile_time_constant_problem_highlighting = warning +resharper_ternary_can_be_replaced_by_its_condition_highlighting = warning +resharper_this_in_global_context_highlighting = warning +resharper_thread_static_at_instance_field_highlighting = warning +resharper_thread_static_field_has_initializer_highlighting = warning +resharper_throwing_system_exception_highlighting = suggestion +resharper_throw_from_catch_with_no_inner_exception_highlighting = warning +resharper_throw_must_be_followed_by_expression_highlighting = error +resharper_too_wide_local_variable_scope_highlighting = suggestion +resharper_try_cast_always_succeeds_highlighting = suggestion +resharper_try_statements_can_be_merged_highlighting = hint +resharper_ts_not_resolved_highlighting = error +resharper_ts_resolved_from_inaccessible_module_highlighting = error +resharper_type_guard_doesnt_affect_anything_highlighting = warning +resharper_type_guard_produces_never_type_highlighting = warning +resharper_type_parameter_can_be_variant_highlighting = suggestion +resharper_type_parameter_hides_type_param_from_outer_scope_highlighting = warning +resharper_ul_tag_contains_non_li_elements_highlighting = hint +resharper_unassigned_field_global_highlighting = suggestion +resharper_unassigned_field_local_highlighting = warning +resharper_unassigned_get_only_auto_property_highlighting = warning +resharper_unassigned_readonly_field_highlighting = warning +resharper_unclosed_script_highlighting = error +resharper_undeclared_global_variable_using_highlighting = warning +resharper_unexpected_value_highlighting = error +resharper_unknown_css_class_highlighting = warning +resharper_unknown_css_variable_highlighting = warning +resharper_unknown_css_vendor_extension_highlighting = hint +resharper_unknown_item_group_highlighting = suggestion +resharper_unknown_metadata_highlighting = suggestion +resharper_unknown_output_parameter_highlighting = warning +resharper_unknown_property_highlighting = none +resharper_unknown_target_highlighting = suggestion +resharper_unknown_task_attribute_highlighting = suggestion +resharper_unknown_task_highlighting = warning +resharper_unnecessary_whitespace_highlighting = suggestion +resharper_unreachable_switch_arm_due_to_integer_analysis_highlighting = warning +resharper_unreachable_switch_case_due_to_integer_analysis_highlighting = warning +resharper_unreal_header_tool_error_highlighting = error +resharper_unreal_header_tool_warning_highlighting = warning +resharper_unsafe_comma_in_object_properties_list_highlighting = warning +resharper_unsupported_required_base_type_highlighting = warning +resharper_unused_anonymous_method_signature_highlighting = warning +resharper_unused_auto_property_accessor_global_highlighting = none +resharper_unused_auto_property_accessor_local_highlighting = warning +resharper_unused_import_clause_highlighting = warning +resharper_unused_inherited_parameter_highlighting = hint +resharper_unused_locals_highlighting = warning +resharper_unused_local_function_highlighting = warning +resharper_unused_local_function_parameter_highlighting = warning +resharper_unused_local_function_return_value_highlighting = warning +resharper_unused_local_import_highlighting = warning +resharper_unused_member_global_highlighting = none +resharper_unused_member_hierarchy_global_highlighting = suggestion +resharper_unused_member_hierarchy_local_highlighting = warning +resharper_unused_member_in_super_global_highlighting = suggestion +resharper_unused_member_in_super_local_highlighting = warning +resharper_unused_member_local_highlighting = warning +resharper_unused_method_return_value_global_highlighting = suggestion +resharper_unused_method_return_value_local_highlighting = warning +resharper_unused_nullable_directive_highlighting = warning +resharper_unused_parameter_global_highlighting = suggestion +resharper_unused_parameter_highlighting = warning +resharper_unused_parameter_in_partial_method_highlighting = warning +resharper_unused_parameter_local_highlighting = warning +resharper_unused_property_highlighting = warning +resharper_unused_tuple_component_in_return_value_highlighting = warning +resharper_unused_type_global_highlighting = none +resharper_unused_type_local_highlighting = warning +resharper_unused_type_parameter_highlighting = warning +resharper_unused_variable_highlighting = warning +resharper_usage_of_definitely_unassigned_value_highlighting = warning +resharper_usage_of_possibly_unassigned_value_highlighting = warning +resharper_useless_binary_operation_highlighting = warning +resharper_useless_comparison_to_integral_constant_highlighting = warning +resharper_use_array_creation_expression_1_highlighting = suggestion +resharper_use_array_creation_expression_2_highlighting = suggestion +resharper_use_array_empty_method_highlighting = suggestion +resharper_use_as_instead_of_type_cast_highlighting = hint +resharper_use_await_using_highlighting = suggestion +resharper_use_cancellation_token_for_i_async_enumerable_highlighting = suggestion +resharper_use_collection_count_property_highlighting = suggestion +resharper_use_configure_await_false_for_async_disposable_highlighting = none +resharper_use_configure_await_false_highlighting = suggestion +resharper_use_deconstruction_highlighting = hint +resharper_use_discard_assignment_highlighting = suggestion +resharper_use_empty_types_field_highlighting = suggestion +resharper_use_event_args_empty_field_highlighting = suggestion +resharper_use_format_specifier_in_format_string_highlighting = suggestion +resharper_use_implicitly_typed_variable_evident_highlighting = hint +resharper_use_implicitly_typed_variable_highlighting = none +resharper_use_implicit_by_val_modifier_highlighting = hint +resharper_use_indexed_property_highlighting = suggestion +resharper_use_index_from_end_expression_highlighting = suggestion +resharper_use_is_operator_1_highlighting = suggestion +resharper_use_is_operator_2_highlighting = suggestion +resharper_use_method_any_0_highlighting = suggestion +resharper_use_method_any_1_highlighting = suggestion +resharper_use_method_any_2_highlighting = suggestion +resharper_use_method_any_3_highlighting = suggestion +resharper_use_method_any_4_highlighting = suggestion +resharper_use_method_is_instance_of_type_highlighting = suggestion +resharper_use_nameof_expression_for_part_of_the_string_highlighting = none +resharper_use_nameof_expression_highlighting = suggestion +resharper_use_nameof_for_dependency_property_highlighting = suggestion +resharper_use_name_of_instead_of_type_of_highlighting = suggestion +resharper_use_negated_pattern_in_is_expression_highlighting = hint +resharper_use_negated_pattern_matching_highlighting = hint +resharper_use_nullable_annotation_instead_of_attribute_highlighting = suggestion +resharper_use_nullable_attributes_supported_by_compiler_highlighting = suggestion +resharper_use_nullable_reference_types_annotation_syntax_highlighting = warning +resharper_use_null_propagation_highlighting = hint +resharper_use_object_or_collection_initializer_highlighting = suggestion +resharper_use_of_implicit_global_in_function_scope_highlighting = warning +resharper_use_of_possibly_unassigned_property_highlighting = warning +resharper_use_pattern_matching_highlighting = suggestion +resharper_use_positional_deconstruction_pattern_highlighting = none +resharper_use_raw_string_highlighting = hint +resharper_use_string_interpolation_highlighting = suggestion +resharper_use_string_interpolation_when_possible_highlighting = hint +resharper_use_switch_case_pattern_variable_highlighting = suggestion +resharper_use_throw_if_null_method_highlighting = none +resharper_use_unsigned_right_shift_operator_highlighting = suggestion +resharper_use_verbatim_string_highlighting = hint +resharper_use_with_expression_to_copy_anonymous_object_highlighting = suggestion +resharper_use_with_expression_to_copy_record_highlighting = suggestion +resharper_use_with_expression_to_copy_struct_highlighting = suggestion +resharper_use_with_expression_to_copy_tuple_highlighting = suggestion +resharper_using_of_reserved_word_error_highlighting = error +resharper_using_of_reserved_word_highlighting = warning +resharper_using_statement_resource_initialization_expression_highlighting = hint +resharper_using_statement_resource_initialization_highlighting = warning +resharper_value_parameter_not_used_highlighting = warning +resharper_value_range_attribute_violation_highlighting = warning +resharper_value_should_have_units_highlighting = error +resharper_variable_can_be_made_const_highlighting = hint +resharper_variable_can_be_made_let_highlighting = hint +resharper_variable_can_be_moved_to_inner_block_highlighting = hint +resharper_variable_can_be_not_nullable_highlighting = warning +resharper_variable_hides_outer_variable_highlighting = warning +resharper_variable_used_before_declared_highlighting = warning +resharper_variable_used_in_inner_scope_before_declared_highlighting = warning +resharper_variable_used_out_of_scope_highlighting = warning +resharper_vb_check_for_reference_equality_instead_1_highlighting = suggestion +resharper_vb_check_for_reference_equality_instead_2_highlighting = suggestion +resharper_vb_possible_mistaken_argument_highlighting = warning +resharper_vb_possible_mistaken_call_to_get_type_1_highlighting = warning +resharper_vb_possible_mistaken_call_to_get_type_2_highlighting = warning +resharper_vb_remove_to_list_1_highlighting = suggestion +resharper_vb_remove_to_list_2_highlighting = suggestion +resharper_vb_replace_with_first_or_default_highlighting = suggestion +resharper_vb_replace_with_last_or_default_highlighting = suggestion +resharper_vb_replace_with_of_type_1_highlighting = suggestion +resharper_vb_replace_with_of_type_2_highlighting = suggestion +resharper_vb_replace_with_of_type_any_1_highlighting = suggestion +resharper_vb_replace_with_of_type_any_2_highlighting = suggestion +resharper_vb_replace_with_of_type_count_1_highlighting = suggestion +resharper_vb_replace_with_of_type_count_2_highlighting = suggestion +resharper_vb_replace_with_of_type_first_1_highlighting = suggestion +resharper_vb_replace_with_of_type_first_2_highlighting = suggestion +resharper_vb_replace_with_of_type_first_or_default_1_highlighting = suggestion +resharper_vb_replace_with_of_type_first_or_default_2_highlighting = suggestion +resharper_vb_replace_with_of_type_last_1_highlighting = suggestion +resharper_vb_replace_with_of_type_last_2_highlighting = suggestion +resharper_vb_replace_with_of_type_last_or_default_1_highlighting = suggestion +resharper_vb_replace_with_of_type_last_or_default_2_highlighting = suggestion +resharper_vb_replace_with_of_type_single_1_highlighting = suggestion +resharper_vb_replace_with_of_type_single_2_highlighting = suggestion +resharper_vb_replace_with_of_type_single_or_default_1_highlighting = suggestion +resharper_vb_replace_with_of_type_single_or_default_2_highlighting = suggestion +resharper_vb_replace_with_of_type_where_highlighting = suggestion +resharper_vb_replace_with_single_assignment_1_highlighting = suggestion +resharper_vb_replace_with_single_assignment_2_highlighting = suggestion +resharper_vb_replace_with_single_call_to_any_highlighting = suggestion +resharper_vb_replace_with_single_call_to_count_highlighting = suggestion +resharper_vb_replace_with_single_call_to_first_highlighting = suggestion +resharper_vb_replace_with_single_call_to_first_or_default_highlighting = suggestion +resharper_vb_replace_with_single_call_to_last_highlighting = suggestion +resharper_vb_replace_with_single_call_to_last_or_default_highlighting = suggestion +resharper_vb_replace_with_single_call_to_single_highlighting = suggestion +resharper_vb_replace_with_single_call_to_single_or_default_highlighting = suggestion +resharper_vb_replace_with_single_or_default_highlighting = suggestion +resharper_vb_simplify_linq_expression_10_highlighting = hint +resharper_vb_simplify_linq_expression_1_highlighting = suggestion +resharper_vb_simplify_linq_expression_2_highlighting = suggestion +resharper_vb_simplify_linq_expression_3_highlighting = suggestion +resharper_vb_simplify_linq_expression_4_highlighting = suggestion +resharper_vb_simplify_linq_expression_5_highlighting = suggestion +resharper_vb_simplify_linq_expression_6_highlighting = suggestion +resharper_vb_simplify_linq_expression_7_highlighting = hint +resharper_vb_simplify_linq_expression_8_highlighting = hint +resharper_vb_simplify_linq_expression_9_highlighting = hint +resharper_vb_string_compare_is_culture_specific_1_highlighting = warning +resharper_vb_string_compare_is_culture_specific_2_highlighting = warning +resharper_vb_string_compare_is_culture_specific_3_highlighting = warning +resharper_vb_string_compare_is_culture_specific_4_highlighting = warning +resharper_vb_string_compare_is_culture_specific_5_highlighting = warning +resharper_vb_string_compare_is_culture_specific_6_highlighting = warning +resharper_vb_string_compare_to_is_culture_specific_highlighting = warning +resharper_vb_string_ends_with_is_culture_specific_highlighting = none +resharper_vb_string_index_of_is_culture_specific_1_highlighting = warning +resharper_vb_string_index_of_is_culture_specific_2_highlighting = warning +resharper_vb_string_index_of_is_culture_specific_3_highlighting = warning +resharper_vb_string_last_index_of_is_culture_specific_1_highlighting = warning +resharper_vb_string_last_index_of_is_culture_specific_2_highlighting = warning +resharper_vb_string_last_index_of_is_culture_specific_3_highlighting = warning +resharper_vb_string_starts_with_is_culture_specific_highlighting = none +resharper_vb_unreachable_code_highlighting = warning +resharper_vb_use_array_creation_expression_1_highlighting = suggestion +resharper_vb_use_array_creation_expression_2_highlighting = suggestion +resharper_vb_use_first_instead_highlighting = warning +resharper_vb_use_method_any_1_highlighting = suggestion +resharper_vb_use_method_any_2_highlighting = suggestion +resharper_vb_use_method_any_3_highlighting = suggestion +resharper_vb_use_method_any_4_highlighting = suggestion +resharper_vb_use_method_any_5_highlighting = suggestion +resharper_vb_use_method_is_instance_of_type_highlighting = suggestion +resharper_vb_use_type_of_is_operator_1_highlighting = suggestion +resharper_vb_use_type_of_is_operator_2_highlighting = suggestion +resharper_virtual_member_call_in_constructor_highlighting = none +resharper_virtual_member_never_overridden_global_highlighting = suggestion +resharper_virtual_member_never_overridden_local_highlighting = suggestion +resharper_void_method_with_must_use_return_value_attribute_highlighting = warning +resharper_vulnerable_package_highlighting = warning +resharper_web_config_module_not_resolved_highlighting = error +resharper_web_config_module_qualification_resolve_highlighting = warning +resharper_web_config_redundant_add_namespace_tag_highlighting = warning +resharper_web_config_redundant_location_tag_highlighting = warning +resharper_web_config_tag_prefix_redundand_highlighting = warning +resharper_web_config_type_not_resolved_highlighting = error +resharper_web_config_unused_add_tag_highlighting = warning +resharper_web_config_unused_element_due_to_config_source_attribute_highlighting = warning +resharper_web_config_unused_remove_or_clear_tag_highlighting = warning +resharper_web_config_web_config_path_warning_highlighting = warning +resharper_web_config_wrong_module_highlighting = error +resharper_web_ignored_path_highlighting = none +resharper_web_mapped_path_highlighting = hint +resharper_with_expression_instead_of_initializer_highlighting = suggestion +resharper_with_expression_modifies_all_members_highlighting = warning +resharper_with_statement_using_error_highlighting = error +resharper_wrong_expression_statement_highlighting = warning +resharper_wrong_indent_size_highlighting = warning +resharper_wrong_metadata_use_highlighting = none +resharper_wrong_public_modifier_specification_highlighting = hint +resharper_wrong_require_relative_path_highlighting = hint +resharper_xaml_assign_null_to_not_null_attribute_highlighting = warning +resharper_xaml_avalonia_wrong_binding_mode_for_stream_binding_operator_highlighting = warning +resharper_xaml_binding_without_context_not_resolved_highlighting = hint +resharper_xaml_binding_with_context_not_resolved_highlighting = warning +resharper_xaml_compiled_binding_missing_data_type_error_highlighting_highlighting = error +resharper_xaml_constructor_warning_highlighting = warning +resharper_xaml_decimal_parsing_is_culture_dependent_highlighting = warning +resharper_xaml_dependency_property_resolve_error_highlighting = warning +resharper_xaml_duplicate_style_setter_highlighting = warning +resharper_xaml_dynamic_resource_error_highlighting = error +resharper_xaml_element_name_reference_not_resolved_highlighting = error +resharper_xaml_empty_grid_length_definition_highlighting = error +resharper_xaml_field_modifier_requires_name_attribute_highlighting = warning +resharper_xaml_grid_definitions_can_be_converted_to_attribute_highlighting = hint +resharper_xaml_ignored_path_highlighting_highlighting = none +resharper_xaml_index_out_of_grid_definition_highlighting = warning +resharper_xaml_invalid_member_type_highlighting = error +resharper_xaml_invalid_resource_target_type_highlighting = error +resharper_xaml_invalid_resource_type_highlighting = error +resharper_xaml_invalid_type_highlighting = error +resharper_xaml_language_level_highlighting = error +resharper_xaml_mapped_path_highlighting_highlighting = hint +resharper_xaml_method_arguments_will_be_ignored_highlighting = warning +resharper_xaml_missing_grid_index_highlighting = warning +resharper_xaml_overloads_collision_highlighting = warning +resharper_xaml_parent_is_out_of_current_component_tree_highlighting = warning +resharper_xaml_path_error_highlighting = warning +resharper_xaml_possible_null_reference_exception_highlighting = suggestion +resharper_xaml_redundant_attached_property_highlighting = warning +resharper_xaml_redundant_binding_mode_attribute_highlighting = warning +resharper_xaml_redundant_collection_property_highlighting = warning +resharper_xaml_redundant_freeze_attribute_highlighting = warning +resharper_xaml_redundant_grid_definitions_highlighting = warning +resharper_xaml_redundant_grid_span_highlighting = warning +resharper_xaml_redundant_modifiers_attribute_highlighting = warning +resharper_xaml_redundant_namespace_alias_highlighting = warning +resharper_xaml_redundant_name_attribute_highlighting = warning +resharper_xaml_redundant_property_type_qualifier_highlighting = warning +resharper_xaml_redundant_resource_highlighting = warning +resharper_xaml_redundant_styled_value_highlighting = warning +resharper_xaml_redundant_update_source_trigger_attribute_highlighting = warning +resharper_xaml_redundant_xamarin_forms_class_declaration_highlighting = warning +resharper_xaml_resource_file_path_case_mismatch_highlighting = warning +resharper_xaml_routed_event_resolve_error_highlighting = warning +resharper_xaml_static_resource_not_resolved_highlighting = warning +resharper_xaml_style_class_not_found_highlighting = warning +resharper_xaml_style_invalid_target_type_highlighting = error +resharper_xaml_unexpected_element_highlighting = error +resharper_xaml_unexpected_text_token_highlighting = error +resharper_xaml_xaml_duplicate_device_family_type_view_highlighting_highlighting = error +resharper_xaml_xaml_mismatched_device_family_view_clr_name_highlighting_highlighting = warning +resharper_xaml_xaml_relative_source_default_mode_warning_highlighting_highlighting = warning +resharper_xaml_xaml_unknown_device_family_type_highlighting_highlighting = warning +resharper_xaml_xaml_xamarin_forms_data_type_and_binding_context_type_mismatched_highlighting_highlighting = warning +resharper_xaml_x_key_attribute_disallowed_highlighting = error +resharper_xml_doc_comment_syntax_problem_highlighting = warning +resharper_xunit_xunit_test_with_console_output_highlighting = warning +resharper_zero_index_from_end_highlighting = warning + +[*.{appxmanifest,asax,ascx,aspx,axaml,axml,build,c,c++,cc,cginc,compute,config,cp,cpp,cppm,cs,cshtml,csproj,css,cu,cuh,cxx,dbml,discomap,dtd,fx,fxh,h,hh,hlsl,hlsli,hlslinc,hpp,htm,html,hxx,inc,inl,ino,ipp,ixx,js,json,jsproj,jsx,lsproj,master,mpp,mq4,mq5,mqh,njsproj,nuspec,paml,proj,props,proto,razor,resjson,resw,resx,skin,StyleCop,targets,tasks,tpp,ts,tsx,usf,ush,vb,vbproj,xaml,xamlx,xml,xoml,xsd}] +indent_style = tab +indent_size = tab +tab_width = 4 diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index fc06fdac5..327546287 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -32,10 +32,8 @@ jobs: run: dotnet build -c Release --no-restore -v minimal -f net7.0 DisCatSharp.sln timeout-minutes: 7 continue-on-error: true - #- name: Add Custom Plugins - # run: cp -R DisCatSharp.Docs/dcs/plugins/* /home/runner/.dotnet/tools/.store/docfx/2.67.0/docfx/2.67.0/tools/net7.0/any/ - name: Build Docs - run: docfx DisCatSharp.Docs/docfx.json + run: docfx DisCatSharp.Docs/docfx.json --logLevel Verbose - name: Pack Docs shell: pwsh run: ./DisCatSharp.Tools/pack-docs.ps1 -DocsPath "./DisCatSharp.Docs" -OutputPath "./" -PackageName "dcs-docs" diff --git a/.github/workflows/documentation_test.yml b/.github/workflows/documentation_test.yml index d723e5cfa..f7d2ba181 100644 --- a/.github/workflows/documentation_test.yml +++ b/.github/workflows/documentation_test.yml @@ -8,10 +8,11 @@ env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true + GH_TOKEN: ${{ github.token }} jobs: build: - timeout-minutes: 20 + timeout-minutes: 25 runs-on: ubuntu-latest name: Build documentation steps: @@ -19,6 +20,9 @@ jobs: uses: actions/checkout@v4 with: token: ${{ secrets.NYUW_TOKEN_GH }} + - name: Checkout PR if nessesary + if: github.event_name == 'pull_request' + run: gh pr checkout ${{ github.event.pull_request.number }} - name: Setup .NET uses: actions/setup-dotnet@v3.2.0 with: @@ -32,10 +36,8 @@ jobs: run: dotnet build -c Release -v minimal -f net7.0 --no-restore DisCatSharp.sln timeout-minutes: 7 continue-on-error: true - #- name: Add Custom Plugins - # run: cp -R DisCatSharp.Docs/dcs/plugins/* /home/runner/.dotnet/tools/.store/docfx/2.67.0/docfx/2.67.0/tools/net7.0/any/ - name: Build Docs - run: docfx DisCatSharp.Docs/docfx.json + run: docfx DisCatSharp.Docs/docfx.json --logLevel Verbose - name: Pack Docs shell: pwsh run: ./DisCatSharp.Tools/pack-docs.ps1 -DocsPath "./DisCatSharp.Docs" -OutputPath "./" -PackageName "dcs-docs-preview" @@ -79,8 +81,6 @@ jobs: run: rm dcs-docs-preview.zip - name: Add .htaccess run: rm -f .htaccess && wget https://gist.githubusercontent.com/Lulalaby/8a032d0ddebb9125691094edc67b6593/raw/0c4bf0423cfe334fdd5092b014d2481759dd052a/.htaccess - #- name: Add _redirects - # run: rm -f _redirects && wget https://gist.githubusercontent.com/Lulalaby/0c784680a855fd161411002e3859b4fd/raw/9708d1acfce3f647cbb8da19c2022a20198979fa/_redirects - name: Set access rights run: sudo chmod 777 -R . - name: Commit changes diff --git a/.nuget/NuGet.config b/.nuget/NuGet.config index 4a4e2f52b..f672dcab5 100644 --- a/.nuget/NuGet.config +++ b/.nuget/NuGet.config @@ -1,11 +1,12 @@ + - - - - - - - - + + + + + + + + diff --git a/Directory.Build.props b/Directory.Build.props index 63fb1b5f0..f38df2a93 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,10 +1,11 @@ + - - - + + + - true + true diff --git a/DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs b/DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs index f5d1f9689..d12fc0c64 100644 --- a/DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs +++ b/DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs @@ -55,12 +55,12 @@ public sealed class ApplicationCommandsExtension : BaseExtension /// /// List of global commands on discords backend. /// - internal static List GlobalDiscordCommands { get; set; } + internal static List? GlobalDiscordCommands { get; set; } /// /// List of guild commands on discords backend. /// - internal static Dictionary> GuildDiscordCommands { get; set; } + internal static Dictionary>? GuildDiscordCommands { get; set; } /// /// Singleton modules. @@ -75,7 +75,7 @@ public sealed class ApplicationCommandsExtension : BaseExtension /// /// Configuration for Discord. /// - internal static ApplicationCommandsConfiguration Configuration; + internal static ApplicationCommandsConfiguration? Configuration; /// /// Set to true if anything fails when registering. @@ -87,23 +87,31 @@ public sealed class ApplicationCommandsExtension : BaseExtension /// public IReadOnlyList>> RegisteredCommands => s_registeredCommands.Select(guild => - new KeyValuePair>(guild.Key, guild.Value - .Select(parent => new RegisteredDiscordApplicationCommand(parent)).ToList())).ToList(); - private static List>> s_registeredCommands = new(); + new KeyValuePair>(guild.Key, guild + .Value + .Select(parent + => new RegisteredDiscordApplicationCommand(parent)) + .ToList())).ToList(); + + private static readonly List>> s_registeredCommands = + new(); /// /// Gets a list of registered global commands. /// public IReadOnlyList GlobalCommands => GlobalCommandsInternal; - internal static List GlobalCommandsInternal = new(); + + internal static readonly List GlobalCommandsInternal = new(); /// /// Gets a list of registered guild commands mapped by guild id. /// public IReadOnlyDictionary> GuildCommands => GuildCommandsInternal; - internal static Dictionary> GuildCommandsInternal = new(); + + internal static readonly Dictionary> GuildCommandsInternal = new(); /// /// Gets the registration count. @@ -141,7 +149,7 @@ internal static LogLevel ApplicationCommandsLogLevel internal static bool ManOr { get; set; } /// - /// Gets whether interactions should be automatically deffered. + /// Gets whether interactions should be automatically deferred. /// internal static bool AutoDeferEnabled { get; set; } @@ -150,25 +158,24 @@ internal static LogLevel ApplicationCommandsLogLevel /// internal bool StartupFinished { get; set; } = false; - /// /// Gets the service provider this module was configured with. /// - public IServiceProvider Services - => Configuration.ServiceProvider; + public IServiceProvider? Services + => Configuration?.ServiceProvider; /// /// Gets a list of handled interactions. Fix for double interaction execution bug. /// - internal static List HandledInteractions = new(); + internal static readonly List HandledInteractions = new(); /// /// Initializes a new instance of the class. /// /// The configuration. - internal ApplicationCommandsExtension(ApplicationCommandsConfiguration configuration = null) + internal ApplicationCommandsExtension(ApplicationCommandsConfiguration? configuration = null) { - configuration ??= new ApplicationCommandsConfiguration(); + configuration ??= new(); Configuration = configuration; DebugEnabled = configuration?.DebugStartup ?? false; CheckAllGuilds = configuration?.CheckAllGuilds ?? false; @@ -186,17 +193,19 @@ protected internal override void Setup(DiscordClient client) if (this.Client != null) throw new InvalidOperationException("What did I tell you?"); + // ReSharper disable once HeuristicUnreachableCode this.Client = client; Logger = client.Logger; - this._slashError = new AsyncEvent("SLASHCOMMAND_ERRORED", TimeSpan.Zero, null); - this._slashExecuted = new AsyncEvent("SLASHCOMMAND_EXECUTED", TimeSpan.Zero, null); - this._contextMenuErrored = new AsyncEvent("CONTEXTMENU_ERRORED", TimeSpan.Zero, null); - this._contextMenuExecuted = new AsyncEvent("CONTEXTMENU_EXECUTED", TimeSpan.Zero, null); - this._applicationCommandsModuleReady = new AsyncEvent("APPLICATION_COMMANDS_MODULE_READY", TimeSpan.Zero, null); - this._applicationCommandsModuleStartupFinished = new AsyncEvent("APPLICATION_COMMANDS_MODULE_STARTUP_FINISHED", TimeSpan.Zero, null); - this._globalApplicationCommandsRegistered = new AsyncEvent("GLOBAL_COMMANDS_REGISTERED", TimeSpan.Zero, null); - this._guildApplicationCommandsRegistered = new AsyncEvent("GUILD_COMMANDS_REGISTERED", TimeSpan.Zero, null); + this._slashError = new("SLASHCOMMAND_ERRORED", TimeSpan.Zero, null); + this._slashExecuted = new("SLASHCOMMAND_EXECUTED", TimeSpan.Zero, null); + this._contextMenuErrored = new("CONTEXTMENU_ERRORED", TimeSpan.Zero, null); + this._contextMenuExecuted = new("CONTEXTMENU_EXECUTED", TimeSpan.Zero, null); + this._applicationCommandsModuleReady = new("APPLICATION_COMMANDS_MODULE_READY", TimeSpan.Zero, null); + this._applicationCommandsModuleStartupFinished = + new("APPLICATION_COMMANDS_MODULE_STARTUP_FINISHED", TimeSpan.Zero, null); + this._globalApplicationCommandsRegistered = new("GLOBAL_COMMANDS_REGISTERED", TimeSpan.Zero, null); + this._guildApplicationCommandsRegistered = new("GUILD_COMMANDS_REGISTERED", TimeSpan.Zero, null); this.Client.GuildDownloadCompleted += (c, e) => { @@ -210,15 +219,24 @@ protected internal override void Setup(DiscordClient client) private async Task CatchInteractionsOnStartup(DiscordClient sender, InteractionCreateEventArgs e) { if (!this.StartupFinished) - await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().AsEphemeral().WithContent("Attention: This application is still starting up. Application commands are unavailable for now.")).ConfigureAwait(false); + await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, + new DiscordInteractionResponseBuilder().AsEphemeral().WithContent( + "Attention: This application is still starting up. Application commands are unavailable for now.")) + .ConfigureAwait(false); else await Task.Delay(1).ConfigureAwait(false); } - private async Task CatchContextMenuInteractionsOnStartup(DiscordClient sender, ContextMenuInteractionCreateEventArgs e) + private async Task CatchContextMenuInteractionsOnStartup( + DiscordClient sender, + ContextMenuInteractionCreateEventArgs e + ) { if (!this.StartupFinished) - await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().AsEphemeral().WithContent("Attention: This application is still starting up. Context menu commands are unavailable for now.")).ConfigureAwait(false); + await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, + new DiscordInteractionResponseBuilder().AsEphemeral().WithContent( + "Attention: This application is still starting up. Context menu commands are unavailable for now.")) + .ConfigureAwait(false); else await Task.Delay(1).ConfigureAwait(false); } @@ -230,9 +248,10 @@ private void FinishedRegistration() this.StartupFinished = true; - this.Client.InteractionCreated += this.InteractionHandler; - this.Client.ContextMenuInteractionCreated += this.ContextMenuHandler; + this.Client.InteractionCreated += this.InteractionHandlerAsync; + this.Client.ContextMenuInteractionCreated += this.ContextMenuHandlerAsync; } + /// /// Cleans the module for a new start of the bot. /// DO NOT USE IF YOU DON'T KNOW WHAT IT DOES. @@ -260,16 +279,19 @@ public void CleanModule() /// internal async Task CleanGuildCommandsAsync() { - foreach (var guild in this.Client.Guilds.Values) - await this.Client.BulkOverwriteGuildApplicationCommandsAsync(guild.Id, Array.Empty()).ConfigureAwait(false); + if (this.Client.Guilds != null) + foreach (var guild in this.Client.Guilds.Values) + await this.Client + .BulkOverwriteGuildApplicationCommandsAsync(guild.Id, Array.Empty()) + .ConfigureAwait(false); } /// /// Cleans the global application commands. /// You normally don't need to execute it. /// - internal async Task CleanGlobalCommandsAsync() - => await this.Client.BulkOverwriteGlobalApplicationCommandsAsync(Array.Empty()).ConfigureAwait(false); + internal Task CleanGlobalCommandsAsync() + => this.Client.BulkOverwriteGlobalApplicationCommandsAsync(Array.Empty()); /// /// Registers all commands from a given assembly. The command classes need to be public to be considered for registration. @@ -308,8 +330,12 @@ public void RegisterGlobalCommands(Assembly assembly) /// The command class to register. /// The guild id to register it on. /// A callback to setup translations with. - public void RegisterGuildCommands(ulong guildId, Action translationSetup = null) where T : ApplicationCommandsModule - => this._updateList.Add(new KeyValuePair(guildId, new ApplicationCommandsModuleConfiguration(typeof(T), translationSetup))); + public void RegisterGuildCommands( + ulong guildId, + Action? translationSetup = null + ) + where T : ApplicationCommandsModule + => this._updateList.Add(new(guildId, new(typeof(T), translationSetup))); /// /// Registers a command class with optional translation setup for a guild. @@ -317,11 +343,15 @@ public void RegisterGuildCommands(ulong guildId, ActionThe of the command class to register. /// The guild id to register it on. /// A callback to setup translations with. - public void RegisterGuildCommands(Type type, ulong guildId, Action translationSetup = null) + public void RegisterGuildCommands( + Type type, ulong guildId, + Action? translationSetup = null + ) { if (!typeof(ApplicationCommandsModule).IsAssignableFrom(type)) throw new ArgumentException("Command classes have to inherit from ApplicationCommandsModule", nameof(type)); - this._updateList.Add(new KeyValuePair(guildId, new ApplicationCommandsModuleConfiguration(type, translationSetup))); + + this._updateList.Add(new(guildId, new(type, translationSetup))); } /// @@ -329,72 +359,90 @@ public void RegisterGuildCommands(Type type, ulong guildId, Action /// The command class to register. /// A callback to setup translations with. - public void RegisterGlobalCommands(Action translationSetup = null) where T : ApplicationCommandsModule - => this._updateList.Add(new KeyValuePair(null, new ApplicationCommandsModuleConfiguration(typeof(T), translationSetup))); + public void RegisterGlobalCommands(Action? translationSetup = null) + where T : ApplicationCommandsModule + => this._updateList.Add(new(null, new(typeof(T), translationSetup))); /// /// Registers a command class with optional translation setup globally. /// /// The of the command class to register. /// A callback to setup translations with. - public void RegisterGlobalCommands(Type type, Action translationSetup = null) + public void RegisterGlobalCommands( + Type type, + Action? translationSetup = null + ) { if (!typeof(ApplicationCommandsModule).IsAssignableFrom(type)) throw new ArgumentException("Command classes have to inherit from ApplicationCommandsModule", nameof(type)); - this._updateList.Add(new KeyValuePair(null, new ApplicationCommandsModuleConfiguration(type, translationSetup))); + + this._updateList.Add(new(null, new(type, translationSetup))); } /// /// Fired when the application commands module is ready. /// - public event AsyncEventHandler ApplicationCommandsModuleReady - { - add => this._applicationCommandsModuleReady.Register(value); - remove => this._applicationCommandsModuleReady.Unregister(value); - } - private AsyncEvent _applicationCommandsModuleReady; + public event AsyncEventHandler + ApplicationCommandsModuleReady + { + add => this._applicationCommandsModuleReady.Register(value); + remove => this._applicationCommandsModuleReady.Unregister(value); + } + + private AsyncEvent + _applicationCommandsModuleReady; /// /// Fired when the application commands modules startup is finished. /// - public event AsyncEventHandler ApplicationCommandsModuleStartupFinished - { - add => this._applicationCommandsModuleStartupFinished.Register(value); - remove => this._applicationCommandsModuleStartupFinished.Unregister(value); - } - private AsyncEvent _applicationCommandsModuleStartupFinished; + public event AsyncEventHandler + ApplicationCommandsModuleStartupFinished + { + add => this._applicationCommandsModuleStartupFinished.Register(value); + remove => this._applicationCommandsModuleStartupFinished.Unregister(value); + } + private AsyncEvent + _applicationCommandsModuleStartupFinished; /// /// Fired when guild commands are registered on a guild. /// - public event AsyncEventHandler GuildApplicationCommandsRegistered - { - add => this._guildApplicationCommandsRegistered.Register(value); - remove => this._guildApplicationCommandsRegistered.Unregister(value); - } - private AsyncEvent _guildApplicationCommandsRegistered; + public event AsyncEventHandler + GuildApplicationCommandsRegistered + { + add => this._guildApplicationCommandsRegistered.Register(value); + remove => this._guildApplicationCommandsRegistered.Unregister(value); + } + + private AsyncEvent + _guildApplicationCommandsRegistered; /// /// Fired when the global commands are registered. /// - public event AsyncEventHandler GlobalApplicationCommandsRegistered - { - add => this._globalApplicationCommandsRegistered.Register(value); - remove => this._globalApplicationCommandsRegistered.Unregister(value); - } - private AsyncEvent _globalApplicationCommandsRegistered; + public event AsyncEventHandler + GlobalApplicationCommandsRegistered + { + add => this._globalApplicationCommandsRegistered.Register(value); + remove => this._globalApplicationCommandsRegistered.Unregister(value); + } + + private AsyncEvent + _globalApplicationCommandsRegistered; /// /// Used for RegisterCommands and the event. /// internal async Task UpdateAsync() { - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Request to register commands on shard {shard}", this.Client.ShardId); + this.Client.Logger.Log(ApplicationCommandsLogLevel, "Request to register commands on shard {shard}", + this.Client.ShardId); if (this.StartupFinished) { - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Shard {shard} already setup, skipping", this.Client.ShardId); + this.Client.Logger.Log(ApplicationCommandsLogLevel, "Shard {shard} already setup, skipping", + this.Client.ShardId); this.FinishedRegistration(); return; } @@ -403,77 +451,100 @@ internal async Task UpdateAsync() GuildDiscordCommands = new(); this.Client.Logger.Log(ApplicationCommandsLogLevel, "Expected Count: {count}", s_expectedCount); - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Shard {shard} has {guilds} guilds.", this.Client.ShardId, this.Client.Guilds?.Count); + this.Client.Logger.Log(ApplicationCommandsLogLevel, "Shard {shard} has {guilds} guilds", this.Client.ShardId, + this.Client.Guilds?.Count); List failedGuilds = new(); - List globalCommands = null; - globalCommands = (await this.Client.GetGlobalApplicationCommandsAsync(Configuration?.EnableLocalization ?? false).ConfigureAwait(false)).ToList() ?? null; - var updateList = this._updateList; - var guilds = CheckAllGuilds ? this.Client.Guilds?.Keys.ToList() : updateList.Where(x => x.Key != null)?.Select(x => x.Key.Value).Distinct().ToList(); - var wrongShards = guilds.Where(x => !this.Client.Guilds.ContainsKey(x)).ToList(); - if (wrongShards.Any()) + var globalCommands = + (await this.Client.GetGlobalApplicationCommandsAsync(Configuration?.EnableLocalization ?? false) + .ConfigureAwait(false)).ToList() ?? null; + var guilds = CheckAllGuilds + ? this.Client.Guilds?.Keys.ToList() + : this._updateList.Where(x => x.Key != null)?.Select(x => x.Key.Value).Distinct().ToList(); + var wrongShards = guilds?.Where(x => !this.Client.Guilds!.ContainsKey(x)).ToList(); + if (wrongShards != null && wrongShards.Any()) { - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Some guilds are not on the same shard as the client. Removing them from the update list."); + this.Client.Logger.Log(ApplicationCommandsLogLevel, + "Some guilds are not on the same shard as the client. Removing them from the update list"); foreach (var guild in wrongShards) { - updateList.RemoveAll(x => x.Key == guild); + this._updateList.RemoveAll(x => x.Key == guild); guilds.Remove(guild); } } - var commandsPending = updateList.Select(x => x.Key).Distinct().ToList(); + var commandsPending = this._updateList.Select(x => x.Key).Distinct().ToList(); s_expectedCount = commandsPending.Count; - foreach (var guild in guilds) - { - List commands = null; - var unauthorized = false; - try - { - commands = (await this.Client.GetGuildApplicationCommandsAsync(guild, Configuration?.EnableLocalization ?? false).ConfigureAwait(false)).ToList() ?? null; - } - catch (UnauthorizedException) - { - unauthorized = true; - } - finally + if (guilds != null) + foreach (var guild in guilds) { - if (!unauthorized && commands != null && commands.Any()) - GuildDiscordCommands.Add(guild, commands.ToList()); - else if (unauthorized) - failedGuilds.Add(guild); + List commands = null; + var unauthorized = false; + try + { + commands = (await this.Client + .GetGuildApplicationCommandsAsync(guild, Configuration?.EnableLocalization ?? false) + .ConfigureAwait(false)).ToList() ?? null; + } + catch (UnauthorizedException) + { + unauthorized = true; + } + finally + { + switch (unauthorized) + { + case false when commands != null && commands.Any(): + GuildDiscordCommands.Add(guild, commands.ToList()); + break; + case true: + failedGuilds.Add(guild); + break; + } + } } - } //Default should be to add the help and slash commands can be added without setting any configuration //so this should still add the default help if (Configuration is null || (Configuration is not null && Configuration.EnableDefaultHelp)) { - updateList.Add(new KeyValuePair - (null, new ApplicationCommandsModuleConfiguration(typeof(DefaultHelpModule)))); - commandsPending = updateList.Select(x => x.Key).Distinct().ToList(); + this._updateList.Add(new(null, new(typeof(DefaultHelpModule)))); + commandsPending = this._updateList.Select(x => x.Key).Distinct().ToList(); } + // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (globalCommands != null && globalCommands.Any()) GlobalDiscordCommands.AddRange(globalCommands); foreach (var key in commandsPending) { - this.Client.Logger.Log(ApplicationCommandsLogLevel, key.HasValue ? $"Registering commands in guild {key.Value}" : "Registering global commands."); if (key.HasValue) { - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Found guild {guild} in shard {shard}!", key.Value, this.Client.ShardId); + this.Client.Logger.Log(ApplicationCommandsLogLevel, "Registering commands in guild, {value}", + key.Value); + this.Client.Logger.Log(ApplicationCommandsLogLevel, "Found guild {guild} in shard {shard}!", key.Value, + this.Client.ShardId); this.Client.Logger.Log(ApplicationCommandsLogLevel, "Registering"); } - await this.RegisterCommands(updateList.Where(x => x.Key == key).Select(x => x.Value).ToList(), key).ConfigureAwait(false); + else + { + this.Client.Logger.Log(ApplicationCommandsLogLevel, "Registering global commands"); + } + + await this.RegisterCommands(this._updateList.Where(x => x.Key == key).Select(x => x.Value).ToList(), key) + .ConfigureAwait(false); } this._missingScopeGuildIds = new(failedGuilds); - await this._applicationCommandsModuleReady.InvokeAsync(this, new ApplicationCommandsModuleReadyEventArgs(Configuration?.ServiceProvider) - { - GuildsWithoutScope = failedGuilds - }).ConfigureAwait(false); - this.Client.GuildDownloadCompleted -= async (c, e) => await this.UpdateAsync().ConfigureAwait(false); + await this._applicationCommandsModuleReady + .InvokeAsync(this, new(Configuration?.ServiceProvider) + { + GuildsWithoutScope = failedGuilds + }) + .ConfigureAwait(false); + // ReSharper disable once EventUnsubscriptionViaAnonymousDelegate + this.Client.GuildDownloadCompleted -= (_, _) => this.UpdateAsync(); } /// @@ -483,7 +554,8 @@ internal async Task UpdateAsync() /// The optional guild id. private async Task RegisterCommands(List types, ulong? guildId) { - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Registering commands on shard {shard}", this.Client.ShardId); + this.Client.Logger.Log(ApplicationCommandsLogLevel, "Registering commands on shard {shard}", + this.Client.ShardId); //Initialize empty lists to be added to the global ones at the end var commandMethods = new List(); var groupCommands = new List(); @@ -513,18 +585,24 @@ private async Task RegisterCommands(List { classes.Add(module); } - else if (module.GetMembers(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static).Any(x => x.IsDefined(typeof(SlashCommandGroupAttribute)))) + else if (module.GetMembers(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static) + .Any(x => x.IsDefined(typeof(SlashCommandGroupAttribute)))) { //Otherwise add the extreme nested groups classes = module.GetMembers(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static) .Where(x => x.IsDefined(typeof(SlashCommandGroupAttribute))) - .Select(x => module.GetNestedType(x.Name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static).GetTypeInfo()).ToList(); + .Select(x => + module.GetNestedType(x.Name, + BindingFlags.NonPublic | BindingFlags.Public | + BindingFlags.Static).GetTypeInfo()) + .ToList(); extremeNestedGroup = true; } else - { //Otherwise add the nested groups - classes = module.DeclaredNestedTypes.Where(x => x.GetCustomAttribute() != null).ToList(); + { + classes = module.DeclaredNestedTypes + .Where(x => x.GetCustomAttribute() != null).ToList(); } if (module.GetCustomAttribute() != null || extremeNestedGroup) @@ -532,56 +610,60 @@ private async Task RegisterCommands(List List groupTranslations = null; if (!string.IsNullOrEmpty(ctx.GroupTranslations)) - { groupTranslations = JsonConvert.DeserializeObject>(ctx.GroupTranslations); - } - var slashGroupsTuple = await NestedCommandWorker.ParseSlashGroupsAsync(type, classes, guildId, groupTranslations).ConfigureAwait(false); + var slashGroupsTuple = await NestedCommandWorker + .ParseSlashGroupsAsync(type, classes, guildId, groupTranslations) + .ConfigureAwait(false); if (slashGroupsTuple.applicationCommands != null && slashGroupsTuple.applicationCommands.Any()) { updateList.AddRange(slashGroupsTuple.applicationCommands); if (Configuration.GenerateTranslationFilesOnly) { - var cgwsgs = new List(); + var commandGroupWithSubGroupsList = new List(); var cgs2 = new List(); foreach (var cmd in slashGroupsTuple.applicationCommands) - { if (cmd.Type == ApplicationCommandType.ChatInput) { var cgs = new List(); - foreach (var scg in cmd.Options.Where(x => x.Type == ApplicationCommandOptionType.SubCommandGroup)) + foreach (var scg in cmd.Options.Where(x => + x.Type == ApplicationCommandOptionType + .SubCommandGroup)) { var cs = new List(); foreach (var sc in scg.Options) - { if (sc.Options == null || !sc.Options.Any()) - cs.Add(new Command(sc.Name, sc.Description, null, null)); + cs.Add(new(sc.Name, sc.Description, null, null)); else - cs.Add(new Command(sc.Name, sc.Description, sc.Options.ToList(), null)); - } - cgs.Add(new CommandGroup(scg.Name, scg.Description, cs, null)); + cs.Add(new(sc.Name, sc.Description, sc.Options.ToList(), null)); + cgs.Add(new(scg.Name, scg.Description, cs, null)); } - cgwsgs.Add(new CommandGroupWithSubGroups(cmd.Name, cmd.Description, cgs, ApplicationCommandType.ChatInput)); + + commandGroupWithSubGroupsList.Add(new(cmd.Name, cmd.Description, cgs, + ApplicationCommandType.ChatInput)); var cs2 = new List(); - foreach (var sc2 in cmd.Options.Where(x => x.Type == ApplicationCommandOptionType.SubCommand)) - { + foreach (var sc2 in cmd.Options.Where(x => + x.Type == ApplicationCommandOptionType + .SubCommand)) if (sc2.Options == null || !sc2.Options.Any()) - cs2.Add(new Command(sc2.Name, sc2.Description, null, null)); + cs2.Add(new(sc2.Name, sc2.Description, null, null)); else - cs2.Add(new Command(sc2.Name, sc2.Description, sc2.Options.ToList(), null)); - } - cgs2.Add(new CommandGroup(cmd.Name, cmd.Description, cs2, ApplicationCommandType.ChatInput)); - + cs2.Add(new(sc2.Name, sc2.Description, sc2.Options.ToList(), null)); + cgs2.Add(new(cmd.Name, cmd.Description, cs2, ApplicationCommandType.ChatInput)); } - } - if (cgwsgs.Any()) - foreach (var cgwsg in cgwsgs) - groupTranslation.Add(JsonConvert.DeserializeObject(JsonConvert.SerializeObject(cgwsg))); + + if (commandGroupWithSubGroupsList.Any()) + groupTranslation.AddRange(commandGroupWithSubGroupsList.Select(cgwsg => + JsonConvert.DeserializeObject( + JsonConvert.SerializeObject(cgwsg)))); if (cgs2.Any()) - foreach (var cg2 in cgs2) - groupTranslation.Add(JsonConvert.DeserializeObject(JsonConvert.SerializeObject(cg2))); + groupTranslation.AddRange(cgs2.Select(cg2 => + JsonConvert + .DeserializeObject< + GroupTranslator>(JsonConvert + .SerializeObject(cg2)))); } } @@ -604,14 +686,16 @@ private async Task RegisterCommands(List List commandTranslations = null; if (!string.IsNullOrEmpty(ctx.SingleTranslations)) - { - commandTranslations = JsonConvert.DeserializeObject>(ctx.SingleTranslations); - } + commandTranslations = + JsonConvert.DeserializeObject>(ctx.SingleTranslations); //Slash commands - var methods = module.DeclaredMethods.Where(x => x.GetCustomAttribute() != null); + var methods = + module.DeclaredMethods.Where(x => x.GetCustomAttribute() != null); - var slashCommands = await CommandWorker.ParseBasicSlashCommandsAsync(type, methods, guildId, commandTranslations).ConfigureAwait(false); + var slashCommands = await CommandWorker + .ParseBasicSlashCommandsAsync(type, methods, guildId, commandTranslations) + .ConfigureAwait(false); if (slashCommands.applicationCommands != null && slashCommands.applicationCommands.Any()) { @@ -619,17 +703,25 @@ private async Task RegisterCommands(List if (Configuration.GenerateTranslationFilesOnly) { var cs = new List(); - foreach (var cmd in slashCommands.applicationCommands) - if (cmd.Type == ApplicationCommandType.ChatInput && (cmd.Options == null || !cmd.Options.Any(x => x.Type == ApplicationCommandOptionType.SubCommand || x.Type == ApplicationCommandOptionType.SubCommandGroup))) - { - if (cmd.Options == null || !cmd.Options.Any()) - cs.Add(new Command(cmd.Name, cmd.Description, null, ApplicationCommandType.ChatInput)); - else - cs.Add(new Command(cmd.Name, cmd.Description, cmd.Options.ToList(), ApplicationCommandType.ChatInput)); - } + foreach (var cmd in slashCommands.applicationCommands.Where(cmd => + cmd.Type == ApplicationCommandType.ChatInput && + (cmd.Options == null || + !cmd.Options.Any(x => + x.Type is ApplicationCommandOptionType + .SubCommand + or ApplicationCommandOptionType + .SubCommandGroup)))) + if (cmd.Options == null || !cmd.Options.Any()) + cs.Add(new(cmd.Name, cmd.Description, null, ApplicationCommandType.ChatInput)); + else + cs.Add(new(cmd.Name, cmd.Description, cmd.Options.ToList(), + ApplicationCommandType.ChatInput)); if (cs.Any()) - foreach (var c in cs) - translation.Add(JsonConvert.DeserializeObject(JsonConvert.SerializeObject(c))); + translation.AddRange(cs.Select(c => + JsonConvert + .DeserializeObject< + CommandTranslator>(JsonConvert + .SerializeObject(c)))); } } @@ -640,22 +732,28 @@ private async Task RegisterCommands(List commandMethods.AddRange(slashCommands.commandMethods); //Context Menus - var contextMethods = module.DeclaredMethods.Where(x => x.GetCustomAttribute() != null); + var contextMethods = + module.DeclaredMethods.Where(x => x.GetCustomAttribute() != null); - var contextCommands = await CommandWorker.ParseContextMenuCommands(type, contextMethods, commandTranslations).ConfigureAwait(false); + var contextCommands = await CommandWorker + .ParseContextMenuCommands(type, contextMethods, commandTranslations) + .ConfigureAwait(false); if (contextCommands.applicationCommands != null && contextCommands.applicationCommands.Any()) { updateList.AddRange(contextCommands.applicationCommands); if (Configuration.GenerateTranslationFilesOnly) { - var cs = new List(); - foreach (var cmd in contextCommands.applicationCommands) - if (cmd.Type == ApplicationCommandType.Message || cmd.Type == ApplicationCommandType.User) - cs.Add(new Command(cmd.Name, null, null, cmd.Type)); + var cs = (from cmd in contextCommands.applicationCommands + where cmd.Type == ApplicationCommandType.Message || + cmd.Type == ApplicationCommandType.User + select new Command(cmd.Name, null, null, cmd.Type)).ToList(); if (cs.Any()) - foreach (var c in cs) - translation.Add(JsonConvert.DeserializeObject(JsonConvert.SerializeObject(c))); + translation.AddRange(cs.Select(c => + JsonConvert + .DeserializeObject< + CommandTranslator>(JsonConvert + .SerializeObject(c)))); } } @@ -666,30 +764,39 @@ private async Task RegisterCommands(List contextMenuCommands.AddRange(contextCommands.contextMenuCommands); //Accounts for lifespans - if (module.GetCustomAttribute() != null && module.GetCustomAttribute().Lifespan == ApplicationCommandModuleLifespan.Singleton) + if (module.GetCustomAttribute() != null && + module.GetCustomAttribute().Lifespan == + ApplicationCommandModuleLifespan.Singleton) s_singletonModules.Add(CreateInstance(module, Configuration?.ServiceProvider)); } } catch (NullReferenceException ex) { - this.Client.Logger.LogCritical(ex, "NRE Exception thrown: {msg}\nStack: {stack}", ex.Message, ex.StackTrace); + this.Client.Logger.LogCritical(ex, "NRE Exception thrown: {msg}\nStack: {stack}", ex.Message, + ex.StackTrace); } catch (Exception ex) { - if (ex is BadRequestException brex) + if (ex is BadRequestException badRequestException) { - this.Client.Logger.LogCritical(brex, @"There was an error registering application commands: {res}", brex.WebResponse.Response); + this.Client.Logger.LogCritical(badRequestException, + "There was an error registering application commands: {res}", + badRequestException.WebResponse.Response); } else { - if (ex.InnerException is not null && ex.InnerException is BadRequestException brex1) - this.Client.Logger.LogCritical(brex1, @"There was an error registering application commands: {res}", brex1.WebResponse.Response); + if (ex.InnerException is BadRequestException requestException) + this.Client.Logger.LogCritical(requestException, + "There was an error registering application commands: {res}", + requestException.WebResponse.Response); else - this.Client.Logger.LogCritical(ex, @"There was an error parsing the application commands"); + this.Client.Logger.LogCritical(ex, "There was an error parsing the application commands"); } + s_errored = true; } } + if (!s_errored) { updateList = updateList.DistinctBy(x => x.Name).ToList(); @@ -710,7 +817,9 @@ private async Task RegisterCommands(List { if (updateList != null && updateList.Any()) { - var regCommands = await RegistrationWorker.RegisterGlobalCommandsAsync(this.Client, updateList).ConfigureAwait(false); + var regCommands = await RegistrationWorker + .RegisterGlobalCommandsAsync(this.Client, updateList) + .ConfigureAwait(false); var actualCommands = regCommands.Distinct().ToList(); commands.AddRange(actualCommands); GlobalCommandsInternal.AddRange(actualCommands); @@ -718,23 +827,27 @@ private async Task RegisterCommands(List else { foreach (var cmd in GlobalDiscordCommands) - { try { - await this.Client.DeleteGlobalApplicationCommandAsync(cmd.Id).ConfigureAwait(false); + await this.Client.DeleteGlobalApplicationCommandAsync(cmd.Id) + .ConfigureAwait(false); } catch (NotFoundException) { - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Could not delete global command {cmdId}. Please clean up manually", cmd.Id); + this.Client.Logger.Log(ApplicationCommandsLogLevel, + "Could not delete global command {cmdId}. Please clean up manually", + cmd.Id); } - } } } else { if (updateList != null && updateList.Any()) { - var regCommands = await RegistrationWorker.RegisterGuildCommandsAsync(this.Client, guildId.Value, updateList).ConfigureAwait(false); + var regCommands = await RegistrationWorker + .RegisterGuildCommandsAsync(this.Client, guildId.Value, + updateList) + .ConfigureAwait(false); var actualCommands = regCommands.Distinct().ToList(); commands.AddRange(actualCommands); GuildCommandsInternal.Add(guildId.Value, actualCommands); @@ -749,24 +862,29 @@ private async Task RegisterCommands(List else { foreach (var cmd in GuildDiscordCommands.First(x => x.Key == guildId.Value).Value) - { try { - await this.Client.DeleteGuildApplicationCommandAsync(guildId.Value, cmd.Id).ConfigureAwait(false); + await this.Client.DeleteGuildApplicationCommandAsync(guildId.Value, cmd.Id) + .ConfigureAwait(false); } catch (NotFoundException) { - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Could not delete guild command {cmdId} in guild {guildId}. Please clean up manually", cmd.Id, guildId.Value); + this.Client.Logger.Log(ApplicationCommandsLogLevel, + "Could not delete guild command {cmdId} in guild {guildId}. Please clean up manually", + cmd.Id, guildId.Value); } - } } } } catch (UnauthorizedException ex) { - this.Client.Logger.LogError("Could not register application commands for guild {guildId}.\nError: {exc}", guildId, ex.JsonMessage); + this.Client.Logger.LogError( + "Could not register application commands for guild {guildId}.\nError: {exc}", + guildId, + ex.JsonMessage); return; } + //Creates a guild command if a guild id is specified, otherwise global //Checks against the ids and adds them to the command method lists foreach (var command in commands) @@ -787,124 +905,152 @@ private async Task RegisterCommands(List SubGroupCommands.AddRange(subGroupCommands.DistinctBy(x => x.Name)); ContextMenuCommands.AddRange(contextMenuCommands.DistinctBy(x => x.Name)); - s_registeredCommands.Add(new KeyValuePair>(guildId, commands.ToList())); + s_registeredCommands.Add(new(guildId, commands.ToList())); - foreach (var command in commandMethods) + foreach (var app in commandMethods.Select(command => + types.First(t => t.Type == command.Method + .DeclaringType))) { - var app = types.First(t => t.Type == command.Method.DeclaringType); + // tf we wanted to do with app?? } - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Expected Count: {exp}\nCurrent Count: {cur}", s_expectedCount, s_registrationCount); + this.Client.Logger.Log(ApplicationCommandsLogLevel, "Expected Count: {exp}\nCurrent Count: {cur}", + s_expectedCount, s_registrationCount); if (guildId.HasValue) - { - await this._guildApplicationCommandsRegistered.InvokeAsync(this, new GuildApplicationCommandsRegisteredEventArgs(Configuration?.ServiceProvider) - { - Handled = true, - GuildId = guildId.Value, - RegisteredCommands = GuildCommandsInternal.Any(c => c.Key == guildId.Value) ? GuildCommandsInternal.FirstOrDefault(c => c.Key == guildId.Value).Value : null - }).ConfigureAwait(false); - } + await this._guildApplicationCommandsRegistered.InvokeAsync(this, + new(Configuration?.ServiceProvider) + { + Handled = true, + GuildId = guildId.Value, + RegisteredCommands = + GuildCommandsInternal.Any(c => c.Key == guildId.Value) + ? GuildCommandsInternal.FirstOrDefault(c => c.Key == guildId.Value).Value + : null + }).ConfigureAwait(false); else - { - await this._globalApplicationCommandsRegistered.InvokeAsync(this, new GlobalApplicationCommandsRegisteredEventArgs(Configuration?.ServiceProvider) - { - Handled = true, - RegisteredCommands = GlobalCommandsInternal - }).ConfigureAwait(false); - } + await this._globalApplicationCommandsRegistered.InvokeAsync(this, + new(Configuration?.ServiceProvider) + { + Handled = true, + RegisteredCommands = GlobalCommandsInternal + }).ConfigureAwait(false); s_registrationCount++; this.CheckRegistrationStartup(ManOr); } catch (NullReferenceException ex) { - this.Client.Logger.LogCritical(ex, "NRE Exception thrown: {msg}\nStack: {stack}", ex.Message, ex.StackTrace); + this.Client.Logger.LogCritical(ex, "NRE Exception thrown: {msg}\nStack: {stack}", ex.Message, + ex.StackTrace); } catch (Exception ex) { - if (ex is BadRequestException brex) + if (ex is BadRequestException badRequestException) { - this.Client.Logger.LogCritical(brex, @"There was an error registering application commands: {res}", brex.WebResponse.Response); + this.Client.Logger.LogCritical(badRequestException, + "There was an error registering application commands: {res}", + badRequestException.WebResponse.Response); } else { - if (ex.InnerException is not null && ex.InnerException is BadRequestException brex1) - this.Client.Logger.LogCritical(brex1, @"There was an error registering application commands: {res}", brex1.WebResponse.Response); + if (ex.InnerException is BadRequestException requestException) + this.Client.Logger.LogCritical(requestException, + "There was an error registering application commands: {res}", + requestException.WebResponse.Response); else - this.Client.Logger.LogCritical(ex, @"There was an general error registering application commands"); + this.Client.Logger.LogCritical(ex, + "There was an general error registering application commands"); } + s_errored = true; } } } } - private async void CheckRegistrationStartup(bool man = false, List translation = null, List groupTranslation = null) + private async void CheckRegistrationStartup( + bool man = false, + IReadOnlyCollection? translation = null, + IReadOnlyCollection? groupTranslation = null + ) { - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Checking counts...\n\nExpected Count: {exp}\nCurrent Count: {cur}", s_expectedCount, s_registrationCount); + this.Client.Logger.Log(ApplicationCommandsLogLevel, + "Checking counts...\n\nExpected Count: {exp}\nCurrent Count: {cur}", s_expectedCount, + s_registrationCount); - if (s_registrationCount == s_expectedCount || man) - { - await this._applicationCommandsModuleStartupFinished.InvokeAsync(this, new ApplicationCommandsModuleStartupFinishedEventArgs(Configuration?.ServiceProvider) + if (s_registrationCount != s_expectedCount && !man) + return; + + await this._applicationCommandsModuleStartupFinished.InvokeAsync(this, + new(Configuration?.ServiceProvider) { Handled = true, - RegisteredGlobalCommands = GlobalCommandsInternal, - RegisteredGuildCommands = GuildCommandsInternal, - GuildsWithoutScope = this._missingScopeGuildIds + RegisteredGlobalCommands = + GlobalCommandsInternal, + RegisteredGuildCommands = + GuildCommandsInternal, + GuildsWithoutScope = + this._missingScopeGuildIds }).ConfigureAwait(false); - if (Configuration.GenerateTranslationFilesOnly) + if (Configuration?.GenerateTranslationFilesOnly ?? false) + { + try { - try + if (translation != null && translation.Any()) { - if (translation != null && translation.Any()) - { - var fileName = $"translation_generator_export-shard{this.Client.ShardId}-SINGLE-{s_registrationCount}_of_{s_expectedCount}.json"; - var fs = File.Create(fileName); - var ms = new MemoryStream(); - var writer = new StreamWriter(ms); - await writer.WriteAsync(JsonConvert.SerializeObject(translation.DistinctBy(x => x.Name), Formatting.Indented)).ConfigureAwait(false); - await writer.FlushAsync().ConfigureAwait(false); - ms.Position = 0; - await ms.CopyToAsync(fs).ConfigureAwait(false); - await fs.FlushAsync().ConfigureAwait(false); - fs.Close(); - await fs.DisposeAsync().ConfigureAwait(false); - ms.Close(); - await ms.DisposeAsync().ConfigureAwait(false); - this.Client.Logger.LogInformation("Exported base translation to {exppath}", fileName); - } - - if (groupTranslation != null && groupTranslation.Any()) - { - var fileName = $"translation_generator_export-shard{this.Client.ShardId}-GROUP-{s_registrationCount}_of_{s_expectedCount}.json"; - var fs = File.Create(fileName); - var ms = new MemoryStream(); - var writer = new StreamWriter(ms); - await writer.WriteAsync(JsonConvert.SerializeObject(groupTranslation.DistinctBy(x => x.Name), Formatting.Indented)).ConfigureAwait(false); - await writer.FlushAsync().ConfigureAwait(false); - ms.Position = 0; - await ms.CopyToAsync(fs).ConfigureAwait(false); - await fs.FlushAsync().ConfigureAwait(false); - fs.Close(); - await fs.DisposeAsync().ConfigureAwait(false); - ms.Close(); - await ms.DisposeAsync().ConfigureAwait(false); - this.Client.Logger.LogInformation("Exported base translation to {exppath}", fileName); - } + var fileName = + $"translation_generator_export-shard{this.Client.ShardId}-SINGLE-{s_registrationCount}_of_{s_expectedCount}.json"; + var fs = File.Create(fileName); + var ms = new MemoryStream(); + var writer = new StreamWriter(ms); + await writer + .WriteAsync(JsonConvert.SerializeObject(translation.DistinctBy(x => x.Name), + Formatting.Indented)).ConfigureAwait(false); + await writer.FlushAsync().ConfigureAwait(false); + ms.Position = 0; + await ms.CopyToAsync(fs).ConfigureAwait(false); + await fs.FlushAsync().ConfigureAwait(false); + fs.Close(); + await fs.DisposeAsync().ConfigureAwait(false); + ms.Close(); + await ms.DisposeAsync().ConfigureAwait(false); + this.Client.Logger.LogInformation("Exported base translation to {exportPath}", fileName); } - catch (Exception ex) + + if (groupTranslation != null && groupTranslation.Any()) { - this.Client.Logger.LogError(@"{msg}", ex.Message); - this.Client.Logger.LogError(@"{stack}", ex.StackTrace); + var fileName = + $"translation_generator_export-shard{this.Client.ShardId}-GROUP-{s_registrationCount}_of_{s_expectedCount}.json"; + var fs = File.Create(fileName); + var ms = new MemoryStream(); + var writer = new StreamWriter(ms); + await writer + .WriteAsync(JsonConvert.SerializeObject(groupTranslation.DistinctBy(x => x.Name), + Formatting.Indented)).ConfigureAwait(false); + await writer.FlushAsync().ConfigureAwait(false); + ms.Position = 0; + await ms.CopyToAsync(fs).ConfigureAwait(false); + await fs.FlushAsync().ConfigureAwait(false); + fs.Close(); + await fs.DisposeAsync().ConfigureAwait(false); + ms.Close(); + await ms.DisposeAsync().ConfigureAwait(false); + this.Client.Logger.LogInformation("Exported base translation to {exportPath}", fileName); } - this.FinishedRegistration(); - await this.Client.DisconnectAsync().ConfigureAwait(false); } - else + catch (Exception ex) { - this.FinishedRegistration(); + this.Client.Logger.LogError(@"{msg}", ex.Message); + this.Client.Logger.LogError(@"{stack}", ex.StackTrace); } + + this.FinishedRegistration(); + await this.Client.DisconnectAsync().ConfigureAwait(false); + } + else + { + this.FinishedRegistration(); } } @@ -913,16 +1059,17 @@ private async void CheckRegistrationStartup(bool man = false, List /// The client. /// The event args. - private Task InteractionHandler(DiscordClient client, InteractionCreateEventArgs e) + private Task InteractionHandlerAsync(DiscordClient client, InteractionCreateEventArgs e) { - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Got slash interaction on shard {shard}", this.Client.ShardId); + this.Client.Logger.Log(ApplicationCommandsLogLevel, "Got slash interaction on shard {shard}", + this.Client.ShardId); if (HandledInteractions.Contains(e.Interaction.Id)) { this.Client.Logger.Log(ApplicationCommandsLogLevel, "Ignoring, already received"); return Task.FromResult(true); } - HandledInteractions.Add(e.Interaction.Id); + HandledInteractions.Add(e.Interaction.Id); _ = Task.Run(async () => { @@ -944,7 +1091,6 @@ private Task InteractionHandler(DiscordClient client, InteractionCreateEventArgs CommandName = e.Interaction.Data.Name, InteractionId = e.Interaction.Id, Token = e.Interaction.Token, - Services = Configuration?.ServiceProvider, ResolvedUserMentions = e.Interaction.Data.Resolved?.Users?.Values.ToList(), ResolvedRoleMentions = e.Interaction.Data.Resolved?.Roles?.Values.ToList(), ResolvedChannelMentions = e.Interaction.Data.Resolved?.Channels?.Values.ToList(), @@ -956,13 +1102,19 @@ private Task InteractionHandler(DiscordClient client, InteractionCreateEventArgs Entitlements = e.Interaction.Entitlements, EntitlementSkuIds = e.Interaction.EntitlementSkuIds }; + if (Configuration?.ServiceProvider != null) + context.Services = Configuration?.ServiceProvider; try { if (s_errored) { - await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("Application commands failed to register properly on startup.").AsEphemeral()).ConfigureAwait(false); - throw new InvalidOperationException("Application commands failed to register properly on startup."); + await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, + new DiscordInteractionResponseBuilder() + .WithContent("Application commands failed to register properly on startup.") + .AsEphemeral()).ConfigureAwait(false); + throw new InvalidOperationException( + "Application commands failed to register properly on startup."); } var methods = CommandMethods.Where(x => x.CommandId == e.Interaction.Data.Id); @@ -970,8 +1122,12 @@ private Task InteractionHandler(DiscordClient client, InteractionCreateEventArgs var subgroups = SubGroupCommands.Where(x => x.CommandId == e.Interaction.Data.Id); if (!methods.Any() && !groups.Any() && !subgroups.Any()) { - await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("A application command was executed, but no command was registered for it.")).ConfigureAwait(false); - throw new InvalidOperationException("A application command was executed, but no command was registered for it."); + await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, + new DiscordInteractionResponseBuilder().WithContent( + "A application command was executed, but no command was registered for it.")) + .ConfigureAwait(false); + throw new InvalidOperationException( + "A application command was executed, but no command was registered for it."); } switch (type) @@ -983,7 +1139,10 @@ private Task InteractionHandler(DiscordClient client, InteractionCreateEventArgs context.SubSubCommandName = null; if (DebugEnabled) this.Client.Logger.LogDebug("Executing {cmd}", method.Name); - var args = await this.ResolveInteractionCommandParameters(e, context, method, e.Interaction.Data.Options).ConfigureAwait(false); + var args = await this + .ResolveInteractionCommandParameters(e, context, method, + e.Interaction.Data.Options) + .ConfigureAwait(false); await this.RunCommandAsync(context, method, args).ConfigureAwait(false); break; @@ -996,7 +1155,9 @@ private Task InteractionHandler(DiscordClient client, InteractionCreateEventArgs context.SubSubCommandName = null; if (DebugEnabled) this.Client.Logger.LogDebug("Executing {cmd}", method.Name); - var args = await this.ResolveInteractionCommandParameters(e, context, method, e.Interaction.Data.Options[0].Options).ConfigureAwait(false); + var args = await this + .ResolveInteractionCommandParameters(e, context, method, + e.Interaction.Data.Options[0].Options).ConfigureAwait(false); await this.RunCommandAsync(context, method, args).ConfigureAwait(false); break; @@ -1012,25 +1173,45 @@ private Task InteractionHandler(DiscordClient client, InteractionCreateEventArgs if (DebugEnabled) this.Client.Logger.LogDebug("Executing {cmd}", method.Name); - var args = await this.ResolveInteractionCommandParameters(e, context, method, e.Interaction.Data.Options[0].Options[0].Options).ConfigureAwait(false); + var args = await this.ResolveInteractionCommandParameters(e, context, method, + e.Interaction.Data.Options[0].Options[0].Options) + .ConfigureAwait(false); await this.RunCommandAsync(context, method, args).ConfigureAwait(false); break; } + case ApplicationCommandFinalType.NotDetermined: + break; + default: + throw new ArgumentOutOfRangeException(); } - await this._slashExecuted.InvokeAsync(this, new SlashCommandExecutedEventArgs(this.Client.ServiceProvider) { Context = context }).ConfigureAwait(false); + await this._slashExecuted + .InvokeAsync(this, new(this.Client.ServiceProvider) + { + Context = context + }) + .ConfigureAwait(false); } catch (Exception ex) { - await this._slashError.InvokeAsync(this, new SlashCommandErrorEventArgs(this.Client.ServiceProvider) { Context = context, Exception = ex }).ConfigureAwait(false); + await this._slashError + .InvokeAsync(this, new(this.Client.ServiceProvider) + { + Context = context, + Exception = ex + }) + .ConfigureAwait(false); this.Client.Logger.LogError(ex, "Error in slash interaction"); } break; } case InteractionType.AutoComplete when s_errored: - await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("Application commands failed to register properly on startup.")).ConfigureAwait(false); + await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, + new DiscordInteractionResponseBuilder().WithContent( + "Application commands failed to register properly on startup.")) + .ConfigureAwait(false); throw new InvalidOperationException("Application commands failed to register properly on startup."); case InteractionType.AutoComplete: { @@ -1039,109 +1220,146 @@ private Task InteractionHandler(DiscordClient client, InteractionCreateEventArgs var subgroups = SubGroupCommands.Where(x => x.CommandId == e.Interaction.Data.Id); if (!methods.Any() && !groups.Any() && !subgroups.Any()) { - await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("An autocomplete interaction was created, but no command was registered for it")).ConfigureAwait(false); - throw new InvalidOperationException("An autocomplete interaction was created, but no command was registered for it"); + await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, + new DiscordInteractionResponseBuilder().WithContent( + "An autocomplete interaction was created, but no command was registered for it")) + .ConfigureAwait(false); + throw new InvalidOperationException( + "An autocomplete interaction was created, but no command was registered for it"); } try { - if (type is ApplicationCommandFinalType.Command && methods.Any()) + switch (type) { - var focusedOption = e.Interaction.Data.Options.First(o => o.Focused); - var method = methods.First().Method; + case ApplicationCommandFinalType.Command when methods.Any(): + { + var focusedOption = e.Interaction.Data.Options!.First(o => o.Focused); + var method = methods.First().Method; - var option = method.GetParameters().Skip(1).First(p => p.GetCustomAttribute().Name == focusedOption.Name); - var provider = option.GetCustomAttribute().ProviderType; - var providerMethod = provider.GetMethod(nameof(IAutocompleteProvider.Provider)); - var providerInstance = Activator.CreateInstance(provider); + var option = method.GetParameters().Skip(1).First(p => + p.GetCustomAttribute().Name == focusedOption.Name); + var provider = option.GetCustomAttribute().ProviderType; + var providerMethod = provider.GetMethod(nameof(IAutocompleteProvider.Provider)); + var providerInstance = Activator.CreateInstance(provider); - var context = new AutocompleteContext + var context = new AutocompleteContext + { + Interaction = e.Interaction, + Client = client, + ApplicationCommandsExtension = this, + Guild = e.Interaction.Guild, + Channel = e.Interaction.Channel, + User = e.Interaction.User, + Options = e.Interaction.Data.Options.ToList(), + FocusedOption = focusedOption, + Locale = e.Interaction.Locale, + GuildLocale = e.Interaction.GuildLocale, + AppPermissions = e.Interaction.AppPermissions, + Entitlements = e.Interaction.Entitlements, + EntitlementSkuIds = e.Interaction.EntitlementSkuIds + }; + if (Configuration?.ServiceProvider != null) + context.Services = Configuration?.ServiceProvider; + + var choices = + await ((Task>) + providerMethod.Invoke(providerInstance, new[] { context })) + .ConfigureAwait(false); + await e.Interaction.CreateResponseAsync(InteractionResponseType.AutoCompleteResult, + new DiscordInteractionResponseBuilder() + .AddAutoCompleteChoices(choices)) + .ConfigureAwait(false); + break; + } + case ApplicationCommandFinalType.SubCommand when groups.Any(): { - Interaction = e.Interaction, - Client = client, - Services = Configuration?.ServiceProvider, - ApplicationCommandsExtension = this, - Guild = e.Interaction.Guild, - Channel = e.Interaction.Channel, - User = e.Interaction.User, - Options = e.Interaction.Data.Options.ToList(), - FocusedOption = focusedOption, - Locale = e.Interaction.Locale, - GuildLocale = e.Interaction.GuildLocale, - AppPermissions = e.Interaction.AppPermissions, - Entitlements = e.Interaction.Entitlements, - EntitlementSkuIds = e.Interaction.EntitlementSkuIds - }; - - var choices = await ((Task>) providerMethod.Invoke(providerInstance, new[] { context })).ConfigureAwait(false); - await e.Interaction.CreateResponseAsync(InteractionResponseType.AutoCompleteResult, new DiscordInteractionResponseBuilder().AddAutoCompleteChoices(choices)).ConfigureAwait(false); - } + var command = e.Interaction.Data.Options![0]; + var group = groups.First().Methods.First(x => x.Key == command.Name).Value; - if (type is ApplicationCommandFinalType.SubCommand && groups.Any()) - { - var command = e.Interaction.Data.Options[0]; - var group = groups.First().Methods.First(x => x.Key == command.Name).Value; - - var focusedOption = command.Options.First(o => o.Focused); - var option = group.GetParameters().Skip(1).First(p => p.GetCustomAttribute().Name == focusedOption.Name); - var provider = option.GetCustomAttribute().ProviderType; - var providerMethod = provider.GetMethod(nameof(IAutocompleteProvider.Provider)); - var providerInstance = Activator.CreateInstance(provider); + var focusedOption = command.Options.First(o => o.Focused); + var option = group.GetParameters().Skip(1).First(p => + p.GetCustomAttribute().Name == focusedOption.Name); + var provider = option.GetCustomAttribute().ProviderType; + var providerMethod = provider.GetMethod(nameof(IAutocompleteProvider.Provider)); + var providerInstance = Activator.CreateInstance(provider); - var context = new AutocompleteContext + var context = new AutocompleteContext + { + Client = client, + Interaction = e.Interaction, + ApplicationCommandsExtension = this, + Guild = e.Interaction.Guild, + Channel = e.Interaction.Channel, + User = e.Interaction.User, + Options = command.Options.ToList(), + FocusedOption = focusedOption, + Locale = e.Interaction.Locale, + GuildLocale = e.Interaction.GuildLocale, + AppPermissions = e.Interaction.AppPermissions, + Entitlements = e.Interaction.Entitlements, + EntitlementSkuIds = e.Interaction.EntitlementSkuIds + }; + if (Configuration?.ServiceProvider != null) + context.Services = Configuration?.ServiceProvider; + + var choices = + await ((Task>) + providerMethod.Invoke(providerInstance, new[] { context })) + .ConfigureAwait(false); + await e.Interaction.CreateResponseAsync(InteractionResponseType.AutoCompleteResult, + new DiscordInteractionResponseBuilder() + .AddAutoCompleteChoices(choices)) + .ConfigureAwait(false); + break; + } + case ApplicationCommandFinalType.SubCommandGroup when subgroups.Any(): { - Client = client, - Interaction = e.Interaction, - Services = Configuration?.ServiceProvider, - ApplicationCommandsExtension = this, - Guild = e.Interaction.Guild, - Channel = e.Interaction.Channel, - User = e.Interaction.User, - Options = command.Options.ToList(), - FocusedOption = focusedOption, - Locale = e.Interaction.Locale, - GuildLocale = e.Interaction.GuildLocale, - AppPermissions = e.Interaction.AppPermissions, - Entitlements = e.Interaction.Entitlements, - EntitlementSkuIds = e.Interaction.EntitlementSkuIds - }; - - var choices = await ((Task>) providerMethod.Invoke(providerInstance, new[] { context })).ConfigureAwait(false); - await e.Interaction.CreateResponseAsync(InteractionResponseType.AutoCompleteResult, new DiscordInteractionResponseBuilder().AddAutoCompleteChoices(choices)).ConfigureAwait(false); - } + var command = e.Interaction.Data.Options![0]; + var group = subgroups.First().SubCommands.First(x => x.Name == command.Name).Methods + .First(x => x.Key == command.Options[0].Name).Value; - if (type is ApplicationCommandFinalType.SubCommandGroup && subgroups.Any()) - { - var command = e.Interaction.Data.Options[0]; - var group = subgroups.First().SubCommands.First(x => x.Name == command.Name).Methods.First(x => x.Key == command.Options[0].Name).Value; + var focusedOption = command.Options[0].Options.First(o => o.Focused); - var focusedOption = command.Options[0].Options.First(o => o.Focused); + var option = group.GetParameters().Skip(1).First(p => + p.GetCustomAttribute().Name == focusedOption.Name); + var provider = option.GetCustomAttribute().ProviderType; + var providerMethod = provider.GetMethod(nameof(IAutocompleteProvider.Provider)); + var providerInstance = Activator.CreateInstance(provider); - var option = group.GetParameters().Skip(1).First(p => p.GetCustomAttribute().Name == focusedOption.Name); - var provider = option.GetCustomAttribute().ProviderType; - var providerMethod = provider.GetMethod(nameof(IAutocompleteProvider.Provider)); - var providerInstance = Activator.CreateInstance(provider); - - var context = new AutocompleteContext - { - Client = client, - Interaction = e.Interaction, - Services = Configuration?.ServiceProvider, - ApplicationCommandsExtension = this, - Guild = e.Interaction.Guild, - Channel = e.Interaction.Channel, - User = e.Interaction.User, - Options = command.Options[0].Options.ToList(), - FocusedOption = focusedOption, - Locale = e.Interaction.Locale, - GuildLocale = e.Interaction.GuildLocale, - AppPermissions = e.Interaction.AppPermissions, - Entitlements = e.Interaction.Entitlements, - EntitlementSkuIds = e.Interaction.EntitlementSkuIds - }; - - var choices = await ((Task>) providerMethod.Invoke(providerInstance, new[] { context })).ConfigureAwait(false); - await e.Interaction.CreateResponseAsync(InteractionResponseType.AutoCompleteResult, new DiscordInteractionResponseBuilder().AddAutoCompleteChoices(choices)).ConfigureAwait(false); + var context = new AutocompleteContext + { + Client = client, + Interaction = e.Interaction, + ApplicationCommandsExtension = this, + Guild = e.Interaction.Guild, + Channel = e.Interaction.Channel, + User = e.Interaction.User, + Options = command.Options[0].Options.ToList(), + FocusedOption = focusedOption, + Locale = e.Interaction.Locale, + GuildLocale = e.Interaction.GuildLocale, + AppPermissions = e.Interaction.AppPermissions, + Entitlements = e.Interaction.Entitlements, + EntitlementSkuIds = e.Interaction.EntitlementSkuIds + }; + if (Configuration?.ServiceProvider != null) + context.Services = Configuration?.ServiceProvider; + + var choices = + await ((Task>) + providerMethod.Invoke(providerInstance, new[] { context })) + .ConfigureAwait(false); + await e.Interaction.CreateResponseAsync(InteractionResponseType.AutoCompleteResult, + new DiscordInteractionResponseBuilder() + .AddAutoCompleteChoices(choices)) + .ConfigureAwait(false); + break; + } + case ApplicationCommandFinalType.NotDetermined: + break; + default: + throw new ArgumentOutOfRangeException(); } } catch (Exception ex) @@ -1151,6 +1369,12 @@ private Task InteractionHandler(DiscordClient client, InteractionCreateEventArgs break; } + case InteractionType.Ping: + break; + case InteractionType.Component: + break; + case InteractionType.ModalSubmit: + break; } }); return Task.CompletedTask; @@ -1162,9 +1386,10 @@ private ApplicationCommandFinalType GetInteractionType(DiscordInteractionData da if (data.Options == null!) return ApplicationCommandFinalType.Command; if (data.Options.All(x => - x.Type is not ApplicationCommandOptionType.SubCommand - and not ApplicationCommandOptionType.SubCommandGroup)) + x.Type is not ApplicationCommandOptionType.SubCommand + and not ApplicationCommandOptionType.SubCommandGroup)) return ApplicationCommandFinalType.Command; + if (data.Options.Any(x => x.Type is ApplicationCommandOptionType.SubCommandGroup)) type = ApplicationCommandFinalType.SubCommandGroup; else if (data.Options.Any(x => x.Type is ApplicationCommandOptionType.SubCommand)) @@ -1177,9 +1402,10 @@ x.Type is not ApplicationCommandOptionType.SubCommand /// /// The client. /// The event args. - private Task ContextMenuHandler(DiscordClient client, ContextMenuInteractionCreateEventArgs e) + private Task ContextMenuHandlerAsync(DiscordClient client, ContextMenuInteractionCreateEventArgs e) { - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Got context menu interaction on shard {shard}", this.Client.ShardId); + this.Client.Logger.Log(ApplicationCommandsLogLevel, "Got context menu interaction on shard {shard}", + this.Client.ShardId); if (HandledInteractions.Contains(e.Interaction.Id)) { this.Client.Logger.Log(ApplicationCommandsLogLevel, "Ignoring, already received"); @@ -1196,7 +1422,6 @@ private Task ContextMenuHandler(DiscordClient client, ContextMenuInteractionCrea Interaction = e.Interaction, Channel = e.Interaction.Channel, Client = client, - Services = Configuration?.ServiceProvider, CommandName = e.Interaction.Data.Name, ApplicationCommandsExtension = this, Guild = e.Interaction.Guild, @@ -1212,12 +1437,17 @@ private Task ContextMenuHandler(DiscordClient client, ContextMenuInteractionCrea Entitlements = e.Interaction.Entitlements, EntitlementSkuIds = e.Interaction.EntitlementSkuIds }; + if (Configuration?.ServiceProvider != null) + context.Services = Configuration?.ServiceProvider; try { if (s_errored) { - await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("Context menus failed to register properly on startup.")).ConfigureAwait(false); + await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, + new DiscordInteractionResponseBuilder().WithContent( + "Context menus failed to register properly on startup.")) + .ConfigureAwait(false); throw new InvalidOperationException("Context menus failed to register properly on startup."); } @@ -1226,17 +1456,31 @@ private Task ContextMenuHandler(DiscordClient client, ContextMenuInteractionCrea if (method == null) { - await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("A context menu command was executed, but no command was registered for it.")).ConfigureAwait(false); - throw new InvalidOperationException("A context menu command was executed, but no command was registered for it."); + await e.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, + new DiscordInteractionResponseBuilder().WithContent( + "A context menu command was executed, but no command was registered for it.")) + .ConfigureAwait(false); + throw new InvalidOperationException( + "A context menu command was executed, but no command was registered for it."); } await this.RunCommandAsync(context, method.Method, new[] { context }).ConfigureAwait(false); - await this._contextMenuExecuted.InvokeAsync(this, new ContextMenuExecutedEventArgs(this.Client.ServiceProvider) { Context = context }).ConfigureAwait(false); + await this._contextMenuExecuted + .InvokeAsync(this, new(this.Client.ServiceProvider) + { + Context = context + }).ConfigureAwait(false); } catch (Exception ex) { - await this._contextMenuErrored.InvokeAsync(this, new ContextMenuErrorEventArgs(this.Client.ServiceProvider) { Context = context, Exception = ex }).ConfigureAwait(false); + await this._contextMenuErrored + .InvokeAsync(this, new(this.Client.ServiceProvider) + { + Context = context, + Exception = ex + }) + .ConfigureAwait(false); } }); @@ -1249,69 +1493,82 @@ private Task ContextMenuHandler(DiscordClient client, ContextMenuInteractionCrea /// The base context. /// The method info. /// The arguments. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "")] internal async Task RunCommandAsync(BaseContext context, MethodInfo method, IEnumerable args) { - object classInstance; - this.Client.Logger.Log(ApplicationCommandsLogLevel, "Executing {cmd}", method.Name); //Accounts for lifespans - var moduleLifespan = (method.DeclaringType.GetCustomAttribute() != null ? method.DeclaringType.GetCustomAttribute()?.Lifespan : ApplicationCommandModuleLifespan.Transient) ?? ApplicationCommandModuleLifespan.Transient; - switch (moduleLifespan) + var moduleLifespan = + (method.DeclaringType.GetCustomAttribute() != null + ? method.DeclaringType.GetCustomAttribute()?.Lifespan + : ApplicationCommandModuleLifespan.Transient) ?? ApplicationCommandModuleLifespan.Transient; + var classInstance = moduleLifespan switch { - case ApplicationCommandModuleLifespan.Scoped: + ApplicationCommandModuleLifespan.Scoped => //Accounts for static methods and adds DI - classInstance = method.IsStatic ? ActivatorUtilities.CreateInstance(Configuration?.ServiceProvider.CreateScope().ServiceProvider, method.DeclaringType) : CreateInstance(method.DeclaringType, Configuration?.ServiceProvider.CreateScope().ServiceProvider); - break; - - case ApplicationCommandModuleLifespan.Transient: + method.IsStatic + ? ActivatorUtilities.CreateInstance(Configuration?.ServiceProvider?.CreateScope().ServiceProvider, + method.DeclaringType) + : CreateInstance(method.DeclaringType, + Configuration?.ServiceProvider?.CreateScope().ServiceProvider), + ApplicationCommandModuleLifespan.Transient => //Accounts for static methods and adds DI - classInstance = method.IsStatic ? ActivatorUtilities.CreateInstance(Configuration?.ServiceProvider, method.DeclaringType) : CreateInstance(method.DeclaringType, Configuration?.ServiceProvider); - break; - + method.IsStatic + ? ActivatorUtilities.CreateInstance(Configuration?.ServiceProvider, method.DeclaringType) + : CreateInstance(method.DeclaringType, Configuration?.ServiceProvider), //If singleton, gets it from the singleton list - case ApplicationCommandModuleLifespan.Singleton: - classInstance = s_singletonModules.First(x => ReferenceEquals(x.GetType(), method.DeclaringType)); - break; - - default: - throw new Exception($"An unknown {nameof(ApplicationCommandModuleLifespanAttribute)} scope was specified on command {context.CommandName}"); - } + ApplicationCommandModuleLifespan.Singleton => s_singletonModules.First(x => + ReferenceEquals(x.GetType(), method.DeclaringType)), + _ => throw new( + $"An unknown {nameof(ApplicationCommandModuleLifespanAttribute)} scope was specified on command {context.CommandName}") + }; ApplicationCommandsModule module = null; if (classInstance is ApplicationCommandsModule mod) module = mod; - // Slash commands - if (context is InteractionContext slashContext) + switch (context) { - await this.RunPreexecutionChecksAsync(method, slashContext).ConfigureAwait(false); + // Slash commands + case InteractionContext slashContext: + { + await this.RunPreexecutionChecksAsync(method, slashContext).ConfigureAwait(false); - var shouldExecute = await (module?.BeforeSlashExecutionAsync(slashContext) ?? Task.FromResult(true)).ConfigureAwait(false); + var shouldExecute = await (module?.BeforeSlashExecutionAsync(slashContext) ?? Task.FromResult(true)) + .ConfigureAwait(false); - if (shouldExecute) - { - if (AutoDeferEnabled) - await context.CreateResponseAsync(InteractionResponseType.DeferredChannelMessageWithSource).ConfigureAwait(false); - await ((Task)method.Invoke(classInstance, args.ToArray())).ConfigureAwait(false); + if (shouldExecute) + { + if (AutoDeferEnabled) + await context.CreateResponseAsync(InteractionResponseType.DeferredChannelMessageWithSource) + .ConfigureAwait(false); + await ((Task)method.Invoke(classInstance, args.ToArray())).ConfigureAwait(false); + + await (module?.AfterSlashExecutionAsync(slashContext) ?? Task.CompletedTask).ConfigureAwait(false); + } - await (module?.AfterSlashExecutionAsync(slashContext) ?? Task.CompletedTask).ConfigureAwait(false); + break; } - } - // Context menus - if (context is ContextMenuContext contextMenuContext) - { - await this.RunPreexecutionChecksAsync(method, contextMenuContext).ConfigureAwait(false); + // Context menus + case ContextMenuContext contextMenuContext: + { + await this.RunPreexecutionChecksAsync(method, contextMenuContext).ConfigureAwait(false); - var shouldExecute = await (module?.BeforeContextMenuExecutionAsync(contextMenuContext) ?? Task.FromResult(true)).ConfigureAwait(false); + var shouldExecute = + await (module?.BeforeContextMenuExecutionAsync(contextMenuContext) ?? Task.FromResult(true)) + .ConfigureAwait(false); - if (shouldExecute) - { - if (AutoDeferEnabled) - await context.CreateResponseAsync(InteractionResponseType.DeferredChannelMessageWithSource).ConfigureAwait(false); - await ((Task)method.Invoke(classInstance, args.ToArray())).ConfigureAwait(false); + if (shouldExecute) + { + if (AutoDeferEnabled) + await context.CreateResponseAsync(InteractionResponseType.DeferredChannelMessageWithSource) + .ConfigureAwait(false); + await ((Task)method.Invoke(classInstance, args.ToArray())).ConfigureAwait(false); + + await (module?.AfterContextMenuExecutionAsync(contextMenuContext) ?? Task.CompletedTask) + .ConfigureAwait(false); + } - await (module?.AfterContextMenuExecutionAsync(contextMenuContext) ?? Task.CompletedTask).ConfigureAwait(false); + break; } } } @@ -1329,14 +1586,16 @@ internal static object CreateInstance(Type t, IServiceProvider services) .ToArray(); if (constructors.Length != 1) - throw new ArgumentException("Specified type does not contain a public constructor or contains more than one public constructor."); + throw new ArgumentException( + "Specified type does not contain a public constructor or contains more than one public constructor."); var constructor = constructors[0]; var constructorArgs = constructor.GetParameters(); var args = new object[constructorArgs.Length]; if (constructorArgs.Length != 0 && services == null) - throw new InvalidOperationException("Dependency collection needs to be specified for parameterized constructors."); + throw new InvalidOperationException( + "Dependency collection needs to be specified for parameterized constructors."); // inject via constructor if (constructorArgs.Length != 0) @@ -1346,7 +1605,9 @@ internal static object CreateInstance(Type t, IServiceProvider services) var moduleInstance = Activator.CreateInstance(t, args); // inject into properties - var props = t.GetRuntimeProperties().Where(xp => xp.CanWrite && xp.SetMethod != null && !xp.SetMethod.IsStatic && xp.SetMethod.IsPublic); + var props = t.GetRuntimeProperties().Where(xp => + xp.CanWrite && xp.SetMethod != null && !xp.SetMethod.IsStatic && + xp.SetMethod.IsPublic); foreach (var prop in props) { if (prop.GetCustomAttribute() != null) @@ -1373,7 +1634,7 @@ internal static object CreateInstance(Type t, IServiceProvider services) field.SetValue(moduleInstance, service); } - return moduleInstance; + return moduleInstance!; } /// @@ -1383,56 +1644,91 @@ internal static object CreateInstance(Type t, IServiceProvider services) /// The interaction context. /// The method info. /// The options. - private async Task> ResolveInteractionCommandParameters(InteractionCreateEventArgs e, InteractionContext context, MethodInfo method, IEnumerable options) + private async Task> ResolveInteractionCommandParameters( + InteractionCreateEventArgs e, + InteractionContext context, MethodInfo method, + IEnumerable + options + ) { - var args = new List { context }; + var args = new List + { + context + }; var parameters = method.GetParameters().Skip(1); foreach (var parameter in parameters) - { //Accounts for optional arguments without values given - if (parameter.IsOptional && (options == null || (!options?.Any(x => x.Name == parameter.GetCustomAttribute().Name.ToLower()) ?? true))) + if (parameter.IsOptional && (options == null || + (!options?.Any(x => + x.Name == parameter.GetCustomAttribute() + .Name + .ToLower()) ?? true))) + { args.Add(parameter.DefaultValue); + } else { - var option = options.Single(x => x.Name == parameter.GetCustomAttribute().Name.ToLower()); + var option = options.Single(x => + x.Name == parameter.GetCustomAttribute().Name + .ToLower()); if (parameter.ParameterType == typeof(string)) + { args.Add(option.Value.ToString()); + } else if (parameter.ParameterType.IsEnum) + { args.Add(Enum.Parse(parameter.ParameterType, (string)option.Value)); + } else if (parameter.ParameterType == typeof(ulong) || parameter.ParameterType == typeof(ulong?)) + { args.Add((ulong?)option.Value); + } else if (parameter.ParameterType == typeof(int) || parameter.ParameterType == typeof(int?)) + { args.Add((int?)option.Value); + } else if (parameter.ParameterType == typeof(long) || parameter.ParameterType == typeof(long?)) + { if (option.Value == null) args.Add(null); else args.Add(Convert.ToInt64(option.Value)); + } else if (parameter.ParameterType == typeof(bool) || parameter.ParameterType == typeof(bool?)) + { args.Add((bool?)option.Value); + } else if (parameter.ParameterType == typeof(double) || parameter.ParameterType == typeof(double?)) + { args.Add((double?)option.Value); + } else if (parameter.ParameterType == typeof(int) || parameter.ParameterType == typeof(int?)) + { args.Add((int?)option.Value); + } else if (parameter.ParameterType == typeof(DiscordAttachment)) { //Checks through resolved - if (e.Interaction.Data.Resolved.Attachments != null && - e.Interaction.Data.Resolved.Attachments.TryGetValue((ulong)option.Value, out var attachment)) + if (e.Interaction.Data.Resolved?.Attachments != null && + e.Interaction.Data.Resolved.Attachments.TryGetValue((ulong)option.Value, out var attachment)) args.Add(attachment); else - args.Add(new DiscordAttachment() { Id = (ulong)option.Value, Discord = this.Client.ApiClient.Discord }); + args.Add(new DiscordAttachment() + { + Id = (ulong)option.Value, + Discord = this.Client.ApiClient.Discord + }); } else if (parameter.ParameterType == typeof(DiscordUser)) { //Checks through resolved - if (e.Interaction.Data.Resolved.Members != null && - e.Interaction.Data.Resolved.Members.TryGetValue((ulong)option.Value, out var member)) + if (e.Interaction.Data.Resolved?.Members != null && + e.Interaction.Data.Resolved.Members.TryGetValue((ulong)option.Value, out var member)) args.Add(member); - else if (e.Interaction.Data.Resolved.Users != null && - e.Interaction.Data.Resolved.Users.TryGetValue((ulong)option.Value, out var user)) + else if (e.Interaction.Data.Resolved?.Users != null && + e.Interaction.Data.Resolved.Users.TryGetValue((ulong)option.Value, out var user)) args.Add(user); else args.Add(await this.Client.GetUserAsync((ulong)option.Value).ConfigureAwait(false)); @@ -1440,8 +1736,8 @@ private async Task> ResolveInteractionCommandParameters(Interaction else if (parameter.ParameterType == typeof(DiscordChannel)) { //Checks through resolved - if (e.Interaction.Data.Resolved.Channels != null && - e.Interaction.Data.Resolved.Channels.TryGetValue((ulong)option.Value, out var channel)) + if (e.Interaction.Data.Resolved?.Channels != null && + e.Interaction.Data.Resolved.Channels.TryGetValue((ulong)option.Value, out var channel)) args.Add(channel); else args.Add(e.Interaction.Guild.GetChannel((ulong)option.Value)); @@ -1449,8 +1745,8 @@ private async Task> ResolveInteractionCommandParameters(Interaction else if (parameter.ParameterType == typeof(DiscordRole)) { //Checks through resolved - if (e.Interaction.Data.Resolved.Roles != null && - e.Interaction.Data.Resolved.Roles.TryGetValue((ulong)option.Value, out var role)) + if (e.Interaction.Data.Resolved?.Roles != null && + e.Interaction.Data.Resolved.Roles.TryGetValue((ulong)option.Value, out var role)) args.Add(role); else args.Add(e.Interaction.Guild.GetRole((ulong)option.Value)); @@ -1458,21 +1754,26 @@ private async Task> ResolveInteractionCommandParameters(Interaction else if (parameter.ParameterType == typeof(SnowflakeObject)) { //Checks through resolved - if (e.Interaction.Data.Resolved.Channels != null && e.Interaction.Data.Resolved.Channels.TryGetValue((ulong)option.Value, out var channel)) + if (e.Interaction.Data.Resolved?.Channels != null && + e.Interaction.Data.Resolved.Channels.TryGetValue((ulong)option.Value, out var channel)) args.Add(channel); - if (e.Interaction.Data.Resolved.Roles != null && e.Interaction.Data.Resolved.Roles.TryGetValue((ulong)option.Value, out var role)) + else if (e.Interaction.Data.Resolved?.Roles != null && + e.Interaction.Data.Resolved.Roles.TryGetValue((ulong)option.Value, out var role)) args.Add(role); - else if (e.Interaction.Data.Resolved.Members != null && e.Interaction.Data.Resolved.Members.TryGetValue((ulong)option.Value, out var member)) + else if (e.Interaction.Data.Resolved?.Members != null && + e.Interaction.Data.Resolved.Members.TryGetValue((ulong)option.Value, out var member)) args.Add(member); - else if (e.Interaction.Data.Resolved.Users != null && e.Interaction.Data.Resolved.Users.TryGetValue((ulong)option.Value, out var user)) + else if (e.Interaction.Data.Resolved?.Users != null && + e.Interaction.Data.Resolved.Users.TryGetValue((ulong)option.Value, out var user)) args.Add(user); else throw new ArgumentException("Error resolving mentionable option."); } else - throw new ArgumentException($"Error resolving interaction."); + { + throw new ArgumentException("Error resolving interaction."); + } } - } return args; } @@ -1482,60 +1783,73 @@ private async Task> ResolveInteractionCommandParameters(Interaction /// /// The method info. /// The base context. - private async Task RunPreexecutionChecksAsync(MethodInfo method, BaseContext context) + private async Task RunPreexecutionChecksAsync(MemberInfo method, BaseContext context) { - if (context is InteractionContext ctx) + switch (context) { - //Gets all attributes from parent classes as well and stuff - var attributes = new List(); - attributes.AddRange(method.GetCustomAttributes(true)); - attributes.AddRange(method.DeclaringType.GetCustomAttributes()); - if (method.DeclaringType.DeclaringType != null) + case InteractionContext ctx: { - attributes.AddRange(method.DeclaringType.DeclaringType.GetCustomAttributes()); - if (method.DeclaringType.DeclaringType.DeclaringType != null) + //Gets all attributes from parent classes as well and stuff + var attributes = new List(); + attributes.AddRange(method.GetCustomAttributes(true)); + attributes.AddRange(method.DeclaringType.GetCustomAttributes()); + if (method.DeclaringType.DeclaringType != null) { - attributes.AddRange(method.DeclaringType.DeclaringType.DeclaringType.GetCustomAttributes()); + attributes.AddRange(method.DeclaringType.DeclaringType + .GetCustomAttributes()); + if (method.DeclaringType.DeclaringType.DeclaringType != null) + attributes.AddRange(method.DeclaringType.DeclaringType.DeclaringType + .GetCustomAttributes()); } - } - var dict = new Dictionary(); - foreach (var att in attributes) - { - //Runs the check and adds the result to a list - var result = await att.ExecuteChecksAsync(ctx).ConfigureAwait(false); - dict.Add(att, result); - } + var dict = new Dictionary(); + foreach (var att in attributes) + { + //Runs the check and adds the result to a list + var result = await att.ExecuteChecksAsync(ctx).ConfigureAwait(false); + dict.Add(att, result); + } - //Checks if any failed, and throws an exception - if (dict.Any(x => x.Value == false)) - throw new SlashExecutionChecksFailedException { FailedChecks = dict.Where(x => x.Value == false).Select(x => x.Key).ToList() }; - } - if (context is ContextMenuContext cMctx) - { - var attributes = new List(); - attributes.AddRange(method.GetCustomAttributes(true)); - attributes.AddRange(method.DeclaringType.GetCustomAttributes()); - if (method.DeclaringType.DeclaringType != null) + //Checks if any failed, and throws an exception + if (dict.Any(x => x.Value == false)) + throw new SlashExecutionChecksFailedException + { + FailedChecks = dict.Where(x => x.Value == false).Select(x => x.Key).ToList() + }; + + break; + } + case ContextMenuContext contextMenuContext: { - attributes.AddRange(method.DeclaringType.DeclaringType.GetCustomAttributes()); - if (method.DeclaringType.DeclaringType.DeclaringType != null) + var attributes = new List(); + attributes.AddRange(method.GetCustomAttributes(true)); + attributes.AddRange(method.DeclaringType.GetCustomAttributes()); + if (method.DeclaringType.DeclaringType != null) { - attributes.AddRange(method.DeclaringType.DeclaringType.DeclaringType.GetCustomAttributes()); + attributes.AddRange(method.DeclaringType.DeclaringType + .GetCustomAttributes()); + if (method.DeclaringType.DeclaringType.DeclaringType != null) + attributes.AddRange(method.DeclaringType.DeclaringType.DeclaringType + .GetCustomAttributes()); } - } - var dict = new Dictionary(); - foreach (var att in attributes) - { - //Runs the check and adds the result to a list - var result = await att.ExecuteChecksAsync(cMctx).ConfigureAwait(false); - dict.Add(att, result); - } + var dict = new Dictionary(); + foreach (var att in attributes) + { + //Runs the check and adds the result to a list + var result = await att.ExecuteChecksAsync(contextMenuContext).ConfigureAwait(false); + dict.Add(att, result); + } + + //Checks if any failed, and throws an exception + if (dict.Any(x => x.Value == false)) + throw new ContextMenuExecutionChecksFailedException + { + FailedChecks = dict.Where(x => x.Value == false).Select(x => x.Key).ToList() + }; - //Checks if any failed, and throws an exception - if (dict.Any(x => x.Value == false)) - throw new ContextMenuExecutionChecksFailedException { FailedChecks = dict.Where(x => x.Value == false).Select(x => x.Key).ToList() }; + break; + } } } @@ -1544,7 +1858,9 @@ private async Task RunPreexecutionChecksAsync(MethodInfo method, BaseContext con /// /// The custom attributes. /// The optional guild id - private static async Task> GetChoiceAttributesFromProvider(IEnumerable customAttributes, ulong? guildId = null) + private static async Task> GetChoiceAttributesFromProviderAsync( + IEnumerable customAttributes, ulong? guildId = null + ) { var choices = new List(); foreach (var choiceProviderAttribute in customAttributes) @@ -1552,7 +1868,9 @@ private static async Task> GetChoice var method = choiceProviderAttribute.ProviderType.GetMethod(nameof(IChoiceProvider.Provider)); if (method == null) + { throw new ArgumentException("ChoiceProviders must inherit from IChoiceProvider."); + } else { var instance = Activator.CreateInstance(choiceProviderAttribute.ProviderType); @@ -1568,12 +1886,12 @@ private static async Task> GetChoice } //Gets the choices from the method - var result = await ((Task>)method.Invoke(instance, null)).ConfigureAwait(false); + var result = + await ((Task>)method.Invoke(instance, null)) + .ConfigureAwait(false); if (result.Any()) - { choices.AddRange(result); - } } } @@ -1585,14 +1903,8 @@ private static async Task> GetChoice /// /// The enum parameter. private static List GetChoiceAttributesFromEnumParameter(Type enumParam) - { - var choices = new List(); - foreach (Enum enumValue in Enum.GetValues(enumParam)) - { - choices.Add(new DiscordApplicationCommandOptionChoice(enumValue.GetName(), enumValue.ToString())); - } - return choices; - } + => (from Enum enumValue in Enum.GetValues(enumParam) + select new DiscordApplicationCommandOptionChoice(enumValue.GetName(), enumValue.ToString())).ToList(); /// /// Gets the parameter type. @@ -1602,25 +1914,27 @@ private static ApplicationCommandOptionType GetParameterType(Type type) { var parameterType = type == typeof(string) ? ApplicationCommandOptionType.String - : type == typeof(long) || type == typeof(long?) || type == typeof(int) || type == typeof(int?) - ? ApplicationCommandOptionType.Integer - : type == typeof(bool) || type == typeof(bool?) - ? ApplicationCommandOptionType.Boolean - : type == typeof(double) || type == typeof(double?) - ? ApplicationCommandOptionType.Number - : type == typeof(DiscordAttachment) - ? ApplicationCommandOptionType.Attachment - : type == typeof(DiscordChannel) - ? ApplicationCommandOptionType.Channel - : type == typeof(DiscordUser) - ? ApplicationCommandOptionType.User - : type == typeof(DiscordRole) - ? ApplicationCommandOptionType.Role - : type == typeof(SnowflakeObject) - ? ApplicationCommandOptionType.Mentionable - : type.IsEnum - ? ApplicationCommandOptionType.String - : throw new ArgumentException("Cannot convert type! Argument types must be string, int, long, bool, double, DiscordChannel, DiscordUser, DiscordRole, SnowflakeObject, DiscordAttachment or an Enum."); + : type == typeof(long) || type == typeof(long?) || type == typeof(int) || + type == typeof(int?) + ? ApplicationCommandOptionType.Integer + : type == typeof(bool) || type == typeof(bool?) + ? ApplicationCommandOptionType.Boolean + : type == typeof(double) || type == typeof(double?) + ? ApplicationCommandOptionType.Number + : type == typeof(DiscordAttachment) + ? ApplicationCommandOptionType.Attachment + : type == typeof(DiscordChannel) + ? ApplicationCommandOptionType.Channel + : type == typeof(DiscordUser) + ? ApplicationCommandOptionType.User + : type == typeof(DiscordRole) + ? ApplicationCommandOptionType.Role + : type == typeof(SnowflakeObject) + ? ApplicationCommandOptionType.Mentionable + : type.IsEnum + ? ApplicationCommandOptionType.String + : throw new ArgumentException( + "Cannot convert type! Argument types must be string, int, long, bool, double, DiscordChannel, DiscordUser, DiscordRole, SnowflakeObject, DiscordAttachment or an Enum."); return parameterType; } @@ -1628,10 +1942,13 @@ private static ApplicationCommandOptionType GetParameterType(Type type) /// Gets the choice attributes from parameter. /// /// The choice attributes. - private static List GetChoiceAttributesFromParameter(IEnumerable choiceAttributes) => - !choiceAttributes.Any() + private static List? GetChoiceAttributesFromParameter( + IEnumerable choiceAttributes + ) + => !choiceAttributes.Any() ? null - : choiceAttributes.Select(att => new DiscordApplicationCommandOptionChoice(att.Name, att.Value)).ToList(); + : choiceAttributes.Select(att => new DiscordApplicationCommandOptionChoice(att.Name, att.Value)) + .ToList(); /// /// Parses the parameters. @@ -1639,13 +1956,17 @@ private static List GetChoiceAttributesFr /// The parameters. /// The command name. /// The optional guild id. - internal static async Task> ParseParametersAsync(IEnumerable parameters, string commandName, ulong? guildId) + internal static async Task> ParseParametersAsync( + IEnumerable parameters, string commandName, ulong? guildId + ) { var options = new List(); foreach (var parameter in parameters) { //Gets the attribute - var optionAttribute = parameter.GetCustomAttribute() ?? throw new ArgumentException($"One or more arguments of the command '{commandName}' are missing the Option attribute!"); + var optionAttribute = parameter.GetCustomAttribute() ?? + throw new ArgumentException( + $"One or more arguments of the command '{commandName}' are missing the Option attribute!"); var minimumValue = parameter.GetCustomAttribute()?.Value ?? null; var maximumValue = parameter.GetCustomAttribute()?.Value ?? null; var minimumLength = parameter.GetCustomAttribute()?.Value ?? null; @@ -1653,24 +1974,31 @@ internal static async Task> ParseParameter var channelTypes = parameter.GetCustomAttribute()?.ChannelTypes ?? null; var autocompleteAttribute = parameter.GetCustomAttribute(); - if (optionAttribute.Autocomplete && autocompleteAttribute == null) - throw new ArgumentException($"The command '{commandName}' has autocomplete enabled but is missing an autocomplete attribute!"); - if (!optionAttribute.Autocomplete && autocompleteAttribute != null) - throw new ArgumentException($"The command '{commandName}' has an autocomplete provider but the option to have autocomplete set to false!"); + switch (optionAttribute.Autocomplete) + { + case true when autocompleteAttribute == null: + throw new ArgumentException( + $"The command '{commandName}' has autocomplete enabled but is missing an autocomplete attribute!"); + case false when autocompleteAttribute != null: + throw new ArgumentException( + $"The command '{commandName}' has an autocomplete provider but the option to have autocomplete set to false!"); + } //Sets the type var type = parameter.ParameterType; var parameterType = GetParameterType(type); - if (parameterType == ApplicationCommandOptionType.String) - { - minimumValue = null; - maximumValue = null; - } - else if (parameterType == ApplicationCommandOptionType.Integer || parameterType == ApplicationCommandOptionType.Number) + switch (parameterType) { - minimumLength = null; - maximumLength = null; + case ApplicationCommandOptionType.String: + minimumValue = null; + maximumValue = null; + break; + case ApplicationCommandOptionType.Integer: + case ApplicationCommandOptionType.Number: + minimumLength = null; + maximumLength = null; + break; } if (parameterType != ApplicationCommandOptionType.Channel) @@ -1681,17 +2009,15 @@ internal static async Task> ParseParameter var choices = GetChoiceAttributesFromParameter(parameter.GetCustomAttributes()); //From enums if (parameter.ParameterType.IsEnum) - { choices = GetChoiceAttributesFromEnumParameter(parameter.ParameterType); - } //From choice provider var choiceProviders = parameter.GetCustomAttributes(); if (choiceProviders.Any()) - { - choices = await GetChoiceAttributesFromProvider(choiceProviders, guildId).ConfigureAwait(false); - } + choices = await GetChoiceAttributesFromProviderAsync(choiceProviders, guildId).ConfigureAwait(false); - options.Add(new DiscordApplicationCommandOption(optionAttribute.Name, optionAttribute.Description, parameterType, !parameter.IsOptional, choices, null, channelTypes, optionAttribute.Autocomplete, minimumValue, maximumValue, minimumLength: minimumLength, maximumLength: maximumLength)); + options.Add(new(optionAttribute.Name, optionAttribute.Description, parameterType, !parameter.IsOptional, + choices, null, channelTypes, optionAttribute.Autocomplete, minimumValue, maximumValue, + minimumLength: minimumLength, maximumLength: maximumLength)); } return options; @@ -1732,6 +2058,7 @@ public event AsyncEventHandler this._slashError.Register(value); remove => this._slashError.Unregister(value); } + private AsyncEvent _slashError; /// @@ -1742,6 +2069,7 @@ public event AsyncEventHandler this._slashExecuted.Register(value); remove => this._slashExecuted.Unregister(value); } + private AsyncEvent _slashExecuted; /// @@ -1752,6 +2080,7 @@ public event AsyncEventHandler this._contextMenuErrored.Register(value); remove => this._contextMenuErrored.Unregister(value); } + private AsyncEvent _contextMenuErrored; /// @@ -1762,13 +2091,14 @@ public event AsyncEventHandler this._contextMenuExecuted.Register(value); remove => this._contextMenuExecuted.Unregister(value); } + private AsyncEvent _contextMenuExecuted; } /// /// Holds configuration data for setting up an application command. /// -internal class ApplicationCommandsModuleConfiguration +internal sealed class ApplicationCommandsModuleConfiguration { /// /// The type of the command module. @@ -1778,14 +2108,17 @@ internal class ApplicationCommandsModuleConfiguration /// /// The translation setup. /// - public Action Translations { get; } + public Action? Translations { get; } /// /// Creates a new command configuration. /// /// The type of the command module. /// The translation setup callback. - public ApplicationCommandsModuleConfiguration(Type type, Action translations = null) + public ApplicationCommandsModuleConfiguration( + Type type, + Action? translations = null + ) { this.Type = type; this.Translations = translations; @@ -1816,7 +2149,7 @@ internal class ApplicationCommandSourceLink /// /// The command method. /// -internal class CommandMethod +internal sealed class CommandMethod { /// /// Gets or sets the command id. @@ -1826,18 +2159,18 @@ internal class CommandMethod /// /// Gets or sets the name. /// - public string Name { get; set; } + public string Name { get; init; } /// /// Gets or sets the method. /// - public MethodInfo Method { get; set; } + public MethodInfo Method { get; init; } } /// /// The group command. /// -internal class GroupCommand +internal sealed class GroupCommand { /// /// Gets or sets the command id. @@ -1847,18 +2180,18 @@ internal class GroupCommand /// /// Gets or sets the name. /// - public string Name { get; set; } + public string Name { get; init; } /// /// Gets or sets the methods. /// - public List> Methods { get; set; } = null; + public List>? Methods { get; init; } } /// /// The sub group command. /// -internal class SubGroupCommand +internal sealed class SubGroupCommand { /// /// Gets or sets the command id. @@ -1868,7 +2201,7 @@ internal class SubGroupCommand /// /// Gets or sets the name. /// - public string Name { get; set; } + public string Name { get; init; } /// /// Gets or sets the sub commands. @@ -1879,7 +2212,7 @@ internal class SubGroupCommand /// /// The context menu command. /// -internal class ContextMenuCommand +internal sealed class ContextMenuCommand { /// /// Gets or sets the command id. @@ -1889,27 +2222,28 @@ internal class ContextMenuCommand /// /// Gets or sets the name. /// - public string Name { get; set; } + public string Name { get; init; } /// /// Gets or sets the method. /// - public MethodInfo Method { get; set; } + public MethodInfo Method { get; init; } } #region Default Help + /// /// Represents the default help module. /// -internal class DefaultHelpModule : ApplicationCommandsModule +internal sealed class DefaultHelpModule : ApplicationCommandsModule { - public class DefaultHelpAutoCompleteProvider : IAutocompleteProvider + public sealed class DefaultHelpAutoCompleteProvider : IAutocompleteProvider { - public async Task> Provider(AutocompleteContext context) + public async Task> Provider( + AutocompleteContext context + ) { - var options = new List(); - - IEnumerable slashCommands = null; + IEnumerable slashCommands; var globalCommandsTask = context.Client.GetGlobalApplicationCommandsAsync(); if (context.Guild != null) { @@ -1918,33 +2252,37 @@ public async Task> Prov slashCommands = globalCommandsTask.Result.Concat(guildCommandsTask.Result) .Where(ac => !ac.Name.Equals("help", StringComparison.OrdinalIgnoreCase)) .GroupBy(ac => ac.Name).Select(x => x.First()) - .Where(ac => ac.Name.StartsWith(context.Options[0].Value.ToString(), StringComparison.OrdinalIgnoreCase)) + .Where(ac => + ac.Name.StartsWith(context.Options[0].Value.ToString(), + StringComparison.OrdinalIgnoreCase)) .ToList(); } else { - await Task.WhenAll(globalCommandsTask).ConfigureAwait(false); - slashCommands = globalCommandsTask.Result + var task = await globalCommandsTask.ConfigureAwait(false); + slashCommands = task .Where(ac => !ac.Name.Equals("help", StringComparison.OrdinalIgnoreCase)) .GroupBy(ac => ac.Name).Select(x => x.First()) - .Where(ac => ac.Name.StartsWith(context.Options[0].Value.ToString(), StringComparison.OrdinalIgnoreCase)) + .Where(ac => + ac.Name.StartsWith(context.Options[0].Value.ToString(), + StringComparison.OrdinalIgnoreCase)) .ToList(); } - foreach (var sc in slashCommands.Take(25)) - { - options.Add(new DiscordApplicationCommandAutocompleteChoice(sc.Name, sc.Name.Trim())); - } + var options = slashCommands.Take(25) + .Select(sc => new DiscordApplicationCommandAutocompleteChoice(sc.Name, sc.Name.Trim())).ToList(); return options.AsEnumerable(); } } - public class DefaultHelpAutoCompleteLevelOneProvider : IAutocompleteProvider + public sealed class DefaultHelpAutoCompleteLevelOneProvider : IAutocompleteProvider { - public async Task> Provider(AutocompleteContext context) + public async Task> Provider( + AutocompleteContext context + ) { var options = new List(); - IEnumerable slashCommands = null; + IEnumerable slashCommands; var globalCommandsTask = context.Client.GetGlobalApplicationCommandsAsync(); if (context.Guild != null) { @@ -1956,37 +2294,44 @@ public async Task> Prov } else { - await Task.WhenAll(globalCommandsTask).ConfigureAwait(false); - slashCommands = globalCommandsTask.Result + var task = await globalCommandsTask.ConfigureAwait(false); + slashCommands = task .Where(ac => !ac.Name.Equals("help", StringComparison.OrdinalIgnoreCase)) .GroupBy(ac => ac.Name).Select(x => x.First()); } var command = slashCommands.FirstOrDefault(ac => - ac.Name.Equals(context.Options[0].Value.ToString().Trim(),StringComparison.OrdinalIgnoreCase)); - if (command is null || command.Options is null) + ac.Name.Equals(context.Options[0].Value.ToString().Trim(), + StringComparison.OrdinalIgnoreCase)); + if (command?.Options is null) { - options.Add(new DiscordApplicationCommandAutocompleteChoice("no_options_for_this_command", "no_options_for_this_command")); + options.Add(new("no_options_for_this_command", "no_options_for_this_command")); } else { - var opt = command.Options.Where(c => c.Type is ApplicationCommandOptionType.SubCommandGroup or ApplicationCommandOptionType.SubCommand - && c.Name.StartsWith(context.Options[1].Value.ToString(), StringComparison.InvariantCultureIgnoreCase)).ToList(); - foreach (var option in opt.Take(25)) - { - options.Add(new DiscordApplicationCommandAutocompleteChoice(option.Name, option.Name.Trim())); - } + var opt = command.Options.Where(c => + c.Type is ApplicationCommandOptionType.SubCommandGroup + or ApplicationCommandOptionType.SubCommand + && c.Name.StartsWith(context.Options[1].Value.ToString(), + StringComparison.InvariantCultureIgnoreCase)) + .ToList(); + options.AddRange(opt.Take(25).Select(option => + new DiscordApplicationCommandAutocompleteChoice(option.Name, + option.Name.Trim()))); } + return options.AsEnumerable(); } } - public class DefaultHelpAutoCompleteLevelTwoProvider : IAutocompleteProvider + public sealed class DefaultHelpAutoCompleteLevelTwoProvider : IAutocompleteProvider { - public async Task> Provider(AutocompleteContext context) + public async Task> Provider( + AutocompleteContext context + ) { var options = new List(); - IEnumerable slashCommands = null; + IEnumerable slashCommands; var globalCommandsTask = context.Client.GetGlobalApplicationCommandsAsync(); if (context.Guild != null) { @@ -1998,51 +2343,63 @@ public async Task> Prov } else { - await Task.WhenAll(globalCommandsTask).ConfigureAwait(false); - slashCommands = globalCommandsTask.Result + var task = await globalCommandsTask.ConfigureAwait(false); + slashCommands = task .Where(ac => !ac.Name.Equals("help", StringComparison.OrdinalIgnoreCase)) .GroupBy(ac => ac.Name).Select(x => x.First()); } var command = slashCommands.FirstOrDefault(ac => - ac.Name.Equals(context.Options[0].Value.ToString().Trim(), StringComparison.OrdinalIgnoreCase)); - if (command.Options is null) + ac.Name.Equals(context.Options[0].Value.ToString().Trim(), + StringComparison.OrdinalIgnoreCase)); + if (command?.Options is null) { - options.Add(new DiscordApplicationCommandAutocompleteChoice("no_options_for_this_command", "no_options_for_this_command")); + options.Add(new("no_options_for_this_command", "no_options_for_this_command")); return options.AsEnumerable(); } - var foundCommand = command.Options.FirstOrDefault(op => op.Name.Equals(context.Options[1].Value.ToString().Trim(), StringComparison.OrdinalIgnoreCase)); - if (foundCommand is null || foundCommand.Options is null) + + var foundCommand = command.Options.FirstOrDefault(op => + op.Name + .Equals(context.Options[1].Value.ToString().Trim(), + StringComparison.OrdinalIgnoreCase)); + if (foundCommand?.Options is null) { - options.Add(new DiscordApplicationCommandAutocompleteChoice("no_options_for_this_command", "no_options_for_this_command")); + options.Add(new("no_options_for_this_command", "no_options_for_this_command")); } else { var opt = foundCommand.Options.Where(x => x.Type == ApplicationCommandOptionType.SubCommand && - x.Name.StartsWith(context.Options[2].Value.ToString(), StringComparison.OrdinalIgnoreCase)).ToList(); - foreach (var option in opt.Take(25)) - { - options.Add(new DiscordApplicationCommandAutocompleteChoice(option.Name, option.Name.Trim())); - } + x.Name.StartsWith(context.Options[2].Value.ToString(), + StringComparison.OrdinalIgnoreCase)) + .ToList(); + options.AddRange(opt.Take(25).Select(option => + new DiscordApplicationCommandAutocompleteChoice(option.Name, + option.Name.Trim()))); } + return options.AsEnumerable(); } } [SlashCommand("help", "Displays command help")] - internal async Task DefaultHelpAsync(InteractionContext ctx, - [Autocomplete(typeof(DefaultHelpAutoCompleteProvider))] - [Option("option_one", "top level command to provide help for", true)] string commandName, - [Autocomplete(typeof(DefaultHelpAutoCompleteLevelOneProvider))] - [Option("option_two", "subgroup or command to provide help for", true)] string commandOneName = null, - [Autocomplete(typeof(DefaultHelpAutoCompleteLevelTwoProvider))] - [Option("option_three", "command to provide help for", true)] string commandTwoName = null) + internal async Task DefaultHelpAsync( + InteractionContext ctx, + [Autocomplete(typeof(DefaultHelpAutoCompleteProvider)), + Option("option_one", "top level command to provide help for", true)] + string commandName, + [Autocomplete(typeof(DefaultHelpAutoCompleteLevelOneProvider)), + Option("option_two", "subgroup or command to provide help for", true)] + string commandOneName = null, + [Autocomplete(typeof(DefaultHelpAutoCompleteLevelTwoProvider)), + Option("option_three", "command to provide help for", true)] + string commandTwoName = null + ) { - List applicationCommands = null; + List applicationCommands; var globalCommandsTask = ctx.Client.GetGlobalApplicationCommandsAsync(); if (ctx.Guild != null) { - var guildCommandsTask= ctx.Client.GetGuildApplicationCommandsAsync(ctx.Guild.Id); + var guildCommandsTask = ctx.Client.GetGuildApplicationCommandsAsync(ctx.Guild.Id); await Task.WhenAll(globalCommandsTask, guildCommandsTask).ConfigureAwait(false); applicationCommands = globalCommandsTask.Result.Concat(guildCommandsTask.Result) .Where(ac => !ac.Name.Equals("help", StringComparison.OrdinalIgnoreCase)) @@ -2051,7 +2408,7 @@ internal async Task DefaultHelpAsync(InteractionContext ctx, } else { - await Task.WhenAll(globalCommandsTask).ConfigureAwait(false); + var task = await globalCommandsTask.ConfigureAwait(false); applicationCommands = globalCommandsTask.Result .Where(ac => !ac.Name.Equals("help", StringComparison.OrdinalIgnoreCase)) .GroupBy(ac => ac.Name).Select(x => x.First()) @@ -2064,21 +2421,35 @@ internal async Task DefaultHelpAsync(InteractionContext ctx, await ctx.EditResponseAsync(new DiscordWebhookBuilder() .WithContent($"There are no slash commands")).ConfigureAwait(false); else - await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder() - .WithContent($"There are no slash commands").AsEphemeral()).ConfigureAwait(false); + await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, + new DiscordInteractionResponseBuilder() + .WithContent($"There are no slash commands").AsEphemeral()) + .ConfigureAwait(false); return; } + if (commandTwoName is not null && !commandTwoName.Equals("no_options_for_this_command")) { - var commandsWithSubCommands = applicationCommands.FindAll(ac => ac.Options is not null && ac.Options.Any(op => op.Type == ApplicationCommandOptionType.SubCommandGroup)); - var subCommandParent = commandsWithSubCommands.FirstOrDefault(cm => cm.Name.Equals(commandName,StringComparison.OrdinalIgnoreCase)); - var cmdParent = commandsWithSubCommands.FirstOrDefault(cm => cm.Options.Any(op => op.Name.Equals(commandOneName))).Options - .FirstOrDefault(opt => opt.Name.Equals(commandOneName,StringComparison.OrdinalIgnoreCase)); - var cmd = cmdParent.Options.FirstOrDefault(op => op.Name.Equals(commandTwoName,StringComparison.OrdinalIgnoreCase)); + var commandsWithSubCommands = applicationCommands.FindAll(ac => + ac.Options is not null && + ac.Options.Any(op => op.Type == + ApplicationCommandOptionType + .SubCommandGroup)); + var subCommandParent = + commandsWithSubCommands.FirstOrDefault(cm => + cm.Name.Equals(commandName, + StringComparison.OrdinalIgnoreCase)); + var cmdParent = commandsWithSubCommands + .FirstOrDefault(cm => cm.Options.Any(op => op.Name.Equals(commandOneName))).Options + .FirstOrDefault(opt => opt.Name.Equals(commandOneName, StringComparison.OrdinalIgnoreCase)); + var cmd = cmdParent.Options.FirstOrDefault(op => + op.Name.Equals(commandTwoName, + StringComparison.OrdinalIgnoreCase)); var discordEmbed = new DiscordEmbedBuilder { Title = "Help", - Description = $"{subCommandParent.Mention.Replace(subCommandParent.Name, $"{subCommandParent.Name} {cmdParent.Name} {cmd.Name}")}: {cmd.Description ?? "No description provided."}" + Description = + $"{subCommandParent.Mention.Replace(subCommandParent.Name, $"{subCommandParent.Name} {cmdParent.Name} {cmd.Name}")}: {cmd.Description ?? "No description provided."}" }; if (cmd.Options is not null) { @@ -2086,27 +2457,41 @@ await ctx.EditResponseAsync(new DiscordWebhookBuilder() var sb = new StringBuilder(); foreach (var option in commandOptions) - sb.Append('`').Append(option.Name).Append("`: ").Append(option.Description ?? "No description provided.").Append('\n'); + sb.Append('`').Append(option.Name).Append("`: ") + .Append(option.Description ?? "No description provided.").Append('\n'); sb.Append('\n'); - discordEmbed.AddField(new DiscordEmbedField("Arguments", sb.ToString().Trim())); + discordEmbed.AddField(new("Arguments", sb.ToString().Trim())); } + if (ApplicationCommandsExtension.Configuration.AutoDefer) await ctx.EditResponseAsync(new DiscordWebhookBuilder() .AddEmbed(discordEmbed)).ConfigureAwait(false); else await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, - new DiscordInteractionResponseBuilder().AddEmbed(discordEmbed).AsEphemeral()).ConfigureAwait(false); + new DiscordInteractionResponseBuilder().AddEmbed(discordEmbed) + .AsEphemeral()).ConfigureAwait(false); } - else if (commandOneName is not null && commandTwoName is null && !commandOneName.Equals("no_options_for_this_command")) + else if (commandOneName is not null && commandTwoName is null && + !commandOneName.Equals("no_options_for_this_command")) { - var commandsWithOptions = applicationCommands.FindAll(ac => ac.Options is not null && ac.Options.All(op => op.Type == ApplicationCommandOptionType.SubCommand)); - var subCommandParent = commandsWithOptions.FirstOrDefault(cm => cm.Name.Equals(commandName,StringComparison.OrdinalIgnoreCase)); - var subCommand = subCommandParent.Options.FirstOrDefault(op => op.Name.Equals(commandOneName,StringComparison.OrdinalIgnoreCase)); + var commandsWithOptions = applicationCommands.FindAll(ac => + ac.Options is not null && + ac.Options.All(op => op.Type == + ApplicationCommandOptionType + .SubCommand)); + var subCommandParent = + commandsWithOptions.FirstOrDefault( + cm => cm.Name.Equals(commandName, + StringComparison.OrdinalIgnoreCase)); + var subCommand = subCommandParent.Options.FirstOrDefault(op => + op.Name.Equals(commandOneName, + StringComparison.OrdinalIgnoreCase)); var discordEmbed = new DiscordEmbedBuilder { Title = "Help", - Description = $"{subCommandParent.Mention.Replace(subCommandParent.Name, $"{subCommandParent.Name} {subCommand.Name}")}: {subCommand.Description ?? "No description provided."}" + Description = + $"{subCommandParent.Mention.Replace(subCommandParent.Name, $"{subCommandParent.Name} {subCommand.Name}")}: {subCommand.Description ?? "No description provided."}" }; if (subCommand.Options is not null) { @@ -2114,53 +2499,67 @@ await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, var sb = new StringBuilder(); foreach (var option in commandOptions) - sb.Append('`').Append(option.Name).Append("`: ").Append(option.Description ?? "No description provided.").Append('\n'); + sb.Append('`').Append(option.Name).Append("`: ") + .Append(option.Description ?? "No description provided.").Append('\n'); sb.Append('\n'); - discordEmbed.AddField(new DiscordEmbedField("Arguments", sb.ToString().Trim())); + discordEmbed.AddField(new("Arguments", sb.ToString().Trim())); } if (ApplicationCommandsExtension.Configuration.AutoDefer) await ctx.EditResponseAsync(new DiscordWebhookBuilder().AddEmbed(discordEmbed)).ConfigureAwait(false); else await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, - new DiscordInteractionResponseBuilder().AddEmbed(discordEmbed).AsEphemeral()).ConfigureAwait(false); + new DiscordInteractionResponseBuilder().AddEmbed(discordEmbed) + .AsEphemeral()).ConfigureAwait(false); } else { - var command = applicationCommands.FirstOrDefault(cm => cm.Name.Equals(commandName, StringComparison.OrdinalIgnoreCase)); + var command = + applicationCommands.FirstOrDefault( + cm => cm.Name.Equals(commandName, + StringComparison.OrdinalIgnoreCase)); if (command is null) { if (ApplicationCommandsExtension.Configuration.AutoDefer) await ctx.EditResponseAsync(new DiscordWebhookBuilder() - .WithContent($"No command called {commandName} in guild {ctx.Guild.Name}")).ConfigureAwait(false); + .WithContent($"No command called {commandName} in guild {ctx.Guild.Name}")) + .ConfigureAwait(false); else - await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder() - .WithContent($"No command called {commandName} in guild {ctx.Guild.Name}").AsEphemeral()).ConfigureAwait(false); + await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, + new DiscordInteractionResponseBuilder() + .WithContent($"No command called {commandName} in guild {ctx.Guild.Name}") + .AsEphemeral()) + .ConfigureAwait(false); return; } + var discordEmbed = new DiscordEmbedBuilder { Title = "Help", Description = $"{command.Mention}: {command.Description ?? "No description provided."}" - }.AddField(new DiscordEmbedField("Command is NSFW", command.IsNsfw.ToString())); + }.AddField(new("Command is NSFW", command.IsNsfw.ToString())); if (command.Options is not null) { var commandOptions = command.Options.ToList(); var sb = new StringBuilder(); foreach (var option in commandOptions) - sb.Append('`').Append(option.Name).Append("`: ").Append(option.Description ?? "No description provided.").Append('\n'); + sb.Append('`').Append(option.Name).Append("`: ") + .Append(option.Description ?? "No description provided.").Append('\n'); sb.Append('\n'); - discordEmbed.AddField(new DiscordEmbedField("Arguments", sb.ToString().Trim())); + discordEmbed.AddField(new("Arguments", sb.ToString().Trim())); } + if (ApplicationCommandsExtension.Configuration.AutoDefer) await ctx.EditResponseAsync(new DiscordWebhookBuilder().AddEmbed(discordEmbed)).ConfigureAwait(false); else await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, - new DiscordInteractionResponseBuilder().AddEmbed(discordEmbed).AsEphemeral()).ConfigureAwait(false); + new DiscordInteractionResponseBuilder().AddEmbed(discordEmbed) + .AsEphemeral()).ConfigureAwait(false); } } } + #endregion diff --git a/DisCatSharp.ApplicationCommands/ApplicationCommandsUtilities.cs b/DisCatSharp.ApplicationCommands/ApplicationCommandsUtilities.cs index 48bc175e1..1aa44ea83 100644 --- a/DisCatSharp.ApplicationCommands/ApplicationCommandsUtilities.cs +++ b/DisCatSharp.ApplicationCommands/ApplicationCommandsUtilities.cs @@ -22,19 +22,19 @@ internal static bool IsModuleCandidateType(this Type type) /// /// Whether this module is a candidate type. /// - /// The type info. - internal static bool IsModuleCandidateType(this TypeInfo ti) + /// The type info. + internal static bool IsModuleCandidateType(this TypeInfo targetTypeInfo) { if (ApplicationCommandsExtension.DebugEnabled) - ApplicationCommandsExtension.Logger.LogDebug("Checking type {name}", ti.FullName); + ApplicationCommandsExtension.Logger.LogDebug("Checking type {name}", targetTypeInfo.FullName); // check if compiler-generated - if (ti.GetCustomAttribute(false) != null) + if (targetTypeInfo.GetCustomAttribute(false) != null) return false; // check if derives from the required base class - var tmodule = typeof(ApplicationCommandsModule); - var timodule = tmodule.GetTypeInfo(); - if (!timodule.IsAssignableFrom(ti)) + var type = typeof(ApplicationCommandsModule); + var typeInfo = type.GetTypeInfo(); + if (!typeInfo.IsAssignableFrom(targetTypeInfo)) { if (ApplicationCommandsExtension.DebugEnabled) ApplicationCommandsExtension.Logger.LogDebug("Not assignable from type"); @@ -42,7 +42,9 @@ internal static bool IsModuleCandidateType(this TypeInfo ti) } // check if anonymous - if (ti.IsGenericType && ti.Name.Contains("AnonymousType") && (ti.Name.StartsWith("<>") || ti.Name.StartsWith("VB$")) && (ti.Attributes & TypeAttributes.NotPublic) == TypeAttributes.NotPublic) + if (targetTypeInfo.IsGenericType && targetTypeInfo.Name.Contains("AnonymousType") && + (targetTypeInfo.Name.StartsWith("<>") || targetTypeInfo.Name.StartsWith("VB$")) && + (targetTypeInfo.Attributes & TypeAttributes.NotPublic) == TypeAttributes.NotPublic) { if (ApplicationCommandsExtension.DebugEnabled) ApplicationCommandsExtension.Logger.LogDebug("Anonymous"); @@ -50,12 +52,12 @@ internal static bool IsModuleCandidateType(this TypeInfo ti) } // check if abstract, static, or not a class - if (!ti.IsClass || ti.IsAbstract) + if (!targetTypeInfo.IsClass || targetTypeInfo.IsAbstract) return false; // check if delegate type - var tdelegate = typeof(Delegate).GetTypeInfo(); - if (tdelegate.IsAssignableFrom(ti)) + var typeDelegate = typeof(Delegate).GetTypeInfo(); + if (typeDelegate.IsAssignableFrom(targetTypeInfo)) { if (ApplicationCommandsExtension.DebugEnabled) ApplicationCommandsExtension.Logger.LogDebug("Delegated"); @@ -65,7 +67,8 @@ internal static bool IsModuleCandidateType(this TypeInfo ti) if (ApplicationCommandsExtension.DebugEnabled) ApplicationCommandsExtension.Logger.LogDebug("Checking qualifying methods"); // qualifies if any method or type qualifies - return ti.DeclaredMethods.Any(xmi => xmi.IsCommandCandidate(out _)) || ti.DeclaredNestedTypes.Any(xti => xti.IsModuleCandidateType()); + return targetTypeInfo.DeclaredMethods.Any(xmi => xmi.IsCommandCandidate(out _)) || + targetTypeInfo.DeclaredNestedTypes.Any(xti => xti.IsModuleCandidateType()); } /// @@ -73,7 +76,7 @@ internal static bool IsModuleCandidateType(this TypeInfo ti) /// /// The method. /// The parameters. - internal static bool IsCommandCandidate(this MethodInfo method, out ParameterInfo[] parameters) + internal static bool IsCommandCandidate(this MethodInfo? method, out ParameterInfo[]? parameters) { parameters = null; // check if exists @@ -83,6 +86,7 @@ internal static bool IsCommandCandidate(this MethodInfo method, out ParameterInf ApplicationCommandsExtension.Logger.LogDebug("Not existent"); return false; } + if (ApplicationCommandsExtension.DebugEnabled) ApplicationCommandsExtension.Logger.LogDebug("Checking method {name}", method.Name); @@ -96,10 +100,13 @@ internal static bool IsCommandCandidate(this MethodInfo method, out ParameterInf // check if appropriate return and arguments parameters = method.GetParameters(); - if (!parameters.Any() || (parameters.First().ParameterType != typeof(ContextMenuContext) && parameters.First().ParameterType != typeof(InteractionContext)) || method.ReturnType != typeof(Task)) + if (!parameters.Any() || + (parameters.First().ParameterType != typeof(ContextMenuContext) && + parameters.First().ParameterType != typeof(InteractionContext)) || method.ReturnType != typeof(Task)) { if (ApplicationCommandsExtension.DebugEnabled) - ApplicationCommandsExtension.Logger.LogDebug("Missing first parameter with type ContextMenuContext or InteractionContext"); + ApplicationCommandsExtension.Logger + .LogDebug("Missing first parameter with type ContextMenuContext or InteractionContext"); return false; } diff --git a/DisCatSharp.ApplicationCommands/Attributes/ContextMenu/ContextMenuAttribute.cs b/DisCatSharp.ApplicationCommands/Attributes/ContextMenu/ContextMenuAttribute.cs index 36e5839de..b060a14fe 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/ContextMenu/ContextMenuAttribute.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/ContextMenu/ContextMenuAttribute.cs @@ -55,7 +55,11 @@ public sealed class ContextMenuAttribute : Attribute /// Whether the context menu is marked as NSFW. /// The allowed contexts of the context menu. /// The allowed integration types of the context menu. - public ContextMenuAttribute(ApplicationCommandType type, string name, bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, ApplicationCommandIntegrationTypes[]? integrationTypes = null) + public ContextMenuAttribute( + ApplicationCommandType type, string name, bool isNsfw = false, + ApplicationCommandContexts[]? allowedContexts = null, + ApplicationCommandIntegrationTypes[]? integrationTypes = null + ) { if (type == ApplicationCommandType.ChatInput) throw new ArgumentException("Context menus cannot be of type ChatInput (Slash)."); @@ -69,7 +73,6 @@ public ContextMenuAttribute(ApplicationCommandType type, string name, bool isNsf this.IntegrationTypes = integrationTypes?.ToList(); } - /// /// Marks this method as a context menu. /// @@ -79,7 +82,11 @@ public ContextMenuAttribute(ApplicationCommandType type, string name, bool isNsf /// Whether the context menu is marked as NSFW. /// The allowed contexts of the context menu. /// The allowed integration types of the context menu. - public ContextMenuAttribute(ApplicationCommandType type, string name, long defaultMemberPermissions, bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, ApplicationCommandIntegrationTypes[]? integrationTypes = null) + public ContextMenuAttribute( + ApplicationCommandType type, string name, long defaultMemberPermissions, + bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, + ApplicationCommandIntegrationTypes[]? integrationTypes = null + ) { if (type == ApplicationCommandType.ChatInput) throw new ArgumentException("Context menus cannot be of type ChatInput (Slash)."); @@ -93,7 +100,6 @@ public ContextMenuAttribute(ApplicationCommandType type, string name, long defau this.IntegrationTypes = integrationTypes?.ToList(); } - /// /// Marks this method as context menu. /// @@ -103,7 +109,11 @@ public ContextMenuAttribute(ApplicationCommandType type, string name, long defau /// Whether the context menu is marked as NSFW. /// The allowed contexts of the context menu. /// The allowed integration types of the context menu. - public ContextMenuAttribute(ApplicationCommandType type, string name, bool dmPermission, bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, ApplicationCommandIntegrationTypes[]? integrationTypes = null) + public ContextMenuAttribute( + ApplicationCommandType type, string name, bool dmPermission, bool isNsfw = false, + ApplicationCommandContexts[]? allowedContexts = null, + ApplicationCommandIntegrationTypes[]? integrationTypes = null + ) { if (type == ApplicationCommandType.ChatInput) throw new ArgumentException("Context menus cannot be of type ChatInput (Slash)."); @@ -127,7 +137,12 @@ public ContextMenuAttribute(ApplicationCommandType type, string name, bool dmPer /// Whether the context menu is marked as NSFW. /// The allowed contexts of the context menu. /// The allowed integration types of the context menu. - public ContextMenuAttribute(ApplicationCommandType type, string name, long defaultMemberPermissions, bool dmPermission, bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, ApplicationCommandIntegrationTypes[]? integrationTypes = null) + public ContextMenuAttribute( + ApplicationCommandType type, string name, long defaultMemberPermissions, + bool dmPermission, bool isNsfw = false, + ApplicationCommandContexts[]? allowedContexts = null, + ApplicationCommandIntegrationTypes[]? integrationTypes = null + ) { if (type == ApplicationCommandType.ChatInput) throw new ArgumentException("Context menus cannot be of type ChatInput (Slash)."); diff --git a/DisCatSharp.ApplicationCommands/Attributes/ContextMenu/ContextMenuCooldownAttribute.cs b/DisCatSharp.ApplicationCommands/Attributes/ContextMenu/ContextMenuCooldownAttribute.cs index 4a0dc8b16..894ee0ad6 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/ContextMenu/ContextMenuCooldownAttribute.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/ContextMenu/ContextMenuCooldownAttribute.cs @@ -12,7 +12,8 @@ namespace DisCatSharp.ApplicationCommands.Attributes; /// Defines a cooldown for this command. This allows you to define how many times can users execute a specific command /// [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] -public sealed class ContextMenuCooldownAttribute : ApplicationCommandCheckBaseAttribute, ICooldown +public sealed class ContextMenuCooldownAttribute : ApplicationCommandCheckBaseAttribute, + ICooldown { /// /// Gets the maximum number of uses before this command triggers a cooldown for its bucket. @@ -45,7 +46,7 @@ public ContextMenuCooldownAttribute(int maxUses, double resetAfter, CooldownBuck this.MaxUses = maxUses; this.Reset = TimeSpan.FromSeconds(resetAfter); this.BucketType = bucketType; - this.Buckets = new ConcurrentDictionary(); + this.Buckets = new(); } /// @@ -68,7 +69,11 @@ public ContextMenuCooldownBucket GetBucket(BaseContext ctx) public TimeSpan GetRemainingCooldown(BaseContext ctx) { var bucket = this.GetBucket(ctx); - return bucket == null ? TimeSpan.Zero : bucket.RemainingUses > 0 ? TimeSpan.Zero : bucket.ResetsAt - DateTimeOffset.UtcNow; + return bucket == null + ? TimeSpan.Zero + : bucket.RemainingUses > 0 + ? TimeSpan.Zero + : bucket.ResetsAt - DateTimeOffset.UtcNow; } /// @@ -108,7 +113,7 @@ public override async Task ExecuteChecksAsync(BaseContext ctx) var bid = this.GetBucketId(ctx, out var usr, out var chn, out var gld); if (!this.Buckets.TryGetValue(bid, out var bucket)) { - bucket = new ContextMenuCooldownBucket(this.MaxUses, this.Reset, usr, chn, gld); + bucket = new(this.MaxUses, this.Reset, usr, chn, gld); this.Buckets.AddOrUpdate(bid, bucket, (k, v) => bucket); } @@ -121,10 +126,12 @@ public override async Task ExecuteChecksAsync(BaseContext ctx) /// public sealed class ContextMenuCooldownBucket : CooldownBucket { - internal ContextMenuCooldownBucket(int maxUses, TimeSpan resetAfter, ulong userId = 0, ulong channelId = 0, ulong guildId = 0) + internal ContextMenuCooldownBucket( + int maxUses, TimeSpan resetAfter, ulong userId = 0, ulong channelId = 0, + ulong guildId = 0 + ) : base(maxUses, resetAfter, userId, channelId, guildId) - { - } + { } /// /// Returns a string representation of this command cooldown bucket. diff --git a/DisCatSharp.ApplicationCommands/Attributes/RequireOwnerAttribute.cs b/DisCatSharp.ApplicationCommands/Attributes/RequireOwnerAttribute.cs index 95708005e..acb1bf7de 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/RequireOwnerAttribute.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/RequireOwnerAttribute.cs @@ -10,7 +10,8 @@ namespace DisCatSharp.ApplicationCommands.Attributes; /// /// Defines that this application command is restricted to the owner of the bot. /// -[Deprecated("This is deprecated and will be remove in future in favor of RequireTeamXY"), AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)] +[Deprecated("This is deprecated and will be remove in future in favor of RequireTeamXY"), + AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)] public sealed class ApplicationCommandRequireOwnerAttribute : ApplicationCommandCheckBaseAttribute { /// @@ -28,6 +29,8 @@ public override Task ExecuteChecksAsync(BaseContext ctx) var app = ctx.Client.CurrentApplication!; var me = ctx.Client.CurrentUser!; - return app != null ? Task.FromResult(app.Members.Any(x => x.Id == ctx.User.Id)) : Task.FromResult(ctx.User.Id == me.Id); + return app != null + ? Task.FromResult(app.Members.Any(x => x.Id == ctx.User.Id)) + : Task.FromResult(ctx.User.Id == me.Id); } } diff --git a/DisCatSharp.ApplicationCommands/Attributes/RequireOwnerOrIdAttribute.cs b/DisCatSharp.ApplicationCommands/Attributes/RequireOwnerOrIdAttribute.cs index 475d41869..b48a88e83 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/RequireOwnerOrIdAttribute.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/RequireOwnerOrIdAttribute.cs @@ -12,7 +12,8 @@ namespace DisCatSharp.ApplicationCommands.Attributes; /// /// Requires ownership of the bot or a whitelisted id to execute this command. /// -[Deprecated("This is deprecated and will be remove in future in favor of RequireTeamXY"), AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)] +[Deprecated("This is deprecated and will be remove in future in favor of RequireTeamXY"), + AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)] public sealed class ApplicationCommandRequireOwnerOrIdAttribute : ApplicationCommandCheckBaseAttribute { /// @@ -39,7 +40,9 @@ public override Task ExecuteChecksAsync(BaseContext ctx) var app = ctx.Client.CurrentApplication!; var me = ctx.Client.CurrentUser!; - var owner = app != null ? Task.FromResult(app.Members.Any(x => x.Id == ctx.User.Id)) : Task.FromResult(ctx.User.Id == me.Id); + var owner = app != null + ? Task.FromResult(app.Members.Any(x => x.Id == ctx.User.Id)) + : Task.FromResult(ctx.User.Id == me.Id); var allowed = this.UserIds.Contains(ctx.User.Id); diff --git a/DisCatSharp.ApplicationCommands/Attributes/RequirePermissionsAttribute.cs b/DisCatSharp.ApplicationCommands/Attributes/RequirePermissionsAttribute.cs index 087bacf1c..ad300e6e1 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/RequirePermissionsAttribute.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/RequirePermissionsAttribute.cs @@ -44,11 +44,13 @@ public override async Task ExecuteChecksAsync(BaseContext ctx) var usr = ctx.Member; if (usr == null) return false; + var pusr = ctx.Channel.PermissionsFor(usr); var bot = await ctx.Guild.GetMemberAsync(ctx.Client.CurrentUser.Id).ConfigureAwait(false); if (bot == null) return false; + var pbot = ctx.Channel.PermissionsFor(bot); var usrok = ctx.Guild.OwnerId == usr.Id; diff --git a/DisCatSharp.ApplicationCommands/Attributes/RequireTeamDeveloper.cs b/DisCatSharp.ApplicationCommands/Attributes/RequireTeamDeveloper.cs index e7eb1327c..b7a4fd602 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/RequireTeamDeveloper.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/RequireTeamDeveloper.cs @@ -28,6 +28,8 @@ public override Task ExecuteChecksAsync(BaseContext ctx) return Task.FromResult(app.Owner.Id == ctx.User.Id); var teamMember = app.Team?.Members.FirstOrDefault(x => x.User.Id == ctx.User.Id); - return teamMember == null ? Task.FromResult(false) : Task.FromResult(teamMember.Role is "developer" or "admin" or "owner"); + return teamMember == null + ? Task.FromResult(false) + : Task.FromResult(teamMember.Role is "developer" or "admin" or "owner"); } } diff --git a/DisCatSharp.ApplicationCommands/Attributes/RequireTeamMember.cs b/DisCatSharp.ApplicationCommands/Attributes/RequireTeamMember.cs index 028bf10a5..83cf396ac 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/RequireTeamMember.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/RequireTeamMember.cs @@ -24,6 +24,8 @@ public ApplicationCommandRequireTeamMemberAttribute() public override Task ExecuteChecksAsync(BaseContext ctx) { var app = ctx.Client.CurrentApplication!; - return app.Team is null ? Task.FromResult(app.Owner.Id == ctx.User.Id) : Task.FromResult(app.Members.Any(x => x.Id == ctx.User.Id)); + return app.Team is null + ? Task.FromResult(app.Owner.Id == ctx.User.Id) + : Task.FromResult(app.Members.Any(x => x.Id == ctx.User.Id)); } } diff --git a/DisCatSharp.ApplicationCommands/Attributes/RequireTeamReadOnly.cs b/DisCatSharp.ApplicationCommands/Attributes/RequireTeamReadOnly.cs index 6d6f5abf7..6b8cc3041 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/RequireTeamReadOnly.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/RequireTeamReadOnly.cs @@ -28,6 +28,8 @@ public override Task ExecuteChecksAsync(BaseContext ctx) return Task.FromResult(app.Owner.Id == ctx.User.Id); var teamMember = app.Team?.Members.FirstOrDefault(x => x.User.Id == ctx.User.Id); - return teamMember == null ? Task.FromResult(false) : Task.FromResult(teamMember.Role is "read-only" or "developer" or "admin" or "owner"); + return teamMember == null + ? Task.FromResult(false) + : Task.FromResult(teamMember.Role is "read-only" or "developer" or "admin" or "owner"); } } diff --git a/DisCatSharp.ApplicationCommands/Attributes/RequireUserPermissionsAttribute.cs b/DisCatSharp.ApplicationCommands/Attributes/RequireUserPermissionsAttribute.cs index ce957e189..21a981763 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/RequireUserPermissionsAttribute.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/RequireUserPermissionsAttribute.cs @@ -52,6 +52,8 @@ public override Task ExecuteChecksAsync(BaseContext ctx) return (pusr & Permissions.Administrator) != 0 ? Task.FromResult(true) - : (pusr & this.Permissions) == this.Permissions ? Task.FromResult(true) : Task.FromResult(false); + : (pusr & this.Permissions) == this.Permissions + ? Task.FromResult(true) + : Task.FromResult(false); } } diff --git a/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/ChoiceProviderAttribute.cs b/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/ChoiceProviderAttribute.cs index ef8ef6445..6188635fe 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/ChoiceProviderAttribute.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/ChoiceProviderAttribute.cs @@ -9,7 +9,6 @@ namespace DisCatSharp.ApplicationCommands.Attributes; [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = true)] public class ChoiceProviderAttribute : Attribute { - /// /// The type of the provider. /// diff --git a/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/MinimumMaximumAttribute.cs b/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/MinimumMaximumAttribute.cs index a2930874c..654c53abb 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/MinimumMaximumAttribute.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/MinimumMaximumAttribute.cs @@ -74,7 +74,6 @@ public MaximumValueAttribute(double value) } } - /// /// Sets a minimum value for this slash command option. Only valid for parameters. /// @@ -93,6 +92,7 @@ public MinimumLengthAttribute(int value) { if (value > 600) throw new ArgumentException("Minimum cannot be more than 6000."); + this.Value = value; } } @@ -115,6 +115,7 @@ public MaximumLengthAttribute(int value) { if (value == 0 || value > 600) throw new ArgumentException("Maximum length cannot be less than 1 and cannot be more than 6000."); + this.Value = value; } } diff --git a/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/SlashCommandAttribute.cs b/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/SlashCommandAttribute.cs index 7dec292a2..c126dd7ef 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/SlashCommandAttribute.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/SlashCommandAttribute.cs @@ -55,7 +55,11 @@ public class SlashCommandAttribute : Attribute /// Whether this command is marked as NSFW. /// The allowed contexts of this slash command. /// The allowed integration types. - public SlashCommandAttribute(string name, string description, bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, ApplicationCommandIntegrationTypes[]? integrationTypes = null) + public SlashCommandAttribute( + string name, string description, bool isNsfw = false, + ApplicationCommandContexts[]? allowedContexts = null, + ApplicationCommandIntegrationTypes[]? integrationTypes = null + ) { this.Name = name.ToLower(); this.Description = description; @@ -75,7 +79,11 @@ public SlashCommandAttribute(string name, string description, bool isNsfw = fals /// Whether this command is marked as NSFW. /// The allowed contexts of this slash command. /// The allowed integration types. - public SlashCommandAttribute(string name, string description, long defaultMemberPermissions, bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, ApplicationCommandIntegrationTypes[]? integrationTypes = null) + public SlashCommandAttribute( + string name, string description, long defaultMemberPermissions, bool isNsfw = false, + ApplicationCommandContexts[]? allowedContexts = null, + ApplicationCommandIntegrationTypes[]? integrationTypes = null + ) { this.Name = name.ToLower(); this.Description = description; @@ -95,7 +103,11 @@ public SlashCommandAttribute(string name, string description, long defaultMember /// Whether this command is marked as NSFW. /// The allowed contexts of this slash command. /// The allowed integration types. - public SlashCommandAttribute(string name, string description, bool dmPermission, bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, ApplicationCommandIntegrationTypes[]? integrationTypes = null) + public SlashCommandAttribute( + string name, string description, bool dmPermission, bool isNsfw = false, + ApplicationCommandContexts[]? allowedContexts = null, + ApplicationCommandIntegrationTypes[]? integrationTypes = null + ) { this.Name = name.ToLower(); this.Description = description; @@ -116,7 +128,11 @@ public SlashCommandAttribute(string name, string description, bool dmPermission, /// Whether this command is marked as NSFW. /// The allowed contexts of this slash command. /// The allowed integration types. - public SlashCommandAttribute(string name, string description, long defaultMemberPermissions, bool dmPermission, bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, ApplicationCommandIntegrationTypes[]? integrationTypes = null) + public SlashCommandAttribute( + string name, string description, long defaultMemberPermissions, bool dmPermission, + bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, + ApplicationCommandIntegrationTypes[]? integrationTypes = null + ) { this.Name = name.ToLower(); this.Description = description; diff --git a/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/SlashCommandCooldownAttribute.cs b/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/SlashCommandCooldownAttribute.cs index 90d97af6b..1669ba81d 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/SlashCommandCooldownAttribute.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/SlashCommandCooldownAttribute.cs @@ -12,7 +12,8 @@ namespace DisCatSharp.ApplicationCommands.Attributes; /// Defines a cooldown for this command. This allows you to define how many times can users execute a specific command /// [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] -public sealed class SlashCommandCooldownAttribute : ApplicationCommandCheckBaseAttribute, ICooldown +public sealed class SlashCommandCooldownAttribute : ApplicationCommandCheckBaseAttribute, + ICooldown { /// /// Gets the maximum number of uses before this command triggers a cooldown for its bucket. @@ -45,7 +46,7 @@ public SlashCommandCooldownAttribute(int maxUses, double resetAfter, CooldownBuc this.MaxUses = maxUses; this.Reset = TimeSpan.FromSeconds(resetAfter); this.BucketType = bucketType; - this.Buckets = new ConcurrentDictionary(); + this.Buckets = new(); } /// @@ -68,7 +69,11 @@ public SlashCommandCooldownBucket GetBucket(BaseContext ctx) public TimeSpan GetRemainingCooldown(BaseContext ctx) { var bucket = this.GetBucket(ctx); - return bucket == null ? TimeSpan.Zero : bucket.RemainingUses > 0 ? TimeSpan.Zero : bucket.ResetsAt - DateTimeOffset.UtcNow; + return bucket == null + ? TimeSpan.Zero + : bucket.RemainingUses > 0 + ? TimeSpan.Zero + : bucket.ResetsAt - DateTimeOffset.UtcNow; } /// @@ -108,7 +113,7 @@ public override async Task ExecuteChecksAsync(BaseContext ctx) var bid = this.GetBucketId(ctx, out var usr, out var chn, out var gld); if (!this.Buckets.TryGetValue(bid, out var bucket)) { - bucket = new SlashCommandCooldownBucket(this.MaxUses, this.Reset, usr, chn, gld); + bucket = new(this.MaxUses, this.Reset, usr, chn, gld); this.Buckets.AddOrUpdate(bid, bucket, (k, v) => bucket); } @@ -127,9 +132,10 @@ public sealed class SlashCommandCooldownBucket : CooldownBucket /// String representation of this command cooldown bucket. public override string ToString() => $"Slash Command bucket {this.BucketId}"; - internal SlashCommandCooldownBucket(int maxUses, TimeSpan resetAfter, ulong userId = 0, ulong channelId = 0, ulong guildId = 0) + internal SlashCommandCooldownBucket( + int maxUses, TimeSpan resetAfter, ulong userId = 0, ulong channelId = 0, + ulong guildId = 0 + ) : base(maxUses, resetAfter, userId, channelId, guildId) - { - - } + { } } diff --git a/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/SlashCommandGroupAttribute.cs b/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/SlashCommandGroupAttribute.cs index c0ac7557c..b3282d222 100644 --- a/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/SlashCommandGroupAttribute.cs +++ b/DisCatSharp.ApplicationCommands/Attributes/SlashCommand/SlashCommandGroupAttribute.cs @@ -55,7 +55,11 @@ public class SlashCommandGroupAttribute : Attribute /// Whether the slash command group is marked as NSFW. /// The allowed contexts of the slash command group. /// The allowed integration types of the slash command group. - public SlashCommandGroupAttribute(string name, string description, bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, ApplicationCommandIntegrationTypes[]? integrationTypes = null) + public SlashCommandGroupAttribute( + string name, string description, bool isNsfw = false, + ApplicationCommandContexts[]? allowedContexts = null, + ApplicationCommandIntegrationTypes[]? integrationTypes = null + ) { this.Name = name.ToLower(); this.Description = description; @@ -75,7 +79,11 @@ public SlashCommandGroupAttribute(string name, string description, bool isNsfw = /// Whether the slash command group is marked as NSFW. /// The allowed contexts of the slash command group. /// The allowed integration types of the slash command group. - public SlashCommandGroupAttribute(string name, string description, long defaultMemberPermissions, bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, ApplicationCommandIntegrationTypes[]? integrationTypes = null) + public SlashCommandGroupAttribute( + string name, string description, long defaultMemberPermissions, + bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, + ApplicationCommandIntegrationTypes[]? integrationTypes = null + ) { this.Name = name.ToLower(); this.Description = description; @@ -95,7 +103,11 @@ public SlashCommandGroupAttribute(string name, string description, long defaultM /// Whether the slash command group is marked as NSFW. /// The allowed contexts of the slash command group. /// The allowed integration types of the slash command group. - public SlashCommandGroupAttribute(string name, string description, bool dmPermission, bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, ApplicationCommandIntegrationTypes[]? integrationTypes = null) + public SlashCommandGroupAttribute( + string name, string description, bool dmPermission, bool isNsfw = false, + ApplicationCommandContexts[]? allowedContexts = null, + ApplicationCommandIntegrationTypes[]? integrationTypes = null + ) { this.Name = name.ToLower(); this.Description = description; @@ -116,7 +128,11 @@ public SlashCommandGroupAttribute(string name, string description, bool dmPermis /// Whether the slash command group is marked as NSFW. /// The allowed contexts of the slash command group. /// The allowed integration types of the slash command group. - public SlashCommandGroupAttribute(string name, string description, long defaultMemberPermissions, bool dmPermission, bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, ApplicationCommandIntegrationTypes[]? integrationTypes = null) + public SlashCommandGroupAttribute( + string name, string description, long defaultMemberPermissions, bool dmPermission, + bool isNsfw = false, ApplicationCommandContexts[]? allowedContexts = null, + ApplicationCommandIntegrationTypes[]? integrationTypes = null + ) { this.Name = name.ToLower(); this.Description = description; diff --git a/DisCatSharp.ApplicationCommands/Checks/ApplicationCommandEqualityChecks.cs b/DisCatSharp.ApplicationCommands/Checks/ApplicationCommandEqualityChecks.cs index f8310b6cf..8662c85bd 100644 --- a/DisCatSharp.ApplicationCommands/Checks/ApplicationCommandEqualityChecks.cs +++ b/DisCatSharp.ApplicationCommands/Checks/ApplicationCommandEqualityChecks.cs @@ -156,14 +156,14 @@ internal static bool NullableSequenceEqual(this List? source, List? tar /// The source dictionary. /// The target dictionary. /// Whether both dictionaries are equal. - internal static bool AreDictionariesEqual(this Dictionary sourceDictionary, Dictionary targetDictionary) + internal static bool AreDictionariesEqual(this Dictionary? sourceDictionary, Dictionary? targetDictionary) { - if (sourceDictionary?.Count != targetDictionary?.Count) - return false; - if (sourceDictionary is null && targetDictionary is null) return true; + if (sourceDictionary?.Count != targetDictionary?.Count) + return false; + foreach (var kvp in sourceDictionary) if (!targetDictionary.TryGetValue(kvp.Key, out var value) || value != kvp.Value) return false; diff --git a/DisCatSharp.ApplicationCommands/Context/AutocompleteContext.cs b/DisCatSharp.ApplicationCommands/Context/AutocompleteContext.cs index 8ffd927e9..30bbc13ca 100644 --- a/DisCatSharp.ApplicationCommands/Context/AutocompleteContext.cs +++ b/DisCatSharp.ApplicationCommands/Context/AutocompleteContext.cs @@ -27,7 +27,7 @@ public class AutocompleteContext /// /// Gets the guild this interaction was executed in. /// - public DiscordGuild Guild { get; internal set; } + public DiscordGuild? Guild { get; internal set; } /// /// Gets the channel this interaction was executed in. @@ -42,7 +42,7 @@ public class AutocompleteContext /// /// Gets the member which executed this interaction, or null if the command is in a DM. /// - public DiscordMember Member + public DiscordMember? Member => this.User is DiscordMember member ? member : null; /// @@ -91,7 +91,7 @@ public DiscordMember Member /// /// The options already provided. /// - public IReadOnlyList Options { get; internal set; } + public IReadOnlyList? Options { get; internal set; } /// /// The option to autocomplete. diff --git a/DisCatSharp.ApplicationCommands/Context/BaseContext.cs b/DisCatSharp.ApplicationCommands/Context/BaseContext.cs index 6ce9af899..8bb2200c6 100644 --- a/DisCatSharp.ApplicationCommands/Context/BaseContext.cs +++ b/DisCatSharp.ApplicationCommands/Context/BaseContext.cs @@ -28,7 +28,7 @@ public class BaseContext /// /// Gets the guild this interaction was executed in. /// - public DiscordGuild Guild { get; internal set; } + public DiscordGuild? Guild { get; internal set; } /// /// Gets the channel this interaction was executed in. @@ -43,7 +43,7 @@ public class BaseContext /// /// Gets the member which executed this interaction, or null if the command is in a DM. /// - public DiscordMember Member + public DiscordMember? Member => this.User is DiscordMember member ? member : null; /// @@ -90,7 +90,7 @@ public string FullCommandName /// /// Gets the guild locale if applicable. /// - public string GuildLocale { get; internal set; } + public string? GuildLocale { get; internal set; } /// /// Gets the applications permissions. @@ -140,7 +140,9 @@ public Task CreateResponseAsync(InteractionResponseType type, DiscordInteraction /// /// The data to send. public Task CreateModalResponseAsync(DiscordInteractionModalBuilder builder) - => this.Interaction.Type != InteractionType.Ping && this.Interaction.Type != InteractionType.ModalSubmit ? this.Interaction.CreateInteractionModalResponseAsync(builder) : throw new NotSupportedException("You can't respond to a PING with a modal."); + => this.Interaction.Type != InteractionType.Ping && this.Interaction.Type != InteractionType.ModalSubmit + ? this.Interaction.CreateInteractionModalResponseAsync(builder) + : throw new NotSupportedException("You can't respond to a PING with a modal."); /// /// Creates an iframe response to this interaction. @@ -149,8 +151,14 @@ public Task CreateModalResponseAsync(DiscordInteractionModalBuilder builder) /// The title of the iframe. /// The size of the iframe. /// The path of the iframe. - public Task CreateInteractionIframeResponseAsync(string customId, string title, IframeModalSize modalSize = IframeModalSize.Normal, string? iFramePath = null) - => this.Interaction.Type != InteractionType.Ping ? this.Interaction.CreateInteractionIframeResponseAsync(customId, title, modalSize, iFramePath) : throw new NotSupportedException("You can't respond to a PING with an iframe."); + public Task CreateInteractionIframeResponseAsync( + string customId, string title, + IframeModalSize modalSize = IframeModalSize.Normal, + string? iFramePath = null + ) + => this.Interaction.Type != InteractionType.Ping + ? this.Interaction.CreateInteractionIframeResponseAsync(customId, title, modalSize, iFramePath) + : throw new NotSupportedException("You can't respond to a PING with an iframe."); /// /// Edits the interaction response. @@ -221,5 +229,5 @@ public Task GetFollowupMessageAsync(ulong followupMessageId) /// /// The original interaction response. public Task GetOriginalResponseAsync() - => this.Interaction.GetOriginalResponseAsync(); + => this.Interaction.GetOriginalResponseAsync(); } diff --git a/DisCatSharp.ApplicationCommands/Context/InteractionContext.cs b/DisCatSharp.ApplicationCommands/Context/InteractionContext.cs index a4cb79b11..270801478 100644 --- a/DisCatSharp.ApplicationCommands/Context/InteractionContext.cs +++ b/DisCatSharp.ApplicationCommands/Context/InteractionContext.cs @@ -12,20 +12,20 @@ public sealed class InteractionContext : BaseContext /// /// Gets the users mentioned in the command parameters. /// - public IReadOnlyList ResolvedUserMentions { get; internal set; } + public IReadOnlyList? ResolvedUserMentions { get; internal set; } /// /// Gets the roles mentioned in the command parameters. /// - public IReadOnlyList ResolvedRoleMentions { get; internal set; } + public IReadOnlyList? ResolvedRoleMentions { get; internal set; } /// /// Gets the channels mentioned in the command parameters. /// - public IReadOnlyList ResolvedChannelMentions { get; internal set; } + public IReadOnlyList? ResolvedChannelMentions { get; internal set; } /// /// Gets the attachments in the command parameters, if applicable. /// - public IReadOnlyList ResolvedAttachments { get; internal set; } + public IReadOnlyList? ResolvedAttachments { get; internal set; } } diff --git a/DisCatSharp.ApplicationCommands/Entities/ChoiceTranslator.cs b/DisCatSharp.ApplicationCommands/Entities/ChoiceTranslator.cs index d1a898aa5..b948b100b 100644 --- a/DisCatSharp.ApplicationCommands/Entities/ChoiceTranslator.cs +++ b/DisCatSharp.ApplicationCommands/Entities/ChoiceTranslator.cs @@ -22,6 +22,7 @@ internal class ChoiceTranslator /// [JsonProperty("name_translations")] internal Dictionary NameTranslationsDictionary { get; set; } + [JsonIgnore] public DiscordApplicationCommandLocalization NameTranslations => new(this.NameTranslationsDictionary); diff --git a/DisCatSharp.ApplicationCommands/Entities/CommandTranslator.cs b/DisCatSharp.ApplicationCommands/Entities/CommandTranslator.cs index 70efcf982..7684cc901 100644 --- a/DisCatSharp.ApplicationCommands/Entities/CommandTranslator.cs +++ b/DisCatSharp.ApplicationCommands/Entities/CommandTranslator.cs @@ -36,6 +36,7 @@ internal class CommandTranslator /// [JsonProperty("name_translations")] internal Dictionary NameTranslationDictionary { get; set; } + [JsonIgnore] public DiscordApplicationCommandLocalization NameTranslations => new(this.NameTranslationDictionary); @@ -45,6 +46,7 @@ public DiscordApplicationCommandLocalization NameTranslations /// [JsonProperty("description_translations")] internal Dictionary DescriptionTranslationDictionary { get; set; } + [JsonIgnore] public DiscordApplicationCommandLocalization DescriptionTranslations => new(this.DescriptionTranslationDictionary); diff --git a/DisCatSharp.ApplicationCommands/Entities/CooldownBucket.cs b/DisCatSharp.ApplicationCommands/Entities/CooldownBucket.cs index 65796d388..2b6c19022 100644 --- a/DisCatSharp.ApplicationCommands/Entities/CooldownBucket.cs +++ b/DisCatSharp.ApplicationCommands/Entities/CooldownBucket.cs @@ -101,6 +101,7 @@ internal async Task DecrementUseAsync() Interlocked.Decrement(ref this.RemainingUsesInternal); success = true; } + Console.WriteLine($"[DecrementUseAsync]: Remaining: {this.RemainingUses}/{this.MaxUses} Resets: {this.ResetsAt} Now: {DateTimeOffset.UtcNow} Vars[u,c,g]: {this.UserId} {this.ChannelId} {this.GuildId} Id: {this.BucketId}"); // ...otherwise just fail this.UsageSemaphore.Release(); @@ -119,7 +120,10 @@ internal async Task DecrementUseAsync() /// /// to compare to. /// Whether the is equal to this . - public bool Equals(CooldownBucket other) => other is not null && (ReferenceEquals(this, other) || (this.UserId == other.UserId && this.ChannelId == other.ChannelId && this.GuildId == other.GuildId)); + public bool Equals(CooldownBucket other) => other is not null && + (ReferenceEquals(this, other) || + (this.UserId == other.UserId && this.ChannelId == other.ChannelId && + this.GuildId == other.GuildId)); /// /// Gets the hash code for this . @@ -159,6 +163,4 @@ internal async Task DecrementUseAsync() /// Generated bucket ID. public static string MakeId(ulong userId = 0, ulong channelId = 0, ulong guildId = 0) => $"{userId.ToString(CultureInfo.InvariantCulture)}:{channelId.ToString(CultureInfo.InvariantCulture)}:{guildId.ToString(CultureInfo.InvariantCulture)}"; - - } diff --git a/DisCatSharp.ApplicationCommands/Entities/FakeApplicationCommandObjects.cs b/DisCatSharp.ApplicationCommands/Entities/FakeApplicationCommandObjects.cs index 6ce82aac3..9ecec844e 100644 --- a/DisCatSharp.ApplicationCommands/Entities/FakeApplicationCommandObjects.cs +++ b/DisCatSharp.ApplicationCommands/Entities/FakeApplicationCommandObjects.cs @@ -12,7 +12,10 @@ internal class CommandGroupWithSubGroups : BaseCommand [JsonProperty("groups")] internal List SubGroups { get; set; } - internal CommandGroupWithSubGroups(string name, string description, List commands, ApplicationCommandType type) + internal CommandGroupWithSubGroups( + string name, string description, List commands, + ApplicationCommandType type + ) : base(name, description, type) { this.SubGroups = commands; @@ -36,7 +39,10 @@ internal class Command : BaseCommand [JsonProperty("options")] internal List Options { get; set; } - internal Command(string name, string? description = null, List options = null, ApplicationCommandType? type = null) + internal Command( + string name, string? description = null, List options = null, + ApplicationCommandType? type = null + ) : base(name, description, type) { this.Options = options; diff --git a/DisCatSharp.ApplicationCommands/Entities/GroupTranslator.cs b/DisCatSharp.ApplicationCommands/Entities/GroupTranslator.cs index 4b634ca9d..617483cbb 100644 --- a/DisCatSharp.ApplicationCommands/Entities/GroupTranslator.cs +++ b/DisCatSharp.ApplicationCommands/Entities/GroupTranslator.cs @@ -36,6 +36,7 @@ internal class GroupTranslator /// [JsonProperty("name_translations")] internal Dictionary NameTranslationsDictionary { get; set; } + [JsonIgnore] public DiscordApplicationCommandLocalization NameTranslations => new(this.NameTranslationsDictionary); @@ -45,6 +46,7 @@ public DiscordApplicationCommandLocalization NameTranslations /// [JsonProperty("description_translations")] internal Dictionary DescriptionTranslationsDictionary { get; set; } + [JsonIgnore] public DiscordApplicationCommandLocalization DescriptionTranslations => new(this.DescriptionTranslationsDictionary); diff --git a/DisCatSharp.ApplicationCommands/Entities/OptionTranslator.cs b/DisCatSharp.ApplicationCommands/Entities/OptionTranslator.cs index 67f1cb39d..907824724 100644 --- a/DisCatSharp.ApplicationCommands/Entities/OptionTranslator.cs +++ b/DisCatSharp.ApplicationCommands/Entities/OptionTranslator.cs @@ -28,6 +28,7 @@ internal class OptionTranslator /// [JsonProperty("name_translations")] internal Dictionary NameTranslationsDictionary { get; set; } + [JsonIgnore] public DiscordApplicationCommandLocalization NameTranslations => new(this.NameTranslationsDictionary); @@ -37,6 +38,7 @@ public DiscordApplicationCommandLocalization NameTranslations /// [JsonProperty("description_translations")] internal Dictionary DescriptionTranslationsDictionary { get; set; } + [JsonIgnore] public DiscordApplicationCommandLocalization DescriptionTranslations => new(this.DescriptionTranslationsDictionary); diff --git a/DisCatSharp.ApplicationCommands/Entities/RegisteredDiscordApplicationCommand.cs b/DisCatSharp.ApplicationCommands/Entities/RegisteredDiscordApplicationCommand.cs index 17091f5a9..7f869c2c2 100644 --- a/DisCatSharp.ApplicationCommands/Entities/RegisteredDiscordApplicationCommand.cs +++ b/DisCatSharp.ApplicationCommands/Entities/RegisteredDiscordApplicationCommand.cs @@ -4,7 +4,6 @@ using System.Reflection; using DisCatSharp.Entities; -using DisCatSharp.Enums; using Microsoft.Extensions.Logging; @@ -18,7 +17,8 @@ public sealed class RegisteredDiscordApplicationCommand : DiscordApplicationComm /// /// Creates a new empty registered discord application command. /// - internal RegisteredDiscordApplicationCommand() { } + internal RegisteredDiscordApplicationCommand() + { } /// /// Creates a new registered discord application command to control a dildo. (Lala told me to leave it) @@ -43,32 +43,37 @@ internal RegisteredDiscordApplicationCommand(DiscordApplicationCommand parent) this.UnknownProperties = parent.UnknownProperties; this.Version = parent.Version; - - try { if (ApplicationCommandsExtension.CommandMethods.Any(x => x.CommandId == this.Id)) { - this.CommandMethod = ApplicationCommandsExtension.CommandMethods.First(x => x.CommandId == this.Id).Method; + this.CommandMethod = ApplicationCommandsExtension.CommandMethods.First(x => x.CommandId == this.Id) + .Method; this.ContainingType = this.CommandMethod.DeclaringType; - this.CustomAttributes = this.CommandMethod.GetCustomAttributes().Where(x => !x.GetType().Namespace.StartsWith("DisCatSharp")).ToList(); + this.CustomAttributes = this.CommandMethod.GetCustomAttributes() + .Where(x => !x.GetType().Namespace.StartsWith("DisCatSharp")).ToList(); } else if (ApplicationCommandsExtension.ContextMenuCommands.Any(x => x.CommandId == this.Id)) { - this.CommandMethod = ApplicationCommandsExtension.ContextMenuCommands.First(x => x.CommandId == this.Id).Method; + this.CommandMethod = ApplicationCommandsExtension.ContextMenuCommands.First(x => x.CommandId == this.Id) + .Method; this.ContainingType = this.CommandMethod.DeclaringType; - this.CustomAttributes = this.CommandMethod.GetCustomAttributes().Where(x => !x.GetType().Namespace.StartsWith("DisCatSharp")).ToList(); + this.CustomAttributes = this.CommandMethod.GetCustomAttributes() + .Where(x => !x.GetType().Namespace.StartsWith("DisCatSharp")).ToList(); } else if (ApplicationCommandsExtension.GroupCommands.Any(x => x.CommandId == this.Id)) { - this.CommandType = ApplicationCommandsExtension.GroupCommands.First(x => x.CommandId == this.Id).Methods.First().Value.DeclaringType; + this.CommandType = ApplicationCommandsExtension.GroupCommands.First(x => x.CommandId == this.Id).Methods + .First().Value.DeclaringType; this.ContainingType = this.CommandType.DeclaringType; - this.CustomAttributes = this.CommandType.GetCustomAttributes().Where(x => !x.GetType().Namespace.StartsWith("DisCatSharp")).ToList(); + this.CustomAttributes = this.CommandType.GetCustomAttributes() + .Where(x => !x.GetType().Namespace.StartsWith("DisCatSharp")).ToList(); } } catch (Exception) { - ApplicationCommandsExtension.Logger.LogError("Failed to generate reflection properties for '{cmd}'", parent.Name); + ApplicationCommandsExtension.Logger.LogError("Failed to generate reflection properties for '{cmd}'", + parent.Name); } } @@ -78,14 +83,12 @@ internal RegisteredDiscordApplicationCommand(DiscordApplicationCommand parent) /// public MethodInfo? CommandMethod { get; internal set; } - /// /// The type that contains the sub commands of this command. /// if command is not a group command or reflection failed. /// public Type? CommandType { get; internal set; } - /// /// The type this command is contained in. /// if reflection failed. diff --git a/DisCatSharp.ApplicationCommands/Entities/SubGroupTranslator.cs b/DisCatSharp.ApplicationCommands/Entities/SubGroupTranslator.cs index c8a021782..cdf445713 100644 --- a/DisCatSharp.ApplicationCommands/Entities/SubGroupTranslator.cs +++ b/DisCatSharp.ApplicationCommands/Entities/SubGroupTranslator.cs @@ -28,6 +28,7 @@ internal class SubGroupTranslator /// [JsonProperty("name_translations")] internal Dictionary NameTranslationsDictionary { get; set; } + [JsonIgnore] public DiscordApplicationCommandLocalization NameTranslations => new(this.NameTranslationsDictionary); @@ -37,6 +38,7 @@ public DiscordApplicationCommandLocalization NameTranslations /// [JsonProperty("description_translations")] internal Dictionary DescriptionTranslationsDictionary { get; set; } + [JsonIgnore] public DiscordApplicationCommandLocalization DescriptionTranslations => new(this.DescriptionTranslationsDictionary); diff --git a/DisCatSharp.ApplicationCommands/Enums/ApplicationCommandFinalType.cs b/DisCatSharp.ApplicationCommands/Enums/ApplicationCommandFinalType.cs index 7d74f50be..d7ddaef74 100644 --- a/DisCatSharp.ApplicationCommands/Enums/ApplicationCommandFinalType.cs +++ b/DisCatSharp.ApplicationCommands/Enums/ApplicationCommandFinalType.cs @@ -1,4 +1,3 @@ - namespace DisCatSharp.ApplicationCommands.Enums; internal enum ApplicationCommandFinalType diff --git a/DisCatSharp.ApplicationCommands/Enums/ApplicationCommandModuleLifespan.cs b/DisCatSharp.ApplicationCommands/Enums/ApplicationCommandModuleLifespan.cs index 8120f8009..b00d3f462 100644 --- a/DisCatSharp.ApplicationCommands/Enums/ApplicationCommandModuleLifespan.cs +++ b/DisCatSharp.ApplicationCommands/Enums/ApplicationCommandModuleLifespan.cs @@ -1,4 +1,3 @@ - namespace DisCatSharp.ApplicationCommands.Enums; /// diff --git a/DisCatSharp.ApplicationCommands/Enums/CooldownBucketType.cs b/DisCatSharp.ApplicationCommands/Enums/CooldownBucketType.cs index 38956db7c..fb0a269dd 100644 --- a/DisCatSharp.ApplicationCommands/Enums/CooldownBucketType.cs +++ b/DisCatSharp.ApplicationCommands/Enums/CooldownBucketType.cs @@ -1,4 +1,3 @@ - namespace DisCatSharp.ApplicationCommands.Enums; /// @@ -6,7 +5,6 @@ namespace DisCatSharp.ApplicationCommands.Enums; /// public enum CooldownBucketType : int { - /// /// Denotes that the command will have its cooldown applied globally. /// diff --git a/DisCatSharp.ApplicationCommands/EventArgs/ContextMenu/ContextMenuErrorEventArgs.cs b/DisCatSharp.ApplicationCommands/EventArgs/ContextMenu/ContextMenuErrorEventArgs.cs index 4292bd94a..3143c695d 100644 --- a/DisCatSharp.ApplicationCommands/EventArgs/ContextMenu/ContextMenuErrorEventArgs.cs +++ b/DisCatSharp.ApplicationCommands/EventArgs/ContextMenu/ContextMenuErrorEventArgs.cs @@ -24,6 +24,7 @@ public class ContextMenuErrorEventArgs : DiscordEventArgs /// Initializes a new instance of the class. /// /// The provider. - public ContextMenuErrorEventArgs(IServiceProvider provider) : base(provider) + public ContextMenuErrorEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp.ApplicationCommands/EventArgs/ContextMenu/ContextMenuExecutedEventArgs.cs b/DisCatSharp.ApplicationCommands/EventArgs/ContextMenu/ContextMenuExecutedEventArgs.cs index 18083ffd1..99ee11bb7 100644 --- a/DisCatSharp.ApplicationCommands/EventArgs/ContextMenu/ContextMenuExecutedEventArgs.cs +++ b/DisCatSharp.ApplicationCommands/EventArgs/ContextMenu/ContextMenuExecutedEventArgs.cs @@ -19,6 +19,7 @@ public sealed class ContextMenuExecutedEventArgs : DiscordEventArgs /// Initializes a new instance of the class. /// /// The provider. - public ContextMenuExecutedEventArgs(IServiceProvider provider) : base(provider) + public ContextMenuExecutedEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp.ApplicationCommands/EventArgs/Module/ApplicationCommandsModuleReadyEventArgs.cs b/DisCatSharp.ApplicationCommands/EventArgs/Module/ApplicationCommandsModuleReadyEventArgs.cs index c3afaec02..95ce13aeb 100644 --- a/DisCatSharp.ApplicationCommands/EventArgs/Module/ApplicationCommandsModuleReadyEventArgs.cs +++ b/DisCatSharp.ApplicationCommands/EventArgs/Module/ApplicationCommandsModuleReadyEventArgs.cs @@ -19,6 +19,7 @@ public class ApplicationCommandsModuleReadyEventArgs : DiscordEventArgs /// Initializes a new instance of the class. /// /// The provider. - internal ApplicationCommandsModuleReadyEventArgs(IServiceProvider provider) : base(provider) + internal ApplicationCommandsModuleReadyEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp.ApplicationCommands/EventArgs/Module/ApplicationCommandsModuleStartupFinishedEventArgs.cs b/DisCatSharp.ApplicationCommands/EventArgs/Module/ApplicationCommandsModuleStartupFinishedEventArgs.cs index 14e24784a..47c392308 100644 --- a/DisCatSharp.ApplicationCommands/EventArgs/Module/ApplicationCommandsModuleStartupFinishedEventArgs.cs +++ b/DisCatSharp.ApplicationCommands/EventArgs/Module/ApplicationCommandsModuleStartupFinishedEventArgs.cs @@ -30,6 +30,7 @@ public class ApplicationCommandsModuleStartupFinishedEventArgs : DiscordEventArg /// Initializes a new instance of the class. /// /// The provider. - internal ApplicationCommandsModuleStartupFinishedEventArgs(IServiceProvider provider) : base(provider) + internal ApplicationCommandsModuleStartupFinishedEventArgs(IServiceProvider? provider) + : base(provider) { } } diff --git a/DisCatSharp.ApplicationCommands/EventArgs/Module/GlobalApplicationCommandsRegisteredEventArgs.cs b/DisCatSharp.ApplicationCommands/EventArgs/Module/GlobalApplicationCommandsRegisteredEventArgs.cs index 3fbccbd55..f8378194c 100644 --- a/DisCatSharp.ApplicationCommands/EventArgs/Module/GlobalApplicationCommandsRegisteredEventArgs.cs +++ b/DisCatSharp.ApplicationCommands/EventArgs/Module/GlobalApplicationCommandsRegisteredEventArgs.cs @@ -20,6 +20,7 @@ public class GlobalApplicationCommandsRegisteredEventArgs : DiscordEventArgs /// Initializes a new instance of the class. /// /// The provider. - internal GlobalApplicationCommandsRegisteredEventArgs(IServiceProvider provider) : base(provider) + internal GlobalApplicationCommandsRegisteredEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp.ApplicationCommands/EventArgs/Module/GuildApplicationCommandsRegisteredEventArgs.cs b/DisCatSharp.ApplicationCommands/EventArgs/Module/GuildApplicationCommandsRegisteredEventArgs.cs index 38586e0b6..14169f606 100644 --- a/DisCatSharp.ApplicationCommands/EventArgs/Module/GuildApplicationCommandsRegisteredEventArgs.cs +++ b/DisCatSharp.ApplicationCommands/EventArgs/Module/GuildApplicationCommandsRegisteredEventArgs.cs @@ -25,6 +25,7 @@ public class GuildApplicationCommandsRegisteredEventArgs : DiscordEventArgs /// Initializes a new instance of the class. /// /// The provider. - internal GuildApplicationCommandsRegisteredEventArgs(IServiceProvider provider) : base(provider) + internal GuildApplicationCommandsRegisteredEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp.ApplicationCommands/EventArgs/SlashCommand/SlashCommandErrorEventArgs.cs b/DisCatSharp.ApplicationCommands/EventArgs/SlashCommand/SlashCommandErrorEventArgs.cs index 7a60e52c5..52b05843f 100644 --- a/DisCatSharp.ApplicationCommands/EventArgs/SlashCommand/SlashCommandErrorEventArgs.cs +++ b/DisCatSharp.ApplicationCommands/EventArgs/SlashCommand/SlashCommandErrorEventArgs.cs @@ -24,6 +24,7 @@ public class SlashCommandErrorEventArgs : DiscordEventArgs /// Initializes a new instance of the class. /// /// The provider. - public SlashCommandErrorEventArgs(IServiceProvider provider) : base(provider) + public SlashCommandErrorEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp.ApplicationCommands/EventArgs/SlashCommand/SlashCommandExecutedEventArgs.cs b/DisCatSharp.ApplicationCommands/EventArgs/SlashCommand/SlashCommandExecutedEventArgs.cs index 74da084d4..8af27678a 100644 --- a/DisCatSharp.ApplicationCommands/EventArgs/SlashCommand/SlashCommandExecutedEventArgs.cs +++ b/DisCatSharp.ApplicationCommands/EventArgs/SlashCommand/SlashCommandExecutedEventArgs.cs @@ -19,6 +19,7 @@ public class SlashCommandExecutedEventArgs : DiscordEventArgs /// Initializes a new instance of the class. /// /// The provider. - public SlashCommandExecutedEventArgs(IServiceProvider provider) : base(provider) + public SlashCommandExecutedEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp.ApplicationCommands/ExtensionMethods.cs b/DisCatSharp.ApplicationCommands/ExtensionMethods.cs index 64a971800..13fa19e76 100644 --- a/DisCatSharp.ApplicationCommands/ExtensionMethods.cs +++ b/DisCatSharp.ApplicationCommands/ExtensionMethods.cs @@ -20,15 +20,17 @@ public static class ExtensionMethods /// Client to enable application commands for. /// Configuration to use. /// Created . - public static ApplicationCommandsExtension UseApplicationCommands(this DiscordClient client, - ApplicationCommandsConfiguration config = null) + public static ApplicationCommandsExtension UseApplicationCommands( + this DiscordClient client, + ApplicationCommandsConfiguration? config = null + ) { if (client.GetExtension() != null) throw new InvalidOperationException("Application commands are already enabled for that client."); - var scomm = new ApplicationCommandsExtension(config); - client.AddExtension(scomm); - return scomm; + var applicationCommandsExtension = new ApplicationCommandsExtension(config); + client.AddExtension(applicationCommandsExtension); + return applicationCommandsExtension; } /// @@ -36,7 +38,7 @@ public static ApplicationCommandsExtension UseApplicationCommands(this DiscordCl /// /// Client to get application commands for. /// The module, or null if not activated. - public static ApplicationCommandsExtension GetApplicationCommands(this DiscordClient client) + public static ApplicationCommandsExtension? GetApplicationCommands(this DiscordClient client) => client.GetExtension(); /// @@ -44,13 +46,13 @@ public static ApplicationCommandsExtension GetApplicationCommands(this DiscordCl /// /// Client to get application commands from. /// A dictionary of current with the key being the shard id. - public static async Task> GetApplicationCommandsAsync(this DiscordShardedClient client) + public static async Task> GetApplicationCommandsAsync( + this DiscordShardedClient client + ) { await client.InitializeShardsAsync().ConfigureAwait(false); - var modules = new Dictionary(); - foreach (var shard in client.ShardClients.Values) - modules.Add(shard.ShardId, shard.GetExtension()); - return modules; + return client.ShardClients.Values.ToDictionary(shard => shard.ShardId, + shard => shard.GetExtension()); } /// @@ -59,7 +61,11 @@ public static async Task> /// Sharding extensions. /// The command class to register. /// A callback to setup translations with. - public static void RegisterGlobalCommands(this IReadOnlyDictionary extensions, Action translationSetup = null) where T : ApplicationCommandsModule + public static void RegisterGlobalCommands( + this IReadOnlyDictionary extensions, + Action? translationSetup = null + ) + where T : ApplicationCommandsModule { foreach (var extension in extensions.Values) extension.RegisterGlobalCommands(translationSetup); @@ -71,10 +77,15 @@ public static void RegisterGlobalCommands(this IReadOnlyDictionarySharding extensions. /// The of the command class to register. /// A callback to setup translations with. - public static void RegisterGlobalCommands(this IReadOnlyDictionary extensions, Type type, Action translationSetup = null) + public static void RegisterGlobalCommands( + this IReadOnlyDictionary extensions, + Type type, + Action? translationSetup = null + ) { if (!typeof(ApplicationCommandsModule).IsAssignableFrom(type)) throw new ArgumentException("Command classes have to inherit from ApplicationCommandsModule", nameof(type)); + foreach (var extension in extensions.Values) extension.RegisterGlobalCommands(type, translationSetup); } @@ -86,11 +97,15 @@ public static void RegisterGlobalCommands(this IReadOnlyDictionarySharding extensions. /// The guild id to register it on. /// A callback to setup translations with. - public static void RegisterGuildCommands(this IReadOnlyDictionary extensions, ulong guildId, Action translationSetup = null) where T : ApplicationCommandsModule + public static void RegisterGuildCommands( + this IReadOnlyDictionary extensions, + ulong guildId, + Action? translationSetup = null + ) + where T : ApplicationCommandsModule { foreach (var extension in extensions.Values) extension.RegisterGuildCommands(guildId, translationSetup); - } /// @@ -100,10 +115,15 @@ public static void RegisterGuildCommands(this IReadOnlyDictionaryThe of the command class to register. /// The guild id to register it on. /// A callback to setup translations with. - public static void RegisterGuildCommands(this IReadOnlyDictionary extensions, Type type, ulong guildId, Action translationSetup = null) + public static void RegisterGuildCommands( + this IReadOnlyDictionary extensions, + Type type, ulong guildId, + Action? translationSetup = null + ) { if (!typeof(ApplicationCommandsModule).IsAssignableFrom(type)) throw new ArgumentException("Command classes have to inherit from ApplicationCommandsModule", nameof(type)); + foreach (var extension in extensions.Values) extension.RegisterGuildCommands(type, guildId, translationSetup); } @@ -114,7 +134,9 @@ public static void RegisterGuildCommands(this IReadOnlyDictionaryClient to enable application commands on. /// Configuration to use. /// A dictionary of created with the key being the shard id. - public static async Task> UseApplicationCommandsAsync(this DiscordShardedClient client, ApplicationCommandsConfiguration config = null) + public static async Task> UseApplicationCommandsAsync( + this DiscordShardedClient client, ApplicationCommandsConfiguration? config = null + ) { var modules = new Dictionary(); await client.InitializeShardsAsync().ConfigureAwait(false); @@ -133,25 +155,21 @@ public static async Task> /// Gets the name from the for this enum value. /// /// The name. - public static string GetName(this T e) where T : IConvertible + public static string? GetName(this T e) where T : IConvertible { - if (e is Enum) - { - var type = e.GetType(); - var values = Enum.GetValues(type); - - foreach (int val in values) - { - if (val == e.ToInt32(CultureInfo.InvariantCulture)) - { - var memInfo = type.GetMember(type.GetEnumName(val)); - - return memInfo[0] - .GetCustomAttributes(typeof(ChoiceNameAttribute), false) - .FirstOrDefault() is ChoiceNameAttribute nameAttribute ? nameAttribute.Name : type.GetEnumName(val); - } - } - } - return null; + if (e is not Enum) + return null; + + var type = e.GetType(); + var values = Enum.GetValues(type); + + return (from int val in values + where val == e.ToInt32(CultureInfo.InvariantCulture) + let memInfo = type.GetMember(type.GetEnumName(val)) + select memInfo[0] + .GetCustomAttributes(typeof(ChoiceNameAttribute), false) + .FirstOrDefault() is ChoiceNameAttribute nameAttribute + ? nameAttribute.Name + : type.GetEnumName(val)).FirstOrDefault(); } } diff --git a/DisCatSharp.ApplicationCommands/GlobalSuppressions.cs b/DisCatSharp.ApplicationCommands/GlobalSuppressions.cs index 11643fcea..e776dbe59 100644 --- a/DisCatSharp.ApplicationCommands/GlobalSuppressions.cs +++ b/DisCatSharp.ApplicationCommands/GlobalSuppressions.cs @@ -1,20 +1,46 @@ using System.Diagnostics.CodeAnalysis; -[assembly: SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "", Scope = "member", Target = "~F:DisCatSharp.ApplicationCommands.ApplicationCommandsExtension.s_registeredCommands")] -[assembly: SuppressMessage("Usage", "CA2254:Template should be a static expression", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.ApplicationCommandsExtension.UpdateAsync~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", Target = "~P:DisCatSharp.ApplicationCommands.ApplicationCommandsExtension.GlobalCommands")] -[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", Target = "~P:DisCatSharp.ApplicationCommands.ApplicationCommandsExtension.GuildCommands")] -[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", Target = "~P:DisCatSharp.ApplicationCommands.ApplicationCommandsExtension.RegisteredCommands")] -[assembly: SuppressMessage("Performance", "CA1842:Do not use 'WhenAll' with a single task", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.DefaultHelpModule.DefaultHelpAsync(DisCatSharp.ApplicationCommands.Context.InteractionContext,System.String,System.String,System.String)~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Performance", "CA1842:Do not use 'WhenAll' with a single task", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.DefaultHelpModule.DefaultHelpAutoCompleteLevelOneProvider.Provider(DisCatSharp.ApplicationCommands.Context.AutocompleteContext)~System.Threading.Tasks.Task{System.Collections.Generic.IEnumerable{DisCatSharp.Entities.DiscordApplicationCommandAutocompleteChoice}}")] -[assembly: SuppressMessage("Performance", "CA1842:Do not use 'WhenAll' with a single task", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.DefaultHelpModule.DefaultHelpAutoCompleteLevelTwoProvider.Provider(DisCatSharp.ApplicationCommands.Context.AutocompleteContext)~System.Threading.Tasks.Task{System.Collections.Generic.IEnumerable{DisCatSharp.Entities.DiscordApplicationCommandAutocompleteChoice}}")] -[assembly: SuppressMessage("Performance", "CA1842:Do not use 'WhenAll' with a single task", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.DefaultHelpModule.DefaultHelpAutoCompleteProvider.Provider(DisCatSharp.ApplicationCommands.Context.AutocompleteContext)~System.Threading.Tasks.Task{System.Collections.Generic.IEnumerable{DisCatSharp.Entities.DiscordApplicationCommandAutocompleteChoice}}")] -[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.ApplicationCommandsExtension.RunPreexecutionChecksAsync(System.Reflection.MethodInfo,DisCatSharp.ApplicationCommands.Context.BaseContext)~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.DefaultHelpModule.DefaultHelpAsync(DisCatSharp.ApplicationCommands.Context.InteractionContext,System.String,System.String,System.String)~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.Workers.RegistrationWorker.BuildGlobalCreateList(DisCatSharp.DiscordClient,System.Collections.Generic.List{DisCatSharp.Entities.DiscordApplicationCommand})~System.Collections.Generic.List{DisCatSharp.Entities.DiscordApplicationCommand}")] -[assembly: SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.Workers.RegistrationWorker.BuildGlobalDeleteList(DisCatSharp.DiscordClient,System.Collections.Generic.List{DisCatSharp.Entities.DiscordApplicationCommand})~System.Collections.Generic.List{System.UInt64}")] -[assembly: SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.Workers.RegistrationWorker.BuildGuildCreateList(DisCatSharp.DiscordClient,System.UInt64,System.Collections.Generic.List{DisCatSharp.Entities.DiscordApplicationCommand})~System.Collections.Generic.List{DisCatSharp.Entities.DiscordApplicationCommand}")] -[assembly: SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.Workers.RegistrationWorker.BuildGuildDeleteList(DisCatSharp.DiscordClient,System.UInt64,System.Collections.Generic.List{DisCatSharp.Entities.DiscordApplicationCommand})~System.Collections.Generic.List{System.UInt64}")] +[assembly: + SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "", Scope = "member", + Target = "~F:DisCatSharp.ApplicationCommands.ApplicationCommandsExtension.s_registeredCommands")] +//[assembly: SuppressMessage("Usage", "CA2254:Template should be a static expression", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.ApplicationCommandsExtension.UpdateAsync~System.Threading.Tasks.Task")] +[assembly: + SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", + Target = "~P:DisCatSharp.ApplicationCommands.ApplicationCommandsExtension.GlobalCommands")] +[assembly: + SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", + Target = "~P:DisCatSharp.ApplicationCommands.ApplicationCommandsExtension.GuildCommands")] +[assembly: + SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", + Target = "~P:DisCatSharp.ApplicationCommands.ApplicationCommandsExtension.RegisteredCommands")] +//[assembly: SuppressMessage("Performance", "CA1842:Do not use 'WhenAll' with a single task", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.DefaultHelpModule.DefaultHelpAsync(DisCatSharp.ApplicationCommands.Context.InteractionContext,System.String,System.String,System.String)~System.Threading.Tasks.Task")] +//[assembly: SuppressMessage("Performance", "CA1842:Do not use 'WhenAll' with a single task", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.DefaultHelpModule.DefaultHelpAutoCompleteLevelOneProvider.Provider(DisCatSharp.ApplicationCommands.Context.AutocompleteContext)~System.Threading.Tasks.Task{System.Collections.Generic.IEnumerable{DisCatSharp.Entities.DiscordApplicationCommandAutocompleteChoice}}")] +//[assembly: SuppressMessage("Performance", "CA1842:Do not use 'WhenAll' with a single task", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.DefaultHelpModule.DefaultHelpAutoCompleteLevelTwoProvider.Provider(DisCatSharp.ApplicationCommands.Context.AutocompleteContext)~System.Threading.Tasks.Task{System.Collections.Generic.IEnumerable{DisCatSharp.Entities.DiscordApplicationCommandAutocompleteChoice}}")] +//[assembly: SuppressMessage("Performance", "CA1842:Do not use 'WhenAll' with a single task", Justification = "", Scope = "member", Target = "~M:DisCatSharp.ApplicationCommands.DefaultHelpModule.DefaultHelpAutoCompleteProvider.Provider(DisCatSharp.ApplicationCommands.Context.AutocompleteContext)~System.Threading.Tasks.Task{System.Collections.Generic.IEnumerable{DisCatSharp.Entities.DiscordApplicationCommandAutocompleteChoice}}")] +[assembly: + SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", + Target = + "~M:DisCatSharp.ApplicationCommands.ApplicationCommandsExtension.RunPreexecutionChecksAsync(System.Reflection.MethodInfo,DisCatSharp.ApplicationCommands.Context.BaseContext)~System.Threading.Tasks.Task")] +[assembly: + SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", + Target = + "~M:DisCatSharp.ApplicationCommands.DefaultHelpModule.DefaultHelpAsync(DisCatSharp.ApplicationCommands.Context.InteractionContext,System.String,System.String,System.String)~System.Threading.Tasks.Task")] +[assembly: + SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "", Scope = "member", + Target = + "~M:DisCatSharp.ApplicationCommands.Workers.RegistrationWorker.BuildGlobalCreateList(DisCatSharp.DiscordClient,System.Collections.Generic.List{DisCatSharp.Entities.DiscordApplicationCommand})~System.Collections.Generic.List{DisCatSharp.Entities.DiscordApplicationCommand}")] +[assembly: + SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "", Scope = "member", + Target = + "~M:DisCatSharp.ApplicationCommands.Workers.RegistrationWorker.BuildGlobalDeleteList(DisCatSharp.DiscordClient,System.Collections.Generic.List{DisCatSharp.Entities.DiscordApplicationCommand})~System.Collections.Generic.List{System.UInt64}")] +[assembly: + SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "", Scope = "member", + Target = + "~M:DisCatSharp.ApplicationCommands.Workers.RegistrationWorker.BuildGuildCreateList(DisCatSharp.DiscordClient,System.UInt64,System.Collections.Generic.List{DisCatSharp.Entities.DiscordApplicationCommand})~System.Collections.Generic.List{DisCatSharp.Entities.DiscordApplicationCommand}")] +[assembly: + SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "", Scope = "member", + Target = + "~M:DisCatSharp.ApplicationCommands.Workers.RegistrationWorker.BuildGuildDeleteList(DisCatSharp.DiscordClient,System.UInt64,System.Collections.Generic.List{DisCatSharp.Entities.DiscordApplicationCommand})~System.Collections.Generic.List{System.UInt64}")] [assembly: SuppressMessage("Usage", "DCS0102:[Discord] Deprecated", Justification = "")] [assembly: SuppressMessage("Usage", "DCS0101:[Discord] InExperiment", Justification = "")] [assembly: SuppressMessage("Usage", "DCS0103:[Discord] InExperiment", Justification = "")] diff --git a/DisCatSharp.ApplicationCommands/Workers/ApplicationCommandWorker.cs b/DisCatSharp.ApplicationCommands/Workers/ApplicationCommandWorker.cs index 3094fdd3b..01e13a47b 100644 --- a/DisCatSharp.ApplicationCommands/Workers/ApplicationCommandWorker.cs +++ b/DisCatSharp.ApplicationCommands/Workers/ApplicationCommandWorker.cs @@ -16,7 +16,7 @@ namespace DisCatSharp.ApplicationCommands.Workers; /// /// Represents a . /// -internal class CommandWorker +internal static class CommandWorker { /// /// Parses context menu application commands. @@ -27,40 +27,52 @@ internal class CommandWorker /// Too much. internal static Task< ( - List applicationCommands, - List> commandTypeSources, - List contextMenuCommands, - bool withLocalization + List applicationCommands, + List> commandTypeSources, + List contextMenuCommands, + bool withLocalization ) - > ParseContextMenuCommands(Type type, IEnumerable methods, List translator = null) + > ParseContextMenuCommands(Type type, IEnumerable methods, List? translator = null) { List commands = new(); List> commandTypeSources = new(); List contextMenuCommands = new(); - foreach (var contextMethod in methods) { var contextAttribute = contextMethod.GetCustomAttribute(); DiscordApplicationCommandLocalization nameLocalizations = null; - var commandTranslation = translator?.Single(c => c.Name == contextAttribute.Name && c.Type == contextAttribute.Type); + var commandTranslation = + translator?.Single(c => c.Name == contextAttribute.Name && c.Type == contextAttribute.Type); if (commandTranslation != null) nameLocalizations = commandTranslation.NameTranslations; - var command = new DiscordApplicationCommand(contextAttribute.Name, null, null, contextAttribute.Type, nameLocalizations, null, contextAttribute.DefaultMemberPermissions, contextAttribute.DmPermission ?? true, isNsfw: contextAttribute.IsNsfw, allowedContexts: contextAttribute.AllowedContexts, integrationTypes: contextAttribute.IntegrationTypes); + var command = new DiscordApplicationCommand(contextAttribute.Name, null, null, contextAttribute.Type, + nameLocalizations, null, + contextAttribute.DefaultMemberPermissions, + contextAttribute.DmPermission ?? true, contextAttribute.IsNsfw, + contextAttribute.AllowedContexts, + contextAttribute.IntegrationTypes); var parameters = contextMethod.GetParameters(); - if (parameters.Length == 0 || parameters == null || !ReferenceEquals(parameters.FirstOrDefault()?.ParameterType, typeof(ContextMenuContext))) - throw new ArgumentException($"The first argument of the command '{contextAttribute.Name}' has to be an ContextMenuContext!"); + if (parameters.Length == 0 || parameters == null || + !ReferenceEquals(parameters.FirstOrDefault()?.ParameterType, typeof(ContextMenuContext))) + throw new + ArgumentException($"The first argument of the command '{contextAttribute.Name}' has to be an ContextMenuContext!"); if (parameters.Length > 1) - throw new ArgumentException($"The context menu command '{contextAttribute.Name}' cannot have parameters!"); + throw new + ArgumentException($"The context menu command '{contextAttribute.Name}' cannot have parameters!"); - contextMenuCommands.Add(new ContextMenuCommand { Method = contextMethod, Name = contextAttribute.Name }); + contextMenuCommands.Add(new() + { + Method = contextMethod, + Name = contextAttribute.Name + }); commands.Add(command); - commandTypeSources.Add(new KeyValuePair(type, type)); + commandTypeSources.Add(new(type, type)); } return Task.FromResult((commands, commandTypeSources, contextMenuCommands, translator != null)); @@ -76,80 +88,113 @@ bool withLocalization /// Too much. internal static async Task< ( - List applicationCommands, - List> commandTypeSources, - List commandMethods, - bool withLocalization + List applicationCommands, + List> commandTypeSources, + List commandMethods, + bool withLocalization ) - > ParseBasicSlashCommandsAsync(Type type, IEnumerable methods, ulong? guildId = null, List translator = null) + > ParseBasicSlashCommandsAsync( + Type type, IEnumerable methods, ulong? guildId = null, + List? translator = null + ) { List commands = new(); List> commandTypeSources = new(); List commandMethods = new(); foreach (var method in methods) - { try { var commandAttribute = method.GetCustomAttribute(); var parameters = method.GetParameters(); - if (parameters.Length == 0 || parameters == null || !ReferenceEquals(parameters.FirstOrDefault()?.ParameterType, typeof(InteractionContext))) - throw new ArgumentException($"The first argument of the command '{commandAttribute.Name}' has to be an InteractionContext!"); - var options = await ApplicationCommandsExtension.ParseParametersAsync(parameters.Skip(1), commandAttribute.Name, guildId).ConfigureAwait(false); + if (parameters.Length == 0 || parameters == null || + !ReferenceEquals(parameters.FirstOrDefault()?.ParameterType, typeof(InteractionContext))) + throw new + ArgumentException($"The first argument of the command '{commandAttribute.Name}' has to be an InteractionContext!"); + + var options = await ApplicationCommandsExtension + .ParseParametersAsync(parameters.Skip(1), commandAttribute.Name, guildId) + .ConfigureAwait(false); - commandMethods.Add(new CommandMethod { Method = method, Name = commandAttribute.Name }); + commandMethods.Add(new() + { + Method = method, + Name = commandAttribute.Name + }); DiscordApplicationCommandLocalization nameLocalizations = null; DiscordApplicationCommandLocalization descriptionLocalizations = null; List localizedOptions = null; - var commandTranslation = translator?.Single(c => c.Name == commandAttribute.Name && c.Type == ApplicationCommandType.ChatInput); + var commandTranslation = + translator?.Single(c => c.Name == commandAttribute.Name && + c.Type == ApplicationCommandType.ChatInput); - if (commandTranslation != null && commandTranslation.Options != null) + if (commandTranslation is { Options: not null }) { - localizedOptions = new List(options.Count); + localizedOptions = new(options.Count); foreach (var option in options) - { try { - var choices = option.Choices != null ? new List(option.Choices.Count) : null; + var choices = option.Choices != null + ? new List(option.Choices.Count) + : null; if (option.Choices != null) foreach (var choice in option.Choices) try { - choices.Add(new DiscordApplicationCommandOptionChoice(choice.Name, choice.Value, commandTranslation.Options.Single(o => o.Name == option.Name).Choices.Single(c => c.Name == choice.Name).NameTranslations)); + choices.Add(new(choice.Name, choice.Value, + commandTranslation.Options.Single(o => o.Name == option.Name) + .Choices.Single(c => c.Name == choice.Name) + .NameTranslations)); } catch (Exception ex) { - throw new AggregateException($"Failed to register choice '{choice.Name}' in command '{commandAttribute.Name}'", ex); + throw new + AggregateException($"Failed to register choice '{choice.Name}' in command '{commandAttribute.Name}'", + ex); } - localizedOptions.Add(new DiscordApplicationCommandOption(option.Name, option.Description, option.Type, option.Required, - choices, option.Options, option.ChannelTypes, option.AutoComplete, option.MinimumValue, option.MaximumValue, - commandTranslation.Options.Single(o => o.Name == option.Name).NameTranslations, commandTranslation.Options.Single(o => o.Name == option.Name).DescriptionTranslations, + localizedOptions.Add(new(option.Name, option.Description, option.Type, option.Required, + choices, option.Options, option.ChannelTypes, option.AutoComplete, + option.MinimumValue, option.MaximumValue, + commandTranslation.Options.Single(o => o.Name == option.Name) + .NameTranslations, + commandTranslation.Options.Single(o => o.Name == option.Name) + .DescriptionTranslations, option.MinimumLength, option.MaximumLength )); } catch (Exception ex) { - throw new AggregateException($"Failed to register option '{option.Name}' in command '{commandAttribute.Name}'", ex); + throw new + AggregateException($"Failed to register option '{option.Name}' in command '{commandAttribute.Name}'", + ex); } - } nameLocalizations = commandTranslation.NameTranslations; descriptionLocalizations = commandTranslation.DescriptionTranslations; } - var payload = new DiscordApplicationCommand(commandAttribute.Name, commandAttribute.Description, (localizedOptions != null && localizedOptions.Any() ? localizedOptions : null) ?? (options != null && options.Any() ? options : null), ApplicationCommandType.ChatInput, nameLocalizations, descriptionLocalizations, commandAttribute.DefaultMemberPermissions, commandAttribute.DmPermission ?? true, isNsfw: commandAttribute.IsNsfw, allowedContexts: commandAttribute.AllowedContexts, integrationTypes: commandAttribute.IntegrationTypes); + var payload = new DiscordApplicationCommand(commandAttribute.Name, commandAttribute.Description, + (localizedOptions != null && localizedOptions.Any() + ? localizedOptions + : null) ?? + (options != null && options.Any() ? options : null), + ApplicationCommandType.ChatInput, nameLocalizations, + descriptionLocalizations, + commandAttribute.DefaultMemberPermissions, + commandAttribute.DmPermission ?? true, + commandAttribute.IsNsfw, commandAttribute.AllowedContexts, + commandAttribute.IntegrationTypes); commands.Add(payload); - commandTypeSources.Add(new KeyValuePair(type, type)); + commandTypeSources.Add(new(type, type)); } catch (Exception ex) { throw new AggregateException($"Failed to register command with method name '{method.Name}'", ex); } - } return (commands, commandTypeSources, commandMethods, translator != null); } @@ -158,7 +203,7 @@ bool withLocalization /// /// Represents a . /// -internal class NestedCommandWorker +internal static class NestedCommandWorker { /// /// Parses application command groups. @@ -170,14 +215,17 @@ internal class NestedCommandWorker /// Too much. internal static async Task< ( - List applicationCommands, - List> commandTypeSources, - List singletonModules, - List groupCommands, - List subGroupCommands, - bool withLocalization + List applicationCommands, + List> commandTypeSources, + List singletonModules, + List groupCommands, + List subGroupCommands, + bool withLocalization ) - > ParseSlashGroupsAsync(Type type, List types, ulong? guildId = null, List translator = null) + > ParseSlashGroupsAsync( + Type type, List types, ulong? guildId = null, + List? translator = null + ) { List commands = new(); List> commandTypeSources = new(); @@ -190,8 +238,10 @@ bool withLocalization { //Gets the attribute and methods in the group var groupAttribute = subclassInfo.GetCustomAttribute(); - var submethods = subclassInfo.DeclaredMethods.Where(x => x.GetCustomAttribute() != null).ToList(); - var subclasses = subclassInfo.DeclaredNestedTypes.Where(x => x.GetCustomAttribute() != null).ToList(); + var submethods = subclassInfo.DeclaredMethods + .Where(x => x.GetCustomAttribute() != null).ToList(); + var subclasses = subclassInfo.DeclaredNestedTypes + .Where(x => x.GetCustomAttribute() != null).ToList(); DiscordApplicationCommandLocalization nameLocalizations = null; DiscordApplicationCommandLocalization descriptionLocalizations = null; @@ -207,7 +257,15 @@ bool withLocalization } //Initializes the command - var payload = new DiscordApplicationCommand(groupAttribute.Name, groupAttribute.Description, nameLocalizations: nameLocalizations, descriptionLocalizations: descriptionLocalizations, defaultMemberPermissions: groupAttribute.DefaultMemberPermissions, dmPermission: groupAttribute.DmPermission ?? true, isNsfw: groupAttribute.IsNsfw, allowedContexts: groupAttribute.AllowedContexts, integrationTypes: groupAttribute.IntegrationTypes); + var payload = new DiscordApplicationCommand(groupAttribute.Name, groupAttribute.Description, + nameLocalizations: nameLocalizations, + descriptionLocalizations: descriptionLocalizations, + defaultMemberPermissions: groupAttribute + .DefaultMemberPermissions, + dmPermission: groupAttribute.DmPermission ?? true, + isNsfw: groupAttribute.IsNsfw, + allowedContexts: groupAttribute.AllowedContexts, + integrationTypes: groupAttribute.IntegrationTypes); commandTypeSources.Add(new(type, type)); var commandMethods = new List>(); @@ -218,10 +276,14 @@ bool withLocalization //Gets the parameters and accounts for InteractionContext var parameters = submethod.GetParameters(); - if (parameters.Length == 0 || parameters == null || !ReferenceEquals(parameters.First().ParameterType, typeof(InteractionContext))) - throw new ArgumentException($"The first argument of the command '{commandAttribute.Name}' has to be an InteractionContext!"); + if (parameters.Length == 0 || parameters == null || + !ReferenceEquals(parameters.First().ParameterType, typeof(InteractionContext))) + throw new + ArgumentException($"The first argument of the command '{commandAttribute.Name}' has to be an InteractionContext!"); - var options = await ApplicationCommandsExtension.ParseParametersAsync(parameters.Skip(1), commandAttribute.Name, guildId).ConfigureAwait(false); + var options = await ApplicationCommandsExtension + .ParseParametersAsync(parameters.Skip(1), commandAttribute.Name, guildId) + .ConfigureAwait(false); DiscordApplicationCommandLocalization subNameLocalizations = null; DiscordApplicationCommandLocalization subDescriptionLocalizations = null; @@ -231,21 +293,36 @@ bool withLocalization if (commandTranslation?.Commands != null) { - - var subCommandTranslation = commandTranslation.Commands.Single(sc => sc.Name == commandAttribute.Name); + var subCommandTranslation = + commandTranslation.Commands.Single(sc => sc.Name == commandAttribute.Name); if (subCommandTranslation.Options != null) { - localizedOptions = new List(options.Count); + localizedOptions = new(options.Count); foreach (var option in options) { - var choices = option.Choices != null ? new List(option.Choices.Count) : null; + var choices = option.Choices != null + ? new List(option.Choices.Count) + : null; if (option.Choices != null) - foreach (var choice in option.Choices) - choices.Add(new DiscordApplicationCommandOptionChoice(choice.Name, choice.Value, subCommandTranslation.Options.Single(o => o.Name == option.Name).Choices.Single(c => c.Name == choice.Name).NameTranslations)); - - localizedOptions.Add(new DiscordApplicationCommandOption(option.Name, option.Description, option.Type, option.Required, - choices, option.Options, option.ChannelTypes, option.AutoComplete, option.MinimumValue, option.MaximumValue, - subCommandTranslation.Options.Single(o => o.Name == option.Name).NameTranslations, subCommandTranslation.Options.Single(o => o.Name == option.Name).DescriptionTranslations, + choices.AddRange(option.Choices.Select(choice + => new + DiscordApplicationCommandOptionChoice(choice.Name, + choice.Value, + subCommandTranslation.Options + .Single(o => o.Name == + option.Name) + .Choices + .Single(c => c.Name == + choice.Name) + .NameTranslations))); + + localizedOptions.Add(new(option.Name, option.Description, option.Type, option.Required, + choices, option.Options, option.ChannelTypes, option.AutoComplete, + option.MinimumValue, option.MaximumValue, + subCommandTranslation.Options.Single(o => o.Name == option.Name) + .NameTranslations, + subCommandTranslation.Options.Single(o => o.Name == option.Name) + .DescriptionTranslations, option.MinimumLength, option.MaximumLength )); } @@ -255,39 +332,56 @@ bool withLocalization subDescriptionLocalizations = subCommandTranslation.DescriptionTranslations; } - //Creates the subcommand and adds it to the main command - var subpayload = new DiscordApplicationCommandOption(commandAttribute.Name, commandAttribute.Description, ApplicationCommandOptionType.SubCommand, false, null, localizedOptions ?? options, nameLocalizations: subNameLocalizations, descriptionLocalizations: subDescriptionLocalizations); - payload = new(payload.Name, payload.Description, payload.Options?.Append(subpayload) ?? new[] { subpayload }, nameLocalizations: payload.NameLocalizations, descriptionLocalizations: payload.DescriptionLocalizations, defaultMemberPermissions: payload.DefaultMemberPermissions, dmPermission: payload.DmPermission ?? true, isNsfw: payload.IsNsfw, allowedContexts: payload.AllowedContexts, integrationTypes: payload.IntegrationTypes); + var subpayload = new DiscordApplicationCommandOption(commandAttribute.Name, + commandAttribute.Description, + ApplicationCommandOptionType.SubCommand, false, + null, localizedOptions ?? options, + nameLocalizations: subNameLocalizations, + descriptionLocalizations: + subDescriptionLocalizations); + payload = new(payload.Name, payload.Description, payload.Options?.Append(subpayload) ?? new[] { subpayload }, nameLocalizations: payload.NameLocalizations, + descriptionLocalizations: payload.DescriptionLocalizations, + defaultMemberPermissions: payload.DefaultMemberPermissions, + dmPermission: payload.DmPermission ?? true, + isNsfw: payload.IsNsfw, allowedContexts: payload.AllowedContexts, + integrationTypes: payload.IntegrationTypes); commandTypeSources.Add(new(subclassInfo, type)); //Adds it to the method lists - commandMethods.Add(new KeyValuePair(commandAttribute.Name, submethod)); - groupCommands.Add(new GroupCommand { Name = groupAttribute.Name, Methods = commandMethods }); + commandMethods.Add(new(commandAttribute.Name, submethod)); + groupCommands.Add(new() + { + Name = groupAttribute.Name, + Methods = commandMethods + }); } - var command = new SubGroupCommand { Name = groupAttribute.Name }; + var command = new SubGroupCommand + { + Name = groupAttribute.Name + }; //Handles subgroups foreach (var subclass in subclasses) { var subgroupAttribute = subclass.GetCustomAttribute(); - var subsubmethods = subclass.DeclaredMethods.Where(x => x.GetCustomAttribute() != null); + var subsubmethods = + subclass.DeclaredMethods.Where(x => x.GetCustomAttribute() != null); var options = new List(); var currentMethods = new List>(); - DiscordApplicationCommandLocalization subNameLocalizations = null; DiscordApplicationCommandLocalization subDescriptionLocalizations = null; if (translator != null) { var commandTranslation = translator.Single(c => c.Name == payload.Name); - if (commandTranslation != null && commandTranslation.SubGroups != null) + if (commandTranslation is { SubGroups: not null }) { - - var subCommandTranslation = commandTranslation.SubGroups.Single(sc => sc.Name == subgroupAttribute.Name); + var subCommandTranslation = + commandTranslation.SubGroups.Single(sc => sc.Name == subgroupAttribute.Name); if (subCommandTranslation != null) { @@ -301,12 +395,16 @@ bool withLocalization foreach (var subsubmethod in subsubmethods) { var suboptions = new List(); - var commatt = subsubmethod.GetCustomAttribute(); + var slashCommandAttribute = subsubmethod.GetCustomAttribute(); var parameters = subsubmethod.GetParameters(); - if (parameters.Length == 0 || parameters == null || !ReferenceEquals(parameters.First().ParameterType, typeof(InteractionContext))) - throw new ArgumentException($"The first argument of the command '{subgroupAttribute.Name}' has to be an InteractionContext!"); + if (parameters.Length == 0 || parameters == null || + !ReferenceEquals(parameters.First().ParameterType, typeof(InteractionContext))) + throw new + ArgumentException($"The first argument of the command '{subgroupAttribute.Name}' has to be an InteractionContext!"); - suboptions = suboptions.Concat(await ApplicationCommandsExtension.ParseParametersAsync(parameters.Skip(1), subgroupAttribute.Name, guildId).ConfigureAwait(false)).ToList(); + suboptions = suboptions.Concat(await ApplicationCommandsExtension + .ParseParametersAsync(parameters.Skip(1), subgroupAttribute.Name, + guildId).ConfigureAwait(false)).ToList(); DiscordApplicationCommandLocalization subSubNameLocalizations = null; DiscordApplicationCommandLocalization subSubDescriptionLocalizations = null; @@ -314,23 +412,40 @@ bool withLocalization var commandTranslation = translator?.Single(c => c.Name == payload.Name); - var subCommandTranslation = commandTranslation?.SubGroups?.Single(sc => sc.Name == commatt.Name); + var subCommandTranslation = + commandTranslation?.SubGroups?.Single(sc => sc.Name == slashCommandAttribute.Name); - var subSubCommandTranslation = subCommandTranslation?.Commands.Single(sc => sc.Name == commatt.Name); + var subSubCommandTranslation = + subCommandTranslation?.Commands.Single(sc => sc.Name == slashCommandAttribute.Name); - if (subSubCommandTranslation != null && subSubCommandTranslation.Options != null) + if (subSubCommandTranslation is { Options: not null }) { - localizedOptions = new List(suboptions.Count); + localizedOptions = new(suboptions.Count); foreach (var option in suboptions) { - var choices = option.Choices != null ? new List(option.Choices.Count) : null; + var choices = option.Choices != null + ? new List(option.Choices.Count) + : null; if (option.Choices != null) - foreach (var choice in option.Choices) - choices.Add(new DiscordApplicationCommandOptionChoice(choice.Name, choice.Value, subSubCommandTranslation.Options.Single(o => o.Name == option.Name).Choices.Single(c => c.Name == choice.Name).NameTranslations)); - - localizedOptions.Add(new DiscordApplicationCommandOption(option.Name, option.Description, option.Type, option.Required, - choices, option.Options, option.ChannelTypes, option.AutoComplete, option.MinimumValue, option.MaximumValue, - subSubCommandTranslation.Options.Single(o => o.Name == option.Name).NameTranslations, subSubCommandTranslation.Options.Single(o => o.Name == option.Name).DescriptionTranslations, + choices.AddRange(option.Choices.Select(choice + => new + DiscordApplicationCommandOptionChoice(choice.Name, + choice.Value, + subSubCommandTranslation.Options + .Single(o => o.Name == + option.Name) + .Choices + .Single(c => c.Name == + choice.Name) + .NameTranslations))); + + localizedOptions.Add(new(option.Name, option.Description, option.Type, option.Required, + choices, option.Options, option.ChannelTypes, option.AutoComplete, + option.MinimumValue, option.MaximumValue, + subSubCommandTranslation.Options.Single(o => o.Name == option.Name) + .NameTranslations, + subSubCommandTranslation.Options.Single(o => o.Name == option.Name) + .DescriptionTranslations, option.MinimumLength, option.MaximumLength )); } @@ -339,28 +454,63 @@ bool withLocalization subSubDescriptionLocalizations = subSubCommandTranslation.DescriptionTranslations; } - var subsubpayload = new DiscordApplicationCommandOption(commatt.Name, commatt.Description, ApplicationCommandOptionType.SubCommand, false, null, (localizedOptions != null && localizedOptions.Any() ? localizedOptions : null) ?? (suboptions != null && suboptions.Any() ? suboptions : null), nameLocalizations: subSubNameLocalizations, descriptionLocalizations: subSubDescriptionLocalizations); + var subsubpayload = new DiscordApplicationCommandOption(slashCommandAttribute.Name, + slashCommandAttribute.Description, + ApplicationCommandOptionType.SubCommand, + false, null, + (localizedOptions != null && + localizedOptions.Any() + ? localizedOptions + : null) ?? + (suboptions != null && suboptions.Any() + ? suboptions + : null), + nameLocalizations: subSubNameLocalizations, + descriptionLocalizations: + subSubDescriptionLocalizations); options.Add(subsubpayload); - commandMethods.Add(new KeyValuePair(commatt.Name, subsubmethod)); - currentMethods.Add(new KeyValuePair(commatt.Name, subsubmethod)); + commandMethods.Add(new(slashCommandAttribute.Name, subsubmethod)); + currentMethods.Add(new(slashCommandAttribute.Name, subsubmethod)); } //Adds the group to the command and method lists - var subpayload = new DiscordApplicationCommandOption(subgroupAttribute.Name, subgroupAttribute.Description, ApplicationCommandOptionType.SubCommandGroup, false, null, options, nameLocalizations: subNameLocalizations, descriptionLocalizations: subDescriptionLocalizations); - command.SubCommands.Add(new() { Name = subgroupAttribute.Name, Methods = currentMethods }); - payload = new(payload.Name, payload.Description, payload.Options?.Append(subpayload) ?? new[] { subpayload }, nameLocalizations: payload.NameLocalizations, descriptionLocalizations: payload.DescriptionLocalizations, defaultMemberPermissions: payload.DefaultMemberPermissions, dmPermission: payload.DmPermission ?? true, isNsfw: payload.IsNsfw, allowedContexts: payload.AllowedContexts, integrationTypes: payload.IntegrationTypes); + var subpayload = new DiscordApplicationCommandOption(subgroupAttribute.Name, + subgroupAttribute.Description, + ApplicationCommandOptionType.SubCommandGroup, + false, null, options, + nameLocalizations: subNameLocalizations, + descriptionLocalizations: + subDescriptionLocalizations); + command.SubCommands.Add(new() + { + Name = subgroupAttribute.Name, + Methods = currentMethods + }); + payload = new(payload.Name, payload.Description, payload.Options?.Append(subpayload) ?? new[] { subpayload }, nameLocalizations: payload.NameLocalizations, + descriptionLocalizations: payload.DescriptionLocalizations, + defaultMemberPermissions: payload.DefaultMemberPermissions, + dmPermission: payload.DmPermission ?? true, + isNsfw: payload.IsNsfw, allowedContexts: payload.AllowedContexts, + integrationTypes: payload.IntegrationTypes); commandTypeSources.Add(new(subclass, type)); //Accounts for lifespans for the sub group - if (subclass.GetCustomAttribute() != null && subclass.GetCustomAttribute().Lifespan == ApplicationCommandModuleLifespan.Singleton) - singletonModules.Add(ApplicationCommandsExtension.CreateInstance(subclass, ApplicationCommandsExtension.Configuration?.ServiceProvider)); + if (subclass.GetCustomAttribute() != null && + subclass.GetCustomAttribute().Lifespan == + ApplicationCommandModuleLifespan.Singleton) + singletonModules.Add(ApplicationCommandsExtension.CreateInstance(subclass, + ApplicationCommandsExtension.Configuration?.ServiceProvider)); } + if (command.SubCommands.Any()) subGroupCommands.Add(command); commands.Add(payload); //Accounts for lifespans - if (subclassInfo.GetCustomAttribute() != null && subclassInfo.GetCustomAttribute().Lifespan == ApplicationCommandModuleLifespan.Singleton) - singletonModules.Add(ApplicationCommandsExtension.CreateInstance(subclassInfo, ApplicationCommandsExtension.Configuration?.ServiceProvider)); + if (subclassInfo.GetCustomAttribute() != null && + subclassInfo.GetCustomAttribute().Lifespan == + ApplicationCommandModuleLifespan.Singleton) + singletonModules.Add(ApplicationCommandsExtension.CreateInstance(subclassInfo, + ApplicationCommandsExtension.Configuration?.ServiceProvider)); } return (commands, commandTypeSources, singletonModules, groupCommands, subGroupCommands, translator != null); diff --git a/DisCatSharp.ApplicationCommands/Workers/RegistrationWorker.cs b/DisCatSharp.ApplicationCommands/Workers/RegistrationWorker.cs index 5929735fe..e66d3b640 100644 --- a/DisCatSharp.ApplicationCommands/Workers/RegistrationWorker.cs +++ b/DisCatSharp.ApplicationCommands/Workers/RegistrationWorker.cs @@ -14,7 +14,7 @@ namespace DisCatSharp.ApplicationCommands.Workers; /// /// Represents a . /// -internal class RegistrationWorker +internal static class RegistrationWorker { /// /// Registers the global commands. @@ -22,15 +22,19 @@ internal class RegistrationWorker /// The discord client. /// The command list. /// A list of registered commands. - internal static async Task> RegisterGlobalCommandsAsync(DiscordClient client, List commands) + internal static async Task?> RegisterGlobalCommandsAsync( + DiscordClient client, List commands + ) { var (changedCommands, unchangedCommands) = BuildGlobalOverwriteList(client, commands); - var globalCommandsCreateList = BuildGlobalCreateList(client, commands); - var globalCommandsDeleteList = BuildGlobalDeleteList(client, commands); + var globalCommandsCreateList = BuildGlobalCreateList(commands); + var globalCommandsDeleteList = BuildGlobalDeleteList(commands); - if (globalCommandsCreateList.NotEmptyAndNotNull() && unchangedCommands.NotEmptyAndNotNull() && changedCommands.NotEmptyAndNotNull()) + if (globalCommandsCreateList.NotEmptyAndNotNull() && unchangedCommands.NotEmptyAndNotNull() && + changedCommands.NotEmptyAndNotNull()) { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, $"[AC GLOBAL] Creating, re-using and overwriting application commands."); + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + $"[AC GLOBAL] Creating, re-using and overwriting application commands."); foreach (var cmd in globalCommandsCreateList) { @@ -38,16 +42,15 @@ internal static async Task> RegisterGlobalComman commands.Add(discordBackendCommand); } - foreach (var cmd in changedCommands) + foreach (var (key, command) in changedCommands) { - var command = cmd.Value; - var discordBackendCommand = await client.EditGlobalApplicationCommandAsync(cmd.Key, action => + var discordBackendCommand = await client.EditGlobalApplicationCommandAsync(key, action => { action.Name = command.Name; action.NameLocalizations = command.NameLocalizations; action.Description = command.Description; action.DescriptionLocalizations = command.DescriptionLocalizations; - if(command.Options != null && command.Options.Any()) + if (command.Options != null && command.Options.Any()) action.Options = Optional.Some(command.Options); action.DefaultMemberPermissions = command.DefaultMemberPermissions; action.DmPermission = command.DmPermission ?? true; @@ -60,9 +63,11 @@ internal static async Task> RegisterGlobalComman commands.AddRange(unchangedCommands); } - else if (globalCommandsCreateList.NotEmptyAndNotNull() && (unchangedCommands.NotEmptyAndNotNull() || changedCommands.NotEmptyAndNotNull())) + else if (globalCommandsCreateList.NotEmptyAndNotNull() && + (unchangedCommands.NotEmptyAndNotNull() || changedCommands.NotEmptyAndNotNull())) { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, $"[AC GLOBAL] Creating, re-using and overwriting application commands."); + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + $"[AC GLOBAL] Creating, re-using and overwriting application commands."); foreach (var cmd in globalCommandsCreateList) { @@ -71,21 +76,20 @@ internal static async Task> RegisterGlobalComman } if (changedCommands.NotEmptyAndNotNull()) - foreach (var cmd in changedCommands) + foreach (var (key, command) in changedCommands) { - var command = cmd.Value; - var discordBackendCommand = await client.EditGlobalApplicationCommandAsync(cmd.Key, action => + var discordBackendCommand = await client.EditGlobalApplicationCommandAsync(key, action => { action.Name = command.Name; action.NameLocalizations = command.NameLocalizations; action.Description = command.Description; action.DescriptionLocalizations = command.DescriptionLocalizations; - if(command.Options != null && command.Options.Any()) + if (command.Options != null && command.Options.Any()) action.Options = Optional.Some(command.Options); action.DefaultMemberPermissions = command.DefaultMemberPermissions; action.DmPermission = command.DmPermission ?? true; action.IsNsfw = command.IsNsfw; - action.AllowedContexts = command.AllowedContexts; + action.AllowedContexts = command.AllowedContexts; }).ConfigureAwait(false); commands.Add(discordBackendCommand); @@ -94,20 +98,21 @@ internal static async Task> RegisterGlobalComman if (unchangedCommands.NotEmptyAndNotNull()) commands.AddRange(unchangedCommands); } - else if (globalCommandsCreateList.EmptyOrNull() && unchangedCommands.NotEmptyAndNotNull() && changedCommands.NotEmptyAndNotNull()) + else if (globalCommandsCreateList.EmptyOrNull() && unchangedCommands.NotEmptyAndNotNull() && + changedCommands.NotEmptyAndNotNull()) { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, $"[AC GLOBAL] Editing & re-using application commands."); + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + $"[AC GLOBAL] Editing & re-using application commands."); - foreach (var cmd in changedCommands) + foreach (var (key, command) in changedCommands) { - var command = cmd.Value; - var discordBackendCommand = await client.EditGlobalApplicationCommandAsync(cmd.Key, action => + var discordBackendCommand = await client.EditGlobalApplicationCommandAsync(key, action => { action.Name = command.Name; action.NameLocalizations = command.NameLocalizations; action.Description = command.Description; action.DescriptionLocalizations = command.DescriptionLocalizations; - if(command.Options != null && command.Options.Any()) + if (command.Options != null && command.Options.Any()) action.Options = Optional.Some(command.Options); action.DefaultMemberPermissions = command.DefaultMemberPermissions; action.DmPermission = command.DmPermission ?? true; @@ -120,48 +125,57 @@ internal static async Task> RegisterGlobalComman commands.AddRange(unchangedCommands); } - else if (globalCommandsCreateList.EmptyOrNull() && changedCommands.NotEmptyAndNotNull() && unchangedCommands.EmptyOrNull()) + else if (globalCommandsCreateList.EmptyOrNull() && changedCommands.NotEmptyAndNotNull() && + unchangedCommands.EmptyOrNull()) { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, $"[AC GLOBAL] Overwriting all application commands."); + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + $"[AC GLOBAL] Overwriting all application commands."); List overwriteList = new(); - foreach (var overwrite in changedCommands) + foreach (var (key, cmd) in changedCommands) { - var cmd = overwrite.Value; - cmd.Id = overwrite.Key; + cmd.Id = key; overwriteList.Add(cmd); } - var discordBackendCommands = await client.BulkOverwriteGlobalApplicationCommandsAsync(overwriteList).ConfigureAwait(false); + + var discordBackendCommands = + await client.BulkOverwriteGlobalApplicationCommandsAsync(overwriteList).ConfigureAwait(false); commands.AddRange(discordBackendCommands); } - else if (globalCommandsCreateList.NotEmptyAndNotNull() && changedCommands.EmptyOrNull() && unchangedCommands.EmptyOrNull()) + else if (globalCommandsCreateList.NotEmptyAndNotNull() && changedCommands.EmptyOrNull() && + unchangedCommands.EmptyOrNull()) { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, $"[AC GLOBAL] Creating all application commands."); + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + $"[AC GLOBAL] Creating all application commands."); - var cmds = await client.BulkOverwriteGlobalApplicationCommandsAsync(globalCommandsCreateList).ConfigureAwait(false); + var cmds = await client.BulkOverwriteGlobalApplicationCommandsAsync(globalCommandsCreateList!) + .ConfigureAwait(false); commands.AddRange(cmds); } - else if (globalCommandsCreateList.EmptyOrNull() && changedCommands.EmptyOrNull() && unchangedCommands.NotEmptyAndNotNull()) + else if (globalCommandsCreateList.EmptyOrNull() && changedCommands.EmptyOrNull() && + unchangedCommands.NotEmptyAndNotNull()) { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, $"[AC GLOBAL] Re-using all application commands."); + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + $"[AC GLOBAL] Re-using all application commands."); commands.AddRange(unchangedCommands); } - if (globalCommandsDeleteList.NotEmptyAndNotNull()) - { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, $"[AC GLOBAL] Deleting missing application commands."); + if (!globalCommandsDeleteList.NotEmptyAndNotNull()) + return commands.NotEmptyAndNotNull() ? commands : null; - foreach (var cmdId in globalCommandsDeleteList) - try - { - await client.DeleteGlobalApplicationCommandAsync(cmdId).ConfigureAwait(false); - } - catch (NotFoundException) - { - client.Logger.LogError(@"Could not delete global command {cmd}. Please clean up manually", cmdId); - } - } + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + $"[AC GLOBAL] Deleting missing application commands."); + + foreach (var cmdId in globalCommandsDeleteList) + try + { + await client.DeleteGlobalApplicationCommandAsync(cmdId).ConfigureAwait(false); + } + catch (NotFoundException) + { + client.Logger.LogError(@"Could not delete global command {cmd}. Please clean up manually", cmdId); + } return commands.NotEmptyAndNotNull() ? commands : null; } @@ -173,32 +187,37 @@ internal static async Task> RegisterGlobalComman /// The target guild id. /// The command list. /// A list of registered commands. - internal static async Task> RegisterGuildCommandsAsync(DiscordClient client, ulong guildId, List commands) + internal static async Task?> RegisterGuildCommandsAsync( + DiscordClient client, ulong guildId, List commands + ) { var (changedCommands, unchangedCommands) = BuildGuildOverwriteList(client, guildId, commands); - var guildCommandsCreateList = BuildGuildCreateList(client, guildId, commands); - var guildCommandsDeleteList = BuildGuildDeleteList(client, guildId, commands); + var guildCommandsCreateList = BuildGuildCreateList(guildId, commands); + var guildCommandsDeleteList = BuildGuildDeleteList(guildId, commands); - if (guildCommandsCreateList.NotEmptyAndNotNull() && unchangedCommands.NotEmptyAndNotNull() && changedCommands.NotEmptyAndNotNull()) + if (guildCommandsCreateList.NotEmptyAndNotNull() && unchangedCommands.NotEmptyAndNotNull() && + changedCommands.NotEmptyAndNotNull()) { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, @"[AC GUILD] Creating, re-using and overwriting application commands. Guild ID: {guild}", guildId); + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + @"[AC GUILD] Creating, re-using and overwriting application commands. Guild ID: {guild}", + guildId); - foreach (var cmd in guildCommandsCreateList) + foreach (var cmd in guildCommandsCreateList!) { - var discordBackendCommand = await client.CreateGuildApplicationCommandAsync(guildId, cmd).ConfigureAwait(false); + var discordBackendCommand = + await client.CreateGuildApplicationCommandAsync(guildId, cmd).ConfigureAwait(false); commands.Add(discordBackendCommand); } - foreach (var cmd in changedCommands) + foreach (var (key, command) in changedCommands) { - var command = cmd.Value; - var discordBackendCommand = await client.EditGuildApplicationCommandAsync(guildId, cmd.Key, action => + var discordBackendCommand = await client.EditGuildApplicationCommandAsync(guildId, key, action => { action.Name = command.Name; action.NameLocalizations = command.NameLocalizations; action.Description = command.Description; action.DescriptionLocalizations = command.DescriptionLocalizations; - if(command.Options != null && command.Options.Any()) + if (command.Options != null && command.Options.Any()) action.Options = Optional.Some(command.Options); action.DefaultMemberPermissions = command.DefaultMemberPermissions; action.DmPermission = command.DmPermission ?? true; @@ -211,27 +230,30 @@ internal static async Task> RegisterGuildCommand commands.AddRange(unchangedCommands); } - else if (guildCommandsCreateList.NotEmptyAndNotNull() && (unchangedCommands.NotEmptyAndNotNull() || changedCommands.NotEmptyAndNotNull())) + else if (guildCommandsCreateList.NotEmptyAndNotNull() && + (unchangedCommands.NotEmptyAndNotNull() || changedCommands.NotEmptyAndNotNull())) { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, @"[AC GUILD] Creating, re-using and overwriting application commands. Guild ID: {guild}", guildId); + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + @"[AC GUILD] Creating, re-using and overwriting application commands. Guild ID: {guild}", + guildId); - foreach (var cmd in guildCommandsCreateList) + foreach (var cmd in guildCommandsCreateList!) { - var discordBackendCommand = await client.CreateGuildApplicationCommandAsync(guildId, cmd).ConfigureAwait(false); + var discordBackendCommand = + await client.CreateGuildApplicationCommandAsync(guildId, cmd).ConfigureAwait(false); commands.Add(discordBackendCommand); } if (changedCommands.NotEmptyAndNotNull()) - foreach (var cmd in changedCommands) + foreach (var (key, command) in changedCommands) { - var command = cmd.Value; - var discordBackendCommand = await client.EditGuildApplicationCommandAsync(guildId, cmd.Key, action => + var discordBackendCommand = await client.EditGuildApplicationCommandAsync(guildId, key, action => { action.Name = command.Name; action.NameLocalizations = command.NameLocalizations; action.Description = command.Description; action.DescriptionLocalizations = command.DescriptionLocalizations; - if(command.Options != null && command.Options.Any()) + if (command.Options != null && command.Options.Any()) action.Options = Optional.Some(command.Options); action.DefaultMemberPermissions = command.DefaultMemberPermissions; action.DmPermission = command.DmPermission ?? true; @@ -245,20 +267,21 @@ internal static async Task> RegisterGuildCommand if (unchangedCommands.NotEmptyAndNotNull()) commands.AddRange(unchangedCommands); } - else if (guildCommandsCreateList.EmptyOrNull() && unchangedCommands.NotEmptyAndNotNull() && changedCommands.NotEmptyAndNotNull()) + else if (guildCommandsCreateList.EmptyOrNull() && unchangedCommands.NotEmptyAndNotNull() && + changedCommands.NotEmptyAndNotNull()) { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, @"[AC GUILD] Editing & re-using application commands. Guild ID: {guild}", guildId); + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + @"[AC GUILD] Editing & re-using application commands. Guild ID: {guild}", guildId); - foreach (var cmd in changedCommands) + foreach (var (key, command) in changedCommands) { - var command = cmd.Value; - var discordBackendCommand = await client.EditGuildApplicationCommandAsync(guildId, cmd.Key, action => + var discordBackendCommand = await client.EditGuildApplicationCommandAsync(guildId, key, action => { action.Name = command.Name; action.NameLocalizations = command.NameLocalizations; action.Description = command.Description; action.DescriptionLocalizations = command.DescriptionLocalizations; - if(command.Options != null && command.Options.Any()) + if (command.Options != null && command.Options.Any()) action.Options = Optional.Some(command.Options); if (command.DefaultMemberPermissions.HasValue) action.DefaultMemberPermissions = command.DefaultMemberPermissions.Value; @@ -273,47 +296,60 @@ internal static async Task> RegisterGuildCommand commands.AddRange(unchangedCommands); } - else if (guildCommandsCreateList.EmptyOrNull() && changedCommands.NotEmptyAndNotNull() && unchangedCommands.EmptyOrNull()) + else if (guildCommandsCreateList.EmptyOrNull() && changedCommands.NotEmptyAndNotNull() && + unchangedCommands.EmptyOrNull()) { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, @"[AC GUILD] Overwriting all application commands. Guild ID: {guild}", guildId); + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + @"[AC GUILD] Overwriting all application commands. Guild ID: {guild}", guildId); List overwriteList = new(); - foreach (var overwrite in changedCommands) + foreach (var (key, cmd) in changedCommands) { - var cmd = overwrite.Value; - cmd.Id = overwrite.Key; + cmd.Id = key; overwriteList.Add(cmd); } - var discordBackendCommands = await client.BulkOverwriteGuildApplicationCommandsAsync(guildId, overwriteList).ConfigureAwait(false); + + var discordBackendCommands = await client.BulkOverwriteGuildApplicationCommandsAsync(guildId, overwriteList) + .ConfigureAwait(false); commands.AddRange(discordBackendCommands); } - else if (guildCommandsCreateList.NotEmptyAndNotNull() && changedCommands.EmptyOrNull() && unchangedCommands.EmptyOrNull()) + else if (guildCommandsCreateList.NotEmptyAndNotNull() && changedCommands.EmptyOrNull() && + unchangedCommands.EmptyOrNull()) { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, @"[AC GUILD] Creating all application commands. Guild ID: {guild}", guildId); + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + @"[AC GUILD] Creating all application commands. Guild ID: {guild}", guildId); - var cmds = await client.BulkOverwriteGuildApplicationCommandsAsync(guildId, guildCommandsCreateList).ConfigureAwait(false); + var cmds = await client.BulkOverwriteGuildApplicationCommandsAsync(guildId, guildCommandsCreateList) + .ConfigureAwait(false); commands.AddRange(cmds); } - else if (guildCommandsCreateList.EmptyOrNull() && changedCommands.EmptyOrNull() && unchangedCommands.NotEmptyAndNotNull()) + else if (guildCommandsCreateList.EmptyOrNull() && changedCommands.EmptyOrNull() && + unchangedCommands.NotEmptyAndNotNull()) { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, @"[AC GUILD] Re-using all application commands Guild ID: {guild}.", guildId); + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + @"[AC GUILD] Re-using all application commands Guild ID: {guild}.", guildId); commands.AddRange(unchangedCommands); } - if (guildCommandsDeleteList.NotEmptyAndNotNull()) - foreach (var cmdId in guildCommandsDeleteList) + if (!guildCommandsDeleteList.NotEmptyAndNotNull()) + return commands.NotEmptyAndNotNull() ? commands : null; + + foreach (var cmdId in guildCommandsDeleteList!) + { + client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, + @"[AC GUILD] Deleting missing application commands. Guild ID: {guild}", guildId); + try { - client.Logger.Log(ApplicationCommandsExtension.ApplicationCommandsLogLevel, @"[AC GUILD] Deleting missing application commands. Guild ID: {guild}", guildId); - try - { - await client.DeleteGuildApplicationCommandAsync(guildId, cmdId).ConfigureAwait(false); - } - catch (NotFoundException) - { - client.Logger.LogError(@"Could not delete guild command {cmd} in guild {guild}. Please clean up manually", cmdId, guildId); - } + await client.DeleteGuildApplicationCommandAsync(guildId, cmdId).ConfigureAwait(false); } + catch (NotFoundException) + { + client.Logger + .LogError(@"Could not delete guild command {cmd} in guild {guild}. Please clean up manually", cmdId, + guildId); + } + } return commands.NotEmptyAndNotNull() ? commands : null; } @@ -321,15 +357,20 @@ internal static async Task> RegisterGuildCommand /// /// Builds a list of guild command ids to be deleted on discords backend. /// - /// The discord client. /// The guild id these commands belong to. /// The command list. /// A list of command ids. - private static List BuildGuildDeleteList(DiscordClient client, ulong guildId, List updateList) + private static List? BuildGuildDeleteList( + ulong guildId, + IReadOnlyCollection? updateList + ) { - - if (ApplicationCommandsExtension.GuildDiscordCommands == null || !ApplicationCommandsExtension.GuildDiscordCommands.Any() - || !ApplicationCommandsExtension.GuildDiscordCommands.TryGetFirstValueByKey(guildId, out var discord) + if (ApplicationCommandsExtension.GuildDiscordCommands == null || !ApplicationCommandsExtension + .GuildDiscordCommands.Any() + || !ApplicationCommandsExtension + .GuildDiscordCommands + .TryGetFirstValueByKey(guildId, + out var discord) ) return null; @@ -339,12 +380,11 @@ private static List BuildGuildDeleteList(DiscordClient client, ulong guil return null; if (updateList == null) - foreach (var cmd in discord) - invalidCommandIds.Add(cmd.Id); + invalidCommandIds.AddRange(discord.Select(cmd => cmd.Id)); else - foreach (var cmd in discord) - if (!updateList.Any(ul => ul.Name == cmd.Name)) - invalidCommandIds.Add(cmd.Id); + invalidCommandIds.AddRange(from cmd in discord + where updateList.All(ul => ul.Name != cmd.Name) + select cmd.Id); return invalidCommandIds; } @@ -352,29 +392,19 @@ private static List BuildGuildDeleteList(DiscordClient client, ulong guil /// /// Builds a list of guild commands to be created on discords backend. /// - /// The discord client. /// The guild id these commands belong to. /// The command list. /// - private static List BuildGuildCreateList(DiscordClient client, ulong guildId, List updateList) - { - - if (ApplicationCommandsExtension.GuildDiscordCommands == null || !ApplicationCommandsExtension.GuildDiscordCommands.Any() - || updateList == null || !ApplicationCommandsExtension.GuildDiscordCommands.TryGetFirstValueByKey(guildId, out var discord) - ) - return updateList; - - List newCommands = new(); - - if (discord == null) - return updateList; - - foreach (var cmd in updateList) - if (discord.All(d => d.Name != cmd.Name)) - newCommands.Add(cmd); - - return newCommands; - } + private static List? BuildGuildCreateList( + ulong guildId, List? updateList + ) => + ApplicationCommandsExtension.GuildDiscordCommands == null || + !ApplicationCommandsExtension.GuildDiscordCommands.Any() || updateList == null || + !ApplicationCommandsExtension.GuildDiscordCommands.TryGetFirstValueByKey(guildId, out var discord) + ? updateList + : discord == null + ? updateList + : updateList.Where(cmd => discord.All(d => d.Name != cmd.Name)).ToList(); /// /// Builds a list of guild commands to be overwritten on discords backend. @@ -384,14 +414,20 @@ private static List BuildGuildCreateList(DiscordClien /// The command list. /// A dictionary of command id and command. private static ( - Dictionary changedCommands, - List unchangedCommands - ) BuildGuildOverwriteList(DiscordClient client, ulong guildId, List updateList) + Dictionary? changedCommands, + List? unchangedCommands + ) BuildGuildOverwriteList(DiscordClient client, ulong guildId, List? updateList) { - - if (ApplicationCommandsExtension.GuildDiscordCommands == null || !ApplicationCommandsExtension.GuildDiscordCommands.Any() - || ApplicationCommandsExtension.GuildDiscordCommands.All(l => l.Key != guildId) || updateList == null - || !ApplicationCommandsExtension.GuildDiscordCommands.TryGetFirstValueByKey(guildId, out var discord) + if (ApplicationCommandsExtension.GuildDiscordCommands == null || !ApplicationCommandsExtension + .GuildDiscordCommands.Any() + || ApplicationCommandsExtension + .GuildDiscordCommands + .All(l => l.Key != guildId) || + updateList == null + || !ApplicationCommandsExtension + .GuildDiscordCommands + .TryGetFirstValueByKey(guildId, + out var discord) ) return (null, null); @@ -425,12 +461,12 @@ List unchangedCommands /// /// Builds a list of global command ids to be deleted on discords backend. /// - /// The discord client. /// The command list. /// A list of command ids. - private static List BuildGlobalDeleteList(DiscordClient client, List updateList = null) + private static List? BuildGlobalDeleteList(IReadOnlyCollection? updateList = null) { - if (ApplicationCommandsExtension.GlobalDiscordCommands == null || !ApplicationCommandsExtension.GlobalDiscordCommands.Any()) + if (ApplicationCommandsExtension.GlobalDiscordCommands == null || + !ApplicationCommandsExtension.GlobalDiscordCommands.Any()) return null; var discord = ApplicationCommandsExtension.GlobalDiscordCommands; @@ -441,12 +477,11 @@ private static List BuildGlobalDeleteList(DiscordClient client, List cmd.Id)); else - foreach (var cmd in discord) - if (updateList.All(ul => ul.Name != cmd.Name)) - invalidCommandIds.Add(cmd.Id); + invalidCommandIds.AddRange(from cmd in discord + where updateList.All(ul => ul.Name != cmd.Name) + select cmd.Id); return invalidCommandIds; } @@ -454,26 +489,17 @@ private static List BuildGlobalDeleteList(DiscordClient client, List /// Builds a list of global commands to be created on discords backend. /// - /// The discord client. /// The command list. /// A list of commands. - private static List BuildGlobalCreateList(DiscordClient client, List updateList) + private static List? BuildGlobalCreateList(List? updateList) { - if (ApplicationCommandsExtension.GlobalDiscordCommands == null || !ApplicationCommandsExtension.GlobalDiscordCommands.Any() || updateList == null) + if (ApplicationCommandsExtension.GlobalDiscordCommands == null || + !ApplicationCommandsExtension.GlobalDiscordCommands.Any() || updateList == null) return updateList; var discord = ApplicationCommandsExtension.GlobalDiscordCommands; - List newCommands = new(); - - if (discord == null) - return updateList; - - foreach (var cmd in updateList) - if (discord.All(d => d.Name != cmd.Name)) - newCommands.Add(cmd); - - return newCommands; + return discord == null ? updateList : updateList.Where(cmd => discord.All(d => d.Name != cmd.Name)).ToList(); } /// @@ -483,11 +509,12 @@ private static List BuildGlobalCreateList(DiscordClie /// The command list. /// A dictionary of command ids and commands. private static ( - Dictionary changedCommands, - List unchangedCommands - ) BuildGlobalOverwriteList(DiscordClient client, List updateList) + Dictionary? changedCommands, + List? unchangedCommands + ) BuildGlobalOverwriteList(DiscordClient client, List? updateList) { - if (ApplicationCommandsExtension.GlobalDiscordCommands == null || !ApplicationCommandsExtension.GlobalDiscordCommands.Any() || updateList == null) + if (ApplicationCommandsExtension.GlobalDiscordCommands == null || + !ApplicationCommandsExtension.GlobalDiscordCommands.Any() || updateList == null) return (null, null); var discord = ApplicationCommandsExtension.GlobalDiscordCommands; diff --git a/DisCatSharp.Attributes/DeprecatedAttribute.cs b/DisCatSharp.Attributes/DeprecatedAttribute.cs index 8a3cb972f..d0758cea1 100644 --- a/DisCatSharp.Attributes/DeprecatedAttribute.cs +++ b/DisCatSharp.Attributes/DeprecatedAttribute.cs @@ -1,4 +1,3 @@ - using System; namespace DisCatSharp.Attributes; diff --git a/DisCatSharp.Attributes/DisCatSharp.Attributes.csproj b/DisCatSharp.Attributes/DisCatSharp.Attributes.csproj index 529d05474..2bcf36be4 100644 --- a/DisCatSharp.Attributes/DisCatSharp.Attributes.csproj +++ b/DisCatSharp.Attributes/DisCatSharp.Attributes.csproj @@ -1,29 +1,30 @@ + - - - + + + - - netstandard2.0 - True + + netstandard2.0 + True Library - 10.4.2 - + 10.4.2 + + + + DisCatSharp.Attributes + DisCatSharp.Attributes + - - DisCatSharp.Attributes - DisCatSharp.Attributes - - - - DisCatSharp.Attributes - - DisCatSharp.Attributes + + DisCatSharp.Attributes + + DisCatSharp.Attributes - Special Attributes for DisCatSharp. - - DisCatSharp - + Special Attributes for DisCatSharp. + + DisCatSharp + diff --git a/DisCatSharp.Attributes/DiscordDeprecatedAttribute.cs b/DisCatSharp.Attributes/DiscordDeprecatedAttribute.cs index ac595b1ef..c51d37e83 100644 --- a/DisCatSharp.Attributes/DiscordDeprecatedAttribute.cs +++ b/DisCatSharp.Attributes/DiscordDeprecatedAttribute.cs @@ -1,4 +1,3 @@ - using System; namespace DisCatSharp.Attributes; diff --git a/DisCatSharp.Attributes/DiscordInExperimentAttribute.cs b/DisCatSharp.Attributes/DiscordInExperimentAttribute.cs index f26656a24..cac91f3b8 100644 --- a/DisCatSharp.Attributes/DiscordInExperimentAttribute.cs +++ b/DisCatSharp.Attributes/DiscordInExperimentAttribute.cs @@ -1,4 +1,3 @@ - using System; namespace DisCatSharp.Attributes; diff --git a/DisCatSharp.Attributes/DiscordUnreleasedAttribute.cs b/DisCatSharp.Attributes/DiscordUnreleasedAttribute.cs index 2586300c6..6374c5743 100644 --- a/DisCatSharp.Attributes/DiscordUnreleasedAttribute.cs +++ b/DisCatSharp.Attributes/DiscordUnreleasedAttribute.cs @@ -1,4 +1,3 @@ - using System; namespace DisCatSharp.Attributes; diff --git a/DisCatSharp.Attributes/ExperimentalAttribute.cs b/DisCatSharp.Attributes/ExperimentalAttribute.cs index 5ff222e14..c6a99a5ad 100644 --- a/DisCatSharp.Attributes/ExperimentalAttribute.cs +++ b/DisCatSharp.Attributes/ExperimentalAttribute.cs @@ -1,4 +1,3 @@ - using System; namespace DisCatSharp.Attributes; diff --git a/DisCatSharp.Attributes/Features.cs b/DisCatSharp.Attributes/Features.cs index 2d39ba0b2..57ac9d82d 100644 --- a/DisCatSharp.Attributes/Features.cs +++ b/DisCatSharp.Attributes/Features.cs @@ -1,4 +1,3 @@ - using System; namespace DisCatSharp.Attributes; @@ -9,29 +8,28 @@ namespace DisCatSharp.Attributes; [Flags] public enum Features : long { - [FeatureDescription("Required that you specify an override in the DiscordConfiguration.")] - Override = 1<<0, + [FeatureDescription("Requires that you specify an override in the DiscordConfiguration.")] + Override = 1 << 0, - [FeatureDescription("Required that the guild has onboarding enabled.")] - Onboarding = 1<<1, + [FeatureDescription("Requires that the guild has onboarding enabled.")] + Onboarding = 1 << 1, - [FeatureDescription("Required that the guild is partnered.")] - Partnered = 1<<2, + [FeatureDescription("Requires that the guild is partnered.")] + Partnered = 1 << 2, - [FeatureDescription("Required that the guild is verified.")] - Verified = 1<<3, + [FeatureDescription("Requires that the guild is verified.")] + Verified = 1 << 3, - [FeatureDescription("Required that the guild has discovery enabled.")] - Discoverable = 1<<4, + [FeatureDescription("Requires that the guild has discovery enabled.")] + Discoverable = 1 << 4, - [FeatureDescription("Required that the guild has community enabled.")] - Community = 1<<5, + [FeatureDescription("Requires that the guild has community enabled.")] + Community = 1 << 5, - [FeatureDescription("Required that the guild has monetization enabled.")] - ServerSubscription = 1<<6 + [FeatureDescription("Requires that the guild has monetization enabled.")] + ServerSubscription = 1 << 6 } - /// /// Defines a readable name for this feature requirement. /// diff --git a/DisCatSharp.Attributes/Properties/AssemblyProperties.cs b/DisCatSharp.Attributes/Properties/AssemblyProperties.cs index 0d5cb60ed..8c6b93f3c 100644 --- a/DisCatSharp.Attributes/Properties/AssemblyProperties.cs +++ b/DisCatSharp.Attributes/Properties/AssemblyProperties.cs @@ -1,4 +1,3 @@ - using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("DisCatSharp")] diff --git a/DisCatSharp.Attributes/RequiresFeatureAttribute.cs b/DisCatSharp.Attributes/RequiresFeatureAttribute.cs index b53615678..023b73a91 100644 --- a/DisCatSharp.Attributes/RequiresFeatureAttribute.cs +++ b/DisCatSharp.Attributes/RequiresFeatureAttribute.cs @@ -1,4 +1,3 @@ - using System; namespace DisCatSharp.Attributes; diff --git a/DisCatSharp.CommandsNext/Attributes/AliasesAttribute.cs b/DisCatSharp.CommandsNext/Attributes/AliasesAttribute.cs index 73371cc1d..1656bdfcd 100644 --- a/DisCatSharp.CommandsNext/Attributes/AliasesAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/AliasesAttribute.cs @@ -23,7 +23,8 @@ public sealed class AliasesAttribute : Attribute public AliasesAttribute(params string[] aliases) { if (aliases.Any(xa => xa == null || xa.Any(xc => char.IsWhiteSpace(xc)))) - throw new ArgumentException("Aliases cannot contain whitespace characters or null strings.", nameof(aliases)); + throw new ArgumentException("Aliases cannot contain whitespace characters or null strings.", + nameof(aliases)); this.Aliases = new ReadOnlyCollection(aliases); } diff --git a/DisCatSharp.CommandsNext/Attributes/CooldownAttribute.cs b/DisCatSharp.CommandsNext/Attributes/CooldownAttribute.cs index 700ec7c19..6656207b3 100644 --- a/DisCatSharp.CommandsNext/Attributes/CooldownAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/CooldownAttribute.cs @@ -43,7 +43,7 @@ public CooldownAttribute(int maxUses, double resetAfter, CooldownBucketType buck this.MaxUses = maxUses; this.Reset = TimeSpan.FromSeconds(resetAfter); this.BucketType = bucketType; - this._buckets = new ConcurrentDictionary(); + this._buckets = new(); } /// @@ -66,7 +66,11 @@ public CommandCooldownBucket GetBucket(CommandContext ctx) public TimeSpan GetRemainingCooldown(CommandContext ctx) { var bucket = this.GetBucket(ctx); - return bucket == null ? TimeSpan.Zero : bucket.RemainingUses > 0 ? TimeSpan.Zero : bucket.ResetsAt - DateTimeOffset.UtcNow; + return bucket == null + ? TimeSpan.Zero + : bucket.RemainingUses > 0 + ? TimeSpan.Zero + : bucket.ResetsAt - DateTimeOffset.UtcNow; } /// @@ -110,7 +114,7 @@ public override async Task ExecuteCheckAsync(CommandContext ctx, bool help var bid = this.GetBucketId(ctx, out var usr, out var chn, out var gld); if (!this._buckets.TryGetValue(bid, out var bucket)) { - bucket = new CommandCooldownBucket(this.MaxUses, this.Reset, usr, chn, gld); + bucket = new(this.MaxUses, this.Reset, usr, chn, gld); this._buckets.AddOrUpdate(bid, bucket, (k, v) => bucket); } @@ -205,7 +209,10 @@ public int RemainingUses /// ID of the user with which this cooldown is associated. /// ID of the channel with which this cooldown is associated. /// ID of the guild with which this cooldown is associated. - internal CommandCooldownBucket(int maxUses, TimeSpan resetAfter, ulong userId = 0, ulong channelId = 0, ulong guildId = 0) + internal CommandCooldownBucket( + int maxUses, TimeSpan resetAfter, ulong userId = 0, ulong channelId = 0, + ulong guildId = 0 + ) { this._remainingUses = maxUses; this.MaxUses = maxUses; @@ -215,7 +222,7 @@ internal CommandCooldownBucket(int maxUses, TimeSpan resetAfter, ulong userId = this.ChannelId = channelId; this.GuildId = guildId; this.BucketId = MakeId(userId, channelId, guildId); - this._usageSemaphore = new SemaphoreSlim(1, 1); + this._usageSemaphore = new(1, 1); } /// @@ -267,7 +274,11 @@ internal async Task DecrementUseAsync() /// /// to compare to. /// Whether the is equal to this . - public bool Equals(CommandCooldownBucket other) => other is not null && (ReferenceEquals(this, other) || (this.UserId == other.UserId && this.ChannelId == other.ChannelId && this.GuildId == other.GuildId)); + public bool Equals(CommandCooldownBucket other) => other is not null && + (ReferenceEquals(this, other) || + (this.UserId == other.UserId && + this.ChannelId == other.ChannelId && + this.GuildId == other.GuildId)); /// /// Gets the hash code for this . diff --git a/DisCatSharp.CommandsNext/Attributes/RequireBoostingAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireBoostingAttribute.cs index 09455ebcb..84c20012d 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireBoostingAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireBoostingAttribute.cs @@ -51,11 +51,15 @@ public override async Task ExecuteCheckAsync(CommandContext ctx, bool help { var guild = await ctx.Client.GetGuildAsync(this.GuildId).ConfigureAwait(false); var member = await guild.GetMemberAsync(ctx.User.Id).ConfigureAwait(false); - return member != null && member.PremiumSince.HasValue ? await Task.FromResult(member.PremiumSince.Value.UtcDateTime.Date < DateTime.UtcNow.Date.AddDays(-this.Since)).ConfigureAwait(false) : await Task.FromResult(false).ConfigureAwait(false); + return member != null && member.PremiumSince.HasValue + ? await Task.FromResult(member.PremiumSince.Value.UtcDateTime.Date < + DateTime.UtcNow.Date.AddDays(-this.Since)).ConfigureAwait(false) + : await Task.FromResult(false).ConfigureAwait(false); } else - { - return ctx.Member != null && ctx.Member.PremiumSince.HasValue ? await Task.FromResult(ctx.Member.PremiumSince.Value.UtcDateTime.Date < DateTime.UtcNow.Date.AddDays(-this.Since)).ConfigureAwait(false) : await Task.FromResult(false).ConfigureAwait(false); - } + return ctx.Member != null && ctx.Member.PremiumSince.HasValue + ? await Task.FromResult(ctx.Member.PremiumSince.Value.UtcDateTime.Date < + DateTime.UtcNow.Date.AddDays(-this.Since)).ConfigureAwait(false) + : await Task.FromResult(false).ConfigureAwait(false); } } diff --git a/DisCatSharp.CommandsNext/Attributes/RequireBotPermissionsAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireBotPermissionsAttribute.cs index 86ccad62a..5eb25b54a 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireBotPermissionsAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireBotPermissionsAttribute.cs @@ -51,9 +51,7 @@ public override async Task ExecuteCheckAsync(CommandContext ctx, bool help var channel = ctx.Channel; if (ctx.Channel.GuildId == null) - { channel = await ctx.Client.GetChannelAsync(ctx.Channel.Id, true).ConfigureAwait(false); - } var pbot = channel.PermissionsFor(bot); return (pbot & Permissions.Administrator) != 0 || (pbot & this.Permissions) == this.Permissions; diff --git a/DisCatSharp.CommandsNext/Attributes/RequireCertifiedModeratorAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireCertifiedModeratorAttribute.cs index 39ec027c7..f0a01f6ab 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireCertifiedModeratorAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireCertifiedModeratorAttribute.cs @@ -16,5 +16,8 @@ public sealed class RequireCertifiedModeratorAttribute : CheckBaseAttribute /// /// The command context. /// If true, help - returns true. - public override Task ExecuteCheckAsync(CommandContext ctx, bool help) => ctx.User.Flags.HasValue ? Task.FromResult(ctx.User.Flags.Value.HasFlag(UserFlags.CertifiedModerator)) : Task.FromResult(false); + public override Task ExecuteCheckAsync(CommandContext ctx, bool help) + => ctx.User.Flags.HasValue + ? Task.FromResult(ctx.User.Flags.Value.HasFlag(UserFlags.CertifiedModerator)) + : Task.FromResult(false); } diff --git a/DisCatSharp.CommandsNext/Attributes/RequireCommunityAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireCommunityAttribute.cs index c90e19d73..961866567 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireCommunityAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireCommunityAttribute.cs @@ -21,5 +21,6 @@ public RequireCommunityAttribute() /// /// The command context. /// If true, help - returns true. - public override Task ExecuteCheckAsync(CommandContext ctx, bool help) => Task.FromResult(ctx.Guild != null && ctx.Guild.IsCommunity); + public override Task ExecuteCheckAsync(CommandContext ctx, bool help) + => Task.FromResult(ctx.Guild != null && ctx.Guild.IsCommunity); } diff --git a/DisCatSharp.CommandsNext/Attributes/RequireDirectMessageAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireDirectMessageAttribute.cs index 42a5dbfbb..afc765388 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireDirectMessageAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireDirectMessageAttribute.cs @@ -8,7 +8,6 @@ namespace DisCatSharp.CommandsNext.Attributes; /// /// Defines that a command is only usable within a direct message channel. /// - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)] public sealed class RequireDirectMessageAttribute : CheckBaseAttribute { diff --git a/DisCatSharp.CommandsNext/Attributes/RequireGuildOwnerAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireGuildOwnerAttribute.cs index d23c98774..3dc28080c 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireGuildOwnerAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireGuildOwnerAttribute.cs @@ -24,8 +24,6 @@ public override async Task ExecuteCheckAsync(CommandContext ctx, bool help return owner; } else - { return false; - } } } diff --git a/DisCatSharp.CommandsNext/Attributes/RequireMemberVerificationGateAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireMemberVerificationGateAttribute.cs index 2e981ec2d..fc867303c 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireMemberVerificationGateAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireMemberVerificationGateAttribute.cs @@ -18,5 +18,6 @@ public RequireMemberVerificationGateAttribute() /// /// The command context. /// If true, help - returns true. - public override Task ExecuteCheckAsync(CommandContext ctx, bool help) => Task.FromResult(ctx.Guild != null && ctx.Guild.HasMemberVerificationGate); + public override Task ExecuteCheckAsync(CommandContext ctx, bool help) + => Task.FromResult(ctx.Guild != null && ctx.Guild.HasMemberVerificationGate); } diff --git a/DisCatSharp.CommandsNext/Attributes/RequireOwnerAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireOwnerAttribute.cs index 2adb98326..91f0dd2b2 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireOwnerAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireOwnerAttribute.cs @@ -20,6 +20,8 @@ public override Task ExecuteCheckAsync(CommandContext ctx, bool help) var app = ctx.Client.CurrentApplication; var me = ctx.Client.CurrentUser; - return app != null ? Task.FromResult(app.Owners.Any(x => x.Id == ctx.User.Id)) : Task.FromResult(ctx.User.Id == me.Id); + return app != null + ? Task.FromResult(app.Owners.Any(x => x.Id == ctx.User.Id)) + : Task.FromResult(ctx.User.Id == me.Id); } } diff --git a/DisCatSharp.CommandsNext/Attributes/RequireOwnerOrIdAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireOwnerOrIdAttribute.cs index eecb79da7..4ffb6950e 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireOwnerOrIdAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireOwnerOrIdAttribute.cs @@ -36,11 +36,12 @@ public override async Task ExecuteCheckAsync(CommandContext ctx, bool help var app = ctx.Client.CurrentApplication; var me = ctx.Client.CurrentUser; - var owner = app != null ? await Task.FromResult(app.Owners.Any(x => x.Id == ctx.User.Id)).ConfigureAwait(false) : await Task.FromResult(ctx.User.Id == me.Id).ConfigureAwait(false); + var owner = app != null + ? await Task.FromResult(app.Owners.Any(x => x.Id == ctx.User.Id)).ConfigureAwait(false) + : await Task.FromResult(ctx.User.Id == me.Id).ConfigureAwait(false); var allowed = this.UserIds.Contains(ctx.User.Id); return owner || allowed; - } } diff --git a/DisCatSharp.CommandsNext/Attributes/RequirePermissionsAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequirePermissionsAttribute.cs index d386a58ef..616266240 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequirePermissionsAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequirePermissionsAttribute.cs @@ -44,18 +44,18 @@ public override async Task ExecuteCheckAsync(CommandContext ctx, bool help var channel = ctx.Channel; if (ctx.Channel.GuildId == null) - { channel = await ctx.Client.GetChannelAsync(ctx.Channel.Id, true).ConfigureAwait(false); - } var usr = ctx.Member; if (usr == null) return false; + var pusr = channel.PermissionsFor(usr); var bot = await ctx.Guild.GetMemberAsync(ctx.Client.CurrentUser.Id).ConfigureAwait(false); if (bot == null) return false; + var pbot = channel.PermissionsFor(bot); var usrok = ctx.Guild.OwnerId == usr.Id; diff --git a/DisCatSharp.CommandsNext/Attributes/RequirePrefixesAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequirePrefixesAttribute.cs index 800134bca..000fe3725 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequirePrefixesAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequirePrefixesAttribute.cs @@ -39,5 +39,6 @@ public RequirePrefixesAttribute(params string[] prefixes) /// The command context. /// If true, help - returns true. public override Task ExecuteCheckAsync(CommandContext ctx, bool help) - => Task.FromResult((help && this.ShowInHelp) || this.Prefixes.Contains(ctx.Prefix, ctx.CommandsNext.GetStringComparer())); + => Task.FromResult((help && this.ShowInHelp) || + this.Prefixes.Contains(ctx.Prefix, ctx.CommandsNext.GetStringComparer())); } diff --git a/DisCatSharp.CommandsNext/Attributes/RequireReferencedMessageAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireReferencedMessageAttribute.cs index 46d6d7ee4..6f63e33ad 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireReferencedMessageAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireReferencedMessageAttribute.cs @@ -14,5 +14,5 @@ public RequireReferencedMessageAttribute() { } public override Task ExecuteCheckAsync(CommandContext ctx, bool help) - => Task.FromResult(help || ctx.Message.ReferencedMessage != null); + => Task.FromResult(help || ctx.Message.ReferencedMessage is not null); } diff --git a/DisCatSharp.CommandsNext/Attributes/RequireRolesAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireRolesAttribute.cs index bb5e2c044..2d1587700 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireRolesAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireRolesAttribute.cs @@ -53,7 +53,7 @@ public override Task ExecuteCheckAsync(CommandContext ctx, bool help) RoleCheckMode.All => Task.FromResult(this.RoleNames.Count == inc), RoleCheckMode.SpecifiedOnly => Task.FromResult(rnc == inc), RoleCheckMode.None => Task.FromResult(inc == 0), - _ => Task.FromResult(inc > 0), + _ => Task.FromResult(inc > 0) }; } } diff --git a/DisCatSharp.CommandsNext/Attributes/RequireStaffAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireStaffAttribute.cs index e9994a579..e773b5220 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireStaffAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireStaffAttribute.cs @@ -16,5 +16,8 @@ public sealed class RequireStaffAttribute : CheckBaseAttribute /// /// The command context. /// If true, help - returns true. - public override Task ExecuteCheckAsync(CommandContext ctx, bool help) => ctx.User.Flags.HasValue ? Task.FromResult(ctx.User.Flags.Value.HasFlag(UserFlags.Staff)) : Task.FromResult(false); + public override Task ExecuteCheckAsync(CommandContext ctx, bool help) + => ctx.User.Flags.HasValue + ? Task.FromResult(ctx.User.Flags.Value.HasFlag(UserFlags.Staff)) + : Task.FromResult(false); } diff --git a/DisCatSharp.CommandsNext/Attributes/RequireUserPermissionsAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireUserPermissionsAttribute.cs index 8ce5eca6f..239a76d25 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireUserPermissionsAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireUserPermissionsAttribute.cs @@ -19,13 +19,12 @@ public sealed class RequireUserPermissionsAttribute : CheckBaseAttribute /// /// Gets or sets this check's behaviour in DMs. True means the check will always pass in DMs, whereas false means that it will always fail. /// - public bool IgnoreDms { get; } = true; + public bool IgnoreDms { get; } /// /// Defines that usage of this command is restricted to members with specified permissions. /// /// Permissions required to execute this command. - /// Sets this check's behaviour in DMs. True means the check will always pass in DMs, whereas false means that it will always fail. public RequireUserPermissionsAttribute(Permissions permissions, bool ignoreDms = true) { @@ -52,9 +51,10 @@ public override Task ExecuteCheckAsync(CommandContext ctx, bool help) var pusr = ctx.Channel.PermissionsFor(usr); - if ((pusr & Permissions.Administrator) != 0) - return Task.FromResult(true); - - return (pusr & this.Permissions) == this.Permissions ? Task.FromResult(true) : Task.FromResult(false); + return (pusr & Permissions.Administrator) != 0 + ? Task.FromResult(true) + : (pusr & this.Permissions) == this.Permissions + ? Task.FromResult(true) + : Task.FromResult(false); } } diff --git a/DisCatSharp.CommandsNext/Attributes/RequireWelcomeScreenAttribute.cs b/DisCatSharp.CommandsNext/Attributes/RequireWelcomeScreenAttribute.cs index c219c8f3d..549f9b51d 100644 --- a/DisCatSharp.CommandsNext/Attributes/RequireWelcomeScreenAttribute.cs +++ b/DisCatSharp.CommandsNext/Attributes/RequireWelcomeScreenAttribute.cs @@ -20,5 +20,6 @@ public RequireWelcomeScreenAttribute() /// /// The command context. /// If true, help - returns true. - public override Task ExecuteCheckAsync(CommandContext ctx, bool help) => Task.FromResult(ctx.Guild != null && ctx.Guild.HasWelcomeScreen); + public override Task ExecuteCheckAsync(CommandContext ctx, bool help) + => Task.FromResult(ctx.Guild != null && ctx.Guild.HasWelcomeScreen); } diff --git a/DisCatSharp.CommandsNext/CommandsNextExtension.cs b/DisCatSharp.CommandsNext/CommandsNextExtension.cs index 1537e483a..0183d8d13 100644 --- a/DisCatSharp.CommandsNext/CommandsNextExtension.cs +++ b/DisCatSharp.CommandsNext/CommandsNextExtension.cs @@ -43,6 +43,7 @@ public class CommandsNextExtension : BaseExtension /// Gets the user friendly type names. /// private readonly Dictionary _userFriendlyTypeNames; + /// /// Gets the argument converters. /// @@ -60,13 +61,13 @@ public IServiceProvider Services /// The cfg. internal CommandsNextExtension(CommandsNextConfiguration cfg) { - this._config = new CommandsNextConfiguration(cfg); - this._topLevelCommands = new Dictionary(); - this._registeredCommandsLazy = new Lazy>(() => new ReadOnlyDictionary(this._topLevelCommands)); - this._helpFormatter = new HelpFormatterFactory(); + this._config = new(cfg); + this._topLevelCommands = new(); + this._registeredCommandsLazy = new(() => new ReadOnlyDictionary(this._topLevelCommands)); + this._helpFormatter = new(); this._helpFormatter.SetFormatterType(); - this.ArgumentConverters = new Dictionary + this.ArgumentConverters = new() { [typeof(string)] = new StringConverter(), [typeof(bool)] = new BoolConverter(), @@ -95,10 +96,10 @@ internal CommandsNextExtension(CommandsNextConfiguration cfg) [typeof(DiscordThreadChannel)] = new DiscordThreadChannelConverter(), [typeof(DiscordInvite)] = new DiscordInviteConverter(), [typeof(DiscordColor)] = new DiscordColorConverter(), - [typeof(DiscordScheduledEvent)] = new DiscordScheduledEventConverter(), + [typeof(DiscordScheduledEvent)] = new DiscordScheduledEventConverter() }; - this._userFriendlyTypeNames = new Dictionary() + this._userFriendlyTypeNames = new() { [typeof(string)] = "string", [typeof(bool)] = "boolean", @@ -148,7 +149,8 @@ internal CommandsNextExtension(CommandsNextConfiguration cfg) var t = this.GetType(); var ms = t.GetTypeInfo().DeclaredMethods; - var m = ms.FirstOrDefault(xm => xm.Name == "ConvertArgumentToObj" && xm.ContainsGenericParameters && !xm.IsStatic && xm.IsPrivate); + var m = ms.FirstOrDefault(xm => xm.Name == "ConvertArgumentToObj" && xm.ContainsGenericParameters && + !xm.IsStatic && xm.IsPrivate); this._convertGeneric = m; } @@ -158,7 +160,8 @@ internal CommandsNextExtension(CommandsNextConfiguration cfg) /// Type of the formatter to use. public void SetHelpFormatter() where T : BaseHelpFormatter => this._helpFormatter.SetFormatterType(); - #region DiscordClient Registration +#region DiscordClient Registration + /// /// DO NOT USE THIS MANUALLY. /// @@ -171,13 +174,14 @@ protected internal override void Setup(DiscordClient client) this.Client = client; - this._executed = new AsyncEvent("COMMAND_EXECUTED", TimeSpan.Zero, this.Client.EventErrorHandler); - this._error = new AsyncEvent("COMMAND_ERRORED", TimeSpan.Zero, this.Client.EventErrorHandler); + this._executed = new("COMMAND_EXECUTED", TimeSpan.Zero, this.Client.EventErrorHandler); + this._error = new("COMMAND_ERRORED", TimeSpan.Zero, this.Client.EventErrorHandler); if (this._config.UseDefaultCommandHandler) this.Client.MessageCreated += this.HandleCommandsAsync; else - this.Client.Logger.LogWarning(CommandsNextEvents.Misc, "Not attaching default command handler - if this is intentional, you can ignore this message"); + this.Client.Logger.LogWarning(CommandsNextEvents.Misc, + "Not attaching default command handler - if this is intentional, you can ignore this message"); if (this._config.EnableDefaultHelp) { @@ -195,11 +199,12 @@ protected internal override void Setup(DiscordClient client) foreach (var xc in tcmds) this.AddToCommandDictionary(xc.Build(null)); } - } - #endregion - #region Command Handling +#endregion + +#region Command Handling + /// /// Handles the commands async. /// @@ -221,7 +226,10 @@ private async Task HandleCommandsAsync(DiscordClient sender, MessageCreateEventA if (this._config.StringPrefixes?.Any() == true) foreach (var pfix in this._config.StringPrefixes) if (mpos == -1 && !string.IsNullOrWhiteSpace(pfix)) - mpos = e.Message.GetStringPrefixLength(pfix, this._config.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase); + mpos = e.Message.GetStringPrefixLength(pfix, + this._config.CaseSensitive + ? StringComparison.Ordinal + : StringComparison.OrdinalIgnoreCase); if (mpos == -1 && this._config.PrefixResolver != null) mpos = await this._config.PrefixResolver(e.Message).ConfigureAwait(false); @@ -239,7 +247,11 @@ private async Task HandleCommandsAsync(DiscordClient sender, MessageCreateEventA var ctx = this.CreateContext(e.Message, pfx, cmd, args); if (cmd == null) { - await this._error.InvokeAsync(this, new CommandErrorEventArgs(this.Client.ServiceProvider) { Context = ctx, Exception = new CommandNotFoundException(fname) }).ConfigureAwait(false); + await this._error.InvokeAsync(this, new(this.Client.ServiceProvider) + { + Context = ctx, + Exception = new CommandNotFoundException(fname) + }).ConfigureAwait(false); return; } @@ -292,12 +304,11 @@ public Command FindCommand(string commandString, out string rawArguments) if (ignoreCase) { next = next.ToLowerInvariant(); - cmd = cm2.Children.FirstOrDefault(x => x.Name.ToLowerInvariant() == next || x.Aliases?.Any(xx => xx.ToLowerInvariant() == next) == true); + cmd = cm2.Children.FirstOrDefault(x => x.Name.ToLowerInvariant() == next || + x.Aliases?.Any(xx => xx.ToLowerInvariant() == next) == true); } else - { cmd = cm2.Children.FirstOrDefault(x => x.Name == next || x.Aliases?.Contains(next) == true); - } if (cmd == null) { @@ -336,7 +347,7 @@ public CommandContext CreateContext(DiscordMessage msg, string prefix, Command c if (cmd != null && (cmd.Module is TransientCommandModule || cmd.Module == null)) { var scope = ctx.Services.CreateScope(); - ctx.ServiceScopeContext = new CommandContext.ServiceContext(ctx.Services, scope); + ctx.ServiceScopeContext = new(ctx.Services, scope); ctx.Services = scope.ServiceProvider; } @@ -358,13 +369,24 @@ public async Task ExecuteCommandAsync(CommandContext ctx) var res = await cmd.ExecuteAsync(ctx).ConfigureAwait(false); if (res.IsSuccessful) - await this._executed.InvokeAsync(this, new CommandExecutionEventArgs(this.Client.ServiceProvider) { Context = res.Context }).ConfigureAwait(false); + await this._executed.InvokeAsync(this, new(this.Client.ServiceProvider) + { + Context = res.Context + }).ConfigureAwait(false); else - await this._error.InvokeAsync(this, new CommandErrorEventArgs(this.Client.ServiceProvider) { Context = res.Context, Exception = res.Exception }).ConfigureAwait(false); + await this._error.InvokeAsync(this, new(this.Client.ServiceProvider) + { + Context = res.Context, + Exception = res.Exception + }).ConfigureAwait(false); } catch (Exception ex) { - await this._error.InvokeAsync(this, new CommandErrorEventArgs(this.Client.ServiceProvider) { Context = ctx, Exception = ex }).ConfigureAwait(false); + await this._error.InvokeAsync(this, new(this.Client.ServiceProvider) + { + Context = ctx, + Exception = ex + }).ConfigureAwait(false); } finally { @@ -388,9 +410,11 @@ private async Task RunAllChecksAsync(Command cmd, CommandContext ctx) if (fchecks.Any()) throw new ChecksFailedException(cmd, ctx, fchecks); } - #endregion - #region Command Registration +#endregion + +#region Command Registration + /// /// Gets a dictionary of registered top-level commands. /// @@ -401,6 +425,7 @@ public IReadOnlyDictionary RegisteredCommands /// Gets or sets the top level commands. /// private readonly Dictionary _topLevelCommands; + private readonly Lazy> _registeredCommandsLazy; /// @@ -454,7 +479,11 @@ public void RegisterCommands(Type t) /// The current parent. /// The inherited checks. /// The found commands. - private void RegisterCommands(Type t, CommandGroupBuilder currentParent, IEnumerable inheritedChecks, out List foundCommands) + private void RegisterCommands( + Type t, CommandGroupBuilder currentParent, + IEnumerable inheritedChecks, + out List foundCommands + ) { var ti = t.GetTypeInfo(); @@ -478,7 +507,6 @@ private void RegisterCommands(Type t, CommandGroupBuilder currentParent, IEnumer var moduleChecks = new List(); foreach (var xa in moduleAttributes) - { switch (xa) { case GroupAttribute g: @@ -505,8 +533,10 @@ private void RegisterCommands(Type t, CommandGroupBuilder currentParent, IEnumer foreach (var chk in inheritedChecks) groupBuilder.WithExecutionCheck(chk); - foreach (var mi in ti.DeclaredMethods.Where(x => x.IsCommandCandidate(out _) && x.GetCustomAttribute() != null)) - groupBuilder.WithOverload(new CommandOverloadBuilder(mi)); + foreach (var mi in ti.DeclaredMethods.Where(x => x.IsCommandCandidate(out _) && + x.GetCustomAttribute() != + null)) + groupBuilder.WithOverload(new(mi)); break; case AliasesAttribute a: @@ -532,7 +562,6 @@ private void RegisterCommands(Type t, CommandGroupBuilder currentParent, IEnumer groupBuilder.WithCustomAttribute(xa); break; } - } if (!isModule) { @@ -578,14 +607,13 @@ private void RegisterCommands(Type t, CommandGroupBuilder currentParent, IEnumer groupBuilder.WithChild(commandBuilder); } - commandBuilder.WithOverload(new CommandOverloadBuilder(m)); + commandBuilder.WithOverload(new(m)); if (!isModule && moduleChecks.Any()) foreach (var chk in moduleChecks) commandBuilder.WithExecutionCheck(chk); foreach (var xa in attrs) - { switch (xa) { case AliasesAttribute a: @@ -609,7 +637,6 @@ private void RegisterCommands(Type t, CommandGroupBuilder currentParent, IEnumer commandBuilder.WithCustomAttribute(xa); break; } - } if (!isModule && moduleHidden) commandBuilder.WithHiddenStatus(true); @@ -676,7 +703,8 @@ private void AddToCommandDictionary(Command cmd) if (cmd.Parent != null) return; - if (this._topLevelCommands.ContainsKey(cmd.Name) || (cmd.Aliases != null && cmd.Aliases.Any(xs => this._topLevelCommands.ContainsKey(xs)))) + if (this._topLevelCommands.ContainsKey(cmd.Name) || + (cmd.Aliases != null && cmd.Aliases.Any(xs => this._topLevelCommands.ContainsKey(xs)))) throw new DuplicateCommandException(cmd.QualifiedName); this._topLevelCommands[cmd.Name] = cmd; @@ -684,9 +712,11 @@ private void AddToCommandDictionary(Command cmd) foreach (var xs in cmd.Aliases) this._topLevelCommands[xs] = cmd; } - #endregion - #region Default Help +#endregion + +#region Default Help + /// /// Represents the default help module. /// @@ -700,7 +730,10 @@ public class DefaultHelpModule : BaseCommandModule /// The command. /// A Task. [Command("help"), Description("Displays command help.")] - public async Task DefaultHelpAsync(CommandContext ctx, [Description("Command to provide help for.")] params string[] command) + public async Task DefaultHelpAsync( + CommandContext ctx, + [Description("Command to provide help for.")] params string[] command + ) { var topLevel = ctx.CommandsNext._topLevelCommands.Values.Distinct(); var helpBuilder = ctx.CommandsNext._helpFormatter.Create(ctx); @@ -718,8 +751,12 @@ public async Task DefaultHelpAsync(CommandContext ctx, [Description("Command to } cmd = ctx.Config.CaseSensitive - ? searchIn.FirstOrDefault(xc => xc.Name == c || (xc.Aliases != null && xc.Aliases.Contains(c))) - : searchIn.FirstOrDefault(xc => xc.Name.ToLowerInvariant() == c.ToLowerInvariant() || (xc.Aliases != null && xc.Aliases.Select(xs => xs.ToLowerInvariant()).Contains(c.ToLowerInvariant()))); + ? searchIn.FirstOrDefault(xc => xc.Name == c || + (xc.Aliases != null && xc.Aliases.Contains(c))) + : searchIn.FirstOrDefault(xc => xc.Name.ToLowerInvariant() == c.ToLowerInvariant() || + (xc.Aliases != null && xc.Aliases + .Select(xs => xs.ToLowerInvariant()) + .Contains(c.ToLowerInvariant()))); if (cmd == null) break; @@ -748,7 +785,8 @@ public async Task DefaultHelpAsync(CommandContext ctx, [Description("Command to continue; } - var candidateFailedChecks = await candidateCommand.RunChecksAsync(ctx, true).ConfigureAwait(false); + var candidateFailedChecks = + await candidateCommand.RunChecksAsync(ctx, true).ConfigureAwait(false); if (!candidateFailedChecks.Any()) eligibleCommands.Add(candidateCommand); } @@ -786,12 +824,13 @@ public async Task DefaultHelpAsync(CommandContext ctx, [Description("Command to await ctx.RespondAsync(builder).ConfigureAwait(false); else await ctx.Member.SendMessageAsync(builder).ConfigureAwait(false); - } } - #endregion - #region Sudo +#endregion + +#region Sudo + /// /// Creates a fake command context to execute commands with. /// @@ -802,7 +841,10 @@ public async Task DefaultHelpAsync(CommandContext ctx, [Description("Command to /// Command to execute. /// Raw arguments to pass to command. /// Created fake context. - public CommandContext CreateFakeContext(DiscordUser actor, DiscordChannel channel, string messageContents, string prefix, Command cmd, string rawArguments = null) + public CommandContext CreateFakeContext( + DiscordUser actor, DiscordChannel channel, string messageContents, + string prefix, Command cmd, string rawArguments = null + ) { var epoch = new DateTimeOffset(2015, 1, 1, 0, 0, 0, TimeSpan.Zero); var now = DateTimeOffset.UtcNow; @@ -819,10 +861,10 @@ public CommandContext CreateFakeContext(DiscordUser actor, DiscordChannel channe Pinned = false, MentionEveryone = messageContents.Contains("@everyone"), IsTts = false, - AttachmentsInternal = new List(), - EmbedsInternal = new List(), + AttachmentsInternal = new(), + EmbedsInternal = new(), TimestampRaw = now.ToString("yyyy-MM-ddTHH:mm:sszzz"), - ReactionsInternal = new List() + ReactionsInternal = new() }; var mentionedUsers = new List(); @@ -833,14 +875,16 @@ public CommandContext CreateFakeContext(DiscordUser actor, DiscordChannel channe { if (msg.Channel.Guild != null) { - mentionedUsers = Utilities.GetUserMentions(msg).Select(xid => msg.Channel.Guild.MembersInternal.TryGetValue(xid, out var member) ? member : null).Cast().ToList(); + mentionedUsers = Utilities.GetUserMentions(msg) + .Select(xid => msg.Channel.Guild.MembersInternal.TryGetValue(xid, out var member) ? member : null) + .Cast().ToList(); mentionedRoles = Utilities.GetRoleMentions(msg).Select(xid => msg.Channel.Guild.GetRole(xid)).ToList(); - mentionedChannels = Utilities.GetChannelMentions(msg).Select(xid => msg.Channel.Guild.GetChannel(xid)).ToList(); + mentionedChannels = Utilities.GetChannelMentions(msg).Select(xid => msg.Channel.Guild.GetChannel(xid)) + .ToList(); } else - { - mentionedUsers = Utilities.GetUserMentions(msg).Select(this.Client.GetCachedOrEmptyUserInternal).ToList(); - } + mentionedUsers = Utilities.GetUserMentions(msg).Select(this.Client.GetCachedOrEmptyUserInternal) + .ToList(); } msg.MentionedUsersInternal = mentionedUsers; @@ -862,15 +906,17 @@ public CommandContext CreateFakeContext(DiscordUser actor, DiscordChannel channe if (cmd != null && (cmd.Module is TransientCommandModule || cmd.Module == null)) { var scope = ctx.Services.CreateScope(); - ctx.ServiceScopeContext = new CommandContext.ServiceContext(ctx.Services, scope); + ctx.ServiceScopeContext = new(ctx.Services, scope); ctx.Services = scope.ServiceProvider; } return ctx; } - #endregion - #region Type Conversion +#endregion + +#region Type Conversion + /// /// Converts a string to specified type. /// @@ -888,7 +934,9 @@ public async Task ConvertArgument(string value, CommandContext ctx) throw new ArgumentException("Invalid converter registered for this type.", nameof(T)); var cvr = await cv.ConvertAsync(value, ctx).ConfigureAwait(false); - return !cvr.HasValue ? throw new ArgumentException("Could not convert specified value to given type.", nameof(value)) : cvr.Value; + return !cvr.HasValue + ? throw new ArgumentException("Could not convert specified value to given type.", nameof(value)) + : cvr.Value; } /// @@ -973,7 +1021,8 @@ public void RegisterUserFriendlyTypeName(string value) var t = typeof(T); var ti = t.GetTypeInfo(); if (!this.ArgumentConverters.ContainsKey(t)) - throw new InvalidOperationException("Cannot register a friendly name for a type which has no associated converter."); + throw new + InvalidOperationException("Cannot register a friendly name for a type which has no associated converter."); this._userFriendlyTypeNames[t] = value; @@ -996,13 +1045,15 @@ public string GetUserFriendlyTypeName(Type t) var ti = t.GetTypeInfo(); if (!ti.IsGenericTypeDefinition || t.GetGenericTypeDefinition() != typeof(Nullable<>)) return t.Name; + var tn = ti.GenericTypeArguments[0]; return this._userFriendlyTypeNames.TryGetValue(tn, out var name) ? name : tn.Name; - } - #endregion - #region Helpers +#endregion + +#region Helpers + /// /// Allows easier interoperability with reflection by turning the returned by /// into a task containing , using the provided generic type information. @@ -1019,9 +1070,11 @@ internal IEqualityComparer GetStringComparer() => this._config.CaseSensitive ? StringComparer.Ordinal : StringComparer.OrdinalIgnoreCase; - #endregion - #region Events +#endregion + +#region Events + /// /// Triggered whenever a command executes successfully. /// @@ -1030,6 +1083,7 @@ public event AsyncEventHandler add => this._executed.Register(value); remove => this._executed.Unregister(value); } + private AsyncEvent _executed; /// @@ -1040,6 +1094,7 @@ public event AsyncEventHandler Com add => this._error.Register(value); remove => this._error.Unregister(value); } + private AsyncEvent _error; /// @@ -1055,5 +1110,6 @@ private Task OnCommandExecuted(CommandExecutionEventArgs e) /// The command error event arguments. private Task OnCommandErrored(CommandErrorEventArgs e) => this._error.InvokeAsync(this, e); - #endregion + +#endregion } diff --git a/DisCatSharp.CommandsNext/CommandsNextUtilities.cs b/DisCatSharp.CommandsNext/CommandsNextUtilities.cs index 1d91a88b6..acd7bfb7a 100644 --- a/DisCatSharp.CommandsNext/CommandsNextUtilities.cs +++ b/DisCatSharp.CommandsNext/CommandsNextUtilities.cs @@ -33,10 +33,17 @@ public static class CommandsNextUtilities /// String to check for. /// Method of string comparison for the purposes of finding prefixes. /// Positive number if the prefix is present, -1 otherwise. - public static int GetStringPrefixLength(this DiscordMessage msg, string str, StringComparison comparisonType = StringComparison.Ordinal) + public static int GetStringPrefixLength( + this DiscordMessage msg, string str, + StringComparison comparisonType = StringComparison.Ordinal + ) { var content = msg.Content; - return str.Length >= content.Length ? -1 : !content.StartsWith(str, comparisonType) ? -1 : str.Length; + return str.Length >= content.Length + ? -1 + : !content.StartsWith(str, comparisonType) + ? -1 + : str.Length; } /// @@ -85,6 +92,7 @@ internal static string ExtractNextArgument(this string str, ref int startPos) for (; i < str.Length; i++) if (!char.IsWhiteSpace(str[i])) break; + startPos = i; var endPosition = -1; @@ -99,7 +107,8 @@ internal static string ExtractNextArgument(this string str, ref int startPos) if (!inEscape && !inBacktick && !inTripleBacktick) { inEscape = true; - if (str.IndexOf("\\`", i) == i || str.IndexOf("\\\"", i) == i || str.IndexOf("\\\\", i) == i || (str.Length >= i && char.IsWhiteSpace(str[i + 1]))) + if (str.IndexOf("\\`", i) == i || str.IndexOf("\\\"", i) == i || str.IndexOf("\\\\", i) == i || + (str.Length >= i && char.IsWhiteSpace(str[i + 1]))) removeIndices.Add(i - startPosition); i++; } @@ -144,7 +153,9 @@ internal static string ExtractNextArgument(this string str, ref int startPos) if (endPosition != -1) { startPos = endPosition; - return startPosition != endPosition ? str[startPosition..endPosition].CleanupString(removeIndices) : null; + return startPosition != endPosition + ? str[startPosition..endPosition].CleanupString(removeIndices) + : null; } } @@ -234,13 +245,13 @@ internal static async Task BindArguments(CommandContext c } if (argValue == null && !arg.IsOptional && !arg.IsCatchAll) - return new ArgumentBindingResult(new ArgumentException("Not enough arguments supplied to the command.")); + return new(new ArgumentException("Not enough arguments supplied to the command.")); else if (argValue == null) rawArgumentList.Add(null); } if (!ignoreSurplus && foundAt < argString.Length) - return new ArgumentBindingResult(new ArgumentException("Too many arguments were supplied to this command.")); + return new(new ArgumentException("Too many arguments were supplied to this command.")); for (var i = 0; i < overload.Arguments.Count; i++) { @@ -253,12 +264,14 @@ internal static async Task BindArguments(CommandContext c { try { - array.SetValue(await ctx.CommandsNext.ConvertArgument(rawArgumentList[i], ctx, arg.Type).ConfigureAwait(false), i - start); + array.SetValue(await ctx.CommandsNext.ConvertArgument(rawArgumentList[i], ctx, arg.Type).ConfigureAwait(false), + i - start); } catch (Exception ex) { - return new ArgumentBindingResult(ex); + return new(ex); } + i++; } @@ -266,19 +279,20 @@ internal static async Task BindArguments(CommandContext c break; } else - { try { - args[i + 2] = rawArgumentList[i] != null ? await ctx.CommandsNext.ConvertArgument(rawArgumentList[i], ctx, arg.Type).ConfigureAwait(false) : arg.DefaultValue; + args[i + 2] = rawArgumentList[i] != null + ? await ctx.CommandsNext.ConvertArgument(rawArgumentList[i], ctx, arg.Type) + .ConfigureAwait(false) + : arg.DefaultValue; } catch (Exception ex) { - return new ArgumentBindingResult(ex); + return new(ex); } - } } - return new ArgumentBindingResult(args, rawArgumentList); + return new(args, rawArgumentList); } /// @@ -305,7 +319,9 @@ internal static bool IsModuleCandidateType(this TypeInfo ti) return false; // check if anonymous - if (ti.IsGenericType && ti.Name.Contains("AnonymousType") && (ti.Name.StartsWith("<>") || ti.Name.StartsWith("VB$")) && (ti.Attributes & TypeAttributes.NotPublic) == TypeAttributes.NotPublic) + if (ti.IsGenericType && ti.Name.Contains("AnonymousType") && + (ti.Name.StartsWith("<>") || ti.Name.StartsWith("VB$")) && + (ti.Attributes & TypeAttributes.NotPublic) == TypeAttributes.NotPublic) return false; // check if abstract, static, or not a class @@ -318,7 +334,8 @@ internal static bool IsModuleCandidateType(this TypeInfo ti) return false; // qualifies if any method or type qualifies - return ti.DeclaredMethods.Any(xmi => xmi.IsCommandCandidate(out _)) || ti.DeclaredNestedTypes.Any(xti => xti.IsModuleCandidateType()); + return ti.DeclaredMethods.Any(xmi => xmi.IsCommandCandidate(out _)) || + ti.DeclaredNestedTypes.Any(xti => xti.IsModuleCandidateType()); } /// @@ -339,7 +356,8 @@ internal static bool IsCommandCandidate(this MethodInfo method, out ParameterInf // check if appropriate return and arguments parameters = method.GetParameters(); - if (!parameters.Any() || parameters.First().ParameterType != typeof(CommandContext) || method.ReturnType != typeof(Task)) + if (!parameters.Any() || parameters.First().ParameterType != typeof(CommandContext) || + method.ReturnType != typeof(Task)) return false; // qualifies @@ -359,14 +377,16 @@ internal static object CreateInstance(this Type t, IServiceProvider services) .ToArray(); if (constructors.Length != 1) - throw new ArgumentException("Specified type does not contain a public constructor or contains more than one public constructor."); + throw new + ArgumentException("Specified type does not contain a public constructor or contains more than one public constructor."); var constructor = constructors[0]; var constructorArgs = constructor.GetParameters(); var args = new object[constructorArgs.Length]; if (constructorArgs.Length != 0 && services == null) - throw new InvalidOperationException("Dependency collection needs to be specified for parameterized constructors."); + throw new + InvalidOperationException("Dependency collection needs to be specified for parameterized constructors."); // inject via constructor if (constructorArgs.Length != 0) @@ -376,7 +396,8 @@ internal static object CreateInstance(this Type t, IServiceProvider services) var moduleInstance = Activator.CreateInstance(t, args); // inject into properties - var props = t.GetRuntimeProperties().Where(xp => xp.CanWrite && xp.SetMethod != null && !xp.SetMethod.IsStatic && xp.SetMethod.IsPublic); + var props = t.GetRuntimeProperties() + .Where(xp => xp.CanWrite && xp.SetMethod != null && !xp.SetMethod.IsStatic && xp.SetMethod.IsPublic); foreach (var prop in props) { if (prop.GetCustomAttribute() != null) diff --git a/DisCatSharp.CommandsNext/Converters/ArgumentBindingResult.cs b/DisCatSharp.CommandsNext/Converters/ArgumentBindingResult.cs index f9bde0d8e..d0115fb0d 100644 --- a/DisCatSharp.CommandsNext/Converters/ArgumentBindingResult.cs +++ b/DisCatSharp.CommandsNext/Converters/ArgumentBindingResult.cs @@ -12,14 +12,17 @@ public readonly struct ArgumentBindingResult /// Gets a value indicating whether the binding is successful. /// public bool IsSuccessful { get; } + /// /// Gets the converted. /// public object[] Converted { get; } + /// /// Gets the raw. /// public IReadOnlyList Raw { get; } + /// /// Gets the reason. /// diff --git a/DisCatSharp.CommandsNext/Converters/DefaultHelpFormatter.cs b/DisCatSharp.CommandsNext/Converters/DefaultHelpFormatter.cs index a399301c2..1f8601458 100644 --- a/DisCatSharp.CommandsNext/Converters/DefaultHelpFormatter.cs +++ b/DisCatSharp.CommandsNext/Converters/DefaultHelpFormatter.cs @@ -43,13 +43,15 @@ public override BaseHelpFormatter WithCommand(Command command) { this._command = command; - this.EmbedBuilder.WithDescription($"{Formatter.InlineCode(command.Name)}: {command.Description ?? "No description provided."}"); + this.EmbedBuilder + .WithDescription($"{Formatter.InlineCode(command.Name)}: {command.Description ?? "No description provided."}"); if (command is CommandGroup cgroup && cgroup.IsExecutableWithoutSubcommands) - this.EmbedBuilder.WithDescription($"{this.EmbedBuilder.Description}\n\nThis group can be executed as a standalone command."); + this.EmbedBuilder + .WithDescription($"{this.EmbedBuilder.Description}\n\nThis group can be executed as a standalone command."); if (command.Aliases?.Any() == true) - this.EmbedBuilder.AddField(new DiscordEmbedField("Aliases", string.Join(", ", command.Aliases.Select(Formatter.InlineCode)))); + this.EmbedBuilder.AddField(new("Aliases", string.Join(", ", command.Aliases.Select(Formatter.InlineCode)))); if (command.Overloads?.Any() == true) { @@ -60,17 +62,20 @@ public override BaseHelpFormatter WithCommand(Command command) sb.Append('`').Append(command.QualifiedName); foreach (var arg in ovl.Arguments) - sb.Append(arg.IsOptional || arg.IsCatchAll ? " [" : " <").Append(arg.Name).Append(arg.IsCatchAll ? "..." : "").Append(arg.IsOptional || arg.IsCatchAll ? ']' : '>'); + sb.Append(arg.IsOptional || arg.IsCatchAll ? " [" : " <").Append(arg.Name) + .Append(arg.IsCatchAll ? "..." : "").Append(arg.IsOptional || arg.IsCatchAll ? ']' : '>'); sb.Append("`\n"); foreach (var arg in ovl.Arguments) - sb.Append('`').Append(arg.Name).Append(" (").Append(this.CommandsNext.GetUserFriendlyTypeName(arg.Type)).Append(")`: ").Append(arg.Description ?? "No description provided.").Append('\n'); + sb.Append('`').Append(arg.Name).Append(" (") + .Append(this.CommandsNext.GetUserFriendlyTypeName(arg.Type)).Append(")`: ") + .Append(arg.Description ?? "No description provided.").Append('\n'); sb.Append('\n'); } - this.EmbedBuilder.AddField(new DiscordEmbedField("Arguments", sb.ToString().Trim())); + this.EmbedBuilder.AddField(new("Arguments", sb.ToString().Trim())); } return this; @@ -83,7 +88,8 @@ public override BaseHelpFormatter WithCommand(Command command) /// This help formatter. public override BaseHelpFormatter WithSubcommands(IEnumerable subcommands) { - this.EmbedBuilder.AddField(new DiscordEmbedField(this._command != null ? "Subcommands" : "Commands", string.Join(", ", subcommands.Select(x => Formatter.InlineCode(x.Name))))); + this.EmbedBuilder.AddField(new(this._command != null ? "Subcommands" : "Commands", + string.Join(", ", subcommands.Select(x => Formatter.InlineCode(x.Name))))); return this; } @@ -95,8 +101,9 @@ public override BaseHelpFormatter WithSubcommands(IEnumerable subcomman public override CommandHelpMessage Build() { if (this._command == null) - this.EmbedBuilder.WithDescription("Listing all top-level commands and groups. Specify a command to see more information."); + this.EmbedBuilder + .WithDescription("Listing all top-level commands and groups. Specify a command to see more information."); - return new CommandHelpMessage(embed: this.EmbedBuilder.Build()); + return new(embed: this.EmbedBuilder.Build()); } } diff --git a/DisCatSharp.CommandsNext/Converters/EntityConverters.cs b/DisCatSharp.CommandsNext/Converters/EntityConverters.cs index 1edb31fb7..ca67f5070 100644 --- a/DisCatSharp.CommandsNext/Converters/EntityConverters.cs +++ b/DisCatSharp.CommandsNext/Converters/EntityConverters.cs @@ -43,7 +43,8 @@ async Task> IArgumentConverter.ConvertAsync(s var us = ctx.Client.Guilds.Values .SelectMany(xkvp => xkvp.Members.Values) - .Where(xm => (cs ? xm.Username : xm.Username.ToLowerInvariant()) == un && ((dv != null && xm.Discriminator == dv) || dv == null)); + .Where(xm => (cs ? xm.Username : xm.Username.ToLowerInvariant()) == un && + ((dv != null && xm.Discriminator == dv) || dv == null)); var usr = us.FirstOrDefault(); return Optional.FromNullable(usr); @@ -80,7 +81,7 @@ async Task> IArgumentConverter.ConvertAsy var searchResult = await ctx.Guild.SearchMembersAsync(value).ConfigureAwait(false); if (searchResult.Any()) - return Optional.Some(searchResult.First()); + return Optional.Some(searchResult[0]); var cs = ctx.Config.CaseSensitive; if (!cs) @@ -91,8 +92,9 @@ async Task> IArgumentConverter.ConvertAsy var dv = di != -1 ? value[(di + 1)..] : null; var us = ctx.Guild.Members.Values - .Where(xm => ((cs ? xm.Username : xm.Username.ToLowerInvariant()) == un && ((dv != null && xm.Discriminator == dv) || dv == null)) - || (cs ? xm.Nickname : xm.Nickname?.ToLowerInvariant()) == value); + .Where(xm => ((cs ? xm.Username : xm.Username.ToLowerInvariant()) == un && + ((dv != null && xm.Discriminator == dv) || dv == null)) + || (cs ? xm.Nickname : xm.Nickname?.ToLowerInvariant()) == value); return Optional.FromNullable(us.FirstOrDefault()); } @@ -108,7 +110,9 @@ public class DiscordChannelConverter : IArgumentConverter /// /// The string to convert. /// The command context. - async Task> IArgumentConverter.ConvertAsync(string value, CommandContext ctx) + async Task> IArgumentConverter.ConvertAsync( + string value, CommandContext ctx + ) { if (ulong.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var cid)) { @@ -142,7 +146,9 @@ public class DiscordThreadChannelConverter : IArgumentConverter /// The string to convert. /// The command context. - async Task> IArgumentConverter.ConvertAsync(string value, CommandContext ctx) + async Task> IArgumentConverter.ConvertAsync( + string value, CommandContext ctx + ) { if (ulong.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var tid)) { @@ -216,11 +222,9 @@ public class DiscordGuildConverter : IArgumentConverter Task> IArgumentConverter.ConvertAsync(string value, CommandContext ctx) { if (ulong.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var gid)) - { return ctx.Client.Guilds.TryGetValue(gid, out var result) ? Task.FromResult(Optional.Some(result)) : Task.FromResult(Optional.None); - } var cs = ctx.Config.CaseSensitive; if (!cs) @@ -231,7 +235,6 @@ Task> IArgumentConverter.ConvertAsync(strin } } - /// /// Represents a discord invite converter. /// @@ -248,8 +251,11 @@ async Task> IArgumentConverter.ConvertAsy if (m.Success) { ulong? eventId = ulong.TryParse(m.Groups["event"].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, - out var eid) ? eid : null; - var result = await ctx.Client.GetInviteByCodeAsync(m.Groups["code"].Value, scheduledEventId: eventId).ConfigureAwait(false); + out var eid) + ? eid + : null; + var result = await ctx.Client.GetInviteByCodeAsync(m.Groups["code"].Value, scheduledEventId: eventId) + .ConfigureAwait(false); return Optional.FromNullable(result); } @@ -268,7 +274,9 @@ public class DiscordMessageConverter : IArgumentConverter /// /// The string to convert. /// The command context. - async Task> IArgumentConverter.ConvertAsync(string value, CommandContext ctx) + async Task> IArgumentConverter.ConvertAsync( + string value, CommandContext ctx + ) { if (string.IsNullOrWhiteSpace(value)) return Optional.None; @@ -279,8 +287,10 @@ async Task> IArgumentConverter.ConvertA { var uripath = DiscordRegEx.MessageLink.Match(uri.AbsoluteUri); if (!uripath.Success - || !ulong.TryParse(uripath.Groups["channel"].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var cid) - || !ulong.TryParse(uripath.Groups["message"].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out mid)) + || !ulong.TryParse(uripath.Groups["channel"].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, + out var cid) + || !ulong.TryParse(uripath.Groups["message"].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, + out mid)) return Optional.None; var chn = await ctx.Client.GetChannelAsync(cid).ConfigureAwait(false); @@ -311,7 +321,9 @@ public class DiscordScheduledEventConverter : IArgumentConverter /// The string to convert. /// The command context. - async Task> IArgumentConverter.ConvertAsync(string value, CommandContext ctx) + async Task> IArgumentConverter.ConvertAsync( + string value, CommandContext ctx + ) { if (string.IsNullOrWhiteSpace(value)) return Optional.None; @@ -322,10 +334,10 @@ async Task> IArgumentConverter> IArgumentConverter.ConvertAsync(strin return !ulong.TryParse(sid, NumberStyles.Integer, CultureInfo.InvariantCulture, out var id) ? Task.FromResult(Optional.None) : DiscordEmoji.TryFromGuildEmote(ctx.Client, id, out emoji) - ? Task.FromResult(Optional.Some(emoji)) - : Task.FromResult(Optional.Some(new DiscordEmoji - { - Discord = ctx.Client, - Id = id, - Name = name, - IsAnimated = anim, - RequiresColons = true, - IsManaged = false - })); + ? Task.FromResult(Optional.Some(emoji)) + : Task.FromResult(Optional.Some(new DiscordEmoji + { + Discord = ctx.Client, + Id = id, + Name = name, + IsAnimated = anim, + RequiresColons = true, + IsManaged = false + })); } return Task.FromResult(Optional.None); @@ -413,7 +425,8 @@ public class DiscordColorConverter : IArgumentConverter Task> IArgumentConverter.ConvertAsync(string value, CommandContext ctx) { var m = CommonRegEx.HexColorString.Match(value); - if (m.Success && int.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var clr)) + if (m.Success && int.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, + out var clr)) return Task.FromResult(Optional.Some(clr)); m = CommonRegEx.RgbColorString.Match(value); diff --git a/DisCatSharp.CommandsNext/Converters/EnumConverter.cs b/DisCatSharp.CommandsNext/Converters/EnumConverter.cs index 32f2fc084..df7a298a2 100644 --- a/DisCatSharp.CommandsNext/Converters/EnumConverter.cs +++ b/DisCatSharp.CommandsNext/Converters/EnumConverter.cs @@ -23,7 +23,7 @@ Task> IArgumentConverter.ConvertAsync(string value, CommandContex return !ti.IsEnum ? throw new InvalidOperationException("Cannot convert non-enum value to an enum.") : Enum.TryParse(value, !ctx.Config.CaseSensitive, out T ev) - ? Task.FromResult(Optional.Some(ev)) - : Task.FromResult(Optional.None); + ? Task.FromResult(Optional.Some(ev)) + : Task.FromResult(Optional.None); } } diff --git a/DisCatSharp.CommandsNext/Converters/HelpFormatterFactory.cs b/DisCatSharp.CommandsNext/Converters/HelpFormatterFactory.cs index 3cb093ee3..d9546eb02 100644 --- a/DisCatSharp.CommandsNext/Converters/HelpFormatterFactory.cs +++ b/DisCatSharp.CommandsNext/Converters/HelpFormatterFactory.cs @@ -15,12 +15,14 @@ internal class HelpFormatterFactory /// /// Initializes a new instance of the class. /// - public HelpFormatterFactory() { } + public HelpFormatterFactory() + { } /// /// Sets the formatter type. /// - public void SetFormatterType() where T : BaseHelpFormatter => this._factory = ActivatorUtilities.CreateFactory(typeof(T), new[] { typeof(CommandContext) }); + public void SetFormatterType() where T : BaseHelpFormatter + => this._factory = ActivatorUtilities.CreateFactory(typeof(T), new[] { typeof(CommandContext) }); /// /// Creates the help formatter. diff --git a/DisCatSharp.CommandsNext/Converters/TimeConverters.cs b/DisCatSharp.CommandsNext/Converters/TimeConverters.cs index 3639c465e..c7bd97ca8 100644 --- a/DisCatSharp.CommandsNext/Converters/TimeConverters.cs +++ b/DisCatSharp.CommandsNext/Converters/TimeConverters.cs @@ -113,7 +113,8 @@ Task> IArgumentConverter.ConvertAsync(string value, break; } } - result = new TimeSpan(d, h, m, s); + + result = new(d, h, m, s); return Task.FromResult(Optional.Some(result)); } } diff --git a/DisCatSharp.CommandsNext/Entities/Builders/CommandBuilder.cs b/DisCatSharp.CommandsNext/Entities/Builders/CommandBuilder.cs index 9d78663d1..25c98b3d9 100644 --- a/DisCatSharp.CommandsNext/Entities/Builders/CommandBuilder.cs +++ b/DisCatSharp.CommandsNext/Entities/Builders/CommandBuilder.cs @@ -92,19 +92,19 @@ public CommandBuilder() /// Module on which this command is to be defined. public CommandBuilder(ICommandModule module) { - this._aliasList = new List(); + this._aliasList = new(); this.Aliases = new ReadOnlyCollection(this._aliasList); - this._executionCheckList = new List(); + this._executionCheckList = new(); this.ExecutionChecks = new ReadOnlyCollection(this._executionCheckList); - this._overloadArgumentSets = new HashSet(); - this._overloadList = new List(); + this._overloadArgumentSets = new(); + this._overloadList = new(); this.Overloads = new ReadOnlyCollection(this._overloadList); this.Module = module; - this._customAttributeList = new List(); + this._customAttributeList = new(); this.CustomAttributes = new ReadOnlyCollection(this._customAttributeList); } @@ -116,7 +116,8 @@ public CommandBuilder(ICommandModule module) public CommandBuilder WithName(string name) { if (name == null || name.ToCharArray().Any(xc => char.IsWhiteSpace(xc))) - throw new ArgumentException("Command name cannot be null or contain any whitespace characters.", nameof(name)); + throw new ArgumentException("Command name cannot be null or contain any whitespace characters.", + nameof(name)); if (this.Name != null) throw new InvalidOperationException("This command already has a name."); @@ -155,7 +156,8 @@ public CommandBuilder WithAlias(string alias) throw new ArgumentException("Aliases cannot contain whitespace characters or null strings.", nameof(alias)); if (this.Name == alias || this._aliasList.Contains(alias)) - throw new ArgumentException("Aliases cannot contain the command name, and cannot be duplicate.", nameof(alias)); + throw new ArgumentException("Aliases cannot contain the command name, and cannot be duplicate.", + nameof(alias)); this._aliasList.Add(alias); return this; @@ -227,7 +229,8 @@ public CommandBuilder WithOverloads(params CommandOverloadBuilder[] overloads) public CommandBuilder WithOverload(CommandOverloadBuilder overload) { if (this._overloadArgumentSets.Contains(overload.ArgumentSet)) - throw new DuplicateOverloadException(this.Name, overload.Arguments.Select(x => x.Type).ToList(), overload.ArgumentSet); + throw new DuplicateOverloadException(this.Name, overload.Arguments.Select(x => x.Type).ToList(), + overload.ArgumentSet); this._overloadArgumentSets.Add(overload.ArgumentSet); this._overloadList.Add(overload); diff --git a/DisCatSharp.CommandsNext/Entities/Builders/CommandGroupBuilder.cs b/DisCatSharp.CommandsNext/Entities/Builders/CommandGroupBuilder.cs index 148b9b611..ca857cbd5 100644 --- a/DisCatSharp.CommandsNext/Entities/Builders/CommandGroupBuilder.cs +++ b/DisCatSharp.CommandsNext/Entities/Builders/CommandGroupBuilder.cs @@ -35,7 +35,7 @@ public CommandGroupBuilder() public CommandGroupBuilder(ICommandModule module) : base(module) { - this._childrenList = new List(); + this._childrenList = new(); this.Children = new ReadOnlyCollection(this._childrenList); } diff --git a/DisCatSharp.CommandsNext/Entities/Builders/CommandModuleBuilder.cs b/DisCatSharp.CommandsNext/Entities/Builders/CommandModuleBuilder.cs index 46ed92dad..4b888d3d6 100644 --- a/DisCatSharp.CommandsNext/Entities/Builders/CommandModuleBuilder.cs +++ b/DisCatSharp.CommandsNext/Entities/Builders/CommandModuleBuilder.cs @@ -60,6 +60,7 @@ internal ICommandModule Build(IServiceProvider services) => { ModuleLifespan.Singleton => new SingletonCommandModule(this.Type, services), ModuleLifespan.Transient => new TransientCommandModule(this.Type), - _ => throw new NotSupportedException("Module lifespans other than transient and singleton are not supported."), + _ => throw new + NotSupportedException("Module lifespans other than transient and singleton are not supported.") }; } diff --git a/DisCatSharp.CommandsNext/Entities/Builders/CommandOverloadBuilder.cs b/DisCatSharp.CommandsNext/Entities/Builders/CommandOverloadBuilder.cs index 2918bff8f..8528a47eb 100644 --- a/DisCatSharp.CommandsNext/Entities/Builders/CommandOverloadBuilder.cs +++ b/DisCatSharp.CommandsNext/Entities/Builders/CommandOverloadBuilder.cs @@ -97,7 +97,6 @@ private CommandOverloadBuilder(MethodInfo method, object target) var attrs = arg.GetCustomAttributes(); var isParams = false; foreach (var xa in attrs) - { switch (xa) { case DescriptionAttribute d: @@ -119,10 +118,10 @@ private CommandOverloadBuilder(MethodInfo method, object target) attrsCustom.Add(xa); break; } - } if (i > 2 && !ca.IsOptional && !ca.IsCatchAll && args[i - 3].IsOptional) - throw new InvalidOverloadException("Non-optional argument cannot appear after an optional one", method, arg); + throw new InvalidOverloadException("Non-optional argument cannot appear after an optional one", method, + arg); if (arg.ParameterType.IsArray && !isParams) throw new InvalidOverloadException("Cannot use array arguments without params modifier.", method, arg); diff --git a/DisCatSharp.CommandsNext/Entities/Command.cs b/DisCatSharp.CommandsNext/Entities/Command.cs index 00671a60e..630fca076 100644 --- a/DisCatSharp.CommandsNext/Entities/Command.cs +++ b/DisCatSharp.CommandsNext/Entities/Command.cs @@ -67,7 +67,8 @@ public string QualifiedName /// /// Initializes a new instance of the class. /// - internal Command() { } + internal Command() + { } /// /// Executes this command with specified context. @@ -83,7 +84,8 @@ public virtual async Task ExecuteAsync(CommandContext ctx) foreach (var ovl in this.Overloads.OrderByDescending(x => x.Priority)) { ctx.Overload = ovl; - var args = await CommandsNextUtilities.BindArguments(ctx, ctx.Config.IgnoreExtraArguments).ConfigureAwait(false); + var args = await CommandsNextUtilities.BindArguments(ctx, ctx.Config.IgnoreExtraArguments) + .ConfigureAwait(false); if (!args.IsSuccessful) continue; @@ -98,7 +100,7 @@ public virtual async Task ExecuteAsync(CommandContext ctx) var ret = (Task)ovl.Callable.DynamicInvoke(args.Converted); await ret.ConfigureAwait(false); executed = true; - res = new CommandResult + res = new() { IsSuccessful = true, Context = ctx @@ -114,7 +116,7 @@ public virtual async Task ExecuteAsync(CommandContext ctx) } catch (Exception ex) { - res = new CommandResult + res = new() { IsSuccessful = false, Exception = ex, @@ -190,7 +192,7 @@ public override bool Equals(object obj) return true; return obj is Command cmd -&& cmd.QualifiedName == this.QualifiedName; + && cmd.QualifiedName == this.QualifiedName; } /// diff --git a/DisCatSharp.CommandsNext/Entities/CommandGroup.cs b/DisCatSharp.CommandsNext/Entities/CommandGroup.cs index b5c45a3b5..1e1e24258 100644 --- a/DisCatSharp.CommandsNext/Entities/CommandGroup.cs +++ b/DisCatSharp.CommandsNext/Entities/CommandGroup.cs @@ -25,7 +25,9 @@ public class CommandGroup : Command /// /// Initializes a new instance of the class. /// - internal CommandGroup() : base() { } + internal CommandGroup() + : base() + { } /// /// Executes this command or its subcommand with specified context. @@ -40,8 +42,12 @@ public override async Task ExecuteAsync(CommandContext ctx) if (cn != null) { var cmd = ctx.Config.CaseSensitive - ? this.Children.FirstOrDefault(xc => xc.Name == cn || (xc.Aliases != null && xc.Aliases.Contains(cn))) - : this.Children.FirstOrDefault(xc => xc.Name.ToLowerInvariant() == cn.ToLowerInvariant() || (xc.Aliases != null && xc.Aliases.Select(xs => xs.ToLowerInvariant()).Contains(cn.ToLowerInvariant()))); + ? this.Children.FirstOrDefault(xc => xc.Name == cn || + (xc.Aliases != null && xc.Aliases.Contains(cn))) + : this.Children.FirstOrDefault(xc => xc.Name.ToLowerInvariant() == cn.ToLowerInvariant() || + (xc.Aliases != null && xc.Aliases + .Select(xs => xs.ToLowerInvariant()) + .Contains(cn.ToLowerInvariant()))); if (cmd != null) { // pass the execution on @@ -59,7 +65,7 @@ public override async Task ExecuteAsync(CommandContext ctx) var fchecks = await cmd.RunChecksAsync(xctx, false).ConfigureAwait(false); return fchecks.Any() - ? new CommandResult + ? new() { IsSuccessful = false, Exception = new ChecksFailedException(cmd, xctx, fchecks), @@ -70,10 +76,12 @@ public override async Task ExecuteAsync(CommandContext ctx) } return !this.IsExecutableWithoutSubcommands - ? new CommandResult + ? new() { IsSuccessful = false, - Exception = new InvalidOperationException("No matching subcommands were found, and this group is not executable."), + Exception = + new + InvalidOperationException("No matching subcommands were found, and this group is not executable."), Context = ctx } : await base.ExecuteAsync(ctx).ConfigureAwait(false); diff --git a/DisCatSharp.CommandsNext/Entities/CommandOverload.cs b/DisCatSharp.CommandsNext/Entities/CommandOverload.cs index c9e1bec5f..e50f86b3f 100644 --- a/DisCatSharp.CommandsNext/Entities/CommandOverload.cs +++ b/DisCatSharp.CommandsNext/Entities/CommandOverload.cs @@ -31,5 +31,6 @@ public sealed class CommandOverload /// /// Initializes a new instance of the class. /// - internal CommandOverload() { } + internal CommandOverload() + { } } diff --git a/DisCatSharp.CommandsNext/EventArgs/CommandContext.cs b/DisCatSharp.CommandsNext/EventArgs/CommandContext.cs index 7478846cb..432155d82 100644 --- a/DisCatSharp.CommandsNext/EventArgs/CommandContext.cs +++ b/DisCatSharp.CommandsNext/EventArgs/CommandContext.cs @@ -99,7 +99,10 @@ public DiscordMember Member /// internal CommandContext() { - this._lazyMember = new Lazy(() => this.Guild != null && this.Guild.Members.TryGetValue(this.User.Id, out var member) ? member : this.Guild?.GetMemberAsync(this.User.Id).ConfigureAwait(false).GetAwaiter().GetResult()); + this._lazyMember = new(() => this.Guild != null && this.Guild.Members.TryGetValue(this.User.Id, out var member) + ? member + : this.Guild?.GetMemberAsync(this.User.Id).ConfigureAwait(false).GetAwaiter() + .GetResult()); } /// @@ -156,10 +159,12 @@ public Task TriggerTypingAsync() /// Gets the provider. /// public IServiceProvider Provider { get; } + /// /// Gets the scope. /// public IServiceScope Scope { get; } + /// /// Gets a value indicating whether is initialized. /// diff --git a/DisCatSharp.CommandsNext/EventArgs/CommandErrorEventArgs.cs b/DisCatSharp.CommandsNext/EventArgs/CommandErrorEventArgs.cs index e8cf48a6f..900d4c271 100644 --- a/DisCatSharp.CommandsNext/EventArgs/CommandErrorEventArgs.cs +++ b/DisCatSharp.CommandsNext/EventArgs/CommandErrorEventArgs.cs @@ -16,6 +16,7 @@ public class CommandErrorEventArgs : CommandEventArgs /// Initializes a new instance of the class. /// /// The provider. - public CommandErrorEventArgs(IServiceProvider provider) : base(provider) + public CommandErrorEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp.CommandsNext/EventArgs/CommandEventArgs.cs b/DisCatSharp.CommandsNext/EventArgs/CommandEventArgs.cs index 9ac993c83..762a76518 100644 --- a/DisCatSharp.CommandsNext/EventArgs/CommandEventArgs.cs +++ b/DisCatSharp.CommandsNext/EventArgs/CommandEventArgs.cs @@ -24,6 +24,7 @@ public Command Command /// Initializes a new instance of the class. /// /// The provider. - public CommandEventArgs(IServiceProvider provider) : base(provider) + public CommandEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp.CommandsNext/EventArgs/CommandExecutionEventArgs.cs b/DisCatSharp.CommandsNext/EventArgs/CommandExecutionEventArgs.cs index f08a27f7d..92aba75ee 100644 --- a/DisCatSharp.CommandsNext/EventArgs/CommandExecutionEventArgs.cs +++ b/DisCatSharp.CommandsNext/EventArgs/CommandExecutionEventArgs.cs @@ -11,6 +11,7 @@ public class CommandExecutionEventArgs : CommandEventArgs /// Initializes a new instance of the class. /// /// The provider. - public CommandExecutionEventArgs(IServiceProvider provider) : base(provider) + public CommandExecutionEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp.CommandsNext/Exceptions/CommandNotFoundException.cs b/DisCatSharp.CommandsNext/Exceptions/CommandNotFoundException.cs index 2e1b8d91a..13b58d2c8 100644 --- a/DisCatSharp.CommandsNext/Exceptions/CommandNotFoundException.cs +++ b/DisCatSharp.CommandsNext/Exceptions/CommandNotFoundException.cs @@ -26,5 +26,6 @@ public CommandNotFoundException(string command) /// Returns a string representation of this . /// /// A string representation. - public override string ToString() => $"{this.GetType()}: {this.Message}\nCommand name: {this.CommandName}"; // much like System.ArgumentNullException works + public override string ToString() + => $"{this.GetType()}: {this.Message}\nCommand name: {this.CommandName}"; // much like System.ArgumentNullException works } diff --git a/DisCatSharp.CommandsNext/Exceptions/DuplicateCommandException.cs b/DisCatSharp.CommandsNext/Exceptions/DuplicateCommandException.cs index f065b13ff..9227dbc68 100644 --- a/DisCatSharp.CommandsNext/Exceptions/DuplicateCommandException.cs +++ b/DisCatSharp.CommandsNext/Exceptions/DuplicateCommandException.cs @@ -26,5 +26,6 @@ internal DuplicateCommandException(string name) /// Returns a string representation of this . /// /// A string representation. - public override string ToString() => $"{this.GetType()}: {this.Message}\nCommand name: {this.CommandName}"; // much like System.ArgumentException works + public override string ToString() + => $"{this.GetType()}: {this.Message}\nCommand name: {this.CommandName}"; // much like System.ArgumentException works } diff --git a/DisCatSharp.CommandsNext/Exceptions/DuplicateOverloadException.cs b/DisCatSharp.CommandsNext/Exceptions/DuplicateOverloadException.cs index fb9d4e3d4..aacfff61a 100644 --- a/DisCatSharp.CommandsNext/Exceptions/DuplicateOverloadException.cs +++ b/DisCatSharp.CommandsNext/Exceptions/DuplicateOverloadException.cs @@ -42,5 +42,6 @@ internal DuplicateOverloadException(string name, IList argumentTypes, stri /// Returns a string representation of this . /// /// A string representation. - public override string ToString() => $"{this.GetType()}: {this.Message}\nCommand name: {this.CommandName}\nArgument types: {this._argumentSetKey}"; // much like System.ArgumentException works + public override string ToString() + => $"{this.GetType()}: {this.Message}\nCommand name: {this.CommandName}\nArgument types: {this._argumentSetKey}"; // much like System.ArgumentException works } diff --git a/DisCatSharp.CommandsNext/ExtensionMethods.cs b/DisCatSharp.CommandsNext/ExtensionMethods.cs index 1e9bcac1b..c601eb3a8 100644 --- a/DisCatSharp.CommandsNext/ExtensionMethods.cs +++ b/DisCatSharp.CommandsNext/ExtensionMethods.cs @@ -31,10 +31,12 @@ public static CommandsNextExtension UseCommandsNext(this DiscordClient client, C throw new InvalidOperationException("CommandsNext is already enabled for that client."); if (!Utilities.HasMessageIntents(client.Configuration.Intents)) - client.Logger.LogCritical(CommandsNextEvents.Intents, "The CommandsNext extension is registered but there are no message intents enabled. It is highly recommended to enable them."); + client.Logger.LogCritical(CommandsNextEvents.Intents, + "The CommandsNext extension is registered but there are no message intents enabled. It is highly recommended to enable them."); if (!client.Configuration.Intents.HasIntent(DiscordIntents.Guilds)) - client.Logger.LogCritical(CommandsNextEvents.Intents, "The CommandsNext extension is registered but the guilds intent is not enabled. It is highly recommended to enable it."); + client.Logger.LogCritical(CommandsNextEvents.Intents, + "The CommandsNext extension is registered but the guilds intent is not enabled. It is highly recommended to enable it."); cfg.ServiceProvider ??= client.ServiceProvider ?? new ServiceCollection().BuildServiceProvider(true); @@ -49,7 +51,9 @@ public static CommandsNextExtension UseCommandsNext(this DiscordClient client, C /// Client to enable CommandsNext for. /// CommandsNext configuration to use. /// A dictionary of created , indexed by shard id. - public static async Task> UseCommandsNextAsync(this DiscordShardedClient client, CommandsNextConfiguration cfg) + public static async Task> UseCommandsNextAsync( + this DiscordShardedClient client, CommandsNextConfiguration cfg + ) { var modules = new Dictionary(); await client.InitializeShardsAsync().ConfigureAwait(false); @@ -70,26 +74,25 @@ public static async Task> UseCom /// /// Client to get CommandsNext module from. /// The module, or null if not activated. - public static CommandsNextExtension GetCommandsNext(this DiscordClient client) + public static CommandsNextExtension? GetCommandsNext(this DiscordClient client) => client.GetExtension(); - /// /// Gets the active CommandsNext modules for all shards in this client. /// /// Client to get CommandsNext instances from. /// A dictionary of the modules, indexed by shard id. - public static async Task> GetCommandsNextAsync(this DiscordShardedClient client) + public static async Task> GetCommandsNextAsync( + this DiscordShardedClient client + ) { await client.InitializeShardsAsync().ConfigureAwait(false); - var extensions = new Dictionary(); + var extensions = new Dictionary(); foreach (var shard in client.ShardClients.Select(xkvp => xkvp.Value)) - { extensions.Add(shard.ShardId, shard.GetExtension()); - } - return new ReadOnlyDictionary(extensions); + return new ReadOnlyDictionary(extensions); } /// @@ -97,21 +100,27 @@ public static async Task> GetCom /// /// Extensions to register commands on. /// Assembly to register commands from. - public static void RegisterCommands(this IReadOnlyDictionary extensions, Assembly assembly) + public static void RegisterCommands( + this IReadOnlyDictionary extensions, + Assembly assembly + ) { foreach (var extension in extensions.Values) extension.RegisterCommands(assembly); } + /// /// Registers all commands from a given command class. /// /// Class which holds commands to register. /// Extensions to register commands on. - public static void RegisterCommands(this IReadOnlyDictionary extensions) where T : BaseCommandModule + public static void RegisterCommands(this IReadOnlyDictionary extensions) + where T : BaseCommandModule { foreach (var extension in extensions.Values) extension.RegisterCommands(); } + /// /// Registers all commands from a given command class. /// @@ -122,12 +131,16 @@ public static void RegisterCommands(this IReadOnlyDictionary /// Builds and registers all supplied commands. /// /// Extensions to register commands on. /// Commands to build and register. - public static void RegisterCommands(this IReadOnlyDictionary extensions, params CommandBuilder[] cmds) + public static void RegisterCommands( + this IReadOnlyDictionary extensions, + params CommandBuilder[] cmds + ) { foreach (var extension in extensions.Values) extension.RegisterCommands(cmds); @@ -138,7 +151,10 @@ public static void RegisterCommands(this IReadOnlyDictionary /// Extensions to unregister commands on. /// Commands to unregister. - public static void UnregisterCommands(this IReadOnlyDictionary extensions, params Command[] cmds) + public static void UnregisterCommands( + this IReadOnlyDictionary extensions, + params Command[] cmds + ) { foreach (var extension in extensions.Values) extension.UnregisterCommands(cmds); @@ -150,7 +166,10 @@ public static void UnregisterCommands(this IReadOnlyDictionaryType for which to register the converter. /// Extensions to register the converter on. /// Converter to register. - public static void RegisterConverter(this IReadOnlyDictionary extensions, IArgumentConverter converter) + public static void RegisterConverter( + this IReadOnlyDictionary extensions, + IArgumentConverter converter + ) { foreach (var extension in extensions.Values) extension.RegisterConverter(converter); @@ -173,7 +192,10 @@ public static void UnregisterConverter(this IReadOnlyDictionaryType to register the name for. /// Extensions to register the name on. /// Name to register. - public static void RegisterUserFriendlyTypeName(this IReadOnlyDictionary extensions, string value) + public static void RegisterUserFriendlyTypeName( + this IReadOnlyDictionary extensions, + string value + ) { foreach (var extension in extensions.Values) extension.RegisterUserFriendlyTypeName(value); @@ -184,7 +206,8 @@ public static void RegisterUserFriendlyTypeName(this IReadOnlyDictionary /// Type of the formatter to use. /// Extensions to set the help formatter on. - public static void SetHelpFormatter(this IReadOnlyDictionary extensions) where T : BaseHelpFormatter + public static void SetHelpFormatter(this IReadOnlyDictionary extensions) + where T : BaseHelpFormatter { foreach (var extension in extensions.Values) extension.SetHelpFormatter(); diff --git a/DisCatSharp.CommandsNext/GlobalSuppressions.cs b/DisCatSharp.CommandsNext/GlobalSuppressions.cs index af8bc5739..6852408ef 100644 --- a/DisCatSharp.CommandsNext/GlobalSuppressions.cs +++ b/DisCatSharp.CommandsNext/GlobalSuppressions.cs @@ -1,8 +1,11 @@ using System.Diagnostics.CodeAnalysis; -[assembly: SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "", Scope = "member", Target = "~M:DisCatSharp.CommandsNext.Attributes.RequireUserPermissionsAttribute.ExecuteCheckAsync(DisCatSharp.CommandsNext.CommandContext,System.Boolean)~System.Threading.Tasks.Task{System.Boolean}")] -[assembly: SuppressMessage("Performance", "CA1826:Do not use Enumerable methods on indexable collections", Justification = "", Scope = "member", Target = "~M:DisCatSharp.CommandsNext.Converters.DiscordMemberConverter.DisCatSharp#CommandsNext#Converters#IArgumentConverter#ConvertAsync(System.String,DisCatSharp.CommandsNext.CommandContext)~System.Threading.Tasks.Task{DisCatSharp.Entities.Optional{DisCatSharp.Entities.DiscordMember}}")] -[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", Target = "~M:DisCatSharp.CommandsNext.CommandsNextExtension.DefaultHelpModule.DefaultHelpAsync(DisCatSharp.CommandsNext.CommandContext,System.String[])~System.Threading.Tasks.Task")] +//[assembly: SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "", Scope = "member", Target = "~M:DisCatSharp.CommandsNext.Attributes.RequireUserPermissionsAttribute.ExecuteCheckAsync(DisCatSharp.CommandsNext.CommandContext,System.Boolean)~System.Threading.Tasks.Task{System.Boolean}")] +//[assembly: SuppressMessage("Performance", "CA1826:Do not use Enumerable methods on indexable collections", Justification = "", Scope = "member", Target = "~M:DisCatSharp.CommandsNext.Converters.DiscordMemberConverter.DisCatSharp#CommandsNext#Converters#IArgumentConverter#ConvertAsync(System.String,DisCatSharp.CommandsNext.CommandContext)~System.Threading.Tasks.Task{DisCatSharp.Entities.Optional{DisCatSharp.Entities.DiscordMember}}")] +[assembly: + SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", + Target = + "~M:DisCatSharp.CommandsNext.CommandsNextExtension.DefaultHelpModule.DefaultHelpAsync(DisCatSharp.CommandsNext.CommandContext,System.String[])~System.Threading.Tasks.Task")] [assembly: SuppressMessage("Usage", "DCS0102:[Discord] Deprecated", Justification = "")] [assembly: SuppressMessage("Usage", "DCS0101:[Discord] InExperiment", Justification = "")] [assembly: SuppressMessage("Usage", "DCS0103:[Discord] InExperiment", Justification = "")] diff --git a/DisCatSharp.Common/Attributes/DateTimeFormatAttribute.cs b/DisCatSharp.Common/Attributes/DateTimeFormatAttribute.cs index 0cdffabec..762c0ea08 100644 --- a/DisCatSharp.Common/Attributes/DateTimeFormatAttribute.cs +++ b/DisCatSharp.Common/Attributes/DateTimeFormatAttribute.cs @@ -1,4 +1,5 @@ using System; + // ReSharper disable InconsistentNaming namespace DisCatSharp.Common.Serialization; @@ -32,7 +33,7 @@ public sealed class DateTimeFormatAttribute : SerializationAttribute /// /// Gets the custom datetime format string to use. /// - public string Format { get; } + public string? Format { get; } /// /// Gets the predefined datetime format kind. @@ -45,7 +46,7 @@ public sealed class DateTimeFormatAttribute : SerializationAttribute /// Predefined format kind to use. public DateTimeFormatAttribute(DateTimeFormatKind kind) { - if (kind < 0 || kind > DateTimeFormatKind.InvariantLocaleShort) + if (kind is < 0 or > DateTimeFormatKind.InvariantLocaleShort) throw new ArgumentOutOfRangeException(nameof(kind), "Specified format kind is not legal or supported."); this.Kind = kind; diff --git a/DisCatSharp.Common/Attributes/DecomposerAttribute.cs b/DisCatSharp.Common/Attributes/DecomposerAttribute.cs index 6410aa643..67ff73c29 100644 --- a/DisCatSharp.Common/Attributes/DecomposerAttribute.cs +++ b/DisCatSharp.Common/Attributes/DecomposerAttribute.cs @@ -19,8 +19,11 @@ public sealed class DecomposerAttribute : SerializationAttribute /// Type of decomposer to use. public DecomposerAttribute(Type type) { - if (!typeof(IDecomposer).IsAssignableFrom(type) || !type.IsClass || type.IsAbstract) // abstract covers static - static = abstract + sealed - throw new ArgumentException("Invalid type specified. Must be a non-abstract class which implements DisCatSharp.Common.Serialization.IDecomposer interface.", nameof(type)); + if (!typeof(IDecomposer).IsAssignableFrom(type) || !type.IsClass || + type.IsAbstract) // abstract covers static - static = abstract + sealed + throw new + ArgumentException("Invalid type specified. Must be a non-abstract class which implements DisCatSharp.Common.Serialization.IDecomposer interface.", + nameof(type)); this.DecomposerType = type; } diff --git a/DisCatSharp.Common/Attributes/IncludeNullAttribute.cs b/DisCatSharp.Common/Attributes/IncludeNullAttribute.cs index 331fa07a7..8406b7d3f 100644 --- a/DisCatSharp.Common/Attributes/IncludeNullAttribute.cs +++ b/DisCatSharp.Common/Attributes/IncludeNullAttribute.cs @@ -6,7 +6,7 @@ namespace DisCatSharp.Common.Serialization; /// Specifies that if the value of the field or property is null, it should be included in the serialized data. /// This alters the default behaviour of ignoring nulls. /// -[Obsolete("Use [DataMember] with EmitDefaultValue = true.")] -[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] +[Obsolete("Use [DataMember] with EmitDefaultValue = true."), + AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] public sealed class IncludeNullAttribute : SerializationAttribute { } diff --git a/DisCatSharp.Common/Attributes/SerializedNameAttribute.cs b/DisCatSharp.Common/Attributes/SerializedNameAttribute.cs index c1cc04133..8bdd99ec7 100644 --- a/DisCatSharp.Common/Attributes/SerializedNameAttribute.cs +++ b/DisCatSharp.Common/Attributes/SerializedNameAttribute.cs @@ -5,8 +5,8 @@ namespace DisCatSharp.Common.Serialization; /// /// Declares name of a property in serialized data. This is used for mapping serialized data to object properties and fields. /// -[Obsolete("Use [DataMember] with set Name instead.")] -[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] +[Obsolete("Use [DataMember] with set Name instead."), + AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] public sealed class SerializedNameAttribute : SerializationAttribute { /// diff --git a/DisCatSharp.Common/Attributes/TimeSpanFormatAttribute.cs b/DisCatSharp.Common/Attributes/TimeSpanFormatAttribute.cs index 9f29478a9..69575c9cd 100644 --- a/DisCatSharp.Common/Attributes/TimeSpanFormatAttribute.cs +++ b/DisCatSharp.Common/Attributes/TimeSpanFormatAttribute.cs @@ -1,4 +1,5 @@ using System; + // ReSharper disable InconsistentNaming namespace DisCatSharp.Common.Serialization; @@ -32,7 +33,7 @@ public sealed class TimeSpanFormatAttribute : SerializationAttribute /// /// Gets the custom datetime format string to use. /// - public string Format { get; } + public string? Format { get; } /// /// Gets the predefined datetime format kind. @@ -45,7 +46,7 @@ public sealed class TimeSpanFormatAttribute : SerializationAttribute /// Predefined format kind to use. public TimeSpanFormatAttribute(TimeSpanFormatKind kind) { - if (kind < 0 || kind > TimeSpanFormatKind.InvariantLocaleShort) + if (kind is < 0 or > TimeSpanFormatKind.InvariantLocaleShort) throw new ArgumentOutOfRangeException(nameof(kind), "Specified format kind is not legal or supported."); this.Kind = kind; diff --git a/DisCatSharp.Common/GlobalSuppressions.cs b/DisCatSharp.Common/GlobalSuppressions.cs index 1fe60ed41..8d5a83115 100644 --- a/DisCatSharp.Common/GlobalSuppressions.cs +++ b/DisCatSharp.Common/GlobalSuppressions.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -[assembly: SuppressMessage("Style", "IDE0090:Use 'new(...)'", Justification = "", Scope = "member", Target = "~F:DisCatSharp.Common.Utilities.AsyncEvent`2._lock")] +/*[assembly: SuppressMessage("Style", "IDE0090:Use 'new(...)'", Justification = "", Scope = "member", Target = "~F:DisCatSharp.Common.Utilities.AsyncEvent`2._lock")] [assembly: SuppressMessage("Style", "IDE0022:Use expression body for methods", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.CharSpanLookupDictionary`1.Enumerator.Dispose")] [assembly: SuppressMessage("Style", "IDE0083:Use pattern matching", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.CharSpanLookupDictionary`1.System#Collections#IDictionary#Add(System.Object,System.Object)")] [assembly: SuppressMessage("Style", "IDE0083:Use pattern matching", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.CharSpanLookupDictionary`1.System#Collections#IDictionary#Contains(System.Object)~System.Boolean")] @@ -40,14 +40,20 @@ [assembly: SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.SecureRandom.GetUInt64(System.UInt64,System.UInt64)~System.UInt64")] [assembly: SuppressMessage("Style", "IDE0048:Add parentheses for clarity", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.SecureRandom.GetUInt8(System.Byte,System.Byte)~System.Byte")] [assembly: SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.SecureRandom.GetUInt8(System.Byte,System.Byte)~System.Byte")] -[assembly: SuppressMessage("Style", "IDE0045:Convert to conditional expression", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.Utilities.AsyncExecutor.Execute(System.Threading.Tasks.Task)")] -[assembly: SuppressMessage("Style", "IDE0062:Make local function 'static'", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.Utilities.AsyncExecutor.Execute(System.Threading.Tasks.Task)")] -[assembly: SuppressMessage("Style", "IDE0045:Convert to conditional expression", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.Utilities.AsyncExecutor.Execute``1(System.Threading.Tasks.Task{``0})~``0")] -[assembly: SuppressMessage("Style", "IDE0062:Make local function 'static'", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.Utilities.AsyncExecutor.Execute``1(System.Threading.Tasks.Task{``0})~``0")] -[assembly: SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.Utilities.ReflectionUtilities.ToDictionary``1(``0)~System.Collections.Generic.IReadOnlyDictionary{System.String,System.Object}")] +[assembly: SuppressMessage("Style", "IDE0045:Convert to conditional expression", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.Utilities.AsyncExecutor.Execute(System.Threading.Tasks.Task)")]*/ +[assembly: + SuppressMessage("Style", "IDE0062:Make local function 'static'", Justification = "", Scope = "member", + Target = "~M:DisCatSharp.Common.Utilities.AsyncExecutor.Execute(System.Threading.Tasks.Task)")] +//[assembly: SuppressMessage("Style", "IDE0045:Convert to conditional expression", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.Utilities.AsyncExecutor.Execute``1(System.Threading.Tasks.Task{``0})~``0")] +[assembly: + SuppressMessage("Style", "IDE0062:Make local function 'static'", Justification = "", Scope = "member", + Target = + "~M:DisCatSharp.Common.Utilities.AsyncExecutor.Execute``1(System.Threading.Tasks.Task{``0})~``0")] +//[assembly: SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Common.Utilities.ReflectionUtilities.ToDictionary``1(``0)~System.Collections.Generic.IReadOnlyDictionary{System.String,System.Object}")] [assembly: SuppressMessage("Usage", "DCS0102:[Discord] Deprecated", Justification = "")] [assembly: SuppressMessage("Usage", "DCS0101:[Discord] InExperiment", Justification = "")] [assembly: SuppressMessage("Usage", "DCS0103:[Discord] InExperiment", Justification = "")] [assembly: SuppressMessage("Usage", "DCS0001:[Discord] InExperiment", Justification = "")] [assembly: SuppressMessage("Usage", "DCS0002:[Discord] InExperiment", Justification = "")] [assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "")] +[assembly: SuppressMessage("GeneratedRegex", "SYSLIB1045:Convert to 'GeneratedRegexAttribute'.", Justification = "")] diff --git a/DisCatSharp.Common/RegularExpressions/CommonRegEx.cs b/DisCatSharp.Common/RegularExpressions/CommonRegEx.cs index d9aadf9a7..76ecc057c 100644 --- a/DisCatSharp.Common/RegularExpressions/CommonRegEx.cs +++ b/DisCatSharp.Common/RegularExpressions/CommonRegEx.cs @@ -23,7 +23,8 @@ public static Regex RgbColorString /// Represents a timespan. /// public static Regex TimeSpan - => new(@"^(?\d+d\s*)?(?\d{1,2}h\s*)?(?\d{1,2}m\s*)?(?\d{1,2}s\s*)?$", RegexOptions.ECMAScript | RegexOptions.Compiled); + => new(@"^(?\d+d\s*)?(?\d{1,2}h\s*)?(?\d{1,2}m\s*)?(?\d{1,2}s\s*)?$", + RegexOptions.ECMAScript | RegexOptions.Compiled); /// /// Represents a advanced youtube regex. @@ -48,5 +49,6 @@ public static Regex TimeSpan /// /// public static Regex AdvancedYoutubeRegex - => new(@"http(s)?:\/\/(www\.)?youtu(\.be|be\.com)\/(watch\?v=|playlist)?(?\w{1,})?((\?|\&)list=(?[\w-_]{1,}))(&index=(?\d{1,}))?", RegexOptions.ECMAScript | RegexOptions.Compiled); + => new(@"http(s)?:\/\/(www\.)?youtu(\.be|be\.com)\/(watch\?v=|playlist)?(?\w{1,})?((\?|\&)list=(?[\w-_]{1,}))(&index=(?\d{1,}))?", + RegexOptions.ECMAScript | RegexOptions.Compiled); } diff --git a/DisCatSharp.Common/RegularExpressions/DiscordRegEx.cs b/DisCatSharp.Common/RegularExpressions/DiscordRegEx.cs index 54971bb80..a4f527f29 100644 --- a/DisCatSharp.Common/RegularExpressions/DiscordRegEx.cs +++ b/DisCatSharp.Common/RegularExpressions/DiscordRegEx.cs @@ -14,25 +14,29 @@ public static class DiscordRegEx /// Represents a invite. /// public static readonly Regex Invite - = new($@"^((https?:\/\/)?(www\.)?discord\.gg(\/.*)*|{WEBSITE}invite)\/(?[a-zA-Z0-9]*)(\?event=(?\d+))?$", RegexOptions.ECMAScript | RegexOptions.Compiled); + = new($@"^((https?:\/\/)?(www\.)?discord\.gg(\/.*)*|{WEBSITE}invite)\/(?[a-zA-Z0-9]*)(\?event=(?\d+))?$", + RegexOptions.ECMAScript | RegexOptions.Compiled); /// /// Represents a message link. /// public static readonly Regex MessageLink - = new($@"^{WEBSITE}channels\/(?(?:\d+|@me))\/(?\d+)\/(?\d+)\/?", RegexOptions.ECMAScript | RegexOptions.Compiled); + = new($@"^{WEBSITE}channels\/(?(?:\d+|@me))\/(?\d+)\/(?\d+)\/?", + RegexOptions.ECMAScript | RegexOptions.Compiled); /// /// Represents a emoji. /// public static readonly Regex Emoji - = new(@"^<(?a)?:(?[a-zA-Z0-9_]+?):(?\d+?)>$", RegexOptions.ECMAScript | RegexOptions.Compiled); + = new(@"^<(?a)?:(?[a-zA-Z0-9_]+?):(?\d+?)>$", + RegexOptions.ECMAScript | RegexOptions.Compiled); /// /// Represents a animated emoji. /// public static readonly Regex AnimatedEmoji - = new(@"^<(?a):(?\w{2,32}):(?\d{17,20})>$", RegexOptions.ECMAScript | RegexOptions.Compiled); + = new(@"^<(?a):(?\w{2,32}):(?\d{17,20})>$", + RegexOptions.ECMAScript | RegexOptions.Compiled); /// /// Represents a non-animated emoji. @@ -44,7 +48,8 @@ public static readonly Regex StaticEmoji /// Represents a timestamp. /// public static readonly Regex Timestamp - = new(@"^-?\d{1,13})(:(?