mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
General cleanup and refactor.
This commit is contained in:
816
.editorconfig
816
.editorconfig
@@ -1,632 +1,216 @@
|
|||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
next_line = crlf
|
end_of_line = lf
|
||||||
|
trim_trailing_whitespace = false
|
||||||
insert_final_newline = false
|
insert_final_newline = false
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
# Generic non-language specific ones for Resharper and friends
|
# Microsoft .NET properties
|
||||||
brace_style = next_line
|
csharp_new_line_between_query_expression_clauses = false
|
||||||
int_align = true
|
csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion
|
||||||
keep_existing_arrangement = false
|
csharp_prefer_braces = false:warning
|
||||||
place_simple_blocks_on_single_line = true
|
csharp_space_after_keywords_in_control_flow_statements = false
|
||||||
place_simple_declaration_blocks_on_single_line = true
|
csharp_style_var_elsewhere = false:suggestion
|
||||||
place_attribute_on_same_line = false
|
csharp_style_var_for_built_in_types = false:suggestion
|
||||||
space_after_unary_operator = false
|
csharp_style_var_when_type_is_apparent = true:suggestion
|
||||||
space_after_comma = true
|
csharp_using_directive_placement = inside_namespace:silent
|
||||||
space_around_ternary_operator = true
|
dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True
|
||||||
space_around_binary_operator = true
|
dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field
|
||||||
space_around_member_access_operator = false
|
dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef
|
||||||
space_before_open_square_brackets = false
|
dotnet_naming_rule.unity_serialized_field_rule.severity = warning
|
||||||
space_after_keywords_in_control_flow_statements = true
|
dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style
|
||||||
space_before_comma = false
|
dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols
|
||||||
space_between_method_call_name_and_opening_parenthesis = false
|
dotnet_naming_rule.unity_serialized_field_rule_1.import_to_resharper = True
|
||||||
space_between_method_declaration_name_and_open_parenthesis = false
|
dotnet_naming_rule.unity_serialized_field_rule_1.resharper_description = Unity serialized field
|
||||||
space_between_square_brackets = false
|
dotnet_naming_rule.unity_serialized_field_rule_1.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef
|
||||||
space_between_parentheses_of_control_flow_statements = false
|
dotnet_naming_rule.unity_serialized_field_rule_1.severity = warning
|
||||||
accessor_owner_declaration_braces = next_line
|
dotnet_naming_rule.unity_serialized_field_rule_1.style = lower_camel_case_style
|
||||||
accessor_declaration_braces = next_line
|
dotnet_naming_rule.unity_serialized_field_rule_1.symbols = unity_serialized_field_symbols_1
|
||||||
case_block_braces = next_line
|
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
|
||||||
initializer_braces = next_line
|
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = *
|
||||||
other_braces = next_line
|
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
|
||||||
allow_comment_after_lbrace = false
|
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
|
||||||
empty_block_style = together_same_line
|
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance
|
||||||
braces_for_ifelse = not_required
|
dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_accessibilities = *
|
||||||
braces_for_for = not_required
|
dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_kinds =
|
||||||
braces_for_foreach = not_required
|
dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_applicable_kinds = unity_serialised_field
|
||||||
braces_for_while = not_required
|
dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_required_modifiers = instance
|
||||||
braces_for_dowhile = not_required
|
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:warning
|
||||||
braces_for_using = not_required
|
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:warning
|
||||||
braces_for_lock = not_required
|
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:warning
|
||||||
braces_for_fixed = not_required
|
|
||||||
method_or_operator_body = expression_body
|
|
||||||
local_function_body = expression_body
|
|
||||||
constructor_or_destructor_body = expression_body
|
|
||||||
accessor_owner_body = expression_body
|
|
||||||
force_attribute_style = join
|
|
||||||
function_braces = next_line
|
|
||||||
force_control_statements_braces = always_remove
|
|
||||||
space_in_singleline_accessorholder = true
|
|
||||||
type_declaration_braces = next_line
|
|
||||||
invocable_declaration_braces = next_line
|
|
||||||
anonymous_method_declaration_braces = next_line
|
|
||||||
space_between_accessors_in_singleline_property = true
|
|
||||||
indent_nested_usings_stmt = true
|
|
||||||
space_within_empty_braces = false
|
|
||||||
indent_nested_fixed_stmt = true
|
|
||||||
indent_nested_lock_stmt = true
|
|
||||||
indent_nested_for_stmt = true
|
|
||||||
indent_nested_foreach_stmt = true
|
|
||||||
indent_nested_while_stmt = true
|
|
||||||
use_continuous_indent_inside_parens = true
|
|
||||||
indent_method_decl_pars = inside
|
|
||||||
indent_invocation_pars = inside
|
|
||||||
indent_statement_pars = inside
|
|
||||||
indent_typeparam_angles = inside
|
|
||||||
indent_typearg_angles = inside
|
|
||||||
indent_pars = inside
|
|
||||||
indent_preprocessor_if = outdent
|
|
||||||
indent_preprocessor_region = usual_indent
|
|
||||||
indent_preprocessor_other = usual_indent
|
|
||||||
indent_switch_labels = true
|
|
||||||
indent_type_constraints = true
|
|
||||||
stick_comment = false
|
|
||||||
alignment_tab_fill_style = use_spaces
|
|
||||||
align_multiline_parameter = true
|
|
||||||
align_multiline_extends_list = true
|
|
||||||
align_linq_query = true
|
|
||||||
align_multiline_binary_expressions_chain = true
|
|
||||||
outdent_binary_ops = true
|
|
||||||
align_multiline_calls_chain = true
|
|
||||||
outdent_dots = true
|
|
||||||
align_multiline_array_and_object_initializer = false
|
|
||||||
indent_anonymous_method_block = false
|
|
||||||
align_first_arg_by_paren = true
|
|
||||||
align_multiline_argument = true
|
|
||||||
align_tuple_components = true
|
|
||||||
align_multiline_expression = true
|
|
||||||
align_multiline_for_stmt = true
|
|
||||||
align_multiple_declaration = true
|
|
||||||
align_multline_type_parameter_list = true
|
|
||||||
align_multline_type_parameter_constrains = true
|
|
||||||
int_align_fields = true
|
|
||||||
int_align_properties = true
|
|
||||||
int_align_methods = true
|
|
||||||
int_align_parameters = false
|
|
||||||
int_align_variables = true
|
|
||||||
int_align_assignments = true
|
|
||||||
int_align_nested_ternary = true
|
|
||||||
int_align_invocations = false
|
|
||||||
int_align_binary_expressions = true
|
|
||||||
int_align_comments = true
|
|
||||||
int_align_switch_sections = true
|
|
||||||
keep_user_linebreaks = false
|
|
||||||
keep_existing_arrangement = false
|
|
||||||
keep_existing_linebreaks = false
|
|
||||||
max_line_length = 120
|
|
||||||
wrap_before_comma = false
|
|
||||||
special_else_if_treatment = true
|
|
||||||
place_type_attribute_on_same_line = never
|
|
||||||
place_method_attribute_on_same_line = never
|
|
||||||
place_accessorholder_attribute_on_same_line = never
|
|
||||||
place_attribute_on_same_line = never
|
|
||||||
place_accessor_attribute_on_same_line = never
|
|
||||||
place_attribute_on_same_line = never
|
|
||||||
place_field_attribute_on_same_line = never
|
|
||||||
place_attribute_on_same_line = never
|
|
||||||
wrap_parameters_style = wrap_if_long
|
|
||||||
keep_existing_declaration_parens_arrangement = false
|
|
||||||
wrap_before_declaration_lpar = false
|
|
||||||
wrap_after_declaration_lpar = false
|
|
||||||
wrap_before_declaration_rpar = false
|
|
||||||
place_constructor_initializer_on_same_line = true
|
|
||||||
keep_existing_expr_member_arrangement = false
|
|
||||||
place_expr_method_on_single_line = true
|
|
||||||
place_expr_property_on_single_line = true
|
|
||||||
place_expr_accessor_on_single_line = true
|
|
||||||
wrap_before_arrow_with_expressions = false
|
|
||||||
place_type_constraints_on_same_line = true
|
|
||||||
wrap_before_first_type_parameter_constraint = true
|
|
||||||
wrap_multiple_type_parameter_constraints_style = wrap_if_long
|
|
||||||
wrap_before_type_parameter_langle = true
|
|
||||||
wrap_before_extends_colon = false
|
|
||||||
wrap_extends_list_style = wrap_if_long
|
|
||||||
keep_existing_declaration_block_arrangement = false
|
|
||||||
place_abstract_accessorholder_on_single_line = true
|
|
||||||
place_simple_accessorholder_on_single_line = false
|
|
||||||
place_accessor_with_attrs_holder_on_single_line = false
|
|
||||||
place_simple_accessor_on_single_line = true
|
|
||||||
place_simple_method_on_single_line = false
|
|
||||||
keep_existing_enum_arrangement = false
|
|
||||||
place_simple_enum_on_single_line = false
|
|
||||||
wrap_enum_declaration = wrap_if_long
|
|
||||||
new_line_before_else = true
|
|
||||||
new_line_before_while = false
|
|
||||||
wrap_for_stmt_header_style = wrap_if_long
|
|
||||||
wrap_multiple_declaration_style = wrap_if_long
|
|
||||||
keep_existing_embedded_arrangement = false
|
|
||||||
place_simple_embedded_statement_on_same_line = false
|
|
||||||
place_simple_case_statement_on_same_line = true
|
|
||||||
keep_existing_embedded_block_arrangement = false
|
|
||||||
place_simple_embedded_block_on_same_line = false
|
|
||||||
place_simple_anonymousmethod_on_single_line = false
|
|
||||||
keep_existing_initializer_arrangement = false
|
|
||||||
place_simple_initializer_on_single_line = false
|
|
||||||
wrap_object_and_collection_initializer_style = chop_always
|
|
||||||
wrap_array_initializer_style = wrap_if_long
|
|
||||||
wrap_arguments_style = wrap_if_long
|
|
||||||
keep_existing_invocation_parens_arrangement = false
|
|
||||||
wrap_after_invocation_lpar = false
|
|
||||||
wrap_before_invocation_rpar = false
|
|
||||||
wrap_after_dot_in_method_calls = true
|
|
||||||
wrap_chained_method_calls = wrap_if_long
|
|
||||||
wrap_before_binary_opsign = false
|
|
||||||
wrap_chained_binary_expressions = wrap_if_long
|
|
||||||
force_chop_compound_if_expression = true
|
|
||||||
force_chop_compound_while_expression = true
|
|
||||||
force_chop_compound_do_expression = true
|
|
||||||
wrap_before_ternary_opsigns = true
|
|
||||||
wrap_ternary_expr_style = wrap_if_long
|
|
||||||
nested_ternary_style = expanded
|
|
||||||
wrap_linq_expressions = wrap_if_long
|
|
||||||
wrap_before_linq_expression = false
|
|
||||||
place_linq_into_on_new_line = false
|
|
||||||
wrap_verbatim_interpolated_strings = wrap_if_long
|
|
||||||
extra_spaces = remove_all
|
|
||||||
space_after_keywords_in_control_flow_statements = false
|
|
||||||
space_between_method_call_name_and_opening_parenthesis = false
|
|
||||||
space_between_method_declaration_name_and_open_parenthesis = false
|
|
||||||
space_before_typeof_parentheses = false
|
|
||||||
space_before_checked_parentheses = false
|
|
||||||
space_before_sizeof_parentheses = false
|
|
||||||
space_before_nameof_parentheses = false
|
|
||||||
space_between_keyword_and_expression = true
|
|
||||||
space_between_keyword_and_type = true
|
|
||||||
space_around_assignment_op = true
|
|
||||||
space_around_logical_op = true
|
|
||||||
space_around_binary_operator = true
|
|
||||||
space_around_equality_op = true
|
|
||||||
space_around_relational_op = true
|
|
||||||
space_around_bitwise_op = true
|
|
||||||
space_around_additive_op = true
|
|
||||||
space_around_multiplicative_op = true
|
|
||||||
space_around_shift_op = true
|
|
||||||
space_around_nullcoalescing_op = true
|
|
||||||
space_around_arrow_op = false
|
|
||||||
space_after_logical_not_op = false
|
|
||||||
space_after_unary_operator = false
|
|
||||||
space_after_cast = false
|
|
||||||
space_around_dot = false
|
|
||||||
space_around_lambda_arrow = true
|
|
||||||
space_before_pointer_asterik_declaration = false
|
|
||||||
space_before_nullable_mark = false
|
|
||||||
blank_lines_around_class_definition = 1
|
|
||||||
namespace_indentation = all
|
|
||||||
space_within_template_argument = false
|
|
||||||
align_union_type_usage = true
|
|
||||||
space_in_singleline_method = true
|
|
||||||
space_in_singleline_anonymous_method = true
|
|
||||||
space_within_single_line_array_initializer_braces = true
|
|
||||||
space_around_arrow_op = false
|
|
||||||
|
|
||||||
# These are for markup languages (HTML, XML, etc)
|
|
||||||
spaces_around_eq_in_pi_attribute = false
|
|
||||||
space_after_last_pi_attribute = true
|
|
||||||
pi_attributes_indent = align_by_first_attribute
|
|
||||||
blank_line_after_pi = true
|
|
||||||
spaces_around_eq_in_attribute = false
|
|
||||||
space_after_last_attribute = false
|
|
||||||
space_before_self_closing = true
|
|
||||||
attribute_style = on_single_line
|
|
||||||
attribute_indent = align_by_first_attribute
|
|
||||||
sort_attributes = true
|
|
||||||
sort_class_selectors = true
|
|
||||||
max_blank_lines_between_tags = 0
|
|
||||||
linebreak_before_all_elements = true
|
|
||||||
linebreak_before_multiline_elements = true
|
|
||||||
quote_style = doublequoted
|
|
||||||
delete_quotes_from_solid_values = false
|
|
||||||
normalize_tag_names = true
|
|
||||||
|
|
||||||
|
|
||||||
[{.babelrc,.stylelintrc,jest.config,.eslintrc,.prettierrc,*.json,*.jsb3,*.jsb2,*.bowerrc}]
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
[*.js.map]
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
[*.{css,scss}]
|
|
||||||
indent_size = 2
|
|
||||||
declarations_style = separate_lines_for_nonsingle
|
|
||||||
media_query_style = separate_lines
|
|
||||||
selector_style = same_line
|
|
||||||
properties_style = separate_lines_for_nonsingle
|
|
||||||
brace_style = next_line
|
|
||||||
|
|
||||||
[{.analysis_options,*.yml,*.yaml}]
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
# Xml project files
|
|
||||||
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
# Xml files
|
|
||||||
[*.{xml,stylecop,resx,ruleset}]
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
# Xml config files
|
|
||||||
[*.{props,targets,config,nuspec}]
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
# .net files
|
|
||||||
[*.{cs,vb}]
|
|
||||||
# These set the this. / Me.
|
|
||||||
dotnet_style_qualification_for_field = false:warning
|
|
||||||
dotnet_style_qualification_for_property = false:warning
|
|
||||||
dotnet_style_qualification_for_method = false:warning
|
|
||||||
dotnet_style_qualification_for_event = false:warning
|
|
||||||
|
|
||||||
# These make it suggest Int32 instead of int, etc.
|
|
||||||
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
|
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
|
||||||
dotnet_style_predefined_type_for_member_access = true:suggestion
|
dotnet_style_predefined_type_for_member_access = true:suggestion
|
||||||
|
dotnet_style_qualification_for_event = false:suggestion
|
||||||
# This controls implicit access modifiers
|
dotnet_style_qualification_for_field = false:suggestion
|
||||||
|
dotnet_style_qualification_for_method = false:suggestion
|
||||||
|
dotnet_style_qualification_for_property = false:suggestion
|
||||||
dotnet_style_require_accessibility_modifiers = never:suggestion
|
dotnet_style_require_accessibility_modifiers = never:suggestion
|
||||||
|
|
||||||
# Prefer non modified fields to be marked readonly
|
# ReSharper properties
|
||||||
dotnet_style_readonly_field = true:warning
|
resharper_align_first_arg_by_paren = true
|
||||||
|
resharper_align_linq_query = true
|
||||||
|
resharper_align_multiline_argument = true
|
||||||
|
resharper_align_multiline_binary_expressions_chain = true
|
||||||
|
resharper_align_multiline_binary_patterns = true
|
||||||
|
resharper_align_multiline_calls_chain = true
|
||||||
|
resharper_align_multiline_expression = true
|
||||||
|
resharper_align_multiline_extends_list = true
|
||||||
|
resharper_align_multiline_for_stmt = true
|
||||||
|
resharper_align_multiline_parameter = true
|
||||||
|
resharper_align_multiline_property_pattern = true
|
||||||
|
resharper_align_multiline_switch_expression = true
|
||||||
|
resharper_align_multiple_declaration = true
|
||||||
|
resharper_align_multline_type_parameter_constrains = true
|
||||||
|
resharper_align_multline_type_parameter_list = true
|
||||||
|
resharper_align_tuple_components = true
|
||||||
|
resharper_attribute_indent = align_by_first_attribute
|
||||||
|
resharper_attribute_style = on_single_line
|
||||||
|
resharper_autodetect_indent_settings = true
|
||||||
|
resharper_constructor_or_destructor_body = expression_body
|
||||||
|
resharper_cpp_brace_style = next_line
|
||||||
|
resharper_csharp_outdent_commas = true
|
||||||
|
resharper_default_value_when_type_not_evident = default_expression
|
||||||
|
resharper_empty_block_style = together_same_line
|
||||||
|
resharper_force_attribute_style = join
|
||||||
|
resharper_force_chop_compound_do_expression = true
|
||||||
|
resharper_force_chop_compound_if_expression = true
|
||||||
|
resharper_force_chop_compound_while_expression = true
|
||||||
|
resharper_for_built_in_types = use_var_when_evident
|
||||||
|
resharper_fsharp_type_declaration_braces = next_line
|
||||||
|
resharper_indent_nested_fixed_stmt = true
|
||||||
|
resharper_indent_nested_foreach_stmt = true
|
||||||
|
resharper_indent_nested_for_stmt = true
|
||||||
|
resharper_indent_nested_lock_stmt = true
|
||||||
|
resharper_indent_nested_usings_stmt = true
|
||||||
|
resharper_indent_nested_while_stmt = true
|
||||||
|
resharper_indent_preprocessor_if = outdent
|
||||||
|
resharper_indent_preprocessor_other = usual_indent
|
||||||
|
resharper_indent_switch_labels = true
|
||||||
|
resharper_int_align_assignments = true
|
||||||
|
resharper_int_align_binary_expressions = true
|
||||||
|
resharper_int_align_comments = true
|
||||||
|
resharper_int_align_fields = true
|
||||||
|
resharper_int_align_methods = true
|
||||||
|
resharper_int_align_nested_ternary = true
|
||||||
|
resharper_int_align_properties = true
|
||||||
|
resharper_int_align_property_patterns = true
|
||||||
|
resharper_int_align_switch_expressions = true
|
||||||
|
resharper_int_align_switch_sections = true
|
||||||
|
resharper_int_align_variables = true
|
||||||
|
resharper_keep_existing_arrangement = false
|
||||||
|
resharper_keep_user_linebreaks = false
|
||||||
|
resharper_linebreak_before_all_elements = true
|
||||||
|
resharper_local_function_body = expression_body
|
||||||
|
resharper_max_blank_lines_between_tags = 0
|
||||||
|
resharper_max_enum_members_on_line = 1
|
||||||
|
resharper_method_or_operator_body = expression_body
|
||||||
|
resharper_nested_ternary_style = expanded
|
||||||
|
resharper_new_line_before_while = false
|
||||||
|
resharper_normalize_tag_names = true
|
||||||
|
resharper_outdent_binary_ops = true
|
||||||
|
resharper_outdent_binary_pattern_ops = true
|
||||||
|
resharper_outdent_dots = true
|
||||||
|
resharper_outdent_statement_labels = true
|
||||||
|
resharper_place_attribute_on_same_line = false
|
||||||
|
resharper_place_expr_accessor_on_single_line = true
|
||||||
|
resharper_place_expr_method_on_single_line = true
|
||||||
|
resharper_place_expr_property_on_single_line = true
|
||||||
|
resharper_place_linq_into_on_new_line = false
|
||||||
|
resharper_place_simple_anonymousmethod_on_single_line = false
|
||||||
|
resharper_place_simple_case_statement_on_same_line = true
|
||||||
|
resharper_place_simple_embedded_statement_on_same_line = false
|
||||||
|
resharper_place_simple_initializer_on_single_line = false
|
||||||
|
resharper_place_simple_switch_expression_on_single_line = true
|
||||||
|
resharper_prefer_explicit_discard_declaration = true
|
||||||
|
resharper_qualified_using_at_nested_scope = true
|
||||||
|
resharper_show_autodetect_configure_formatting_tip = false
|
||||||
|
resharper_sort_attributes = true
|
||||||
|
resharper_sort_class_selectors = true
|
||||||
|
resharper_space_after_keywords_in_control_flow_statements = false
|
||||||
|
resharper_space_after_last_pi_attribute = true
|
||||||
|
resharper_space_after_unary_operator = false
|
||||||
|
resharper_space_around_binary_operator = true
|
||||||
|
resharper_space_before_self_closing = true
|
||||||
|
resharper_space_within_empty_braces = false
|
||||||
|
resharper_stick_comment = false
|
||||||
|
resharper_use_indent_from_vs = false
|
||||||
|
resharper_wrap_after_dot_in_method_calls = true
|
||||||
|
resharper_wrap_before_first_type_parameter_constraint = true
|
||||||
|
resharper_wrap_before_type_parameter_langle = true
|
||||||
|
resharper_wrap_enum_declaration = wrap_if_long
|
||||||
|
resharper_wrap_for_stmt_header_style = wrap_if_long
|
||||||
|
resharper_wrap_lines = true
|
||||||
|
resharper_wrap_multiple_declaration_style = wrap_if_long
|
||||||
|
resharper_wrap_multiple_type_parameter_constraints_style = wrap_if_long
|
||||||
|
resharper_wrap_object_and_collection_initializer_style = chop_always
|
||||||
|
resharper_wrap_ternary_expr_style = wrap_if_long
|
||||||
|
resharper_wrap_verbatim_interpolated_strings = wrap_if_long
|
||||||
|
|
||||||
# Parenthesis settings
|
# ReSharper inspection severities
|
||||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning
|
resharper_annotate_can_be_null_parameter_highlighting = warning
|
||||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning
|
resharper_annotate_can_be_null_type_member_highlighting = warning
|
||||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning
|
resharper_annotate_not_null_parameter_highlighting = warning
|
||||||
dotnet_style_parentheses_in_other_operators = always_for_clarity:warning
|
resharper_annotate_not_null_type_member_highlighting = warning
|
||||||
|
resharper_arrange_attributes_highlighting = hint
|
||||||
|
resharper_arrange_constructor_or_destructor_body_highlighting = warning
|
||||||
|
resharper_arrange_default_value_when_type_evident_highlighting = warning
|
||||||
|
resharper_arrange_default_value_when_type_not_evident_highlighting = warning
|
||||||
|
resharper_arrange_local_function_body_highlighting = warning
|
||||||
|
resharper_arrange_method_or_operator_body_highlighting = warning
|
||||||
|
resharper_arrange_object_creation_when_type_evident_highlighting = warning
|
||||||
|
resharper_arrange_object_creation_when_type_not_evident_highlighting = warning
|
||||||
|
resharper_arrange_redundant_parentheses_highlighting = hint
|
||||||
|
resharper_arrange_this_qualifier_highlighting = hint
|
||||||
|
resharper_arrange_type_member_modifiers_highlighting = hint
|
||||||
|
resharper_arrange_type_modifiers_highlighting = hint
|
||||||
|
resharper_async_void_method_highlighting = warning
|
||||||
|
resharper_built_in_type_reference_style_for_member_access_highlighting = hint
|
||||||
|
resharper_built_in_type_reference_style_highlighting = hint
|
||||||
|
resharper_compare_non_constrained_generic_with_null_highlighting = warning
|
||||||
|
resharper_heap_view_boxing_allocation_highlighting = none
|
||||||
|
resharper_heap_view_delegate_allocation_highlighting = none
|
||||||
|
resharper_heap_view_object_allocation_evident_highlighting = none
|
||||||
|
resharper_heap_view_object_allocation_highlighting = none
|
||||||
|
resharper_inheritdoc_consider_usage_highlighting = warning
|
||||||
|
resharper_local_function_can_be_made_static_highlighting = warning
|
||||||
|
resharper_loop_can_be_partly_converted_to_query_highlighting = warning
|
||||||
|
resharper_member_can_be_internal_highlighting = warning
|
||||||
|
resharper_nullable_warning_suppression_is_used_highlighting = warning
|
||||||
|
resharper_redundant_base_qualifier_highlighting = warning
|
||||||
|
resharper_remove_constructor_invocation_highlighting = warning
|
||||||
|
resharper_separate_control_transfer_statement_highlighting = warning
|
||||||
|
resharper_string_ends_with_is_culture_specific_highlighting = warning
|
||||||
|
resharper_string_starts_with_is_culture_specific_highlighting = warning
|
||||||
|
resharper_struct_member_can_be_made_read_only_highlighting = warning
|
||||||
|
resharper_suggest_var_or_type_built_in_types_highlighting = hint
|
||||||
|
resharper_suggest_var_or_type_elsewhere_highlighting = hint
|
||||||
|
resharper_suggest_var_or_type_simple_types_highlighting = hint
|
||||||
|
resharper_tabs_are_disallowed_highlighting = warning
|
||||||
|
resharper_unnecessary_whitespace_highlighting = warning
|
||||||
|
resharper_use_nameof_expression_for_part_of_the_string_highlighting = warning
|
||||||
|
resharper_use_positional_deconstruction_pattern_highlighting = warning
|
||||||
|
resharper_web_config_module_not_resolved_highlighting = warning
|
||||||
|
resharper_web_config_type_not_resolved_highlighting = warning
|
||||||
|
resharper_web_config_wrong_module_highlighting = warning
|
||||||
|
|
||||||
dotnet_style_object_initializer = true:suggestion
|
[{*.har,*.inputactions,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config}]
|
||||||
dotnet_style_collection_initializer = true:suggestion
|
indent_style = space
|
||||||
dotnet_style_explicit_tuple_names = true:error
|
indent_size = 2
|
||||||
dotnet_style_prefer_inferred_tuple_names = true:warning
|
|
||||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
|
|
||||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
|
|
||||||
dotnet_style_prefer_conditional_expression_over_return = true:warning
|
|
||||||
dotnet_style_coalesce_expression = true:warning
|
|
||||||
dotnet_style_null_propagation = true:error
|
|
||||||
|
|
||||||
dotnet_sort_system_directives_first = true
|
[{*.yaml,*.yml,.analysis_options}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
# Constants in C style, all-caps
|
[*.csv]
|
||||||
dotnet_naming_rule.constant_fields_caps.symbols = constant_fields
|
indent_style = tab
|
||||||
dotnet_naming_rule.constant_fields_caps.severity = warning
|
tab_width = 1
|
||||||
dotnet_naming_rule.constant_fields_caps.style = caps_style
|
|
||||||
dotnet_naming_symbols.constant_fields.applicable_kinds = field
|
|
||||||
dotnet_naming_symbols.constant_fields.required_modifiers = const
|
|
||||||
dotnet_naming_style.caps_style.capitalization = all_upper
|
|
||||||
|
|
||||||
# interfaces should be prefixed with I
|
[{*.bash,*.sh,*.tool,*.zsh}]
|
||||||
dotnet_naming_rule.pascal_case_for_interface.severity = error
|
indent_style = space
|
||||||
dotnet_naming_rule.pascal_case_for_interface.symbols = interfaces_fields
|
indent_size = 2
|
||||||
dotnet_naming_rule.pascal_case_for_interface.style = pascal_case_interface_style
|
|
||||||
dotnet_naming_symbols.interfaces_fields.applicable_kinds = interface
|
|
||||||
dotnet_naming_style.pascal_case_interface_style.required_prefix = I
|
|
||||||
dotnet_naming_style.pascal_case_interface_style.capitalization = pascal_case
|
|
||||||
|
|
||||||
## internal and private fields should be _camelCase
|
[*.{appxmanifest,asax,ascx,aspx,axaml,build,cg,cginc,compute,cs,cshtml,dtd,fs,fsi,fsscript,fsx,hlsl,hlsli,hlslinc,master,ml,mli,nuspec,paml,razor,resw,resx,shader,skin,usf,ush,vb,xaml,xamlx,xoml,xsd}]
|
||||||
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning
|
indent_style = space
|
||||||
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
|
indent_size = 4
|
||||||
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
|
tab_width = 4
|
||||||
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
|
|
||||||
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
|
|
||||||
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
|
|
||||||
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
|
|
||||||
|
|
||||||
# 2018-12-07 NP: This is not yet working in VS2017
|
|
||||||
# local variables should be camelCase
|
|
||||||
#dotnet_naming_rule.camel_case_for_locals.severity = suggestion
|
|
||||||
#dotnet_naming_rule.camel_case_for_locals.symbols = local_fields
|
|
||||||
#dotnet_naming_rule.camel_case_for_locals.style = camel_case_style
|
|
||||||
#dotnet_naming_symbols.local_fields.applicable_kinds = local
|
|
||||||
#dotnet_naming_style.camel_case_style.capitalization = camel_case
|
|
||||||
|
|
||||||
[*.cs]
|
|
||||||
# var var var
|
|
||||||
csharp_style_var_for_built_in_types = false:warning
|
|
||||||
csharp_style_var_when_type_is_apparent = true:suggestion
|
|
||||||
csharp_style_var_elsewhere = false:warning
|
|
||||||
|
|
||||||
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
|
|
||||||
csharp_style_expression_bodied_constructors = when_on_single_line:suggestion
|
|
||||||
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
|
|
||||||
csharp_style_expression_bodied_properties = when_on_single_line:suggestion
|
|
||||||
csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
|
|
||||||
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
|
|
||||||
|
|
||||||
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
|
|
||||||
csharp_style_pattern_matching_over_as_with_null_check = when_on_single_line:warning
|
|
||||||
|
|
||||||
csharp_style_inlined_variable_declaration = true:warning
|
|
||||||
|
|
||||||
csharp_prefer_simple_default_expression = true:warning
|
|
||||||
csharp_style_deconstructed_variable_declaration = false:warning
|
|
||||||
|
|
||||||
csharp_style_throw_expression = true:warning
|
|
||||||
csharp_style_conditional_delegate_call = true:warning
|
|
||||||
|
|
||||||
csharp_prefer_braces = false
|
|
||||||
|
|
||||||
csharp_new_line_before_open_brace = all
|
|
||||||
csharp_new_line_before_else = true
|
|
||||||
csharp_new_line_before_catch = true
|
|
||||||
csharp_new_line_before_finally = true
|
|
||||||
csharp_new_line_before_members_in_object_initializers = true
|
|
||||||
csharp_new_line_before_members_in_anonymous_types = true
|
|
||||||
csharp_new_line_between_query_expression_clauses = true
|
|
||||||
|
|
||||||
csharp_indent_case_contents = true
|
|
||||||
csharp_indent_switch_labels = true
|
|
||||||
csharp_indent_labels = flush_left
|
|
||||||
|
|
||||||
csharp_space_after_cast = false
|
|
||||||
csharp_space_after_keywords_in_control_flow_statements = false
|
|
||||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
|
||||||
csharp_space_between_parentheses = none
|
|
||||||
csharp_space_before_colon_in_inheritance_clause = true
|
|
||||||
csharp_space_after_colon_in_inheritance_clause = true
|
|
||||||
csharp_space_around_binary_operators = before_and_after
|
|
||||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
|
||||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
|
||||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
|
||||||
|
|
||||||
csharp_preserve_single_line_statements = false
|
|
||||||
csharp_preserve_single_line_blocks = true
|
|
||||||
|
|
||||||
csharp_blank_lines_around_region = 0
|
|
||||||
csharp_blank_lines_inside_region = 0
|
|
||||||
csharp_blank_lines_before_single_line_comment = 1
|
|
||||||
csharp_keep_blank_lines_in_declarations = 1
|
|
||||||
csharp_remove_blank_lines_near_braces_in_declarations = true
|
|
||||||
csharp_blank_lines_after_start_comment = false
|
|
||||||
csharp_blank_lines_between_using_groups = 0
|
|
||||||
csharp_blank_lines_after_using_list = 1
|
|
||||||
csharp_blank_lines_around_namespace = 1
|
|
||||||
csharp_blank_lines_inside_namespace = 0
|
|
||||||
csharp_blank_lines_around_type = 1
|
|
||||||
csharp_blank_lines_inside_type = 0
|
|
||||||
csharp_blank_lines_around_field = 0
|
|
||||||
csharp_blank_lines_around_single_line_field = 0
|
|
||||||
csharp_blank_lines_around_property = 1
|
|
||||||
csharp_blank_lines_around_single_line_property = 0
|
|
||||||
csharp_blank_lines_around_auto_property = 0
|
|
||||||
csharp_blank_lines_around_single_line_auto_property = 0
|
|
||||||
csharp_blank_lines_around_invocable = 1
|
|
||||||
csharp_blank_lines_around_single_line_invocable = 1
|
|
||||||
csharp_keep_blank_lines_in_code = 1
|
|
||||||
csharp_remove_blank_lines_near_braces_in_code = true
|
|
||||||
csharp_blank_lines_around_local_method = 1
|
|
||||||
csharp_blank_lines_around_single_line_local_method = 1
|
|
||||||
csharp_blank_lines_before_control_transfer_statements = 1
|
|
||||||
csharp_blank_lines_after_control_transfer_statements = 1
|
|
||||||
csharp_blank_lines_before_block_statements = 1
|
|
||||||
csharp_blank_lines_after_block_statements = 1
|
|
||||||
csharp_blank_lines_before_multiline_statements = 1
|
|
||||||
csharp_blank_lines_after_multiline_statements = 1
|
|
||||||
|
|
||||||
csharp_type_declaration_braces = next_line
|
|
||||||
csharp_brace_style = next_line
|
|
||||||
csharp_indent_inside_namespace = true
|
|
||||||
csharp_invocable_declaration_braces = next_line
|
|
||||||
csharp_anonymous_method_declaration_braces = next_line
|
|
||||||
csharp_accessor_owner_declaration_braces = next_line
|
|
||||||
csharp_accessor_declaration_braces = next_line
|
|
||||||
csharp_case_block_braces = next_line
|
|
||||||
csharp_initializer_braces = next_line
|
|
||||||
csharp_other_braces = next_line
|
|
||||||
csharp_allow_comment_after_lbrace = false
|
|
||||||
csharp_empty_block_style = together_same_line
|
|
||||||
|
|
||||||
csharp_for_built_in_types = use_explicit_type
|
|
||||||
csharp_for_simple_types = use_var_when_evident
|
|
||||||
csharp_for_other_types = use_explicit_type
|
|
||||||
csharp_prefer_separate_deconstructed_variables_declaration = true
|
|
||||||
csharp_prefer_explicit_discard_declaration = false
|
|
||||||
|
|
||||||
csharp_instance_members_qualify_members = none
|
|
||||||
csharp_builtin_type_reference_style = use_keyword
|
|
||||||
csharp_prefer_qualified_reference = false
|
|
||||||
csharp_add_imports_to_deepest_scope = false
|
|
||||||
csharp_allow_alias = true
|
|
||||||
csharp_default_private_modifier = implicit
|
|
||||||
csharp_default_internal_modifier = explicit
|
|
||||||
csharp_arguments_literal = positional
|
|
||||||
csharp_arguments_string_literal = positional
|
|
||||||
csharp_arguments_named = positional
|
|
||||||
csharp_arguments_anonymous_function = positional
|
|
||||||
csharp_arguments_other = positional
|
|
||||||
csharp_braces_for_ifelse = not_required
|
|
||||||
csharp_braces_for_for = not_required
|
|
||||||
csharp_braces_for_foreach = not_required
|
|
||||||
csharp_braces_for_while = not_required
|
|
||||||
csharp_braces_for_dowhile = not_required
|
|
||||||
csharp_braces_for_using = not_required
|
|
||||||
csharp_braces_for_lock = not_required
|
|
||||||
csharp_braces_for_fixed = not_required
|
|
||||||
csharp_method_or_operator_body = expression_body
|
|
||||||
csharp_local_function_body = expression_body
|
|
||||||
csharp_constructor_or_destructor_body = expression_body
|
|
||||||
csharp_accessor_owner_body = expression_body
|
|
||||||
csharp_force_attribute_style = join
|
|
||||||
csharp_indent_nested_usings_stmt = true
|
|
||||||
|
|
||||||
csharp_builtin_type_reference_for_member_access_style = use_keyword
|
|
||||||
csharp_indent_nested_fixed_stmt = true
|
|
||||||
csharp_indent_nested_lock_stmt = true
|
|
||||||
csharp_indent_nested_for_stmt = true
|
|
||||||
csharp_indent_nested_foreach_stmt = true
|
|
||||||
csharp_indent_nested_while_stmt = true
|
|
||||||
csharp_use_continuous_indent_inside_parens = true
|
|
||||||
csharp_indent_method_decl_pars = inside
|
|
||||||
csharp_indent_invocation_pars = inside
|
|
||||||
csharp_indent_statement_pars = inside
|
|
||||||
csharp_indent_typeparam_angles = inside
|
|
||||||
csharp_indent_typearg_angles = inside
|
|
||||||
csharp_indent_pars = inside
|
|
||||||
csharp_indent_preprocessor_if = outdent
|
|
||||||
csharp_indent_preprocessor_region = usual_indent
|
|
||||||
csharp_indent_preprocessor_other = usual_indent
|
|
||||||
csharp_indent_switch_labels = true
|
|
||||||
csharp_indent_type_constraints = true
|
|
||||||
csharp_stick_comment = false
|
|
||||||
csharp_alignment_tab_fill_style = use_spaces
|
|
||||||
csharp_align_multiline_parameter = true
|
|
||||||
csharp_align_multiline_extends_list = true
|
|
||||||
csharp_align_linq_query = true
|
|
||||||
csharp_align_multiline_binary_expressions_chain = true
|
|
||||||
csharp_outdent_binary_ops = true
|
|
||||||
csharp_align_multiline_calls_chain = true
|
|
||||||
csharp_outdent_dots = true
|
|
||||||
csharp_align_multiline_array_and_object_initializer = false
|
|
||||||
csharp_indent_anonymous_method_block = false
|
|
||||||
csharp_align_first_arg_by_paren = true
|
|
||||||
csharp_align_multiline_argument = true
|
|
||||||
csharp_align_tuple_components = true
|
|
||||||
csharp_align_multiline_expression = true
|
|
||||||
csharp_align_multiline_for_stmt = true
|
|
||||||
csharp_align_multiple_declaration = true
|
|
||||||
csharp_align_multline_type_parameter_list = true
|
|
||||||
csharp_align_multline_type_parameter_constrains = true
|
|
||||||
csharp_int_align_fields = true
|
|
||||||
csharp_int_align_properties = true
|
|
||||||
csharp_int_align_methods = true
|
|
||||||
csharp_int_align_parameters = false
|
|
||||||
csharp_int_align_variables = true
|
|
||||||
csharp_int_align_assignments = true
|
|
||||||
csharp_int_align_nested_ternary = true
|
|
||||||
csharp_int_align_invocations = false
|
|
||||||
csharp_int_align_binary_expressions = true
|
|
||||||
csharp_int_align_comments = true
|
|
||||||
csharp_int_align_switch_sections = true
|
|
||||||
csharp_int_align = true
|
|
||||||
csharp_keep_user_linebreaks = false
|
|
||||||
csharp_keep_existing_arrangement = false
|
|
||||||
csharp_keep_existing_linebreaks = false
|
|
||||||
csharp_max_line_length = 120
|
|
||||||
csharp_wrap_before_comma = false
|
|
||||||
csharp_special_else_if_treatment = true
|
|
||||||
csharp_insert_final_newline = false
|
|
||||||
csharp_place_type_attribute_on_same_line = never
|
|
||||||
csharp_place_method_attribute_on_same_line = never
|
|
||||||
csharp_place_accessorholder_attribute_on_same_line = never
|
|
||||||
csharp_place_attribute_on_same_line = never
|
|
||||||
csharp_place_accessor_attribute_on_same_line = never
|
|
||||||
csharp_place_attribute_on_same_line = never
|
|
||||||
csharp_place_field_attribute_on_same_line = never
|
|
||||||
csharp_place_attribute_on_same_line = never
|
|
||||||
csharp_wrap_parameters_style = wrap_if_long
|
|
||||||
csharp_keep_existing_declaration_parens_arrangement = false
|
|
||||||
csharp_wrap_before_declaration_lpar = false
|
|
||||||
csharp_wrap_after_declaration_lpar = false
|
|
||||||
csharp_wrap_before_declaration_rpar = false
|
|
||||||
csharp_place_constructor_initializer_on_same_line = true
|
|
||||||
csharp_keep_existing_expr_member_arrangement = false
|
|
||||||
csharp_place_expr_method_on_single_line = true
|
|
||||||
csharp_place_expr_property_on_single_line = true
|
|
||||||
csharp_place_expr_accessor_on_single_line = true
|
|
||||||
csharp_wrap_before_arrow_with_expressions = false
|
|
||||||
csharp_place_type_constraints_on_same_line = true
|
|
||||||
csharp_wrap_before_first_type_parameter_constraint = true
|
|
||||||
csharp_wrap_multiple_type_parameter_constraints_style = wrap_if_long
|
|
||||||
csharp_wrap_before_type_parameter_langle = true
|
|
||||||
csharp_wrap_before_extends_colon = false
|
|
||||||
csharp_wrap_extends_list_style = wrap_if_long
|
|
||||||
csharp_keep_existing_declaration_block_arrangement = false
|
|
||||||
csharp_place_abstract_accessorholder_on_single_line = true
|
|
||||||
csharp_place_simple_accessorholder_on_single_line = false
|
|
||||||
csharp_place_accessor_with_attrs_holder_on_single_line = false
|
|
||||||
csharp_place_simple_accessor_on_single_line = true
|
|
||||||
csharp_place_simple_method_on_single_line = false
|
|
||||||
csharp_keep_existing_enum_arrangement = false
|
|
||||||
csharp_place_simple_enum_on_single_line = false
|
|
||||||
csharp_wrap_enum_declaration = wrap_if_long
|
|
||||||
csharp_new_line_before_else = true
|
|
||||||
csharp_new_line_before_while = false
|
|
||||||
csharp_wrap_for_stmt_header_style = wrap_if_long
|
|
||||||
csharp_wrap_multiple_declaration_style = wrap_if_long
|
|
||||||
csharp_keep_existing_embedded_arrangement = false
|
|
||||||
csharp_place_simple_embedded_statement_on_same_line = false
|
|
||||||
csharp_place_simple_case_statement_on_same_line = true
|
|
||||||
csharp_keep_existing_embedded_block_arrangement = false
|
|
||||||
csharp_place_simple_embedded_block_on_same_line = false
|
|
||||||
csharp_place_simple_anonymousmethod_on_single_line = false
|
|
||||||
csharp_keep_existing_initializer_arrangement = false
|
|
||||||
csharp_place_simple_initializer_on_single_line = false
|
|
||||||
csharp_wrap_object_and_collection_initializer_style = chop_always
|
|
||||||
csharp_wrap_array_initializer_style = wrap_if_long
|
|
||||||
csharp_wrap_arguments_style = wrap_if_long
|
|
||||||
csharp_keep_existing_invocation_parens_arrangement = false
|
|
||||||
csharp_wrap_after_invocation_lpar = false
|
|
||||||
csharp_wrap_before_invocation_rpar = false
|
|
||||||
csharp_wrap_after_dot_in_method_calls = true
|
|
||||||
csharp_wrap_chained_method_calls = wrap_if_long
|
|
||||||
csharp_wrap_before_binary_opsign = false
|
|
||||||
csharp_wrap_chained_binary_expressions = wrap_if_long
|
|
||||||
csharp_force_chop_compound_if_expression = true
|
|
||||||
csharp_force_chop_compound_while_expression = true
|
|
||||||
csharp_force_chop_compound_do_expression = true
|
|
||||||
csharp_wrap_before_ternary_opsigns = true
|
|
||||||
csharp_wrap_ternary_expr_style = wrap_if_long
|
|
||||||
csharp_nested_ternary_style = expanded
|
|
||||||
csharp_wrap_linq_expressions = wrap_if_long
|
|
||||||
csharp_wrap_before_linq_expression = false
|
|
||||||
csharp_place_linq_into_on_new_line = false
|
|
||||||
csharp_wrap_verbatim_interpolated_strings = wrap_if_long
|
|
||||||
csharp_extra_spaces = remove_all
|
|
||||||
csharp_space_after_keywords_in_control_flow_statements = false
|
|
||||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
|
||||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
|
||||||
csharp_space_before_typeof_parentheses = false
|
|
||||||
csharp_space_before_checked_parentheses = false
|
|
||||||
csharp_space_before_sizeof_parentheses = false
|
|
||||||
csharp_space_before_nameof_parentheses = false
|
|
||||||
csharp_space_between_keyword_and_expression = true
|
|
||||||
csharp_space_between_keyword_and_type = true
|
|
||||||
csharp_space_around_assignment_op = true
|
|
||||||
csharp_space_around_logical_op = true
|
|
||||||
csharp_space_around_binary_operator = true
|
|
||||||
csharp_space_around_equality_op = true
|
|
||||||
csharp_space_around_relational_op = true
|
|
||||||
csharp_space_around_bitwise_op = true
|
|
||||||
csharp_space_around_additive_op = true
|
|
||||||
csharp_space_around_multiplicative_op = true
|
|
||||||
csharp_space_around_shift_op = true
|
|
||||||
csharp_space_around_nullcoalescing_op = true
|
|
||||||
csharp_space_around_arrow_op = false
|
|
||||||
csharp_space_after_logical_not_op = false
|
|
||||||
csharp_space_after_unary_operator = false
|
|
||||||
csharp_space_after_cast = false
|
|
||||||
csharp_space_around_dot = false
|
|
||||||
csharp_space_around_lambda_arrow = true
|
|
||||||
csharp_space_before_pointer_asterik_declaration = false
|
|
||||||
csharp_space_before_nullable_mark = false
|
|
||||||
|
|
||||||
[*.cshtml]
|
|
||||||
linebreaks_around_razor_statements = true
|
|
||||||
blank_lines_around_razor_functions = true
|
|
||||||
blank_lines_around_razor_helpers = true
|
|
||||||
blank_lines_around_razor_sections = true
|
|
||||||
|
|
||||||
# C++
|
|
||||||
[*.{cc,cpp,cxx,h,hpp,hxx}]
|
|
||||||
cpp_indent_access_specifiers_from_class = true
|
|
||||||
cpp_indent_wrapped_function_names = false
|
|
||||||
cpp_align_multiline_type_argument = true
|
|
||||||
|
|
||||||
# C, C++ and ObjectiveC
|
|
||||||
[*.{c,h,cc,cpp,cxx,m,hpp,hxx}]
|
|
||||||
indent_preprocessor_directives = normal
|
|
||||||
indent_type_constraints = true
|
|
||||||
|
|
||||||
# Javascript and Typescript
|
|
||||||
[*.{js,js.map,ts}]
|
|
||||||
quote_style = doublequoted
|
|
||||||
termination_style = ensure_semicolon
|
|
||||||
|
|||||||
@@ -70,8 +70,7 @@
|
|||||||
<Compile Include="CHS.cs"/>
|
<Compile Include="CHS.cs"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj">
|
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"></ProjectReference>
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="..\LICENSE.LGPL">
|
<EmbeddedResource Include="..\LICENSE.LGPL">
|
||||||
|
|||||||
@@ -24,11 +24,11 @@
|
|||||||
// Copyright(C) 2014 mykohsu
|
// Copyright(C) 2014 mykohsu
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
namespace Aaru.Helpers;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Aaru.Helpers;
|
|
||||||
|
|
||||||
public static partial class ArrayHelpers
|
public static partial class ArrayHelpers
|
||||||
{
|
{
|
||||||
/// <summary>Fills an array with the specified value</summary>
|
/// <summary>Fills an array with the specified value</summary>
|
||||||
|
|||||||
@@ -30,10 +30,10 @@
|
|||||||
// Copyright © 2011-2022 Natalia Portillo
|
// Copyright © 2011-2022 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Aaru.Helpers;
|
namespace Aaru.Helpers;
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
/// <summary>Helper operations to work with arrays</summary>
|
/// <summary>Helper operations to work with arrays</summary>
|
||||||
public static partial class ArrayHelpers
|
public static partial class ArrayHelpers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,11 +30,11 @@
|
|||||||
// Copyright © 2011-2022 Natalia Portillo
|
// Copyright © 2011-2022 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
namespace Aaru.Helpers;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Aaru.Helpers;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts base data types to an array of bytes, and an array of bytes to base data types. All info taken from
|
/// Converts base data types to an array of bytes, and an array of bytes to base data types. All info taken from
|
||||||
/// the meta data of System.BitConverter. This implementation allows for Endianness consideration.
|
/// the meta data of System.BitConverter. This implementation allows for Endianness consideration.
|
||||||
@@ -309,15 +309,12 @@ public static class BigEndianBitConverter
|
|||||||
/// <param name="value">Byte array containing a GUID in big endian</param>
|
/// <param name="value">Byte array containing a GUID in big endian</param>
|
||||||
/// <param name="startIndex">Start of the byte array to process</param>
|
/// <param name="startIndex">Start of the byte array to process</param>
|
||||||
/// <returns>Processed Guid</returns>
|
/// <returns>Processed Guid</returns>
|
||||||
public static Guid ToGuid(byte[] value, int startIndex) => new Guid(ToUInt32(value, 0 + startIndex),
|
public static Guid ToGuid(byte[] value, int startIndex) => new(ToUInt32(value, 0 + startIndex),
|
||||||
ToUInt16(value, 4 + startIndex),
|
ToUInt16(value, 4 + startIndex),
|
||||||
ToUInt16(value, 6 + startIndex),
|
ToUInt16(value, 6 + startIndex),
|
||||||
value[8 + startIndex + 0],
|
value[8 + startIndex + 0], value[8 + startIndex + 1],
|
||||||
value[8 + startIndex + 1],
|
value[8 + startIndex + 2], value[8 + startIndex + 3],
|
||||||
value[8 + startIndex + 2],
|
value[8 + startIndex + 5], value[8 + startIndex + 5],
|
||||||
value[8 + startIndex + 3],
|
|
||||||
value[8 + startIndex + 5],
|
|
||||||
value[8 + startIndex + 5],
|
|
||||||
value[8 + startIndex + 6],
|
value[8 + startIndex + 6],
|
||||||
value[8 + startIndex + 7]);
|
value[8 + startIndex + 7]);
|
||||||
}
|
}
|
||||||
4
CHS.cs
4
CHS.cs
@@ -43,6 +43,6 @@ public static class CHS
|
|||||||
/// <param name="maxSector">Number of sectors per track</param>
|
/// <param name="maxSector">Number of sectors per track</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static uint ToLBA(uint cyl, uint head, uint sector, uint maxHead, uint maxSector) =>
|
public static uint ToLBA(uint cyl, uint head, uint sector, uint maxHead, uint maxSector) =>
|
||||||
maxHead == 0 || maxSector == 0 ? (((cyl * 16) + head) * 63) + sector - 1
|
maxHead == 0 || maxSector == 0 ? (cyl * 16 + head) * 63 + sector - 1
|
||||||
: (((cyl * maxHead) + head) * maxSector) + sector - 1;
|
: (cyl * maxHead + head) * maxSector + sector - 1;
|
||||||
}
|
}
|
||||||
@@ -39,8 +39,7 @@ public static partial class ArrayHelpers
|
|||||||
/// <param name="sameSize"><c>true</c> if they have the same size</param>
|
/// <param name="sameSize"><c>true</c> if they have the same size</param>
|
||||||
/// <param name="compareArray1">Left array</param>
|
/// <param name="compareArray1">Left array</param>
|
||||||
/// <param name="compareArray2">Right array</param>
|
/// <param name="compareArray2">Right array</param>
|
||||||
public static void CompareBytes(out bool different, out bool sameSize, byte[] compareArray1,
|
public static void CompareBytes(out bool different, out bool sameSize, byte[] compareArray1, byte[] compareArray2)
|
||||||
byte[] compareArray2)
|
|
||||||
{
|
{
|
||||||
different = false;
|
different = false;
|
||||||
sameSize = true;
|
sameSize = true;
|
||||||
|
|||||||
@@ -30,21 +30,21 @@
|
|||||||
// Copyright © 2011-2022 Natalia Portillo
|
// Copyright © 2011-2022 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
namespace Aaru.Helpers;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Aaru.Console;
|
using Aaru.Console;
|
||||||
|
|
||||||
namespace Aaru.Helpers;
|
|
||||||
|
|
||||||
/// <summary>Helper operations for timestamp management (date and time)</summary>
|
/// <summary>Helper operations for timestamp management (date and time)</summary>
|
||||||
public static class DateHandlers
|
public static class DateHandlers
|
||||||
{
|
{
|
||||||
static readonly DateTime _lisaEpoch = new DateTime(1901, 1, 1, 0, 0, 0);
|
static readonly DateTime _lisaEpoch = new(1901, 1, 1, 0, 0, 0);
|
||||||
static readonly DateTime _macEpoch = new DateTime(1904, 1, 1, 0, 0, 0);
|
static readonly DateTime _macEpoch = new(1904, 1, 1, 0, 0, 0);
|
||||||
static readonly DateTime _unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0);
|
static readonly DateTime _unixEpoch = new(1970, 1, 1, 0, 0, 0);
|
||||||
/// <summary>Day 0 of Julian Date system</summary>
|
/// <summary>Day 0 of Julian Date system</summary>
|
||||||
static readonly DateTime _julianEpoch = new DateTime(1858, 11, 17, 0, 0, 0);
|
static readonly DateTime _julianEpoch = new(1858, 11, 17, 0, 0, 0);
|
||||||
static readonly DateTime _amigaEpoch = new DateTime(1978, 1, 1, 0, 0, 0);
|
static readonly DateTime _amigaEpoch = new(1978, 1, 1, 0, 0, 0);
|
||||||
|
|
||||||
/// <summary>Converts a Macintosh timestamp to a .NET DateTime</summary>
|
/// <summary>Converts a Macintosh timestamp to a .NET DateTime</summary>
|
||||||
/// <param name="macTimeStamp">Macintosh timestamp (seconds since 1st Jan. 1904)</param>
|
/// <param name="macTimeStamp">Macintosh timestamp (seconds since 1st Jan. 1904)</param>
|
||||||
@@ -88,7 +88,7 @@ public static class DateHandlers
|
|||||||
/// <returns>.NET DateTime</returns>
|
/// <returns>.NET DateTime</returns>
|
||||||
public static DateTime HighSierraToDateTime(byte[] vdDateTime)
|
public static DateTime HighSierraToDateTime(byte[] vdDateTime)
|
||||||
{
|
{
|
||||||
byte[] isoTime = new byte[17];
|
var isoTime = new byte[17];
|
||||||
Array.Copy(vdDateTime, 0, isoTime, 0, 16);
|
Array.Copy(vdDateTime, 0, isoTime, 0, 16);
|
||||||
|
|
||||||
return Iso9660ToDateTime(isoTime);
|
return Iso9660ToDateTime(isoTime);
|
||||||
@@ -100,8 +100,8 @@ public static class DateHandlers
|
|||||||
/// <returns>.NET DateTime</returns>
|
/// <returns>.NET DateTime</returns>
|
||||||
public static DateTime Iso9660ToDateTime(byte[] vdDateTime)
|
public static DateTime Iso9660ToDateTime(byte[] vdDateTime)
|
||||||
{
|
{
|
||||||
byte[] twoCharValue = new byte[2];
|
var twoCharValue = new byte[2];
|
||||||
byte[] fourCharValue = new byte[4];
|
var fourCharValue = new byte[4];
|
||||||
|
|
||||||
fourCharValue[0] = vdDateTime[0];
|
fourCharValue[0] = vdDateTime[0];
|
||||||
fourCharValue[1] = vdDateTime[1];
|
fourCharValue[1] = vdDateTime[1];
|
||||||
@@ -172,7 +172,7 @@ public static class DateHandlers
|
|||||||
"decodedDT = new DateTime({0}, {1}, {2}, {3}, {4}, {5}, {6}, DateTimeKind.Unspecified);",
|
"decodedDT = new DateTime({0}, {1}, {2}, {3}, {4}, {5}, {6}, DateTimeKind.Unspecified);",
|
||||||
year, month, day, hour, minute, second, hundredths * 10);
|
year, month, day, hour, minute, second, hundredths * 10);
|
||||||
|
|
||||||
sbyte difference = (sbyte)vdDateTime[16];
|
var difference = (sbyte)vdDateTime[16];
|
||||||
|
|
||||||
var decodedDt = new DateTime(year, month, day, hour, minute, second, hundredths * 10, DateTimeKind.Utc);
|
var decodedDt = new DateTime(year, month, day, hour, minute, second, hundredths * 10, DateTimeKind.Utc);
|
||||||
|
|
||||||
@@ -213,8 +213,8 @@ public static class DateHandlers
|
|||||||
int month = dateRecord & 0x000F;
|
int month = dateRecord & 0x000F;
|
||||||
|
|
||||||
AaruConsole.DebugWriteLine("UCSDPascalToDateTime handler",
|
AaruConsole.DebugWriteLine("UCSDPascalToDateTime handler",
|
||||||
"dateRecord = 0x{0:X4}, year = {1}, month = {2}, day = {3}", dateRecord, year,
|
"dateRecord = 0x{0:X4}, year = {1}, month = {2}, day = {3}", dateRecord, year, month,
|
||||||
month, day);
|
day);
|
||||||
|
|
||||||
return new DateTime(year, month, day);
|
return new DateTime(year, month, day);
|
||||||
}
|
}
|
||||||
@@ -232,12 +232,11 @@ public static class DateHandlers
|
|||||||
int minute = (time & 0x7E0) >> 5;
|
int minute = (time & 0x7E0) >> 5;
|
||||||
int second = (time & 0x1F) * 2;
|
int second = (time & 0x1F) * 2;
|
||||||
|
|
||||||
AaruConsole.DebugWriteLine("DOSToDateTime handler", "date = 0x{0:X4}, year = {1}, month = {2}, day = {3}",
|
AaruConsole.DebugWriteLine("DOSToDateTime handler", "date = 0x{0:X4}, year = {1}, month = {2}, day = {3}", date,
|
||||||
date, year, month, day);
|
year, month, day);
|
||||||
|
|
||||||
AaruConsole.DebugWriteLine("DOSToDateTime handler",
|
AaruConsole.DebugWriteLine("DOSToDateTime handler", "time = 0x{0:X4}, hour = {1}, minute = {2}, second = {3}",
|
||||||
"time = 0x{0:X4}, hour = {1}, minute = {2}, second = {3}", time, hour, minute,
|
time, hour, minute, second);
|
||||||
second);
|
|
||||||
|
|
||||||
DateTime dosDate;
|
DateTime dosDate;
|
||||||
|
|
||||||
@@ -258,7 +257,7 @@ public static class DateHandlers
|
|||||||
/// <returns>.NET DateTime</returns>
|
/// <returns>.NET DateTime</returns>
|
||||||
public static DateTime CpmToDateTime(byte[] timestamp)
|
public static DateTime CpmToDateTime(byte[] timestamp)
|
||||||
{
|
{
|
||||||
ushort days = BitConverter.ToUInt16(timestamp, 0);
|
var days = BitConverter.ToUInt16(timestamp, 0);
|
||||||
int hours = timestamp[2];
|
int hours = timestamp[2];
|
||||||
int minutes = timestamp[3];
|
int minutes = timestamp[3];
|
||||||
|
|
||||||
@@ -285,15 +284,14 @@ public static class DateHandlers
|
|||||||
byte minute, byte second, byte centiseconds, byte hundredsOfMicroseconds,
|
byte minute, byte second, byte centiseconds, byte hundredsOfMicroseconds,
|
||||||
byte microseconds)
|
byte microseconds)
|
||||||
{
|
{
|
||||||
byte specification = (byte)((typeAndTimeZone & 0xF000) >> 12);
|
var specification = (byte)((typeAndTimeZone & 0xF000) >> 12);
|
||||||
|
|
||||||
long ticks = ((long)centiseconds * 100000) + ((long)hundredsOfMicroseconds * 1000) +
|
long ticks = (long)centiseconds * 100000 + (long)hundredsOfMicroseconds * 1000 + (long)microseconds * 10;
|
||||||
((long)microseconds * 10);
|
|
||||||
|
|
||||||
if(specification == 0)
|
if(specification == 0)
|
||||||
return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc).AddTicks(ticks);
|
return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc).AddTicks(ticks);
|
||||||
|
|
||||||
ushort preOffset = (ushort)(typeAndTimeZone & 0xFFF);
|
var preOffset = (ushort)(typeAndTimeZone & 0xFFF);
|
||||||
short offset;
|
short offset;
|
||||||
|
|
||||||
if((preOffset & 0x800) == 0x800)
|
if((preOffset & 0x800) == 0x800)
|
||||||
@@ -308,15 +306,14 @@ public static class DateHandlers
|
|||||||
offset > 1440)
|
offset > 1440)
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
return new DateTimeOffset(year, month, day, hour, minute, second, new TimeSpan(0, offset, 0)).
|
return new DateTimeOffset(year, month, day, hour, minute, second, new TimeSpan(0, offset, 0)).AddTicks(ticks).
|
||||||
AddTicks(ticks).DateTime;
|
DateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Converts a Solaris high resolution timestamp to .NET DateTime</summary>
|
/// <summary>Converts a Solaris high resolution timestamp to .NET DateTime</summary>
|
||||||
/// <param name="hrTimeStamp">Solaris high resolution timestamp</param>
|
/// <param name="hrTimeStamp">Solaris high resolution timestamp</param>
|
||||||
/// <returns>.NET DateTime</returns>
|
/// <returns>.NET DateTime</returns>
|
||||||
public static DateTime UnixHrTimeToDateTime(ulong hrTimeStamp) =>
|
public static DateTime UnixHrTimeToDateTime(ulong hrTimeStamp) => _unixEpoch.AddTicks((long)(hrTimeStamp / 100));
|
||||||
_unixEpoch.AddTicks((long)(hrTimeStamp / 100));
|
|
||||||
|
|
||||||
/// <summary>Converts an OS-9 timestamp to .NET DateTime</summary>
|
/// <summary>Converts an OS-9 timestamp to .NET DateTime</summary>
|
||||||
/// <param name="date">OS-9 timestamp</param>
|
/// <param name="date">OS-9 timestamp</param>
|
||||||
@@ -324,7 +321,7 @@ public static class DateHandlers
|
|||||||
public static DateTime Os9ToDateTime(byte[] date)
|
public static DateTime Os9ToDateTime(byte[] date)
|
||||||
{
|
{
|
||||||
if(date == null ||
|
if(date == null ||
|
||||||
(date.Length != 3 && date.Length != 5))
|
date.Length != 3 && date.Length != 5)
|
||||||
return DateTime.MinValue;
|
return DateTime.MinValue;
|
||||||
|
|
||||||
DateTime os9Date;
|
DateTime os9Date;
|
||||||
@@ -366,12 +363,12 @@ public static class DateHandlers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int iyear = ((year >> 4) * 10) + (year & 0xF);
|
int iyear = (year >> 4) * 10 + (year & 0xF);
|
||||||
int imonth = ((month >> 4) * 10) + (month & 0xF);
|
int imonth = (month >> 4) * 10 + (month & 0xF);
|
||||||
int iday = ((day >> 4) * 10) + (day & 0xF);
|
int iday = (day >> 4) * 10 + (day & 0xF);
|
||||||
int iminute = ((minute >> 4) * 10) + (minute & 0xF);
|
int iminute = (minute >> 4) * 10 + (minute & 0xF);
|
||||||
int ihour = ((hour >> 4) * 10) + (hour & 0xF);
|
int ihour = (hour >> 4) * 10 + (hour & 0xF);
|
||||||
int isecond = ((second >> 4) * 10) + (second & 0xF);
|
int isecond = (second >> 4) * 10 + (second & 0xF);
|
||||||
|
|
||||||
if(iyear >= 70)
|
if(iyear >= 70)
|
||||||
iyear += 1900;
|
iyear += 1900;
|
||||||
|
|||||||
63
Marshal.cs
63
Marshal.cs
@@ -30,14 +30,14 @@
|
|||||||
// Copyright © 2011-2022 Natalia Portillo
|
// Copyright © 2011-2022 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
namespace Aaru.Helpers;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Aaru.Helpers;
|
|
||||||
|
|
||||||
/// <summary>Provides methods to marshal binary data into C# structs</summary>
|
/// <summary>Provides methods to marshal binary data into C# structs</summary>
|
||||||
public static class Marshal
|
public static class Marshal
|
||||||
{
|
{
|
||||||
@@ -117,8 +117,7 @@ public static class Marshal
|
|||||||
{
|
{
|
||||||
var ptr = GCHandle.Alloc(bytes, GCHandleType.Pinned);
|
var ptr = GCHandle.Alloc(bytes, GCHandleType.Pinned);
|
||||||
|
|
||||||
object str =
|
object str = (T)System.Runtime.InteropServices.Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(T));
|
||||||
(T)System.Runtime.InteropServices.Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(T));
|
|
||||||
|
|
||||||
ptr.Free();
|
ptr.Free();
|
||||||
|
|
||||||
@@ -161,8 +160,8 @@ public static class Marshal
|
|||||||
/// <typeparam name="T">Type of the structure to marshal</typeparam>
|
/// <typeparam name="T">Type of the structure to marshal</typeparam>
|
||||||
/// <returns>The binary data marshalled in a structure with the specified type</returns>
|
/// <returns>The binary data marshalled in a structure with the specified type</returns>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static T SpanToStructureLittleEndian<T>(ReadOnlySpan<byte> bytes, int start, int length)
|
public static T SpanToStructureLittleEndian<T>(ReadOnlySpan<byte> bytes, int start, int length) where T : struct =>
|
||||||
where T : struct => MemoryMarshal.Read<T>(bytes.Slice(start, length));
|
MemoryMarshal.Read<T>(bytes.Slice(start, length));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Marshal big-endian binary data to a structure. If the structure type contains any non value type, this method
|
/// Marshal big-endian binary data to a structure. If the structure type contains any non value type, this method
|
||||||
@@ -274,22 +273,22 @@ public static class Marshal
|
|||||||
|
|
||||||
foreach(FieldInfo fi in fieldInfo)
|
foreach(FieldInfo fi in fieldInfo)
|
||||||
if(fi.FieldType == typeof(short) ||
|
if(fi.FieldType == typeof(short) ||
|
||||||
(fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(short)))
|
fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(short))
|
||||||
{
|
{
|
||||||
short x = (short)fi.GetValue(str);
|
var x = (short)fi.GetValue(str);
|
||||||
fi.SetValue(str, (short)((x << 8) | ((x >> 8) & 0xFF)));
|
fi.SetValue(str, (short)((x << 8) | ((x >> 8) & 0xFF)));
|
||||||
}
|
}
|
||||||
else if(fi.FieldType == typeof(int) ||
|
else if(fi.FieldType == typeof(int) ||
|
||||||
(fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(int)))
|
fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(int))
|
||||||
{
|
{
|
||||||
int x = (int)fi.GetValue(str);
|
var x = (int)fi.GetValue(str);
|
||||||
x = (int)(((x << 8) & 0xFF00FF00) | (((uint)x >> 8) & 0xFF00FF));
|
x = (int)(((x << 8) & 0xFF00FF00) | (((uint)x >> 8) & 0xFF00FF));
|
||||||
fi.SetValue(str, (int)(((uint)x << 16) | (((uint)x >> 16) & 0xFFFF)));
|
fi.SetValue(str, (int)(((uint)x << 16) | (((uint)x >> 16) & 0xFFFF)));
|
||||||
}
|
}
|
||||||
else if(fi.FieldType == typeof(long) ||
|
else if(fi.FieldType == typeof(long) ||
|
||||||
(fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(long)))
|
fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(long))
|
||||||
{
|
{
|
||||||
long x = (long)fi.GetValue(str);
|
var x = (long)fi.GetValue(str);
|
||||||
x = ((x & 0x00000000FFFFFFFF) << 32) | (long)(((ulong)x & 0xFFFFFFFF00000000) >> 32);
|
x = ((x & 0x00000000FFFFFFFF) << 32) | (long)(((ulong)x & 0xFFFFFFFF00000000) >> 32);
|
||||||
x = ((x & 0x0000FFFF0000FFFF) << 16) | (long)(((ulong)x & 0xFFFF0000FFFF0000) >> 16);
|
x = ((x & 0x0000FFFF0000FFFF) << 16) | (long)(((ulong)x & 0xFFFF0000FFFF0000) >> 16);
|
||||||
x = ((x & 0x00FF00FF00FF00FF) << 8) | (long)(((ulong)x & 0xFF00FF00FF00FF00) >> 8);
|
x = ((x & 0x00FF00FF00FF00FF) << 8) | (long)(((ulong)x & 0xFF00FF00FF00FF00) >> 8);
|
||||||
@@ -297,22 +296,22 @@ public static class Marshal
|
|||||||
fi.SetValue(str, x);
|
fi.SetValue(str, x);
|
||||||
}
|
}
|
||||||
else if(fi.FieldType == typeof(ushort) ||
|
else if(fi.FieldType == typeof(ushort) ||
|
||||||
(fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(ushort)))
|
fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(ushort))
|
||||||
{
|
{
|
||||||
ushort x = (ushort)fi.GetValue(str);
|
var x = (ushort)fi.GetValue(str);
|
||||||
fi.SetValue(str, (ushort)((x << 8) | (x >> 8)));
|
fi.SetValue(str, (ushort)((x << 8) | (x >> 8)));
|
||||||
}
|
}
|
||||||
else if(fi.FieldType == typeof(uint) ||
|
else if(fi.FieldType == typeof(uint) ||
|
||||||
(fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(uint)))
|
fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(uint))
|
||||||
{
|
{
|
||||||
uint x = (uint)fi.GetValue(str);
|
var x = (uint)fi.GetValue(str);
|
||||||
x = ((x << 8) & 0xFF00FF00) | ((x >> 8) & 0xFF00FF);
|
x = ((x << 8) & 0xFF00FF00) | ((x >> 8) & 0xFF00FF);
|
||||||
fi.SetValue(str, (x << 16) | (x >> 16));
|
fi.SetValue(str, (x << 16) | (x >> 16));
|
||||||
}
|
}
|
||||||
else if(fi.FieldType == typeof(ulong) ||
|
else if(fi.FieldType == typeof(ulong) ||
|
||||||
(fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(ulong)))
|
fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(ulong))
|
||||||
{
|
{
|
||||||
ulong x = (ulong)fi.GetValue(str);
|
var x = (ulong)fi.GetValue(str);
|
||||||
x = ((x & 0x00000000FFFFFFFF) << 32) | ((x & 0xFFFFFFFF00000000) >> 32);
|
x = ((x & 0x00000000FFFFFFFF) << 32) | ((x & 0xFFFFFFFF00000000) >> 32);
|
||||||
x = ((x & 0x0000FFFF0000FFFF) << 16) | ((x & 0xFFFF0000FFFF0000) >> 16);
|
x = ((x & 0x0000FFFF0000FFFF) << 16) | ((x & 0xFFFF0000FFFF0000) >> 16);
|
||||||
x = ((x & 0x00FF00FF00FF00FF) << 8) | ((x & 0xFF00FF00FF00FF00) >> 8);
|
x = ((x & 0x00FF00FF00FF00FF) << 8) | ((x & 0xFF00FF00FF00FF00) >> 8);
|
||||||
@@ -320,7 +319,7 @@ public static class Marshal
|
|||||||
}
|
}
|
||||||
else if(fi.FieldType == typeof(float))
|
else if(fi.FieldType == typeof(float))
|
||||||
{
|
{
|
||||||
float flt = (float)fi.GetValue(str);
|
var flt = (float)fi.GetValue(str);
|
||||||
byte[] flt_b = BitConverter.GetBytes(flt);
|
byte[] flt_b = BitConverter.GetBytes(flt);
|
||||||
|
|
||||||
fi.SetValue(str, BitConverter.ToSingle(new[]
|
fi.SetValue(str, BitConverter.ToSingle(new[]
|
||||||
@@ -330,7 +329,7 @@ public static class Marshal
|
|||||||
}
|
}
|
||||||
else if(fi.FieldType == typeof(double))
|
else if(fi.FieldType == typeof(double))
|
||||||
{
|
{
|
||||||
double dbl = (double)fi.GetValue(str);
|
var dbl = (double)fi.GetValue(str);
|
||||||
byte[] dbl_b = BitConverter.GetBytes(dbl);
|
byte[] dbl_b = BitConverter.GetBytes(dbl);
|
||||||
|
|
||||||
fi.SetValue(str, BitConverter.ToDouble(new[]
|
fi.SetValue(str, BitConverter.ToDouble(new[]
|
||||||
@@ -384,15 +383,15 @@ public static class Marshal
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
else if(fi.FieldType == typeof(int) ||
|
else if(fi.FieldType == typeof(int) ||
|
||||||
(fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(int)))
|
fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(int))
|
||||||
{
|
{
|
||||||
int x = (int)fi.GetValue(str);
|
var x = (int)fi.GetValue(str);
|
||||||
fi.SetValue(str, ((x & 0xffffu) << 16) | ((x & 0xffff0000u) >> 16));
|
fi.SetValue(str, ((x & 0xffffu) << 16) | ((x & 0xffff0000u) >> 16));
|
||||||
}
|
}
|
||||||
else if(fi.FieldType == typeof(uint) ||
|
else if(fi.FieldType == typeof(uint) ||
|
||||||
(fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(uint)))
|
fi.FieldType.IsEnum && fi.FieldType.GetEnumUnderlyingType() == typeof(uint))
|
||||||
{
|
{
|
||||||
uint x = (uint)fi.GetValue(str);
|
var x = (uint)fi.GetValue(str);
|
||||||
fi.SetValue(str, ((x & 0xffffu) << 16) | ((x & 0xffff0000u) >> 16));
|
fi.SetValue(str, ((x & 0xffffu) << 16) | ((x & 0xffff0000u) >> 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,7 +415,7 @@ public static class Marshal
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static byte[] StructureToByteArrayLittleEndian<T>(T str) where T : struct
|
public static byte[] StructureToByteArrayLittleEndian<T>(T str) where T : struct
|
||||||
{
|
{
|
||||||
byte[] buf = new byte[SizeOf<T>()];
|
var buf = new byte[SizeOf<T>()];
|
||||||
var ptr = GCHandle.Alloc(buf, GCHandleType.Pinned);
|
var ptr = GCHandle.Alloc(buf, GCHandleType.Pinned);
|
||||||
System.Runtime.InteropServices.Marshal.StructureToPtr(str, ptr.AddrOfPinnedObject(), false);
|
System.Runtime.InteropServices.Marshal.StructureToPtr(str, ptr.AddrOfPinnedObject(), false);
|
||||||
ptr.Free();
|
ptr.Free();
|
||||||
@@ -444,24 +443,22 @@ public static class Marshal
|
|||||||
hex == "")
|
hex == "")
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int off = 0;
|
var off = 0;
|
||||||
|
|
||||||
if(hex[0] == '0' &&
|
if(hex[0] == '0' &&
|
||||||
(hex[1] == 'x' || hex[1] == 'X'))
|
(hex[1] == 'x' || hex[1] == 'X'))
|
||||||
{
|
|
||||||
off = 2;
|
off = 2;
|
||||||
}
|
|
||||||
|
|
||||||
outBuf = new byte[(hex.Length - off) / 2];
|
outBuf = new byte[(hex.Length - off) / 2];
|
||||||
int count = 0;
|
var count = 0;
|
||||||
|
|
||||||
for(int i = off; i < hex.Length; i += 2)
|
for(int i = off; i < hex.Length; i += 2)
|
||||||
{
|
{
|
||||||
char c = hex[i];
|
char c = hex[i];
|
||||||
|
|
||||||
if(c < '0' ||
|
if(c < '0' ||
|
||||||
(c > '9' && c < 'A') ||
|
c > '9' && c < 'A' ||
|
||||||
(c > 'F' && c < 'a') ||
|
c > 'F' && c < 'a' ||
|
||||||
c > 'f')
|
c > 'f')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -476,8 +473,8 @@ public static class Marshal
|
|||||||
c = hex[i + 1];
|
c = hex[i + 1];
|
||||||
|
|
||||||
if(c < '0' ||
|
if(c < '0' ||
|
||||||
(c > '9' && c < 'A') ||
|
c > '9' && c < 'A' ||
|
||||||
(c > 'F' && c < 'a') ||
|
c > 'F' && c < 'a' ||
|
||||||
c > 'f')
|
c > 'f')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,10 @@
|
|||||||
// Copyright © 2011-2022 Natalia Portillo
|
// Copyright © 2011-2022 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Aaru.Helpers;
|
namespace Aaru.Helpers;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>Defines properties to help marshalling structs from binary data</summary>
|
/// <summary>Defines properties to help marshalling structs from binary data</summary>
|
||||||
[AttributeUsage(AttributeTargets.Struct)]
|
[AttributeUsage(AttributeTargets.Struct)]
|
||||||
|
|||||||
22
PrintHex.cs
22
PrintHex.cs
@@ -30,11 +30,11 @@
|
|||||||
// Copyright © 2011-2022 Natalia Portillo
|
// Copyright © 2011-2022 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
namespace Aaru.Helpers;
|
||||||
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Aaru.Console;
|
using Aaru.Console;
|
||||||
|
|
||||||
namespace Aaru.Helpers;
|
|
||||||
|
|
||||||
/// <summary>Helper operations to get hexadecimal representations of byte arrays</summary>
|
/// <summary>Helper operations to get hexadecimal representations of byte arrays</summary>
|
||||||
public static class PrintHex
|
public static class PrintHex
|
||||||
{
|
{
|
||||||
@@ -56,7 +56,7 @@ public static class PrintHex
|
|||||||
|
|
||||||
// TODO: Color list
|
// TODO: Color list
|
||||||
// TODO: Allow to change width
|
// TODO: Allow to change width
|
||||||
string str = "Offset";
|
var str = "Offset";
|
||||||
int rows = array.Length / 16;
|
int rows = array.Length / 16;
|
||||||
int last = array.Length % 16;
|
int last = array.Length % 16;
|
||||||
int offsetLength = $"{array.Length:X}".Length;
|
int offsetLength = $"{array.Length:X}".Length;
|
||||||
@@ -80,21 +80,19 @@ public static class PrintHex
|
|||||||
sb.Append(str);
|
sb.Append(str);
|
||||||
sb.Append(" ");
|
sb.Append(" ");
|
||||||
|
|
||||||
for(int i = 0; i < 16; i++)
|
for(var i = 0; i < 16; i++)
|
||||||
{
|
|
||||||
sb.AppendFormat(" {0:X2}", i);
|
sb.AppendFormat(" {0:X2}", i);
|
||||||
}
|
|
||||||
|
|
||||||
if(color)
|
if(color)
|
||||||
sb.Append("\u001b[0m");
|
sb.Append("\u001b[0m");
|
||||||
|
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
|
|
||||||
int b = 0;
|
var b = 0;
|
||||||
|
|
||||||
string format = $"{{0:X{offsetLength}}}";
|
string format = $"{{0:X{offsetLength}}}";
|
||||||
|
|
||||||
for(int i = 0; i < rows; i++)
|
for(var i = 0; i < rows; i++)
|
||||||
{
|
{
|
||||||
if(color)
|
if(color)
|
||||||
sb.Append("\u001b[36m");
|
sb.Append("\u001b[36m");
|
||||||
@@ -108,22 +106,22 @@ public static class PrintHex
|
|||||||
int lastBytes = i == rows - 1 ? last : 16;
|
int lastBytes = i == rows - 1 ? last : 16;
|
||||||
int lastSpaces = 16 - lastBytes;
|
int lastSpaces = 16 - lastBytes;
|
||||||
|
|
||||||
for(int j = 0; j < lastBytes; j++)
|
for(var j = 0; j < lastBytes; j++)
|
||||||
{
|
{
|
||||||
sb.AppendFormat(" {0:X2}", array[b]);
|
sb.AppendFormat(" {0:X2}", array[b]);
|
||||||
b++;
|
b++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int j = 0; j < lastSpaces; j++)
|
for(var j = 0; j < lastSpaces; j++)
|
||||||
sb.Append(" ");
|
sb.Append(" ");
|
||||||
|
|
||||||
b -= lastBytes;
|
b -= lastBytes;
|
||||||
sb.Append(" ");
|
sb.Append(" ");
|
||||||
|
|
||||||
for(int j = 0; j < lastBytes; j++)
|
for(var j = 0; j < lastBytes; j++)
|
||||||
{
|
{
|
||||||
int v = array[b];
|
int v = array[b];
|
||||||
sb.Append((v > 31 && v < 127) || v > 159 ? (char)v : '.');
|
sb.Append(v > 31 && v < 127 || v > 159 ? (char)v : '.');
|
||||||
b++;
|
b++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,11 +30,11 @@
|
|||||||
// Copyright © 2011-2022 Natalia Portillo
|
// Copyright © 2011-2022 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
namespace Aaru.Helpers;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Aaru.Helpers;
|
|
||||||
|
|
||||||
/// <summary>Helper operations to work with strings</summary>
|
/// <summary>Helper operations to work with strings</summary>
|
||||||
public static class StringHandlers
|
public static class StringHandlers
|
||||||
{
|
{
|
||||||
@@ -54,7 +54,7 @@ public static class StringHandlers
|
|||||||
if(cString == null)
|
if(cString == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
int len = 0;
|
var len = 0;
|
||||||
|
|
||||||
for(int i = start; i < cString.Length; i++)
|
for(int i = start; i < cString.Length; i++)
|
||||||
{
|
{
|
||||||
@@ -78,7 +78,7 @@ public static class StringHandlers
|
|||||||
if(twoBytes && len % 2 > 0)
|
if(twoBytes && len % 2 > 0)
|
||||||
len--;
|
len--;
|
||||||
|
|
||||||
byte[] dest = new byte[len];
|
var dest = new byte[len];
|
||||||
Array.Copy(cString, start, dest, 0, len);
|
Array.Copy(cString, start, dest, 0, len);
|
||||||
|
|
||||||
return len == 0 ? "" : encoding.GetString(dest);
|
return len == 0 ? "" : encoding.GetString(dest);
|
||||||
@@ -100,7 +100,7 @@ public static class StringHandlers
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
byte length = pascalString[start];
|
byte length = pascalString[start];
|
||||||
int len = 0;
|
var len = 0;
|
||||||
|
|
||||||
for(int i = start + 1; i < length + 1 && i < pascalString.Length; i++)
|
for(int i = start + 1; i < length + 1 && i < pascalString.Length; i++)
|
||||||
{
|
{
|
||||||
@@ -110,7 +110,7 @@ public static class StringHandlers
|
|||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] dest = new byte[len];
|
var dest = new byte[len];
|
||||||
Array.Copy(pascalString, start + 1, dest, 0, len);
|
Array.Copy(pascalString, start + 1, dest, 0, len);
|
||||||
|
|
||||||
return len == 0 ? "" : encoding.GetString(dest);
|
return len == 0 ? "" : encoding.GetString(dest);
|
||||||
@@ -157,13 +157,13 @@ public static class StringHandlers
|
|||||||
{
|
{
|
||||||
ushort unicode;
|
ushort unicode;
|
||||||
byte compId = dstring[0];
|
byte compId = dstring[0];
|
||||||
string temp = "";
|
var temp = "";
|
||||||
|
|
||||||
if(compId != 8 &&
|
if(compId != 8 &&
|
||||||
compId != 16)
|
compId != 16)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
for(int byteIndex = 1; byteIndex < dstring.Length;)
|
for(var byteIndex = 1; byteIndex < dstring.Length;)
|
||||||
{
|
{
|
||||||
if(compId == 16)
|
if(compId == 16)
|
||||||
unicode = (ushort)(dstring[byteIndex++] << 8);
|
unicode = (ushort)(dstring[byteIndex++] << 8);
|
||||||
|
|||||||
@@ -30,10 +30,10 @@
|
|||||||
// Copyright © 2011-2022 Natalia Portillo
|
// Copyright © 2011-2022 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
namespace Aaru.Helpers;
|
namespace Aaru.Helpers;
|
||||||
|
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
/// <summary>Helper operations to work with swapping endians</summary>
|
/// <summary>Helper operations to work with swapping endians</summary>
|
||||||
public static class Swapping
|
public static class Swapping
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user