From 86f55d9f0e30c9693e3fcfb02e0cb9ffac2af96e Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 13 Jan 2021 18:55:36 +0000 Subject: [PATCH 01/53] Initial commit. --- LICENSE | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..98dc1fdc6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015-2016 Natalia Portillo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. From d9df1bd17012a545c3cd56d9500a2a919f875b18 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 13 Jan 2021 18:56:30 +0000 Subject: [PATCH 02/53] Add hidden files. --- .editorconfig | 632 ++++++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 608 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1240 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..8b506dabe --- /dev/null +++ b/.editorconfig @@ -0,0 +1,632 @@ +root = true + +[*] +charset=utf-8 +next_line=crlf +insert_final_newline=false +indent_style=space +indent_size=4 + +# Generic non-language specific ones for Resharper and friends +brace_style=next_line +int_align=true +keep_existing_arrangement=false +place_simple_blocks_on_single_line=true +place_simple_declaration_blocks_on_single_line=true +place_attribute_on_same_line=false +space_after_unary_operator=false +space_after_comma=true +space_around_ternary_operator=true +space_around_binary_operator=true +space_around_member_access_operator=false +space_before_open_square_brackets=false +space_after_keywords_in_control_flow_statements=true +space_before_comma=false +space_between_method_call_name_and_opening_parenthesis=false +space_between_method_declaration_name_and_open_parenthesis=false +space_between_square_brackets=false +space_between_parentheses_of_control_flow_statements=false +accessor_owner_declaration_braces=next_line +accessor_declaration_braces=next_line +case_block_braces=next_line +initializer_braces=next_line +other_braces=next_line +allow_comment_after_lbrace=false +empty_block_style=together_same_line +braces_for_ifelse=not_required +braces_for_for=not_required +braces_for_foreach=not_required +braces_for_while=not_required +braces_for_dowhile=not_required +braces_for_using=not_required +braces_for_lock=not_required +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_member_access=true:suggestion + +# This controls implicit access modifiers +dotnet_style_require_accessibility_modifiers=never:suggestion + +# Prefer non modified fields to be marked readonly +dotnet_style_readonly_field=true:warning + +# Parenthesis settings +dotnet_style_parentheses_in_arithmetic_binary_operators=always_for_clarity:warning +dotnet_style_parentheses_in_relational_binary_operators=always_for_clarity:warning +dotnet_style_parentheses_in_other_binary_operators=always_for_clarity:warning +dotnet_style_parentheses_in_other_operators=always_for_clarity:warning + +dotnet_style_object_initializer=true:suggestion +dotnet_style_collection_initializer=true:suggestion +dotnet_style_explicit_tuple_names=true:error +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 + +# Constants in C style, all-caps +dotnet_naming_rule.constant_fields_caps.symbols = constant_fields +dotnet_naming_rule.constant_fields_caps.severity = warning +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 +dotnet_naming_rule.pascal_case_for_interface.severity = error +dotnet_naming_rule.pascal_case_for_interface.symbols = interfaces_fields +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 +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style +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 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..47d474d72 --- /dev/null +++ b/.gitignore @@ -0,0 +1,608 @@ +### VisualStudio template +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ +### Linux template + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* +### Xcode template +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +### VisualStudioCode template +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +### C++ template +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o + +# Precompiled Headers +*.gch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app +### MonoDevelop template +#User Specific +*.usertasks + +#Mono Project Files +*.resources +test-results/ +### GPG template +secring.* + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### CMake template +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +### C template +# Object files +*.ko +*.elf + +# Linker output +*.map +*.exp + +*.so.* + +# Executables +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf +### Windows template +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# NuGet Packages Directory +packages/ +## TODO: If the tool you use requires repositories.config uncomment the next line +#!packages/repositories.config + +# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets +# This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented) +!packages/build/ + + +# Others +sql/ +*.Cache + +# Visual Studio 2017 +.vs + +workspace.xml +cmake-build-debug +### macOS template +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +pkg/**/pkg +pkg/**/src +pkg/**/*.asc +pkg/**/*.sig +pkg/**/*.tar.xz +pkg/**/*.zip +pkg/**/aaru + +.sonarqube + +build/* \ No newline at end of file From a5947b590b6a137d3dbb6dada3e6d093857072d0 Mon Sep 17 00:00:00 2001 From: Rebecca Wallander Date: Wed, 13 Jan 2021 21:09:13 +0100 Subject: [PATCH 03/53] Add CSS decryption --- Aaru.Decryption.csproj | 13 + DVD/CSS.cs | 728 +++++++++++++++++++++++++++++++++++++++++ DVD/Dump.cs | 529 ++++++++++++++++++++++++++++++ Enums.cs | 12 + 4 files changed, 1282 insertions(+) create mode 100644 Aaru.Decryption.csproj create mode 100644 DVD/CSS.cs create mode 100644 DVD/Dump.cs create mode 100644 Enums.cs diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj new file mode 100644 index 000000000..196accb3e --- /dev/null +++ b/Aaru.Decryption.csproj @@ -0,0 +1,13 @@ + + + + netcoreapp3.1 + enable + + + + + + + + diff --git a/DVD/CSS.cs b/DVD/CSS.cs new file mode 100644 index 000000000..d631377e8 --- /dev/null +++ b/DVD/CSS.cs @@ -0,0 +1,728 @@ +// /*************************************************************************** +// Aaru Data Preservation Suite +// ---------------------------------------------------------------------------- +// +// Filename : CSS.cs +// Author(s) : Rebecca Wallander +// +// --[ Description ] ---------------------------------------------------------- +// +// Handles Content Scrambling System crypto functionality. +// +// --[ License ] -------------------------------------------------------------- +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// ---------------------------------------------------------------------------- +// Copyright © 2020-2021 Rebecca Wallander +// ****************************************************************************/ + +using System; +using System.Linq; +using Aaru.Decoders.DVD; + +// Based on information gathered from: +// ISO/IEC13818-1 Second Edition +// Mt. Fuji Commands for Multimedia Devices +// https://www.cs.cmu.edu/~dst/DeCSS/Kesden/ +// http://groups.csail.mit.edu/mac/users/hal/css/css.html +// http://www.staroceans.org/e-book/css/css_auth.html +// libdvdcpxm (https://offog.org/git/dvdaexplorer/src/libdvdcpxm/) +// libdvdcss (https://www.videolan.org/developers/libdvdcss.html) + +namespace Aaru.Decryption.DVD +{ + public class CSS + { + static readonly byte[,] _playerKeys = + { + { + 0x01, 0xaf, 0xe3, 0x12, 0x80 + }, + { + 0x12, 0x11, 0xca, 0x04, 0x3b + }, + { + 0x14, 0x0c, 0x9e, 0xd0, 0x09 + }, + { + 0x14, 0x71, 0x35, 0xba, 0xe2 + }, + { + 0x1a, 0xa4, 0x33, 0x21, 0xa6 + }, + { + 0x26, 0xec, 0xc4, 0xa7, 0x4e + }, + { + 0x2c, 0xb2, 0xc1, 0x09, 0xee + }, + { + 0x2f, 0x25, 0x9e, 0x96, 0xdd + }, + { + 0x33, 0x2f, 0x49, 0x6c, 0xe0 + }, + { + 0x35, 0x5b, 0xc1, 0x31, 0x0f + }, + { + 0x36, 0x67, 0xb2, 0xe3, 0x85 + }, + { + 0x39, 0x3d, 0xf1, 0xf1, 0xbd + }, + { + 0x3b, 0x31, 0x34, 0x0d, 0x91 + }, + { + 0x45, 0xed, 0x28, 0xeb, 0xd3 + }, + { + 0x48, 0xb7, 0x6c, 0xce, 0x69 + }, + { + 0x4b, 0x65, 0x0d, 0xc1, 0xee + }, + { + 0x4c, 0xbb, 0xf5, 0x5b, 0x23 + }, + { + 0x51, 0x67, 0x67, 0xc5, 0xe0 + }, + { + 0x53, 0x94, 0xe1, 0x75, 0xbf + }, + { + 0x57, 0x2c, 0x8b, 0x31, 0xae + }, + { + 0x63, 0xdb, 0x4c, 0x5b, 0x4a + }, + { + 0x7b, 0x1e, 0x5e, 0x2b, 0x57 + }, + { + 0x85, 0xf3, 0x85, 0xa0, 0xe0 + }, + { + 0xab, 0x1e, 0xe7, 0x7b, 0x72 + }, + { + 0xab, 0x36, 0xe3, 0xeb, 0x76 + }, + { + 0xb1, 0xb8, 0xf9, 0x38, 0x03 + }, + { + 0xb8, 0x5d, 0xd8, 0x53, 0xbd + }, + { + 0xbf, 0x92, 0xc3, 0xb0, 0xe2 + }, + { + 0xcf, 0x1a, 0xb2, 0xf8, 0x0a + }, + { + 0xec, 0xa0, 0xcf, 0xb3, 0xff + }, + { + 0xfc, 0x95, 0xa9, 0x87, 0x35 + } + }; + + static readonly byte[] _cssTable1 = + { + 0x33, 0x73, 0x3b, 0x26, 0x63, 0x23, 0x6b, 0x76, 0x3e, 0x7e, 0x36, 0x2b, 0x6e, 0x2e, 0x66, 0x7b, 0xd3, 0x93, + 0xdb, 0x06, 0x43, 0x03, 0x4b, 0x96, 0xde, 0x9e, 0xd6, 0x0b, 0x4e, 0x0e, 0x46, 0x9b, 0x57, 0x17, 0x5f, 0x82, + 0xc7, 0x87, 0xcf, 0x12, 0x5a, 0x1a, 0x52, 0x8f, 0xca, 0x8a, 0xc2, 0x1f, 0xd9, 0x99, 0xd1, 0x00, 0x49, 0x09, + 0x41, 0x90, 0xd8, 0x98, 0xd0, 0x01, 0x48, 0x08, 0x40, 0x91, 0x3d, 0x7d, 0x35, 0x24, 0x6d, 0x2d, 0x65, 0x74, + 0x3c, 0x7c, 0x34, 0x25, 0x6c, 0x2c, 0x64, 0x75, 0xdd, 0x9d, 0xd5, 0x04, 0x4d, 0x0d, 0x45, 0x94, 0xdc, 0x9c, + 0xd4, 0x05, 0x4c, 0x0c, 0x44, 0x95, 0x59, 0x19, 0x51, 0x80, 0xc9, 0x89, 0xc1, 0x10, 0x58, 0x18, 0x50, 0x81, + 0xc8, 0x88, 0xc0, 0x11, 0xd7, 0x97, 0xdf, 0x02, 0x47, 0x07, 0x4f, 0x92, 0xda, 0x9a, 0xd2, 0x0f, 0x4a, 0x0a, + 0x42, 0x9f, 0x53, 0x13, 0x5b, 0x86, 0xc3, 0x83, 0xcb, 0x16, 0x5e, 0x1e, 0x56, 0x8b, 0xce, 0x8e, 0xc6, 0x1b, + 0xb3, 0xf3, 0xbb, 0xa6, 0xe3, 0xa3, 0xeb, 0xf6, 0xbe, 0xfe, 0xb6, 0xab, 0xee, 0xae, 0xe6, 0xfb, 0x37, 0x77, + 0x3f, 0x22, 0x67, 0x27, 0x6f, 0x72, 0x3a, 0x7a, 0x32, 0x2f, 0x6a, 0x2a, 0x62, 0x7f, 0xb9, 0xf9, 0xb1, 0xa0, + 0xe9, 0xa9, 0xe1, 0xf0, 0xb8, 0xf8, 0xb0, 0xa1, 0xe8, 0xa8, 0xe0, 0xf1, 0x5d, 0x1d, 0x55, 0x84, 0xcd, 0x8d, + 0xc5, 0x14, 0x5c, 0x1c, 0x54, 0x85, 0xcc, 0x8c, 0xc4, 0x15, 0xbd, 0xfd, 0xb5, 0xa4, 0xed, 0xad, 0xe5, 0xf4, + 0xbc, 0xfc, 0xb4, 0xa5, 0xec, 0xac, 0xe4, 0xf5, 0x39, 0x79, 0x31, 0x20, 0x69, 0x29, 0x61, 0x70, 0x38, 0x78, + 0x30, 0x21, 0x68, 0x28, 0x60, 0x71, 0xb7, 0xf7, 0xbf, 0xa2, 0xe7, 0xa7, 0xef, 0xf2, 0xba, 0xfa, 0xb2, 0xaf, + 0xea, 0xaa, 0xe2, 0xff + }; + + static readonly byte[] _cssTable2 = + { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x08, 0x0b, 0x0a, 0x0d, 0x0c, 0x0f, 0x0e, 0x12, 0x13, + 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, 0x1b, 0x1a, 0x19, 0x18, 0x1f, 0x1e, 0x1d, 0x1c, 0x24, 0x25, 0x26, 0x27, + 0x20, 0x21, 0x22, 0x23, 0x2d, 0x2c, 0x2f, 0x2e, 0x29, 0x28, 0x2b, 0x2a, 0x36, 0x37, 0x34, 0x35, 0x32, 0x33, + 0x30, 0x31, 0x3f, 0x3e, 0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x49, 0x48, 0x4b, 0x4a, 0x4d, 0x4c, 0x4f, 0x4e, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x5b, 0x5a, 0x59, 0x58, 0x5f, 0x5e, 0x5d, 0x5c, 0x52, 0x53, + 0x50, 0x51, 0x56, 0x57, 0x54, 0x55, 0x6d, 0x6c, 0x6f, 0x6e, 0x69, 0x68, 0x6b, 0x6a, 0x64, 0x65, 0x66, 0x67, + 0x60, 0x61, 0x62, 0x63, 0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78, 0x76, 0x77, 0x74, 0x75, 0x72, 0x73, + 0x70, 0x71, 0x92, 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, 0x9b, 0x9a, 0x99, 0x98, 0x9f, 0x9e, 0x9d, 0x9c, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x89, 0x88, 0x8b, 0x8a, 0x8d, 0x8c, 0x8f, 0x8e, 0xb6, 0xb7, + 0xb4, 0xb5, 0xb2, 0xb3, 0xb0, 0xb1, 0xbf, 0xbe, 0xbd, 0xbc, 0xbb, 0xba, 0xb9, 0xb8, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa0, 0xa1, 0xa2, 0xa3, 0xad, 0xac, 0xaf, 0xae, 0xa9, 0xa8, 0xab, 0xaa, 0xdb, 0xda, 0xd9, 0xd8, 0xdf, 0xde, + 0xdd, 0xdc, 0xd2, 0xd3, 0xd0, 0xd1, 0xd6, 0xd7, 0xd4, 0xd5, 0xc9, 0xc8, 0xcb, 0xca, 0xcd, 0xcc, 0xcf, 0xce, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf6, 0xf7, + 0xf4, 0xf5, 0xf2, 0xf3, 0xf0, 0xf1, 0xed, 0xec, 0xef, 0xee, 0xe9, 0xe8, 0xeb, 0xea, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe0, 0xe1, 0xe2, 0xe3 + }; + + static readonly byte[] _cssTable3 = + { + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff + }; + + static readonly byte[] _cssTable4 = + { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, + 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, + 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, + 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, + 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, + 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, + 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, + 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, + 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, + 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, + 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, + 0x3f, 0xbf, 0x7f, 0xff + }; + + static readonly byte[] _cssTable5 = + { + 0xff, 0x7f, 0xbf, 0x3f, 0xdf, 0x5f, 0x9f, 0x1f, 0xef, 0x6f, 0xaf, 0x2f, 0xcf, 0x4f, 0x8f, 0x0f, 0xf7, 0x77, + 0xb7, 0x37, 0xd7, 0x57, 0x97, 0x17, 0xe7, 0x67, 0xa7, 0x27, 0xc7, 0x47, 0x87, 0x07, 0xfb, 0x7b, 0xbb, 0x3b, + 0xdb, 0x5b, 0x9b, 0x1b, 0xeb, 0x6b, 0xab, 0x2b, 0xcb, 0x4b, 0x8b, 0x0b, 0xf3, 0x73, 0xb3, 0x33, 0xd3, 0x53, + 0x93, 0x13, 0xe3, 0x63, 0xa3, 0x23, 0xc3, 0x43, 0x83, 0x03, 0xfd, 0x7d, 0xbd, 0x3d, 0xdd, 0x5d, 0x9d, 0x1d, + 0xed, 0x6d, 0xad, 0x2d, 0xcd, 0x4d, 0x8d, 0x0d, 0xf5, 0x75, 0xb5, 0x35, 0xd5, 0x55, 0x95, 0x15, 0xe5, 0x65, + 0xa5, 0x25, 0xc5, 0x45, 0x85, 0x05, 0xf9, 0x79, 0xb9, 0x39, 0xd9, 0x59, 0x99, 0x19, 0xe9, 0x69, 0xa9, 0x29, + 0xc9, 0x49, 0x89, 0x09, 0xf1, 0x71, 0xb1, 0x31, 0xd1, 0x51, 0x91, 0x11, 0xe1, 0x61, 0xa1, 0x21, 0xc1, 0x41, + 0x81, 0x01, 0xfe, 0x7e, 0xbe, 0x3e, 0xde, 0x5e, 0x9e, 0x1e, 0xee, 0x6e, 0xae, 0x2e, 0xce, 0x4e, 0x8e, 0x0e, + 0xf6, 0x76, 0xb6, 0x36, 0xd6, 0x56, 0x96, 0x16, 0xe6, 0x66, 0xa6, 0x26, 0xc6, 0x46, 0x86, 0x06, 0xfa, 0x7a, + 0xba, 0x3a, 0xda, 0x5a, 0x9a, 0x1a, 0xea, 0x6a, 0xaa, 0x2a, 0xca, 0x4a, 0x8a, 0x0a, 0xf2, 0x72, 0xb2, 0x32, + 0xd2, 0x52, 0x92, 0x12, 0xe2, 0x62, 0xa2, 0x22, 0xc2, 0x42, 0x82, 0x02, 0xfc, 0x7c, 0xbc, 0x3c, 0xdc, 0x5c, + 0x9c, 0x1c, 0xec, 0x6c, 0xac, 0x2c, 0xcc, 0x4c, 0x8c, 0x0c, 0xf4, 0x74, 0xb4, 0x34, 0xd4, 0x54, 0x94, 0x14, + 0xe4, 0x64, 0xa4, 0x24, 0xc4, 0x44, 0x84, 0x04, 0xf8, 0x78, 0xb8, 0x38, 0xd8, 0x58, 0x98, 0x18, 0xe8, 0x68, + 0xa8, 0x28, 0xc8, 0x48, 0x88, 0x08, 0xf0, 0x70, 0xb0, 0x30, 0xd0, 0x50, 0x90, 0x10, 0xe0, 0x60, 0xa0, 0x20, + 0xc0, 0x40, 0x80, 0x00 + }; + + static readonly byte[] _encryptTable0 = + { + 0xB7, 0xF4, 0x82, 0x57, 0xDA, 0x4D, 0xDB, 0xE2, 0x2F, 0x52, 0x1A, 0xA8, 0x68, 0x5A, 0x8A, 0xFF, 0xFB, 0x0E, + 0x6D, 0x35, 0xF7, 0x5C, 0x76, 0x12, 0xCE, 0x25, 0x79, 0x29, 0x39, 0x62, 0x08, 0x24, 0xA5, 0x85, 0x7B, 0x56, + 0x01, 0x23, 0x68, 0xCF, 0x0A, 0xE2, 0x5A, 0xED, 0x3D, 0x59, 0xB0, 0xA9, 0xB0, 0x2C, 0xF2, 0xB8, 0xEF, 0x32, + 0xA9, 0x40, 0x80, 0x71, 0xAF, 0x1E, 0xDE, 0x8F, 0x58, 0x88, 0xB8, 0x3A, 0xD0, 0xFC, 0xC4, 0x1E, 0xB5, 0xA0, + 0xBB, 0x3B, 0x0F, 0x01, 0x7E, 0x1F, 0x9F, 0xD9, 0xAA, 0xB8, 0x3D, 0x9D, 0x74, 0x1E, 0x25, 0xDB, 0x37, 0x56, + 0x8F, 0x16, 0xBA, 0x49, 0x2B, 0xAC, 0xD0, 0xBD, 0x95, 0x20, 0xBE, 0x7A, 0x28, 0xD0, 0x51, 0x64, 0x63, 0x1C, + 0x7F, 0x66, 0x10, 0xBB, 0xC4, 0x56, 0x1A, 0x04, 0x6E, 0x0A, 0xEC, 0x9C, 0xD6, 0xE8, 0x9A, 0x7A, 0xCF, 0x8C, + 0xDB, 0xB1, 0xEF, 0x71, 0xDE, 0x31, 0xFF, 0x54, 0x3E, 0x5E, 0x07, 0x69, 0x96, 0xB0, 0xCF, 0xDD, 0x9E, 0x47, + 0xC7, 0x96, 0x8F, 0xE4, 0x2B, 0x59, 0xC6, 0xEE, 0xB9, 0x86, 0x9A, 0x64, 0x84, 0x72, 0xE2, 0x5B, 0xA2, 0x96, + 0x58, 0x99, 0x50, 0x03, 0xF5, 0x38, 0x4D, 0x02, 0x7D, 0xE7, 0x7D, 0x75, 0xA7, 0xB8, 0x67, 0x87, 0x84, 0x3F, + 0x1D, 0x11, 0xE5, 0xFC, 0x1E, 0xD3, 0x83, 0x16, 0xA5, 0x29, 0xF6, 0xC7, 0x15, 0x61, 0x29, 0x1A, 0x43, 0x4F, + 0x9B, 0xAF, 0xC5, 0x87, 0x34, 0x6C, 0x0F, 0x3B, 0xA8, 0x1D, 0x45, 0x58, 0x25, 0xDC, 0xA8, 0xA3, 0x3B, 0xD1, + 0x79, 0x1B, 0x48, 0xF2, 0xE9, 0x93, 0x1F, 0xFC, 0xDB, 0x2A, 0x90, 0xA9, 0x8A, 0x3D, 0x39, 0x18, 0xA3, 0x8E, + 0x58, 0x6C, 0xE0, 0x12, 0xBB, 0x25, 0xCD, 0x71, 0x22, 0xA2, 0x64, 0xC6, 0xE7, 0xFB, 0xAD, 0x94, 0x77, 0x04, + 0x9A, 0x39, 0xCF, 0x7C + }; + + static readonly byte[] _encryptTable1 = + { + 0x8C, 0x47, 0xB0, 0xE1, 0xEB, 0xFC, 0xEB, 0x56, 0x10, 0xE5, 0x2C, 0x1A, 0x5D, 0xEF, 0xBE, 0x4F, 0x08, 0x75, + 0x97, 0x4B, 0x0E, 0x25, 0x8E, 0x6E, 0x39, 0x5A, 0x87, 0x53, 0xC4, 0x1F, 0xF4, 0x5C, 0x4E, 0xE6, 0x99, 0x30, + 0xE0, 0x42, 0x88, 0xAB, 0xE5, 0x85, 0xBC, 0x8F, 0xD8, 0x3C, 0x54, 0xC9, 0x53, 0x47, 0x18, 0xD6, 0x06, 0x5B, + 0x41, 0x2C, 0x67, 0x1E, 0x41, 0x74, 0x33, 0xE2, 0xB4, 0xE0, 0x23, 0x29, 0x42, 0xEA, 0x55, 0x0F, 0x25, 0xB4, + 0x24, 0x2C, 0x99, 0x13, 0xEB, 0x0A, 0x0B, 0xC9, 0xF9, 0x63, 0x67, 0x43, 0x2D, 0xC7, 0x7D, 0x07, 0x60, 0x89, + 0xD1, 0xCC, 0xE7, 0x94, 0x77, 0x74, 0x9B, 0x7E, 0xD7, 0xE6, 0xFF, 0xBB, 0x68, 0x14, 0x1E, 0xA3, 0x25, 0xDE, + 0x3A, 0xA3, 0x54, 0x7B, 0x87, 0x9D, 0x50, 0xCA, 0x27, 0xC3, 0xA4, 0x50, 0x91, 0x27, 0xD4, 0xB0, 0x82, 0x41, + 0x97, 0x79, 0x94, 0x82, 0xAC, 0xC7, 0x8E, 0xA5, 0x4E, 0xAA, 0x78, 0x9E, 0xE0, 0x42, 0xBA, 0x28, 0xEA, 0xB7, + 0x74, 0xAD, 0x35, 0xDA, 0x92, 0x60, 0x7E, 0xD2, 0x0E, 0xB9, 0x24, 0x5E, 0x39, 0x4F, 0x5E, 0x63, 0x09, 0xB5, + 0xFA, 0xBF, 0xF1, 0x22, 0x55, 0x1C, 0xE2, 0x25, 0xDB, 0xC5, 0xD8, 0x50, 0x03, 0x98, 0xC4, 0xAC, 0x2E, 0x11, + 0xB4, 0x38, 0x4D, 0xD0, 0xB9, 0xFC, 0x2D, 0x3C, 0x08, 0x04, 0x5A, 0xEF, 0xCE, 0x32, 0xFB, 0x4C, 0x92, 0x1E, + 0x4B, 0xFB, 0x1A, 0xD0, 0xE2, 0x3E, 0xDA, 0x6E, 0x7C, 0x4D, 0x56, 0xC3, 0x3F, 0x42, 0xB1, 0x3A, 0x23, 0x4D, + 0x6E, 0x84, 0x56, 0x68, 0xF4, 0x0E, 0x03, 0x64, 0xD0, 0xA9, 0x92, 0x2F, 0x8B, 0xBC, 0x39, 0x9C, 0xAC, 0x09, + 0x5E, 0xEE, 0xE5, 0x97, 0xBF, 0xA5, 0xCE, 0xFA, 0x28, 0x2C, 0x6D, 0x4F, 0xEF, 0x77, 0xAA, 0x1B, 0x79, 0x8E, + 0x97, 0xB4, 0xC3, 0xF4 + }; + + static readonly byte[] _encryptTable2 = + { + 0xB7, 0x75, 0x81, 0xD5, 0xDC, 0xCA, 0xDE, 0x66, 0x23, 0xDF, 0x15, 0x26, 0x62, 0xD1, 0x83, 0x77, 0xE3, 0x97, + 0x76, 0xAF, 0xE9, 0xC3, 0x6B, 0x8E, 0xDA, 0xB0, 0x6E, 0xBF, 0x2B, 0xF1, 0x19, 0xB4, 0x95, 0x34, 0x48, 0xE4, + 0x37, 0x94, 0x5D, 0x7B, 0x36, 0x5F, 0x65, 0x53, 0x07, 0xE2, 0x89, 0x11, 0x98, 0x85, 0xD9, 0x12, 0xC1, 0x9D, + 0x84, 0xEC, 0xA4, 0xD4, 0x88, 0xB8, 0xFC, 0x2C, 0x79, 0x28, 0xD8, 0xDB, 0xB3, 0x1E, 0xA2, 0xF9, 0xD0, 0x44, + 0xD7, 0xD6, 0x60, 0xEF, 0x14, 0xF4, 0xF6, 0x31, 0xD2, 0x41, 0x46, 0x67, 0x0A, 0xE1, 0x58, 0x27, 0x43, 0xA3, + 0xF8, 0xE0, 0xC8, 0xBA, 0x5A, 0x5C, 0x80, 0x6C, 0xC6, 0xF2, 0xE8, 0xAD, 0x7D, 0x04, 0x0D, 0xB9, 0x3C, 0xC2, + 0x25, 0xBD, 0x49, 0x63, 0x8C, 0x9F, 0x51, 0xCE, 0x20, 0xC5, 0xA1, 0x50, 0x92, 0x2D, 0xDD, 0xBC, 0x8D, 0x4F, + 0x9A, 0x71, 0x2F, 0x30, 0x1D, 0x73, 0x39, 0x13, 0xFB, 0x1A, 0xCB, 0x24, 0x59, 0xFE, 0x05, 0x96, 0x57, 0x0F, + 0x1F, 0xCF, 0x54, 0xBE, 0xF5, 0x06, 0x1B, 0xB2, 0x6D, 0xD3, 0x4D, 0x32, 0x56, 0x21, 0x33, 0x0B, 0x52, 0xE7, + 0xAB, 0xEB, 0xA6, 0x74, 0x00, 0x4C, 0xB1, 0x7F, 0x82, 0x99, 0x87, 0x0E, 0x5E, 0xC0, 0x8F, 0xEE, 0x6F, 0x55, + 0xF3, 0x7E, 0x08, 0x90, 0xFA, 0xB6, 0x64, 0x70, 0x47, 0x4A, 0x17, 0xA7, 0xB5, 0x40, 0x8A, 0x38, 0xE5, 0x68, + 0x3E, 0x8B, 0x69, 0xAA, 0x9B, 0x42, 0xA5, 0x10, 0x01, 0x35, 0xFD, 0x61, 0x9E, 0xE6, 0x16, 0x9C, 0x86, 0xED, + 0xCD, 0x2E, 0xFF, 0xC4, 0x5B, 0xA0, 0xAE, 0xCC, 0x4B, 0x3B, 0x03, 0xBB, 0x1C, 0x2A, 0xAC, 0x0C, 0x3F, 0x93, + 0xC7, 0x72, 0x7A, 0x09, 0x22, 0x3D, 0x45, 0x78, 0xA9, 0xA8, 0xEA, 0xC9, 0x6A, 0xF7, 0x29, 0x91, 0xF0, 0x02, + 0x18, 0x3A, 0x4E, 0x7C + }; + + static readonly byte[] _encryptTable3 = + { + 0x73, 0x51, 0x95, 0xE1, 0x12, 0xE4, 0xC0, 0x58, 0xEE, 0xF2, 0x08, 0x1B, 0xA9, 0xFA, 0x98, 0x4C, 0xA7, 0x33, + 0xE2, 0x1B, 0xA7, 0x6D, 0xF5, 0x30, 0x97, 0x1D, 0xF3, 0x02, 0x60, 0x5A, 0x82, 0x0F, 0x91, 0xD0, 0x9C, 0x10, + 0x39, 0x7A, 0x83, 0x85, 0x3B, 0xB2, 0xB8, 0xAE, 0x0C, 0x09, 0x52, 0xEA, 0x1C, 0xE1, 0x8D, 0x66, 0x4F, 0xF3, + 0xDA, 0x92, 0x29, 0xB9, 0xD5, 0xC5, 0x77, 0x47, 0x22, 0x53, 0x14, 0xF7, 0xAF, 0x22, 0x64, 0xDF, 0xC6, 0x72, + 0x12, 0xF3, 0x75, 0xDA, 0xD7, 0xD7, 0xE5, 0x02, 0x9E, 0xED, 0xDA, 0xDB, 0x4C, 0x47, 0xCE, 0x91, 0x06, 0x06, + 0x6D, 0x55, 0x8B, 0x19, 0xC9, 0xEF, 0x8C, 0x80, 0x1A, 0x0E, 0xEE, 0x4B, 0xAB, 0xF2, 0x08, 0x5C, 0xE9, 0x37, + 0x26, 0x5E, 0x9A, 0x90, 0x00, 0xF3, 0x0D, 0xB2, 0xA6, 0xA3, 0xF7, 0x26, 0x17, 0x48, 0x88, 0xC9, 0x0E, 0x2C, + 0xC9, 0x02, 0xE7, 0x18, 0x05, 0x4B, 0xF3, 0x39, 0xE1, 0x20, 0x02, 0x0D, 0x40, 0xC7, 0xCA, 0xB9, 0x48, 0x30, + 0x57, 0x67, 0xCC, 0x06, 0xBF, 0xAC, 0x81, 0x08, 0x24, 0x7A, 0xD4, 0x8B, 0x19, 0x8E, 0xAC, 0xB4, 0x5A, 0x0F, + 0x73, 0x13, 0xAC, 0x9E, 0xDA, 0xB6, 0xB8, 0x96, 0x5B, 0x60, 0x88, 0xE1, 0x81, 0x3F, 0x07, 0x86, 0x37, 0x2D, + 0x79, 0x14, 0x52, 0xEA, 0x73, 0xDF, 0x3D, 0x09, 0xC8, 0x25, 0x48, 0xD8, 0x75, 0x60, 0x9A, 0x08, 0x27, 0x4A, + 0x2C, 0xB9, 0xA8, 0x8B, 0x8A, 0x73, 0x62, 0x37, 0x16, 0x02, 0xBD, 0xC1, 0x0E, 0x56, 0x54, 0x3E, 0x14, 0x5F, + 0x8C, 0x8F, 0x6E, 0x75, 0x1C, 0x07, 0x39, 0x7B, 0x4B, 0xDB, 0xD3, 0x4B, 0x1E, 0xC8, 0x7E, 0xFE, 0x3E, 0x72, + 0x16, 0x83, 0x7D, 0xEE, 0xF5, 0xCA, 0xC5, 0x18, 0xF9, 0xD8, 0x68, 0xAB, 0x38, 0x85, 0xA8, 0xF0, 0xA1, 0x73, + 0x9F, 0x5D, 0x19, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x72, 0x39, 0x25, 0x67, 0x26, + 0x6D, 0x71, 0x36, 0x77, 0x3C, 0x20, 0x62, 0x23, 0x68, 0x74, 0xC3, 0x82, 0xC9, 0x15, 0x57, 0x16, 0x5D, 0x81 + }; + + static readonly byte[,] _permutationChallenge = + { + { + 1, 3, 0, 7, 5, 2, 9, 6, 4, 8 + }, + { + 6, 1, 9, 3, 8, 5, 7, 4, 0, 2 + }, + { + 4, 0, 3, 5, 7, 2, 8, 6, 1, 9 + } + }; + + static readonly byte[,] _permutationVariant = + { + { + 0x0a, 0x08, 0x0e, 0x0c, 0x0b, 0x09, 0x0f, 0x0d, 0x1a, 0x18, 0x1e, 0x1c, 0x1b, 0x19, 0x1f, 0x1d, 0x02, + 0x00, 0x06, 0x04, 0x03, 0x01, 0x07, 0x05, 0x12, 0x10, 0x16, 0x14, 0x13, 0x11, 0x17, 0x15 + }, + { + 0x12, 0x1a, 0x16, 0x1e, 0x02, 0x0a, 0x06, 0x0e, 0x10, 0x18, 0x14, 0x1c, 0x00, 0x08, 0x04, 0x0c, 0x13, + 0x1b, 0x17, 0x1f, 0x03, 0x0b, 0x07, 0x0f, 0x11, 0x19, 0x15, 0x1d, 0x01, 0x09, 0x05, 0x0d + } + }; + + static readonly byte[] _variants = + { + 0xB7, 0x74, 0x85, 0xD0, 0xCC, 0xDB, 0xCA, 0x73, 0x03, 0xFE, 0x31, 0x03, 0x52, 0xE0, 0xB7, 0x42, 0x63, 0x16, + 0xF2, 0x2A, 0x79, 0x52, 0xFF, 0x1B, 0x7A, 0x11, 0xCA, 0x1A, 0x9B, 0x40, 0xAD, 0x01 + }; + + static readonly byte[] _secret = + { + 0x55, 0xD6, 0xC4, 0xC5, 0x28 + }; + + /// + /// The disc key returned by the logical unit is encoded with the bus key + /// to prevent man-in-the-middle attacks. This method returns a structure + /// with the decoded key included. + /// + /// The encoded key from the logical unit. + /// The bus key from the logical unit. + /// A DiscKey struct with the decoded key. + public static CSS_CPRM.DiscKey? DecodeDiscKey(byte[] response, byte[] busKey) + { + if(response?.Length != 2052 || + busKey?.Length != 5) + return null; + + byte[] key = response.Skip(4).Take(2048).ToArray(); + + for(uint i = 0; i < key.Length; i++) + key[i] ^= busKey[4 - (i % busKey.Length)]; + + return new CSS_CPRM.DiscKey + { + DataLength = (ushort)((response[0] << 8) + response[1]), + Reserved1 = response[2], + Reserved2 = response[3], + Key = key + }; + } + + /// + /// The title key returned by the logical unit is encoded with the bus key + /// to prevent man-in-the-middle attacks. This method returns a structure + /// with the decoded key included. + /// + /// The encoded key from the logical unit. + /// The bus key from the logical unit. + /// A TitleKey struct with the decoded key. + public static CSS_CPRM.TitleKey? DecodeTitleKey(byte[] response, byte[] busKey) + { + if(response?.Length != 12 || + busKey?.Length != 5) + return null; + + byte[] key = response.Skip(5).Take(5).ToArray(); + + for(uint i = 0; i < key.Length; i++) + key[i] ^= busKey[4 - (i % busKey.Length)]; + + return new CSS_CPRM.TitleKey + { + DataLength = (ushort)((response[0] << 8) + response[1]), + Reserved1 = response[2], + Reserved2 = response[3], + CMI = response[4], + Key = key, + Reserved3 = response[10], + Reserved4 = response[11] + }; + } + + /// + /// Takes a challenge and a variant and encrypts it according to the key type. + /// + /// The type of key to encrypt. + /// + /// The challenge sent to the logical unit. + /// The encrypted key. + /// The encrypted key. + public static void EncryptKey(DvdCssKeyType keyType, uint variant, byte[] challenge, out byte[] key) + { + byte[] bits = new byte[30]; + byte[] scratch = new byte[10]; + byte index = sizeof(byte) * 30; + byte[] temp1 = new byte[5]; + byte[] temp2 = new byte[5]; + byte carry = 0; + key = new byte[5]; + + for(int i = 9; i >= 0; --i) + scratch[i] = challenge[_permutationChallenge[(uint)keyType, i]]; + + byte cssVariant = (byte)(keyType == 0 ? variant : _permutationVariant[(uint)keyType - 1, variant]); + + for(int i = 5; --i >= 0;) + temp1[i] = (byte)(scratch[5 + i] ^ _secret[i] ^ _encryptTable2[i]); + + uint lfsr0 = (uint)((temp1[0] << 17) | (temp1[1] << 9) | ((temp1[2] & ~7) << 1) | 8 | (temp1[2] & 7)); + uint lfsr1 = (uint)((temp1[3] << 9) | 0x100 | temp1[4]); + + do + { + byte val = 0; + + for(int bit = 0; bit < 8; ++bit) + { + byte oLfsr0 = (byte)(((lfsr0 >> 24) ^ (lfsr0 >> 21) ^ (lfsr0 >> 20) ^ (lfsr0 >> 12)) & 1); + lfsr0 = (lfsr0 << 1) | oLfsr0; + + byte oLfsr1 = (byte)(((lfsr1 >> 16) ^ (lfsr1 >> 2)) & 1); + lfsr1 = (lfsr1 << 1) | oLfsr1; + + byte combined = (byte)(Convert.ToByte(oLfsr1 == 0) + carry + Convert.ToByte(oLfsr0 == 0)); + carry = (byte)((combined >> 1) & 1); + val |= (byte)((combined & 1) << bit); + } + + bits[--index] = val; + } while(index > 0); + + byte cse = (byte)(_variants[cssVariant] ^ _encryptTable2[cssVariant]); + int term = 0; + + for(int i = 5; --i >= 0; term = scratch[i]) + { + index = (byte)(bits[25 + i] ^ scratch[i]); + index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); + + temp1[i] = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); + } + + temp1[4] ^= temp1[0]; + term = 0; + + for(int i = 5; --i >= 0; term = temp1[i]) + { + index = (byte)(bits[20 + i] ^ temp1[i]); + index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); + + temp2[i] = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); + } + + temp2[4] ^= temp2[0]; + term = 0; + + for(int i = 5; --i >= 0; term = temp2[i]) + { + index = (byte)(bits[15 + i] ^ temp2[i]); + index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); + index = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); + + temp1[i] = (byte)(_encryptTable0[index] ^ _encryptTable2[index]); + } + + temp1[4] ^= temp1[0]; + term = 0; + + for(int i = 5; --i >= 0; term = temp1[i]) + { + index = (byte)(bits[10 + i] ^ temp1[i]); + index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); + index = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); + + temp2[i] = (byte)(_encryptTable0[index] ^ _encryptTable2[index]); + } + + temp2[4] ^= temp2[0]; + term = 0; + + for(int i = 5; --i >= 0; term = temp2[i]) + { + index = (byte)(bits[5 + i] ^ temp2[i]); + index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); + + temp1[i] = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); + } + + temp1[4] ^= temp1[0]; + term = 0; + + for(int i = 5; --i >= 0; term = temp1[i]) + { + index = (byte)(bits[i] ^ temp1[i]); + index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); + + key[i] = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); + } + } + + /// + /// Takes an encrypted key and its crypto and returns the key decrypted. + /// + /// + /// The key used to encrypt the data. + /// The encrypted data. + /// The decrypted data. + public static void DecryptKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) + { + decryptedKey = new byte[5]; + byte[] k = new byte[5]; + + uint lfsr1Lo = (uint)(cryptoKey[0] | 0x100); + uint lfsr1Hi = cryptoKey[1]; + + uint lfsr0 = (uint)(((cryptoKey[4] << 17) | (cryptoKey[3] << 9) | (cryptoKey[2] << 1)) + 8 - + (cryptoKey[2] & 7)); + + lfsr0 = (uint)((_cssTable4[lfsr0 & 0xff] << 24) | (_cssTable4[(lfsr0 >> 8) & 0xff] << 16) | + (_cssTable4[(lfsr0 >> 16) & 0xff] << 8) | _cssTable4[(lfsr0 >> 24) & 0xff]); + + uint combined = 0; + + for(uint i = 0; i < 5; i++) + { + byte oLfsr1 = (byte)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); + lfsr1Hi = lfsr1Lo >> 1; + lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; + oLfsr1 = _cssTable4[oLfsr1]; + byte oLfsr0 = (byte)(((((((lfsr0 >> 8) ^ lfsr0) >> 1) ^ lfsr0) >> 3) ^ lfsr0) >> 7); + lfsr0 = (uint)((lfsr0 >> 8) | (oLfsr0 << 24)); + combined += (uint)((oLfsr0 ^ invert) + oLfsr1); + k[i] = (byte)(combined & 0xff); + combined >>= 8; + } + + decryptedKey[4] = (byte)(k[4] ^ _cssTable1[encryptedKey[4]] ^ encryptedKey[3]); + decryptedKey[3] = (byte)(k[3] ^ _cssTable1[encryptedKey[3]] ^ encryptedKey[2]); + decryptedKey[2] = (byte)(k[2] ^ _cssTable1[encryptedKey[2]] ^ encryptedKey[1]); + decryptedKey[1] = (byte)(k[1] ^ _cssTable1[encryptedKey[1]] ^ encryptedKey[0]); + decryptedKey[0] = (byte)(k[0] ^ _cssTable1[encryptedKey[0]] ^ decryptedKey[4]); + + decryptedKey[4] = (byte)(k[4] ^ _cssTable1[decryptedKey[4]] ^ decryptedKey[3]); + decryptedKey[3] = (byte)(k[3] ^ _cssTable1[decryptedKey[3]] ^ decryptedKey[2]); + decryptedKey[2] = (byte)(k[2] ^ _cssTable1[decryptedKey[2]] ^ decryptedKey[1]); + decryptedKey[1] = (byte)(k[1] ^ _cssTable1[decryptedKey[1]] ^ decryptedKey[0]); + decryptedKey[0] = (byte)(k[0] ^ _cssTable1[decryptedKey[0]]); + } + + public static void + DecryptTitleKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) => + DecryptKey(invert, cryptoKey, encryptedKey, out decryptedKey); + + /// + /// Takes an bytearray of encrypted keys, decrypts them and returns the correctly decrypted key. + /// + /// Encrypted keys to try to decrypt. + /// The decrypted key if found. + public static void DecryptDiscKey(byte[] encryptedKeys, out byte[]? decryptedKey) + { + decryptedKey = new byte[5]; + byte[] verificationKey = encryptedKeys.Take(5).ToArray(); + + for(uint n = 0; n < _playerKeys.GetLength(0); n++) + { + byte[] currentPlayerKey = Enumerable.Range(0, _playerKeys.GetLength(1)).Select(x => _playerKeys[n, x]). + ToArray(); + + for(uint i = 1; i < 409; i++) + { + DecryptKey(0, currentPlayerKey, encryptedKeys.Skip(5 * (int)i).Take(5).ToArray(), out decryptedKey); + + // The first key in the structure is the key encrypted with itself, so we can use it to verify + // we found the correct key. + DecryptKey(0, decryptedKey, verificationKey, out byte[] verify); + + if(decryptedKey.SequenceEqual(verify)) + { + return; + } + } + } + + // No correct key was found. + decryptedKey = null; + } + + /// + /// Takes a sector and a decrypted title key and returns the decrypted sector. + /// + /// Encrypted sector data. + /// The Copyright Management Information. + /// The encryption keys. + /// Number of sectors in sectorData. + /// Size of one sector. + /// The decrypted sector. + public static byte[] DecryptSector(byte[] sectorData, byte[] cmiData, byte[] keyData, uint blocks = 1, + uint blockSize = 2048) + { + if(cmiData.All(cmi => (cmi & 0x80) >> 7 == 0) || + keyData.All(k => k == 0)) + return sectorData; + + byte[] decryptedBuffer = new byte[sectorData.Length]; + + for(uint j = 0; j < blocks; j++) + { + byte[] currentKey = keyData.Skip((int)(j * 5)).Take(5).ToArray(); + byte[] currentSector = sectorData.Skip((int)(j * blockSize)).Take((int)blockSize).ToArray(); + + // If the CMI tells use the sector isn't encrypted or + // if the key is all zeroes or + // if the MPEG Packetized Elementary Stream scrambling control value tells us the packet is not scrambled + if((cmiData[j] & 0x80) >> 7 == 0 || + currentKey.All(k => k == 0) || + (currentSector[20] & 0x30) >> 4 == 0) + { + // Sector is not encrypted + Array.Copy(currentSector, 0, decryptedBuffer, (int)(j * blockSize), blockSize); + + continue; + } + + uint lfsr1Lo = (uint)(currentKey[0] ^ currentSector[0x54]) | 0x100; + uint lfsr1Hi = (uint)currentKey[1] ^ currentSector[0x55]; + + uint lfsr0 = (uint)((currentKey[2] | (currentKey[3] << 8) | (currentKey[4] << 16)) ^ + (sectorData[0x56] | (sectorData[0x57] << 8) | (sectorData[0x58] << 16))); + + uint oLfsr1 = lfsr0 & 7; + lfsr0 = (lfsr0 * 2) + 8 - oLfsr1; + + uint combined = 0; + + for(uint i = 128; i < blockSize; i++) + { + oLfsr1 = (uint)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); + lfsr1Hi = lfsr1Lo >> 1; + lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; + oLfsr1 = _cssTable5[oLfsr1]; + uint oLfsr0 = (((((((lfsr0 >> 3) ^ lfsr0) >> 1) ^ lfsr0) >> 8) ^ lfsr0) >> 5) & 0xff; + lfsr0 = (lfsr0 >> 8) | (oLfsr0 << 24); + lfsr0 = (lfsr0 << 8) | oLfsr0; + oLfsr0 = _cssTable4[oLfsr0]; + combined += oLfsr0 + oLfsr1; + currentSector[i] = (byte)(_cssTable1[currentSector[i]] ^ (combined & 0xff)); + combined >>= 8; + } + + Array.Copy(currentSector, 0, decryptedBuffer, (int)(j * blockSize), blockSize); + } + + return decryptedBuffer; + } + + /// + /// Takes an RPC state from the drive and a CMI from a disc and checks if the regions are compatible. + /// + /// The RegionalPlaybackControlState from drive. + /// The LeadInCopyright from disc. + /// true if the regions are compatible, else false + public static bool CheckRegion(CSS_CPRM.RegionalPlaybackControlState rpc, CSS_CPRM.LeadInCopyright cmi) + { + // if disc region is all or none, we cannot do anything but try to read it as is + if(cmi.RegionInformation == 0xFF || + cmi.RegionInformation == 0x00) + return true; + + return ((rpc.RegionMask & 0x01) == (cmi.RegionInformation & 0x01) && (rpc.RegionMask & 0x01) != 0x01) || + ((rpc.RegionMask & 0x02) == (cmi.RegionInformation & 0x02) && (rpc.RegionMask & 0x02) != 0x02) || + ((rpc.RegionMask & 0x04) == (cmi.RegionInformation & 0x04) && (rpc.RegionMask & 0x04) != 0x04) || + ((rpc.RegionMask & 0x08) == (cmi.RegionInformation & 0x08) && (rpc.RegionMask & 0x08) != 0x08) || + ((rpc.RegionMask & 0x10) == (cmi.RegionInformation & 0x10) && (rpc.RegionMask & 0x10) != 0x10) || + ((rpc.RegionMask & 0x20) == (cmi.RegionInformation & 0x20) && (rpc.RegionMask & 0x20) != 0x20) || + ((rpc.RegionMask & 0x40) == (cmi.RegionInformation & 0x40) && (rpc.RegionMask & 0x40) != 0x40) || + ((rpc.RegionMask & 0x80) == (cmi.RegionInformation & 0x80) && (rpc.RegionMask & 0x80) != 0x80); + } + } +} diff --git a/DVD/Dump.cs b/DVD/Dump.cs new file mode 100644 index 000000000..331bbcb09 --- /dev/null +++ b/DVD/Dump.cs @@ -0,0 +1,529 @@ +// /*************************************************************************** +// Aaru Data Preservation Suite +// ---------------------------------------------------------------------------- +// +// Filename : Dump.cs +// Author(s) : Rebecca Wallander +// +// --[ Description ] ---------------------------------------------------------- +// +// SCSI read commands related to Content Scrambling System. +// +// --[ License ] -------------------------------------------------------------- +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// ---------------------------------------------------------------------------- +// Copyright © 2020-2021 Rebecca Wallander +// ****************************************************************************/ + +using System; +using System.Linq; +using Aaru.Console; +using Aaru.Decoders.DVD; +using Aaru.Devices; + +namespace Aaru.Decryption.DVD +{ + public sealed class Dump + { + const byte _keySize = 5; + const byte _challengeSize = 2 * _keySize; + readonly Device _dev; + public byte Agid { get; private set; } + public byte[] BusKey { get; private set; } + + public Dump(Device dev) + { + _dev = dev; + BusKey = null; + Agid = 0; + } + + /// + /// Returns the Authentication Success Flag of the logical unit. + /// + /// true if the command failed and contains the sense buffer. + /// Buffer where the Authentication Success Flag will be stored. + /// Sense buffer. + /// Key class. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + public bool ReadAsf(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, + out double duration) + { + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + buffer = new byte[8]; + + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.Asf ^ ((Agid & 0x03) << 6)); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, + Agid, sense, _dev.LastError); + + return sense; + } + + /// + /// Returns the Regional Playback Control State of the logical unit. + /// + /// true if the command failed and contains the sense buffer. + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + public bool ReadRpc(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, + out double duration) + { + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + buffer = new byte[8]; + + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.RpcState ^ ((Agid & 0x03) << 6)); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, + Agid, sense, _dev.LastError); + + return sense; + } + + /// + /// Invalidates an Authentication Grant ID. + /// + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool InvalidateAgid(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, + out double duration) + { + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + buffer = new byte[0]; + + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.InvalidateAgid ^ ((Agid & 0x03) << 6)); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "INVALIDATE AGID (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", + duration, Agid, sense, _dev.LastError); + + return sense; + } + + /// + /// Returns a valid Authentication Grant ID for CSS/CPPM. + /// + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool ReportAgidCssCppm(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, + out double duration) + { + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + buffer = new byte[8]; + + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.AgidForCssCppm ^ ((Agid & 0x03) << 6)); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "REPORT AGID CSS/CPPM (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", + duration, Agid, sense, _dev.LastError); + + return sense; + } + + /// + /// Returns KEY1 from the logical unit. + /// + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool ReportKey1(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, + out double duration) + { + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + buffer = new byte[12]; + + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.Key1 ^ ((Agid & 0x03) << 6)); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "REPORT KEY1 (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, + Agid, sense, _dev.LastError); + + return sense; + } + + /// + /// Returns the challenge from the logical unit. + /// + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool ReportChallenge(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, + out double duration) + { + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + buffer = new byte[16]; + + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.ChallengeKey ^ ((Agid & 0x03) << 6)); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "REPORT CHALLENGE (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", + duration, Agid, sense, _dev.LastError); + + return sense; + } + + /// + /// Send a challenge to the logical unit. + /// + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// The challenge; can be any 10 bytes. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool SendChallenge(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, + byte[] challengeKey, uint timeout, out double duration) + { + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + buffer = new byte[16]; + + cdb[0] = (byte)ScsiCommands.SendKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssSendKeyFormat.ChallengeKey ^ ((Agid & 0x03) << 6)); + buffer[0] = (byte)(((buffer.Length - 2) & 0xFF00) >> 8); + buffer[1] = (byte)((buffer.Length - 2) & 0xFF); + buffer[4] = challengeKey[9]; + buffer[5] = challengeKey[8]; + buffer[6] = challengeKey[7]; + buffer[7] = challengeKey[6]; + buffer[8] = challengeKey[5]; + buffer[9] = challengeKey[4]; + buffer[10] = challengeKey[3]; + buffer[11] = challengeKey[2]; + buffer[12] = challengeKey[1]; + buffer[13] = challengeKey[0]; + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "SEND CHALLENGE (AGID: {1}, Challenge {2}, Sense: {3}, Last Error: {4}) took {0} ms.", + duration, Agid, challengeKey, sense, _dev.LastError); + + return sense; + } + + /// + /// Send KEY2 to the logical unit. + /// + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// The KEY2 message. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool SendKey2(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, byte[] key2, + uint timeout, out double duration) + { + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + buffer = new byte[12]; + + cdb[0] = (byte)ScsiCommands.SendKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssSendKeyFormat.Key2 ^ ((Agid & 0x03) << 6)); + buffer[0] = (byte)(((buffer.Length - 2) & 0xFF00) >> 8); + buffer[1] = (byte)((buffer.Length - 2) & 0xFF); + buffer[4] = key2[4]; + buffer[5] = key2[3]; + buffer[6] = key2[2]; + buffer[7] = key2[1]; + buffer[8] = key2[0]; + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "SEND CHALLENGE (AGID: {1}, KEY2 {2}, Sense: {3}, Last Error: {4}) took {0} ms.", + duration, Agid, key2, sense, _dev.LastError); + + return sense; + } + + /// + /// Returns the encrypted disc key of the MMC logical unit + /// + /// true if the command failed and contains the sense buffer. + /// Buffer where the bus key will be stored + /// Sense buffer. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + public bool ReadDiscKey(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + { + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + buffer = new byte[2052]; + + cdb[0] = (byte)ScsiCommands.ReadDiscStructure; + cdb[1] = (byte)MmcDiscStructureMediaType.Dvd & 0x0F; + cdb[6] = 0; + cdb[7] = (byte)MmcDiscStructureFormat.DiscKey; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((Agid & 0x03) << 6); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + return (sense); + } + + /// + /// Returns the bus key of the MMC logical unit + /// + /// true if the command failed and contains the sense buffer. + /// Buffer where the bus key will be stored + /// Sense buffer. + /// The type of protection the logical unit reports + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + public bool ReadBusKey(out byte[] buffer, out byte[] senseBuffer, CopyrightType protectionType, uint timeout, + out double duration) + { + duration = 0; + buffer = new byte[0]; + senseBuffer = new byte[32]; + + bool sense = false; + byte[] challenge = new byte[_challengeSize]; + byte[] key1 = new byte[_keySize]; + byte variant = 0; + + for(byte i = 0; i < 4; i++) + { + // Invalidate AGID to reset any previous drive communications + Agid = i; + + sense = InvalidateAgid(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, + out duration); + + // Get AGID + if(protectionType == CopyrightType.CSS) + { + sense = ReportAgidCssCppm(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, + out duration); + } + + if(protectionType == CopyrightType.CPRM) + { + throw new NotImplementedException(); + } + + if(!sense) + { + Agid = (byte)(buffer[7] >> 6); + + break; + } + } + + if(sense) + { + return true; + } + + for(byte i = 0; i < _challengeSize; i++) + challenge[i] = i; + + sense = SendChallenge(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, challenge, timeout, + out duration); + + if(sense) + { + return true; + } + + sense = ReportKey1(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, out duration); + + if(sense) + { + return true; + } + + for(byte i = 0; i < _keySize; i++) + key1[i] = buffer[8 - i]; + + for(byte i = 0; i < 32; i++) + { + CSS.EncryptKey(DvdCssKeyType.Key1, i, challenge, out byte[] keyCheck); + + if(key1.SequenceEqual(keyCheck)) + { + variant = i; + + break; + } + + if(i >= 31) + { + senseBuffer = null; + + return true; + } + } + + sense = ReportChallenge(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, + out duration); + + if(sense) + { + return true; + } + + for(byte i = 0; i < _challengeSize; i++) + challenge[i] = buffer[13 - i]; + + CSS.EncryptKey(DvdCssKeyType.Key2, variant, challenge, out byte[] key2); + + sense = SendKey2(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, key2, timeout, out duration); + + if(sense) + { + return true; + } + + key1.CopyTo(challenge, 0); + key2.CopyTo(challenge, key1.Length); + CSS.EncryptKey(DvdCssKeyType.BusKey, variant, challenge, out buffer); + + BusKey = buffer; + + return false; + } + + /// + /// Reads a title key for a sector on the disc. + /// + /// Buffer where the bus key will be stored + /// Sense buffer. + /// Key class. + /// The sector address to get the key for. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool ReadTitleKey(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, ulong address, + uint timeout, out double duration) + { + // We need to be in a bus key state to read title keys. Only CSS has title keys. + ReadBusKey(out buffer, out senseBuffer, CopyrightType.CSS, timeout, out duration); + + BusKey = buffer; + + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + buffer = new byte[12]; + + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[2] = (byte)((address & 0xFF000000) >> 24); + cdb[3] = (byte)((address & 0xFF0000) >> 16); + cdb[4] = (byte)((address & 0xFF00) >> 8); + cdb[5] = (byte)(address & 0xFF); + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.TitleKey ^ ((Agid & 0x03) << 6)); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", "GET TITLE KEY (AGID: {1}, LBA: {2}, Sense: {3}) took {0} ms.", + duration, Agid, address, sense); + + return sense; + } + } +} diff --git a/Enums.cs b/Enums.cs new file mode 100644 index 000000000..947a5e238 --- /dev/null +++ b/Enums.cs @@ -0,0 +1,12 @@ +namespace Aaru.Decryption +{ + public enum DvdCssKeyClass : byte + { + DvdCssCppmOrCprm = 0, RewritableSecurityServicesA = 1 + } + + public enum DvdCssKeyType + { + Key1 = 0, Key2 = 1, BusKey = 2 + } +} \ No newline at end of file From f1fb7b38dfc1863aa6b42347d66d857620747c14 Mon Sep 17 00:00:00 2001 From: Rebecca Wallander Date: Sat, 16 Jan 2021 11:15:51 +0100 Subject: [PATCH 04/53] Add Aaru.Images to project --- Aaru.Decryption.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index 196accb3e..feb119532 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -8,6 +8,7 @@ + From b1e2fd49539d701f917d48468e22c57d082fc617 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 17 Jan 2021 22:53:58 +0000 Subject: [PATCH 05/53] Code restyle. --- DVD/CSS.cs | 32 ++++++++++---------------------- DVD/Dump.cs | 53 ++++++++++++++++------------------------------------- 2 files changed, 26 insertions(+), 59 deletions(-) diff --git a/DVD/CSS.cs b/DVD/CSS.cs index d631377e8..ce9cade5c 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -371,9 +371,8 @@ namespace Aaru.Decryption.DVD }; /// - /// The disc key returned by the logical unit is encoded with the bus key - /// to prevent man-in-the-middle attacks. This method returns a structure - /// with the decoded key included. + /// The disc key returned by the logical unit is encoded with the bus key to prevent man-in-the-middle attacks. + /// This method returns a structure with the decoded key included. /// /// The encoded key from the logical unit. /// The bus key from the logical unit. @@ -399,9 +398,8 @@ namespace Aaru.Decryption.DVD } /// - /// The title key returned by the logical unit is encoded with the bus key - /// to prevent man-in-the-middle attacks. This method returns a structure - /// with the decoded key included. + /// The title key returned by the logical unit is encoded with the bus key to prevent man-in-the-middle attacks. + /// This method returns a structure with the decoded key included. /// /// The encoded key from the logical unit. /// The bus key from the logical unit. @@ -429,9 +427,7 @@ namespace Aaru.Decryption.DVD }; } - /// - /// Takes a challenge and a variant and encrypts it according to the key type. - /// + /// Takes a challenge and a variant and encrypts it according to the key type. /// The type of key to encrypt. /// /// The challenge sent to the logical unit. @@ -547,9 +543,7 @@ namespace Aaru.Decryption.DVD } } - /// - /// Takes an encrypted key and its crypto and returns the key decrypted. - /// + /// Takes an encrypted key and its crypto and returns the key decrypted. /// /// The key used to encrypt the data. /// The encrypted data. @@ -600,9 +594,7 @@ namespace Aaru.Decryption.DVD DecryptTitleKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) => DecryptKey(invert, cryptoKey, encryptedKey, out decryptedKey); - /// - /// Takes an bytearray of encrypted keys, decrypts them and returns the correctly decrypted key. - /// + /// Takes an bytearray of encrypted keys, decrypts them and returns the correctly decrypted key. /// Encrypted keys to try to decrypt. /// The decrypted key if found. public static void DecryptDiscKey(byte[] encryptedKeys, out byte[]? decryptedKey) @@ -634,9 +626,7 @@ namespace Aaru.Decryption.DVD decryptedKey = null; } - /// - /// Takes a sector and a decrypted title key and returns the decrypted sector. - /// + /// Takes a sector and a decrypted title key and returns the decrypted sector. /// Encrypted sector data. /// The Copyright Management Information. /// The encryption keys. @@ -702,9 +692,7 @@ namespace Aaru.Decryption.DVD return decryptedBuffer; } - /// - /// Takes an RPC state from the drive and a CMI from a disc and checks if the regions are compatible. - /// + /// Takes an RPC state from the drive and a CMI from a disc and checks if the regions are compatible. /// The RegionalPlaybackControlState from drive. /// The LeadInCopyright from disc. /// true if the regions are compatible, else false @@ -725,4 +713,4 @@ namespace Aaru.Decryption.DVD ((rpc.RegionMask & 0x80) == (cmi.RegionInformation & 0x80) && (rpc.RegionMask & 0x80) != 0x80); } } -} +} \ No newline at end of file diff --git a/DVD/Dump.cs b/DVD/Dump.cs index 331bbcb09..08af6ab4e 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -47,8 +47,6 @@ namespace Aaru.Decryption.DVD const byte _keySize = 5; const byte _challengeSize = 2 * _keySize; readonly Device _dev; - public byte Agid { get; private set; } - public byte[] BusKey { get; private set; } public Dump(Device dev) { @@ -57,9 +55,10 @@ namespace Aaru.Decryption.DVD Agid = 0; } - /// - /// Returns the Authentication Success Flag of the logical unit. - /// + public byte Agid { get; private set; } + public byte[] BusKey { get; private set; } + + /// Returns the Authentication Success Flag of the logical unit. /// true if the command failed and contains the sense buffer. /// Buffer where the Authentication Success Flag will be stored. /// Sense buffer. @@ -89,9 +88,7 @@ namespace Aaru.Decryption.DVD return sense; } - /// - /// Returns the Regional Playback Control State of the logical unit. - /// + /// Returns the Regional Playback Control State of the logical unit. /// true if the command failed and contains the sense buffer. /// Buffer where the Regional Playback Control State will be stored. /// Sense buffer. @@ -121,9 +118,7 @@ namespace Aaru.Decryption.DVD return sense; } - /// - /// Invalidates an Authentication Grant ID. - /// + /// Invalidates an Authentication Grant ID. /// Buffer where the Regional Playback Control State will be stored. /// Sense buffer. /// Key class. @@ -153,9 +148,7 @@ namespace Aaru.Decryption.DVD return sense; } - /// - /// Returns a valid Authentication Grant ID for CSS/CPPM. - /// + /// Returns a valid Authentication Grant ID for CSS/CPPM. /// Buffer where the Regional Playback Control State will be stored. /// Sense buffer. /// Key class. @@ -185,9 +178,7 @@ namespace Aaru.Decryption.DVD return sense; } - /// - /// Returns KEY1 from the logical unit. - /// + /// Returns KEY1 from the logical unit. /// Buffer where the Regional Playback Control State will be stored. /// Sense buffer. /// Key class. @@ -217,9 +208,7 @@ namespace Aaru.Decryption.DVD return sense; } - /// - /// Returns the challenge from the logical unit. - /// + /// Returns the challenge from the logical unit. /// Buffer where the Regional Playback Control State will be stored. /// Sense buffer. /// Key class. @@ -249,9 +238,7 @@ namespace Aaru.Decryption.DVD return sense; } - /// - /// Send a challenge to the logical unit. - /// + /// Send a challenge to the logical unit. /// Buffer where the Regional Playback Control State will be stored. /// Sense buffer. /// Key class. @@ -294,9 +281,7 @@ namespace Aaru.Decryption.DVD return sense; } - /// - /// Send KEY2 to the logical unit. - /// + /// Send KEY2 to the logical unit. /// Buffer where the Regional Playback Control State will be stored. /// Sense buffer. /// Key class. @@ -334,9 +319,7 @@ namespace Aaru.Decryption.DVD return sense; } - /// - /// Returns the encrypted disc key of the MMC logical unit - /// + /// Returns the encrypted disc key of the MMC logical unit /// true if the command failed and contains the sense buffer. /// Buffer where the bus key will be stored /// Sense buffer. @@ -359,12 +342,10 @@ namespace Aaru.Decryption.DVD _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - return (sense); + return sense; } - /// - /// Returns the bus key of the MMC logical unit - /// + /// Returns the bus key of the MMC logical unit /// true if the command failed and contains the sense buffer. /// Buffer where the bus key will be stored /// Sense buffer. @@ -485,9 +466,7 @@ namespace Aaru.Decryption.DVD return false; } - /// - /// Reads a title key for a sector on the disc. - /// + /// Reads a title key for a sector on the disc. /// Buffer where the bus key will be stored /// Sense buffer. /// Key class. @@ -526,4 +505,4 @@ namespace Aaru.Decryption.DVD return sense; } } -} +} \ No newline at end of file From 019060781ba1d30f5266c856404a840d912fb5cf Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 25 Mar 2021 23:23:18 +0000 Subject: [PATCH 06/53] Enlarge sense buffer to 64 bytes. --- DVD/Dump.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/DVD/Dump.cs b/DVD/Dump.cs index 08af6ab4e..7169f8d24 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -68,7 +68,7 @@ namespace Aaru.Decryption.DVD public bool ReadAsf(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, out double duration) { - senseBuffer = new byte[32]; + senseBuffer = new byte[64]; byte[] cdb = new byte[12]; buffer = new byte[8]; @@ -98,7 +98,7 @@ namespace Aaru.Decryption.DVD public bool ReadRpc(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, out double duration) { - senseBuffer = new byte[32]; + senseBuffer = new byte[64]; byte[] cdb = new byte[12]; buffer = new byte[8]; @@ -128,7 +128,7 @@ namespace Aaru.Decryption.DVD public bool InvalidateAgid(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, out double duration) { - senseBuffer = new byte[32]; + senseBuffer = new byte[64]; byte[] cdb = new byte[12]; buffer = new byte[0]; @@ -158,7 +158,7 @@ namespace Aaru.Decryption.DVD public bool ReportAgidCssCppm(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, out double duration) { - senseBuffer = new byte[32]; + senseBuffer = new byte[64]; byte[] cdb = new byte[12]; buffer = new byte[8]; @@ -188,7 +188,7 @@ namespace Aaru.Decryption.DVD public bool ReportKey1(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, out double duration) { - senseBuffer = new byte[32]; + senseBuffer = new byte[64]; byte[] cdb = new byte[12]; buffer = new byte[12]; @@ -218,7 +218,7 @@ namespace Aaru.Decryption.DVD public bool ReportChallenge(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, out double duration) { - senseBuffer = new byte[32]; + senseBuffer = new byte[64]; byte[] cdb = new byte[12]; buffer = new byte[16]; @@ -249,7 +249,7 @@ namespace Aaru.Decryption.DVD public bool SendChallenge(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, byte[] challengeKey, uint timeout, out double duration) { - senseBuffer = new byte[32]; + senseBuffer = new byte[64]; byte[] cdb = new byte[12]; buffer = new byte[16]; @@ -292,7 +292,7 @@ namespace Aaru.Decryption.DVD public bool SendKey2(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, byte[] key2, uint timeout, out double duration) { - senseBuffer = new byte[32]; + senseBuffer = new byte[64]; byte[] cdb = new byte[12]; buffer = new byte[12]; @@ -327,7 +327,7 @@ namespace Aaru.Decryption.DVD /// Duration in milliseconds it took for the device to execute the command. public bool ReadDiscKey(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { - senseBuffer = new byte[32]; + senseBuffer = new byte[64]; byte[] cdb = new byte[12]; buffer = new byte[2052]; @@ -357,7 +357,7 @@ namespace Aaru.Decryption.DVD { duration = 0; buffer = new byte[0]; - senseBuffer = new byte[32]; + senseBuffer = new byte[64]; bool sense = false; byte[] challenge = new byte[_challengeSize]; @@ -482,7 +482,7 @@ namespace Aaru.Decryption.DVD BusKey = buffer; - senseBuffer = new byte[32]; + senseBuffer = new byte[64]; byte[] cdb = new byte[12]; buffer = new byte[12]; From a835c0272729dac5153f71b8778009222803140f Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 17 Aug 2021 16:27:42 +0100 Subject: [PATCH 07/53] Fix inconsistent naming. --- DVD/Dump.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/DVD/Dump.cs b/DVD/Dump.cs index 7169f8d24..9a5174436 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -44,8 +44,8 @@ namespace Aaru.Decryption.DVD { public sealed class Dump { - const byte _keySize = 5; - const byte _challengeSize = 2 * _keySize; + const byte KEY_SIZE = 5; + const byte CHALLENGE_SIZE = 2 * KEY_SIZE; readonly Device _dev; public Dump(Device dev) @@ -360,8 +360,8 @@ namespace Aaru.Decryption.DVD senseBuffer = new byte[64]; bool sense = false; - byte[] challenge = new byte[_challengeSize]; - byte[] key1 = new byte[_keySize]; + byte[] challenge = new byte[CHALLENGE_SIZE]; + byte[] key1 = new byte[KEY_SIZE]; byte variant = 0; for(byte i = 0; i < 4; i++) @@ -397,7 +397,7 @@ namespace Aaru.Decryption.DVD return true; } - for(byte i = 0; i < _challengeSize; i++) + for(byte i = 0; i < CHALLENGE_SIZE; i++) challenge[i] = i; sense = SendChallenge(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, challenge, timeout, @@ -415,7 +415,7 @@ namespace Aaru.Decryption.DVD return true; } - for(byte i = 0; i < _keySize; i++) + for(byte i = 0; i < KEY_SIZE; i++) key1[i] = buffer[8 - i]; for(byte i = 0; i < 32; i++) @@ -445,7 +445,7 @@ namespace Aaru.Decryption.DVD return true; } - for(byte i = 0; i < _challengeSize; i++) + for(byte i = 0; i < CHALLENGE_SIZE; i++) challenge[i] = buffer[13 - i]; CSS.EncryptKey(DvdCssKeyType.Key2, variant, challenge, out byte[] key2); From 73b212d3bb730fc67876e3f42bd22d1426289c1c Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 17 Aug 2021 17:35:43 +0100 Subject: [PATCH 08/53] Conditional access is known to be not null. --- DVD/CSS.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DVD/CSS.cs b/DVD/CSS.cs index ce9cade5c..cc6ff6a46 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -379,8 +379,8 @@ namespace Aaru.Decryption.DVD /// A DiscKey struct with the decoded key. public static CSS_CPRM.DiscKey? DecodeDiscKey(byte[] response, byte[] busKey) { - if(response?.Length != 2052 || - busKey?.Length != 5) + if(response.Length != 2052 || + busKey.Length != 5) return null; byte[] key = response.Skip(4).Take(2048).ToArray(); @@ -406,8 +406,8 @@ namespace Aaru.Decryption.DVD /// A TitleKey struct with the decoded key. public static CSS_CPRM.TitleKey? DecodeTitleKey(byte[] response, byte[] busKey) { - if(response?.Length != 12 || - busKey?.Length != 5) + if(response.Length != 12 || + busKey.Length != 5) return null; byte[] key = response.Skip(5).Take(5).ToArray(); From 36b638fd4e69b889fad154ca9ab8dd39eec5cdc5 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 17 Aug 2021 17:41:14 +0100 Subject: [PATCH 09/53] Fix bitwise calculation losing data. --- DVD/CSS.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DVD/CSS.cs b/DVD/CSS.cs index cc6ff6a46..318baec91 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -571,7 +571,7 @@ namespace Aaru.Decryption.DVD lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; oLfsr1 = _cssTable4[oLfsr1]; byte oLfsr0 = (byte)(((((((lfsr0 >> 8) ^ lfsr0) >> 1) ^ lfsr0) >> 3) ^ lfsr0) >> 7); - lfsr0 = (uint)((lfsr0 >> 8) | (oLfsr0 << 24)); + lfsr0 = (lfsr0 >> 8) | ((uint)oLfsr0 << 24); combined += (uint)((oLfsr0 ^ invert) + oLfsr1); k[i] = (byte)(combined & 0xff); combined >>= 8; From a84d4c28f6b19cb821913145216d436dfbd332ea Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 17 Aug 2021 17:42:44 +0100 Subject: [PATCH 10/53] Fix initialization of non nullable fields. --- DVD/Dump.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DVD/Dump.cs b/DVD/Dump.cs index 9a5174436..85bb6bbd3 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -51,7 +51,7 @@ namespace Aaru.Decryption.DVD public Dump(Device dev) { _dev = dev; - BusKey = null; + BusKey = new byte[0]; Agid = 0; } @@ -431,7 +431,7 @@ namespace Aaru.Decryption.DVD if(i >= 31) { - senseBuffer = null; + senseBuffer = new byte[0]; return true; } From a19cac2209ce7e06ccae6653274d76b8bec9ca6f Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 17 Aug 2021 18:21:11 +0100 Subject: [PATCH 11/53] Use Array.Empty. --- DVD/Dump.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DVD/Dump.cs b/DVD/Dump.cs index 85bb6bbd3..030a55f1a 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -51,7 +51,7 @@ namespace Aaru.Decryption.DVD public Dump(Device dev) { _dev = dev; - BusKey = new byte[0]; + BusKey = Array.Empty(); Agid = 0; } @@ -130,7 +130,7 @@ namespace Aaru.Decryption.DVD { senseBuffer = new byte[64]; byte[] cdb = new byte[12]; - buffer = new byte[0]; + buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.ReportKey; cdb[7] = (byte)keyClass; @@ -356,7 +356,7 @@ namespace Aaru.Decryption.DVD out double duration) { duration = 0; - buffer = new byte[0]; + buffer = Array.Empty(); senseBuffer = new byte[64]; bool sense = false; @@ -431,7 +431,7 @@ namespace Aaru.Decryption.DVD if(i >= 31) { - senseBuffer = new byte[0]; + senseBuffer = Array.Empty(); return true; } From d6559cb798d320ba27085fcf0c787591d838a2d0 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 17 Aug 2021 21:23:22 +0100 Subject: [PATCH 12/53] General code refactor. --- .editorconfig | 1064 ++++++++++++++++++++-------------------- Aaru.Decryption.csproj | 18 +- 2 files changed, 541 insertions(+), 541 deletions(-) diff --git a/.editorconfig b/.editorconfig index 8b506dabe..9181fe501 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,252 +1,252 @@ root = true [*] -charset=utf-8 -next_line=crlf -insert_final_newline=false -indent_style=space -indent_size=4 +charset = utf-8 +next_line = crlf +insert_final_newline = false +indent_style = space +indent_size = 4 # Generic non-language specific ones for Resharper and friends -brace_style=next_line -int_align=true -keep_existing_arrangement=false -place_simple_blocks_on_single_line=true -place_simple_declaration_blocks_on_single_line=true -place_attribute_on_same_line=false -space_after_unary_operator=false -space_after_comma=true -space_around_ternary_operator=true -space_around_binary_operator=true -space_around_member_access_operator=false -space_before_open_square_brackets=false -space_after_keywords_in_control_flow_statements=true -space_before_comma=false -space_between_method_call_name_and_opening_parenthesis=false -space_between_method_declaration_name_and_open_parenthesis=false -space_between_square_brackets=false -space_between_parentheses_of_control_flow_statements=false -accessor_owner_declaration_braces=next_line -accessor_declaration_braces=next_line -case_block_braces=next_line -initializer_braces=next_line -other_braces=next_line -allow_comment_after_lbrace=false -empty_block_style=together_same_line -braces_for_ifelse=not_required -braces_for_for=not_required -braces_for_foreach=not_required -braces_for_while=not_required -braces_for_dowhile=not_required -braces_for_using=not_required -braces_for_lock=not_required -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 +brace_style = next_line +int_align = true +keep_existing_arrangement = false +place_simple_blocks_on_single_line = true +place_simple_declaration_blocks_on_single_line = true +place_attribute_on_same_line = false +space_after_unary_operator = false +space_after_comma = true +space_around_ternary_operator = true +space_around_binary_operator = true +space_around_member_access_operator = false +space_before_open_square_brackets = false +space_after_keywords_in_control_flow_statements = true +space_before_comma = false +space_between_method_call_name_and_opening_parenthesis = false +space_between_method_declaration_name_and_open_parenthesis = false +space_between_square_brackets = false +space_between_parentheses_of_control_flow_statements = false +accessor_owner_declaration_braces = next_line +accessor_declaration_braces = next_line +case_block_braces = next_line +initializer_braces = next_line +other_braces = next_line +allow_comment_after_lbrace = false +empty_block_style = together_same_line +braces_for_ifelse = not_required +braces_for_for = not_required +braces_for_foreach = not_required +braces_for_while = not_required +braces_for_dowhile = not_required +braces_for_using = not_required +braces_for_lock = not_required +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 +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 +indent_size = 2 [*.js.map] -indent_size=2 +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 +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 +indent_size = 2 # Xml project files [*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] @@ -263,38 +263,38 @@ 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 +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_member_access=true:suggestion +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion # This controls implicit access modifiers -dotnet_style_require_accessibility_modifiers=never:suggestion +dotnet_style_require_accessibility_modifiers = never:suggestion # Prefer non modified fields to be marked readonly -dotnet_style_readonly_field=true:warning +dotnet_style_readonly_field = true:warning # Parenthesis settings -dotnet_style_parentheses_in_arithmetic_binary_operators=always_for_clarity:warning -dotnet_style_parentheses_in_relational_binary_operators=always_for_clarity:warning -dotnet_style_parentheses_in_other_binary_operators=always_for_clarity:warning -dotnet_style_parentheses_in_other_operators=always_for_clarity:warning +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_other_operators = always_for_clarity:warning -dotnet_style_object_initializer=true:suggestion -dotnet_style_collection_initializer=true:suggestion -dotnet_style_explicit_tuple_names=true:error -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_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:error +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 +dotnet_sort_system_directives_first = true # Constants in C style, all-caps dotnet_naming_rule.constant_fields_caps.symbols = constant_fields @@ -306,16 +306,16 @@ dotnet_naming_style.caps_style.capitalization = all_upper # interfaces should be prefixed with I dotnet_naming_rule.pascal_case_for_interface.severity = error -dotnet_naming_rule.pascal_case_for_interface.symbols = interfaces_fields -dotnet_naming_rule.pascal_case_for_interface.style = pascal_case_interface_style +dotnet_naming_rule.pascal_case_for_interface.symbols = interfaces_fields +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 dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning -dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields -dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style 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 = _ @@ -331,302 +331,302 @@ dotnet_naming_style.camel_case_underscore_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_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_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_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_style_inlined_variable_declaration = true:warning -csharp_prefer_simple_default_expression=true:warning -csharp_style_deconstructed_variable_declaration=false: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_style_throw_expression = true:warning +csharp_style_conditional_delegate_call = true:warning -csharp_prefer_braces=false +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_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_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_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_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_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_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_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_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 +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 +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 +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 +indent_preprocessor_directives = normal +indent_type_constraints = true # Javascript and Typescript [*.{js,js.map,ts}] -quote_style=doublequoted -termination_style=ensure_semicolon \ No newline at end of file +quote_style = doublequoted +termination_style = ensure_semicolon \ No newline at end of file diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index feb119532..c46738d24 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -1,14 +1,14 @@ - - netcoreapp3.1 - enable - + + netcoreapp3.1 + enable + - - - - - + + + + + From 6b04c4eb0649f1bf4320ef45935ef55c52339d1d Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 12 Sep 2021 21:34:22 +0100 Subject: [PATCH 13/53] Bump version to 6.0.0-alpha6. --- Aaru.Decryption.csproj | 54 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index c46738d24..c8659890a 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -1,14 +1,62 @@ + Debug + AnyCPU + 2.0 + Library + Aaru.Decryption + Aaru.Decryption + $(Version) + true + 6.0.0-alpha6 + Claunia.com + Copyright © 2011-2021 Natalia Portillo + Aaru Data Preservation Suite + Aaru.Decryption + $(Version) netcoreapp3.1 + 8 + Decryption algorithms used by the Aaru Data Preservation Suite. + https://github.com/aaru-dps/ + MIT + https://github.com/aaru-dps/Aaru.Decryption + true + en-US + true + true + snupkg + Rebecca Wallander <sakcheen@gmail.com> enable + + $(Version)+{chash:8} + true + true + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + - - - + + + From 98912c8425c8877f245bfa269e6bc1dbda0c150c Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 12 Sep 2021 22:25:59 +0100 Subject: [PATCH 14/53] Upgrade to .NET 6. --- Aaru.Decryption.csproj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index c8659890a..dbce8ebec 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -15,8 +15,8 @@ Aaru Data Preservation Suite Aaru.Decryption $(Version) - netcoreapp3.1 - 8 + net6 + 10 Decryption algorithms used by the Aaru Data Preservation Suite. https://github.com/aaru-dps/ MIT @@ -28,6 +28,7 @@ snupkg Rebecca Wallander <sakcheen@gmail.com> enable + true $(Version)+{chash:8} From 159ab37995460e031b4ab3c0c1a80e5db4e0af97 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 8 Dec 2021 20:39:48 +0000 Subject: [PATCH 15/53] Bump version to 6.0.0-alpha7. --- Aaru.Decryption.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index dbce8ebec..babfe0c16 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -9,7 +9,7 @@ Aaru.Decryption $(Version) true - 6.0.0-alpha6 + 6.0.0-alpha7 Claunia.com Copyright © 2011-2021 Natalia Portillo Aaru Data Preservation Suite From 6c8fee44538b8c2e8d8412e33c531374059d8726 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 8 Dec 2021 21:48:35 +0000 Subject: [PATCH 16/53] Bump version to 6.0.0-alpha8. --- Aaru.Decryption.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index babfe0c16..d3c055caf 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -9,7 +9,7 @@ Aaru.Decryption $(Version) true - 6.0.0-alpha7 + 6.0.0-alpha8 Claunia.com Copyright © 2011-2021 Natalia Portillo Aaru Data Preservation Suite From 3d303623c22b3b27e5c9d134958ad7a2dfff7663 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Fri, 18 Feb 2022 10:02:34 +0000 Subject: [PATCH 17/53] Update copyright year. --- Aaru.Decryption.csproj | 2 +- DVD/CSS.cs | 2 +- DVD/Dump.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index d3c055caf..8112c1faf 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -11,7 +11,7 @@ true 6.0.0-alpha8 Claunia.com - Copyright © 2011-2021 Natalia Portillo + Copyright © 2011-2022 Natalia Portillo Aaru Data Preservation Suite Aaru.Decryption $(Version) diff --git a/DVD/CSS.cs b/DVD/CSS.cs index 318baec91..75009c211 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -31,7 +31,7 @@ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // ---------------------------------------------------------------------------- -// Copyright © 2020-2021 Rebecca Wallander +// Copyright © 2020-2022 Rebecca Wallander // ****************************************************************************/ using System; diff --git a/DVD/Dump.cs b/DVD/Dump.cs index 030a55f1a..cb9b615c8 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -31,7 +31,7 @@ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // ---------------------------------------------------------------------------- -// Copyright © 2020-2021 Rebecca Wallander +// Copyright © 2020-2022 Rebecca Wallander // ****************************************************************************/ using System; From 2b6d8ae4738151d0042cec5f2137fbb93c065ce3 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 6 Mar 2022 13:29:36 +0000 Subject: [PATCH 18/53] Move to file scoped namespaces. --- DVD/CSS.cs | 1243 +++++++++++++++++++++++++-------------------------- DVD/Dump.cs | 857 ++++++++++++++++++----------------- Enums.cs | 19 +- 3 files changed, 1058 insertions(+), 1061 deletions(-) diff --git a/DVD/CSS.cs b/DVD/CSS.cs index 75009c211..4382d672b 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -47,670 +47,669 @@ using Aaru.Decoders.DVD; // libdvdcpxm (https://offog.org/git/dvdaexplorer/src/libdvdcpxm/) // libdvdcss (https://www.videolan.org/developers/libdvdcss.html) -namespace Aaru.Decryption.DVD +namespace Aaru.Decryption.DVD; + +public class CSS { - public class CSS + static readonly byte[,] _playerKeys = { - static readonly byte[,] _playerKeys = { + 0x01, 0xaf, 0xe3, 0x12, 0x80 + }, + { + 0x12, 0x11, 0xca, 0x04, 0x3b + }, + { + 0x14, 0x0c, 0x9e, 0xd0, 0x09 + }, + { + 0x14, 0x71, 0x35, 0xba, 0xe2 + }, + { + 0x1a, 0xa4, 0x33, 0x21, 0xa6 + }, + { + 0x26, 0xec, 0xc4, 0xa7, 0x4e + }, + { + 0x2c, 0xb2, 0xc1, 0x09, 0xee + }, + { + 0x2f, 0x25, 0x9e, 0x96, 0xdd + }, + { + 0x33, 0x2f, 0x49, 0x6c, 0xe0 + }, + { + 0x35, 0x5b, 0xc1, 0x31, 0x0f + }, + { + 0x36, 0x67, 0xb2, 0xe3, 0x85 + }, + { + 0x39, 0x3d, 0xf1, 0xf1, 0xbd + }, + { + 0x3b, 0x31, 0x34, 0x0d, 0x91 + }, + { + 0x45, 0xed, 0x28, 0xeb, 0xd3 + }, + { + 0x48, 0xb7, 0x6c, 0xce, 0x69 + }, + { + 0x4b, 0x65, 0x0d, 0xc1, 0xee + }, + { + 0x4c, 0xbb, 0xf5, 0x5b, 0x23 + }, + { + 0x51, 0x67, 0x67, 0xc5, 0xe0 + }, + { + 0x53, 0x94, 0xe1, 0x75, 0xbf + }, + { + 0x57, 0x2c, 0x8b, 0x31, 0xae + }, + { + 0x63, 0xdb, 0x4c, 0x5b, 0x4a + }, + { + 0x7b, 0x1e, 0x5e, 0x2b, 0x57 + }, + { + 0x85, 0xf3, 0x85, 0xa0, 0xe0 + }, + { + 0xab, 0x1e, 0xe7, 0x7b, 0x72 + }, + { + 0xab, 0x36, 0xe3, 0xeb, 0x76 + }, + { + 0xb1, 0xb8, 0xf9, 0x38, 0x03 + }, + { + 0xb8, 0x5d, 0xd8, 0x53, 0xbd + }, + { + 0xbf, 0x92, 0xc3, 0xb0, 0xe2 + }, + { + 0xcf, 0x1a, 0xb2, 0xf8, 0x0a + }, + { + 0xec, 0xa0, 0xcf, 0xb3, 0xff + }, + { + 0xfc, 0x95, 0xa9, 0x87, 0x35 + } + }; + + static readonly byte[] _cssTable1 = + { + 0x33, 0x73, 0x3b, 0x26, 0x63, 0x23, 0x6b, 0x76, 0x3e, 0x7e, 0x36, 0x2b, 0x6e, 0x2e, 0x66, 0x7b, 0xd3, 0x93, + 0xdb, 0x06, 0x43, 0x03, 0x4b, 0x96, 0xde, 0x9e, 0xd6, 0x0b, 0x4e, 0x0e, 0x46, 0x9b, 0x57, 0x17, 0x5f, 0x82, + 0xc7, 0x87, 0xcf, 0x12, 0x5a, 0x1a, 0x52, 0x8f, 0xca, 0x8a, 0xc2, 0x1f, 0xd9, 0x99, 0xd1, 0x00, 0x49, 0x09, + 0x41, 0x90, 0xd8, 0x98, 0xd0, 0x01, 0x48, 0x08, 0x40, 0x91, 0x3d, 0x7d, 0x35, 0x24, 0x6d, 0x2d, 0x65, 0x74, + 0x3c, 0x7c, 0x34, 0x25, 0x6c, 0x2c, 0x64, 0x75, 0xdd, 0x9d, 0xd5, 0x04, 0x4d, 0x0d, 0x45, 0x94, 0xdc, 0x9c, + 0xd4, 0x05, 0x4c, 0x0c, 0x44, 0x95, 0x59, 0x19, 0x51, 0x80, 0xc9, 0x89, 0xc1, 0x10, 0x58, 0x18, 0x50, 0x81, + 0xc8, 0x88, 0xc0, 0x11, 0xd7, 0x97, 0xdf, 0x02, 0x47, 0x07, 0x4f, 0x92, 0xda, 0x9a, 0xd2, 0x0f, 0x4a, 0x0a, + 0x42, 0x9f, 0x53, 0x13, 0x5b, 0x86, 0xc3, 0x83, 0xcb, 0x16, 0x5e, 0x1e, 0x56, 0x8b, 0xce, 0x8e, 0xc6, 0x1b, + 0xb3, 0xf3, 0xbb, 0xa6, 0xe3, 0xa3, 0xeb, 0xf6, 0xbe, 0xfe, 0xb6, 0xab, 0xee, 0xae, 0xe6, 0xfb, 0x37, 0x77, + 0x3f, 0x22, 0x67, 0x27, 0x6f, 0x72, 0x3a, 0x7a, 0x32, 0x2f, 0x6a, 0x2a, 0x62, 0x7f, 0xb9, 0xf9, 0xb1, 0xa0, + 0xe9, 0xa9, 0xe1, 0xf0, 0xb8, 0xf8, 0xb0, 0xa1, 0xe8, 0xa8, 0xe0, 0xf1, 0x5d, 0x1d, 0x55, 0x84, 0xcd, 0x8d, + 0xc5, 0x14, 0x5c, 0x1c, 0x54, 0x85, 0xcc, 0x8c, 0xc4, 0x15, 0xbd, 0xfd, 0xb5, 0xa4, 0xed, 0xad, 0xe5, 0xf4, + 0xbc, 0xfc, 0xb4, 0xa5, 0xec, 0xac, 0xe4, 0xf5, 0x39, 0x79, 0x31, 0x20, 0x69, 0x29, 0x61, 0x70, 0x38, 0x78, + 0x30, 0x21, 0x68, 0x28, 0x60, 0x71, 0xb7, 0xf7, 0xbf, 0xa2, 0xe7, 0xa7, 0xef, 0xf2, 0xba, 0xfa, 0xb2, 0xaf, + 0xea, 0xaa, 0xe2, 0xff + }; + + static readonly byte[] _cssTable2 = + { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x08, 0x0b, 0x0a, 0x0d, 0x0c, 0x0f, 0x0e, 0x12, 0x13, + 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, 0x1b, 0x1a, 0x19, 0x18, 0x1f, 0x1e, 0x1d, 0x1c, 0x24, 0x25, 0x26, 0x27, + 0x20, 0x21, 0x22, 0x23, 0x2d, 0x2c, 0x2f, 0x2e, 0x29, 0x28, 0x2b, 0x2a, 0x36, 0x37, 0x34, 0x35, 0x32, 0x33, + 0x30, 0x31, 0x3f, 0x3e, 0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x49, 0x48, 0x4b, 0x4a, 0x4d, 0x4c, 0x4f, 0x4e, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x5b, 0x5a, 0x59, 0x58, 0x5f, 0x5e, 0x5d, 0x5c, 0x52, 0x53, + 0x50, 0x51, 0x56, 0x57, 0x54, 0x55, 0x6d, 0x6c, 0x6f, 0x6e, 0x69, 0x68, 0x6b, 0x6a, 0x64, 0x65, 0x66, 0x67, + 0x60, 0x61, 0x62, 0x63, 0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78, 0x76, 0x77, 0x74, 0x75, 0x72, 0x73, + 0x70, 0x71, 0x92, 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, 0x9b, 0x9a, 0x99, 0x98, 0x9f, 0x9e, 0x9d, 0x9c, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x89, 0x88, 0x8b, 0x8a, 0x8d, 0x8c, 0x8f, 0x8e, 0xb6, 0xb7, + 0xb4, 0xb5, 0xb2, 0xb3, 0xb0, 0xb1, 0xbf, 0xbe, 0xbd, 0xbc, 0xbb, 0xba, 0xb9, 0xb8, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa0, 0xa1, 0xa2, 0xa3, 0xad, 0xac, 0xaf, 0xae, 0xa9, 0xa8, 0xab, 0xaa, 0xdb, 0xda, 0xd9, 0xd8, 0xdf, 0xde, + 0xdd, 0xdc, 0xd2, 0xd3, 0xd0, 0xd1, 0xd6, 0xd7, 0xd4, 0xd5, 0xc9, 0xc8, 0xcb, 0xca, 0xcd, 0xcc, 0xcf, 0xce, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf6, 0xf7, + 0xf4, 0xf5, 0xf2, 0xf3, 0xf0, 0xf1, 0xed, 0xec, 0xef, 0xee, 0xe9, 0xe8, 0xeb, 0xea, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe0, 0xe1, 0xe2, 0xe3 + }; + + static readonly byte[] _cssTable3 = + { + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, + 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, + 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, + 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, + 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff + }; + + static readonly byte[] _cssTable4 = + { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, + 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, + 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, + 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, + 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, + 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, + 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, + 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, + 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, + 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, + 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, + 0x3f, 0xbf, 0x7f, 0xff + }; + + static readonly byte[] _cssTable5 = + { + 0xff, 0x7f, 0xbf, 0x3f, 0xdf, 0x5f, 0x9f, 0x1f, 0xef, 0x6f, 0xaf, 0x2f, 0xcf, 0x4f, 0x8f, 0x0f, 0xf7, 0x77, + 0xb7, 0x37, 0xd7, 0x57, 0x97, 0x17, 0xe7, 0x67, 0xa7, 0x27, 0xc7, 0x47, 0x87, 0x07, 0xfb, 0x7b, 0xbb, 0x3b, + 0xdb, 0x5b, 0x9b, 0x1b, 0xeb, 0x6b, 0xab, 0x2b, 0xcb, 0x4b, 0x8b, 0x0b, 0xf3, 0x73, 0xb3, 0x33, 0xd3, 0x53, + 0x93, 0x13, 0xe3, 0x63, 0xa3, 0x23, 0xc3, 0x43, 0x83, 0x03, 0xfd, 0x7d, 0xbd, 0x3d, 0xdd, 0x5d, 0x9d, 0x1d, + 0xed, 0x6d, 0xad, 0x2d, 0xcd, 0x4d, 0x8d, 0x0d, 0xf5, 0x75, 0xb5, 0x35, 0xd5, 0x55, 0x95, 0x15, 0xe5, 0x65, + 0xa5, 0x25, 0xc5, 0x45, 0x85, 0x05, 0xf9, 0x79, 0xb9, 0x39, 0xd9, 0x59, 0x99, 0x19, 0xe9, 0x69, 0xa9, 0x29, + 0xc9, 0x49, 0x89, 0x09, 0xf1, 0x71, 0xb1, 0x31, 0xd1, 0x51, 0x91, 0x11, 0xe1, 0x61, 0xa1, 0x21, 0xc1, 0x41, + 0x81, 0x01, 0xfe, 0x7e, 0xbe, 0x3e, 0xde, 0x5e, 0x9e, 0x1e, 0xee, 0x6e, 0xae, 0x2e, 0xce, 0x4e, 0x8e, 0x0e, + 0xf6, 0x76, 0xb6, 0x36, 0xd6, 0x56, 0x96, 0x16, 0xe6, 0x66, 0xa6, 0x26, 0xc6, 0x46, 0x86, 0x06, 0xfa, 0x7a, + 0xba, 0x3a, 0xda, 0x5a, 0x9a, 0x1a, 0xea, 0x6a, 0xaa, 0x2a, 0xca, 0x4a, 0x8a, 0x0a, 0xf2, 0x72, 0xb2, 0x32, + 0xd2, 0x52, 0x92, 0x12, 0xe2, 0x62, 0xa2, 0x22, 0xc2, 0x42, 0x82, 0x02, 0xfc, 0x7c, 0xbc, 0x3c, 0xdc, 0x5c, + 0x9c, 0x1c, 0xec, 0x6c, 0xac, 0x2c, 0xcc, 0x4c, 0x8c, 0x0c, 0xf4, 0x74, 0xb4, 0x34, 0xd4, 0x54, 0x94, 0x14, + 0xe4, 0x64, 0xa4, 0x24, 0xc4, 0x44, 0x84, 0x04, 0xf8, 0x78, 0xb8, 0x38, 0xd8, 0x58, 0x98, 0x18, 0xe8, 0x68, + 0xa8, 0x28, 0xc8, 0x48, 0x88, 0x08, 0xf0, 0x70, 0xb0, 0x30, 0xd0, 0x50, 0x90, 0x10, 0xe0, 0x60, 0xa0, 0x20, + 0xc0, 0x40, 0x80, 0x00 + }; + + static readonly byte[] _encryptTable0 = + { + 0xB7, 0xF4, 0x82, 0x57, 0xDA, 0x4D, 0xDB, 0xE2, 0x2F, 0x52, 0x1A, 0xA8, 0x68, 0x5A, 0x8A, 0xFF, 0xFB, 0x0E, + 0x6D, 0x35, 0xF7, 0x5C, 0x76, 0x12, 0xCE, 0x25, 0x79, 0x29, 0x39, 0x62, 0x08, 0x24, 0xA5, 0x85, 0x7B, 0x56, + 0x01, 0x23, 0x68, 0xCF, 0x0A, 0xE2, 0x5A, 0xED, 0x3D, 0x59, 0xB0, 0xA9, 0xB0, 0x2C, 0xF2, 0xB8, 0xEF, 0x32, + 0xA9, 0x40, 0x80, 0x71, 0xAF, 0x1E, 0xDE, 0x8F, 0x58, 0x88, 0xB8, 0x3A, 0xD0, 0xFC, 0xC4, 0x1E, 0xB5, 0xA0, + 0xBB, 0x3B, 0x0F, 0x01, 0x7E, 0x1F, 0x9F, 0xD9, 0xAA, 0xB8, 0x3D, 0x9D, 0x74, 0x1E, 0x25, 0xDB, 0x37, 0x56, + 0x8F, 0x16, 0xBA, 0x49, 0x2B, 0xAC, 0xD0, 0xBD, 0x95, 0x20, 0xBE, 0x7A, 0x28, 0xD0, 0x51, 0x64, 0x63, 0x1C, + 0x7F, 0x66, 0x10, 0xBB, 0xC4, 0x56, 0x1A, 0x04, 0x6E, 0x0A, 0xEC, 0x9C, 0xD6, 0xE8, 0x9A, 0x7A, 0xCF, 0x8C, + 0xDB, 0xB1, 0xEF, 0x71, 0xDE, 0x31, 0xFF, 0x54, 0x3E, 0x5E, 0x07, 0x69, 0x96, 0xB0, 0xCF, 0xDD, 0x9E, 0x47, + 0xC7, 0x96, 0x8F, 0xE4, 0x2B, 0x59, 0xC6, 0xEE, 0xB9, 0x86, 0x9A, 0x64, 0x84, 0x72, 0xE2, 0x5B, 0xA2, 0x96, + 0x58, 0x99, 0x50, 0x03, 0xF5, 0x38, 0x4D, 0x02, 0x7D, 0xE7, 0x7D, 0x75, 0xA7, 0xB8, 0x67, 0x87, 0x84, 0x3F, + 0x1D, 0x11, 0xE5, 0xFC, 0x1E, 0xD3, 0x83, 0x16, 0xA5, 0x29, 0xF6, 0xC7, 0x15, 0x61, 0x29, 0x1A, 0x43, 0x4F, + 0x9B, 0xAF, 0xC5, 0x87, 0x34, 0x6C, 0x0F, 0x3B, 0xA8, 0x1D, 0x45, 0x58, 0x25, 0xDC, 0xA8, 0xA3, 0x3B, 0xD1, + 0x79, 0x1B, 0x48, 0xF2, 0xE9, 0x93, 0x1F, 0xFC, 0xDB, 0x2A, 0x90, 0xA9, 0x8A, 0x3D, 0x39, 0x18, 0xA3, 0x8E, + 0x58, 0x6C, 0xE0, 0x12, 0xBB, 0x25, 0xCD, 0x71, 0x22, 0xA2, 0x64, 0xC6, 0xE7, 0xFB, 0xAD, 0x94, 0x77, 0x04, + 0x9A, 0x39, 0xCF, 0x7C + }; + + static readonly byte[] _encryptTable1 = + { + 0x8C, 0x47, 0xB0, 0xE1, 0xEB, 0xFC, 0xEB, 0x56, 0x10, 0xE5, 0x2C, 0x1A, 0x5D, 0xEF, 0xBE, 0x4F, 0x08, 0x75, + 0x97, 0x4B, 0x0E, 0x25, 0x8E, 0x6E, 0x39, 0x5A, 0x87, 0x53, 0xC4, 0x1F, 0xF4, 0x5C, 0x4E, 0xE6, 0x99, 0x30, + 0xE0, 0x42, 0x88, 0xAB, 0xE5, 0x85, 0xBC, 0x8F, 0xD8, 0x3C, 0x54, 0xC9, 0x53, 0x47, 0x18, 0xD6, 0x06, 0x5B, + 0x41, 0x2C, 0x67, 0x1E, 0x41, 0x74, 0x33, 0xE2, 0xB4, 0xE0, 0x23, 0x29, 0x42, 0xEA, 0x55, 0x0F, 0x25, 0xB4, + 0x24, 0x2C, 0x99, 0x13, 0xEB, 0x0A, 0x0B, 0xC9, 0xF9, 0x63, 0x67, 0x43, 0x2D, 0xC7, 0x7D, 0x07, 0x60, 0x89, + 0xD1, 0xCC, 0xE7, 0x94, 0x77, 0x74, 0x9B, 0x7E, 0xD7, 0xE6, 0xFF, 0xBB, 0x68, 0x14, 0x1E, 0xA3, 0x25, 0xDE, + 0x3A, 0xA3, 0x54, 0x7B, 0x87, 0x9D, 0x50, 0xCA, 0x27, 0xC3, 0xA4, 0x50, 0x91, 0x27, 0xD4, 0xB0, 0x82, 0x41, + 0x97, 0x79, 0x94, 0x82, 0xAC, 0xC7, 0x8E, 0xA5, 0x4E, 0xAA, 0x78, 0x9E, 0xE0, 0x42, 0xBA, 0x28, 0xEA, 0xB7, + 0x74, 0xAD, 0x35, 0xDA, 0x92, 0x60, 0x7E, 0xD2, 0x0E, 0xB9, 0x24, 0x5E, 0x39, 0x4F, 0x5E, 0x63, 0x09, 0xB5, + 0xFA, 0xBF, 0xF1, 0x22, 0x55, 0x1C, 0xE2, 0x25, 0xDB, 0xC5, 0xD8, 0x50, 0x03, 0x98, 0xC4, 0xAC, 0x2E, 0x11, + 0xB4, 0x38, 0x4D, 0xD0, 0xB9, 0xFC, 0x2D, 0x3C, 0x08, 0x04, 0x5A, 0xEF, 0xCE, 0x32, 0xFB, 0x4C, 0x92, 0x1E, + 0x4B, 0xFB, 0x1A, 0xD0, 0xE2, 0x3E, 0xDA, 0x6E, 0x7C, 0x4D, 0x56, 0xC3, 0x3F, 0x42, 0xB1, 0x3A, 0x23, 0x4D, + 0x6E, 0x84, 0x56, 0x68, 0xF4, 0x0E, 0x03, 0x64, 0xD0, 0xA9, 0x92, 0x2F, 0x8B, 0xBC, 0x39, 0x9C, 0xAC, 0x09, + 0x5E, 0xEE, 0xE5, 0x97, 0xBF, 0xA5, 0xCE, 0xFA, 0x28, 0x2C, 0x6D, 0x4F, 0xEF, 0x77, 0xAA, 0x1B, 0x79, 0x8E, + 0x97, 0xB4, 0xC3, 0xF4 + }; + + static readonly byte[] _encryptTable2 = + { + 0xB7, 0x75, 0x81, 0xD5, 0xDC, 0xCA, 0xDE, 0x66, 0x23, 0xDF, 0x15, 0x26, 0x62, 0xD1, 0x83, 0x77, 0xE3, 0x97, + 0x76, 0xAF, 0xE9, 0xC3, 0x6B, 0x8E, 0xDA, 0xB0, 0x6E, 0xBF, 0x2B, 0xF1, 0x19, 0xB4, 0x95, 0x34, 0x48, 0xE4, + 0x37, 0x94, 0x5D, 0x7B, 0x36, 0x5F, 0x65, 0x53, 0x07, 0xE2, 0x89, 0x11, 0x98, 0x85, 0xD9, 0x12, 0xC1, 0x9D, + 0x84, 0xEC, 0xA4, 0xD4, 0x88, 0xB8, 0xFC, 0x2C, 0x79, 0x28, 0xD8, 0xDB, 0xB3, 0x1E, 0xA2, 0xF9, 0xD0, 0x44, + 0xD7, 0xD6, 0x60, 0xEF, 0x14, 0xF4, 0xF6, 0x31, 0xD2, 0x41, 0x46, 0x67, 0x0A, 0xE1, 0x58, 0x27, 0x43, 0xA3, + 0xF8, 0xE0, 0xC8, 0xBA, 0x5A, 0x5C, 0x80, 0x6C, 0xC6, 0xF2, 0xE8, 0xAD, 0x7D, 0x04, 0x0D, 0xB9, 0x3C, 0xC2, + 0x25, 0xBD, 0x49, 0x63, 0x8C, 0x9F, 0x51, 0xCE, 0x20, 0xC5, 0xA1, 0x50, 0x92, 0x2D, 0xDD, 0xBC, 0x8D, 0x4F, + 0x9A, 0x71, 0x2F, 0x30, 0x1D, 0x73, 0x39, 0x13, 0xFB, 0x1A, 0xCB, 0x24, 0x59, 0xFE, 0x05, 0x96, 0x57, 0x0F, + 0x1F, 0xCF, 0x54, 0xBE, 0xF5, 0x06, 0x1B, 0xB2, 0x6D, 0xD3, 0x4D, 0x32, 0x56, 0x21, 0x33, 0x0B, 0x52, 0xE7, + 0xAB, 0xEB, 0xA6, 0x74, 0x00, 0x4C, 0xB1, 0x7F, 0x82, 0x99, 0x87, 0x0E, 0x5E, 0xC0, 0x8F, 0xEE, 0x6F, 0x55, + 0xF3, 0x7E, 0x08, 0x90, 0xFA, 0xB6, 0x64, 0x70, 0x47, 0x4A, 0x17, 0xA7, 0xB5, 0x40, 0x8A, 0x38, 0xE5, 0x68, + 0x3E, 0x8B, 0x69, 0xAA, 0x9B, 0x42, 0xA5, 0x10, 0x01, 0x35, 0xFD, 0x61, 0x9E, 0xE6, 0x16, 0x9C, 0x86, 0xED, + 0xCD, 0x2E, 0xFF, 0xC4, 0x5B, 0xA0, 0xAE, 0xCC, 0x4B, 0x3B, 0x03, 0xBB, 0x1C, 0x2A, 0xAC, 0x0C, 0x3F, 0x93, + 0xC7, 0x72, 0x7A, 0x09, 0x22, 0x3D, 0x45, 0x78, 0xA9, 0xA8, 0xEA, 0xC9, 0x6A, 0xF7, 0x29, 0x91, 0xF0, 0x02, + 0x18, 0x3A, 0x4E, 0x7C + }; + + static readonly byte[] _encryptTable3 = + { + 0x73, 0x51, 0x95, 0xE1, 0x12, 0xE4, 0xC0, 0x58, 0xEE, 0xF2, 0x08, 0x1B, 0xA9, 0xFA, 0x98, 0x4C, 0xA7, 0x33, + 0xE2, 0x1B, 0xA7, 0x6D, 0xF5, 0x30, 0x97, 0x1D, 0xF3, 0x02, 0x60, 0x5A, 0x82, 0x0F, 0x91, 0xD0, 0x9C, 0x10, + 0x39, 0x7A, 0x83, 0x85, 0x3B, 0xB2, 0xB8, 0xAE, 0x0C, 0x09, 0x52, 0xEA, 0x1C, 0xE1, 0x8D, 0x66, 0x4F, 0xF3, + 0xDA, 0x92, 0x29, 0xB9, 0xD5, 0xC5, 0x77, 0x47, 0x22, 0x53, 0x14, 0xF7, 0xAF, 0x22, 0x64, 0xDF, 0xC6, 0x72, + 0x12, 0xF3, 0x75, 0xDA, 0xD7, 0xD7, 0xE5, 0x02, 0x9E, 0xED, 0xDA, 0xDB, 0x4C, 0x47, 0xCE, 0x91, 0x06, 0x06, + 0x6D, 0x55, 0x8B, 0x19, 0xC9, 0xEF, 0x8C, 0x80, 0x1A, 0x0E, 0xEE, 0x4B, 0xAB, 0xF2, 0x08, 0x5C, 0xE9, 0x37, + 0x26, 0x5E, 0x9A, 0x90, 0x00, 0xF3, 0x0D, 0xB2, 0xA6, 0xA3, 0xF7, 0x26, 0x17, 0x48, 0x88, 0xC9, 0x0E, 0x2C, + 0xC9, 0x02, 0xE7, 0x18, 0x05, 0x4B, 0xF3, 0x39, 0xE1, 0x20, 0x02, 0x0D, 0x40, 0xC7, 0xCA, 0xB9, 0x48, 0x30, + 0x57, 0x67, 0xCC, 0x06, 0xBF, 0xAC, 0x81, 0x08, 0x24, 0x7A, 0xD4, 0x8B, 0x19, 0x8E, 0xAC, 0xB4, 0x5A, 0x0F, + 0x73, 0x13, 0xAC, 0x9E, 0xDA, 0xB6, 0xB8, 0x96, 0x5B, 0x60, 0x88, 0xE1, 0x81, 0x3F, 0x07, 0x86, 0x37, 0x2D, + 0x79, 0x14, 0x52, 0xEA, 0x73, 0xDF, 0x3D, 0x09, 0xC8, 0x25, 0x48, 0xD8, 0x75, 0x60, 0x9A, 0x08, 0x27, 0x4A, + 0x2C, 0xB9, 0xA8, 0x8B, 0x8A, 0x73, 0x62, 0x37, 0x16, 0x02, 0xBD, 0xC1, 0x0E, 0x56, 0x54, 0x3E, 0x14, 0x5F, + 0x8C, 0x8F, 0x6E, 0x75, 0x1C, 0x07, 0x39, 0x7B, 0x4B, 0xDB, 0xD3, 0x4B, 0x1E, 0xC8, 0x7E, 0xFE, 0x3E, 0x72, + 0x16, 0x83, 0x7D, 0xEE, 0xF5, 0xCA, 0xC5, 0x18, 0xF9, 0xD8, 0x68, 0xAB, 0x38, 0x85, 0xA8, 0xF0, 0xA1, 0x73, + 0x9F, 0x5D, 0x19, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x72, 0x39, 0x25, 0x67, 0x26, + 0x6D, 0x71, 0x36, 0x77, 0x3C, 0x20, 0x62, 0x23, 0x68, 0x74, 0xC3, 0x82, 0xC9, 0x15, 0x57, 0x16, 0x5D, 0x81 + }; + + static readonly byte[,] _permutationChallenge = + { + { + 1, 3, 0, 7, 5, 2, 9, 6, 4, 8 + }, + { + 6, 1, 9, 3, 8, 5, 7, 4, 0, 2 + }, + { + 4, 0, 3, 5, 7, 2, 8, 6, 1, 9 + } + }; + + static readonly byte[,] _permutationVariant = + { + { + 0x0a, 0x08, 0x0e, 0x0c, 0x0b, 0x09, 0x0f, 0x0d, 0x1a, 0x18, 0x1e, 0x1c, 0x1b, 0x19, 0x1f, 0x1d, 0x02, + 0x00, 0x06, 0x04, 0x03, 0x01, 0x07, 0x05, 0x12, 0x10, 0x16, 0x14, 0x13, 0x11, 0x17, 0x15 + }, + { + 0x12, 0x1a, 0x16, 0x1e, 0x02, 0x0a, 0x06, 0x0e, 0x10, 0x18, 0x14, 0x1c, 0x00, 0x08, 0x04, 0x0c, 0x13, + 0x1b, 0x17, 0x1f, 0x03, 0x0b, 0x07, 0x0f, 0x11, 0x19, 0x15, 0x1d, 0x01, 0x09, 0x05, 0x0d + } + }; + + static readonly byte[] _variants = + { + 0xB7, 0x74, 0x85, 0xD0, 0xCC, 0xDB, 0xCA, 0x73, 0x03, 0xFE, 0x31, 0x03, 0x52, 0xE0, 0xB7, 0x42, 0x63, 0x16, + 0xF2, 0x2A, 0x79, 0x52, 0xFF, 0x1B, 0x7A, 0x11, 0xCA, 0x1A, 0x9B, 0x40, 0xAD, 0x01 + }; + + static readonly byte[] _secret = + { + 0x55, 0xD6, 0xC4, 0xC5, 0x28 + }; + + /// + /// The disc key returned by the logical unit is encoded with the bus key to prevent man-in-the-middle attacks. + /// This method returns a structure with the decoded key included. + /// + /// The encoded key from the logical unit. + /// The bus key from the logical unit. + /// A DiscKey struct with the decoded key. + public static CSS_CPRM.DiscKey? DecodeDiscKey(byte[] response, byte[] busKey) + { + if(response.Length != 2052 || + busKey.Length != 5) + return null; + + byte[] key = response.Skip(4).Take(2048).ToArray(); + + for(uint i = 0; i < key.Length; i++) + key[i] ^= busKey[4 - (i % busKey.Length)]; + + return new CSS_CPRM.DiscKey + { + DataLength = (ushort)((response[0] << 8) + response[1]), + Reserved1 = response[2], + Reserved2 = response[3], + Key = key + }; + } + + /// + /// The title key returned by the logical unit is encoded with the bus key to prevent man-in-the-middle attacks. + /// This method returns a structure with the decoded key included. + /// + /// The encoded key from the logical unit. + /// The bus key from the logical unit. + /// A TitleKey struct with the decoded key. + public static CSS_CPRM.TitleKey? DecodeTitleKey(byte[] response, byte[] busKey) + { + if(response.Length != 12 || + busKey.Length != 5) + return null; + + byte[] key = response.Skip(5).Take(5).ToArray(); + + for(uint i = 0; i < key.Length; i++) + key[i] ^= busKey[4 - (i % busKey.Length)]; + + return new CSS_CPRM.TitleKey + { + DataLength = (ushort)((response[0] << 8) + response[1]), + Reserved1 = response[2], + Reserved2 = response[3], + CMI = response[4], + Key = key, + Reserved3 = response[10], + Reserved4 = response[11] + }; + } + + /// Takes a challenge and a variant and encrypts it according to the key type. + /// The type of key to encrypt. + /// + /// The challenge sent to the logical unit. + /// The encrypted key. + /// The encrypted key. + public static void EncryptKey(DvdCssKeyType keyType, uint variant, byte[] challenge, out byte[] key) + { + byte[] bits = new byte[30]; + byte[] scratch = new byte[10]; + byte index = sizeof(byte) * 30; + byte[] temp1 = new byte[5]; + byte[] temp2 = new byte[5]; + byte carry = 0; + key = new byte[5]; + + for(int i = 9; i >= 0; --i) + scratch[i] = challenge[_permutationChallenge[(uint)keyType, i]]; + + byte cssVariant = (byte)(keyType == 0 ? variant : _permutationVariant[(uint)keyType - 1, variant]); + + for(int i = 5; --i >= 0;) + temp1[i] = (byte)(scratch[5 + i] ^ _secret[i] ^ _encryptTable2[i]); + + uint lfsr0 = (uint)((temp1[0] << 17) | (temp1[1] << 9) | ((temp1[2] & ~7) << 1) | 8 | (temp1[2] & 7)); + uint lfsr1 = (uint)((temp1[3] << 9) | 0x100 | temp1[4]); + + do + { + byte val = 0; + + for(int bit = 0; bit < 8; ++bit) { - 0x01, 0xaf, 0xe3, 0x12, 0x80 - }, - { - 0x12, 0x11, 0xca, 0x04, 0x3b - }, - { - 0x14, 0x0c, 0x9e, 0xd0, 0x09 - }, - { - 0x14, 0x71, 0x35, 0xba, 0xe2 - }, - { - 0x1a, 0xa4, 0x33, 0x21, 0xa6 - }, - { - 0x26, 0xec, 0xc4, 0xa7, 0x4e - }, - { - 0x2c, 0xb2, 0xc1, 0x09, 0xee - }, - { - 0x2f, 0x25, 0x9e, 0x96, 0xdd - }, - { - 0x33, 0x2f, 0x49, 0x6c, 0xe0 - }, - { - 0x35, 0x5b, 0xc1, 0x31, 0x0f - }, - { - 0x36, 0x67, 0xb2, 0xe3, 0x85 - }, - { - 0x39, 0x3d, 0xf1, 0xf1, 0xbd - }, - { - 0x3b, 0x31, 0x34, 0x0d, 0x91 - }, - { - 0x45, 0xed, 0x28, 0xeb, 0xd3 - }, - { - 0x48, 0xb7, 0x6c, 0xce, 0x69 - }, - { - 0x4b, 0x65, 0x0d, 0xc1, 0xee - }, - { - 0x4c, 0xbb, 0xf5, 0x5b, 0x23 - }, - { - 0x51, 0x67, 0x67, 0xc5, 0xe0 - }, - { - 0x53, 0x94, 0xe1, 0x75, 0xbf - }, - { - 0x57, 0x2c, 0x8b, 0x31, 0xae - }, - { - 0x63, 0xdb, 0x4c, 0x5b, 0x4a - }, - { - 0x7b, 0x1e, 0x5e, 0x2b, 0x57 - }, - { - 0x85, 0xf3, 0x85, 0xa0, 0xe0 - }, - { - 0xab, 0x1e, 0xe7, 0x7b, 0x72 - }, - { - 0xab, 0x36, 0xe3, 0xeb, 0x76 - }, - { - 0xb1, 0xb8, 0xf9, 0x38, 0x03 - }, - { - 0xb8, 0x5d, 0xd8, 0x53, 0xbd - }, - { - 0xbf, 0x92, 0xc3, 0xb0, 0xe2 - }, - { - 0xcf, 0x1a, 0xb2, 0xf8, 0x0a - }, - { - 0xec, 0xa0, 0xcf, 0xb3, 0xff - }, - { - 0xfc, 0x95, 0xa9, 0x87, 0x35 + byte oLfsr0 = (byte)(((lfsr0 >> 24) ^ (lfsr0 >> 21) ^ (lfsr0 >> 20) ^ (lfsr0 >> 12)) & 1); + lfsr0 = (lfsr0 << 1) | oLfsr0; + + byte oLfsr1 = (byte)(((lfsr1 >> 16) ^ (lfsr1 >> 2)) & 1); + lfsr1 = (lfsr1 << 1) | oLfsr1; + + byte combined = (byte)(Convert.ToByte(oLfsr1 == 0) + carry + Convert.ToByte(oLfsr0 == 0)); + carry = (byte)((combined >> 1) & 1); + val |= (byte)((combined & 1) << bit); } - }; - static readonly byte[] _cssTable1 = + bits[--index] = val; + } while(index > 0); + + byte cse = (byte)(_variants[cssVariant] ^ _encryptTable2[cssVariant]); + int term = 0; + + for(int i = 5; --i >= 0; term = scratch[i]) { - 0x33, 0x73, 0x3b, 0x26, 0x63, 0x23, 0x6b, 0x76, 0x3e, 0x7e, 0x36, 0x2b, 0x6e, 0x2e, 0x66, 0x7b, 0xd3, 0x93, - 0xdb, 0x06, 0x43, 0x03, 0x4b, 0x96, 0xde, 0x9e, 0xd6, 0x0b, 0x4e, 0x0e, 0x46, 0x9b, 0x57, 0x17, 0x5f, 0x82, - 0xc7, 0x87, 0xcf, 0x12, 0x5a, 0x1a, 0x52, 0x8f, 0xca, 0x8a, 0xc2, 0x1f, 0xd9, 0x99, 0xd1, 0x00, 0x49, 0x09, - 0x41, 0x90, 0xd8, 0x98, 0xd0, 0x01, 0x48, 0x08, 0x40, 0x91, 0x3d, 0x7d, 0x35, 0x24, 0x6d, 0x2d, 0x65, 0x74, - 0x3c, 0x7c, 0x34, 0x25, 0x6c, 0x2c, 0x64, 0x75, 0xdd, 0x9d, 0xd5, 0x04, 0x4d, 0x0d, 0x45, 0x94, 0xdc, 0x9c, - 0xd4, 0x05, 0x4c, 0x0c, 0x44, 0x95, 0x59, 0x19, 0x51, 0x80, 0xc9, 0x89, 0xc1, 0x10, 0x58, 0x18, 0x50, 0x81, - 0xc8, 0x88, 0xc0, 0x11, 0xd7, 0x97, 0xdf, 0x02, 0x47, 0x07, 0x4f, 0x92, 0xda, 0x9a, 0xd2, 0x0f, 0x4a, 0x0a, - 0x42, 0x9f, 0x53, 0x13, 0x5b, 0x86, 0xc3, 0x83, 0xcb, 0x16, 0x5e, 0x1e, 0x56, 0x8b, 0xce, 0x8e, 0xc6, 0x1b, - 0xb3, 0xf3, 0xbb, 0xa6, 0xe3, 0xa3, 0xeb, 0xf6, 0xbe, 0xfe, 0xb6, 0xab, 0xee, 0xae, 0xe6, 0xfb, 0x37, 0x77, - 0x3f, 0x22, 0x67, 0x27, 0x6f, 0x72, 0x3a, 0x7a, 0x32, 0x2f, 0x6a, 0x2a, 0x62, 0x7f, 0xb9, 0xf9, 0xb1, 0xa0, - 0xe9, 0xa9, 0xe1, 0xf0, 0xb8, 0xf8, 0xb0, 0xa1, 0xe8, 0xa8, 0xe0, 0xf1, 0x5d, 0x1d, 0x55, 0x84, 0xcd, 0x8d, - 0xc5, 0x14, 0x5c, 0x1c, 0x54, 0x85, 0xcc, 0x8c, 0xc4, 0x15, 0xbd, 0xfd, 0xb5, 0xa4, 0xed, 0xad, 0xe5, 0xf4, - 0xbc, 0xfc, 0xb4, 0xa5, 0xec, 0xac, 0xe4, 0xf5, 0x39, 0x79, 0x31, 0x20, 0x69, 0x29, 0x61, 0x70, 0x38, 0x78, - 0x30, 0x21, 0x68, 0x28, 0x60, 0x71, 0xb7, 0xf7, 0xbf, 0xa2, 0xe7, 0xa7, 0xef, 0xf2, 0xba, 0xfa, 0xb2, 0xaf, - 0xea, 0xaa, 0xe2, 0xff - }; + index = (byte)(bits[25 + i] ^ scratch[i]); + index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); - static readonly byte[] _cssTable2 = - { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x08, 0x0b, 0x0a, 0x0d, 0x0c, 0x0f, 0x0e, 0x12, 0x13, - 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, 0x1b, 0x1a, 0x19, 0x18, 0x1f, 0x1e, 0x1d, 0x1c, 0x24, 0x25, 0x26, 0x27, - 0x20, 0x21, 0x22, 0x23, 0x2d, 0x2c, 0x2f, 0x2e, 0x29, 0x28, 0x2b, 0x2a, 0x36, 0x37, 0x34, 0x35, 0x32, 0x33, - 0x30, 0x31, 0x3f, 0x3e, 0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x49, 0x48, 0x4b, 0x4a, 0x4d, 0x4c, 0x4f, 0x4e, - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x5b, 0x5a, 0x59, 0x58, 0x5f, 0x5e, 0x5d, 0x5c, 0x52, 0x53, - 0x50, 0x51, 0x56, 0x57, 0x54, 0x55, 0x6d, 0x6c, 0x6f, 0x6e, 0x69, 0x68, 0x6b, 0x6a, 0x64, 0x65, 0x66, 0x67, - 0x60, 0x61, 0x62, 0x63, 0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78, 0x76, 0x77, 0x74, 0x75, 0x72, 0x73, - 0x70, 0x71, 0x92, 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, 0x9b, 0x9a, 0x99, 0x98, 0x9f, 0x9e, 0x9d, 0x9c, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x89, 0x88, 0x8b, 0x8a, 0x8d, 0x8c, 0x8f, 0x8e, 0xb6, 0xb7, - 0xb4, 0xb5, 0xb2, 0xb3, 0xb0, 0xb1, 0xbf, 0xbe, 0xbd, 0xbc, 0xbb, 0xba, 0xb9, 0xb8, 0xa4, 0xa5, 0xa6, 0xa7, - 0xa0, 0xa1, 0xa2, 0xa3, 0xad, 0xac, 0xaf, 0xae, 0xa9, 0xa8, 0xab, 0xaa, 0xdb, 0xda, 0xd9, 0xd8, 0xdf, 0xde, - 0xdd, 0xdc, 0xd2, 0xd3, 0xd0, 0xd1, 0xd6, 0xd7, 0xd4, 0xd5, 0xc9, 0xc8, 0xcb, 0xca, 0xcd, 0xcc, 0xcf, 0xce, - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf6, 0xf7, - 0xf4, 0xf5, 0xf2, 0xf3, 0xf0, 0xf1, 0xed, 0xec, 0xef, 0xee, 0xe9, 0xe8, 0xeb, 0xea, 0xe4, 0xe5, 0xe6, 0xe7, - 0xe0, 0xe1, 0xe2, 0xe3 - }; - - static readonly byte[] _cssTable3 = - { - 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, - 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, - 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, - 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, - 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, - 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, - 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, - 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, - 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, - 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, - 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, - 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, - 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, - 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, - 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, - 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, - 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, - 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, - 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, - 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, - 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, - 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, - 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, - 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, - 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, - 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, - 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, - 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff, - 0x00, 0x24, 0x49, 0x6d, 0x92, 0xb6, 0xdb, 0xff - }; - - static readonly byte[] _cssTable4 = - { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, - 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, - 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, - 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, - 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, - 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, - 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, - 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, - 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, - 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, - 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, - 0x3f, 0xbf, 0x7f, 0xff - }; - - static readonly byte[] _cssTable5 = - { - 0xff, 0x7f, 0xbf, 0x3f, 0xdf, 0x5f, 0x9f, 0x1f, 0xef, 0x6f, 0xaf, 0x2f, 0xcf, 0x4f, 0x8f, 0x0f, 0xf7, 0x77, - 0xb7, 0x37, 0xd7, 0x57, 0x97, 0x17, 0xe7, 0x67, 0xa7, 0x27, 0xc7, 0x47, 0x87, 0x07, 0xfb, 0x7b, 0xbb, 0x3b, - 0xdb, 0x5b, 0x9b, 0x1b, 0xeb, 0x6b, 0xab, 0x2b, 0xcb, 0x4b, 0x8b, 0x0b, 0xf3, 0x73, 0xb3, 0x33, 0xd3, 0x53, - 0x93, 0x13, 0xe3, 0x63, 0xa3, 0x23, 0xc3, 0x43, 0x83, 0x03, 0xfd, 0x7d, 0xbd, 0x3d, 0xdd, 0x5d, 0x9d, 0x1d, - 0xed, 0x6d, 0xad, 0x2d, 0xcd, 0x4d, 0x8d, 0x0d, 0xf5, 0x75, 0xb5, 0x35, 0xd5, 0x55, 0x95, 0x15, 0xe5, 0x65, - 0xa5, 0x25, 0xc5, 0x45, 0x85, 0x05, 0xf9, 0x79, 0xb9, 0x39, 0xd9, 0x59, 0x99, 0x19, 0xe9, 0x69, 0xa9, 0x29, - 0xc9, 0x49, 0x89, 0x09, 0xf1, 0x71, 0xb1, 0x31, 0xd1, 0x51, 0x91, 0x11, 0xe1, 0x61, 0xa1, 0x21, 0xc1, 0x41, - 0x81, 0x01, 0xfe, 0x7e, 0xbe, 0x3e, 0xde, 0x5e, 0x9e, 0x1e, 0xee, 0x6e, 0xae, 0x2e, 0xce, 0x4e, 0x8e, 0x0e, - 0xf6, 0x76, 0xb6, 0x36, 0xd6, 0x56, 0x96, 0x16, 0xe6, 0x66, 0xa6, 0x26, 0xc6, 0x46, 0x86, 0x06, 0xfa, 0x7a, - 0xba, 0x3a, 0xda, 0x5a, 0x9a, 0x1a, 0xea, 0x6a, 0xaa, 0x2a, 0xca, 0x4a, 0x8a, 0x0a, 0xf2, 0x72, 0xb2, 0x32, - 0xd2, 0x52, 0x92, 0x12, 0xe2, 0x62, 0xa2, 0x22, 0xc2, 0x42, 0x82, 0x02, 0xfc, 0x7c, 0xbc, 0x3c, 0xdc, 0x5c, - 0x9c, 0x1c, 0xec, 0x6c, 0xac, 0x2c, 0xcc, 0x4c, 0x8c, 0x0c, 0xf4, 0x74, 0xb4, 0x34, 0xd4, 0x54, 0x94, 0x14, - 0xe4, 0x64, 0xa4, 0x24, 0xc4, 0x44, 0x84, 0x04, 0xf8, 0x78, 0xb8, 0x38, 0xd8, 0x58, 0x98, 0x18, 0xe8, 0x68, - 0xa8, 0x28, 0xc8, 0x48, 0x88, 0x08, 0xf0, 0x70, 0xb0, 0x30, 0xd0, 0x50, 0x90, 0x10, 0xe0, 0x60, 0xa0, 0x20, - 0xc0, 0x40, 0x80, 0x00 - }; - - static readonly byte[] _encryptTable0 = - { - 0xB7, 0xF4, 0x82, 0x57, 0xDA, 0x4D, 0xDB, 0xE2, 0x2F, 0x52, 0x1A, 0xA8, 0x68, 0x5A, 0x8A, 0xFF, 0xFB, 0x0E, - 0x6D, 0x35, 0xF7, 0x5C, 0x76, 0x12, 0xCE, 0x25, 0x79, 0x29, 0x39, 0x62, 0x08, 0x24, 0xA5, 0x85, 0x7B, 0x56, - 0x01, 0x23, 0x68, 0xCF, 0x0A, 0xE2, 0x5A, 0xED, 0x3D, 0x59, 0xB0, 0xA9, 0xB0, 0x2C, 0xF2, 0xB8, 0xEF, 0x32, - 0xA9, 0x40, 0x80, 0x71, 0xAF, 0x1E, 0xDE, 0x8F, 0x58, 0x88, 0xB8, 0x3A, 0xD0, 0xFC, 0xC4, 0x1E, 0xB5, 0xA0, - 0xBB, 0x3B, 0x0F, 0x01, 0x7E, 0x1F, 0x9F, 0xD9, 0xAA, 0xB8, 0x3D, 0x9D, 0x74, 0x1E, 0x25, 0xDB, 0x37, 0x56, - 0x8F, 0x16, 0xBA, 0x49, 0x2B, 0xAC, 0xD0, 0xBD, 0x95, 0x20, 0xBE, 0x7A, 0x28, 0xD0, 0x51, 0x64, 0x63, 0x1C, - 0x7F, 0x66, 0x10, 0xBB, 0xC4, 0x56, 0x1A, 0x04, 0x6E, 0x0A, 0xEC, 0x9C, 0xD6, 0xE8, 0x9A, 0x7A, 0xCF, 0x8C, - 0xDB, 0xB1, 0xEF, 0x71, 0xDE, 0x31, 0xFF, 0x54, 0x3E, 0x5E, 0x07, 0x69, 0x96, 0xB0, 0xCF, 0xDD, 0x9E, 0x47, - 0xC7, 0x96, 0x8F, 0xE4, 0x2B, 0x59, 0xC6, 0xEE, 0xB9, 0x86, 0x9A, 0x64, 0x84, 0x72, 0xE2, 0x5B, 0xA2, 0x96, - 0x58, 0x99, 0x50, 0x03, 0xF5, 0x38, 0x4D, 0x02, 0x7D, 0xE7, 0x7D, 0x75, 0xA7, 0xB8, 0x67, 0x87, 0x84, 0x3F, - 0x1D, 0x11, 0xE5, 0xFC, 0x1E, 0xD3, 0x83, 0x16, 0xA5, 0x29, 0xF6, 0xC7, 0x15, 0x61, 0x29, 0x1A, 0x43, 0x4F, - 0x9B, 0xAF, 0xC5, 0x87, 0x34, 0x6C, 0x0F, 0x3B, 0xA8, 0x1D, 0x45, 0x58, 0x25, 0xDC, 0xA8, 0xA3, 0x3B, 0xD1, - 0x79, 0x1B, 0x48, 0xF2, 0xE9, 0x93, 0x1F, 0xFC, 0xDB, 0x2A, 0x90, 0xA9, 0x8A, 0x3D, 0x39, 0x18, 0xA3, 0x8E, - 0x58, 0x6C, 0xE0, 0x12, 0xBB, 0x25, 0xCD, 0x71, 0x22, 0xA2, 0x64, 0xC6, 0xE7, 0xFB, 0xAD, 0x94, 0x77, 0x04, - 0x9A, 0x39, 0xCF, 0x7C - }; - - static readonly byte[] _encryptTable1 = - { - 0x8C, 0x47, 0xB0, 0xE1, 0xEB, 0xFC, 0xEB, 0x56, 0x10, 0xE5, 0x2C, 0x1A, 0x5D, 0xEF, 0xBE, 0x4F, 0x08, 0x75, - 0x97, 0x4B, 0x0E, 0x25, 0x8E, 0x6E, 0x39, 0x5A, 0x87, 0x53, 0xC4, 0x1F, 0xF4, 0x5C, 0x4E, 0xE6, 0x99, 0x30, - 0xE0, 0x42, 0x88, 0xAB, 0xE5, 0x85, 0xBC, 0x8F, 0xD8, 0x3C, 0x54, 0xC9, 0x53, 0x47, 0x18, 0xD6, 0x06, 0x5B, - 0x41, 0x2C, 0x67, 0x1E, 0x41, 0x74, 0x33, 0xE2, 0xB4, 0xE0, 0x23, 0x29, 0x42, 0xEA, 0x55, 0x0F, 0x25, 0xB4, - 0x24, 0x2C, 0x99, 0x13, 0xEB, 0x0A, 0x0B, 0xC9, 0xF9, 0x63, 0x67, 0x43, 0x2D, 0xC7, 0x7D, 0x07, 0x60, 0x89, - 0xD1, 0xCC, 0xE7, 0x94, 0x77, 0x74, 0x9B, 0x7E, 0xD7, 0xE6, 0xFF, 0xBB, 0x68, 0x14, 0x1E, 0xA3, 0x25, 0xDE, - 0x3A, 0xA3, 0x54, 0x7B, 0x87, 0x9D, 0x50, 0xCA, 0x27, 0xC3, 0xA4, 0x50, 0x91, 0x27, 0xD4, 0xB0, 0x82, 0x41, - 0x97, 0x79, 0x94, 0x82, 0xAC, 0xC7, 0x8E, 0xA5, 0x4E, 0xAA, 0x78, 0x9E, 0xE0, 0x42, 0xBA, 0x28, 0xEA, 0xB7, - 0x74, 0xAD, 0x35, 0xDA, 0x92, 0x60, 0x7E, 0xD2, 0x0E, 0xB9, 0x24, 0x5E, 0x39, 0x4F, 0x5E, 0x63, 0x09, 0xB5, - 0xFA, 0xBF, 0xF1, 0x22, 0x55, 0x1C, 0xE2, 0x25, 0xDB, 0xC5, 0xD8, 0x50, 0x03, 0x98, 0xC4, 0xAC, 0x2E, 0x11, - 0xB4, 0x38, 0x4D, 0xD0, 0xB9, 0xFC, 0x2D, 0x3C, 0x08, 0x04, 0x5A, 0xEF, 0xCE, 0x32, 0xFB, 0x4C, 0x92, 0x1E, - 0x4B, 0xFB, 0x1A, 0xD0, 0xE2, 0x3E, 0xDA, 0x6E, 0x7C, 0x4D, 0x56, 0xC3, 0x3F, 0x42, 0xB1, 0x3A, 0x23, 0x4D, - 0x6E, 0x84, 0x56, 0x68, 0xF4, 0x0E, 0x03, 0x64, 0xD0, 0xA9, 0x92, 0x2F, 0x8B, 0xBC, 0x39, 0x9C, 0xAC, 0x09, - 0x5E, 0xEE, 0xE5, 0x97, 0xBF, 0xA5, 0xCE, 0xFA, 0x28, 0x2C, 0x6D, 0x4F, 0xEF, 0x77, 0xAA, 0x1B, 0x79, 0x8E, - 0x97, 0xB4, 0xC3, 0xF4 - }; - - static readonly byte[] _encryptTable2 = - { - 0xB7, 0x75, 0x81, 0xD5, 0xDC, 0xCA, 0xDE, 0x66, 0x23, 0xDF, 0x15, 0x26, 0x62, 0xD1, 0x83, 0x77, 0xE3, 0x97, - 0x76, 0xAF, 0xE9, 0xC3, 0x6B, 0x8E, 0xDA, 0xB0, 0x6E, 0xBF, 0x2B, 0xF1, 0x19, 0xB4, 0x95, 0x34, 0x48, 0xE4, - 0x37, 0x94, 0x5D, 0x7B, 0x36, 0x5F, 0x65, 0x53, 0x07, 0xE2, 0x89, 0x11, 0x98, 0x85, 0xD9, 0x12, 0xC1, 0x9D, - 0x84, 0xEC, 0xA4, 0xD4, 0x88, 0xB8, 0xFC, 0x2C, 0x79, 0x28, 0xD8, 0xDB, 0xB3, 0x1E, 0xA2, 0xF9, 0xD0, 0x44, - 0xD7, 0xD6, 0x60, 0xEF, 0x14, 0xF4, 0xF6, 0x31, 0xD2, 0x41, 0x46, 0x67, 0x0A, 0xE1, 0x58, 0x27, 0x43, 0xA3, - 0xF8, 0xE0, 0xC8, 0xBA, 0x5A, 0x5C, 0x80, 0x6C, 0xC6, 0xF2, 0xE8, 0xAD, 0x7D, 0x04, 0x0D, 0xB9, 0x3C, 0xC2, - 0x25, 0xBD, 0x49, 0x63, 0x8C, 0x9F, 0x51, 0xCE, 0x20, 0xC5, 0xA1, 0x50, 0x92, 0x2D, 0xDD, 0xBC, 0x8D, 0x4F, - 0x9A, 0x71, 0x2F, 0x30, 0x1D, 0x73, 0x39, 0x13, 0xFB, 0x1A, 0xCB, 0x24, 0x59, 0xFE, 0x05, 0x96, 0x57, 0x0F, - 0x1F, 0xCF, 0x54, 0xBE, 0xF5, 0x06, 0x1B, 0xB2, 0x6D, 0xD3, 0x4D, 0x32, 0x56, 0x21, 0x33, 0x0B, 0x52, 0xE7, - 0xAB, 0xEB, 0xA6, 0x74, 0x00, 0x4C, 0xB1, 0x7F, 0x82, 0x99, 0x87, 0x0E, 0x5E, 0xC0, 0x8F, 0xEE, 0x6F, 0x55, - 0xF3, 0x7E, 0x08, 0x90, 0xFA, 0xB6, 0x64, 0x70, 0x47, 0x4A, 0x17, 0xA7, 0xB5, 0x40, 0x8A, 0x38, 0xE5, 0x68, - 0x3E, 0x8B, 0x69, 0xAA, 0x9B, 0x42, 0xA5, 0x10, 0x01, 0x35, 0xFD, 0x61, 0x9E, 0xE6, 0x16, 0x9C, 0x86, 0xED, - 0xCD, 0x2E, 0xFF, 0xC4, 0x5B, 0xA0, 0xAE, 0xCC, 0x4B, 0x3B, 0x03, 0xBB, 0x1C, 0x2A, 0xAC, 0x0C, 0x3F, 0x93, - 0xC7, 0x72, 0x7A, 0x09, 0x22, 0x3D, 0x45, 0x78, 0xA9, 0xA8, 0xEA, 0xC9, 0x6A, 0xF7, 0x29, 0x91, 0xF0, 0x02, - 0x18, 0x3A, 0x4E, 0x7C - }; - - static readonly byte[] _encryptTable3 = - { - 0x73, 0x51, 0x95, 0xE1, 0x12, 0xE4, 0xC0, 0x58, 0xEE, 0xF2, 0x08, 0x1B, 0xA9, 0xFA, 0x98, 0x4C, 0xA7, 0x33, - 0xE2, 0x1B, 0xA7, 0x6D, 0xF5, 0x30, 0x97, 0x1D, 0xF3, 0x02, 0x60, 0x5A, 0x82, 0x0F, 0x91, 0xD0, 0x9C, 0x10, - 0x39, 0x7A, 0x83, 0x85, 0x3B, 0xB2, 0xB8, 0xAE, 0x0C, 0x09, 0x52, 0xEA, 0x1C, 0xE1, 0x8D, 0x66, 0x4F, 0xF3, - 0xDA, 0x92, 0x29, 0xB9, 0xD5, 0xC5, 0x77, 0x47, 0x22, 0x53, 0x14, 0xF7, 0xAF, 0x22, 0x64, 0xDF, 0xC6, 0x72, - 0x12, 0xF3, 0x75, 0xDA, 0xD7, 0xD7, 0xE5, 0x02, 0x9E, 0xED, 0xDA, 0xDB, 0x4C, 0x47, 0xCE, 0x91, 0x06, 0x06, - 0x6D, 0x55, 0x8B, 0x19, 0xC9, 0xEF, 0x8C, 0x80, 0x1A, 0x0E, 0xEE, 0x4B, 0xAB, 0xF2, 0x08, 0x5C, 0xE9, 0x37, - 0x26, 0x5E, 0x9A, 0x90, 0x00, 0xF3, 0x0D, 0xB2, 0xA6, 0xA3, 0xF7, 0x26, 0x17, 0x48, 0x88, 0xC9, 0x0E, 0x2C, - 0xC9, 0x02, 0xE7, 0x18, 0x05, 0x4B, 0xF3, 0x39, 0xE1, 0x20, 0x02, 0x0D, 0x40, 0xC7, 0xCA, 0xB9, 0x48, 0x30, - 0x57, 0x67, 0xCC, 0x06, 0xBF, 0xAC, 0x81, 0x08, 0x24, 0x7A, 0xD4, 0x8B, 0x19, 0x8E, 0xAC, 0xB4, 0x5A, 0x0F, - 0x73, 0x13, 0xAC, 0x9E, 0xDA, 0xB6, 0xB8, 0x96, 0x5B, 0x60, 0x88, 0xE1, 0x81, 0x3F, 0x07, 0x86, 0x37, 0x2D, - 0x79, 0x14, 0x52, 0xEA, 0x73, 0xDF, 0x3D, 0x09, 0xC8, 0x25, 0x48, 0xD8, 0x75, 0x60, 0x9A, 0x08, 0x27, 0x4A, - 0x2C, 0xB9, 0xA8, 0x8B, 0x8A, 0x73, 0x62, 0x37, 0x16, 0x02, 0xBD, 0xC1, 0x0E, 0x56, 0x54, 0x3E, 0x14, 0x5F, - 0x8C, 0x8F, 0x6E, 0x75, 0x1C, 0x07, 0x39, 0x7B, 0x4B, 0xDB, 0xD3, 0x4B, 0x1E, 0xC8, 0x7E, 0xFE, 0x3E, 0x72, - 0x16, 0x83, 0x7D, 0xEE, 0xF5, 0xCA, 0xC5, 0x18, 0xF9, 0xD8, 0x68, 0xAB, 0x38, 0x85, 0xA8, 0xF0, 0xA1, 0x73, - 0x9F, 0x5D, 0x19, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x72, 0x39, 0x25, 0x67, 0x26, - 0x6D, 0x71, 0x36, 0x77, 0x3C, 0x20, 0x62, 0x23, 0x68, 0x74, 0xC3, 0x82, 0xC9, 0x15, 0x57, 0x16, 0x5D, 0x81 - }; - - static readonly byte[,] _permutationChallenge = - { - { - 1, 3, 0, 7, 5, 2, 9, 6, 4, 8 - }, - { - 6, 1, 9, 3, 8, 5, 7, 4, 0, 2 - }, - { - 4, 0, 3, 5, 7, 2, 8, 6, 1, 9 - } - }; - - static readonly byte[,] _permutationVariant = - { - { - 0x0a, 0x08, 0x0e, 0x0c, 0x0b, 0x09, 0x0f, 0x0d, 0x1a, 0x18, 0x1e, 0x1c, 0x1b, 0x19, 0x1f, 0x1d, 0x02, - 0x00, 0x06, 0x04, 0x03, 0x01, 0x07, 0x05, 0x12, 0x10, 0x16, 0x14, 0x13, 0x11, 0x17, 0x15 - }, - { - 0x12, 0x1a, 0x16, 0x1e, 0x02, 0x0a, 0x06, 0x0e, 0x10, 0x18, 0x14, 0x1c, 0x00, 0x08, 0x04, 0x0c, 0x13, - 0x1b, 0x17, 0x1f, 0x03, 0x0b, 0x07, 0x0f, 0x11, 0x19, 0x15, 0x1d, 0x01, 0x09, 0x05, 0x0d - } - }; - - static readonly byte[] _variants = - { - 0xB7, 0x74, 0x85, 0xD0, 0xCC, 0xDB, 0xCA, 0x73, 0x03, 0xFE, 0x31, 0x03, 0x52, 0xE0, 0xB7, 0x42, 0x63, 0x16, - 0xF2, 0x2A, 0x79, 0x52, 0xFF, 0x1B, 0x7A, 0x11, 0xCA, 0x1A, 0x9B, 0x40, 0xAD, 0x01 - }; - - static readonly byte[] _secret = - { - 0x55, 0xD6, 0xC4, 0xC5, 0x28 - }; - - /// - /// The disc key returned by the logical unit is encoded with the bus key to prevent man-in-the-middle attacks. - /// This method returns a structure with the decoded key included. - /// - /// The encoded key from the logical unit. - /// The bus key from the logical unit. - /// A DiscKey struct with the decoded key. - public static CSS_CPRM.DiscKey? DecodeDiscKey(byte[] response, byte[] busKey) - { - if(response.Length != 2052 || - busKey.Length != 5) - return null; - - byte[] key = response.Skip(4).Take(2048).ToArray(); - - for(uint i = 0; i < key.Length; i++) - key[i] ^= busKey[4 - (i % busKey.Length)]; - - return new CSS_CPRM.DiscKey - { - DataLength = (ushort)((response[0] << 8) + response[1]), - Reserved1 = response[2], - Reserved2 = response[3], - Key = key - }; + temp1[i] = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); } - /// - /// The title key returned by the logical unit is encoded with the bus key to prevent man-in-the-middle attacks. - /// This method returns a structure with the decoded key included. - /// - /// The encoded key from the logical unit. - /// The bus key from the logical unit. - /// A TitleKey struct with the decoded key. - public static CSS_CPRM.TitleKey? DecodeTitleKey(byte[] response, byte[] busKey) + temp1[4] ^= temp1[0]; + term = 0; + + for(int i = 5; --i >= 0; term = temp1[i]) { - if(response.Length != 12 || - busKey.Length != 5) - return null; + index = (byte)(bits[20 + i] ^ temp1[i]); + index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); - byte[] key = response.Skip(5).Take(5).ToArray(); - - for(uint i = 0; i < key.Length; i++) - key[i] ^= busKey[4 - (i % busKey.Length)]; - - return new CSS_CPRM.TitleKey - { - DataLength = (ushort)((response[0] << 8) + response[1]), - Reserved1 = response[2], - Reserved2 = response[3], - CMI = response[4], - Key = key, - Reserved3 = response[10], - Reserved4 = response[11] - }; + temp2[i] = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); } - /// Takes a challenge and a variant and encrypts it according to the key type. - /// The type of key to encrypt. - /// - /// The challenge sent to the logical unit. - /// The encrypted key. - /// The encrypted key. - public static void EncryptKey(DvdCssKeyType keyType, uint variant, byte[] challenge, out byte[] key) + temp2[4] ^= temp2[0]; + term = 0; + + for(int i = 5; --i >= 0; term = temp2[i]) { - byte[] bits = new byte[30]; - byte[] scratch = new byte[10]; - byte index = sizeof(byte) * 30; - byte[] temp1 = new byte[5]; - byte[] temp2 = new byte[5]; - byte carry = 0; - key = new byte[5]; + index = (byte)(bits[15 + i] ^ temp2[i]); + index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); + index = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); - for(int i = 9; i >= 0; --i) - scratch[i] = challenge[_permutationChallenge[(uint)keyType, i]]; + temp1[i] = (byte)(_encryptTable0[index] ^ _encryptTable2[index]); + } - byte cssVariant = (byte)(keyType == 0 ? variant : _permutationVariant[(uint)keyType - 1, variant]); + temp1[4] ^= temp1[0]; + term = 0; - for(int i = 5; --i >= 0;) - temp1[i] = (byte)(scratch[5 + i] ^ _secret[i] ^ _encryptTable2[i]); + for(int i = 5; --i >= 0; term = temp1[i]) + { + index = (byte)(bits[10 + i] ^ temp1[i]); + index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); + index = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); - uint lfsr0 = (uint)((temp1[0] << 17) | (temp1[1] << 9) | ((temp1[2] & ~7) << 1) | 8 | (temp1[2] & 7)); - uint lfsr1 = (uint)((temp1[3] << 9) | 0x100 | temp1[4]); + temp2[i] = (byte)(_encryptTable0[index] ^ _encryptTable2[index]); + } - do + temp2[4] ^= temp2[0]; + term = 0; + + for(int i = 5; --i >= 0; term = temp2[i]) + { + index = (byte)(bits[5 + i] ^ temp2[i]); + index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); + + temp1[i] = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); + } + + temp1[4] ^= temp1[0]; + term = 0; + + for(int i = 5; --i >= 0; term = temp1[i]) + { + index = (byte)(bits[i] ^ temp1[i]); + index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); + + key[i] = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); + } + } + + /// Takes an encrypted key and its crypto and returns the key decrypted. + /// + /// The key used to encrypt the data. + /// The encrypted data. + /// The decrypted data. + public static void DecryptKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) + { + decryptedKey = new byte[5]; + byte[] k = new byte[5]; + + uint lfsr1Lo = (uint)(cryptoKey[0] | 0x100); + uint lfsr1Hi = cryptoKey[1]; + + uint lfsr0 = (uint)(((cryptoKey[4] << 17) | (cryptoKey[3] << 9) | (cryptoKey[2] << 1)) + 8 - + (cryptoKey[2] & 7)); + + lfsr0 = (uint)((_cssTable4[lfsr0 & 0xff] << 24) | (_cssTable4[(lfsr0 >> 8) & 0xff] << 16) | + (_cssTable4[(lfsr0 >> 16) & 0xff] << 8) | _cssTable4[(lfsr0 >> 24) & 0xff]); + + uint combined = 0; + + for(uint i = 0; i < 5; i++) + { + byte oLfsr1 = (byte)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); + lfsr1Hi = lfsr1Lo >> 1; + lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; + oLfsr1 = _cssTable4[oLfsr1]; + byte oLfsr0 = (byte)(((((((lfsr0 >> 8) ^ lfsr0) >> 1) ^ lfsr0) >> 3) ^ lfsr0) >> 7); + lfsr0 = (lfsr0 >> 8) | ((uint)oLfsr0 << 24); + combined += (uint)((oLfsr0 ^ invert) + oLfsr1); + k[i] = (byte)(combined & 0xff); + combined >>= 8; + } + + decryptedKey[4] = (byte)(k[4] ^ _cssTable1[encryptedKey[4]] ^ encryptedKey[3]); + decryptedKey[3] = (byte)(k[3] ^ _cssTable1[encryptedKey[3]] ^ encryptedKey[2]); + decryptedKey[2] = (byte)(k[2] ^ _cssTable1[encryptedKey[2]] ^ encryptedKey[1]); + decryptedKey[1] = (byte)(k[1] ^ _cssTable1[encryptedKey[1]] ^ encryptedKey[0]); + decryptedKey[0] = (byte)(k[0] ^ _cssTable1[encryptedKey[0]] ^ decryptedKey[4]); + + decryptedKey[4] = (byte)(k[4] ^ _cssTable1[decryptedKey[4]] ^ decryptedKey[3]); + decryptedKey[3] = (byte)(k[3] ^ _cssTable1[decryptedKey[3]] ^ decryptedKey[2]); + decryptedKey[2] = (byte)(k[2] ^ _cssTable1[decryptedKey[2]] ^ decryptedKey[1]); + decryptedKey[1] = (byte)(k[1] ^ _cssTable1[decryptedKey[1]] ^ decryptedKey[0]); + decryptedKey[0] = (byte)(k[0] ^ _cssTable1[decryptedKey[0]]); + } + + public static void + DecryptTitleKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) => + DecryptKey(invert, cryptoKey, encryptedKey, out decryptedKey); + + /// Takes an bytearray of encrypted keys, decrypts them and returns the correctly decrypted key. + /// Encrypted keys to try to decrypt. + /// The decrypted key if found. + public static void DecryptDiscKey(byte[] encryptedKeys, out byte[]? decryptedKey) + { + decryptedKey = new byte[5]; + byte[] verificationKey = encryptedKeys.Take(5).ToArray(); + + for(uint n = 0; n < _playerKeys.GetLength(0); n++) + { + byte[] currentPlayerKey = Enumerable.Range(0, _playerKeys.GetLength(1)).Select(x => _playerKeys[n, x]). + ToArray(); + + for(uint i = 1; i < 409; i++) { - byte val = 0; + DecryptKey(0, currentPlayerKey, encryptedKeys.Skip(5 * (int)i).Take(5).ToArray(), out decryptedKey); - for(int bit = 0; bit < 8; ++bit) + // The first key in the structure is the key encrypted with itself, so we can use it to verify + // we found the correct key. + DecryptKey(0, decryptedKey, verificationKey, out byte[] verify); + + if(decryptedKey.SequenceEqual(verify)) { - byte oLfsr0 = (byte)(((lfsr0 >> 24) ^ (lfsr0 >> 21) ^ (lfsr0 >> 20) ^ (lfsr0 >> 12)) & 1); - lfsr0 = (lfsr0 << 1) | oLfsr0; - - byte oLfsr1 = (byte)(((lfsr1 >> 16) ^ (lfsr1 >> 2)) & 1); - lfsr1 = (lfsr1 << 1) | oLfsr1; - - byte combined = (byte)(Convert.ToByte(oLfsr1 == 0) + carry + Convert.ToByte(oLfsr0 == 0)); - carry = (byte)((combined >> 1) & 1); - val |= (byte)((combined & 1) << bit); + return; } - - bits[--index] = val; - } while(index > 0); - - byte cse = (byte)(_variants[cssVariant] ^ _encryptTable2[cssVariant]); - int term = 0; - - for(int i = 5; --i >= 0; term = scratch[i]) - { - index = (byte)(bits[25 + i] ^ scratch[i]); - index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); - - temp1[i] = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); - } - - temp1[4] ^= temp1[0]; - term = 0; - - for(int i = 5; --i >= 0; term = temp1[i]) - { - index = (byte)(bits[20 + i] ^ temp1[i]); - index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); - - temp2[i] = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); - } - - temp2[4] ^= temp2[0]; - term = 0; - - for(int i = 5; --i >= 0; term = temp2[i]) - { - index = (byte)(bits[15 + i] ^ temp2[i]); - index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); - index = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); - - temp1[i] = (byte)(_encryptTable0[index] ^ _encryptTable2[index]); - } - - temp1[4] ^= temp1[0]; - term = 0; - - for(int i = 5; --i >= 0; term = temp1[i]) - { - index = (byte)(bits[10 + i] ^ temp1[i]); - index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); - index = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); - - temp2[i] = (byte)(_encryptTable0[index] ^ _encryptTable2[index]); - } - - temp2[4] ^= temp2[0]; - term = 0; - - for(int i = 5; --i >= 0; term = temp2[i]) - { - index = (byte)(bits[5 + i] ^ temp2[i]); - index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); - - temp1[i] = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); - } - - temp1[4] ^= temp1[0]; - term = 0; - - for(int i = 5; --i >= 0; term = temp1[i]) - { - index = (byte)(bits[i] ^ temp1[i]); - index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); - - key[i] = (byte)(_encryptTable2[index] ^ _encryptTable3[index] ^ term); } } - /// Takes an encrypted key and its crypto and returns the key decrypted. - /// - /// The key used to encrypt the data. - /// The encrypted data. - /// The decrypted data. - public static void DecryptKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) + // No correct key was found. + decryptedKey = null; + } + + /// Takes a sector and a decrypted title key and returns the decrypted sector. + /// Encrypted sector data. + /// The Copyright Management Information. + /// The encryption keys. + /// Number of sectors in sectorData. + /// Size of one sector. + /// The decrypted sector. + public static byte[] DecryptSector(byte[] sectorData, byte[] cmiData, byte[] keyData, uint blocks = 1, + uint blockSize = 2048) + { + if(cmiData.All(cmi => (cmi & 0x80) >> 7 == 0) || + keyData.All(k => k == 0)) + return sectorData; + + byte[] decryptedBuffer = new byte[sectorData.Length]; + + for(uint j = 0; j < blocks; j++) { - decryptedKey = new byte[5]; - byte[] k = new byte[5]; + byte[] currentKey = keyData.Skip((int)(j * 5)).Take(5).ToArray(); + byte[] currentSector = sectorData.Skip((int)(j * blockSize)).Take((int)blockSize).ToArray(); - uint lfsr1Lo = (uint)(cryptoKey[0] | 0x100); - uint lfsr1Hi = cryptoKey[1]; + // If the CMI tells use the sector isn't encrypted or + // if the key is all zeroes or + // if the MPEG Packetized Elementary Stream scrambling control value tells us the packet is not scrambled + if((cmiData[j] & 0x80) >> 7 == 0 || + currentKey.All(k => k == 0) || + (currentSector[20] & 0x30) >> 4 == 0) + { + // Sector is not encrypted + Array.Copy(currentSector, 0, decryptedBuffer, (int)(j * blockSize), blockSize); - uint lfsr0 = (uint)(((cryptoKey[4] << 17) | (cryptoKey[3] << 9) | (cryptoKey[2] << 1)) + 8 - - (cryptoKey[2] & 7)); + continue; + } - lfsr0 = (uint)((_cssTable4[lfsr0 & 0xff] << 24) | (_cssTable4[(lfsr0 >> 8) & 0xff] << 16) | - (_cssTable4[(lfsr0 >> 16) & 0xff] << 8) | _cssTable4[(lfsr0 >> 24) & 0xff]); + uint lfsr1Lo = (uint)(currentKey[0] ^ currentSector[0x54]) | 0x100; + uint lfsr1Hi = (uint)currentKey[1] ^ currentSector[0x55]; + + uint lfsr0 = (uint)((currentKey[2] | (currentKey[3] << 8) | (currentKey[4] << 16)) ^ + (sectorData[0x56] | (sectorData[0x57] << 8) | (sectorData[0x58] << 16))); + + uint oLfsr1 = lfsr0 & 7; + lfsr0 = (lfsr0 * 2) + 8 - oLfsr1; uint combined = 0; - for(uint i = 0; i < 5; i++) + for(uint i = 128; i < blockSize; i++) { - byte oLfsr1 = (byte)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); + oLfsr1 = (uint)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); lfsr1Hi = lfsr1Lo >> 1; lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; - oLfsr1 = _cssTable4[oLfsr1]; - byte oLfsr0 = (byte)(((((((lfsr0 >> 8) ^ lfsr0) >> 1) ^ lfsr0) >> 3) ^ lfsr0) >> 7); - lfsr0 = (lfsr0 >> 8) | ((uint)oLfsr0 << 24); - combined += (uint)((oLfsr0 ^ invert) + oLfsr1); - k[i] = (byte)(combined & 0xff); - combined >>= 8; + oLfsr1 = _cssTable5[oLfsr1]; + uint oLfsr0 = (((((((lfsr0 >> 3) ^ lfsr0) >> 1) ^ lfsr0) >> 8) ^ lfsr0) >> 5) & 0xff; + lfsr0 = (lfsr0 >> 8) | (oLfsr0 << 24); + lfsr0 = (lfsr0 << 8) | oLfsr0; + oLfsr0 = _cssTable4[oLfsr0]; + combined += oLfsr0 + oLfsr1; + currentSector[i] = (byte)(_cssTable1[currentSector[i]] ^ (combined & 0xff)); + combined >>= 8; } - decryptedKey[4] = (byte)(k[4] ^ _cssTable1[encryptedKey[4]] ^ encryptedKey[3]); - decryptedKey[3] = (byte)(k[3] ^ _cssTable1[encryptedKey[3]] ^ encryptedKey[2]); - decryptedKey[2] = (byte)(k[2] ^ _cssTable1[encryptedKey[2]] ^ encryptedKey[1]); - decryptedKey[1] = (byte)(k[1] ^ _cssTable1[encryptedKey[1]] ^ encryptedKey[0]); - decryptedKey[0] = (byte)(k[0] ^ _cssTable1[encryptedKey[0]] ^ decryptedKey[4]); - - decryptedKey[4] = (byte)(k[4] ^ _cssTable1[decryptedKey[4]] ^ decryptedKey[3]); - decryptedKey[3] = (byte)(k[3] ^ _cssTable1[decryptedKey[3]] ^ decryptedKey[2]); - decryptedKey[2] = (byte)(k[2] ^ _cssTable1[decryptedKey[2]] ^ decryptedKey[1]); - decryptedKey[1] = (byte)(k[1] ^ _cssTable1[decryptedKey[1]] ^ decryptedKey[0]); - decryptedKey[0] = (byte)(k[0] ^ _cssTable1[decryptedKey[0]]); + Array.Copy(currentSector, 0, decryptedBuffer, (int)(j * blockSize), blockSize); } - public static void - DecryptTitleKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) => - DecryptKey(invert, cryptoKey, encryptedKey, out decryptedKey); + return decryptedBuffer; + } - /// Takes an bytearray of encrypted keys, decrypts them and returns the correctly decrypted key. - /// Encrypted keys to try to decrypt. - /// The decrypted key if found. - public static void DecryptDiscKey(byte[] encryptedKeys, out byte[]? decryptedKey) - { - decryptedKey = new byte[5]; - byte[] verificationKey = encryptedKeys.Take(5).ToArray(); + /// Takes an RPC state from the drive and a CMI from a disc and checks if the regions are compatible. + /// The RegionalPlaybackControlState from drive. + /// The LeadInCopyright from disc. + /// true if the regions are compatible, else false + public static bool CheckRegion(CSS_CPRM.RegionalPlaybackControlState rpc, CSS_CPRM.LeadInCopyright cmi) + { + // if disc region is all or none, we cannot do anything but try to read it as is + if(cmi.RegionInformation == 0xFF || + cmi.RegionInformation == 0x00) + return true; - for(uint n = 0; n < _playerKeys.GetLength(0); n++) - { - byte[] currentPlayerKey = Enumerable.Range(0, _playerKeys.GetLength(1)).Select(x => _playerKeys[n, x]). - ToArray(); - - for(uint i = 1; i < 409; i++) - { - DecryptKey(0, currentPlayerKey, encryptedKeys.Skip(5 * (int)i).Take(5).ToArray(), out decryptedKey); - - // The first key in the structure is the key encrypted with itself, so we can use it to verify - // we found the correct key. - DecryptKey(0, decryptedKey, verificationKey, out byte[] verify); - - if(decryptedKey.SequenceEqual(verify)) - { - return; - } - } - } - - // No correct key was found. - decryptedKey = null; - } - - /// Takes a sector and a decrypted title key and returns the decrypted sector. - /// Encrypted sector data. - /// The Copyright Management Information. - /// The encryption keys. - /// Number of sectors in sectorData. - /// Size of one sector. - /// The decrypted sector. - public static byte[] DecryptSector(byte[] sectorData, byte[] cmiData, byte[] keyData, uint blocks = 1, - uint blockSize = 2048) - { - if(cmiData.All(cmi => (cmi & 0x80) >> 7 == 0) || - keyData.All(k => k == 0)) - return sectorData; - - byte[] decryptedBuffer = new byte[sectorData.Length]; - - for(uint j = 0; j < blocks; j++) - { - byte[] currentKey = keyData.Skip((int)(j * 5)).Take(5).ToArray(); - byte[] currentSector = sectorData.Skip((int)(j * blockSize)).Take((int)blockSize).ToArray(); - - // If the CMI tells use the sector isn't encrypted or - // if the key is all zeroes or - // if the MPEG Packetized Elementary Stream scrambling control value tells us the packet is not scrambled - if((cmiData[j] & 0x80) >> 7 == 0 || - currentKey.All(k => k == 0) || - (currentSector[20] & 0x30) >> 4 == 0) - { - // Sector is not encrypted - Array.Copy(currentSector, 0, decryptedBuffer, (int)(j * blockSize), blockSize); - - continue; - } - - uint lfsr1Lo = (uint)(currentKey[0] ^ currentSector[0x54]) | 0x100; - uint lfsr1Hi = (uint)currentKey[1] ^ currentSector[0x55]; - - uint lfsr0 = (uint)((currentKey[2] | (currentKey[3] << 8) | (currentKey[4] << 16)) ^ - (sectorData[0x56] | (sectorData[0x57] << 8) | (sectorData[0x58] << 16))); - - uint oLfsr1 = lfsr0 & 7; - lfsr0 = (lfsr0 * 2) + 8 - oLfsr1; - - uint combined = 0; - - for(uint i = 128; i < blockSize; i++) - { - oLfsr1 = (uint)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); - lfsr1Hi = lfsr1Lo >> 1; - lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; - oLfsr1 = _cssTable5[oLfsr1]; - uint oLfsr0 = (((((((lfsr0 >> 3) ^ lfsr0) >> 1) ^ lfsr0) >> 8) ^ lfsr0) >> 5) & 0xff; - lfsr0 = (lfsr0 >> 8) | (oLfsr0 << 24); - lfsr0 = (lfsr0 << 8) | oLfsr0; - oLfsr0 = _cssTable4[oLfsr0]; - combined += oLfsr0 + oLfsr1; - currentSector[i] = (byte)(_cssTable1[currentSector[i]] ^ (combined & 0xff)); - combined >>= 8; - } - - Array.Copy(currentSector, 0, decryptedBuffer, (int)(j * blockSize), blockSize); - } - - return decryptedBuffer; - } - - /// Takes an RPC state from the drive and a CMI from a disc and checks if the regions are compatible. - /// The RegionalPlaybackControlState from drive. - /// The LeadInCopyright from disc. - /// true if the regions are compatible, else false - public static bool CheckRegion(CSS_CPRM.RegionalPlaybackControlState rpc, CSS_CPRM.LeadInCopyright cmi) - { - // if disc region is all or none, we cannot do anything but try to read it as is - if(cmi.RegionInformation == 0xFF || - cmi.RegionInformation == 0x00) - return true; - - return ((rpc.RegionMask & 0x01) == (cmi.RegionInformation & 0x01) && (rpc.RegionMask & 0x01) != 0x01) || - ((rpc.RegionMask & 0x02) == (cmi.RegionInformation & 0x02) && (rpc.RegionMask & 0x02) != 0x02) || - ((rpc.RegionMask & 0x04) == (cmi.RegionInformation & 0x04) && (rpc.RegionMask & 0x04) != 0x04) || - ((rpc.RegionMask & 0x08) == (cmi.RegionInformation & 0x08) && (rpc.RegionMask & 0x08) != 0x08) || - ((rpc.RegionMask & 0x10) == (cmi.RegionInformation & 0x10) && (rpc.RegionMask & 0x10) != 0x10) || - ((rpc.RegionMask & 0x20) == (cmi.RegionInformation & 0x20) && (rpc.RegionMask & 0x20) != 0x20) || - ((rpc.RegionMask & 0x40) == (cmi.RegionInformation & 0x40) && (rpc.RegionMask & 0x40) != 0x40) || - ((rpc.RegionMask & 0x80) == (cmi.RegionInformation & 0x80) && (rpc.RegionMask & 0x80) != 0x80); - } + return ((rpc.RegionMask & 0x01) == (cmi.RegionInformation & 0x01) && (rpc.RegionMask & 0x01) != 0x01) || + ((rpc.RegionMask & 0x02) == (cmi.RegionInformation & 0x02) && (rpc.RegionMask & 0x02) != 0x02) || + ((rpc.RegionMask & 0x04) == (cmi.RegionInformation & 0x04) && (rpc.RegionMask & 0x04) != 0x04) || + ((rpc.RegionMask & 0x08) == (cmi.RegionInformation & 0x08) && (rpc.RegionMask & 0x08) != 0x08) || + ((rpc.RegionMask & 0x10) == (cmi.RegionInformation & 0x10) && (rpc.RegionMask & 0x10) != 0x10) || + ((rpc.RegionMask & 0x20) == (cmi.RegionInformation & 0x20) && (rpc.RegionMask & 0x20) != 0x20) || + ((rpc.RegionMask & 0x40) == (cmi.RegionInformation & 0x40) && (rpc.RegionMask & 0x40) != 0x40) || + ((rpc.RegionMask & 0x80) == (cmi.RegionInformation & 0x80) && (rpc.RegionMask & 0x80) != 0x80); } } \ No newline at end of file diff --git a/DVD/Dump.cs b/DVD/Dump.cs index cb9b615c8..f600968fa 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -40,469 +40,468 @@ using Aaru.Console; using Aaru.Decoders.DVD; using Aaru.Devices; -namespace Aaru.Decryption.DVD +namespace Aaru.Decryption.DVD; + +public sealed class Dump { - public sealed class Dump + const byte KEY_SIZE = 5; + const byte CHALLENGE_SIZE = 2 * KEY_SIZE; + readonly Device _dev; + + public Dump(Device dev) { - const byte KEY_SIZE = 5; - const byte CHALLENGE_SIZE = 2 * KEY_SIZE; - readonly Device _dev; + _dev = dev; + BusKey = Array.Empty(); + Agid = 0; + } - public Dump(Device dev) - { - _dev = dev; - BusKey = Array.Empty(); - Agid = 0; - } + public byte Agid { get; private set; } + public byte[] BusKey { get; private set; } - public byte Agid { get; private set; } - public byte[] BusKey { get; private set; } + /// Returns the Authentication Success Flag of the logical unit. + /// true if the command failed and contains the sense buffer. + /// Buffer where the Authentication Success Flag will be stored. + /// Sense buffer. + /// Key class. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + public bool ReadAsf(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, + out double duration) + { + senseBuffer = new byte[64]; + byte[] cdb = new byte[12]; + buffer = new byte[8]; - /// Returns the Authentication Success Flag of the logical unit. - /// true if the command failed and contains the sense buffer. - /// Buffer where the Authentication Success Flag will be stored. - /// Sense buffer. - /// Key class. - /// Timeout in seconds. - /// Duration in milliseconds it took for the device to execute the command. - public bool ReadAsf(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, - out double duration) - { - senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; - buffer = new byte[8]; + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.Asf ^ ((Agid & 0x03) << 6)); - cdb[0] = (byte)ScsiCommands.ReportKey; - cdb[7] = (byte)keyClass; - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.Asf ^ ((Agid & 0x03) << 6)); + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); + AaruConsole.DebugWriteLine("SCSI Device", + "REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, + Agid, sense, _dev.LastError); - AaruConsole.DebugWriteLine("SCSI Device", - "REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, - Agid, sense, _dev.LastError); + return sense; + } - return sense; - } + /// Returns the Regional Playback Control State of the logical unit. + /// true if the command failed and contains the sense buffer. + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + public bool ReadRpc(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, + out double duration) + { + senseBuffer = new byte[64]; + byte[] cdb = new byte[12]; + buffer = new byte[8]; - /// Returns the Regional Playback Control State of the logical unit. - /// true if the command failed and contains the sense buffer. - /// Buffer where the Regional Playback Control State will be stored. - /// Sense buffer. - /// Key class. - /// Timeout in seconds. - /// Duration in milliseconds it took for the device to execute the command. - public bool ReadRpc(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, - out double duration) - { - senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; - buffer = new byte[8]; + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.RpcState ^ ((Agid & 0x03) << 6)); - cdb[0] = (byte)ScsiCommands.ReportKey; - cdb[7] = (byte)keyClass; - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.RpcState ^ ((Agid & 0x03) << 6)); + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); + AaruConsole.DebugWriteLine("SCSI Device", + "REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, + Agid, sense, _dev.LastError); - AaruConsole.DebugWriteLine("SCSI Device", - "REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, - Agid, sense, _dev.LastError); + return sense; + } - return sense; - } - - /// Invalidates an Authentication Grant ID. - /// Buffer where the Regional Playback Control State will be stored. - /// Sense buffer. - /// Key class. - /// Timeout in seconds. - /// Duration in milliseconds it took for the device to execute the command. - /// true if the command failed and contains the sense buffer. - public bool InvalidateAgid(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, - out double duration) - { - senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; - buffer = Array.Empty(); - - cdb[0] = (byte)ScsiCommands.ReportKey; - cdb[7] = (byte)keyClass; - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.InvalidateAgid ^ ((Agid & 0x03) << 6)); - - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); - - AaruConsole.DebugWriteLine("SCSI Device", - "INVALIDATE AGID (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", - duration, Agid, sense, _dev.LastError); - - return sense; - } - - /// Returns a valid Authentication Grant ID for CSS/CPPM. - /// Buffer where the Regional Playback Control State will be stored. - /// Sense buffer. - /// Key class. - /// Timeout in seconds. - /// Duration in milliseconds it took for the device to execute the command. - /// true if the command failed and contains the sense buffer. - public bool ReportAgidCssCppm(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, - out double duration) - { - senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; - buffer = new byte[8]; - - cdb[0] = (byte)ScsiCommands.ReportKey; - cdb[7] = (byte)keyClass; - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.AgidForCssCppm ^ ((Agid & 0x03) << 6)); - - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); - - AaruConsole.DebugWriteLine("SCSI Device", - "REPORT AGID CSS/CPPM (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", - duration, Agid, sense, _dev.LastError); - - return sense; - } - - /// Returns KEY1 from the logical unit. - /// Buffer where the Regional Playback Control State will be stored. - /// Sense buffer. - /// Key class. - /// Timeout in seconds. - /// Duration in milliseconds it took for the device to execute the command. - /// true if the command failed and contains the sense buffer. - public bool ReportKey1(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, + /// Invalidates an Authentication Grant ID. + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool InvalidateAgid(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, out double duration) + { + senseBuffer = new byte[64]; + byte[] cdb = new byte[12]; + buffer = Array.Empty(); + + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.InvalidateAgid ^ ((Agid & 0x03) << 6)); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "INVALIDATE AGID (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", + duration, Agid, sense, _dev.LastError); + + return sense; + } + + /// Returns a valid Authentication Grant ID for CSS/CPPM. + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool ReportAgidCssCppm(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, + out double duration) + { + senseBuffer = new byte[64]; + byte[] cdb = new byte[12]; + buffer = new byte[8]; + + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.AgidForCssCppm ^ ((Agid & 0x03) << 6)); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "REPORT AGID CSS/CPPM (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", + duration, Agid, sense, _dev.LastError); + + return sense; + } + + /// Returns KEY1 from the logical unit. + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool ReportKey1(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, + out double duration) + { + senseBuffer = new byte[64]; + byte[] cdb = new byte[12]; + buffer = new byte[12]; + + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.Key1 ^ ((Agid & 0x03) << 6)); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "REPORT KEY1 (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, + Agid, sense, _dev.LastError); + + return sense; + } + + /// Returns the challenge from the logical unit. + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool ReportChallenge(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, + out double duration) + { + senseBuffer = new byte[64]; + byte[] cdb = new byte[12]; + buffer = new byte[16]; + + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.ChallengeKey ^ ((Agid & 0x03) << 6)); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "REPORT CHALLENGE (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", + duration, Agid, sense, _dev.LastError); + + return sense; + } + + /// Send a challenge to the logical unit. + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// The challenge; can be any 10 bytes. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool SendChallenge(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, + byte[] challengeKey, uint timeout, out double duration) + { + senseBuffer = new byte[64]; + byte[] cdb = new byte[12]; + buffer = new byte[16]; + + cdb[0] = (byte)ScsiCommands.SendKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssSendKeyFormat.ChallengeKey ^ ((Agid & 0x03) << 6)); + buffer[0] = (byte)(((buffer.Length - 2) & 0xFF00) >> 8); + buffer[1] = (byte)((buffer.Length - 2) & 0xFF); + buffer[4] = challengeKey[9]; + buffer[5] = challengeKey[8]; + buffer[6] = challengeKey[7]; + buffer[7] = challengeKey[6]; + buffer[8] = challengeKey[5]; + buffer[9] = challengeKey[4]; + buffer[10] = challengeKey[3]; + buffer[11] = challengeKey[2]; + buffer[12] = challengeKey[1]; + buffer[13] = challengeKey[0]; + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "SEND CHALLENGE (AGID: {1}, Challenge {2}, Sense: {3}, Last Error: {4}) took {0} ms.", + duration, Agid, challengeKey, sense, _dev.LastError); + + return sense; + } + + /// Send KEY2 to the logical unit. + /// Buffer where the Regional Playback Control State will be stored. + /// Sense buffer. + /// Key class. + /// The KEY2 message. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool SendKey2(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, byte[] key2, + uint timeout, out double duration) + { + senseBuffer = new byte[64]; + byte[] cdb = new byte[12]; + buffer = new byte[12]; + + cdb[0] = (byte)ScsiCommands.SendKey; + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssSendKeyFormat.Key2 ^ ((Agid & 0x03) << 6)); + buffer[0] = (byte)(((buffer.Length - 2) & 0xFF00) >> 8); + buffer[1] = (byte)((buffer.Length - 2) & 0xFF); + buffer[4] = key2[4]; + buffer[5] = key2[3]; + buffer[6] = key2[2]; + buffer[7] = key2[1]; + buffer[8] = key2[0]; + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, + out bool sense); + + AaruConsole.DebugWriteLine("SCSI Device", + "SEND CHALLENGE (AGID: {1}, KEY2 {2}, Sense: {3}, Last Error: {4}) took {0} ms.", + duration, Agid, key2, sense, _dev.LastError); + + return sense; + } + + /// Returns the encrypted disc key of the MMC logical unit + /// true if the command failed and contains the sense buffer. + /// Buffer where the bus key will be stored + /// Sense buffer. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + public bool ReadDiscKey(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + { + senseBuffer = new byte[64]; + byte[] cdb = new byte[12]; + buffer = new byte[2052]; + + cdb[0] = (byte)ScsiCommands.ReadDiscStructure; + cdb[1] = (byte)MmcDiscStructureMediaType.Dvd & 0x0F; + cdb[6] = 0; + cdb[7] = (byte)MmcDiscStructureFormat.DiscKey; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((Agid & 0x03) << 6); + + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); + + return sense; + } + + /// Returns the bus key of the MMC logical unit + /// true if the command failed and contains the sense buffer. + /// Buffer where the bus key will be stored + /// Sense buffer. + /// The type of protection the logical unit reports + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + public bool ReadBusKey(out byte[] buffer, out byte[] senseBuffer, CopyrightType protectionType, uint timeout, + out double duration) + { + duration = 0; + buffer = Array.Empty(); + senseBuffer = new byte[64]; + + bool sense = false; + byte[] challenge = new byte[CHALLENGE_SIZE]; + byte[] key1 = new byte[KEY_SIZE]; + byte variant = 0; + + for(byte i = 0; i < 4; i++) { - senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; - buffer = new byte[12]; + // Invalidate AGID to reset any previous drive communications + Agid = i; - cdb[0] = (byte)ScsiCommands.ReportKey; - cdb[7] = (byte)keyClass; - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.Key1 ^ ((Agid & 0x03) << 6)); + sense = InvalidateAgid(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, + out duration); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); + // Get AGID + if(protectionType == CopyrightType.CSS) + { + sense = ReportAgidCssCppm(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, + out duration); + } - AaruConsole.DebugWriteLine("SCSI Device", - "REPORT KEY1 (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, - Agid, sense, _dev.LastError); + if(protectionType == CopyrightType.CPRM) + { + throw new NotImplementedException(); + } - return sense; + if(!sense) + { + Agid = (byte)(buffer[7] >> 6); + + break; + } } - /// Returns the challenge from the logical unit. - /// Buffer where the Regional Playback Control State will be stored. - /// Sense buffer. - /// Key class. - /// Timeout in seconds. - /// Duration in milliseconds it took for the device to execute the command. - /// true if the command failed and contains the sense buffer. - public bool ReportChallenge(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, uint timeout, - out double duration) + if(sense) { - senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; - buffer = new byte[16]; - - cdb[0] = (byte)ScsiCommands.ReportKey; - cdb[7] = (byte)keyClass; - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.ChallengeKey ^ ((Agid & 0x03) << 6)); - - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); - - AaruConsole.DebugWriteLine("SCSI Device", - "REPORT CHALLENGE (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", - duration, Agid, sense, _dev.LastError); - - return sense; + return true; } - /// Send a challenge to the logical unit. - /// Buffer where the Regional Playback Control State will be stored. - /// Sense buffer. - /// Key class. - /// The challenge; can be any 10 bytes. - /// Timeout in seconds. - /// Duration in milliseconds it took for the device to execute the command. - /// true if the command failed and contains the sense buffer. - public bool SendChallenge(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, - byte[] challengeKey, uint timeout, out double duration) + for(byte i = 0; i < CHALLENGE_SIZE; i++) + challenge[i] = i; + + sense = SendChallenge(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, challenge, timeout, + out duration); + + if(sense) { - senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; - buffer = new byte[16]; - - cdb[0] = (byte)ScsiCommands.SendKey; - cdb[7] = (byte)keyClass; - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssSendKeyFormat.ChallengeKey ^ ((Agid & 0x03) << 6)); - buffer[0] = (byte)(((buffer.Length - 2) & 0xFF00) >> 8); - buffer[1] = (byte)((buffer.Length - 2) & 0xFF); - buffer[4] = challengeKey[9]; - buffer[5] = challengeKey[8]; - buffer[6] = challengeKey[7]; - buffer[7] = challengeKey[6]; - buffer[8] = challengeKey[5]; - buffer[9] = challengeKey[4]; - buffer[10] = challengeKey[3]; - buffer[11] = challengeKey[2]; - buffer[12] = challengeKey[1]; - buffer[13] = challengeKey[0]; - - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, - out bool sense); - - AaruConsole.DebugWriteLine("SCSI Device", - "SEND CHALLENGE (AGID: {1}, Challenge {2}, Sense: {3}, Last Error: {4}) took {0} ms.", - duration, Agid, challengeKey, sense, _dev.LastError); - - return sense; + return true; } - /// Send KEY2 to the logical unit. - /// Buffer where the Regional Playback Control State will be stored. - /// Sense buffer. - /// Key class. - /// The KEY2 message. - /// Timeout in seconds. - /// Duration in milliseconds it took for the device to execute the command. - /// true if the command failed and contains the sense buffer. - public bool SendKey2(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, byte[] key2, + sense = ReportKey1(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, out duration); + + if(sense) + { + return true; + } + + for(byte i = 0; i < KEY_SIZE; i++) + key1[i] = buffer[8 - i]; + + for(byte i = 0; i < 32; i++) + { + CSS.EncryptKey(DvdCssKeyType.Key1, i, challenge, out byte[] keyCheck); + + if(key1.SequenceEqual(keyCheck)) + { + variant = i; + + break; + } + + if(i >= 31) + { + senseBuffer = Array.Empty(); + + return true; + } + } + + sense = ReportChallenge(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, + out duration); + + if(sense) + { + return true; + } + + for(byte i = 0; i < CHALLENGE_SIZE; i++) + challenge[i] = buffer[13 - i]; + + CSS.EncryptKey(DvdCssKeyType.Key2, variant, challenge, out byte[] key2); + + sense = SendKey2(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, key2, timeout, out duration); + + if(sense) + { + return true; + } + + key1.CopyTo(challenge, 0); + key2.CopyTo(challenge, key1.Length); + CSS.EncryptKey(DvdCssKeyType.BusKey, variant, challenge, out buffer); + + BusKey = buffer; + + return false; + } + + /// Reads a title key for a sector on the disc. + /// Buffer where the bus key will be stored + /// Sense buffer. + /// Key class. + /// The sector address to get the key for. + /// Timeout in seconds. + /// Duration in milliseconds it took for the device to execute the command. + /// true if the command failed and contains the sense buffer. + public bool ReadTitleKey(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, ulong address, uint timeout, out double duration) - { - senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; - buffer = new byte[12]; + { + // We need to be in a bus key state to read title keys. Only CSS has title keys. + ReadBusKey(out buffer, out senseBuffer, CopyrightType.CSS, timeout, out duration); - cdb[0] = (byte)ScsiCommands.SendKey; - cdb[7] = (byte)keyClass; - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssSendKeyFormat.Key2 ^ ((Agid & 0x03) << 6)); - buffer[0] = (byte)(((buffer.Length - 2) & 0xFF00) >> 8); - buffer[1] = (byte)((buffer.Length - 2) & 0xFF); - buffer[4] = key2[4]; - buffer[5] = key2[3]; - buffer[6] = key2[2]; - buffer[7] = key2[1]; - buffer[8] = key2[0]; + BusKey = buffer; - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, - out bool sense); + senseBuffer = new byte[64]; + byte[] cdb = new byte[12]; + buffer = new byte[12]; - AaruConsole.DebugWriteLine("SCSI Device", - "SEND CHALLENGE (AGID: {1}, KEY2 {2}, Sense: {3}, Last Error: {4}) took {0} ms.", - duration, Agid, key2, sense, _dev.LastError); + cdb[0] = (byte)ScsiCommands.ReportKey; + cdb[2] = (byte)((address & 0xFF000000) >> 24); + cdb[3] = (byte)((address & 0xFF0000) >> 16); + cdb[4] = (byte)((address & 0xFF00) >> 8); + cdb[5] = (byte)(address & 0xFF); + cdb[7] = (byte)keyClass; + cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); + cdb[9] = (byte)(buffer.Length & 0xFF); + cdb[10] = (byte)((byte)CssReportKeyFormat.TitleKey ^ ((Agid & 0x03) << 6)); - return sense; - } + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, + out bool sense); - /// Returns the encrypted disc key of the MMC logical unit - /// true if the command failed and contains the sense buffer. - /// Buffer where the bus key will be stored - /// Sense buffer. - /// Timeout in seconds. - /// Duration in milliseconds it took for the device to execute the command. - public bool ReadDiscKey(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) - { - senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; - buffer = new byte[2052]; + AaruConsole.DebugWriteLine("SCSI Device", "GET TITLE KEY (AGID: {1}, LBA: {2}, Sense: {3}) took {0} ms.", + duration, Agid, address, sense); - cdb[0] = (byte)ScsiCommands.ReadDiscStructure; - cdb[1] = (byte)MmcDiscStructureMediaType.Dvd & 0x0F; - cdb[6] = 0; - cdb[7] = (byte)MmcDiscStructureFormat.DiscKey; - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((Agid & 0x03) << 6); - - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); - - return sense; - } - - /// Returns the bus key of the MMC logical unit - /// true if the command failed and contains the sense buffer. - /// Buffer where the bus key will be stored - /// Sense buffer. - /// The type of protection the logical unit reports - /// Timeout in seconds. - /// Duration in milliseconds it took for the device to execute the command. - public bool ReadBusKey(out byte[] buffer, out byte[] senseBuffer, CopyrightType protectionType, uint timeout, - out double duration) - { - duration = 0; - buffer = Array.Empty(); - senseBuffer = new byte[64]; - - bool sense = false; - byte[] challenge = new byte[CHALLENGE_SIZE]; - byte[] key1 = new byte[KEY_SIZE]; - byte variant = 0; - - for(byte i = 0; i < 4; i++) - { - // Invalidate AGID to reset any previous drive communications - Agid = i; - - sense = InvalidateAgid(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, - out duration); - - // Get AGID - if(protectionType == CopyrightType.CSS) - { - sense = ReportAgidCssCppm(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, - out duration); - } - - if(protectionType == CopyrightType.CPRM) - { - throw new NotImplementedException(); - } - - if(!sense) - { - Agid = (byte)(buffer[7] >> 6); - - break; - } - } - - if(sense) - { - return true; - } - - for(byte i = 0; i < CHALLENGE_SIZE; i++) - challenge[i] = i; - - sense = SendChallenge(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, challenge, timeout, - out duration); - - if(sense) - { - return true; - } - - sense = ReportKey1(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, out duration); - - if(sense) - { - return true; - } - - for(byte i = 0; i < KEY_SIZE; i++) - key1[i] = buffer[8 - i]; - - for(byte i = 0; i < 32; i++) - { - CSS.EncryptKey(DvdCssKeyType.Key1, i, challenge, out byte[] keyCheck); - - if(key1.SequenceEqual(keyCheck)) - { - variant = i; - - break; - } - - if(i >= 31) - { - senseBuffer = Array.Empty(); - - return true; - } - } - - sense = ReportChallenge(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, - out duration); - - if(sense) - { - return true; - } - - for(byte i = 0; i < CHALLENGE_SIZE; i++) - challenge[i] = buffer[13 - i]; - - CSS.EncryptKey(DvdCssKeyType.Key2, variant, challenge, out byte[] key2); - - sense = SendKey2(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, key2, timeout, out duration); - - if(sense) - { - return true; - } - - key1.CopyTo(challenge, 0); - key2.CopyTo(challenge, key1.Length); - CSS.EncryptKey(DvdCssKeyType.BusKey, variant, challenge, out buffer); - - BusKey = buffer; - - return false; - } - - /// Reads a title key for a sector on the disc. - /// Buffer where the bus key will be stored - /// Sense buffer. - /// Key class. - /// The sector address to get the key for. - /// Timeout in seconds. - /// Duration in milliseconds it took for the device to execute the command. - /// true if the command failed and contains the sense buffer. - public bool ReadTitleKey(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, ulong address, - uint timeout, out double duration) - { - // We need to be in a bus key state to read title keys. Only CSS has title keys. - ReadBusKey(out buffer, out senseBuffer, CopyrightType.CSS, timeout, out duration); - - BusKey = buffer; - - senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; - buffer = new byte[12]; - - cdb[0] = (byte)ScsiCommands.ReportKey; - cdb[2] = (byte)((address & 0xFF000000) >> 24); - cdb[3] = (byte)((address & 0xFF0000) >> 16); - cdb[4] = (byte)((address & 0xFF00) >> 8); - cdb[5] = (byte)(address & 0xFF); - cdb[7] = (byte)keyClass; - cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); - cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.TitleKey ^ ((Agid & 0x03) << 6)); - - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); - - AaruConsole.DebugWriteLine("SCSI Device", "GET TITLE KEY (AGID: {1}, LBA: {2}, Sense: {3}) took {0} ms.", - duration, Agid, address, sense); - - return sense; - } + return sense; } } \ No newline at end of file diff --git a/Enums.cs b/Enums.cs index 947a5e238..dcf25baa0 100644 --- a/Enums.cs +++ b/Enums.cs @@ -1,12 +1,11 @@ -namespace Aaru.Decryption -{ - public enum DvdCssKeyClass : byte - { - DvdCssCppmOrCprm = 0, RewritableSecurityServicesA = 1 - } +namespace Aaru.Decryption; - public enum DvdCssKeyType - { - Key1 = 0, Key2 = 1, BusKey = 2 - } +public enum DvdCssKeyClass : byte +{ + DvdCssCppmOrCprm = 0, RewritableSecurityServicesA = 1 +} + +public enum DvdCssKeyType +{ + Key1 = 0, Key2 = 1, BusKey = 2 } \ No newline at end of file From 7d64becec8791e6f95cd3e62dd496f4406857795 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 7 Mar 2022 07:36:42 +0000 Subject: [PATCH 19/53] General cleanup and refactor. --- .editorconfig | 816 ++++++++++------------------------------- Aaru.Decryption.csproj | 116 +++--- DVD/CSS.cs | 106 +++--- DVD/Dump.cs | 107 ++---- Enums.cs | 7 +- 5 files changed, 355 insertions(+), 797 deletions(-) diff --git a/.editorconfig b/.editorconfig index 9181fe501..25aaa3207 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,632 +1,216 @@ -root = true - [*] charset = utf-8 -next_line = crlf +end_of_line = lf +trim_trailing_whitespace = false insert_final_newline = false indent_style = space indent_size = 4 -# Generic non-language specific ones for Resharper and friends -brace_style = next_line -int_align = true -keep_existing_arrangement = false -place_simple_blocks_on_single_line = true -place_simple_declaration_blocks_on_single_line = true -place_attribute_on_same_line = false -space_after_unary_operator = false -space_after_comma = true -space_around_ternary_operator = true -space_around_binary_operator = true -space_around_member_access_operator = false -space_before_open_square_brackets = false -space_after_keywords_in_control_flow_statements = true -space_before_comma = false -space_between_method_call_name_and_opening_parenthesis = false -space_between_method_declaration_name_and_open_parenthesis = false -space_between_square_brackets = false -space_between_parentheses_of_control_flow_statements = false -accessor_owner_declaration_braces = next_line -accessor_declaration_braces = next_line -case_block_braces = next_line -initializer_braces = next_line -other_braces = next_line -allow_comment_after_lbrace = false -empty_block_style = together_same_line -braces_for_ifelse = not_required -braces_for_for = not_required -braces_for_foreach = not_required -braces_for_while = not_required -braces_for_dowhile = not_required -braces_for_using = not_required -braces_for_lock = not_required -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. +# Microsoft .NET properties +csharp_new_line_between_query_expression_clauses = false +csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion +csharp_prefer_braces = false:warning +csharp_space_after_keywords_in_control_flow_statements = false +csharp_style_var_elsewhere = false:suggestion +csharp_style_var_for_built_in_types = false:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion +csharp_using_directive_placement = inside_namespace:silent +dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True +dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field +dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef +dotnet_naming_rule.unity_serialized_field_rule.severity = warning +dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style +dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols +dotnet_naming_rule.unity_serialized_field_rule_1.import_to_resharper = True +dotnet_naming_rule.unity_serialized_field_rule_1.resharper_description = Unity serialized field +dotnet_naming_rule.unity_serialized_field_rule_1.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef +dotnet_naming_rule.unity_serialized_field_rule_1.severity = warning +dotnet_naming_rule.unity_serialized_field_rule_1.style = lower_camel_case_style +dotnet_naming_rule.unity_serialized_field_rule_1.symbols = unity_serialized_field_symbols_1 +dotnet_naming_style.lower_camel_case_style.capitalization = camel_case +dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = * +dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds = +dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field +dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance +dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_accessibilities = * +dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_kinds = +dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_applicable_kinds = unity_serialised_field +dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_required_modifiers = instance +dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:warning +dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:warning +dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:warning dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion dotnet_style_predefined_type_for_member_access = true:suggestion - -# This controls implicit access modifiers +dotnet_style_qualification_for_event = false:suggestion +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 -# Prefer non modified fields to be marked readonly -dotnet_style_readonly_field = true:warning +# ReSharper properties +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 -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_operators = always_for_clarity:warning +# ReSharper inspection severities +resharper_annotate_can_be_null_parameter_highlighting = warning +resharper_annotate_can_be_null_type_member_highlighting = warning +resharper_annotate_not_null_parameter_highlighting = 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 -dotnet_style_collection_initializer = true:suggestion -dotnet_style_explicit_tuple_names = true:error -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 +[{*.har,*.inputactions,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config}] +indent_style = space +indent_size = 2 -dotnet_sort_system_directives_first = true +[{*.yaml,*.yml,.analysis_options}] +indent_style = space +indent_size = 2 -# Constants in C style, all-caps -dotnet_naming_rule.constant_fields_caps.symbols = constant_fields -dotnet_naming_rule.constant_fields_caps.severity = warning -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 +[*.csv] +indent_style = tab +tab_width = 1 -# interfaces should be prefixed with I -dotnet_naming_rule.pascal_case_for_interface.severity = error -dotnet_naming_rule.pascal_case_for_interface.symbols = interfaces_fields -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 +[{*.bash,*.sh,*.tool,*.zsh}] +indent_style = space +indent_size = 2 -## internal and private fields should be _camelCase -dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning -dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields -dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style -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 \ No newline at end of file +[*.{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}] +indent_style = space +indent_size = 4 +tab_width = 4 diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index 8112c1faf..c5d680ea1 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -1,63 +1,63 @@ - - Debug - AnyCPU - 2.0 - Library - Aaru.Decryption - Aaru.Decryption - $(Version) - true - 6.0.0-alpha8 - Claunia.com - Copyright © 2011-2022 Natalia Portillo - Aaru Data Preservation Suite - Aaru.Decryption - $(Version) - net6 - 10 - Decryption algorithms used by the Aaru Data Preservation Suite. - https://github.com/aaru-dps/ - MIT - https://github.com/aaru-dps/Aaru.Decryption - true - en-US - true - true - snupkg - Rebecca Wallander <sakcheen@gmail.com> - enable - true - - - $(Version)+{chash:8} - true - true - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - - - full - true - bin\Release - prompt - 4 - false - + + Debug + AnyCPU + 2.0 + Library + Aaru.Decryption + Aaru.Decryption + $(Version) + true + 6.0.0-alpha8 + Claunia.com + Copyright © 2011-2022 Natalia Portillo + Aaru Data Preservation Suite + Aaru.Decryption + $(Version) + net6 + 10 + Decryption algorithms used by the Aaru Data Preservation Suite. + https://github.com/aaru-dps/ + MIT + https://github.com/aaru-dps/Aaru.Decryption + true + en-US + true + true + snupkg + Rebecca Wallander <sakcheen@gmail.com> + enable + true + + + $(Version)+{chash:8} + true + true + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + - - - - - + + + + + diff --git a/DVD/CSS.cs b/DVD/CSS.cs index 4382d672b..3da1f517a 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -34,9 +34,7 @@ // Copyright © 2020-2022 Rebecca Wallander // ****************************************************************************/ -using System; -using System.Linq; -using Aaru.Decoders.DVD; + // Based on information gathered from: // ISO/IEC13818-1 Second Edition @@ -49,6 +47,10 @@ using Aaru.Decoders.DVD; namespace Aaru.Decryption.DVD; +using System; +using System.Linq; +using Aaru.Decoders.DVD; + public class CSS { static readonly byte[,] _playerKeys = @@ -350,12 +352,12 @@ public class CSS static readonly byte[,] _permutationVariant = { { - 0x0a, 0x08, 0x0e, 0x0c, 0x0b, 0x09, 0x0f, 0x0d, 0x1a, 0x18, 0x1e, 0x1c, 0x1b, 0x19, 0x1f, 0x1d, 0x02, - 0x00, 0x06, 0x04, 0x03, 0x01, 0x07, 0x05, 0x12, 0x10, 0x16, 0x14, 0x13, 0x11, 0x17, 0x15 + 0x0a, 0x08, 0x0e, 0x0c, 0x0b, 0x09, 0x0f, 0x0d, 0x1a, 0x18, 0x1e, 0x1c, 0x1b, 0x19, 0x1f, 0x1d, 0x02, 0x00, + 0x06, 0x04, 0x03, 0x01, 0x07, 0x05, 0x12, 0x10, 0x16, 0x14, 0x13, 0x11, 0x17, 0x15 }, { - 0x12, 0x1a, 0x16, 0x1e, 0x02, 0x0a, 0x06, 0x0e, 0x10, 0x18, 0x14, 0x1c, 0x00, 0x08, 0x04, 0x0c, 0x13, - 0x1b, 0x17, 0x1f, 0x03, 0x0b, 0x07, 0x0f, 0x11, 0x19, 0x15, 0x1d, 0x01, 0x09, 0x05, 0x0d + 0x12, 0x1a, 0x16, 0x1e, 0x02, 0x0a, 0x06, 0x0e, 0x10, 0x18, 0x14, 0x1c, 0x00, 0x08, 0x04, 0x0c, 0x13, 0x1b, + 0x17, 0x1f, 0x03, 0x0b, 0x07, 0x0f, 0x11, 0x19, 0x15, 0x1d, 0x01, 0x09, 0x05, 0x0d } }; @@ -386,7 +388,7 @@ public class CSS byte[] key = response.Skip(4).Take(2048).ToArray(); for(uint i = 0; i < key.Length; i++) - key[i] ^= busKey[4 - (i % busKey.Length)]; + key[i] ^= busKey[4 - i % busKey.Length]; return new CSS_CPRM.DiscKey { @@ -413,7 +415,7 @@ public class CSS byte[] key = response.Skip(5).Take(5).ToArray(); for(uint i = 0; i < key.Length; i++) - key[i] ^= busKey[4 - (i % busKey.Length)]; + key[i] ^= busKey[4 - i % busKey.Length]; return new CSS_CPRM.TitleKey { @@ -435,38 +437,38 @@ public class CSS /// The encrypted key. public static void EncryptKey(DvdCssKeyType keyType, uint variant, byte[] challenge, out byte[] key) { - byte[] bits = new byte[30]; - byte[] scratch = new byte[10]; - byte index = sizeof(byte) * 30; - byte[] temp1 = new byte[5]; - byte[] temp2 = new byte[5]; - byte carry = 0; + var bits = new byte[30]; + var scratch = new byte[10]; + byte index = sizeof(byte) * 30; + var temp1 = new byte[5]; + var temp2 = new byte[5]; + byte carry = 0; key = new byte[5]; - for(int i = 9; i >= 0; --i) + for(var i = 9; i >= 0; --i) scratch[i] = challenge[_permutationChallenge[(uint)keyType, i]]; - byte cssVariant = (byte)(keyType == 0 ? variant : _permutationVariant[(uint)keyType - 1, variant]); + var cssVariant = (byte)(keyType == 0 ? variant : _permutationVariant[(uint)keyType - 1, variant]); - for(int i = 5; --i >= 0;) + for(var i = 5; --i >= 0;) temp1[i] = (byte)(scratch[5 + i] ^ _secret[i] ^ _encryptTable2[i]); - uint lfsr0 = (uint)((temp1[0] << 17) | (temp1[1] << 9) | ((temp1[2] & ~7) << 1) | 8 | (temp1[2] & 7)); - uint lfsr1 = (uint)((temp1[3] << 9) | 0x100 | temp1[4]); + var lfsr0 = (uint)((temp1[0] << 17) | (temp1[1] << 9) | ((temp1[2] & ~7) << 1) | 8 | (temp1[2] & 7)); + var lfsr1 = (uint)((temp1[3] << 9) | 0x100 | temp1[4]); do { byte val = 0; - for(int bit = 0; bit < 8; ++bit) + for(var bit = 0; bit < 8; ++bit) { - byte oLfsr0 = (byte)(((lfsr0 >> 24) ^ (lfsr0 >> 21) ^ (lfsr0 >> 20) ^ (lfsr0 >> 12)) & 1); + var oLfsr0 = (byte)(((lfsr0 >> 24) ^ (lfsr0 >> 21) ^ (lfsr0 >> 20) ^ (lfsr0 >> 12)) & 1); lfsr0 = (lfsr0 << 1) | oLfsr0; - byte oLfsr1 = (byte)(((lfsr1 >> 16) ^ (lfsr1 >> 2)) & 1); + var oLfsr1 = (byte)(((lfsr1 >> 16) ^ (lfsr1 >> 2)) & 1); lfsr1 = (lfsr1 << 1) | oLfsr1; - byte combined = (byte)(Convert.ToByte(oLfsr1 == 0) + carry + Convert.ToByte(oLfsr0 == 0)); + var combined = (byte)(Convert.ToByte(oLfsr1 == 0) + carry + Convert.ToByte(oLfsr0 == 0)); carry = (byte)((combined >> 1) & 1); val |= (byte)((combined & 1) << bit); } @@ -474,10 +476,10 @@ public class CSS bits[--index] = val; } while(index > 0); - byte cse = (byte)(_variants[cssVariant] ^ _encryptTable2[cssVariant]); - int term = 0; + var cse = (byte)(_variants[cssVariant] ^ _encryptTable2[cssVariant]); + var term = 0; - for(int i = 5; --i >= 0; term = scratch[i]) + for(var i = 5; --i >= 0; term = scratch[i]) { index = (byte)(bits[25 + i] ^ scratch[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -488,7 +490,7 @@ public class CSS temp1[4] ^= temp1[0]; term = 0; - for(int i = 5; --i >= 0; term = temp1[i]) + for(var i = 5; --i >= 0; term = temp1[i]) { index = (byte)(bits[20 + i] ^ temp1[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -499,7 +501,7 @@ public class CSS temp2[4] ^= temp2[0]; term = 0; - for(int i = 5; --i >= 0; term = temp2[i]) + for(var i = 5; --i >= 0; term = temp2[i]) { index = (byte)(bits[15 + i] ^ temp2[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -511,7 +513,7 @@ public class CSS temp1[4] ^= temp1[0]; term = 0; - for(int i = 5; --i >= 0; term = temp1[i]) + for(var i = 5; --i >= 0; term = temp1[i]) { index = (byte)(bits[10 + i] ^ temp1[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -523,7 +525,7 @@ public class CSS temp2[4] ^= temp2[0]; term = 0; - for(int i = 5; --i >= 0; term = temp2[i]) + for(var i = 5; --i >= 0; term = temp2[i]) { index = (byte)(bits[5 + i] ^ temp2[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -534,7 +536,7 @@ public class CSS temp1[4] ^= temp1[0]; term = 0; - for(int i = 5; --i >= 0; term = temp1[i]) + for(var i = 5; --i >= 0; term = temp1[i]) { index = (byte)(bits[i] ^ temp1[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -551,13 +553,12 @@ public class CSS public static void DecryptKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) { decryptedKey = new byte[5]; - byte[] k = new byte[5]; + var k = new byte[5]; - uint lfsr1Lo = (uint)(cryptoKey[0] | 0x100); + var lfsr1Lo = (uint)(cryptoKey[0] | 0x100); uint lfsr1Hi = cryptoKey[1]; - uint lfsr0 = (uint)(((cryptoKey[4] << 17) | (cryptoKey[3] << 9) | (cryptoKey[2] << 1)) + 8 - - (cryptoKey[2] & 7)); + var lfsr0 = (uint)(((cryptoKey[4] << 17) | (cryptoKey[3] << 9) | (cryptoKey[2] << 1)) + 8 - (cryptoKey[2] & 7)); lfsr0 = (uint)((_cssTable4[lfsr0 & 0xff] << 24) | (_cssTable4[(lfsr0 >> 8) & 0xff] << 16) | (_cssTable4[(lfsr0 >> 16) & 0xff] << 8) | _cssTable4[(lfsr0 >> 24) & 0xff]); @@ -566,11 +567,11 @@ public class CSS for(uint i = 0; i < 5; i++) { - byte oLfsr1 = (byte)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); + var oLfsr1 = (byte)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); lfsr1Hi = lfsr1Lo >> 1; lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; oLfsr1 = _cssTable4[oLfsr1]; - byte oLfsr0 = (byte)(((((((lfsr0 >> 8) ^ lfsr0) >> 1) ^ lfsr0) >> 3) ^ lfsr0) >> 7); + var oLfsr0 = (byte)(((((((lfsr0 >> 8) ^ lfsr0) >> 1) ^ lfsr0) >> 3) ^ lfsr0) >> 7); lfsr0 = (lfsr0 >> 8) | ((uint)oLfsr0 << 24); combined += (uint)((oLfsr0 ^ invert) + oLfsr1); k[i] = (byte)(combined & 0xff); @@ -590,8 +591,7 @@ public class CSS decryptedKey[0] = (byte)(k[0] ^ _cssTable1[decryptedKey[0]]); } - public static void - DecryptTitleKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) => + public static void DecryptTitleKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) => DecryptKey(invert, cryptoKey, encryptedKey, out decryptedKey); /// Takes an bytearray of encrypted keys, decrypts them and returns the correctly decrypted key. @@ -616,9 +616,7 @@ public class CSS DecryptKey(0, decryptedKey, verificationKey, out byte[] verify); if(decryptedKey.SequenceEqual(verify)) - { return; - } } } @@ -640,7 +638,7 @@ public class CSS keyData.All(k => k == 0)) return sectorData; - byte[] decryptedBuffer = new byte[sectorData.Length]; + var decryptedBuffer = new byte[sectorData.Length]; for(uint j = 0; j < blocks; j++) { @@ -663,11 +661,11 @@ public class CSS uint lfsr1Lo = (uint)(currentKey[0] ^ currentSector[0x54]) | 0x100; uint lfsr1Hi = (uint)currentKey[1] ^ currentSector[0x55]; - uint lfsr0 = (uint)((currentKey[2] | (currentKey[3] << 8) | (currentKey[4] << 16)) ^ - (sectorData[0x56] | (sectorData[0x57] << 8) | (sectorData[0x58] << 16))); + var lfsr0 = (uint)((currentKey[2] | (currentKey[3] << 8) | (currentKey[4] << 16)) ^ + (sectorData[0x56] | (sectorData[0x57] << 8) | (sectorData[0x58] << 16))); uint oLfsr1 = lfsr0 & 7; - lfsr0 = (lfsr0 * 2) + 8 - oLfsr1; + lfsr0 = lfsr0 * 2 + 8 - oLfsr1; uint combined = 0; @@ -703,13 +701,13 @@ public class CSS cmi.RegionInformation == 0x00) return true; - return ((rpc.RegionMask & 0x01) == (cmi.RegionInformation & 0x01) && (rpc.RegionMask & 0x01) != 0x01) || - ((rpc.RegionMask & 0x02) == (cmi.RegionInformation & 0x02) && (rpc.RegionMask & 0x02) != 0x02) || - ((rpc.RegionMask & 0x04) == (cmi.RegionInformation & 0x04) && (rpc.RegionMask & 0x04) != 0x04) || - ((rpc.RegionMask & 0x08) == (cmi.RegionInformation & 0x08) && (rpc.RegionMask & 0x08) != 0x08) || - ((rpc.RegionMask & 0x10) == (cmi.RegionInformation & 0x10) && (rpc.RegionMask & 0x10) != 0x10) || - ((rpc.RegionMask & 0x20) == (cmi.RegionInformation & 0x20) && (rpc.RegionMask & 0x20) != 0x20) || - ((rpc.RegionMask & 0x40) == (cmi.RegionInformation & 0x40) && (rpc.RegionMask & 0x40) != 0x40) || - ((rpc.RegionMask & 0x80) == (cmi.RegionInformation & 0x80) && (rpc.RegionMask & 0x80) != 0x80); + return (rpc.RegionMask & 0x01) == (cmi.RegionInformation & 0x01) && (rpc.RegionMask & 0x01) != 0x01 || + (rpc.RegionMask & 0x02) == (cmi.RegionInformation & 0x02) && (rpc.RegionMask & 0x02) != 0x02 || + (rpc.RegionMask & 0x04) == (cmi.RegionInformation & 0x04) && (rpc.RegionMask & 0x04) != 0x04 || + (rpc.RegionMask & 0x08) == (cmi.RegionInformation & 0x08) && (rpc.RegionMask & 0x08) != 0x08 || + (rpc.RegionMask & 0x10) == (cmi.RegionInformation & 0x10) && (rpc.RegionMask & 0x10) != 0x10 || + (rpc.RegionMask & 0x20) == (cmi.RegionInformation & 0x20) && (rpc.RegionMask & 0x20) != 0x20 || + (rpc.RegionMask & 0x40) == (cmi.RegionInformation & 0x40) && (rpc.RegionMask & 0x40) != 0x40 || + (rpc.RegionMask & 0x80) == (cmi.RegionInformation & 0x80) && (rpc.RegionMask & 0x80) != 0x80; } } \ No newline at end of file diff --git a/DVD/Dump.cs b/DVD/Dump.cs index f600968fa..9a6e09540 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -34,14 +34,14 @@ // Copyright © 2020-2022 Rebecca Wallander // ****************************************************************************/ +namespace Aaru.Decryption.DVD; + using System; using System.Linq; using Aaru.Console; using Aaru.Decoders.DVD; using Aaru.Devices; -namespace Aaru.Decryption.DVD; - public sealed class Dump { const byte KEY_SIZE = 5; @@ -69,7 +69,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -78,12 +78,10 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.Asf ^ ((Agid & 0x03) << 6)); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", - "REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, - Agid, sense, _dev.LastError); + AaruConsole.DebugWriteLine("SCSI Device", "REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", + duration, Agid, sense, _dev.LastError); return sense; } @@ -99,7 +97,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -108,12 +106,10 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.RpcState ^ ((Agid & 0x03) << 6)); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", - "REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, - Agid, sense, _dev.LastError); + AaruConsole.DebugWriteLine("SCSI Device", "REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", + duration, Agid, sense, _dev.LastError); return sense; } @@ -129,7 +125,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.ReportKey; @@ -138,12 +134,11 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.InvalidateAgid ^ ((Agid & 0x03) << 6)); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); AaruConsole.DebugWriteLine("SCSI Device", - "INVALIDATE AGID (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", - duration, Agid, sense, _dev.LastError); + "INVALIDATE AGID (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, + Agid, sense, _dev.LastError); return sense; } @@ -159,7 +154,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -168,8 +163,7 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.AgidForCssCppm ^ ((Agid & 0x03) << 6)); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); AaruConsole.DebugWriteLine("SCSI Device", "REPORT AGID CSS/CPPM (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", @@ -189,7 +183,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[12]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -198,12 +192,10 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.Key1 ^ ((Agid & 0x03) << 6)); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", - "REPORT KEY1 (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, - Agid, sense, _dev.LastError); + AaruConsole.DebugWriteLine("SCSI Device", "REPORT KEY1 (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", + duration, Agid, sense, _dev.LastError); return sense; } @@ -219,7 +211,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[16]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -228,12 +220,11 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.ChallengeKey ^ ((Agid & 0x03) << 6)); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); AaruConsole.DebugWriteLine("SCSI Device", - "REPORT CHALLENGE (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", - duration, Agid, sense, _dev.LastError); + "REPORT CHALLENGE (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, + Agid, sense, _dev.LastError); return sense; } @@ -246,11 +237,11 @@ public sealed class Dump /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// true if the command failed and contains the sense buffer. - public bool SendChallenge(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, - byte[] challengeKey, uint timeout, out double duration) + public bool SendChallenge(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, byte[] challengeKey, + uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[16]; cdb[0] = (byte)ScsiCommands.SendKey; @@ -289,11 +280,11 @@ public sealed class Dump /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// true if the command failed and contains the sense buffer. - public bool SendKey2(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, byte[] key2, - uint timeout, out double duration) + public bool SendKey2(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, byte[] key2, uint timeout, + out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[12]; cdb[0] = (byte)ScsiCommands.SendKey; @@ -328,7 +319,7 @@ public sealed class Dump public bool ReadDiscKey(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[2052]; cdb[0] = (byte)ScsiCommands.ReadDiscStructure; @@ -339,8 +330,7 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((Agid & 0x03) << 6); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); return sense; } @@ -359,30 +349,25 @@ public sealed class Dump buffer = Array.Empty(); senseBuffer = new byte[64]; - bool sense = false; - byte[] challenge = new byte[CHALLENGE_SIZE]; - byte[] key1 = new byte[KEY_SIZE]; - byte variant = 0; + var sense = false; + var challenge = new byte[CHALLENGE_SIZE]; + var key1 = new byte[KEY_SIZE]; + byte variant = 0; for(byte i = 0; i < 4; i++) { // Invalidate AGID to reset any previous drive communications Agid = i; - sense = InvalidateAgid(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, - out duration); + sense = InvalidateAgid(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, out duration); // Get AGID if(protectionType == CopyrightType.CSS) - { sense = ReportAgidCssCppm(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, out duration); - } if(protectionType == CopyrightType.CPRM) - { throw new NotImplementedException(); - } if(!sense) { @@ -393,9 +378,7 @@ public sealed class Dump } if(sense) - { return true; - } for(byte i = 0; i < CHALLENGE_SIZE; i++) challenge[i] = i; @@ -404,16 +387,12 @@ public sealed class Dump out duration); if(sense) - { return true; - } sense = ReportKey1(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, out duration); if(sense) - { return true; - } for(byte i = 0; i < KEY_SIZE; i++) key1[i] = buffer[8 - i]; @@ -437,13 +416,10 @@ public sealed class Dump } } - sense = ReportChallenge(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, - out duration); + sense = ReportChallenge(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, out duration); if(sense) - { return true; - } for(byte i = 0; i < CHALLENGE_SIZE; i++) challenge[i] = buffer[13 - i]; @@ -453,9 +429,7 @@ public sealed class Dump sense = SendKey2(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, key2, timeout, out duration); if(sense) - { return true; - } key1.CopyTo(challenge, 0); key2.CopyTo(challenge, key1.Length); @@ -483,7 +457,7 @@ public sealed class Dump BusKey = buffer; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[12]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -496,8 +470,7 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.TitleKey ^ ((Agid & 0x03) << 6)); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, - out bool sense); + _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); AaruConsole.DebugWriteLine("SCSI Device", "GET TITLE KEY (AGID: {1}, LBA: {2}, Sense: {3}) took {0} ms.", duration, Agid, address, sense); diff --git a/Enums.cs b/Enums.cs index dcf25baa0..ae59bb14f 100644 --- a/Enums.cs +++ b/Enums.cs @@ -2,10 +2,13 @@ namespace Aaru.Decryption; public enum DvdCssKeyClass : byte { - DvdCssCppmOrCprm = 0, RewritableSecurityServicesA = 1 + DvdCssCppmOrCprm = 0, + RewritableSecurityServicesA = 1 } public enum DvdCssKeyType { - Key1 = 0, Key2 = 1, BusKey = 2 + Key1 = 0, + Key2 = 1, + BusKey = 2 } \ No newline at end of file From cdeb6bd0cf3e197d1e9cb78ead53dd2ff6f64373 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 16 Mar 2022 11:46:59 +0000 Subject: [PATCH 20/53] Use merge pattern. --- DVD/CSS.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/DVD/CSS.cs b/DVD/CSS.cs index 3da1f517a..66ce1d48a 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -34,8 +34,6 @@ // Copyright © 2020-2022 Rebecca Wallander // ****************************************************************************/ - - // Based on information gathered from: // ISO/IEC13818-1 Second Edition // Mt. Fuji Commands for Multimedia Devices @@ -697,8 +695,7 @@ public class CSS public static bool CheckRegion(CSS_CPRM.RegionalPlaybackControlState rpc, CSS_CPRM.LeadInCopyright cmi) { // if disc region is all or none, we cannot do anything but try to read it as is - if(cmi.RegionInformation == 0xFF || - cmi.RegionInformation == 0x00) + if(cmi.RegionInformation is 0xFF or 0x00) return true; return (rpc.RegionMask & 0x01) == (cmi.RegionInformation & 0x01) && (rpc.RegionMask & 0x01) != 0x01 || From 5bb198ff96fb64a6d5bf0b35525d8bbfebe2947f Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 18 Apr 2022 09:45:17 +0100 Subject: [PATCH 21/53] Fix .NET 6 TFM. --- Aaru.Decryption.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index c5d680ea1..872099f58 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -15,7 +15,7 @@ Aaru Data Preservation Suite Aaru.Decryption $(Version) - net6 + net6.0 10 Decryption algorithms used by the Aaru Data Preservation Suite. https://github.com/aaru-dps/ From 228a3eda3585d4e107a21f827f6156d33a1ed451 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 13 Nov 2022 12:46:17 +0000 Subject: [PATCH 22/53] Bump framework to .NET 7 --- Aaru.Decryption.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index 872099f58..958078d7f 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -15,7 +15,7 @@ Aaru Data Preservation Suite Aaru.Decryption $(Version) - net6.0 + net7.0 10 Decryption algorithms used by the Aaru Data Preservation Suite. https://github.com/aaru-dps/ From f904c80627b3e1dc5e08abed392de9617022442f Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 13 Nov 2022 12:48:41 +0000 Subject: [PATCH 23/53] Bump C# to 11.0. --- Aaru.Decryption.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index 958078d7f..f1b78a0bc 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -16,7 +16,7 @@ Aaru.Decryption $(Version) net7.0 - 10 + 11 Decryption algorithms used by the Aaru Data Preservation Suite. https://github.com/aaru-dps/ MIT From 91abff46953f5bf774032dee3a7893b3a3b53e10 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 13 Nov 2022 13:19:56 +0000 Subject: [PATCH 24/53] Ignore XML comment warnings when building in DEBUG. --- Aaru.Decryption.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index f1b78a0bc..ad90ff757 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -30,6 +30,9 @@ enable true + + CS1591;CS1574 + $(Version)+{chash:8} true From 0a9f3e6f7893ccd6230f861bad8a07b9260de81a Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 13 Nov 2022 13:32:00 +0000 Subject: [PATCH 25/53] Remove output configuration from projects. --- Aaru.Decryption.csproj | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index ad90ff757..3519d6fbe 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -38,24 +38,6 @@ true true - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - - - full - true - bin\Release - prompt - 4 - false - From 2e50c6eb108004b1417687fdad504e42dad2b3d3 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 13 Nov 2022 13:38:03 +0000 Subject: [PATCH 26/53] Remove useless parameters in projects. --- Aaru.Decryption.csproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index 3519d6fbe..a90603b01 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -1,8 +1,6 @@ - Debug - AnyCPU 2.0 Library Aaru.Decryption From 633a1788603cc21237d60425a569fe1a3f8c278b Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 13 Nov 2022 16:38:16 +0000 Subject: [PATCH 27/53] Make classes visible to tests. --- Aaru.Decryption.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index a90603b01..ffcbdc7e3 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -31,6 +31,10 @@ CS1591;CS1574 + + + + $(Version)+{chash:8} true From 9ca111c2e45f4bad2f336aeb4fd720c530e8fdde Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 13 Nov 2022 17:13:09 +0000 Subject: [PATCH 28/53] Enable trim analyzer. --- Aaru.Decryption.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index ffcbdc7e3..100547db3 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -27,6 +27,7 @@ Rebecca Wallander <sakcheen@gmail.com> enable true + true CS1591;CS1574 From 603379482318d1a4fdcdfa5591f2a409c229b122 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 13 Nov 2022 19:38:01 +0000 Subject: [PATCH 29/53] Convert if to switch statement. --- DVD/Dump.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/DVD/Dump.cs b/DVD/Dump.cs index 9a6e09540..a333b5a0c 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -361,13 +361,16 @@ public sealed class Dump sense = InvalidateAgid(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, out duration); - // Get AGID - if(protectionType == CopyrightType.CSS) - sense = ReportAgidCssCppm(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, - out duration); + switch(protectionType) + { + // Get AGID + case CopyrightType.CSS: + sense = ReportAgidCssCppm(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, + out duration); - if(protectionType == CopyrightType.CPRM) - throw new NotImplementedException(); + break; + case CopyrightType.CPRM: throw new NotImplementedException(); + } if(!sense) { From 2a6ca74a7855a04f902c37d669af8d5e39708163 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 13 Nov 2022 21:14:17 +0000 Subject: [PATCH 30/53] Invert 'if' statements to reduce nesting. --- DVD/Dump.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/DVD/Dump.cs b/DVD/Dump.cs index a333b5a0c..64bdec115 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -372,12 +372,12 @@ public sealed class Dump case CopyrightType.CPRM: throw new NotImplementedException(); } - if(!sense) - { - Agid = (byte)(buffer[7] >> 6); + if(sense) + continue; - break; - } + Agid = (byte)(buffer[7] >> 6); + + break; } if(sense) @@ -411,12 +411,12 @@ public sealed class Dump break; } - if(i >= 31) - { - senseBuffer = Array.Empty(); + if(i < 31) + continue; - return true; - } + senseBuffer = Array.Empty(); + + return true; } sense = ReportChallenge(out buffer, out senseBuffer, DvdCssKeyClass.DvdCssCppmOrCprm, timeout, out duration); From 42e2251131e26f1fa0afa2f0ab9335c5032d5910 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 15 Nov 2022 15:57:59 +0000 Subject: [PATCH 31/53] Fix editorconfig. --- .editorconfig | 815 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 615 insertions(+), 200 deletions(-) diff --git a/.editorconfig b/.editorconfig index 25aaa3207..7586c80d3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,216 +1,631 @@ [*] charset = utf-8 -end_of_line = lf -trim_trailing_whitespace = false +next_line = crlf insert_final_newline = false indent_style = space indent_size = 4 -# Microsoft .NET properties -csharp_new_line_between_query_expression_clauses = false -csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion -csharp_prefer_braces = false:warning -csharp_space_after_keywords_in_control_flow_statements = false -csharp_style_var_elsewhere = false:suggestion -csharp_style_var_for_built_in_types = false:suggestion -csharp_style_var_when_type_is_apparent = true:suggestion -csharp_using_directive_placement = inside_namespace:silent -dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True -dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field -dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef -dotnet_naming_rule.unity_serialized_field_rule.severity = warning -dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style -dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols -dotnet_naming_rule.unity_serialized_field_rule_1.import_to_resharper = True -dotnet_naming_rule.unity_serialized_field_rule_1.resharper_description = Unity serialized field -dotnet_naming_rule.unity_serialized_field_rule_1.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef -dotnet_naming_rule.unity_serialized_field_rule_1.severity = warning -dotnet_naming_rule.unity_serialized_field_rule_1.style = lower_camel_case_style -dotnet_naming_rule.unity_serialized_field_rule_1.symbols = unity_serialized_field_symbols_1 -dotnet_naming_style.lower_camel_case_style.capitalization = camel_case -dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = * -dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds = -dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field -dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance -dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_accessibilities = * -dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_kinds = -dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_applicable_kinds = unity_serialised_field -dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_required_modifiers = instance -dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:warning -dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:warning -dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:warning +# Generic non-language specific ones for Resharper and friends +brace_style = next_line +int_align = true +keep_existing_arrangement = false +place_simple_blocks_on_single_line = true +place_simple_declaration_blocks_on_single_line = true +place_attribute_on_same_line = false +space_after_unary_operator = false +space_after_comma = true +space_around_ternary_operator = true +space_around_binary_operator = true +space_around_member_access_operator = false +space_before_open_square_brackets = false +space_after_keywords_in_control_flow_statements = true +space_before_comma = false +space_between_method_call_name_and_opening_parenthesis = false +space_between_method_declaration_name_and_open_parenthesis = false +space_between_square_brackets = false +space_between_parentheses_of_control_flow_statements = false +accessor_owner_declaration_braces = next_line +accessor_declaration_braces = next_line +case_block_braces = next_line +initializer_braces = next_line +other_braces = next_line +allow_comment_after_lbrace = false +empty_block_style = together_same_line +braces_for_ifelse = not_required +braces_for_for = not_required +braces_for_foreach = not_required +braces_for_while = not_required +braces_for_dowhile = not_required +braces_for_using = not_required +braces_for_lock = not_required +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_member_access = true:suggestion -dotnet_style_qualification_for_event = false:suggestion -dotnet_style_qualification_for_field = false:suggestion -dotnet_style_qualification_for_method = false:suggestion -dotnet_style_qualification_for_property = false:suggestion + +# This controls implicit access modifiers dotnet_style_require_accessibility_modifiers = never:suggestion -# ReSharper properties -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 +# Prefer non modified fields to be marked readonly +dotnet_style_readonly_field = true:warning -# ReSharper inspection severities -resharper_annotate_can_be_null_parameter_highlighting = warning -resharper_annotate_can_be_null_type_member_highlighting = warning -resharper_annotate_not_null_parameter_highlighting = 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 +# Parenthesis settings +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_other_operators = always_for_clarity:warning -[{*.har,*.inputactions,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config}] -indent_style = space -indent_size = 2 +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:error +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 -[{*.yaml,*.yml,.analysis_options}] -indent_style = space -indent_size = 2 +dotnet_sort_system_directives_first = true -[*.csv] -indent_style = tab -tab_width = 1 +# Constants in C style, all-caps +dotnet_naming_rule.constant_fields_caps.symbols = constant_fields +dotnet_naming_rule.constant_fields_caps.severity = warning +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 -[{*.bash,*.sh,*.tool,*.zsh}] -indent_style = space -indent_size = 2 +# interfaces should be prefixed with I +dotnet_naming_rule.pascal_case_for_interface.severity = error +dotnet_naming_rule.pascal_case_for_interface.symbols = interfaces_fields +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 -[*.{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}] -indent_style = space -indent_size = 4 -tab_width = 4 +## internal and private fields should be _camelCase +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style +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 = implicit +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 +csharp_style_namespace_declarations = file_scoped:warning + +[*.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 From 8e64a9f10c6123997e122ed399def34b14874248 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 15 Nov 2022 15:58:41 +0000 Subject: [PATCH 32/53] General code cleanup and style refactor. --- Aaru.Decryption.csproj | 92 +++++++++++++++++++++--------------------- DVD/CSS.cs | 89 ++++++++++++++++++++-------------------- DVD/Dump.cs | 32 +++++++-------- Enums.cs | 7 +--- 4 files changed, 109 insertions(+), 111 deletions(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index 100547db3..db1a4fb78 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -1,51 +1,51 @@ - - 2.0 - Library - Aaru.Decryption - Aaru.Decryption - $(Version) - true - 6.0.0-alpha8 - Claunia.com - Copyright © 2011-2022 Natalia Portillo - Aaru Data Preservation Suite - Aaru.Decryption - $(Version) - net7.0 - 11 - Decryption algorithms used by the Aaru Data Preservation Suite. - https://github.com/aaru-dps/ - MIT - https://github.com/aaru-dps/Aaru.Decryption - true - en-US - true - true - snupkg - Rebecca Wallander <sakcheen@gmail.com> - enable - true - true - - - CS1591;CS1574 - - - - - - - $(Version)+{chash:8} - true - true - + + 2.0 + Library + Aaru.Decryption + Aaru.Decryption + $(Version) + true + 6.0.0-alpha8 + Claunia.com + Copyright © 2011-2022 Natalia Portillo + Aaru Data Preservation Suite + Aaru.Decryption + $(Version) + net7.0 + 11 + Decryption algorithms used by the Aaru Data Preservation Suite. + https://github.com/aaru-dps/ + MIT + https://github.com/aaru-dps/Aaru.Decryption + true + en-US + true + true + snupkg + Rebecca Wallander <sakcheen@gmail.com> + enable + true + true + + + CS1591;CS1574 + + + + + + + $(Version)+{chash:8} + true + true + - - - - - + + + + + diff --git a/DVD/CSS.cs b/DVD/CSS.cs index 66ce1d48a..973f7fcee 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -43,12 +43,12 @@ // libdvdcpxm (https://offog.org/git/dvdaexplorer/src/libdvdcpxm/) // libdvdcss (https://www.videolan.org/developers/libdvdcss.html) -namespace Aaru.Decryption.DVD; - using System; using System.Linq; using Aaru.Decoders.DVD; +namespace Aaru.Decryption.DVD; + public class CSS { static readonly byte[,] _playerKeys = @@ -386,7 +386,7 @@ public class CSS byte[] key = response.Skip(4).Take(2048).ToArray(); for(uint i = 0; i < key.Length; i++) - key[i] ^= busKey[4 - i % busKey.Length]; + key[i] ^= busKey[4 - (i % busKey.Length)]; return new CSS_CPRM.DiscKey { @@ -413,7 +413,7 @@ public class CSS byte[] key = response.Skip(5).Take(5).ToArray(); for(uint i = 0; i < key.Length; i++) - key[i] ^= busKey[4 - i % busKey.Length]; + key[i] ^= busKey[4 - (i % busKey.Length)]; return new CSS_CPRM.TitleKey { @@ -435,38 +435,38 @@ public class CSS /// The encrypted key. public static void EncryptKey(DvdCssKeyType keyType, uint variant, byte[] challenge, out byte[] key) { - var bits = new byte[30]; - var scratch = new byte[10]; - byte index = sizeof(byte) * 30; - var temp1 = new byte[5]; - var temp2 = new byte[5]; - byte carry = 0; + byte[] bits = new byte[30]; + byte[] scratch = new byte[10]; + byte index = sizeof(byte) * 30; + byte[] temp1 = new byte[5]; + byte[] temp2 = new byte[5]; + byte carry = 0; key = new byte[5]; - for(var i = 9; i >= 0; --i) + for(int i = 9; i >= 0; --i) scratch[i] = challenge[_permutationChallenge[(uint)keyType, i]]; - var cssVariant = (byte)(keyType == 0 ? variant : _permutationVariant[(uint)keyType - 1, variant]); + byte cssVariant = (byte)(keyType == 0 ? variant : _permutationVariant[(uint)keyType - 1, variant]); - for(var i = 5; --i >= 0;) + for(int i = 5; --i >= 0;) temp1[i] = (byte)(scratch[5 + i] ^ _secret[i] ^ _encryptTable2[i]); - var lfsr0 = (uint)((temp1[0] << 17) | (temp1[1] << 9) | ((temp1[2] & ~7) << 1) | 8 | (temp1[2] & 7)); - var lfsr1 = (uint)((temp1[3] << 9) | 0x100 | temp1[4]); + uint lfsr0 = (uint)((temp1[0] << 17) | (temp1[1] << 9) | ((temp1[2] & ~7) << 1) | 8 | (temp1[2] & 7)); + uint lfsr1 = (uint)((temp1[3] << 9) | 0x100 | temp1[4]); do { byte val = 0; - for(var bit = 0; bit < 8; ++bit) + for(int bit = 0; bit < 8; ++bit) { - var oLfsr0 = (byte)(((lfsr0 >> 24) ^ (lfsr0 >> 21) ^ (lfsr0 >> 20) ^ (lfsr0 >> 12)) & 1); + byte oLfsr0 = (byte)(((lfsr0 >> 24) ^ (lfsr0 >> 21) ^ (lfsr0 >> 20) ^ (lfsr0 >> 12)) & 1); lfsr0 = (lfsr0 << 1) | oLfsr0; - var oLfsr1 = (byte)(((lfsr1 >> 16) ^ (lfsr1 >> 2)) & 1); + byte oLfsr1 = (byte)(((lfsr1 >> 16) ^ (lfsr1 >> 2)) & 1); lfsr1 = (lfsr1 << 1) | oLfsr1; - var combined = (byte)(Convert.ToByte(oLfsr1 == 0) + carry + Convert.ToByte(oLfsr0 == 0)); + byte combined = (byte)(Convert.ToByte(oLfsr1 == 0) + carry + Convert.ToByte(oLfsr0 == 0)); carry = (byte)((combined >> 1) & 1); val |= (byte)((combined & 1) << bit); } @@ -474,10 +474,10 @@ public class CSS bits[--index] = val; } while(index > 0); - var cse = (byte)(_variants[cssVariant] ^ _encryptTable2[cssVariant]); - var term = 0; + byte cse = (byte)(_variants[cssVariant] ^ _encryptTable2[cssVariant]); + int term = 0; - for(var i = 5; --i >= 0; term = scratch[i]) + for(int i = 5; --i >= 0; term = scratch[i]) { index = (byte)(bits[25 + i] ^ scratch[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -488,7 +488,7 @@ public class CSS temp1[4] ^= temp1[0]; term = 0; - for(var i = 5; --i >= 0; term = temp1[i]) + for(int i = 5; --i >= 0; term = temp1[i]) { index = (byte)(bits[20 + i] ^ temp1[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -499,7 +499,7 @@ public class CSS temp2[4] ^= temp2[0]; term = 0; - for(var i = 5; --i >= 0; term = temp2[i]) + for(int i = 5; --i >= 0; term = temp2[i]) { index = (byte)(bits[15 + i] ^ temp2[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -511,7 +511,7 @@ public class CSS temp1[4] ^= temp1[0]; term = 0; - for(var i = 5; --i >= 0; term = temp1[i]) + for(int i = 5; --i >= 0; term = temp1[i]) { index = (byte)(bits[10 + i] ^ temp1[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -523,7 +523,7 @@ public class CSS temp2[4] ^= temp2[0]; term = 0; - for(var i = 5; --i >= 0; term = temp2[i]) + for(int i = 5; --i >= 0; term = temp2[i]) { index = (byte)(bits[5 + i] ^ temp2[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -534,7 +534,7 @@ public class CSS temp1[4] ^= temp1[0]; term = 0; - for(var i = 5; --i >= 0; term = temp1[i]) + for(int i = 5; --i >= 0; term = temp1[i]) { index = (byte)(bits[i] ^ temp1[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -551,12 +551,13 @@ public class CSS public static void DecryptKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) { decryptedKey = new byte[5]; - var k = new byte[5]; + byte[] k = new byte[5]; - var lfsr1Lo = (uint)(cryptoKey[0] | 0x100); + uint lfsr1Lo = (uint)(cryptoKey[0] | 0x100); uint lfsr1Hi = cryptoKey[1]; - var lfsr0 = (uint)(((cryptoKey[4] << 17) | (cryptoKey[3] << 9) | (cryptoKey[2] << 1)) + 8 - (cryptoKey[2] & 7)); + uint lfsr0 = (uint)(((cryptoKey[4] << 17) | (cryptoKey[3] << 9) | (cryptoKey[2] << 1)) + 8 - + (cryptoKey[2] & 7)); lfsr0 = (uint)((_cssTable4[lfsr0 & 0xff] << 24) | (_cssTable4[(lfsr0 >> 8) & 0xff] << 16) | (_cssTable4[(lfsr0 >> 16) & 0xff] << 8) | _cssTable4[(lfsr0 >> 24) & 0xff]); @@ -565,11 +566,11 @@ public class CSS for(uint i = 0; i < 5; i++) { - var oLfsr1 = (byte)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); + byte oLfsr1 = (byte)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); lfsr1Hi = lfsr1Lo >> 1; lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; oLfsr1 = _cssTable4[oLfsr1]; - var oLfsr0 = (byte)(((((((lfsr0 >> 8) ^ lfsr0) >> 1) ^ lfsr0) >> 3) ^ lfsr0) >> 7); + byte oLfsr0 = (byte)(((((((lfsr0 >> 8) ^ lfsr0) >> 1) ^ lfsr0) >> 3) ^ lfsr0) >> 7); lfsr0 = (lfsr0 >> 8) | ((uint)oLfsr0 << 24); combined += (uint)((oLfsr0 ^ invert) + oLfsr1); k[i] = (byte)(combined & 0xff); @@ -636,7 +637,7 @@ public class CSS keyData.All(k => k == 0)) return sectorData; - var decryptedBuffer = new byte[sectorData.Length]; + byte[] decryptedBuffer = new byte[sectorData.Length]; for(uint j = 0; j < blocks; j++) { @@ -659,11 +660,11 @@ public class CSS uint lfsr1Lo = (uint)(currentKey[0] ^ currentSector[0x54]) | 0x100; uint lfsr1Hi = (uint)currentKey[1] ^ currentSector[0x55]; - var lfsr0 = (uint)((currentKey[2] | (currentKey[3] << 8) | (currentKey[4] << 16)) ^ - (sectorData[0x56] | (sectorData[0x57] << 8) | (sectorData[0x58] << 16))); + uint lfsr0 = (uint)((currentKey[2] | (currentKey[3] << 8) | (currentKey[4] << 16)) ^ + (sectorData[0x56] | (sectorData[0x57] << 8) | (sectorData[0x58] << 16))); uint oLfsr1 = lfsr0 & 7; - lfsr0 = lfsr0 * 2 + 8 - oLfsr1; + lfsr0 = (lfsr0 * 2) + 8 - oLfsr1; uint combined = 0; @@ -698,13 +699,13 @@ public class CSS if(cmi.RegionInformation is 0xFF or 0x00) return true; - return (rpc.RegionMask & 0x01) == (cmi.RegionInformation & 0x01) && (rpc.RegionMask & 0x01) != 0x01 || - (rpc.RegionMask & 0x02) == (cmi.RegionInformation & 0x02) && (rpc.RegionMask & 0x02) != 0x02 || - (rpc.RegionMask & 0x04) == (cmi.RegionInformation & 0x04) && (rpc.RegionMask & 0x04) != 0x04 || - (rpc.RegionMask & 0x08) == (cmi.RegionInformation & 0x08) && (rpc.RegionMask & 0x08) != 0x08 || - (rpc.RegionMask & 0x10) == (cmi.RegionInformation & 0x10) && (rpc.RegionMask & 0x10) != 0x10 || - (rpc.RegionMask & 0x20) == (cmi.RegionInformation & 0x20) && (rpc.RegionMask & 0x20) != 0x20 || - (rpc.RegionMask & 0x40) == (cmi.RegionInformation & 0x40) && (rpc.RegionMask & 0x40) != 0x40 || - (rpc.RegionMask & 0x80) == (cmi.RegionInformation & 0x80) && (rpc.RegionMask & 0x80) != 0x80; + return ((rpc.RegionMask & 0x01) == (cmi.RegionInformation & 0x01) && (rpc.RegionMask & 0x01) != 0x01) || + ((rpc.RegionMask & 0x02) == (cmi.RegionInformation & 0x02) && (rpc.RegionMask & 0x02) != 0x02) || + ((rpc.RegionMask & 0x04) == (cmi.RegionInformation & 0x04) && (rpc.RegionMask & 0x04) != 0x04) || + ((rpc.RegionMask & 0x08) == (cmi.RegionInformation & 0x08) && (rpc.RegionMask & 0x08) != 0x08) || + ((rpc.RegionMask & 0x10) == (cmi.RegionInformation & 0x10) && (rpc.RegionMask & 0x10) != 0x10) || + ((rpc.RegionMask & 0x20) == (cmi.RegionInformation & 0x20) && (rpc.RegionMask & 0x20) != 0x20) || + ((rpc.RegionMask & 0x40) == (cmi.RegionInformation & 0x40) && (rpc.RegionMask & 0x40) != 0x40) || + ((rpc.RegionMask & 0x80) == (cmi.RegionInformation & 0x80) && (rpc.RegionMask & 0x80) != 0x80); } } \ No newline at end of file diff --git a/DVD/Dump.cs b/DVD/Dump.cs index 64bdec115..2b42dbc7b 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -34,14 +34,14 @@ // Copyright © 2020-2022 Rebecca Wallander // ****************************************************************************/ -namespace Aaru.Decryption.DVD; - using System; using System.Linq; using Aaru.Console; using Aaru.Decoders.DVD; using Aaru.Devices; +namespace Aaru.Decryption.DVD; + public sealed class Dump { const byte KEY_SIZE = 5; @@ -69,7 +69,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -97,7 +97,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -125,7 +125,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.ReportKey; @@ -154,7 +154,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -183,7 +183,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[12]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -211,7 +211,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[16]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -241,7 +241,7 @@ public sealed class Dump uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[16]; cdb[0] = (byte)ScsiCommands.SendKey; @@ -284,7 +284,7 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[12]; cdb[0] = (byte)ScsiCommands.SendKey; @@ -319,7 +319,7 @@ public sealed class Dump public bool ReadDiscKey(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[2052]; cdb[0] = (byte)ScsiCommands.ReadDiscStructure; @@ -349,10 +349,10 @@ public sealed class Dump buffer = Array.Empty(); senseBuffer = new byte[64]; - var sense = false; - var challenge = new byte[CHALLENGE_SIZE]; - var key1 = new byte[KEY_SIZE]; - byte variant = 0; + bool sense = false; + byte[] challenge = new byte[CHALLENGE_SIZE]; + byte[] key1 = new byte[KEY_SIZE]; + byte variant = 0; for(byte i = 0; i < 4; i++) { @@ -460,7 +460,7 @@ public sealed class Dump BusKey = buffer; senseBuffer = new byte[64]; - var cdb = new byte[12]; + byte[] cdb = new byte[12]; buffer = new byte[12]; cdb[0] = (byte)ScsiCommands.ReportKey; diff --git a/Enums.cs b/Enums.cs index ae59bb14f..dcf25baa0 100644 --- a/Enums.cs +++ b/Enums.cs @@ -2,13 +2,10 @@ namespace Aaru.Decryption; public enum DvdCssKeyClass : byte { - DvdCssCppmOrCprm = 0, - RewritableSecurityServicesA = 1 + DvdCssCppmOrCprm = 0, RewritableSecurityServicesA = 1 } public enum DvdCssKeyType { - Key1 = 0, - Key2 = 1, - BusKey = 2 + Key1 = 0, Key2 = 1, BusKey = 2 } \ No newline at end of file From 71291ba070aca5b66480f0150c0a57ac786edb90 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 27 Nov 2022 14:05:44 +0000 Subject: [PATCH 33/53] Move all localizable strings from Aaru.Decryption project to resources. --- Aaru.Decryption.csproj | 15 +++++ Aaru.Decryption.csproj.DotSettings | 2 + DVD/Dump.cs | 30 ++++----- Localization/Localization.Designer.cs | 96 +++++++++++++++++++++++++++ Localization/Localization.resx | 48 ++++++++++++++ 5 files changed, 175 insertions(+), 16 deletions(-) create mode 100644 Aaru.Decryption.csproj.DotSettings create mode 100644 Localization/Localization.Designer.cs create mode 100644 Localization/Localization.resx diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index db1a4fb78..2eeb87214 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -48,4 +48,19 @@ + + + ResXFileCodeGenerator + Localization.Designer.cs + + + + + + True + True + Localization.resx + + + diff --git a/Aaru.Decryption.csproj.DotSettings b/Aaru.Decryption.csproj.DotSettings new file mode 100644 index 000000000..dc0dbdcef --- /dev/null +++ b/Aaru.Decryption.csproj.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/DVD/Dump.cs b/DVD/Dump.cs index 2b42dbc7b..b6878b0a2 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -80,7 +80,7 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", "REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", + AaruConsole.DebugWriteLine("SCSI Device", Localization.REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, Agid, sense, _dev.LastError); return sense; @@ -108,7 +108,7 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", "REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", + AaruConsole.DebugWriteLine("SCSI Device", Localization.REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, Agid, sense, _dev.LastError); return sense; @@ -136,9 +136,8 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", - "INVALIDATE AGID (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, - Agid, sense, _dev.LastError); + AaruConsole.DebugWriteLine("SCSI Device", Localization.INVALIDATE_AGID_AGID_1_Sense_2_Last_Error_3_took_0_ms, + duration, Agid, sense, _dev.LastError); return sense; } @@ -166,8 +165,8 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); AaruConsole.DebugWriteLine("SCSI Device", - "REPORT AGID CSS/CPPM (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", - duration, Agid, sense, _dev.LastError); + Localization.REPORT_AGID_CSS_CPPM_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, + Agid, sense, _dev.LastError); return sense; } @@ -194,7 +193,7 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", "REPORT KEY1 (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", + AaruConsole.DebugWriteLine("SCSI Device", Localization.REPORT_KEY1_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, Agid, sense, _dev.LastError); return sense; @@ -222,9 +221,8 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", - "REPORT CHALLENGE (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.", duration, - Agid, sense, _dev.LastError); + AaruConsole.DebugWriteLine("SCSI Device", Localization.REPORT_CHALLENGE_AGID_1_Sense_2_Last_Error_3_took_0_ms, + duration, Agid, sense, _dev.LastError); return sense; } @@ -266,7 +264,7 @@ public sealed class Dump out bool sense); AaruConsole.DebugWriteLine("SCSI Device", - "SEND CHALLENGE (AGID: {1}, Challenge {2}, Sense: {3}, Last Error: {4}) took {0} ms.", + Localization.SEND_CHALLENGE_AGID_1_Challenge_2_Sense_3_Last_Error_4_took_0_ms, duration, Agid, challengeKey, sense, _dev.LastError); return sense; @@ -304,8 +302,8 @@ public sealed class Dump out bool sense); AaruConsole.DebugWriteLine("SCSI Device", - "SEND CHALLENGE (AGID: {1}, KEY2 {2}, Sense: {3}, Last Error: {4}) took {0} ms.", - duration, Agid, key2, sense, _dev.LastError); + Localization.SEND_CHALLENGE_AGID_1_KEY2_2_Sense_3_Last_Error_4_took_0_ms, duration, + Agid, key2, sense, _dev.LastError); return sense; } @@ -475,8 +473,8 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", "GET TITLE KEY (AGID: {1}, LBA: {2}, Sense: {3}) took {0} ms.", - duration, Agid, address, sense); + AaruConsole.DebugWriteLine("SCSI Device", Localization.GET_TITLE_KEY_AGID_1_LBA_2_Sense_3_took_0_ms, duration, + Agid, address, sense); return sense; } diff --git a/Localization/Localization.Designer.cs b/Localization/Localization.Designer.cs new file mode 100644 index 000000000..90bad9bd3 --- /dev/null +++ b/Localization/Localization.Designer.cs @@ -0,0 +1,96 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Aaru.Decryption { + using System; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Localization { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Localization() { + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager { + get { + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Aaru.Decryption.Localization.Localization", typeof(Localization).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static string REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms { + get { + return ResourceManager.GetString("REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); + } + } + + internal static string INVALIDATE_AGID_AGID_1_Sense_2_Last_Error_3_took_0_ms { + get { + return ResourceManager.GetString("INVALIDATE_AGID_AGID_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); + } + } + + internal static string REPORT_AGID_CSS_CPPM_AGID_1_Sense_2_Last_Error_3_took_0_ms { + get { + return ResourceManager.GetString("REPORT_AGID_CSS_CPPM_AGID_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); + } + } + + internal static string REPORT_KEY1_AGID_1_Sense_2_Last_Error_3_took_0_ms { + get { + return ResourceManager.GetString("REPORT_KEY1_AGID_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); + } + } + + internal static string REPORT_CHALLENGE_AGID_1_Sense_2_Last_Error_3_took_0_ms { + get { + return ResourceManager.GetString("REPORT_CHALLENGE_AGID_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); + } + } + + internal static string SEND_CHALLENGE_AGID_1_Challenge_2_Sense_3_Last_Error_4_took_0_ms { + get { + return ResourceManager.GetString("SEND_CHALLENGE_AGID_1_Challenge_2_Sense_3_Last_Error_4_took_0_ms", resourceCulture); + } + } + + internal static string SEND_CHALLENGE_AGID_1_KEY2_2_Sense_3_Last_Error_4_took_0_ms { + get { + return ResourceManager.GetString("SEND_CHALLENGE_AGID_1_KEY2_2_Sense_3_Last_Error_4_took_0_ms", resourceCulture); + } + } + + internal static string GET_TITLE_KEY_AGID_1_LBA_2_Sense_3_took_0_ms { + get { + return ResourceManager.GetString("GET_TITLE_KEY_AGID_1_LBA_2_Sense_3_took_0_ms", resourceCulture); + } + } + } +} diff --git a/Localization/Localization.resx b/Localization/Localization.resx new file mode 100644 index 000000000..32dc9b77d --- /dev/null +++ b/Localization/Localization.resx @@ -0,0 +1,48 @@ + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms. + + + INVALIDATE AGID (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms. + + + REPORT AGID CSS/CPPM (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms. + + + REPORT KEY1 (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms. + + + REPORT CHALLENGE (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms. + + + SEND CHALLENGE (AGID: {1}, Challenge {2}, Sense: {3}, Last Error: {4}) took {0} ms. + + + SEND CHALLENGE (AGID: {1}, KEY2 {2}, Sense: {3}, Last Error: {4}) took {0} ms. + + + GET TITLE KEY (AGID: {1}, LBA: {2}, Sense: {3}) took {0} ms. + + \ No newline at end of file From e6d0ef1af9b6992f70a02fdc539487335e291323 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 3 Dec 2022 16:07:07 +0000 Subject: [PATCH 34/53] Update copyright year. --- Aaru.Decryption.csproj | 2 +- DVD/CSS.cs | 2 +- DVD/Dump.cs | 2 +- LICENSE | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index 2eeb87214..76750f2dc 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -9,7 +9,7 @@ true 6.0.0-alpha8 Claunia.com - Copyright © 2011-2022 Natalia Portillo + Copyright © 2011-2023 Natalia Portillo Aaru Data Preservation Suite Aaru.Decryption $(Version) diff --git a/DVD/CSS.cs b/DVD/CSS.cs index 973f7fcee..f85ecf5d0 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -31,7 +31,7 @@ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // ---------------------------------------------------------------------------- -// Copyright © 2020-2022 Rebecca Wallander +// Copyright © 2020-2023 Rebecca Wallander // ****************************************************************************/ // Based on information gathered from: diff --git a/DVD/Dump.cs b/DVD/Dump.cs index b6878b0a2..c7975611b 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -31,7 +31,7 @@ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // ---------------------------------------------------------------------------- -// Copyright © 2020-2022 Rebecca Wallander +// Copyright © 2020-2023 Rebecca Wallander // ****************************************************************************/ using System; diff --git a/LICENSE b/LICENSE index 98dc1fdc6..b4f38daad 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015-2016 Natalia Portillo +Copyright (c) 2015-2023 Natalia Portillo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From bc4497d6769d9925c794d3b520a4aba886cd2255 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Fri, 23 Dec 2022 17:38:01 +0000 Subject: [PATCH 35/53] Bump version to v6.0.0-alpha9. --- Aaru.Decryption.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index 76750f2dc..72c6796dc 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -7,7 +7,7 @@ Aaru.Decryption $(Version) true - 6.0.0-alpha8 + 6.0.0-alpha9 Claunia.com Copyright © 2011-2023 Natalia Portillo Aaru Data Preservation Suite From b9b22519b72b1fdb780abec237ba8a4a846d2bd1 Mon Sep 17 00:00:00 2001 From: Rebecca Wallander Date: Sat, 29 Jul 2023 23:52:24 +0200 Subject: [PATCH 36/53] Find CSS keys from pattern attack --- Aaru.Decryption.csproj | 10 +- DVD/CSS.cs | 404 ++++++++++++++++++++++++++++++++++++----- DVD/MPEG.cs | 108 +++++++++++ 3 files changed, 472 insertions(+), 50 deletions(-) create mode 100644 DVD/MPEG.cs diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index 72c6796dc..2eeeef4a7 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -33,8 +33,8 @@ CS1591;CS1574 - - + + $(Version)+{chash:8} @@ -43,9 +43,9 @@ - - - + + + diff --git a/DVD/CSS.cs b/DVD/CSS.cs index f85ecf5d0..3a28055a9 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -44,7 +44,12 @@ // libdvdcss (https://www.videolan.org/developers/libdvdcss.html) using System; +using System.Collections.Generic; using System.Linq; +using Aaru.CommonTypes; +using Aaru.CommonTypes.Enums; +using Aaru.CommonTypes.Interfaces; +using Aaru.CommonTypes.Structs; using Aaru.Decoders.DVD; namespace Aaru.Decryption.DVD; @@ -544,11 +549,11 @@ public class CSS } /// Takes an encrypted key and its crypto and returns the key decrypted. - /// + /// For disc keys, invert is 0x00. For title keys, invert if 0xff. /// The key used to encrypt the data. /// The encrypted data. /// The decrypted data. - public static void DecryptKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) + static void DecryptKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) { decryptedKey = new byte[5]; byte[] k = new byte[5]; @@ -590,8 +595,8 @@ public class CSS decryptedKey[0] = (byte)(k[0] ^ _cssTable1[decryptedKey[0]]); } - public static void DecryptTitleKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) => - DecryptKey(invert, cryptoKey, encryptedKey, out decryptedKey); + public static void DecryptTitleKey(byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) => + DecryptKey(0xff, cryptoKey, encryptedKey, out decryptedKey); /// Takes an bytearray of encrypted keys, decrypts them and returns the correctly decrypted key. /// Encrypted keys to try to decrypt. @@ -630,65 +635,115 @@ public class CSS /// Number of sectors in sectorData. /// Size of one sector. /// The decrypted sector. - public static byte[] DecryptSector(byte[] sectorData, byte[] cmiData, byte[] keyData, uint blocks = 1, + public static byte[] DecryptSector(byte[] sectorData, byte[] keyData, byte[]? cmiData, uint blocks = 1, uint blockSize = 2048) { - if(cmiData.All(cmi => (cmi & 0x80) >> 7 == 0) || - keyData.All(k => k == 0)) + // None of the sectors are encrypted + if((cmiData != null && cmiData.All(static cmi => (cmi & 0x80) >> 7 == 0)) || + keyData.All(static k => k == 0)) return sectorData; byte[] decryptedBuffer = new byte[sectorData.Length]; - for(uint j = 0; j < blocks; j++) + for(uint i = 0; i < blocks; i++) { - byte[] currentKey = keyData.Skip((int)(j * 5)).Take(5).ToArray(); - byte[] currentSector = sectorData.Skip((int)(j * blockSize)).Take((int)blockSize).ToArray(); + byte[] currentKey = keyData.Skip((int)(i * 5)).Take(5).ToArray(); + byte[] currentSector = sectorData.Skip((int)(i * blockSize)).Take((int)blockSize).ToArray(); - // If the CMI tells use the sector isn't encrypted or - // if the key is all zeroes or - // if the MPEG Packetized Elementary Stream scrambling control value tells us the packet is not scrambled - if((cmiData[j] & 0x80) >> 7 == 0 || - currentKey.All(k => k == 0) || - (currentSector[20] & 0x30) >> 4 == 0) + if(!IsEncrypted(cmiData?[i], currentKey, currentSector)) { - // Sector is not encrypted - Array.Copy(currentSector, 0, decryptedBuffer, (int)(j * blockSize), blockSize); + Array.Copy(currentSector, 0, decryptedBuffer, (int)(i * blockSize), blockSize); continue; } - uint lfsr1Lo = (uint)(currentKey[0] ^ currentSector[0x54]) | 0x100; - uint lfsr1Hi = (uint)currentKey[1] ^ currentSector[0x55]; - - uint lfsr0 = (uint)((currentKey[2] | (currentKey[3] << 8) | (currentKey[4] << 16)) ^ - (sectorData[0x56] | (sectorData[0x57] << 8) | (sectorData[0x58] << 16))); - - uint oLfsr1 = lfsr0 & 7; - lfsr0 = (lfsr0 * 2) + 8 - oLfsr1; - - uint combined = 0; - - for(uint i = 128; i < blockSize; i++) - { - oLfsr1 = (uint)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); - lfsr1Hi = lfsr1Lo >> 1; - lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; - oLfsr1 = _cssTable5[oLfsr1]; - uint oLfsr0 = (((((((lfsr0 >> 3) ^ lfsr0) >> 1) ^ lfsr0) >> 8) ^ lfsr0) >> 5) & 0xff; - lfsr0 = (lfsr0 >> 8) | (oLfsr0 << 24); - lfsr0 = (lfsr0 << 8) | oLfsr0; - oLfsr0 = _cssTable4[oLfsr0]; - combined += oLfsr0 + oLfsr1; - currentSector[i] = (byte)(_cssTable1[currentSector[i]] ^ (combined & 0xff)); - combined >>= 8; - } - - Array.Copy(currentSector, 0, decryptedBuffer, (int)(j * blockSize), blockSize); + Array.Copy(UnscrambleSector(currentKey, currentSector), 0, decryptedBuffer, (int)(i * blockSize), + blockSize); } return decryptedBuffer; } + /// + /// Unscrambles a DVD sector with a title key. + /// + /// The title key. + /// The scrambled sector. + /// The unscrambled sector. + static byte[] UnscrambleSector(IReadOnlyList key, byte[] sector) + { + long lfsr1Lo = (key[0] ^ sector[0x54]) | 0x100; + long lfsr1Hi = key[1] ^ sector[0x55]; + + long lfsr0 = (key[2] | (key[3] << 8) | (key[4] << 16)) ^ + (sector[0x56] | (sector[0x57] << 8) | (sector[0x58] << 16)); + + long oLfsr1 = lfsr0 & 7; + lfsr0 = (lfsr0 * 2) + 8 - oLfsr1; + + long combined = 0; + + for(uint i = 0x80; i < 2048; i++) + { + oLfsr1 = _cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]; + lfsr1Hi = lfsr1Lo >> 1; + lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; + oLfsr1 = _cssTable5[oLfsr1]; + long oLfsr0 = (((((((lfsr0 >> 3) ^ lfsr0) >> 1) ^ lfsr0) >> 8) ^ lfsr0) >> 5) & 0xff; + lfsr0 = (lfsr0 << 8) | oLfsr0; + oLfsr0 = _cssTable4[oLfsr0]; + combined += oLfsr0 + oLfsr1; + sector[i] = (byte)(_cssTable1[sector[i]] ^ (combined & 0xff)); + combined >>= 8; + } + + // Since we unscrambled the sector, we need to set the MPEG Packetized Elementary Stream + // scrambling control value to "not scrambled". + sector[20] ^= 1 << 4; + + return sector; + } + + /// + /// Analyzes data to try to figure out if the sector is encrypted, including + /// + /// If the packet is not an MPEG packet + /// If the CMI tells us the sector isn't encrypted + /// If the key is all zeroes + /// If the MPEG Packetized Elementary Stream scrambling control value tells us the packet is not scrambled + /// If if the packet is system_header, padding_stream or private_stream2 (cannot be encrypted according to libdvdcss) + /// + /// + /// The Copyright Management Information. + /// The title key. + /// The sector data. + /// True if encrypted + static bool IsEncrypted(byte? cmi, byte[]? key, IReadOnlyList sector) + { + // Only MPEG packets can be encrypted. + if(!MPEG.IsMpegPacket(sector)) + return false; + + // The CMI tells us the sector is not encrypted. + if(cmi != null && + (cmi & 0x80) >> 7 == 0) + return false; + + // We have the key but it's all zeroes, so sector is unencrypted. + if(key != null && + key.All(static k => k == 0)) + return false; + + // These packet types cannot be encrypted + if(sector[17] == (byte)MPEG.Mpeg2StreamId.SystemHeader || + sector[17] == (byte)MPEG.Mpeg2StreamId.PaddingStream || + sector[17] == (byte)MPEG.Mpeg2StreamId.PrivateStream2) + return false; + + // MPEG Packetized Elementary Stream scrambling control value + return (sector[20] & 0x30) >> 4 == 1; + } + /// Takes an RPC state from the drive and a CMI from a disc and checks if the regions are compatible. /// The RegionalPlaybackControlState from drive. /// The LeadInCopyright from disc. @@ -708,4 +763,263 @@ public class CSS ((rpc.RegionMask & 0x40) == (cmi.RegionInformation & 0x40) && (rpc.RegionMask & 0x40) != 0x40) || ((rpc.RegionMask & 0x80) == (cmi.RegionInformation & 0x80) && (rpc.RegionMask & 0x80) != 0x80); } + + /// + /// This tries to find a title key for a range of sectors by doing a brute force pattern search developed by + /// Ethan Hawke of DeCSSPlus. CSS encrypted sectors have parts of them that are unencrypted (byte 0x0 - 0x80). + /// We try to find a long pattern of repeated bytes just before the encryption starts. If we assume this + /// pattern continues into the encrypted part, we can force keys until one of them satisfies this condition. + /// + /// The sector to analyze. + /// The key found. + /// true if a key was found. + static bool AttackPattern(byte[] sector, out byte[] key) + { + uint bestPatternLength = 0; + uint bestPattern = 0; + key = new byte[5]; + + for(uint i = 2; i < 0x30; i++) + { + // Find the number of bytes that repeats in cycles. + for(uint j = i + 1; j < 0x80 && sector[0x7F - (j % i)] == sector[0x7F - j]; j++) + { + if(j <= bestPatternLength) + continue; + + bestPatternLength = j; + bestPattern = i; + } + } + + // If we found an adequate pattern. + if(bestPattern <= 0 || + bestPatternLength <= 3 || + bestPatternLength / bestPattern < 2) + return false; + + int offset = (int)(0x80 - ((bestPatternLength / bestPattern) * bestPattern)); + + int result = RecoverTitleKey(0, sector.Skip(0x80).Take(sector.Length - 0x80).ToArray(), + sector.Skip(offset).Take((int)(sector.Length - offset)).ToArray(), + sector.Skip(0x54).Take(5).ToArray(), out key); + + return result >= 0; + } + + /// + /// Takes a guessed plain text and a encrypted bytes and tries to recover the title key + /// from those. Attack developed by Frank Stevenson. + /// + /// Start position. + /// Buffer with encrypted bytes. + /// Buffer with decrypted bytes. + /// This sector's seed values. + /// The title key. + /// Positive values on success. + static int RecoverTitleKey(uint start, byte[] encryptedBytes, byte[] decryptedBytes, byte[] sectorSeed, + out byte[] key) + { + byte[] buffer = new byte[10]; + long oLfsr1; + long oLfsr0; + long iTry; + uint i; + int exit = -1; + key = new byte[5]; + + for(i = 0; i < 10; i++) + buffer[i] = (byte)(_cssTable1[encryptedBytes[i]] ^ decryptedBytes[i]); + + for(iTry = start; iTry < 0x10000; iTry++) + { + long lfsr1Lo = (iTry >> 8) | 0x100; + long lfsr1Hi = iTry & 0xff; + long lfsr0 = 0; + long combined = 0; + + // Iterate cipher 4 times to reconstruct LFSR2 + for(i = 0; i < 4; i++) + { + // Advance LFSR1 normally + oLfsr1 = _cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]; + lfsr1Hi = lfsr1Lo >> 1; + lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; + oLfsr1 = _cssTable5[oLfsr1]; + oLfsr0 = buffer[i]; + + if(combined > 0) + oLfsr0 = (oLfsr0 + 0xff) & 0x0ff; + + if(oLfsr0 < oLfsr1) + oLfsr0 += 0x100; + + oLfsr0 -= oLfsr1; + combined += oLfsr0 + oLfsr1; + oLfsr0 = _cssTable4[oLfsr0]; + lfsr0 = (lfsr0 << 8) | oLfsr0; + combined >>= 8; + } + + long candidate = lfsr0; + + // Iterate 6 more times to validate candidate key + for(; i < 10; i++) + { + oLfsr1 = _cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]; + lfsr1Hi = lfsr1Lo >> 1; + lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; + oLfsr1 = _cssTable5[oLfsr1]; + oLfsr0 = (((((((lfsr0 >> 3) ^ lfsr0) >> 1) ^ lfsr0) >> 8) ^ lfsr0) >> 5) & 0xff; + lfsr0 = (lfsr0 << 8) | oLfsr0; + oLfsr0 = _cssTable4[oLfsr0]; + combined += oLfsr0 + oLfsr1; + + if((combined & 0xff) != buffer[i]) + break; + + combined >>= 8; + } + + if(i != 10) + continue; + + lfsr0 = candidate; + + for(i = 0; i < 4; i++) + { + lfsr1Lo = lfsr0 & 0xff; + lfsr0 = (lfsr0 >> 8); + + for(uint j = 0; j < 256; j++) + { + lfsr0 = (lfsr0 & 0x1ffff) | (j << 17); + oLfsr0 = (((((((lfsr0 >> 3) ^ lfsr0) >> 1) ^ lfsr0) >> 8) ^ lfsr0) >> 5) & 0xff; + + if(oLfsr0 == lfsr1Lo) + break; + } + } + + oLfsr1 = (lfsr0 >> 1) - 4; + + for(combined = 0; combined < 8; combined++) + { + if(((oLfsr1 + combined) * 2) + 8 - ((oLfsr1 + combined) & 7) != lfsr0) + continue; + + key[0] = (byte)(iTry >> 8); + key[1] = (byte)(iTry & 0xFF); + key[2] = (byte)(((oLfsr1 + combined) >> 0) & 0xFF); + key[3] = (byte)(((oLfsr1 + combined) >> 8) & 0xFF); + key[4] = (byte)(((oLfsr1 + combined) >> 16) & 0xFF); + exit = (int)(iTry + 1); + } + } + + if(exit < 0) + return exit; + + key[0] ^= sectorSeed[0]; + key[1] ^= sectorSeed[1]; + key[2] ^= sectorSeed[2]; + key[3] ^= sectorSeed[3]; + key[4] ^= sectorSeed[4]; + + return exit; + } + + /// + /// Tries to find a title key by attacking CSS vulnerabilities. + /// + /// IOpticalMediaImage to find the title key in. + /// Sector index to begin search. + /// Amount of sectors to search before giving up. + /// The title key. + static byte[] FindTitleKey(IOpticalMediaImage input, ulong startSector, ulong sectorsToSearch = 20000) + { + byte[] titleKey = new byte[5]; + + for(ulong i = 0; i < sectorsToSearch; i++) + { + input.ReadSector(startSector + i, out byte[] sector); + + if(!IsEncrypted(null, null, sector)) + continue; + + if(AttackPattern(sector, out byte[] key)) + return key; + } + + return titleKey; + } + + /// + /// Generates title keys for all sectors in a track. + /// + /// IOpticalMediaImage to generate keys for. + /// List of Partition to analyze. + /// Total number of sectors for track. + /// + /// A byte array with keys for every sector in the track. One key is 5 bytes. + public static byte[] GenerateTitleKeys(IOpticalMediaImage input, List partitions, ulong trackSectors, + Type pluginType) + { + byte[] keys = new byte[trackSectors * 5]; + + foreach(Partition partition in partitions) + { + if(Activator.CreateInstance(pluginType) is not IReadOnlyFilesystem fs) + continue; + + if(!HasVideoTsFolder(input, fs, partition)) + continue; + + if(fs.Mount(input, partition, null, null, null) != ErrorNumber.NoError) + continue; + + if(fs.OpenDir("VIDEO_TS", out IDirNode node) == ErrorNumber.NoError) + { + while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError && + entry is not null) + { + if(!entry.ToLower().EndsWith(".vob")) + continue; + + fs.Stat("VIDEO_TS" + "/" + entry, out FileEntryInfo stat); + + byte[] key = FindTitleKey(input, stat.Inode); + + for(long i = 0; i < stat.Blocks; i++) + key.CopyTo(keys, (long)(5 * (stat.Inode + (ulong)i))); + } + + fs.CloseDir(node); + } + + fs.Unmount(); + } + + return keys; + } + + /// + /// DVD video discs always have a VIDEO_TS folder. If it doesn't have one, it's not a DVD video. + /// + /// IOpticalMediaImage to check for VIDEO_TS folder in. + /// IReadOnlyFilesystem to check in. + /// Partition to check in. + /// true if VIDEO_TS folder was found. + static bool HasVideoTsFolder(IOpticalMediaImage input, IReadOnlyFilesystem fs, Partition partition) + { + ErrorNumber error = fs.Mount(input, partition, null, null, null); + + if(error != ErrorNumber.NoError) + return false; + + error = fs.Stat("VIDEO_TS", out FileEntryInfo stat); + fs.Unmount(); + + return error == ErrorNumber.NoError && stat.Attributes == FileAttributes.Directory; + } } \ No newline at end of file diff --git a/DVD/MPEG.cs b/DVD/MPEG.cs new file mode 100644 index 000000000..70df521e5 --- /dev/null +++ b/DVD/MPEG.cs @@ -0,0 +1,108 @@ +// /*************************************************************************** +// Aaru Data Preservation Suite +// ---------------------------------------------------------------------------- +// +// Filename : MPEG.cs +// Author(s) : Rebecca Wallander +// +// --[ Description ] ---------------------------------------------------------- +// +// Handles MPEG packets functionality. +// +// --[ License ] -------------------------------------------------------------- +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// ---------------------------------------------------------------------------- +// Copyright © 2023 Rebecca Wallander +// ****************************************************************************/ + +// http://www.mpucoder.com/DVD/vobov.html + +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; + +namespace Aaru.Decryption.DVD; + +public class MPEG +{ + static byte[] _mpeg2PackHeaderStartCode = + { + 0x0, 0x0, 0x1 + }; + + public enum Mpeg2StreamId : byte + { + ProgramEnd = 0xB9, PackHeader = 0xBA, SystemHeader = 0xBB, + ProgramStreamMap = 0xBC, PrivateStream1 = 0xBD, PaddingStream = 0xBE, + PrivateStream2 = 0xBF, EcmStream = 0xF0, EmmStream = 0xF1, + ItuTRecH222_0_or_IsoIec13818_1AnnexA_or_IsoIec13818_6DsmccStream = 0xF2, IsoIec13522Stream = 0xF3, + ItuTRecH222_1TypeA = 0xF4, ItuTRecH222_1TypeB = 0xF5, ItuTRecH222_1TypeC = 0xF6, + ItuTRecH222_1TypeD = 0xF7, ItuTRecH222_1TypeE = 0xF8, AncillaryStream = 0xF9, + Reserved1 = 0xFA, Reserved2 = 0xFB, Reserved3 = 0xFC, + Reserved4 = 0xFD, Reserved5 = 0xFE, ProgramStreamDirectory = 0xFF, + + // DVD Video can only hold 8 audio streams + MpegAudioStream1 = 0xC0, MpegAudioStream2 = 0xC1, MpegAudioStream3 = 0xC2, + MpegAudioStream4 = 0xC3, MpegAudioStream5 = 0xC4, MpegAudioStream6 = 0xC5, + MpegAudioStream7 = 0xC6, MpegAudioStream8 = 0xC7, MpegAudioStream9 = 0xC8, + MpegAudioStream10 = 0xC9, MpegAudioStream11 = 0xCA, MpegAudioStream12 = 0xCB, + MpegAudioStream13 = 0xCC, MpegAudioStream14 = 0xCD, MpegAudioStream15 = 0xCE, + MpegAudioStream16 = 0xCF, MpegAudioStream17 = 0xD0, MpegAudioStream18 = 0xD1, + MpegAudioStream19 = 0xD2, MpegAudioStream20 = 0xD3, MpegAudioStream21 = 0xD4, + MpegAudioStream22 = 0xD5, MpegAudioStream23 = 0xD6, MpegAudioStream24 = 0xD7, + MpegAudioStream25 = 0xD8, MpegAudioStream26 = 0xD9, MpegAudioStream27 = 0xDA, + MpegAudioStream28 = 0xDB, MpegAudioStream29 = 0xDC, MpegAudioStream30 = 0xDD, + MpegAudioStream31 = 0xDE, MpegAudioStream32 = 0xDF, + + // DVD Video can only hold 1 video stream + MpegVideStream1 = 0xE0, MpegVideStream2 = 0xE1, MpegVideStream3 = 0xE2, + MpegVideStream4 = 0xE3, MpegVideStream5 = 0xE4, MpegVideStream6 = 0xE5, + MpegVideStream7 = 0xE6, MpegVideStream8 = 0xE7, MpegVideStream9 = 0xE8, + MpegVideStream10 = 0xE9, MpegVideStream11 = 0xEA, MpegVideStream12 = 0xEB, + MpegVideStream13 = 0xEC, MpegVideStream14 = 0xED, MpegVideStream15 = 0xEE, + MpegVideStream16 = 0xEF + } + + public struct MpegHeader + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] startCode; + public byte packIdentifier; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] + public byte[] scrBlock; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] programMuxRateBlock; + byte packStuffingLengthBlock; + } + + public static bool ContainsMpegPackets(byte[] sectorData, uint blocks = 1, uint blockSize = 2048) + { + for(uint i = 0; i < blocks; i++) + if(IsMpegPacket(sectorData.Skip((int)(i * blockSize)))) + return true; + + return false; + } + + public static bool IsMpegPacket(IEnumerable sector) => + sector.Take(3).ToArray().SequenceEqual(_mpeg2PackHeaderStartCode); +} \ No newline at end of file From 4efd3a68918b8ef692bebc543361704c35b1ada2 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 24 Sep 2023 21:48:56 +0100 Subject: [PATCH 37/53] Update to .NET 8.0 RC1. --- Aaru.Decryption.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index 2eeeef4a7..036ceda9d 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -13,8 +13,8 @@ Aaru Data Preservation Suite Aaru.Decryption $(Version) - net7.0 - 11 + net8.0 + 12 Decryption algorithms used by the Aaru Data Preservation Suite. https://github.com/aaru-dps/ MIT From 92d1953bb2b89da7034f5b85a76e1ee2bdcf1d99 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 27 Sep 2023 00:39:32 +0100 Subject: [PATCH 38/53] Translate Aaru.Decryption to Spanish (Spain). --- Localization/Localization.es.resx | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Localization/Localization.es.resx diff --git a/Localization/Localization.es.resx b/Localization/Localization.es.resx new file mode 100644 index 000000000..55b348d38 --- /dev/null +++ b/Localization/Localization.es.resx @@ -0,0 +1,38 @@ + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + GET TITLE KEY (AGID: {1}, LBA: {2}, Sense: {3}) tardó {0} ms. + + + INVALIDATE AGID (AGID: {1}, Sense: {2}, Error: {3}) tardó {0} ms. + + + REPORT AGID CSS/CPPM (AGID: {1}, Sense: {2}, Error: {3}) tardó {0} ms. + + + REPORT ASF (AGID: {1}, Sense: {2}, Error: {3}) tardó {0} ms. + + + REPORT CHALLENGE (AGID: {1}, Sense: {2}, Error: {3}) tardó {0} ms. + + + REPORT KEY1 (AGID: {1}, Sense: {2}, Error: {3}) tardó {0} ms. + + + SEND CHALLENGE (AGID: {1}, Desafío {2}, Sense: {3}, Error: {4}) tardó {0} ms. + + + SEND CHALLENGE (AGID: {1}, KEY2 {2}, Sense: {3}, Error: {4}) tardó {0} ms. + + \ No newline at end of file From a980b38c1015ed4b070a44ee0272b2f25b4a3a78 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 3 Oct 2023 17:23:15 +0100 Subject: [PATCH 39/53] [Aaru.Decryption] Introduced constants for module names Introduces constant fields for respective debug module names, replacing the hardcoded ones. This is done to standardize the naming convention, reduce redundancy and potentially avoid any typos or name mismatches across the project. This change makes the code more maintainable and easier to update in case module names need to be changed. --- DVD/Dump.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/DVD/Dump.cs b/DVD/Dump.cs index c7975611b..b84ed2b3a 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -46,6 +46,7 @@ public sealed class Dump { const byte KEY_SIZE = 5; const byte CHALLENGE_SIZE = 2 * KEY_SIZE; + const string MODULE_NAME = "DVD decryption"; readonly Device _dev; public Dump(Device dev) @@ -80,7 +81,7 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", Localization.REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, Agid, sense, _dev.LastError); return sense; @@ -108,7 +109,7 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", Localization.REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, Agid, sense, _dev.LastError); return sense; @@ -136,7 +137,7 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", Localization.INVALIDATE_AGID_AGID_1_Sense_2_Last_Error_3_took_0_ms, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.INVALIDATE_AGID_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, Agid, sense, _dev.LastError); return sense; @@ -164,7 +165,7 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_AGID_CSS_CPPM_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, Agid, sense, _dev.LastError); @@ -193,7 +194,7 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", Localization.REPORT_KEY1_AGID_1_Sense_2_Last_Error_3_took_0_ms, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_KEY1_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, Agid, sense, _dev.LastError); return sense; @@ -221,7 +222,7 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", Localization.REPORT_CHALLENGE_AGID_1_Sense_2_Last_Error_3_took_0_ms, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_CHALLENGE_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, Agid, sense, _dev.LastError); return sense; @@ -263,7 +264,7 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.SEND_CHALLENGE_AGID_1_Challenge_2_Sense_3_Last_Error_4_took_0_ms, duration, Agid, challengeKey, sense, _dev.LastError); @@ -301,7 +302,7 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.SEND_CHALLENGE_AGID_1_KEY2_2_Sense_3_Last_Error_4_took_0_ms, duration, Agid, key2, sense, _dev.LastError); @@ -473,7 +474,7 @@ public sealed class Dump _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine("SCSI Device", Localization.GET_TITLE_KEY_AGID_1_LBA_2_Sense_3_took_0_ms, duration, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.GET_TITLE_KEY_AGID_1_LBA_2_Sense_3_took_0_ms, duration, Agid, address, sense); return sense; From cd75a48ddb9081946cd50f16e987afee4b4305da Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 3 Oct 2023 21:04:57 +0100 Subject: [PATCH 40/53] Update style configuration. --- .editorconfig | 1888 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 1293 insertions(+), 595 deletions(-) diff --git a/.editorconfig b/.editorconfig index 7586c80d3..fd4cb0e6b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,631 +1,1329 @@ [*] charset = utf-8 -next_line = crlf -insert_final_newline = false -indent_style = space +end_of_line = lf indent_size = 4 - -# Generic non-language specific ones for Resharper and friends -brace_style = next_line -int_align = true -keep_existing_arrangement = false -place_simple_blocks_on_single_line = true -place_simple_declaration_blocks_on_single_line = true -place_attribute_on_same_line = false -space_after_unary_operator = false -space_after_comma = true -space_around_ternary_operator = true -space_around_binary_operator = true -space_around_member_access_operator = false -space_before_open_square_brackets = false -space_after_keywords_in_control_flow_statements = true -space_before_comma = false -space_between_method_call_name_and_opening_parenthesis = false -space_between_method_declaration_name_and_open_parenthesis = false -space_between_square_brackets = false -space_between_parentheses_of_control_flow_statements = false -accessor_owner_declaration_braces = next_line -accessor_declaration_braces = next_line -case_block_braces = next_line -initializer_braces = next_line -other_braces = next_line -allow_comment_after_lbrace = false -empty_block_style = together_same_line -braces_for_ifelse = not_required -braces_for_for = not_required -braces_for_foreach = not_required -braces_for_while = not_required -braces_for_dowhile = not_required -braces_for_using = not_required -braces_for_lock = not_required -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 +indent_style = space +insert_final_newline = 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 +tab_width = 4 +trim_trailing_whitespace = false +ij_continuation_indent_size = 8 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = true +ij_smart_tabs = false +ij_visual_guides = +ij_wrap_on_typing = 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. +# Microsoft .NET properties +csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion +csharp_space_after_keywords_in_control_flow_statements = false +csharp_style_namespace_declarations = file_scoped:warning +csharp_style_prefer_utf8_string_literals = true:warning +csharp_style_var_elsewhere = false:none +csharp_style_var_for_built_in_types = false:suggestion +csharp_using_directive_placement = inside_namespace:silent +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 = all_upper_style +dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols +dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True +dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field +dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef +dotnet_naming_rule.unity_serialized_field_rule.severity = warning +dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style +dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols +dotnet_naming_style.all_upper_style.capitalization = all_upper +dotnet_naming_style.all_upper_style.word_separator = _ +dotnet_naming_style.lower_camel_case_style.capitalization = camel_case +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.unity_serialized_field_symbols.applicable_accessibilities = * +dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds = +dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field +dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance +dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:warning +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:warning dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion dotnet_style_predefined_type_for_member_access = true:suggestion - -# This controls implicit access modifiers +dotnet_style_qualification_for_event = false:suggestion +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 -# Prefer non modified fields to be marked readonly -dotnet_style_readonly_field = true:warning +# ReSharper properties +resharper_align_linq_query = true +resharper_align_multiline_argument = true +resharper_align_multiline_array_and_object_initializer = 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_expression_braces = true +resharper_align_multiline_extends_list = true +resharper_align_multiline_for_stmt = true +resharper_align_multiline_list_pattern = 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_ternary = align_all +resharper_align_tuple_components = true +resharper_autodetect_indent_settings = true +resharper_braces_for_for = required_for_multiline +resharper_braces_for_foreach = required_for_multiline +resharper_braces_for_ifelse = required_for_multiline +resharper_braces_for_while = required_for_multiline +resharper_builtin_type_apply_to_native_integer = true +resharper_constructor_or_destructor_body = expression_body +resharper_csharp_align_first_arg_by_paren = true +resharper_csharp_empty_block_style = together_same_line +resharper_csharp_place_comments_at_first_column = true +resharper_default_value_when_type_not_evident = default_expression +resharper_enforce_line_ending_style = true +resharper_formatter_off_tag = @formatter:off +resharper_formatter_on_tag = @formatter:on +resharper_formatter_tags_enabled = true +resharper_for_built_in_types = use_var_when_evident +resharper_function_declaration_return_type_style = on_single_line +resharper_function_definition_return_type_style = on_single_line +resharper_html_pi_attribute_style = first_attribute_on_single_line +resharper_indent_anonymous_method_block = true +resharper_indent_preprocessor_if = outdent +resharper_indent_preprocessor_other = outdent +resharper_indent_preprocessor_region = outdent +resharper_int_align = true +resharper_int_align_bitfield_sizes = true +resharper_int_align_comments = true +resharper_int_align_declaration_names = true +resharper_int_align_enum_initializers = true +resharper_int_align_eq = true +resharper_keep_existing_embedded_arrangement = false +resharper_keep_existing_initializer_arrangement = false +resharper_keep_existing_list_patterns_arrangement = false +resharper_keep_existing_property_patterns_arrangement = false +resharper_keep_existing_switch_expression_arrangement = false +resharper_line_break_after_colon_in_member_initializer_lists = on_single_line +resharper_line_break_before_requires_clause = on_single_line +resharper_linkage_specification_indentation = all +resharper_local_function_body = expression_body +resharper_member_initializer_list_style = on_single_line +resharper_method_or_operator_body = expression_body +resharper_outdent_binary_ops = true +resharper_outdent_binary_pattern_ops = true +resharper_outdent_commas = true +resharper_outdent_dots = true +resharper_outdent_statement_labels = true +resharper_parentheses_redundancy_style = remove +resharper_place_attribute_on_same_line = false +resharper_show_autodetect_configure_formatting_tip = false +resharper_simple_block_style = on_single_line +resharper_simple_case_statement_style = line_break +resharper_simple_embedded_statement_style = on_single_line +resharper_space_after_ptr_in_data_member = false +resharper_space_after_ptr_in_method = false +resharper_space_after_ref_in_data_member = false +resharper_space_after_ref_in_method = false +resharper_space_before_ptr_in_data_member = true +resharper_space_before_ptr_in_method = true +resharper_space_before_ref_in_data_member = true +resharper_space_before_ref_in_method = true +resharper_space_before_template_params = false +resharper_space_within_empty_braces = false +resharper_toplevel_function_declaration_return_type_style = on_single_line +resharper_toplevel_function_definition_return_type_style = on_single_line +resharper_use_indent_from_vs = false +resharper_wrap_base_clause_style = chop_if_long +resharper_wrap_braced_init_list_style = chop_if_long +resharper_wrap_ctor_initializer_style = chop_if_long +resharper_wrap_lines = true +resharper_xmldoc_attribute_indent = align_by_first_attribute +resharper_xmldoc_attribute_style = first_attribute_on_single_line +resharper_xmldoc_pi_attribute_style = first_attribute_on_single_line -# Parenthesis settings -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_operators = always_for_clarity:warning +# ReSharper inspection severities +resharper_annotate_can_be_null_parameter_highlighting = warning +resharper_annotate_can_be_null_type_member_highlighting = warning +resharper_annotate_not_null_parameter_highlighting = warning +resharper_annotate_not_null_type_member_highlighting = warning +resharper_arguments_style_anonymous_function_highlighting = warning +resharper_arguments_style_literal_highlighting = warning +resharper_arguments_style_named_expression_highlighting = warning +resharper_arguments_style_other_highlighting = warning +resharper_arguments_style_string_literal_highlighting = warning +resharper_arrange_accessor_owner_body_highlighting = warning +resharper_arrange_constructor_or_destructor_body_highlighting = warning +resharper_arrange_local_function_body_highlighting = warning +resharper_arrange_method_or_operator_body_highlighting = warning +resharper_arrange_redundant_parentheses_highlighting = hint +resharper_arrange_static_member_qualifier_highlighting = warning +resharper_arrange_this_qualifier_highlighting = hint +resharper_arrange_trailing_comma_in_multiline_lists_highlighting = warning +resharper_arrange_trailing_comma_in_singleline_lists_highlighting = warning +resharper_arrange_type_member_modifiers_highlighting = hint +resharper_arrange_type_modifiers_highlighting = hint +resharper_arrange_var_keywords_in_deconstructing_declaration_highlighting = warning +resharper_async_void_method_highlighting = warning +resharper_auto_property_can_be_made_get_only_global_highlighting = warning +resharper_auto_property_can_be_made_get_only_local_highlighting = warning +resharper_bad_attribute_brackets_spaces_highlighting = warning +resharper_bad_braces_spaces_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 = warning +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_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_built_in_type_reference_style_for_member_access_highlighting = hint +resharper_built_in_type_reference_style_highlighting = hint +resharper_check_for_reference_equality_instead_1_highlighting = warning +resharper_check_for_reference_equality_instead_2_highlighting = warning +resharper_check_for_reference_equality_instead_3_highlighting = warning +resharper_check_for_reference_equality_instead_4_highlighting = warning +resharper_class_can_be_sealed_global_highlighting = warning +resharper_class_can_be_sealed_local_highlighting = warning +resharper_class_never_instantiated_global_highlighting = warning +resharper_class_never_instantiated_local_highlighting = warning +resharper_class_with_virtual_members_never_inherited_global_highlighting = warning +resharper_class_with_virtual_members_never_inherited_local_highlighting = warning +resharper_comment_typo_highlighting = none +resharper_compare_non_constrained_generic_with_null_highlighting = warning +resharper_convert_closure_to_method_group_highlighting = warning +resharper_convert_conditional_ternary_expression_to_switch_expression_highlighting = warning +resharper_convert_if_do_to_while_highlighting = warning +resharper_convert_if_statement_to_conditional_ternary_expression_highlighting = warning +resharper_convert_if_statement_to_null_coalescing_assignment_highlighting = warning +resharper_convert_if_statement_to_null_coalescing_expression_highlighting = warning +resharper_convert_if_statement_to_return_statement_highlighting = warning +resharper_convert_if_statement_to_switch_statement_highlighting = warning +resharper_convert_if_to_or_expression_highlighting = warning +resharper_convert_nullable_to_short_form_highlighting = warning +resharper_convert_switch_statement_to_switch_expression_highlighting = warning +resharper_convert_to_auto_property_highlighting = warning +resharper_convert_to_auto_property_when_possible_highlighting = warning +resharper_convert_to_auto_property_with_private_setter_highlighting = warning +resharper_convert_to_compound_assignment_highlighting = warning +resharper_convert_to_constant_global_highlighting = warning +resharper_convert_to_constant_local_highlighting = warning +resharper_convert_to_lambda_expression_highlighting = warning +resharper_convert_to_local_function_highlighting = warning +resharper_convert_to_null_coalescing_compound_assignment_highlighting = warning +resharper_convert_to_primary_constructor_highlighting = warning +resharper_convert_to_static_class_highlighting = warning +resharper_convert_to_using_declaration_highlighting = warning +resharper_cpp_enforce_cv_qualifiers_order_highlighting = hint +resharper_cpp_enforce_cv_qualifiers_placement_highlighting = hint +resharper_cpp_enforce_do_statement_braces_highlighting = hint +resharper_cpp_enforce_for_statement_braces_highlighting = hint +resharper_cpp_enforce_function_declaration_style_highlighting = hint +resharper_cpp_enforce_if_statement_braces_highlighting = hint +resharper_cpp_enforce_type_alias_code_style_highlighting = hint +resharper_cpp_enforce_while_statement_braces_highlighting = hint +resharper_cpp_remove_redundant_braces_highlighting = hint +resharper_double_negation_in_pattern_highlighting = warning +resharper_double_negation_operator_highlighting = warning +resharper_event_never_invoked_global_highlighting = warning +resharper_event_never_subscribed_to_global_highlighting = warning +resharper_event_never_subscribed_to_local_highlighting = warning +resharper_field_can_be_made_read_only_global_highlighting = warning +resharper_field_can_be_made_read_only_local_highlighting = warning +resharper_foreach_can_be_converted_to_query_using_another_get_enumerator_highlighting = warning +resharper_foreach_can_be_partly_converted_to_query_using_another_get_enumerator_highlighting = none +resharper_for_can_be_converted_to_foreach_highlighting = warning +resharper_heap_view_boxing_allocation_highlighting = none +resharper_heap_view_closure_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_identifier_typo_highlighting = none +resharper_incorrect_blank_lines_near_braces_highlighting = warning +resharper_inheritdoc_consider_usage_highlighting = warning +resharper_inline_out_variable_declaration_highlighting = warning +resharper_inline_temporary_variable_highlighting = warning +resharper_introduce_optional_parameters_global_highlighting = warning +resharper_introduce_optional_parameters_local_highlighting = warning +resharper_invert_condition_1_highlighting = warning +resharper_invert_if_highlighting = warning +resharper_invocation_is_skipped_highlighting = warning +resharper_invoke_as_extension_method_highlighting = warning +resharper_join_declaration_and_initializer_highlighting = warning +resharper_join_null_check_with_usage_highlighting = warning +resharper_lambda_expression_must_be_static_highlighting = warning +resharper_local_function_can_be_made_static_highlighting = warning +resharper_loop_can_be_converted_to_query_highlighting = warning +resharper_loop_can_be_partly_converted_to_query_highlighting = warning +resharper_member_can_be_file_local_highlighting = warning +resharper_member_can_be_internal_highlighting = warning +resharper_member_can_be_made_static_global_highlighting = warning +resharper_member_can_be_made_static_local_highlighting = warning +resharper_member_can_be_private_global_highlighting = warning +resharper_member_can_be_private_local_highlighting = warning +resharper_member_can_be_protected_global_highlighting = warning +resharper_member_can_be_protected_local_highlighting = warning +resharper_merge_and_pattern_highlighting = warning +resharper_merge_cast_with_type_check_highlighting = warning +resharper_merge_conditional_expression_highlighting = warning +resharper_merge_into_logical_pattern_highlighting = warning +resharper_merge_into_negated_pattern_highlighting = warning +resharper_merge_into_pattern_highlighting = warning +resharper_merge_nested_property_patterns_highlighting = warning +resharper_merge_sequential_checks_highlighting = warning +resharper_method_has_async_overload_highlighting = warning +resharper_method_has_async_overload_with_cancellation_highlighting = warning +resharper_method_supports_cancellation_highlighting = warning +resharper_missing_blank_lines_highlighting = warning +resharper_missing_linebreak_highlighting = warning +resharper_missing_space_highlighting = warning +resharper_more_specific_foreach_variable_type_available_highlighting = warning +resharper_move_to_existing_positional_deconstruction_pattern_highlighting = warning +resharper_move_variable_declaration_inside_loop_condition_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_negation_of_relational_pattern_highlighting = warning +resharper_negative_equality_expression_highlighting = warning +resharper_nested_string_interpolation_highlighting = warning +resharper_not_accessed_field_global_highlighting = warning +resharper_nullable_warning_suppression_is_used_highlighting = warning +resharper_outdent_is_off_prev_level_highlighting = warning +resharper_out_parameter_value_is_always_discarded_global_highlighting = warning +resharper_parameter_only_used_for_precondition_check_global_highlighting = warning +resharper_parameter_type_can_be_enumerable_global_highlighting = warning +resharper_parameter_type_can_be_enumerable_local_highlighting = warning +resharper_pass_string_interpolation_highlighting = warning +resharper_possible_unintended_queryable_as_enumerable_highlighting = warning +resharper_property_can_be_made_init_only_global_highlighting = warning +resharper_property_can_be_made_init_only_local_highlighting = warning +resharper_public_constructor_in_abstract_class_highlighting = warning +resharper_raw_string_can_be_simplified_highlighting = warning +resharper_redundant_accessor_body_highlighting = warning +resharper_redundant_always_match_subpattern_highlighting = warning +resharper_redundant_array_creation_expression_highlighting = warning +resharper_redundant_attribute_parentheses_highlighting = warning +resharper_redundant_attribute_usage_property_highlighting = warning +resharper_redundant_base_qualifier_highlighting = warning +resharper_redundant_blank_lines_highlighting = warning +resharper_redundant_collection_initializer_element_braces_highlighting = warning +resharper_redundant_configure_await_highlighting = warning +resharper_redundant_declaration_semicolon_highlighting = warning +resharper_redundant_discard_designation_highlighting = warning +resharper_redundant_empty_object_creation_argument_list_highlighting = warning +resharper_redundant_enum_case_label_for_default_section_highlighting = warning +resharper_redundant_explicit_params_array_creation_highlighting = warning +resharper_redundant_fixed_pointer_declaration_highlighting = warning +resharper_redundant_if_else_block_highlighting = warning +resharper_redundant_immediate_delegate_invocation_highlighting = warning +resharper_redundant_is_before_relational_pattern_highlighting = warning +resharper_redundant_lambda_signature_parentheses_highlighting = warning +resharper_redundant_overload_global_highlighting = warning +resharper_redundant_overload_local_highlighting = warning +resharper_redundant_pattern_parentheses_highlighting = warning +resharper_redundant_property_pattern_clause_highlighting = warning +resharper_redundant_query_order_by_ascending_keyword_highlighting = warning +resharper_redundant_range_bound_highlighting = warning +resharper_redundant_readonly_modifier_highlighting = warning +resharper_redundant_space_highlighting = warning +resharper_redundant_string_interpolation_highlighting = warning +resharper_redundant_to_string_call_for_value_type_highlighting = warning +resharper_redundant_verbatim_prefix_highlighting = warning +resharper_redundant_verbatim_string_prefix_highlighting = warning +resharper_redundant_with_expression_highlighting = warning +resharper_remove_constructor_invocation_highlighting = warning +resharper_remove_redundant_braces_highlighting = warning +resharper_remove_redundant_or_statement_false_highlighting = warning +resharper_remove_redundant_or_statement_true_highlighting = warning +resharper_remove_to_list_1_highlighting = warning +resharper_remove_to_list_2_highlighting = warning +resharper_replace_auto_property_with_computed_property_highlighting = warning +resharper_replace_conditional_expression_with_null_coalescing_highlighting = warning +resharper_replace_object_pattern_with_var_pattern_highlighting = warning +resharper_replace_slice_with_range_indexer_highlighting = warning +resharper_replace_substring_with_range_indexer_highlighting = warning +resharper_replace_with_field_keyword_highlighting = warning +resharper_replace_with_first_or_default_1_highlighting = warning +resharper_replace_with_first_or_default_2_highlighting = warning +resharper_replace_with_first_or_default_3_highlighting = warning +resharper_replace_with_first_or_default_4_highlighting = warning +resharper_replace_with_last_or_default_1_highlighting = warning +resharper_replace_with_last_or_default_2_highlighting = warning +resharper_replace_with_last_or_default_3_highlighting = warning +resharper_replace_with_last_or_default_4_highlighting = warning +resharper_replace_with_of_type_1_highlighting = warning +resharper_replace_with_of_type_2_highlighting = warning +resharper_replace_with_of_type_3_highlighting = warning +resharper_replace_with_of_type_any_1_highlighting = warning +resharper_replace_with_of_type_any_2_highlighting = warning +resharper_replace_with_of_type_count_1_highlighting = warning +resharper_replace_with_of_type_count_2_highlighting = warning +resharper_replace_with_of_type_first_1_highlighting = warning +resharper_replace_with_of_type_first_2_highlighting = warning +resharper_replace_with_of_type_first_or_default_1_highlighting = warning +resharper_replace_with_of_type_first_or_default_2_highlighting = warning +resharper_replace_with_of_type_last_1_highlighting = warning +resharper_replace_with_of_type_last_2_highlighting = warning +resharper_replace_with_of_type_last_or_default_1_highlighting = warning +resharper_replace_with_of_type_last_or_default_2_highlighting = warning +resharper_replace_with_of_type_long_count_highlighting = warning +resharper_replace_with_of_type_single_1_highlighting = warning +resharper_replace_with_of_type_single_2_highlighting = warning +resharper_replace_with_of_type_single_or_default_1_highlighting = warning +resharper_replace_with_of_type_single_or_default_2_highlighting = warning +resharper_replace_with_of_type_where_highlighting = warning +resharper_replace_with_simple_assignment_false_highlighting = warning +resharper_replace_with_simple_assignment_true_highlighting = warning +resharper_replace_with_single_assignment_false_highlighting = warning +resharper_replace_with_single_assignment_true_highlighting = warning +resharper_replace_with_single_call_to_any_highlighting = warning +resharper_replace_with_single_call_to_count_highlighting = warning +resharper_replace_with_single_call_to_first_highlighting = warning +resharper_replace_with_single_call_to_first_or_default_highlighting = warning +resharper_replace_with_single_call_to_last_highlighting = warning +resharper_replace_with_single_call_to_last_or_default_highlighting = warning +resharper_replace_with_single_call_to_single_highlighting = warning +resharper_replace_with_single_call_to_single_or_default_highlighting = warning +resharper_replace_with_single_or_default_1_highlighting = warning +resharper_replace_with_single_or_default_2_highlighting = warning +resharper_replace_with_single_or_default_3_highlighting = warning +resharper_replace_with_single_or_default_4_highlighting = warning +resharper_replace_with_string_is_null_or_empty_highlighting = warning +resharper_return_type_can_be_enumerable_global_highlighting = warning +resharper_return_type_can_be_enumerable_local_highlighting = warning +resharper_safe_cast_is_used_as_type_check_highlighting = warning +resharper_separate_control_transfer_statement_highlighting = warning +resharper_similar_anonymous_type_nearby_highlighting = warning +resharper_simplify_conditional_ternary_expression_highlighting = warning +resharper_simplify_linq_expression_use_all_highlighting = warning +resharper_simplify_linq_expression_use_any_highlighting = warning +resharper_simplify_linq_expression_use_min_by_and_max_by_highlighting = warning +resharper_simplify_string_interpolation_highlighting = warning +resharper_specify_string_comparison_highlighting = warning +resharper_string_ends_with_is_culture_specific_highlighting = warning +resharper_string_literal_as_interpolation_argument_highlighting = warning +resharper_string_literal_typo_highlighting = warning +resharper_string_starts_with_is_culture_specific_highlighting = warning +resharper_struct_can_be_made_read_only_highlighting = warning +resharper_struct_member_can_be_made_read_only_highlighting = warning +resharper_suggest_base_type_for_parameter_highlighting = none +resharper_suggest_base_type_for_parameter_in_constructor_highlighting = warning +resharper_suggest_var_or_type_built_in_types_highlighting = hint +resharper_suggest_var_or_type_deconstruction_declarations_highlighting = warning +resharper_suggest_var_or_type_elsewhere_highlighting = hint +resharper_suggest_var_or_type_simple_types_highlighting = hint +resharper_swap_via_deconstruction_highlighting = warning +resharper_switch_expression_handles_some_known_enum_values_with_exception_in_default_highlighting = warning +resharper_switch_statement_handles_some_known_enum_values_with_default_highlighting = none +resharper_switch_statement_missing_some_enum_cases_no_default_highlighting = none +resharper_tabs_and_spaces_mismatch_highlighting = warning +resharper_tabs_are_disallowed_highlighting = warning +resharper_tabs_outside_indent_highlighting = warning +resharper_tail_recursive_call_highlighting = warning +resharper_too_wide_local_variable_scope_highlighting = warning +resharper_try_cast_always_succeeds_highlighting = warning +resharper_try_statements_can_be_merged_highlighting = warning +resharper_type_parameter_can_be_variant_highlighting = warning +resharper_unnecessary_whitespace_highlighting = warning +resharper_unused_member_global_highlighting = warning +resharper_unused_member_hierarchy_global_highlighting = warning +resharper_unused_member_in_super_global_highlighting = warning +resharper_unused_method_return_value_global_highlighting = warning +resharper_unused_parameter_global_highlighting = warning +resharper_unused_type_global_highlighting = warning +resharper_use_array_creation_expression_1_highlighting = warning +resharper_use_array_creation_expression_2_highlighting = warning +resharper_use_array_empty_method_highlighting = warning +resharper_use_await_using_highlighting = warning +resharper_use_cancellation_token_for_i_async_enumerable_highlighting = warning +resharper_use_collection_count_property_highlighting = warning +resharper_use_configure_await_false_highlighting = warning +resharper_use_deconstruction_highlighting = warning +resharper_use_empty_types_field_highlighting = warning +resharper_use_event_args_empty_field_highlighting = warning +resharper_use_format_specifier_in_format_string_highlighting = warning +resharper_use_indexed_property_highlighting = warning +resharper_use_index_from_end_expression_highlighting = warning +resharper_use_is_operator_1_highlighting = warning +resharper_use_is_operator_2_highlighting = warning +resharper_use_method_any_0_highlighting = warning +resharper_use_method_any_1_highlighting = warning +resharper_use_method_any_2_highlighting = warning +resharper_use_method_any_3_highlighting = warning +resharper_use_method_any_4_highlighting = warning +resharper_use_method_is_instance_of_type_highlighting = warning +resharper_use_nameof_expression_for_part_of_the_string_highlighting = warning +resharper_use_nameof_expression_highlighting = warning +resharper_use_nameof_for_dependency_property_highlighting = warning +resharper_use_name_of_instead_of_type_of_highlighting = warning +resharper_use_negated_pattern_in_is_expression_highlighting = warning +resharper_use_negated_pattern_matching_highlighting = warning +resharper_use_nullable_annotation_instead_of_attribute_highlighting = warning +resharper_use_nullable_attributes_supported_by_compiler_highlighting = warning +resharper_use_null_propagation_highlighting = warning +resharper_use_object_or_collection_initializer_highlighting = warning +resharper_use_pattern_matching_highlighting = warning +resharper_use_positional_deconstruction_pattern_highlighting = warning +resharper_use_raw_string_highlighting = warning +resharper_use_string_interpolation_highlighting = warning +resharper_use_switch_case_pattern_variable_highlighting = warning +resharper_use_throw_if_null_method_highlighting = warning +resharper_use_unsigned_right_shift_operator_highlighting = warning +resharper_use_verbatim_string_highlighting = warning +resharper_use_with_expression_to_copy_anonymous_object_highlighting = warning +resharper_use_with_expression_to_copy_record_highlighting = warning +resharper_use_with_expression_to_copy_struct_highlighting = warning +resharper_use_with_expression_to_copy_tuple_highlighting = warning +resharper_virtual_member_never_overridden_global_highlighting = warning +resharper_virtual_member_never_overridden_local_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 +resharper_with_expression_instead_of_initializer_highlighting = warning +resharper_wrong_indent_size_highlighting = warning -dotnet_style_object_initializer = true:suggestion -dotnet_style_collection_initializer = true:suggestion -dotnet_style_explicit_tuple_names = true:error -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 +[*.css] +ij_css_align_closing_brace_with_properties = false +ij_css_blank_lines_around_nested_selector = 1 +ij_css_blank_lines_between_blocks = 1 +ij_css_block_comment_add_space = false +ij_css_brace_placement = end_of_line +ij_css_enforce_quotes_on_format = false +ij_css_hex_color_long_format = false +ij_css_hex_color_lower_case = false +ij_css_hex_color_short_format = false +ij_css_hex_color_upper_case = false +ij_css_keep_blank_lines_in_code = 2 +ij_css_keep_indents_on_empty_lines = false +ij_css_keep_single_line_blocks = false +ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_css_space_after_colon = true +ij_css_space_before_opening_brace = true +ij_css_use_double_quotes = true +ij_css_value_alignment = do_not_align -dotnet_sort_system_directives_first = true +[*.csv] +max_line_length = 2147483647 +ij_csv_wrap_long_lines = false +indent_style = tab +tab_width = 1 -# Constants in C style, all-caps -dotnet_naming_rule.constant_fields_caps.symbols = constant_fields -dotnet_naming_rule.constant_fields_caps.severity = warning -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 +[*.dart] +max_line_length = 80 -# interfaces should be prefixed with I -dotnet_naming_rule.pascal_case_for_interface.severity = error -dotnet_naming_rule.pascal_case_for_interface.symbols = interfaces_fields -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 +[*.less] +indent_size = 2 +ij_less_align_closing_brace_with_properties = false +ij_less_blank_lines_around_nested_selector = 1 +ij_less_blank_lines_between_blocks = 1 +ij_less_block_comment_add_space = false +ij_less_brace_placement = 0 +ij_less_enforce_quotes_on_format = false +ij_less_hex_color_long_format = false +ij_less_hex_color_lower_case = false +ij_less_hex_color_short_format = false +ij_less_hex_color_upper_case = false +ij_less_keep_blank_lines_in_code = 2 +ij_less_keep_indents_on_empty_lines = false +ij_less_keep_single_line_blocks = false +ij_less_line_comment_add_space = false +ij_less_line_comment_at_first_column = false +ij_less_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_less_space_after_colon = true +ij_less_space_before_opening_brace = true +ij_less_use_double_quotes = true +ij_less_value_alignment = 0 -## internal and private fields should be _camelCase -dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning -dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields -dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style -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 +[*.pp] +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 2 +ij_puppet_keep_indents_on_empty_lines = false -# 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 +[*.properties] +ij_properties_align_group_field_declarations = true +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = true -[*.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 +[*.sass] +indent_size = 2 +ij_sass_align_closing_brace_with_properties = false +ij_sass_blank_lines_around_nested_selector = 1 +ij_sass_blank_lines_between_blocks = 1 +ij_sass_brace_placement = 0 +ij_sass_enforce_quotes_on_format = false +ij_sass_hex_color_long_format = false +ij_sass_hex_color_lower_case = false +ij_sass_hex_color_short_format = false +ij_sass_hex_color_upper_case = false +ij_sass_keep_blank_lines_in_code = 2 +ij_sass_keep_indents_on_empty_lines = false +ij_sass_keep_single_line_blocks = false +ij_sass_line_comment_add_space = false +ij_sass_line_comment_at_first_column = false +ij_sass_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_sass_space_after_colon = true +ij_sass_space_before_opening_brace = true +ij_sass_use_double_quotes = true +ij_sass_value_alignment = 0 -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 +[*.scss] +indent_size = 2 +ij_scss_align_closing_brace_with_properties = false +ij_scss_blank_lines_around_nested_selector = 1 +ij_scss_blank_lines_between_blocks = 1 +ij_scss_block_comment_add_space = false +ij_scss_brace_placement = 0 +ij_scss_enforce_quotes_on_format = false +ij_scss_hex_color_long_format = false +ij_scss_hex_color_lower_case = false +ij_scss_hex_color_short_format = false +ij_scss_hex_color_upper_case = false +ij_scss_keep_blank_lines_in_code = 2 +ij_scss_keep_indents_on_empty_lines = false +ij_scss_keep_single_line_blocks = false +ij_scss_line_comment_add_space = false +ij_scss_line_comment_at_first_column = false +ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_scss_space_after_colon = true +ij_scss_space_before_opening_brace = true +ij_scss_use_double_quotes = true +ij_scss_value_alignment = 0 -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 +[*.slim] +indent_size = 2 +ij_slim_keep_indents_on_empty_lines = false -csharp_style_inlined_variable_declaration = true:warning +[*.twig] +ij_twig_keep_indents_on_empty_lines = false +ij_twig_spaces_inside_comments_delimiters = true +ij_twig_spaces_inside_delimiters = true +ij_twig_spaces_inside_variable_delimiters = true -csharp_prefer_simple_default_expression = true:warning -csharp_style_deconstructed_variable_declaration = false:warning +[*.vue] +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 4 +ij_vue_indent_children_of_top_level = template +ij_vue_interpolation_new_line_after_start_delimiter = true +ij_vue_interpolation_new_line_before_end_delimiter = true +ij_vue_interpolation_wrap = off +ij_vue_keep_indents_on_empty_lines = false +ij_vue_spaces_within_interpolation_expressions = true -csharp_style_throw_expression = true:warning -csharp_style_conditional_delegate_call = true:warning +[.editorconfig] +ij_editorconfig_align_group_field_declarations = true +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true -csharp_prefer_braces = false +[{*.ad,*.adoc,*.asciidoc,.asciidoctorconfig}] +ij_asciidoc_blank_lines_after_header = 1 +ij_asciidoc_blank_lines_keep_after_header = 1 +ij_asciidoc_formatting_enabled = true +ij_asciidoc_one_sentence_per_line = true -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 +[{*.ant,*.appxmanifest,*.axml,*.cscfg,*.csdef,*.disco,*.dotsettings,*.filelayout,*.fxml,*.jhm,*.jnlp,*.jrxml,*.manifest,*.myapp,*.nuspec,*.rng,*.sdef,*.stylecop,*.svcmap,*.tld,*.wadcfgx,*.webref,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul,StyleCop.Cache}] +ij_xml_align_attributes = true +ij_xml_align_text = false +ij_xml_attribute_wrap = on_every_item +ij_xml_block_comment_add_space = false +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = true +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = false +ij_xml_text_wrap = normal +ij_xml_use_custom_settings = false -csharp_indent_case_contents = true -csharp_indent_switch_labels = true -csharp_indent_labels = flush_left +[{*.applescript,*.scpt}] +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 4 +ij_applescript_align_multiline_binary_operation = true +ij_applescript_align_multiline_parameters = true +ij_applescript_align_multiline_parameters_in_calls = true +ij_applescript_binary_operation_sign_on_next_line = false +ij_applescript_binary_operation_wrap = off +ij_applescript_block_brace_style = next_line +ij_applescript_call_parameters_new_line_after_left_paren = false +ij_applescript_call_parameters_right_paren_on_new_line = false +ij_applescript_call_parameters_wrap = off +ij_applescript_else_on_new_line = true +ij_applescript_keep_blank_lines_in_code = 2 +ij_applescript_keep_first_column_comment = true +ij_applescript_keep_indents_on_empty_lines = false +ij_applescript_keep_line_breaks = true +ij_applescript_method_brace_style = next_line +ij_applescript_method_parameters_new_line_after_left_paren = false +ij_applescript_method_parameters_right_paren_on_new_line = false +ij_applescript_method_parameters_wrap = off +ij_applescript_parentheses_expression_new_line_after_left_paren = false +ij_applescript_parentheses_expression_right_paren_on_new_line = false +ij_applescript_space_after_colon = true +ij_applescript_space_after_comma = true +ij_applescript_space_after_comma_in_type_arguments = true +ij_applescript_space_before_colon = true +ij_applescript_space_before_comma = false +ij_applescript_space_before_else_keyword = true +ij_applescript_space_before_else_left_brace = true +ij_applescript_space_before_if_parentheses = false +ij_applescript_space_before_method_call_parentheses = false +ij_applescript_space_before_method_left_brace = true +ij_applescript_space_before_method_parentheses = false +ij_applescript_space_before_while_keyword = true +ij_applescript_spaces_around_additive_operators = true +ij_applescript_spaces_around_assignment_operators = true +ij_applescript_spaces_around_equality_operators = true +ij_applescript_spaces_around_logical_operators = true +ij_applescript_spaces_around_multiplicative_operators = true +ij_applescript_spaces_around_relational_operators = true +ij_applescript_spaces_around_shift_operators = true +ij_applescript_spaces_around_unary_operator = false +ij_applescript_spaces_within_if_parentheses = false +ij_applescript_spaces_within_method_call_parentheses = false +ij_applescript_spaces_within_method_parentheses = false +ij_applescript_special_else_if_treatment = true -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 +[{*.ats,*.cts,*.mts,*.ts}] +ij_continuation_indent_size = 4 +ij_typescript_align_imports = true +ij_typescript_align_multiline_array_initializer_expression = true +ij_typescript_align_multiline_binary_operation = true +ij_typescript_align_multiline_chained_methods = true +ij_typescript_align_multiline_extends_list = false +ij_typescript_align_multiline_for = true +ij_typescript_align_multiline_parameters = true +ij_typescript_align_multiline_parameters_in_calls = true +ij_typescript_align_multiline_ternary_operation = true +ij_typescript_align_object_properties = 1 +ij_typescript_align_union_types = true +ij_typescript_align_var_statements = 2 +ij_typescript_array_initializer_new_line_after_left_brace = false +ij_typescript_array_initializer_right_brace_on_new_line = false +ij_typescript_array_initializer_wrap = on_every_item +ij_typescript_assignment_wrap = on_every_item +ij_typescript_binary_operation_sign_on_next_line = false +ij_typescript_binary_operation_wrap = on_every_item +ij_typescript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** +ij_typescript_blank_lines_after_imports = 1 +ij_typescript_blank_lines_around_class = 1 +ij_typescript_blank_lines_around_field = 0 +ij_typescript_blank_lines_around_field_in_interface = 0 +ij_typescript_blank_lines_around_function = 1 +ij_typescript_blank_lines_around_method = 1 +ij_typescript_blank_lines_around_method_in_interface = 1 +ij_typescript_block_brace_style = next_line +ij_typescript_block_comment_add_space = false +ij_typescript_block_comment_at_first_column = true +ij_typescript_call_parameters_new_line_after_left_paren = false +ij_typescript_call_parameters_right_paren_on_new_line = false +ij_typescript_call_parameters_wrap = on_every_item +ij_typescript_catch_on_new_line = true +ij_typescript_chained_call_dot_on_new_line = true +ij_typescript_class_brace_style = next_line +ij_typescript_comma_on_new_line = false +ij_typescript_do_while_brace_force = always +ij_typescript_else_on_new_line = false +ij_typescript_enforce_trailing_comma = keep +ij_typescript_enum_constants_wrap = on_every_item +ij_typescript_extends_keyword_wrap = normal +ij_typescript_extends_list_wrap = on_every_item +ij_typescript_field_prefix = _ +ij_typescript_file_name_style = relaxed +ij_typescript_finally_on_new_line = true +ij_typescript_for_brace_force = if_multiline +ij_typescript_for_statement_new_line_after_left_paren = false +ij_typescript_for_statement_right_paren_on_new_line = false +ij_typescript_for_statement_wrap = on_every_item +ij_typescript_force_quote_style = true +ij_typescript_force_semicolon_style = true +ij_typescript_function_expression_brace_style = next_line +ij_typescript_if_brace_force = never +ij_typescript_import_merge_members = global +ij_typescript_import_prefer_absolute_path = true +ij_typescript_import_sort_members = true +ij_typescript_import_sort_module_name = true +ij_typescript_import_use_node_resolution = true +ij_typescript_imports_wrap = on_every_item +ij_typescript_indent_case_from_switch = true +ij_typescript_indent_chained_calls = true +ij_typescript_indent_package_children = 0 +ij_typescript_jsdoc_include_types = false +ij_typescript_jsx_attribute_value = braces +ij_typescript_keep_blank_lines_in_code = 2 +ij_typescript_keep_first_column_comment = true +ij_typescript_keep_indents_on_empty_lines = false +ij_typescript_keep_line_breaks = true +ij_typescript_keep_simple_blocks_in_one_line = false +ij_typescript_keep_simple_methods_in_one_line = false +ij_typescript_line_comment_add_space = true +ij_typescript_line_comment_at_first_column = false +ij_typescript_method_brace_style = next_line +ij_typescript_method_call_chain_wrap = on_every_item +ij_typescript_method_parameters_new_line_after_left_paren = false +ij_typescript_method_parameters_right_paren_on_new_line = false +ij_typescript_method_parameters_wrap = on_every_item +ij_typescript_object_literal_wrap = on_every_item +ij_typescript_object_types_wrap = on_every_item +ij_typescript_parentheses_expression_new_line_after_left_paren = false +ij_typescript_parentheses_expression_right_paren_on_new_line = false +ij_typescript_place_assignment_sign_on_next_line = false +ij_typescript_prefer_as_type_cast = false +ij_typescript_prefer_explicit_types_function_expression_returns = false +ij_typescript_prefer_explicit_types_function_returns = false +ij_typescript_prefer_explicit_types_vars_fields = false +ij_typescript_prefer_parameters_wrap = false +ij_typescript_property_prefix = +ij_typescript_reformat_c_style_comments = false +ij_typescript_space_after_colon = true +ij_typescript_space_after_comma = true +ij_typescript_space_after_dots_in_rest_parameter = false +ij_typescript_space_after_generator_mult = true +ij_typescript_space_after_property_colon = true +ij_typescript_space_after_quest = true +ij_typescript_space_after_type_colon = true +ij_typescript_space_after_unary_not = false +ij_typescript_space_before_async_arrow_lparen = false +ij_typescript_space_before_catch_keyword = true +ij_typescript_space_before_catch_left_brace = false +ij_typescript_space_before_catch_parentheses = false +ij_typescript_space_before_class_lbrace = false +ij_typescript_space_before_class_left_brace = true +ij_typescript_space_before_colon = true +ij_typescript_space_before_comma = false +ij_typescript_space_before_do_left_brace = false +ij_typescript_space_before_else_keyword = true +ij_typescript_space_before_else_left_brace = false +ij_typescript_space_before_finally_keyword = true +ij_typescript_space_before_finally_left_brace = false +ij_typescript_space_before_for_left_brace = false +ij_typescript_space_before_for_parentheses = false +ij_typescript_space_before_for_semicolon = false +ij_typescript_space_before_function_left_parenth = false +ij_typescript_space_before_generator_mult = false +ij_typescript_space_before_if_left_brace = false +ij_typescript_space_before_if_parentheses = false +ij_typescript_space_before_method_call_parentheses = false +ij_typescript_space_before_method_left_brace = false +ij_typescript_space_before_method_parentheses = false +ij_typescript_space_before_property_colon = false +ij_typescript_space_before_quest = true +ij_typescript_space_before_switch_left_brace = false +ij_typescript_space_before_switch_parentheses = false +ij_typescript_space_before_try_left_brace = false +ij_typescript_space_before_type_colon = false +ij_typescript_space_before_unary_not = false +ij_typescript_space_before_while_keyword = true +ij_typescript_space_before_while_left_brace = false +ij_typescript_space_before_while_parentheses = false +ij_typescript_spaces_around_additive_operators = true +ij_typescript_spaces_around_arrow_function_operator = true +ij_typescript_spaces_around_assignment_operators = true +ij_typescript_spaces_around_bitwise_operators = true +ij_typescript_spaces_around_equality_operators = true +ij_typescript_spaces_around_logical_operators = true +ij_typescript_spaces_around_multiplicative_operators = true +ij_typescript_spaces_around_relational_operators = true +ij_typescript_spaces_around_shift_operators = true +ij_typescript_spaces_around_unary_operator = false +ij_typescript_spaces_within_array_initializer_brackets = false +ij_typescript_spaces_within_brackets = false +ij_typescript_spaces_within_catch_parentheses = false +ij_typescript_spaces_within_for_parentheses = false +ij_typescript_spaces_within_if_parentheses = false +ij_typescript_spaces_within_imports = false +ij_typescript_spaces_within_interpolation_expressions = false +ij_typescript_spaces_within_method_call_parentheses = false +ij_typescript_spaces_within_method_parentheses = false +ij_typescript_spaces_within_object_literal_braces = false +ij_typescript_spaces_within_object_type_braces = true +ij_typescript_spaces_within_parentheses = false +ij_typescript_spaces_within_switch_parentheses = false +ij_typescript_spaces_within_type_assertion = false +ij_typescript_spaces_within_union_types = true +ij_typescript_spaces_within_while_parentheses = false +ij_typescript_special_else_if_treatment = true +ij_typescript_ternary_operation_signs_on_next_line = false +ij_typescript_ternary_operation_wrap = on_every_item +ij_typescript_union_types_wrap = on_every_item +ij_typescript_use_chained_calls_group_indents = false +ij_typescript_use_double_quotes = true +ij_typescript_use_explicit_js_extension = auto +ij_typescript_use_path_mapping = always +ij_typescript_use_public_modifier = false +ij_typescript_use_semicolon_after_statement = true +ij_typescript_var_declaration_wrap = normal +ij_typescript_while_brace_force = always +ij_typescript_while_on_new_line = false +ij_typescript_wrap_comments = false -csharp_preserve_single_line_statements = false -csharp_preserve_single_line_blocks = true +[{*.bash,*.sh,*.zsh}] +indent_size = 2 +tab_width = 2 +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = true +ij_shell_use_unix_line_separator = true +indent_style = space -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 +[{*.cjs,*.js}] +ij_continuation_indent_size = 4 +ij_javascript_align_imports = true +ij_javascript_align_multiline_array_initializer_expression = true +ij_javascript_align_multiline_binary_operation = true +ij_javascript_align_multiline_chained_methods = false +ij_javascript_align_multiline_extends_list = true +ij_javascript_align_multiline_for = true +ij_javascript_align_multiline_parameters = true +ij_javascript_align_multiline_parameters_in_calls = true +ij_javascript_align_multiline_ternary_operation = true +ij_javascript_align_object_properties = 1 +ij_javascript_align_union_types = false +ij_javascript_align_var_statements = 2 +ij_javascript_array_initializer_new_line_after_left_brace = false +ij_javascript_array_initializer_right_brace_on_new_line = false +ij_javascript_array_initializer_wrap = on_every_item +ij_javascript_assignment_wrap = on_every_item +ij_javascript_binary_operation_sign_on_next_line = false +ij_javascript_binary_operation_wrap = on_every_item +ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** +ij_javascript_blank_lines_after_imports = 1 +ij_javascript_blank_lines_around_class = 1 +ij_javascript_blank_lines_around_field = 0 +ij_javascript_blank_lines_around_function = 1 +ij_javascript_blank_lines_around_method = 1 +ij_javascript_block_brace_style = next_line +ij_javascript_block_comment_add_space = false +ij_javascript_block_comment_at_first_column = true +ij_javascript_call_parameters_new_line_after_left_paren = false +ij_javascript_call_parameters_right_paren_on_new_line = false +ij_javascript_call_parameters_wrap = on_every_item +ij_javascript_catch_on_new_line = true +ij_javascript_chained_call_dot_on_new_line = true +ij_javascript_class_brace_style = next_line +ij_javascript_comma_on_new_line = false +ij_javascript_do_while_brace_force = always +ij_javascript_else_on_new_line = true +ij_javascript_enforce_trailing_comma = remove +ij_javascript_extends_keyword_wrap = normal +ij_javascript_extends_list_wrap = on_every_item +ij_javascript_field_prefix = _ +ij_javascript_file_name_style = relaxed +ij_javascript_finally_on_new_line = true +ij_javascript_for_brace_force = if_multiline +ij_javascript_for_statement_new_line_after_left_paren = false +ij_javascript_for_statement_right_paren_on_new_line = false +ij_javascript_for_statement_wrap = on_every_item +ij_javascript_force_quote_style = true +ij_javascript_force_semicolon_style = true +ij_javascript_function_expression_brace_style = next_line +ij_javascript_if_brace_force = if_multiline +ij_javascript_import_merge_members = global +ij_javascript_import_prefer_absolute_path = true +ij_javascript_import_sort_members = true +ij_javascript_import_sort_module_name = true +ij_javascript_import_use_node_resolution = true +ij_javascript_imports_wrap = on_every_item +ij_javascript_indent_case_from_switch = true +ij_javascript_indent_chained_calls = true +ij_javascript_indent_package_children = 0 +ij_javascript_jsx_attribute_value = braces +ij_javascript_keep_blank_lines_in_code = 2 +ij_javascript_keep_first_column_comment = true +ij_javascript_keep_indents_on_empty_lines = false +ij_javascript_keep_line_breaks = true +ij_javascript_keep_simple_blocks_in_one_line = false +ij_javascript_keep_simple_methods_in_one_line = false +ij_javascript_line_comment_add_space = true +ij_javascript_line_comment_at_first_column = false +ij_javascript_method_brace_style = next_line +ij_javascript_method_call_chain_wrap = on_every_item +ij_javascript_method_parameters_new_line_after_left_paren = false +ij_javascript_method_parameters_right_paren_on_new_line = false +ij_javascript_method_parameters_wrap = on_every_item +ij_javascript_object_literal_wrap = on_every_item +ij_javascript_object_types_wrap = on_every_item +ij_javascript_parentheses_expression_new_line_after_left_paren = false +ij_javascript_parentheses_expression_right_paren_on_new_line = false +ij_javascript_place_assignment_sign_on_next_line = true +ij_javascript_prefer_as_type_cast = false +ij_javascript_prefer_explicit_types_function_expression_returns = false +ij_javascript_prefer_explicit_types_function_returns = false +ij_javascript_prefer_explicit_types_vars_fields = false +ij_javascript_prefer_parameters_wrap = false +ij_javascript_property_prefix = +ij_javascript_reformat_c_style_comments = true +ij_javascript_space_after_colon = true +ij_javascript_space_after_comma = true +ij_javascript_space_after_dots_in_rest_parameter = false +ij_javascript_space_after_generator_mult = true +ij_javascript_space_after_property_colon = true +ij_javascript_space_after_quest = true +ij_javascript_space_after_type_colon = true +ij_javascript_space_after_unary_not = false +ij_javascript_space_before_async_arrow_lparen = false +ij_javascript_space_before_catch_keyword = true +ij_javascript_space_before_catch_left_brace = false +ij_javascript_space_before_catch_parentheses = false +ij_javascript_space_before_class_lbrace = false +ij_javascript_space_before_class_left_brace = true +ij_javascript_space_before_colon = true +ij_javascript_space_before_comma = false +ij_javascript_space_before_do_left_brace = false +ij_javascript_space_before_else_keyword = true +ij_javascript_space_before_else_left_brace = false +ij_javascript_space_before_finally_keyword = true +ij_javascript_space_before_finally_left_brace = false +ij_javascript_space_before_for_left_brace = false +ij_javascript_space_before_for_parentheses = false +ij_javascript_space_before_for_semicolon = false +ij_javascript_space_before_function_left_parenth = false +ij_javascript_space_before_generator_mult = false +ij_javascript_space_before_if_left_brace = false +ij_javascript_space_before_if_parentheses = false +ij_javascript_space_before_method_call_parentheses = false +ij_javascript_space_before_method_left_brace = false +ij_javascript_space_before_method_parentheses = false +ij_javascript_space_before_property_colon = false +ij_javascript_space_before_quest = true +ij_javascript_space_before_switch_left_brace = false +ij_javascript_space_before_switch_parentheses = false +ij_javascript_space_before_try_left_brace = false +ij_javascript_space_before_type_colon = false +ij_javascript_space_before_unary_not = false +ij_javascript_space_before_while_keyword = true +ij_javascript_space_before_while_left_brace = false +ij_javascript_space_before_while_parentheses = false +ij_javascript_spaces_around_additive_operators = true +ij_javascript_spaces_around_arrow_function_operator = true +ij_javascript_spaces_around_assignment_operators = true +ij_javascript_spaces_around_bitwise_operators = true +ij_javascript_spaces_around_equality_operators = true +ij_javascript_spaces_around_logical_operators = true +ij_javascript_spaces_around_multiplicative_operators = true +ij_javascript_spaces_around_relational_operators = true +ij_javascript_spaces_around_shift_operators = true +ij_javascript_spaces_around_unary_operator = false +ij_javascript_spaces_within_array_initializer_brackets = false +ij_javascript_spaces_within_brackets = false +ij_javascript_spaces_within_catch_parentheses = false +ij_javascript_spaces_within_for_parentheses = false +ij_javascript_spaces_within_if_parentheses = false +ij_javascript_spaces_within_imports = false +ij_javascript_spaces_within_interpolation_expressions = false +ij_javascript_spaces_within_method_call_parentheses = false +ij_javascript_spaces_within_method_parentheses = false +ij_javascript_spaces_within_object_literal_braces = false +ij_javascript_spaces_within_object_type_braces = true +ij_javascript_spaces_within_parentheses = false +ij_javascript_spaces_within_switch_parentheses = false +ij_javascript_spaces_within_type_assertion = false +ij_javascript_spaces_within_union_types = true +ij_javascript_spaces_within_while_parentheses = false +ij_javascript_special_else_if_treatment = true +ij_javascript_ternary_operation_signs_on_next_line = false +ij_javascript_ternary_operation_wrap = on_every_item +ij_javascript_union_types_wrap = on_every_item +ij_javascript_use_chained_calls_group_indents = true +ij_javascript_use_double_quotes = true +ij_javascript_use_explicit_js_extension = auto +ij_javascript_use_path_mapping = always +ij_javascript_use_public_modifier = false +ij_javascript_use_semicolon_after_statement = true +ij_javascript_var_declaration_wrap = normal +ij_javascript_while_brace_force = always +ij_javascript_while_on_new_line = false +ij_javascript_wrap_comments = false -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 +[{*.comp,*.frag,*.fsh,*.geom,*.glsl,*.tesc,*.tese,*.vert,*.vsh}] +ij_glsl_keep_indents_on_empty_lines = false -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 +[{*.har,*.jsb2,*.jsb3,*.json,*.jsonc,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,jest.config}] +indent_size = 2 +ij_json_array_wrapping = normal +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_keep_trailing_comma = false +ij_json_object_wrapping = normal +ij_json_property_alignment = align_on_value +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = false +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false +indent_style = space -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 = implicit -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 +[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}] +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_add_space = false +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal -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 -csharp_style_namespace_declarations = file_scoped:warning +[{*.http,*.rest}] +indent_size = 0 +ij_continuation_indent_size = 4 +ij_http-request_call_parameters_wrap = normal +ij_http-request_method_parameters_wrap = split_into_lines +ij_http-request_space_before_comma = true +ij_http-request_spaces_around_assignment_operators = true -[*.cshtml] -linebreaks_around_razor_statements = true -blank_lines_around_razor_functions = true -blank_lines_around_razor_helpers = true -blank_lines_around_razor_sections = true +[{*.markdown,*.md}] +ij_markdown_force_one_space_after_blockquote_symbol = true +ij_markdown_force_one_space_after_header_symbol = true +ij_markdown_force_one_space_after_list_bullet = true +ij_markdown_force_one_space_between_words = true +ij_markdown_format_tables = true +ij_markdown_insert_quote_arrows_on_wrap = true +ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_keep_line_breaks_inside_text_blocks = true +ij_markdown_max_lines_around_block_elements = 1 +ij_markdown_max_lines_around_header = 1 +ij_markdown_max_lines_between_paragraphs = 1 +ij_markdown_min_lines_around_block_elements = 1 +ij_markdown_min_lines_around_header = 1 +ij_markdown_min_lines_between_paragraphs = 1 +ij_markdown_wrap_text_if_long = true +ij_markdown_wrap_text_inside_blockquotes = 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 +[{*.ps1,*.psd1,*.psm1}] +max_line_length = 115 +ij_powershell_align_multiline_binary_operation = true +ij_powershell_align_multiline_chained_methods = false +ij_powershell_align_multiline_for = true +ij_powershell_align_multiline_parameters = true +ij_powershell_align_multiline_parameters_in_calls = false +ij_powershell_binary_operation_wrap = on_every_item +ij_powershell_block_brace_style = next_line +ij_powershell_call_parameters_new_line_after_left_paren = false +ij_powershell_call_parameters_right_paren_on_new_line = false +ij_powershell_call_parameters_wrap = on_every_item +ij_powershell_catch_on_new_line = true +ij_powershell_class_annotation_wrap = split_into_lines +ij_powershell_class_brace_style = next_line +ij_powershell_else_on_new_line = true +ij_powershell_field_annotation_wrap = off +ij_powershell_finally_on_new_line = true +ij_powershell_for_statement_new_line_after_left_paren = false +ij_powershell_for_statement_right_paren_on_new_line = false +ij_powershell_for_statement_wrap = on_every_item +ij_powershell_keep_blank_lines_in_code = 2 +ij_powershell_keep_first_column_comment = true +ij_powershell_keep_line_breaks = true +ij_powershell_keep_simple_blocks_in_one_line = true +ij_powershell_keep_simple_classes_in_one_line = false +ij_powershell_keep_simple_lambdas_in_one_line = true +ij_powershell_keep_simple_methods_in_one_line = true +ij_powershell_method_annotation_wrap = split_into_lines +ij_powershell_method_brace_style = next_line +ij_powershell_method_call_chain_wrap = on_every_item +ij_powershell_method_parameters_new_line_after_left_paren = false +ij_powershell_method_parameters_right_paren_on_new_line = false +ij_powershell_method_parameters_wrap = on_every_item +ij_powershell_parameter_annotation_wrap = off +ij_powershell_parentheses_expression_new_line_after_left_paren = false +ij_powershell_parentheses_expression_right_paren_on_new_line = false +ij_powershell_space_after_colon = true +ij_powershell_space_after_comma = true +ij_powershell_space_after_for_semicolon = true +ij_powershell_space_after_type_cast = false +ij_powershell_space_before_annotation_parameter_list = false +ij_powershell_space_before_array_initializer_left_brace = false +ij_powershell_space_before_catch_keyword = true +ij_powershell_space_before_catch_left_brace = false +ij_powershell_space_before_class_left_brace = false +ij_powershell_space_before_colon = true +ij_powershell_space_before_comma = false +ij_powershell_space_before_do_left_brace = false +ij_powershell_space_before_else_keyword = true +ij_powershell_space_before_else_left_brace = false +ij_powershell_space_before_finally_keyword = true +ij_powershell_space_before_finally_left_brace = false +ij_powershell_space_before_for_left_brace = false +ij_powershell_space_before_for_parentheses = false +ij_powershell_space_before_for_semicolon = false +ij_powershell_space_before_if_left_brace = false +ij_powershell_space_before_if_parentheses = false +ij_powershell_space_before_method_call_parentheses = false +ij_powershell_space_before_method_left_brace = false +ij_powershell_space_before_method_parentheses = false +ij_powershell_space_before_switch_left_brace = false +ij_powershell_space_before_switch_parentheses = false +ij_powershell_space_before_try_left_brace = false +ij_powershell_space_before_while_keyword = true +ij_powershell_space_before_while_left_brace = false +ij_powershell_space_before_while_parentheses = false +ij_powershell_space_within_empty_method_call_parentheses = false +ij_powershell_space_within_empty_method_parentheses = false +ij_powershell_spaces_around_additive_operators = true +ij_powershell_spaces_around_assignment_operators = true +ij_powershell_spaces_around_bitwise_operators = true +ij_powershell_spaces_around_logical_operators = true +ij_powershell_spaces_around_method_ref_dbl_colon = false +ij_powershell_spaces_around_multiplicative_operators = true +ij_powershell_spaces_around_relational_operators = true +ij_powershell_spaces_around_unary_operator = false +ij_powershell_spaces_within_annotation_parentheses = false +ij_powershell_spaces_within_braces = true +ij_powershell_spaces_within_brackets = false +ij_powershell_spaces_within_cast_parentheses = false +ij_powershell_spaces_within_for_parentheses = false +ij_powershell_spaces_within_if_parentheses = false +ij_powershell_spaces_within_method_call_parentheses = false +ij_powershell_spaces_within_method_parentheses = false +ij_powershell_spaces_within_parentheses = false +ij_powershell_spaces_within_switch_parentheses = false +ij_powershell_spaces_within_while_parentheses = false +ij_powershell_special_else_if_treatment = true +ij_powershell_while_on_new_line = false +ij_powershell_wrap_first_method_in_call_chain = false +ij_powershell_wrap_long_lines = false -# C, C++ and ObjectiveC -[*.{c,h,cc,cpp,cxx,m,hpp,hxx}] -indent_preprocessor_directives = normal -indent_type_constraints = true +[{*.py,*.pyw}] +ij_python_align_collections_and_comprehensions = true +ij_python_align_multiline_imports = true +ij_python_align_multiline_parameters = true +ij_python_align_multiline_parameters_in_calls = true +ij_python_blank_line_at_file_end = false +ij_python_blank_lines_after_imports = 1 +ij_python_blank_lines_after_local_imports = 0 +ij_python_blank_lines_around_class = 1 +ij_python_blank_lines_around_method = 1 +ij_python_blank_lines_around_top_level_classes_functions = 2 +ij_python_blank_lines_before_first_method = 0 +ij_python_call_parameters_new_line_after_left_paren = false +ij_python_call_parameters_right_paren_on_new_line = false +ij_python_call_parameters_wrap = on_every_item +ij_python_dict_alignment = 0 +ij_python_dict_new_line_after_left_brace = false +ij_python_dict_new_line_before_right_brace = false +ij_python_dict_wrapping = 5 +ij_python_from_import_new_line_after_left_parenthesis = false +ij_python_from_import_new_line_before_right_parenthesis = false +ij_python_from_import_parentheses_force_if_multiline = false +ij_python_from_import_trailing_comma_if_multiline = false +ij_python_from_import_wrapping = 5 +ij_python_hang_closing_brackets = true +ij_python_keep_blank_lines_in_code = 1 +ij_python_keep_blank_lines_in_declarations = 1 +ij_python_keep_indents_on_empty_lines = false +ij_python_keep_line_breaks = true +ij_python_method_parameters_new_line_after_left_paren = false +ij_python_method_parameters_right_paren_on_new_line = false +ij_python_method_parameters_wrap = on_every_item +ij_python_new_line_after_colon = false +ij_python_new_line_after_colon_multi_clause = true +ij_python_optimize_imports_always_split_from_imports = false +ij_python_optimize_imports_case_insensitive_order = true +ij_python_optimize_imports_join_from_imports_with_same_source = false +ij_python_optimize_imports_sort_by_type_first = true +ij_python_optimize_imports_sort_imports = true +ij_python_optimize_imports_sort_names_in_from_imports = true +ij_python_space_after_comma = true +ij_python_space_after_number_sign = true +ij_python_space_after_py_colon = true +ij_python_space_before_backslash = true +ij_python_space_before_comma = false +ij_python_space_before_for_semicolon = false +ij_python_space_before_lbracket = false +ij_python_space_before_method_call_parentheses = false +ij_python_space_before_method_parentheses = false +ij_python_space_before_number_sign = true +ij_python_space_before_py_colon = false +ij_python_space_within_empty_method_call_parentheses = false +ij_python_space_within_empty_method_parentheses = false +ij_python_spaces_around_additive_operators = true +ij_python_spaces_around_assignment_operators = true +ij_python_spaces_around_bitwise_operators = true +ij_python_spaces_around_eq_in_keyword_argument = false +ij_python_spaces_around_eq_in_named_parameter = false +ij_python_spaces_around_equality_operators = true +ij_python_spaces_around_multiplicative_operators = true +ij_python_spaces_around_power_operator = true +ij_python_spaces_around_relational_operators = true +ij_python_spaces_around_shift_operators = true +ij_python_spaces_within_braces = false +ij_python_spaces_within_brackets = false +ij_python_spaces_within_method_call_parentheses = false +ij_python_spaces_within_method_parentheses = false +ij_python_use_continuation_indent_for_arguments = false +ij_python_use_continuation_indent_for_collection_and_comprehensions = false +ij_python_use_continuation_indent_for_parameters = true +ij_python_wrap_long_lines = false -# Javascript and Typescript -[*.{js,js.map,ts}] -quote_style = doublequoted -termination_style = ensure_semicolon +[{*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,poetry.lock}] +ij_toml_keep_indents_on_empty_lines = false + +[{*.yaml,*.yml,pubspec.lock}] +indent_size = 2 +ij_yaml_align_values_properties = on_value +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true +ij_yaml_keep_indents_on_empty_lines = false +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true +indent_style = space + +[*.{appxmanifest,asax,ascx,aspx,axaml,build,c,c++,cc,cginc,compute,cp,cpp,cppm,cs,cshtml,cu,cuh,cxx,dtd,fs,fsi,fsscript,fsx,fx,fxh,h,hh,hlsl,hlsli,hlslinc,hpp,hxx,inc,inl,ino,ipp,ixx,master,ml,mli,mpp,mq4,mq5,mqh,nuspec,paml,razor,resw,resx,shader,skin,tpp,usf,ush,uxml,vb,xaml,xamlx,xoml,xsd}] +indent_style = space +indent_size = 4 +tab_width = 4 From fd83f02b8406d657eba23aaaceeb804ba90809cf Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 3 Oct 2023 21:13:54 +0100 Subject: [PATCH 41/53] Disable JetBrains spell checking in Spanish (Spain) resource files. --- Localization/Localization.es.resx | 1 + 1 file changed, 1 insertion(+) diff --git a/Localization/Localization.es.resx b/Localization/Localization.es.resx index 55b348d38..52afa7b9b 100644 --- a/Localization/Localization.es.resx +++ b/Localization/Localization.es.resx @@ -1,4 +1,5 @@ + text/microsoft-resx From f3a526b1ea3501cba0a1f5de0f0aadd70369053d Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 3 Oct 2023 21:26:12 +0100 Subject: [PATCH 42/53] Update code style. --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index fd4cb0e6b..99b0609a8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -57,7 +57,7 @@ dotnet_style_require_accessibility_modifiers = never:suggestion # ReSharper properties resharper_align_linq_query = true resharper_align_multiline_argument = true -resharper_align_multiline_array_and_object_initializer = true +resharper_align_multiline_array_and_object_initializer = false resharper_align_multiline_binary_expressions_chain = true resharper_align_multiline_binary_patterns = true resharper_align_multiline_calls_chain = true From ac1db3b2e94a3b6297ec1b0841ff113c3986c403 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 3 Oct 2023 21:41:42 +0100 Subject: [PATCH 43/53] Update code style (final). --- .editorconfig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 99b0609a8..9a88a7205 100644 --- a/.editorconfig +++ b/.editorconfig @@ -20,9 +20,10 @@ csharp_preferred_modifier_order = public, private, protected, internal, file, ne csharp_space_after_keywords_in_control_flow_statements = false csharp_style_namespace_declarations = file_scoped:warning csharp_style_prefer_utf8_string_literals = true:warning -csharp_style_var_elsewhere = false:none +csharp_style_var_elsewhere = false:suggestion csharp_style_var_for_built_in_types = false:suggestion -csharp_using_directive_placement = inside_namespace:silent +csharp_style_var_when_type_is_apparent = true:suggestion +csharp_using_directive_placement = outside_namespace:silent 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 = all_upper_style @@ -84,6 +85,7 @@ resharper_constructor_or_destructor_body = expression_body resharper_csharp_align_first_arg_by_paren = true resharper_csharp_empty_block_style = together_same_line resharper_csharp_place_comments_at_first_column = true +resharper_csharp_prefer_qualified_reference = false resharper_default_value_when_type_not_evident = default_expression resharper_enforce_line_ending_style = true resharper_formatter_off_tag = @formatter:off @@ -121,6 +123,8 @@ resharper_outdent_dots = true resharper_outdent_statement_labels = true resharper_parentheses_redundancy_style = remove resharper_place_attribute_on_same_line = false +resharper_place_simple_embedded_statement_on_same_line = false +resharper_qualified_using_at_nested_scope = true resharper_show_autodetect_configure_formatting_tip = false resharper_simple_block_style = on_single_line resharper_simple_case_statement_style = line_break @@ -138,6 +142,7 @@ resharper_space_within_empty_braces = false resharper_toplevel_function_declaration_return_type_style = on_single_line resharper_toplevel_function_definition_return_type_style = on_single_line resharper_use_indent_from_vs = false +resharper_wrap_after_dot_in_method_calls = true resharper_wrap_base_clause_style = chop_if_long resharper_wrap_braced_init_list_style = chop_if_long resharper_wrap_ctor_initializer_style = chop_if_long From 4ce6ff54c8b3c1c9c08339f60c181e4cabd7d770 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 3 Oct 2023 23:10:41 +0100 Subject: [PATCH 44/53] [Aaru.Decryption] Reformat and cleanup. --- .editorconfig | 2480 +++++++++++++------------ Aaru.Decryption.csproj | 10 +- Aaru.Decryption.csproj.DotSettings | 5 +- DVD/CSS.cs | 328 ++-- DVD/Dump.cs | 65 +- DVD/MPEG.cs | 131 +- Enums.cs | 7 +- Localization/Localization.Designer.cs | 82 +- Localization/Localization.es.resx | 46 +- Localization/Localization.resx | 58 +- 10 files changed, 1615 insertions(+), 1597 deletions(-) diff --git a/.editorconfig b/.editorconfig index 9a88a7205..71a05170a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,1334 +1,1338 @@ [*] -charset = utf-8 -end_of_line = lf -indent_size = 4 -indent_style = space -insert_final_newline = false -max_line_length = 120 -tab_width = 4 -trim_trailing_whitespace = false -ij_continuation_indent_size = 8 +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = false +max_line_length = 120 +tab_width = 2 +trim_trailing_whitespace = false +ij_continuation_indent_size = 4 ij_formatter_off_tag = @formatter:off -ij_formatter_on_tag = @formatter:on -ij_formatter_tags_enabled = true -ij_smart_tabs = false -ij_visual_guides = -ij_wrap_on_typing = false +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = true +ij_smart_tabs = false +ij_visual_guides = +ij_wrap_on_typing = false # Microsoft .NET properties -csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion -csharp_space_after_keywords_in_control_flow_statements = false -csharp_style_namespace_declarations = file_scoped:warning -csharp_style_prefer_utf8_string_literals = true:warning -csharp_style_var_elsewhere = false:suggestion -csharp_style_var_for_built_in_types = false:suggestion -csharp_style_var_when_type_is_apparent = true:suggestion -csharp_using_directive_placement = outside_namespace:silent -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 = all_upper_style -dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols -dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True -dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field -dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef -dotnet_naming_rule.unity_serialized_field_rule.severity = warning -dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style -dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols -dotnet_naming_style.all_upper_style.capitalization = all_upper -dotnet_naming_style.all_upper_style.word_separator = _ -dotnet_naming_style.lower_camel_case_style.capitalization = camel_case -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.unity_serialized_field_symbols.applicable_accessibilities = * -dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds = -dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field -dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance -dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:warning -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:warning -dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion -dotnet_style_predefined_type_for_member_access = true:suggestion -dotnet_style_qualification_for_event = false:suggestion -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 +csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion +csharp_space_after_keywords_in_control_flow_statements = false +csharp_style_namespace_declarations = file_scoped:warning +csharp_style_prefer_utf8_string_literals = true:warning +csharp_style_var_elsewhere = false:suggestion +csharp_style_var_for_built_in_types = false:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion +csharp_using_directive_placement = outside_namespace:silent +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 = all_upper_style +dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols +dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True +dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field +dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef +dotnet_naming_rule.unity_serialized_field_rule.severity = warning +dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style +dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols +dotnet_naming_style.all_upper_style.capitalization = all_upper +dotnet_naming_style.all_upper_style.word_separator = _ +dotnet_naming_style.lower_camel_case_style.capitalization = camel_case +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.unity_serialized_field_symbols.applicable_accessibilities = * +dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds = +dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field +dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance +dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:warning +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:warning +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion +dotnet_style_qualification_for_event = false:suggestion +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 # ReSharper properties -resharper_align_linq_query = true -resharper_align_multiline_argument = true -resharper_align_multiline_array_and_object_initializer = false -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_expression_braces = true -resharper_align_multiline_extends_list = true -resharper_align_multiline_for_stmt = true -resharper_align_multiline_list_pattern = 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_ternary = align_all -resharper_align_tuple_components = true -resharper_autodetect_indent_settings = true -resharper_braces_for_for = required_for_multiline -resharper_braces_for_foreach = required_for_multiline -resharper_braces_for_ifelse = required_for_multiline -resharper_braces_for_while = required_for_multiline -resharper_builtin_type_apply_to_native_integer = true -resharper_constructor_or_destructor_body = expression_body -resharper_csharp_align_first_arg_by_paren = true -resharper_csharp_empty_block_style = together_same_line -resharper_csharp_place_comments_at_first_column = true -resharper_csharp_prefer_qualified_reference = false -resharper_default_value_when_type_not_evident = default_expression -resharper_enforce_line_ending_style = true +resharper_align_first_arg_by_paren = false +resharper_align_linq_query = true +resharper_align_multiline_argument = true +resharper_align_multiline_array_and_object_initializer = false +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_expression_braces = true +resharper_align_multiline_extends_list = true +resharper_align_multiline_for_stmt = true +resharper_align_multiline_list_pattern = 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_ternary = align_all +resharper_align_tuple_components = true +resharper_autodetect_indent_settings = true +resharper_braces_for_for = required_for_multiline +resharper_braces_for_foreach = required_for_multiline +resharper_braces_for_ifelse = required_for_multiline +resharper_braces_for_while = required_for_multiline +resharper_builtin_type_apply_to_native_integer = false +resharper_constructor_or_destructor_body = expression_body +resharper_csharp_align_first_arg_by_paren = false +resharper_csharp_empty_block_style = together_same_line +resharper_csharp_place_comments_at_first_column = true +resharper_csharp_prefer_qualified_reference = false +resharper_default_value_when_type_not_evident = default_expression +resharper_enforce_line_ending_style = true resharper_formatter_off_tag = @formatter:off -resharper_formatter_on_tag = @formatter:on -resharper_formatter_tags_enabled = true -resharper_for_built_in_types = use_var_when_evident -resharper_function_declaration_return_type_style = on_single_line -resharper_function_definition_return_type_style = on_single_line -resharper_html_pi_attribute_style = first_attribute_on_single_line -resharper_indent_anonymous_method_block = true -resharper_indent_preprocessor_if = outdent -resharper_indent_preprocessor_other = outdent -resharper_indent_preprocessor_region = outdent -resharper_int_align = true -resharper_int_align_bitfield_sizes = true -resharper_int_align_comments = true -resharper_int_align_declaration_names = true -resharper_int_align_enum_initializers = true -resharper_int_align_eq = true -resharper_keep_existing_embedded_arrangement = false -resharper_keep_existing_initializer_arrangement = false -resharper_keep_existing_list_patterns_arrangement = false -resharper_keep_existing_property_patterns_arrangement = false -resharper_keep_existing_switch_expression_arrangement = false -resharper_line_break_after_colon_in_member_initializer_lists = on_single_line -resharper_line_break_before_requires_clause = on_single_line -resharper_linkage_specification_indentation = all -resharper_local_function_body = expression_body -resharper_member_initializer_list_style = on_single_line -resharper_method_or_operator_body = expression_body -resharper_outdent_binary_ops = true -resharper_outdent_binary_pattern_ops = true -resharper_outdent_commas = true -resharper_outdent_dots = true -resharper_outdent_statement_labels = true -resharper_parentheses_redundancy_style = remove -resharper_place_attribute_on_same_line = false -resharper_place_simple_embedded_statement_on_same_line = false -resharper_qualified_using_at_nested_scope = true -resharper_show_autodetect_configure_formatting_tip = false -resharper_simple_block_style = on_single_line -resharper_simple_case_statement_style = line_break -resharper_simple_embedded_statement_style = on_single_line -resharper_space_after_ptr_in_data_member = false -resharper_space_after_ptr_in_method = false -resharper_space_after_ref_in_data_member = false -resharper_space_after_ref_in_method = false -resharper_space_before_ptr_in_data_member = true -resharper_space_before_ptr_in_method = true -resharper_space_before_ref_in_data_member = true -resharper_space_before_ref_in_method = true -resharper_space_before_template_params = false -resharper_space_within_empty_braces = false -resharper_toplevel_function_declaration_return_type_style = on_single_line -resharper_toplevel_function_definition_return_type_style = on_single_line -resharper_use_indent_from_vs = false -resharper_wrap_after_dot_in_method_calls = true -resharper_wrap_base_clause_style = chop_if_long -resharper_wrap_braced_init_list_style = chop_if_long -resharper_wrap_ctor_initializer_style = chop_if_long -resharper_wrap_lines = true -resharper_xmldoc_attribute_indent = align_by_first_attribute -resharper_xmldoc_attribute_style = first_attribute_on_single_line -resharper_xmldoc_pi_attribute_style = first_attribute_on_single_line +resharper_formatter_on_tag = @formatter:on +resharper_formatter_tags_enabled = true +resharper_for_built_in_types = use_var_when_evident +resharper_function_declaration_return_type_style = on_single_line +resharper_function_definition_return_type_style = on_single_line +resharper_html_pi_attribute_style = first_attribute_on_single_line +resharper_indent_anonymous_method_block = false +resharper_indent_preprocessor_if = outdent +resharper_indent_preprocessor_other = outdent +resharper_indent_preprocessor_region = outdent +resharper_int_align = true +resharper_int_align_bitfield_sizes = true +resharper_int_align_comments = true +resharper_int_align_declaration_names = true +resharper_int_align_enum_initializers = true +resharper_int_align_eq = true +resharper_keep_existing_embedded_arrangement = false +resharper_keep_existing_initializer_arrangement = false +resharper_keep_existing_list_patterns_arrangement = false +resharper_keep_existing_property_patterns_arrangement = false +resharper_keep_existing_switch_expression_arrangement = false +resharper_line_break_after_colon_in_member_initializer_lists = on_single_line +resharper_line_break_before_requires_clause = on_single_line +resharper_linkage_specification_indentation = all +resharper_local_function_body = expression_body +resharper_member_initializer_list_style = on_single_line +resharper_method_or_operator_body = expression_body +resharper_outdent_binary_ops = true +resharper_outdent_binary_pattern_ops = true +resharper_outdent_commas = true +resharper_outdent_dots = true +resharper_outdent_statement_labels = true +resharper_parentheses_redundancy_style = remove +resharper_place_attribute_on_same_line = false +resharper_place_simple_embedded_statement_on_same_line = false +resharper_qualified_using_at_nested_scope = true +resharper_show_autodetect_configure_formatting_tip = false +resharper_simple_block_style = on_single_line +resharper_simple_case_statement_style = line_break +resharper_simple_embedded_statement_style = on_single_line +resharper_space_after_ptr_in_data_member = false +resharper_space_after_ptr_in_method = false +resharper_space_after_ref_in_data_member = false +resharper_space_after_ref_in_method = false +resharper_space_before_ptr_in_data_member = true +resharper_space_before_ptr_in_method = true +resharper_space_before_ref_in_data_member = true +resharper_space_before_ref_in_method = true +resharper_space_before_template_params = false +resharper_space_within_empty_braces = false +resharper_toplevel_function_declaration_return_type_style = on_single_line +resharper_toplevel_function_definition_return_type_style = on_single_line +resharper_use_indent_from_vs = false +resharper_wrap_after_dot_in_method_calls = true +resharper_wrap_base_clause_style = chop_if_long +resharper_wrap_braced_init_list_style = chop_if_long +resharper_wrap_ctor_initializer_style = chop_if_long +resharper_wrap_lines = true +resharper_xmldoc_attribute_indent = align_by_first_attribute +resharper_xmldoc_attribute_style = first_attribute_on_single_line +resharper_xmldoc_pi_attribute_style = first_attribute_on_single_line # ReSharper inspection severities -resharper_annotate_can_be_null_parameter_highlighting = warning -resharper_annotate_can_be_null_type_member_highlighting = warning -resharper_annotate_not_null_parameter_highlighting = warning -resharper_annotate_not_null_type_member_highlighting = warning -resharper_arguments_style_anonymous_function_highlighting = warning -resharper_arguments_style_literal_highlighting = warning -resharper_arguments_style_named_expression_highlighting = warning -resharper_arguments_style_other_highlighting = warning -resharper_arguments_style_string_literal_highlighting = warning -resharper_arrange_accessor_owner_body_highlighting = warning -resharper_arrange_constructor_or_destructor_body_highlighting = warning -resharper_arrange_local_function_body_highlighting = warning -resharper_arrange_method_or_operator_body_highlighting = warning -resharper_arrange_redundant_parentheses_highlighting = hint -resharper_arrange_static_member_qualifier_highlighting = warning -resharper_arrange_this_qualifier_highlighting = hint -resharper_arrange_trailing_comma_in_multiline_lists_highlighting = warning -resharper_arrange_trailing_comma_in_singleline_lists_highlighting = warning -resharper_arrange_type_member_modifiers_highlighting = hint -resharper_arrange_type_modifiers_highlighting = hint -resharper_arrange_var_keywords_in_deconstructing_declaration_highlighting = warning -resharper_async_void_method_highlighting = warning -resharper_auto_property_can_be_made_get_only_global_highlighting = warning -resharper_auto_property_can_be_made_get_only_local_highlighting = warning -resharper_bad_attribute_brackets_spaces_highlighting = warning -resharper_bad_braces_spaces_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 = warning -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_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_built_in_type_reference_style_for_member_access_highlighting = hint -resharper_built_in_type_reference_style_highlighting = hint -resharper_check_for_reference_equality_instead_1_highlighting = warning -resharper_check_for_reference_equality_instead_2_highlighting = warning -resharper_check_for_reference_equality_instead_3_highlighting = warning -resharper_check_for_reference_equality_instead_4_highlighting = warning -resharper_class_can_be_sealed_global_highlighting = warning -resharper_class_can_be_sealed_local_highlighting = warning -resharper_class_never_instantiated_global_highlighting = warning -resharper_class_never_instantiated_local_highlighting = warning -resharper_class_with_virtual_members_never_inherited_global_highlighting = warning -resharper_class_with_virtual_members_never_inherited_local_highlighting = warning -resharper_comment_typo_highlighting = none -resharper_compare_non_constrained_generic_with_null_highlighting = warning -resharper_convert_closure_to_method_group_highlighting = warning -resharper_convert_conditional_ternary_expression_to_switch_expression_highlighting = warning -resharper_convert_if_do_to_while_highlighting = warning -resharper_convert_if_statement_to_conditional_ternary_expression_highlighting = warning -resharper_convert_if_statement_to_null_coalescing_assignment_highlighting = warning -resharper_convert_if_statement_to_null_coalescing_expression_highlighting = warning -resharper_convert_if_statement_to_return_statement_highlighting = warning -resharper_convert_if_statement_to_switch_statement_highlighting = warning -resharper_convert_if_to_or_expression_highlighting = warning -resharper_convert_nullable_to_short_form_highlighting = warning -resharper_convert_switch_statement_to_switch_expression_highlighting = warning -resharper_convert_to_auto_property_highlighting = warning -resharper_convert_to_auto_property_when_possible_highlighting = warning -resharper_convert_to_auto_property_with_private_setter_highlighting = warning -resharper_convert_to_compound_assignment_highlighting = warning -resharper_convert_to_constant_global_highlighting = warning -resharper_convert_to_constant_local_highlighting = warning -resharper_convert_to_lambda_expression_highlighting = warning -resharper_convert_to_local_function_highlighting = warning -resharper_convert_to_null_coalescing_compound_assignment_highlighting = warning -resharper_convert_to_primary_constructor_highlighting = warning -resharper_convert_to_static_class_highlighting = warning -resharper_convert_to_using_declaration_highlighting = warning -resharper_cpp_enforce_cv_qualifiers_order_highlighting = hint -resharper_cpp_enforce_cv_qualifiers_placement_highlighting = hint -resharper_cpp_enforce_do_statement_braces_highlighting = hint -resharper_cpp_enforce_for_statement_braces_highlighting = hint -resharper_cpp_enforce_function_declaration_style_highlighting = hint -resharper_cpp_enforce_if_statement_braces_highlighting = hint -resharper_cpp_enforce_type_alias_code_style_highlighting = hint -resharper_cpp_enforce_while_statement_braces_highlighting = hint -resharper_cpp_remove_redundant_braces_highlighting = hint -resharper_double_negation_in_pattern_highlighting = warning -resharper_double_negation_operator_highlighting = warning -resharper_event_never_invoked_global_highlighting = warning -resharper_event_never_subscribed_to_global_highlighting = warning -resharper_event_never_subscribed_to_local_highlighting = warning -resharper_field_can_be_made_read_only_global_highlighting = warning -resharper_field_can_be_made_read_only_local_highlighting = warning -resharper_foreach_can_be_converted_to_query_using_another_get_enumerator_highlighting = warning -resharper_foreach_can_be_partly_converted_to_query_using_another_get_enumerator_highlighting = none -resharper_for_can_be_converted_to_foreach_highlighting = warning -resharper_heap_view_boxing_allocation_highlighting = none -resharper_heap_view_closure_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_identifier_typo_highlighting = none -resharper_incorrect_blank_lines_near_braces_highlighting = warning -resharper_inheritdoc_consider_usage_highlighting = warning -resharper_inline_out_variable_declaration_highlighting = warning -resharper_inline_temporary_variable_highlighting = warning -resharper_introduce_optional_parameters_global_highlighting = warning -resharper_introduce_optional_parameters_local_highlighting = warning -resharper_invert_condition_1_highlighting = warning -resharper_invert_if_highlighting = warning -resharper_invocation_is_skipped_highlighting = warning -resharper_invoke_as_extension_method_highlighting = warning -resharper_join_declaration_and_initializer_highlighting = warning -resharper_join_null_check_with_usage_highlighting = warning -resharper_lambda_expression_must_be_static_highlighting = warning -resharper_local_function_can_be_made_static_highlighting = warning -resharper_loop_can_be_converted_to_query_highlighting = warning -resharper_loop_can_be_partly_converted_to_query_highlighting = warning -resharper_member_can_be_file_local_highlighting = warning -resharper_member_can_be_internal_highlighting = warning -resharper_member_can_be_made_static_global_highlighting = warning -resharper_member_can_be_made_static_local_highlighting = warning -resharper_member_can_be_private_global_highlighting = warning -resharper_member_can_be_private_local_highlighting = warning -resharper_member_can_be_protected_global_highlighting = warning -resharper_member_can_be_protected_local_highlighting = warning -resharper_merge_and_pattern_highlighting = warning -resharper_merge_cast_with_type_check_highlighting = warning -resharper_merge_conditional_expression_highlighting = warning -resharper_merge_into_logical_pattern_highlighting = warning -resharper_merge_into_negated_pattern_highlighting = warning -resharper_merge_into_pattern_highlighting = warning -resharper_merge_nested_property_patterns_highlighting = warning -resharper_merge_sequential_checks_highlighting = warning -resharper_method_has_async_overload_highlighting = warning -resharper_method_has_async_overload_with_cancellation_highlighting = warning -resharper_method_supports_cancellation_highlighting = warning -resharper_missing_blank_lines_highlighting = warning -resharper_missing_linebreak_highlighting = warning -resharper_missing_space_highlighting = warning -resharper_more_specific_foreach_variable_type_available_highlighting = warning -resharper_move_to_existing_positional_deconstruction_pattern_highlighting = warning -resharper_move_variable_declaration_inside_loop_condition_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_negation_of_relational_pattern_highlighting = warning -resharper_negative_equality_expression_highlighting = warning -resharper_nested_string_interpolation_highlighting = warning -resharper_not_accessed_field_global_highlighting = warning -resharper_nullable_warning_suppression_is_used_highlighting = warning -resharper_outdent_is_off_prev_level_highlighting = warning -resharper_out_parameter_value_is_always_discarded_global_highlighting = warning -resharper_parameter_only_used_for_precondition_check_global_highlighting = warning -resharper_parameter_type_can_be_enumerable_global_highlighting = warning -resharper_parameter_type_can_be_enumerable_local_highlighting = warning -resharper_pass_string_interpolation_highlighting = warning -resharper_possible_unintended_queryable_as_enumerable_highlighting = warning -resharper_property_can_be_made_init_only_global_highlighting = warning -resharper_property_can_be_made_init_only_local_highlighting = warning -resharper_public_constructor_in_abstract_class_highlighting = warning -resharper_raw_string_can_be_simplified_highlighting = warning -resharper_redundant_accessor_body_highlighting = warning -resharper_redundant_always_match_subpattern_highlighting = warning -resharper_redundant_array_creation_expression_highlighting = warning -resharper_redundant_attribute_parentheses_highlighting = warning -resharper_redundant_attribute_usage_property_highlighting = warning -resharper_redundant_base_qualifier_highlighting = warning -resharper_redundant_blank_lines_highlighting = warning -resharper_redundant_collection_initializer_element_braces_highlighting = warning -resharper_redundant_configure_await_highlighting = warning -resharper_redundant_declaration_semicolon_highlighting = warning -resharper_redundant_discard_designation_highlighting = warning -resharper_redundant_empty_object_creation_argument_list_highlighting = warning -resharper_redundant_enum_case_label_for_default_section_highlighting = warning -resharper_redundant_explicit_params_array_creation_highlighting = warning -resharper_redundant_fixed_pointer_declaration_highlighting = warning -resharper_redundant_if_else_block_highlighting = warning -resharper_redundant_immediate_delegate_invocation_highlighting = warning -resharper_redundant_is_before_relational_pattern_highlighting = warning -resharper_redundant_lambda_signature_parentheses_highlighting = warning -resharper_redundant_overload_global_highlighting = warning -resharper_redundant_overload_local_highlighting = warning -resharper_redundant_pattern_parentheses_highlighting = warning -resharper_redundant_property_pattern_clause_highlighting = warning -resharper_redundant_query_order_by_ascending_keyword_highlighting = warning -resharper_redundant_range_bound_highlighting = warning -resharper_redundant_readonly_modifier_highlighting = warning -resharper_redundant_space_highlighting = warning -resharper_redundant_string_interpolation_highlighting = warning -resharper_redundant_to_string_call_for_value_type_highlighting = warning -resharper_redundant_verbatim_prefix_highlighting = warning -resharper_redundant_verbatim_string_prefix_highlighting = warning -resharper_redundant_with_expression_highlighting = warning -resharper_remove_constructor_invocation_highlighting = warning -resharper_remove_redundant_braces_highlighting = warning -resharper_remove_redundant_or_statement_false_highlighting = warning -resharper_remove_redundant_or_statement_true_highlighting = warning -resharper_remove_to_list_1_highlighting = warning -resharper_remove_to_list_2_highlighting = warning -resharper_replace_auto_property_with_computed_property_highlighting = warning -resharper_replace_conditional_expression_with_null_coalescing_highlighting = warning -resharper_replace_object_pattern_with_var_pattern_highlighting = warning -resharper_replace_slice_with_range_indexer_highlighting = warning -resharper_replace_substring_with_range_indexer_highlighting = warning -resharper_replace_with_field_keyword_highlighting = warning -resharper_replace_with_first_or_default_1_highlighting = warning -resharper_replace_with_first_or_default_2_highlighting = warning -resharper_replace_with_first_or_default_3_highlighting = warning -resharper_replace_with_first_or_default_4_highlighting = warning -resharper_replace_with_last_or_default_1_highlighting = warning -resharper_replace_with_last_or_default_2_highlighting = warning -resharper_replace_with_last_or_default_3_highlighting = warning -resharper_replace_with_last_or_default_4_highlighting = warning -resharper_replace_with_of_type_1_highlighting = warning -resharper_replace_with_of_type_2_highlighting = warning -resharper_replace_with_of_type_3_highlighting = warning -resharper_replace_with_of_type_any_1_highlighting = warning -resharper_replace_with_of_type_any_2_highlighting = warning -resharper_replace_with_of_type_count_1_highlighting = warning -resharper_replace_with_of_type_count_2_highlighting = warning -resharper_replace_with_of_type_first_1_highlighting = warning -resharper_replace_with_of_type_first_2_highlighting = warning -resharper_replace_with_of_type_first_or_default_1_highlighting = warning -resharper_replace_with_of_type_first_or_default_2_highlighting = warning -resharper_replace_with_of_type_last_1_highlighting = warning -resharper_replace_with_of_type_last_2_highlighting = warning -resharper_replace_with_of_type_last_or_default_1_highlighting = warning -resharper_replace_with_of_type_last_or_default_2_highlighting = warning -resharper_replace_with_of_type_long_count_highlighting = warning -resharper_replace_with_of_type_single_1_highlighting = warning -resharper_replace_with_of_type_single_2_highlighting = warning -resharper_replace_with_of_type_single_or_default_1_highlighting = warning -resharper_replace_with_of_type_single_or_default_2_highlighting = warning -resharper_replace_with_of_type_where_highlighting = warning -resharper_replace_with_simple_assignment_false_highlighting = warning -resharper_replace_with_simple_assignment_true_highlighting = warning -resharper_replace_with_single_assignment_false_highlighting = warning -resharper_replace_with_single_assignment_true_highlighting = warning -resharper_replace_with_single_call_to_any_highlighting = warning -resharper_replace_with_single_call_to_count_highlighting = warning -resharper_replace_with_single_call_to_first_highlighting = warning -resharper_replace_with_single_call_to_first_or_default_highlighting = warning -resharper_replace_with_single_call_to_last_highlighting = warning -resharper_replace_with_single_call_to_last_or_default_highlighting = warning -resharper_replace_with_single_call_to_single_highlighting = warning -resharper_replace_with_single_call_to_single_or_default_highlighting = warning -resharper_replace_with_single_or_default_1_highlighting = warning -resharper_replace_with_single_or_default_2_highlighting = warning -resharper_replace_with_single_or_default_3_highlighting = warning -resharper_replace_with_single_or_default_4_highlighting = warning -resharper_replace_with_string_is_null_or_empty_highlighting = warning -resharper_return_type_can_be_enumerable_global_highlighting = warning -resharper_return_type_can_be_enumerable_local_highlighting = warning -resharper_safe_cast_is_used_as_type_check_highlighting = warning -resharper_separate_control_transfer_statement_highlighting = warning -resharper_similar_anonymous_type_nearby_highlighting = warning -resharper_simplify_conditional_ternary_expression_highlighting = warning -resharper_simplify_linq_expression_use_all_highlighting = warning -resharper_simplify_linq_expression_use_any_highlighting = warning -resharper_simplify_linq_expression_use_min_by_and_max_by_highlighting = warning -resharper_simplify_string_interpolation_highlighting = warning -resharper_specify_string_comparison_highlighting = warning -resharper_string_ends_with_is_culture_specific_highlighting = warning -resharper_string_literal_as_interpolation_argument_highlighting = warning -resharper_string_literal_typo_highlighting = warning -resharper_string_starts_with_is_culture_specific_highlighting = warning -resharper_struct_can_be_made_read_only_highlighting = warning -resharper_struct_member_can_be_made_read_only_highlighting = warning -resharper_suggest_base_type_for_parameter_highlighting = none -resharper_suggest_base_type_for_parameter_in_constructor_highlighting = warning -resharper_suggest_var_or_type_built_in_types_highlighting = hint -resharper_suggest_var_or_type_deconstruction_declarations_highlighting = warning -resharper_suggest_var_or_type_elsewhere_highlighting = hint -resharper_suggest_var_or_type_simple_types_highlighting = hint -resharper_swap_via_deconstruction_highlighting = warning +resharper_annotate_can_be_null_parameter_highlighting = warning +resharper_annotate_can_be_null_type_member_highlighting = warning +resharper_annotate_not_null_parameter_highlighting = warning +resharper_annotate_not_null_type_member_highlighting = warning +resharper_arguments_style_anonymous_function_highlighting = warning +resharper_arguments_style_literal_highlighting = warning +resharper_arguments_style_named_expression_highlighting = warning +resharper_arguments_style_other_highlighting = warning +resharper_arguments_style_string_literal_highlighting = warning +resharper_arrange_accessor_owner_body_highlighting = warning +resharper_arrange_constructor_or_destructor_body_highlighting = warning +resharper_arrange_local_function_body_highlighting = warning +resharper_arrange_method_or_operator_body_highlighting = warning +resharper_arrange_redundant_parentheses_highlighting = hint +resharper_arrange_static_member_qualifier_highlighting = warning +resharper_arrange_this_qualifier_highlighting = hint +resharper_arrange_trailing_comma_in_multiline_lists_highlighting = warning +resharper_arrange_trailing_comma_in_singleline_lists_highlighting = warning +resharper_arrange_type_member_modifiers_highlighting = hint +resharper_arrange_type_modifiers_highlighting = hint +resharper_arrange_var_keywords_in_deconstructing_declaration_highlighting = warning +resharper_async_void_method_highlighting = warning +resharper_auto_property_can_be_made_get_only_global_highlighting = warning +resharper_auto_property_can_be_made_get_only_local_highlighting = warning +resharper_bad_attribute_brackets_spaces_highlighting = warning +resharper_bad_braces_spaces_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 = warning +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_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_built_in_type_reference_style_for_member_access_highlighting = hint +resharper_built_in_type_reference_style_highlighting = hint +resharper_check_for_reference_equality_instead_1_highlighting = warning +resharper_check_for_reference_equality_instead_2_highlighting = warning +resharper_check_for_reference_equality_instead_3_highlighting = warning +resharper_check_for_reference_equality_instead_4_highlighting = warning +resharper_class_can_be_sealed_global_highlighting = warning +resharper_class_can_be_sealed_local_highlighting = warning +resharper_class_never_instantiated_global_highlighting = warning +resharper_class_never_instantiated_local_highlighting = warning +resharper_class_with_virtual_members_never_inherited_global_highlighting = warning +resharper_class_with_virtual_members_never_inherited_local_highlighting = warning +resharper_comment_typo_highlighting = none +resharper_compare_non_constrained_generic_with_null_highlighting = warning +resharper_convert_closure_to_method_group_highlighting = warning +resharper_convert_conditional_ternary_expression_to_switch_expression_highlighting = warning +resharper_convert_if_do_to_while_highlighting = warning +resharper_convert_if_statement_to_conditional_ternary_expression_highlighting = warning +resharper_convert_if_statement_to_null_coalescing_assignment_highlighting = warning +resharper_convert_if_statement_to_null_coalescing_expression_highlighting = warning +resharper_convert_if_statement_to_return_statement_highlighting = warning +resharper_convert_if_statement_to_switch_statement_highlighting = warning +resharper_convert_if_to_or_expression_highlighting = warning +resharper_convert_nullable_to_short_form_highlighting = warning +resharper_convert_switch_statement_to_switch_expression_highlighting = warning +resharper_convert_to_auto_property_highlighting = warning +resharper_convert_to_auto_property_when_possible_highlighting = warning +resharper_convert_to_auto_property_with_private_setter_highlighting = warning +resharper_convert_to_compound_assignment_highlighting = warning +resharper_convert_to_constant_global_highlighting = warning +resharper_convert_to_constant_local_highlighting = warning +resharper_convert_to_lambda_expression_highlighting = warning +resharper_convert_to_local_function_highlighting = warning +resharper_convert_to_null_coalescing_compound_assignment_highlighting = warning +resharper_convert_to_primary_constructor_highlighting = warning +resharper_convert_to_static_class_highlighting = warning +resharper_convert_to_using_declaration_highlighting = warning +resharper_cpp_enforce_cv_qualifiers_order_highlighting = hint +resharper_cpp_enforce_cv_qualifiers_placement_highlighting = hint +resharper_cpp_enforce_do_statement_braces_highlighting = hint +resharper_cpp_enforce_for_statement_braces_highlighting = hint +resharper_cpp_enforce_function_declaration_style_highlighting = hint +resharper_cpp_enforce_if_statement_braces_highlighting = hint +resharper_cpp_enforce_type_alias_code_style_highlighting = hint +resharper_cpp_enforce_while_statement_braces_highlighting = hint +resharper_cpp_remove_redundant_braces_highlighting = hint +resharper_double_negation_in_pattern_highlighting = warning +resharper_double_negation_operator_highlighting = warning +resharper_event_never_invoked_global_highlighting = warning +resharper_event_never_subscribed_to_global_highlighting = warning +resharper_event_never_subscribed_to_local_highlighting = warning +resharper_field_can_be_made_read_only_global_highlighting = warning +resharper_field_can_be_made_read_only_local_highlighting = warning +resharper_foreach_can_be_converted_to_query_using_another_get_enumerator_highlighting = warning +resharper_foreach_can_be_partly_converted_to_query_using_another_get_enumerator_highlighting = none +resharper_for_can_be_converted_to_foreach_highlighting = warning +resharper_heap_view_boxing_allocation_highlighting = none +resharper_heap_view_closure_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_identifier_typo_highlighting = none +resharper_incorrect_blank_lines_near_braces_highlighting = warning +resharper_inheritdoc_consider_usage_highlighting = warning +resharper_inline_out_variable_declaration_highlighting = warning +resharper_inline_temporary_variable_highlighting = warning +resharper_introduce_optional_parameters_global_highlighting = warning +resharper_introduce_optional_parameters_local_highlighting = warning +resharper_invert_condition_1_highlighting = warning +resharper_invert_if_highlighting = warning +resharper_invocation_is_skipped_highlighting = warning +resharper_invoke_as_extension_method_highlighting = warning +resharper_join_declaration_and_initializer_highlighting = warning +resharper_join_null_check_with_usage_highlighting = warning +resharper_lambda_expression_must_be_static_highlighting = warning +resharper_local_function_can_be_made_static_highlighting = warning +resharper_loop_can_be_converted_to_query_highlighting = warning +resharper_loop_can_be_partly_converted_to_query_highlighting = warning +resharper_member_can_be_file_local_highlighting = warning +resharper_member_can_be_internal_highlighting = warning +resharper_member_can_be_made_static_global_highlighting = warning +resharper_member_can_be_made_static_local_highlighting = warning +resharper_member_can_be_private_global_highlighting = warning +resharper_member_can_be_private_local_highlighting = warning +resharper_member_can_be_protected_global_highlighting = warning +resharper_member_can_be_protected_local_highlighting = warning +resharper_merge_and_pattern_highlighting = warning +resharper_merge_cast_with_type_check_highlighting = warning +resharper_merge_conditional_expression_highlighting = warning +resharper_merge_into_logical_pattern_highlighting = warning +resharper_merge_into_negated_pattern_highlighting = warning +resharper_merge_into_pattern_highlighting = warning +resharper_merge_nested_property_patterns_highlighting = warning +resharper_merge_sequential_checks_highlighting = warning +resharper_method_has_async_overload_highlighting = warning +resharper_method_has_async_overload_with_cancellation_highlighting = warning +resharper_method_supports_cancellation_highlighting = warning +resharper_missing_blank_lines_highlighting = warning +resharper_missing_linebreak_highlighting = warning +resharper_missing_space_highlighting = warning +resharper_more_specific_foreach_variable_type_available_highlighting = warning +resharper_move_to_existing_positional_deconstruction_pattern_highlighting = warning +resharper_move_variable_declaration_inside_loop_condition_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_negation_of_relational_pattern_highlighting = warning +resharper_negative_equality_expression_highlighting = warning +resharper_nested_string_interpolation_highlighting = warning +resharper_not_accessed_field_global_highlighting = warning +resharper_nullable_warning_suppression_is_used_highlighting = warning +resharper_outdent_is_off_prev_level_highlighting = warning +resharper_out_parameter_value_is_always_discarded_global_highlighting = warning +resharper_parameter_only_used_for_precondition_check_global_highlighting = warning +resharper_parameter_type_can_be_enumerable_global_highlighting = warning +resharper_parameter_type_can_be_enumerable_local_highlighting = warning +resharper_pass_string_interpolation_highlighting = warning +resharper_possible_unintended_queryable_as_enumerable_highlighting = warning +resharper_property_can_be_made_init_only_global_highlighting = warning +resharper_property_can_be_made_init_only_local_highlighting = warning +resharper_public_constructor_in_abstract_class_highlighting = warning +resharper_raw_string_can_be_simplified_highlighting = warning +resharper_redundant_accessor_body_highlighting = warning +resharper_redundant_always_match_subpattern_highlighting = warning +resharper_redundant_array_creation_expression_highlighting = warning +resharper_redundant_attribute_parentheses_highlighting = warning +resharper_redundant_attribute_usage_property_highlighting = warning +resharper_redundant_base_qualifier_highlighting = warning +resharper_redundant_blank_lines_highlighting = warning +resharper_redundant_collection_initializer_element_braces_highlighting = warning +resharper_redundant_configure_await_highlighting = warning +resharper_redundant_declaration_semicolon_highlighting = warning +resharper_redundant_discard_designation_highlighting = warning +resharper_redundant_empty_object_creation_argument_list_highlighting = warning +resharper_redundant_enum_case_label_for_default_section_highlighting = warning +resharper_redundant_explicit_params_array_creation_highlighting = warning +resharper_redundant_fixed_pointer_declaration_highlighting = warning +resharper_redundant_if_else_block_highlighting = warning +resharper_redundant_immediate_delegate_invocation_highlighting = warning +resharper_redundant_is_before_relational_pattern_highlighting = warning +resharper_redundant_lambda_signature_parentheses_highlighting = warning +resharper_redundant_overload_global_highlighting = warning +resharper_redundant_overload_local_highlighting = warning +resharper_redundant_pattern_parentheses_highlighting = warning +resharper_redundant_property_pattern_clause_highlighting = warning +resharper_redundant_query_order_by_ascending_keyword_highlighting = warning +resharper_redundant_range_bound_highlighting = warning +resharper_redundant_readonly_modifier_highlighting = warning +resharper_redundant_space_highlighting = warning +resharper_redundant_string_interpolation_highlighting = warning +resharper_redundant_to_string_call_for_value_type_highlighting = warning +resharper_redundant_verbatim_prefix_highlighting = warning +resharper_redundant_verbatim_string_prefix_highlighting = warning +resharper_redundant_with_expression_highlighting = warning +resharper_remove_constructor_invocation_highlighting = warning +resharper_remove_redundant_braces_highlighting = warning +resharper_remove_redundant_or_statement_false_highlighting = warning +resharper_remove_redundant_or_statement_true_highlighting = warning +resharper_remove_to_list_1_highlighting = warning +resharper_remove_to_list_2_highlighting = warning +resharper_replace_auto_property_with_computed_property_highlighting = warning +resharper_replace_conditional_expression_with_null_coalescing_highlighting = warning +resharper_replace_object_pattern_with_var_pattern_highlighting = warning +resharper_replace_slice_with_range_indexer_highlighting = warning +resharper_replace_substring_with_range_indexer_highlighting = warning +resharper_replace_with_field_keyword_highlighting = warning +resharper_replace_with_first_or_default_1_highlighting = warning +resharper_replace_with_first_or_default_2_highlighting = warning +resharper_replace_with_first_or_default_3_highlighting = warning +resharper_replace_with_first_or_default_4_highlighting = warning +resharper_replace_with_last_or_default_1_highlighting = warning +resharper_replace_with_last_or_default_2_highlighting = warning +resharper_replace_with_last_or_default_3_highlighting = warning +resharper_replace_with_last_or_default_4_highlighting = warning +resharper_replace_with_of_type_1_highlighting = warning +resharper_replace_with_of_type_2_highlighting = warning +resharper_replace_with_of_type_3_highlighting = warning +resharper_replace_with_of_type_any_1_highlighting = warning +resharper_replace_with_of_type_any_2_highlighting = warning +resharper_replace_with_of_type_count_1_highlighting = warning +resharper_replace_with_of_type_count_2_highlighting = warning +resharper_replace_with_of_type_first_1_highlighting = warning +resharper_replace_with_of_type_first_2_highlighting = warning +resharper_replace_with_of_type_first_or_default_1_highlighting = warning +resharper_replace_with_of_type_first_or_default_2_highlighting = warning +resharper_replace_with_of_type_last_1_highlighting = warning +resharper_replace_with_of_type_last_2_highlighting = warning +resharper_replace_with_of_type_last_or_default_1_highlighting = warning +resharper_replace_with_of_type_last_or_default_2_highlighting = warning +resharper_replace_with_of_type_long_count_highlighting = warning +resharper_replace_with_of_type_single_1_highlighting = warning +resharper_replace_with_of_type_single_2_highlighting = warning +resharper_replace_with_of_type_single_or_default_1_highlighting = warning +resharper_replace_with_of_type_single_or_default_2_highlighting = warning +resharper_replace_with_of_type_where_highlighting = warning +resharper_replace_with_simple_assignment_false_highlighting = warning +resharper_replace_with_simple_assignment_true_highlighting = warning +resharper_replace_with_single_assignment_false_highlighting = warning +resharper_replace_with_single_assignment_true_highlighting = warning +resharper_replace_with_single_call_to_any_highlighting = warning +resharper_replace_with_single_call_to_count_highlighting = warning +resharper_replace_with_single_call_to_first_highlighting = warning +resharper_replace_with_single_call_to_first_or_default_highlighting = warning +resharper_replace_with_single_call_to_last_highlighting = warning +resharper_replace_with_single_call_to_last_or_default_highlighting = warning +resharper_replace_with_single_call_to_single_highlighting = warning +resharper_replace_with_single_call_to_single_or_default_highlighting = warning +resharper_replace_with_single_or_default_1_highlighting = warning +resharper_replace_with_single_or_default_2_highlighting = warning +resharper_replace_with_single_or_default_3_highlighting = warning +resharper_replace_with_single_or_default_4_highlighting = warning +resharper_replace_with_string_is_null_or_empty_highlighting = warning +resharper_return_type_can_be_enumerable_global_highlighting = warning +resharper_return_type_can_be_enumerable_local_highlighting = warning +resharper_safe_cast_is_used_as_type_check_highlighting = warning +resharper_separate_control_transfer_statement_highlighting = warning +resharper_similar_anonymous_type_nearby_highlighting = warning +resharper_simplify_conditional_ternary_expression_highlighting = warning +resharper_simplify_linq_expression_use_all_highlighting = warning +resharper_simplify_linq_expression_use_any_highlighting = warning +resharper_simplify_linq_expression_use_min_by_and_max_by_highlighting = warning +resharper_simplify_string_interpolation_highlighting = warning +resharper_specify_string_comparison_highlighting = warning +resharper_string_ends_with_is_culture_specific_highlighting = warning +resharper_string_literal_as_interpolation_argument_highlighting = warning +resharper_string_literal_typo_highlighting = warning +resharper_string_starts_with_is_culture_specific_highlighting = warning +resharper_struct_can_be_made_read_only_highlighting = warning +resharper_struct_member_can_be_made_read_only_highlighting = warning +resharper_suggest_base_type_for_parameter_highlighting = none +resharper_suggest_base_type_for_parameter_in_constructor_highlighting = warning +resharper_suggest_var_or_type_built_in_types_highlighting = hint +resharper_suggest_var_or_type_deconstruction_declarations_highlighting = warning +resharper_suggest_var_or_type_elsewhere_highlighting = hint +resharper_suggest_var_or_type_simple_types_highlighting = hint +resharper_swap_via_deconstruction_highlighting = warning resharper_switch_expression_handles_some_known_enum_values_with_exception_in_default_highlighting = warning -resharper_switch_statement_handles_some_known_enum_values_with_default_highlighting = none -resharper_switch_statement_missing_some_enum_cases_no_default_highlighting = none -resharper_tabs_and_spaces_mismatch_highlighting = warning -resharper_tabs_are_disallowed_highlighting = warning -resharper_tabs_outside_indent_highlighting = warning -resharper_tail_recursive_call_highlighting = warning -resharper_too_wide_local_variable_scope_highlighting = warning -resharper_try_cast_always_succeeds_highlighting = warning -resharper_try_statements_can_be_merged_highlighting = warning -resharper_type_parameter_can_be_variant_highlighting = warning -resharper_unnecessary_whitespace_highlighting = warning -resharper_unused_member_global_highlighting = warning -resharper_unused_member_hierarchy_global_highlighting = warning -resharper_unused_member_in_super_global_highlighting = warning -resharper_unused_method_return_value_global_highlighting = warning -resharper_unused_parameter_global_highlighting = warning -resharper_unused_type_global_highlighting = warning -resharper_use_array_creation_expression_1_highlighting = warning -resharper_use_array_creation_expression_2_highlighting = warning -resharper_use_array_empty_method_highlighting = warning -resharper_use_await_using_highlighting = warning -resharper_use_cancellation_token_for_i_async_enumerable_highlighting = warning -resharper_use_collection_count_property_highlighting = warning -resharper_use_configure_await_false_highlighting = warning -resharper_use_deconstruction_highlighting = warning -resharper_use_empty_types_field_highlighting = warning -resharper_use_event_args_empty_field_highlighting = warning -resharper_use_format_specifier_in_format_string_highlighting = warning -resharper_use_indexed_property_highlighting = warning -resharper_use_index_from_end_expression_highlighting = warning -resharper_use_is_operator_1_highlighting = warning -resharper_use_is_operator_2_highlighting = warning -resharper_use_method_any_0_highlighting = warning -resharper_use_method_any_1_highlighting = warning -resharper_use_method_any_2_highlighting = warning -resharper_use_method_any_3_highlighting = warning -resharper_use_method_any_4_highlighting = warning -resharper_use_method_is_instance_of_type_highlighting = warning -resharper_use_nameof_expression_for_part_of_the_string_highlighting = warning -resharper_use_nameof_expression_highlighting = warning -resharper_use_nameof_for_dependency_property_highlighting = warning -resharper_use_name_of_instead_of_type_of_highlighting = warning -resharper_use_negated_pattern_in_is_expression_highlighting = warning -resharper_use_negated_pattern_matching_highlighting = warning -resharper_use_nullable_annotation_instead_of_attribute_highlighting = warning -resharper_use_nullable_attributes_supported_by_compiler_highlighting = warning -resharper_use_null_propagation_highlighting = warning -resharper_use_object_or_collection_initializer_highlighting = warning -resharper_use_pattern_matching_highlighting = warning -resharper_use_positional_deconstruction_pattern_highlighting = warning -resharper_use_raw_string_highlighting = warning -resharper_use_string_interpolation_highlighting = warning -resharper_use_switch_case_pattern_variable_highlighting = warning -resharper_use_throw_if_null_method_highlighting = warning -resharper_use_unsigned_right_shift_operator_highlighting = warning -resharper_use_verbatim_string_highlighting = warning -resharper_use_with_expression_to_copy_anonymous_object_highlighting = warning -resharper_use_with_expression_to_copy_record_highlighting = warning -resharper_use_with_expression_to_copy_struct_highlighting = warning -resharper_use_with_expression_to_copy_tuple_highlighting = warning -resharper_virtual_member_never_overridden_global_highlighting = warning -resharper_virtual_member_never_overridden_local_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 -resharper_with_expression_instead_of_initializer_highlighting = warning -resharper_wrong_indent_size_highlighting = warning +resharper_switch_statement_handles_some_known_enum_values_with_default_highlighting = none +resharper_switch_statement_missing_some_enum_cases_no_default_highlighting = none +resharper_tabs_and_spaces_mismatch_highlighting = warning +resharper_tabs_are_disallowed_highlighting = warning +resharper_tabs_outside_indent_highlighting = warning +resharper_tail_recursive_call_highlighting = warning +resharper_too_wide_local_variable_scope_highlighting = warning +resharper_try_cast_always_succeeds_highlighting = warning +resharper_try_statements_can_be_merged_highlighting = warning +resharper_type_parameter_can_be_variant_highlighting = warning +resharper_unnecessary_whitespace_highlighting = warning +resharper_unused_member_global_highlighting = warning +resharper_unused_member_hierarchy_global_highlighting = warning +resharper_unused_member_in_super_global_highlighting = warning +resharper_unused_method_return_value_global_highlighting = warning +resharper_unused_parameter_global_highlighting = warning +resharper_unused_type_global_highlighting = warning +resharper_use_array_creation_expression_1_highlighting = warning +resharper_use_array_creation_expression_2_highlighting = warning +resharper_use_array_empty_method_highlighting = warning +resharper_use_await_using_highlighting = warning +resharper_use_cancellation_token_for_i_async_enumerable_highlighting = warning +resharper_use_collection_count_property_highlighting = warning +resharper_use_configure_await_false_highlighting = warning +resharper_use_deconstruction_highlighting = warning +resharper_use_empty_types_field_highlighting = warning +resharper_use_event_args_empty_field_highlighting = warning +resharper_use_format_specifier_in_format_string_highlighting = warning +resharper_use_indexed_property_highlighting = warning +resharper_use_index_from_end_expression_highlighting = warning +resharper_use_is_operator_1_highlighting = warning +resharper_use_is_operator_2_highlighting = warning +resharper_use_method_any_0_highlighting = warning +resharper_use_method_any_1_highlighting = warning +resharper_use_method_any_2_highlighting = warning +resharper_use_method_any_3_highlighting = warning +resharper_use_method_any_4_highlighting = warning +resharper_use_method_is_instance_of_type_highlighting = warning +resharper_use_nameof_expression_for_part_of_the_string_highlighting = warning +resharper_use_nameof_expression_highlighting = warning +resharper_use_nameof_for_dependency_property_highlighting = warning +resharper_use_name_of_instead_of_type_of_highlighting = warning +resharper_use_negated_pattern_in_is_expression_highlighting = warning +resharper_use_negated_pattern_matching_highlighting = warning +resharper_use_nullable_annotation_instead_of_attribute_highlighting = warning +resharper_use_nullable_attributes_supported_by_compiler_highlighting = warning +resharper_use_null_propagation_highlighting = warning +resharper_use_object_or_collection_initializer_highlighting = warning +resharper_use_pattern_matching_highlighting = warning +resharper_use_positional_deconstruction_pattern_highlighting = warning +resharper_use_raw_string_highlighting = warning +resharper_use_string_interpolation_highlighting = warning +resharper_use_switch_case_pattern_variable_highlighting = warning +resharper_use_throw_if_null_method_highlighting = warning +resharper_use_unsigned_right_shift_operator_highlighting = warning +resharper_use_verbatim_string_highlighting = warning +resharper_use_with_expression_to_copy_anonymous_object_highlighting = warning +resharper_use_with_expression_to_copy_record_highlighting = warning +resharper_use_with_expression_to_copy_struct_highlighting = warning +resharper_use_with_expression_to_copy_tuple_highlighting = warning +resharper_virtual_member_never_overridden_global_highlighting = warning +resharper_virtual_member_never_overridden_local_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 +resharper_with_expression_instead_of_initializer_highlighting = warning +resharper_wrong_indent_size_highlighting = warning [*.css] ij_css_align_closing_brace_with_properties = false -ij_css_blank_lines_around_nested_selector = 1 -ij_css_blank_lines_between_blocks = 1 -ij_css_block_comment_add_space = false -ij_css_brace_placement = end_of_line -ij_css_enforce_quotes_on_format = false -ij_css_hex_color_long_format = false -ij_css_hex_color_lower_case = false -ij_css_hex_color_short_format = false -ij_css_hex_color_upper_case = false -ij_css_keep_blank_lines_in_code = 2 -ij_css_keep_indents_on_empty_lines = false -ij_css_keep_single_line_blocks = false -ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow -ij_css_space_after_colon = true -ij_css_space_before_opening_brace = true -ij_css_use_double_quotes = true -ij_css_value_alignment = do_not_align +ij_css_blank_lines_around_nested_selector = 1 +ij_css_blank_lines_between_blocks = 1 +ij_css_block_comment_add_space = false +ij_css_brace_placement = end_of_line +ij_css_enforce_quotes_on_format = false +ij_css_hex_color_long_format = false +ij_css_hex_color_lower_case = false +ij_css_hex_color_short_format = false +ij_css_hex_color_upper_case = false +ij_css_keep_blank_lines_in_code = 2 +ij_css_keep_indents_on_empty_lines = false +ij_css_keep_single_line_blocks = false +ij_css_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_css_space_after_colon = true +ij_css_space_before_opening_brace = true +ij_css_use_double_quotes = true +ij_css_value_alignment = do_not_align [*.csv] -max_line_length = 2147483647 +max_line_length = 2147483647 ij_csv_wrap_long_lines = false -indent_style = tab -tab_width = 1 +indent_style = tab +tab_width = 1 [*.dart] max_line_length = 80 [*.less] -indent_size = 2 +indent_size = 2 ij_less_align_closing_brace_with_properties = false -ij_less_blank_lines_around_nested_selector = 1 -ij_less_blank_lines_between_blocks = 1 -ij_less_block_comment_add_space = false -ij_less_brace_placement = 0 -ij_less_enforce_quotes_on_format = false -ij_less_hex_color_long_format = false -ij_less_hex_color_lower_case = false -ij_less_hex_color_short_format = false -ij_less_hex_color_upper_case = false -ij_less_keep_blank_lines_in_code = 2 -ij_less_keep_indents_on_empty_lines = false -ij_less_keep_single_line_blocks = false -ij_less_line_comment_add_space = false -ij_less_line_comment_at_first_column = false -ij_less_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow -ij_less_space_after_colon = true -ij_less_space_before_opening_brace = true -ij_less_use_double_quotes = true -ij_less_value_alignment = 0 +ij_less_blank_lines_around_nested_selector = 1 +ij_less_blank_lines_between_blocks = 1 +ij_less_block_comment_add_space = false +ij_less_brace_placement = 0 +ij_less_enforce_quotes_on_format = false +ij_less_hex_color_long_format = false +ij_less_hex_color_lower_case = false +ij_less_hex_color_short_format = false +ij_less_hex_color_upper_case = false +ij_less_keep_blank_lines_in_code = 2 +ij_less_keep_indents_on_empty_lines = false +ij_less_keep_single_line_blocks = false +ij_less_line_comment_add_space = false +ij_less_line_comment_at_first_column = false +ij_less_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_less_space_after_colon = true +ij_less_space_before_opening_brace = true +ij_less_use_double_quotes = true +ij_less_value_alignment = 0 [*.pp] -indent_size = 2 -tab_width = 2 -ij_continuation_indent_size = 2 +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 2 ij_puppet_keep_indents_on_empty_lines = false [*.properties] -ij_properties_align_group_field_declarations = true -ij_properties_keep_blank_lines = false -ij_properties_key_value_delimiter = equals +ij_properties_align_group_field_declarations = true +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals ij_properties_spaces_around_key_value_delimiter = true [*.sass] -indent_size = 2 +indent_size = 2 ij_sass_align_closing_brace_with_properties = false -ij_sass_blank_lines_around_nested_selector = 1 -ij_sass_blank_lines_between_blocks = 1 -ij_sass_brace_placement = 0 -ij_sass_enforce_quotes_on_format = false -ij_sass_hex_color_long_format = false -ij_sass_hex_color_lower_case = false -ij_sass_hex_color_short_format = false -ij_sass_hex_color_upper_case = false -ij_sass_keep_blank_lines_in_code = 2 -ij_sass_keep_indents_on_empty_lines = false -ij_sass_keep_single_line_blocks = false -ij_sass_line_comment_add_space = false -ij_sass_line_comment_at_first_column = false -ij_sass_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow -ij_sass_space_after_colon = true -ij_sass_space_before_opening_brace = true -ij_sass_use_double_quotes = true -ij_sass_value_alignment = 0 +ij_sass_blank_lines_around_nested_selector = 1 +ij_sass_blank_lines_between_blocks = 1 +ij_sass_brace_placement = 0 +ij_sass_enforce_quotes_on_format = false +ij_sass_hex_color_long_format = false +ij_sass_hex_color_lower_case = false +ij_sass_hex_color_short_format = false +ij_sass_hex_color_upper_case = false +ij_sass_keep_blank_lines_in_code = 2 +ij_sass_keep_indents_on_empty_lines = false +ij_sass_keep_single_line_blocks = false +ij_sass_line_comment_add_space = false +ij_sass_line_comment_at_first_column = false +ij_sass_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_sass_space_after_colon = true +ij_sass_space_before_opening_brace = true +ij_sass_use_double_quotes = true +ij_sass_value_alignment = 0 [*.scss] -indent_size = 2 +indent_size = 2 ij_scss_align_closing_brace_with_properties = false -ij_scss_blank_lines_around_nested_selector = 1 -ij_scss_blank_lines_between_blocks = 1 -ij_scss_block_comment_add_space = false -ij_scss_brace_placement = 0 -ij_scss_enforce_quotes_on_format = false -ij_scss_hex_color_long_format = false -ij_scss_hex_color_lower_case = false -ij_scss_hex_color_short_format = false -ij_scss_hex_color_upper_case = false -ij_scss_keep_blank_lines_in_code = 2 -ij_scss_keep_indents_on_empty_lines = false -ij_scss_keep_single_line_blocks = false -ij_scss_line_comment_add_space = false -ij_scss_line_comment_at_first_column = false -ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow -ij_scss_space_after_colon = true -ij_scss_space_before_opening_brace = true -ij_scss_use_double_quotes = true -ij_scss_value_alignment = 0 +ij_scss_blank_lines_around_nested_selector = 1 +ij_scss_blank_lines_between_blocks = 1 +ij_scss_block_comment_add_space = false +ij_scss_brace_placement = 0 +ij_scss_enforce_quotes_on_format = false +ij_scss_hex_color_long_format = false +ij_scss_hex_color_lower_case = false +ij_scss_hex_color_short_format = false +ij_scss_hex_color_upper_case = false +ij_scss_keep_blank_lines_in_code = 2 +ij_scss_keep_indents_on_empty_lines = false +ij_scss_keep_single_line_blocks = false +ij_scss_line_comment_add_space = false +ij_scss_line_comment_at_first_column = false +ij_scss_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_scss_space_after_colon = true +ij_scss_space_before_opening_brace = true +ij_scss_use_double_quotes = true +ij_scss_value_alignment = 0 [*.slim] -indent_size = 2 +indent_size = 2 ij_slim_keep_indents_on_empty_lines = false [*.twig] -ij_twig_keep_indents_on_empty_lines = false +ij_twig_keep_indents_on_empty_lines = false ij_twig_spaces_inside_comments_delimiters = true -ij_twig_spaces_inside_delimiters = true +ij_twig_spaces_inside_delimiters = true ij_twig_spaces_inside_variable_delimiters = true [*.vue] -indent_size = 2 -tab_width = 2 -ij_continuation_indent_size = 4 -ij_vue_indent_children_of_top_level = template +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 4 +ij_vue_indent_children_of_top_level = template ij_vue_interpolation_new_line_after_start_delimiter = true -ij_vue_interpolation_new_line_before_end_delimiter = true -ij_vue_interpolation_wrap = off -ij_vue_keep_indents_on_empty_lines = false -ij_vue_spaces_within_interpolation_expressions = true +ij_vue_interpolation_new_line_before_end_delimiter = true +ij_vue_interpolation_wrap = off +ij_vue_keep_indents_on_empty_lines = false +ij_vue_spaces_within_interpolation_expressions = true [.editorconfig] -ij_editorconfig_align_group_field_declarations = true -ij_editorconfig_space_after_colon = false -ij_editorconfig_space_after_comma = true -ij_editorconfig_space_before_colon = false -ij_editorconfig_space_before_comma = false +ij_editorconfig_align_group_field_declarations = true +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false ij_editorconfig_spaces_around_assignment_operators = true [{*.ad,*.adoc,*.asciidoc,.asciidoctorconfig}] -ij_asciidoc_blank_lines_after_header = 1 +ij_asciidoc_blank_lines_after_header = 1 ij_asciidoc_blank_lines_keep_after_header = 1 -ij_asciidoc_formatting_enabled = true -ij_asciidoc_one_sentence_per_line = true +ij_asciidoc_formatting_enabled = true +ij_asciidoc_one_sentence_per_line = true [{*.ant,*.appxmanifest,*.axml,*.cscfg,*.csdef,*.disco,*.dotsettings,*.filelayout,*.fxml,*.jhm,*.jnlp,*.jrxml,*.manifest,*.myapp,*.nuspec,*.rng,*.sdef,*.stylecop,*.svcmap,*.tld,*.wadcfgx,*.webref,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul,StyleCop.Cache}] -ij_xml_align_attributes = true -ij_xml_align_text = false -ij_xml_attribute_wrap = on_every_item -ij_xml_block_comment_add_space = false -ij_xml_block_comment_at_first_column = true -ij_xml_keep_blank_lines = 2 -ij_xml_keep_indents_on_empty_lines = false -ij_xml_keep_line_breaks = true -ij_xml_keep_line_breaks_in_text = true -ij_xml_keep_whitespaces = false -ij_xml_keep_whitespaces_around_cdata = preserve -ij_xml_keep_whitespaces_inside_cdata = false -ij_xml_line_comment_at_first_column = true -ij_xml_space_after_tag_name = false +ij_xml_align_attributes = true +ij_xml_align_text = false +ij_xml_attribute_wrap = on_every_item +ij_xml_block_comment_add_space = false +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = true +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false ij_xml_space_around_equals_in_attribute = false -ij_xml_space_inside_empty_tag = false -ij_xml_text_wrap = normal -ij_xml_use_custom_settings = false +ij_xml_space_inside_empty_tag = false +ij_xml_text_wrap = normal +ij_xml_use_custom_settings = false +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 4 [{*.applescript,*.scpt}] -indent_size = 2 -tab_width = 2 -ij_continuation_indent_size = 4 -ij_applescript_align_multiline_binary_operation = true -ij_applescript_align_multiline_parameters = true -ij_applescript_align_multiline_parameters_in_calls = true -ij_applescript_binary_operation_sign_on_next_line = false -ij_applescript_binary_operation_wrap = off -ij_applescript_block_brace_style = next_line -ij_applescript_call_parameters_new_line_after_left_paren = false -ij_applescript_call_parameters_right_paren_on_new_line = false -ij_applescript_call_parameters_wrap = off -ij_applescript_else_on_new_line = true -ij_applescript_keep_blank_lines_in_code = 2 -ij_applescript_keep_first_column_comment = true -ij_applescript_keep_indents_on_empty_lines = false -ij_applescript_keep_line_breaks = true -ij_applescript_method_brace_style = next_line -ij_applescript_method_parameters_new_line_after_left_paren = false -ij_applescript_method_parameters_right_paren_on_new_line = false -ij_applescript_method_parameters_wrap = off +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 4 +ij_applescript_align_multiline_binary_operation = true +ij_applescript_align_multiline_parameters = true +ij_applescript_align_multiline_parameters_in_calls = true +ij_applescript_binary_operation_sign_on_next_line = false +ij_applescript_binary_operation_wrap = off +ij_applescript_block_brace_style = next_line +ij_applescript_call_parameters_new_line_after_left_paren = false +ij_applescript_call_parameters_right_paren_on_new_line = false +ij_applescript_call_parameters_wrap = off +ij_applescript_else_on_new_line = true +ij_applescript_keep_blank_lines_in_code = 2 +ij_applescript_keep_first_column_comment = true +ij_applescript_keep_indents_on_empty_lines = false +ij_applescript_keep_line_breaks = true +ij_applescript_method_brace_style = next_line +ij_applescript_method_parameters_new_line_after_left_paren = false +ij_applescript_method_parameters_right_paren_on_new_line = false +ij_applescript_method_parameters_wrap = off ij_applescript_parentheses_expression_new_line_after_left_paren = false -ij_applescript_parentheses_expression_right_paren_on_new_line = false -ij_applescript_space_after_colon = true -ij_applescript_space_after_comma = true -ij_applescript_space_after_comma_in_type_arguments = true -ij_applescript_space_before_colon = true -ij_applescript_space_before_comma = false -ij_applescript_space_before_else_keyword = true -ij_applescript_space_before_else_left_brace = true -ij_applescript_space_before_if_parentheses = false -ij_applescript_space_before_method_call_parentheses = false -ij_applescript_space_before_method_left_brace = true -ij_applescript_space_before_method_parentheses = false -ij_applescript_space_before_while_keyword = true -ij_applescript_spaces_around_additive_operators = true -ij_applescript_spaces_around_assignment_operators = true -ij_applescript_spaces_around_equality_operators = true -ij_applescript_spaces_around_logical_operators = true -ij_applescript_spaces_around_multiplicative_operators = true -ij_applescript_spaces_around_relational_operators = true -ij_applescript_spaces_around_shift_operators = true -ij_applescript_spaces_around_unary_operator = false -ij_applescript_spaces_within_if_parentheses = false -ij_applescript_spaces_within_method_call_parentheses = false -ij_applescript_spaces_within_method_parentheses = false -ij_applescript_special_else_if_treatment = true +ij_applescript_parentheses_expression_right_paren_on_new_line = false +ij_applescript_space_after_colon = true +ij_applescript_space_after_comma = true +ij_applescript_space_after_comma_in_type_arguments = true +ij_applescript_space_before_colon = true +ij_applescript_space_before_comma = false +ij_applescript_space_before_else_keyword = true +ij_applescript_space_before_else_left_brace = true +ij_applescript_space_before_if_parentheses = false +ij_applescript_space_before_method_call_parentheses = false +ij_applescript_space_before_method_left_brace = true +ij_applescript_space_before_method_parentheses = false +ij_applescript_space_before_while_keyword = true +ij_applescript_spaces_around_additive_operators = true +ij_applescript_spaces_around_assignment_operators = true +ij_applescript_spaces_around_equality_operators = true +ij_applescript_spaces_around_logical_operators = true +ij_applescript_spaces_around_multiplicative_operators = true +ij_applescript_spaces_around_relational_operators = true +ij_applescript_spaces_around_shift_operators = true +ij_applescript_spaces_around_unary_operator = false +ij_applescript_spaces_within_if_parentheses = false +ij_applescript_spaces_within_method_call_parentheses = false +ij_applescript_spaces_within_method_parentheses = false +ij_applescript_special_else_if_treatment = true [{*.ats,*.cts,*.mts,*.ts}] -ij_continuation_indent_size = 4 -ij_typescript_align_imports = true -ij_typescript_align_multiline_array_initializer_expression = true -ij_typescript_align_multiline_binary_operation = true -ij_typescript_align_multiline_chained_methods = true -ij_typescript_align_multiline_extends_list = false -ij_typescript_align_multiline_for = true -ij_typescript_align_multiline_parameters = true -ij_typescript_align_multiline_parameters_in_calls = true -ij_typescript_align_multiline_ternary_operation = true -ij_typescript_align_object_properties = 1 -ij_typescript_align_union_types = true -ij_typescript_align_var_statements = 2 -ij_typescript_array_initializer_new_line_after_left_brace = false -ij_typescript_array_initializer_right_brace_on_new_line = false -ij_typescript_array_initializer_wrap = on_every_item -ij_typescript_assignment_wrap = on_every_item -ij_typescript_binary_operation_sign_on_next_line = false -ij_typescript_binary_operation_wrap = on_every_item -ij_typescript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** -ij_typescript_blank_lines_after_imports = 1 -ij_typescript_blank_lines_around_class = 1 -ij_typescript_blank_lines_around_field = 0 -ij_typescript_blank_lines_around_field_in_interface = 0 -ij_typescript_blank_lines_around_function = 1 -ij_typescript_blank_lines_around_method = 1 -ij_typescript_blank_lines_around_method_in_interface = 1 -ij_typescript_block_brace_style = next_line -ij_typescript_block_comment_add_space = false -ij_typescript_block_comment_at_first_column = true -ij_typescript_call_parameters_new_line_after_left_paren = false -ij_typescript_call_parameters_right_paren_on_new_line = false -ij_typescript_call_parameters_wrap = on_every_item -ij_typescript_catch_on_new_line = true -ij_typescript_chained_call_dot_on_new_line = true -ij_typescript_class_brace_style = next_line -ij_typescript_comma_on_new_line = false -ij_typescript_do_while_brace_force = always -ij_typescript_else_on_new_line = false -ij_typescript_enforce_trailing_comma = keep -ij_typescript_enum_constants_wrap = on_every_item -ij_typescript_extends_keyword_wrap = normal -ij_typescript_extends_list_wrap = on_every_item -ij_typescript_field_prefix = _ -ij_typescript_file_name_style = relaxed -ij_typescript_finally_on_new_line = true -ij_typescript_for_brace_force = if_multiline -ij_typescript_for_statement_new_line_after_left_paren = false -ij_typescript_for_statement_right_paren_on_new_line = false -ij_typescript_for_statement_wrap = on_every_item -ij_typescript_force_quote_style = true -ij_typescript_force_semicolon_style = true -ij_typescript_function_expression_brace_style = next_line -ij_typescript_if_brace_force = never -ij_typescript_import_merge_members = global -ij_typescript_import_prefer_absolute_path = true -ij_typescript_import_sort_members = true -ij_typescript_import_sort_module_name = true -ij_typescript_import_use_node_resolution = true -ij_typescript_imports_wrap = on_every_item -ij_typescript_indent_case_from_switch = true -ij_typescript_indent_chained_calls = true -ij_typescript_indent_package_children = 0 -ij_typescript_jsdoc_include_types = false -ij_typescript_jsx_attribute_value = braces -ij_typescript_keep_blank_lines_in_code = 2 -ij_typescript_keep_first_column_comment = true -ij_typescript_keep_indents_on_empty_lines = false -ij_typescript_keep_line_breaks = true -ij_typescript_keep_simple_blocks_in_one_line = false -ij_typescript_keep_simple_methods_in_one_line = false -ij_typescript_line_comment_add_space = true -ij_typescript_line_comment_at_first_column = false -ij_typescript_method_brace_style = next_line -ij_typescript_method_call_chain_wrap = on_every_item -ij_typescript_method_parameters_new_line_after_left_paren = false -ij_typescript_method_parameters_right_paren_on_new_line = false -ij_typescript_method_parameters_wrap = on_every_item -ij_typescript_object_literal_wrap = on_every_item -ij_typescript_object_types_wrap = on_every_item -ij_typescript_parentheses_expression_new_line_after_left_paren = false -ij_typescript_parentheses_expression_right_paren_on_new_line = false -ij_typescript_place_assignment_sign_on_next_line = false -ij_typescript_prefer_as_type_cast = false +ij_continuation_indent_size = 4 +ij_typescript_align_imports = true +ij_typescript_align_multiline_array_initializer_expression = true +ij_typescript_align_multiline_binary_operation = true +ij_typescript_align_multiline_chained_methods = true +ij_typescript_align_multiline_extends_list = false +ij_typescript_align_multiline_for = true +ij_typescript_align_multiline_parameters = true +ij_typescript_align_multiline_parameters_in_calls = true +ij_typescript_align_multiline_ternary_operation = true +ij_typescript_align_object_properties = 1 +ij_typescript_align_union_types = true +ij_typescript_align_var_statements = 2 +ij_typescript_array_initializer_new_line_after_left_brace = false +ij_typescript_array_initializer_right_brace_on_new_line = false +ij_typescript_array_initializer_wrap = on_every_item +ij_typescript_assignment_wrap = on_every_item +ij_typescript_binary_operation_sign_on_next_line = false +ij_typescript_binary_operation_wrap = on_every_item +ij_typescript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** +ij_typescript_blank_lines_after_imports = 1 +ij_typescript_blank_lines_around_class = 1 +ij_typescript_blank_lines_around_field = 0 +ij_typescript_blank_lines_around_field_in_interface = 0 +ij_typescript_blank_lines_around_function = 1 +ij_typescript_blank_lines_around_method = 1 +ij_typescript_blank_lines_around_method_in_interface = 1 +ij_typescript_block_brace_style = next_line +ij_typescript_block_comment_add_space = false +ij_typescript_block_comment_at_first_column = true +ij_typescript_call_parameters_new_line_after_left_paren = false +ij_typescript_call_parameters_right_paren_on_new_line = false +ij_typescript_call_parameters_wrap = on_every_item +ij_typescript_catch_on_new_line = true +ij_typescript_chained_call_dot_on_new_line = true +ij_typescript_class_brace_style = next_line +ij_typescript_comma_on_new_line = false +ij_typescript_do_while_brace_force = always +ij_typescript_else_on_new_line = false +ij_typescript_enforce_trailing_comma = keep +ij_typescript_enum_constants_wrap = on_every_item +ij_typescript_extends_keyword_wrap = normal +ij_typescript_extends_list_wrap = on_every_item +ij_typescript_field_prefix = _ +ij_typescript_file_name_style = relaxed +ij_typescript_finally_on_new_line = true +ij_typescript_for_brace_force = if_multiline +ij_typescript_for_statement_new_line_after_left_paren = false +ij_typescript_for_statement_right_paren_on_new_line = false +ij_typescript_for_statement_wrap = on_every_item +ij_typescript_force_quote_style = true +ij_typescript_force_semicolon_style = true +ij_typescript_function_expression_brace_style = next_line +ij_typescript_if_brace_force = never +ij_typescript_import_merge_members = global +ij_typescript_import_prefer_absolute_path = true +ij_typescript_import_sort_members = true +ij_typescript_import_sort_module_name = true +ij_typescript_import_use_node_resolution = true +ij_typescript_imports_wrap = on_every_item +ij_typescript_indent_case_from_switch = true +ij_typescript_indent_chained_calls = true +ij_typescript_indent_package_children = 0 +ij_typescript_jsdoc_include_types = false +ij_typescript_jsx_attribute_value = braces +ij_typescript_keep_blank_lines_in_code = 2 +ij_typescript_keep_first_column_comment = true +ij_typescript_keep_indents_on_empty_lines = false +ij_typescript_keep_line_breaks = true +ij_typescript_keep_simple_blocks_in_one_line = false +ij_typescript_keep_simple_methods_in_one_line = false +ij_typescript_line_comment_add_space = true +ij_typescript_line_comment_at_first_column = false +ij_typescript_method_brace_style = next_line +ij_typescript_method_call_chain_wrap = on_every_item +ij_typescript_method_parameters_new_line_after_left_paren = false +ij_typescript_method_parameters_right_paren_on_new_line = false +ij_typescript_method_parameters_wrap = on_every_item +ij_typescript_object_literal_wrap = on_every_item +ij_typescript_object_types_wrap = on_every_item +ij_typescript_parentheses_expression_new_line_after_left_paren = false +ij_typescript_parentheses_expression_right_paren_on_new_line = false +ij_typescript_place_assignment_sign_on_next_line = false +ij_typescript_prefer_as_type_cast = false ij_typescript_prefer_explicit_types_function_expression_returns = false -ij_typescript_prefer_explicit_types_function_returns = false -ij_typescript_prefer_explicit_types_vars_fields = false -ij_typescript_prefer_parameters_wrap = false -ij_typescript_property_prefix = -ij_typescript_reformat_c_style_comments = false -ij_typescript_space_after_colon = true -ij_typescript_space_after_comma = true -ij_typescript_space_after_dots_in_rest_parameter = false -ij_typescript_space_after_generator_mult = true -ij_typescript_space_after_property_colon = true -ij_typescript_space_after_quest = true -ij_typescript_space_after_type_colon = true -ij_typescript_space_after_unary_not = false -ij_typescript_space_before_async_arrow_lparen = false -ij_typescript_space_before_catch_keyword = true -ij_typescript_space_before_catch_left_brace = false -ij_typescript_space_before_catch_parentheses = false -ij_typescript_space_before_class_lbrace = false -ij_typescript_space_before_class_left_brace = true -ij_typescript_space_before_colon = true -ij_typescript_space_before_comma = false -ij_typescript_space_before_do_left_brace = false -ij_typescript_space_before_else_keyword = true -ij_typescript_space_before_else_left_brace = false -ij_typescript_space_before_finally_keyword = true -ij_typescript_space_before_finally_left_brace = false -ij_typescript_space_before_for_left_brace = false -ij_typescript_space_before_for_parentheses = false -ij_typescript_space_before_for_semicolon = false -ij_typescript_space_before_function_left_parenth = false -ij_typescript_space_before_generator_mult = false -ij_typescript_space_before_if_left_brace = false -ij_typescript_space_before_if_parentheses = false -ij_typescript_space_before_method_call_parentheses = false -ij_typescript_space_before_method_left_brace = false -ij_typescript_space_before_method_parentheses = false -ij_typescript_space_before_property_colon = false -ij_typescript_space_before_quest = true -ij_typescript_space_before_switch_left_brace = false -ij_typescript_space_before_switch_parentheses = false -ij_typescript_space_before_try_left_brace = false -ij_typescript_space_before_type_colon = false -ij_typescript_space_before_unary_not = false -ij_typescript_space_before_while_keyword = true -ij_typescript_space_before_while_left_brace = false -ij_typescript_space_before_while_parentheses = false -ij_typescript_spaces_around_additive_operators = true -ij_typescript_spaces_around_arrow_function_operator = true -ij_typescript_spaces_around_assignment_operators = true -ij_typescript_spaces_around_bitwise_operators = true -ij_typescript_spaces_around_equality_operators = true -ij_typescript_spaces_around_logical_operators = true -ij_typescript_spaces_around_multiplicative_operators = true -ij_typescript_spaces_around_relational_operators = true -ij_typescript_spaces_around_shift_operators = true -ij_typescript_spaces_around_unary_operator = false -ij_typescript_spaces_within_array_initializer_brackets = false -ij_typescript_spaces_within_brackets = false -ij_typescript_spaces_within_catch_parentheses = false -ij_typescript_spaces_within_for_parentheses = false -ij_typescript_spaces_within_if_parentheses = false -ij_typescript_spaces_within_imports = false -ij_typescript_spaces_within_interpolation_expressions = false -ij_typescript_spaces_within_method_call_parentheses = false -ij_typescript_spaces_within_method_parentheses = false -ij_typescript_spaces_within_object_literal_braces = false -ij_typescript_spaces_within_object_type_braces = true -ij_typescript_spaces_within_parentheses = false -ij_typescript_spaces_within_switch_parentheses = false -ij_typescript_spaces_within_type_assertion = false -ij_typescript_spaces_within_union_types = true -ij_typescript_spaces_within_while_parentheses = false -ij_typescript_special_else_if_treatment = true -ij_typescript_ternary_operation_signs_on_next_line = false -ij_typescript_ternary_operation_wrap = on_every_item -ij_typescript_union_types_wrap = on_every_item -ij_typescript_use_chained_calls_group_indents = false -ij_typescript_use_double_quotes = true -ij_typescript_use_explicit_js_extension = auto -ij_typescript_use_path_mapping = always -ij_typescript_use_public_modifier = false -ij_typescript_use_semicolon_after_statement = true -ij_typescript_var_declaration_wrap = normal -ij_typescript_while_brace_force = always -ij_typescript_while_on_new_line = false -ij_typescript_wrap_comments = false +ij_typescript_prefer_explicit_types_function_returns = false +ij_typescript_prefer_explicit_types_vars_fields = false +ij_typescript_prefer_parameters_wrap = false +ij_typescript_property_prefix = +ij_typescript_reformat_c_style_comments = false +ij_typescript_space_after_colon = true +ij_typescript_space_after_comma = true +ij_typescript_space_after_dots_in_rest_parameter = false +ij_typescript_space_after_generator_mult = true +ij_typescript_space_after_property_colon = true +ij_typescript_space_after_quest = true +ij_typescript_space_after_type_colon = true +ij_typescript_space_after_unary_not = false +ij_typescript_space_before_async_arrow_lparen = false +ij_typescript_space_before_catch_keyword = true +ij_typescript_space_before_catch_left_brace = false +ij_typescript_space_before_catch_parentheses = false +ij_typescript_space_before_class_lbrace = false +ij_typescript_space_before_class_left_brace = true +ij_typescript_space_before_colon = true +ij_typescript_space_before_comma = false +ij_typescript_space_before_do_left_brace = false +ij_typescript_space_before_else_keyword = true +ij_typescript_space_before_else_left_brace = false +ij_typescript_space_before_finally_keyword = true +ij_typescript_space_before_finally_left_brace = false +ij_typescript_space_before_for_left_brace = false +ij_typescript_space_before_for_parentheses = false +ij_typescript_space_before_for_semicolon = false +ij_typescript_space_before_function_left_parenth = false +ij_typescript_space_before_generator_mult = false +ij_typescript_space_before_if_left_brace = false +ij_typescript_space_before_if_parentheses = false +ij_typescript_space_before_method_call_parentheses = false +ij_typescript_space_before_method_left_brace = false +ij_typescript_space_before_method_parentheses = false +ij_typescript_space_before_property_colon = false +ij_typescript_space_before_quest = true +ij_typescript_space_before_switch_left_brace = false +ij_typescript_space_before_switch_parentheses = false +ij_typescript_space_before_try_left_brace = false +ij_typescript_space_before_type_colon = false +ij_typescript_space_before_unary_not = false +ij_typescript_space_before_while_keyword = true +ij_typescript_space_before_while_left_brace = false +ij_typescript_space_before_while_parentheses = false +ij_typescript_spaces_around_additive_operators = true +ij_typescript_spaces_around_arrow_function_operator = true +ij_typescript_spaces_around_assignment_operators = true +ij_typescript_spaces_around_bitwise_operators = true +ij_typescript_spaces_around_equality_operators = true +ij_typescript_spaces_around_logical_operators = true +ij_typescript_spaces_around_multiplicative_operators = true +ij_typescript_spaces_around_relational_operators = true +ij_typescript_spaces_around_shift_operators = true +ij_typescript_spaces_around_unary_operator = false +ij_typescript_spaces_within_array_initializer_brackets = false +ij_typescript_spaces_within_brackets = false +ij_typescript_spaces_within_catch_parentheses = false +ij_typescript_spaces_within_for_parentheses = false +ij_typescript_spaces_within_if_parentheses = false +ij_typescript_spaces_within_imports = false +ij_typescript_spaces_within_interpolation_expressions = false +ij_typescript_spaces_within_method_call_parentheses = false +ij_typescript_spaces_within_method_parentheses = false +ij_typescript_spaces_within_object_literal_braces = false +ij_typescript_spaces_within_object_type_braces = true +ij_typescript_spaces_within_parentheses = false +ij_typescript_spaces_within_switch_parentheses = false +ij_typescript_spaces_within_type_assertion = false +ij_typescript_spaces_within_union_types = true +ij_typescript_spaces_within_while_parentheses = false +ij_typescript_special_else_if_treatment = true +ij_typescript_ternary_operation_signs_on_next_line = false +ij_typescript_ternary_operation_wrap = on_every_item +ij_typescript_union_types_wrap = on_every_item +ij_typescript_use_chained_calls_group_indents = false +ij_typescript_use_double_quotes = true +ij_typescript_use_explicit_js_extension = auto +ij_typescript_use_path_mapping = always +ij_typescript_use_public_modifier = false +ij_typescript_use_semicolon_after_statement = true +ij_typescript_var_declaration_wrap = normal +ij_typescript_while_brace_force = always +ij_typescript_while_on_new_line = false +ij_typescript_wrap_comments = false [{*.bash,*.sh,*.zsh}] -indent_size = 2 -tab_width = 2 -ij_shell_binary_ops_start_line = false +indent_size = 2 +tab_width = 2 +ij_shell_binary_ops_start_line = false ij_shell_keep_column_alignment_padding = false -ij_shell_minify_program = false -ij_shell_redirect_followed_by_space = false -ij_shell_switch_cases_indented = true -ij_shell_use_unix_line_separator = true -indent_style = space +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = true +ij_shell_use_unix_line_separator = true +indent_style = space [{*.cjs,*.js}] -ij_continuation_indent_size = 4 -ij_javascript_align_imports = true -ij_javascript_align_multiline_array_initializer_expression = true -ij_javascript_align_multiline_binary_operation = true -ij_javascript_align_multiline_chained_methods = false -ij_javascript_align_multiline_extends_list = true -ij_javascript_align_multiline_for = true -ij_javascript_align_multiline_parameters = true -ij_javascript_align_multiline_parameters_in_calls = true -ij_javascript_align_multiline_ternary_operation = true -ij_javascript_align_object_properties = 1 -ij_javascript_align_union_types = false -ij_javascript_align_var_statements = 2 -ij_javascript_array_initializer_new_line_after_left_brace = false -ij_javascript_array_initializer_right_brace_on_new_line = false -ij_javascript_array_initializer_wrap = on_every_item -ij_javascript_assignment_wrap = on_every_item -ij_javascript_binary_operation_sign_on_next_line = false -ij_javascript_binary_operation_wrap = on_every_item -ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** -ij_javascript_blank_lines_after_imports = 1 -ij_javascript_blank_lines_around_class = 1 -ij_javascript_blank_lines_around_field = 0 -ij_javascript_blank_lines_around_function = 1 -ij_javascript_blank_lines_around_method = 1 -ij_javascript_block_brace_style = next_line -ij_javascript_block_comment_add_space = false -ij_javascript_block_comment_at_first_column = true -ij_javascript_call_parameters_new_line_after_left_paren = false -ij_javascript_call_parameters_right_paren_on_new_line = false -ij_javascript_call_parameters_wrap = on_every_item -ij_javascript_catch_on_new_line = true -ij_javascript_chained_call_dot_on_new_line = true -ij_javascript_class_brace_style = next_line -ij_javascript_comma_on_new_line = false -ij_javascript_do_while_brace_force = always -ij_javascript_else_on_new_line = true -ij_javascript_enforce_trailing_comma = remove -ij_javascript_extends_keyword_wrap = normal -ij_javascript_extends_list_wrap = on_every_item -ij_javascript_field_prefix = _ -ij_javascript_file_name_style = relaxed -ij_javascript_finally_on_new_line = true -ij_javascript_for_brace_force = if_multiline -ij_javascript_for_statement_new_line_after_left_paren = false -ij_javascript_for_statement_right_paren_on_new_line = false -ij_javascript_for_statement_wrap = on_every_item -ij_javascript_force_quote_style = true -ij_javascript_force_semicolon_style = true -ij_javascript_function_expression_brace_style = next_line -ij_javascript_if_brace_force = if_multiline -ij_javascript_import_merge_members = global -ij_javascript_import_prefer_absolute_path = true -ij_javascript_import_sort_members = true -ij_javascript_import_sort_module_name = true -ij_javascript_import_use_node_resolution = true -ij_javascript_imports_wrap = on_every_item -ij_javascript_indent_case_from_switch = true -ij_javascript_indent_chained_calls = true -ij_javascript_indent_package_children = 0 -ij_javascript_jsx_attribute_value = braces -ij_javascript_keep_blank_lines_in_code = 2 -ij_javascript_keep_first_column_comment = true -ij_javascript_keep_indents_on_empty_lines = false -ij_javascript_keep_line_breaks = true -ij_javascript_keep_simple_blocks_in_one_line = false -ij_javascript_keep_simple_methods_in_one_line = false -ij_javascript_line_comment_add_space = true -ij_javascript_line_comment_at_first_column = false -ij_javascript_method_brace_style = next_line -ij_javascript_method_call_chain_wrap = on_every_item -ij_javascript_method_parameters_new_line_after_left_paren = false -ij_javascript_method_parameters_right_paren_on_new_line = false -ij_javascript_method_parameters_wrap = on_every_item -ij_javascript_object_literal_wrap = on_every_item -ij_javascript_object_types_wrap = on_every_item -ij_javascript_parentheses_expression_new_line_after_left_paren = false -ij_javascript_parentheses_expression_right_paren_on_new_line = false -ij_javascript_place_assignment_sign_on_next_line = true -ij_javascript_prefer_as_type_cast = false +ij_continuation_indent_size = 4 +ij_javascript_align_imports = true +ij_javascript_align_multiline_array_initializer_expression = true +ij_javascript_align_multiline_binary_operation = true +ij_javascript_align_multiline_chained_methods = false +ij_javascript_align_multiline_extends_list = true +ij_javascript_align_multiline_for = true +ij_javascript_align_multiline_parameters = true +ij_javascript_align_multiline_parameters_in_calls = true +ij_javascript_align_multiline_ternary_operation = true +ij_javascript_align_object_properties = 1 +ij_javascript_align_union_types = false +ij_javascript_align_var_statements = 2 +ij_javascript_array_initializer_new_line_after_left_brace = false +ij_javascript_array_initializer_right_brace_on_new_line = false +ij_javascript_array_initializer_wrap = on_every_item +ij_javascript_assignment_wrap = on_every_item +ij_javascript_binary_operation_sign_on_next_line = false +ij_javascript_binary_operation_wrap = on_every_item +ij_javascript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** +ij_javascript_blank_lines_after_imports = 1 +ij_javascript_blank_lines_around_class = 1 +ij_javascript_blank_lines_around_field = 0 +ij_javascript_blank_lines_around_function = 1 +ij_javascript_blank_lines_around_method = 1 +ij_javascript_block_brace_style = next_line +ij_javascript_block_comment_add_space = false +ij_javascript_block_comment_at_first_column = true +ij_javascript_call_parameters_new_line_after_left_paren = false +ij_javascript_call_parameters_right_paren_on_new_line = false +ij_javascript_call_parameters_wrap = on_every_item +ij_javascript_catch_on_new_line = true +ij_javascript_chained_call_dot_on_new_line = true +ij_javascript_class_brace_style = next_line +ij_javascript_comma_on_new_line = false +ij_javascript_do_while_brace_force = always +ij_javascript_else_on_new_line = true +ij_javascript_enforce_trailing_comma = remove +ij_javascript_extends_keyword_wrap = normal +ij_javascript_extends_list_wrap = on_every_item +ij_javascript_field_prefix = _ +ij_javascript_file_name_style = relaxed +ij_javascript_finally_on_new_line = true +ij_javascript_for_brace_force = if_multiline +ij_javascript_for_statement_new_line_after_left_paren = false +ij_javascript_for_statement_right_paren_on_new_line = false +ij_javascript_for_statement_wrap = on_every_item +ij_javascript_force_quote_style = true +ij_javascript_force_semicolon_style = true +ij_javascript_function_expression_brace_style = next_line +ij_javascript_if_brace_force = if_multiline +ij_javascript_import_merge_members = global +ij_javascript_import_prefer_absolute_path = true +ij_javascript_import_sort_members = true +ij_javascript_import_sort_module_name = true +ij_javascript_import_use_node_resolution = true +ij_javascript_imports_wrap = on_every_item +ij_javascript_indent_case_from_switch = true +ij_javascript_indent_chained_calls = true +ij_javascript_indent_package_children = 0 +ij_javascript_jsx_attribute_value = braces +ij_javascript_keep_blank_lines_in_code = 2 +ij_javascript_keep_first_column_comment = true +ij_javascript_keep_indents_on_empty_lines = false +ij_javascript_keep_line_breaks = true +ij_javascript_keep_simple_blocks_in_one_line = false +ij_javascript_keep_simple_methods_in_one_line = false +ij_javascript_line_comment_add_space = true +ij_javascript_line_comment_at_first_column = false +ij_javascript_method_brace_style = next_line +ij_javascript_method_call_chain_wrap = on_every_item +ij_javascript_method_parameters_new_line_after_left_paren = false +ij_javascript_method_parameters_right_paren_on_new_line = false +ij_javascript_method_parameters_wrap = on_every_item +ij_javascript_object_literal_wrap = on_every_item +ij_javascript_object_types_wrap = on_every_item +ij_javascript_parentheses_expression_new_line_after_left_paren = false +ij_javascript_parentheses_expression_right_paren_on_new_line = false +ij_javascript_place_assignment_sign_on_next_line = true +ij_javascript_prefer_as_type_cast = false ij_javascript_prefer_explicit_types_function_expression_returns = false -ij_javascript_prefer_explicit_types_function_returns = false -ij_javascript_prefer_explicit_types_vars_fields = false -ij_javascript_prefer_parameters_wrap = false -ij_javascript_property_prefix = -ij_javascript_reformat_c_style_comments = true -ij_javascript_space_after_colon = true -ij_javascript_space_after_comma = true -ij_javascript_space_after_dots_in_rest_parameter = false -ij_javascript_space_after_generator_mult = true -ij_javascript_space_after_property_colon = true -ij_javascript_space_after_quest = true -ij_javascript_space_after_type_colon = true -ij_javascript_space_after_unary_not = false -ij_javascript_space_before_async_arrow_lparen = false -ij_javascript_space_before_catch_keyword = true -ij_javascript_space_before_catch_left_brace = false -ij_javascript_space_before_catch_parentheses = false -ij_javascript_space_before_class_lbrace = false -ij_javascript_space_before_class_left_brace = true -ij_javascript_space_before_colon = true -ij_javascript_space_before_comma = false -ij_javascript_space_before_do_left_brace = false -ij_javascript_space_before_else_keyword = true -ij_javascript_space_before_else_left_brace = false -ij_javascript_space_before_finally_keyword = true -ij_javascript_space_before_finally_left_brace = false -ij_javascript_space_before_for_left_brace = false -ij_javascript_space_before_for_parentheses = false -ij_javascript_space_before_for_semicolon = false -ij_javascript_space_before_function_left_parenth = false -ij_javascript_space_before_generator_mult = false -ij_javascript_space_before_if_left_brace = false -ij_javascript_space_before_if_parentheses = false -ij_javascript_space_before_method_call_parentheses = false -ij_javascript_space_before_method_left_brace = false -ij_javascript_space_before_method_parentheses = false -ij_javascript_space_before_property_colon = false -ij_javascript_space_before_quest = true -ij_javascript_space_before_switch_left_brace = false -ij_javascript_space_before_switch_parentheses = false -ij_javascript_space_before_try_left_brace = false -ij_javascript_space_before_type_colon = false -ij_javascript_space_before_unary_not = false -ij_javascript_space_before_while_keyword = true -ij_javascript_space_before_while_left_brace = false -ij_javascript_space_before_while_parentheses = false -ij_javascript_spaces_around_additive_operators = true -ij_javascript_spaces_around_arrow_function_operator = true -ij_javascript_spaces_around_assignment_operators = true -ij_javascript_spaces_around_bitwise_operators = true -ij_javascript_spaces_around_equality_operators = true -ij_javascript_spaces_around_logical_operators = true -ij_javascript_spaces_around_multiplicative_operators = true -ij_javascript_spaces_around_relational_operators = true -ij_javascript_spaces_around_shift_operators = true -ij_javascript_spaces_around_unary_operator = false -ij_javascript_spaces_within_array_initializer_brackets = false -ij_javascript_spaces_within_brackets = false -ij_javascript_spaces_within_catch_parentheses = false -ij_javascript_spaces_within_for_parentheses = false -ij_javascript_spaces_within_if_parentheses = false -ij_javascript_spaces_within_imports = false -ij_javascript_spaces_within_interpolation_expressions = false -ij_javascript_spaces_within_method_call_parentheses = false -ij_javascript_spaces_within_method_parentheses = false -ij_javascript_spaces_within_object_literal_braces = false -ij_javascript_spaces_within_object_type_braces = true -ij_javascript_spaces_within_parentheses = false -ij_javascript_spaces_within_switch_parentheses = false -ij_javascript_spaces_within_type_assertion = false -ij_javascript_spaces_within_union_types = true -ij_javascript_spaces_within_while_parentheses = false -ij_javascript_special_else_if_treatment = true -ij_javascript_ternary_operation_signs_on_next_line = false -ij_javascript_ternary_operation_wrap = on_every_item -ij_javascript_union_types_wrap = on_every_item -ij_javascript_use_chained_calls_group_indents = true -ij_javascript_use_double_quotes = true -ij_javascript_use_explicit_js_extension = auto -ij_javascript_use_path_mapping = always -ij_javascript_use_public_modifier = false -ij_javascript_use_semicolon_after_statement = true -ij_javascript_var_declaration_wrap = normal -ij_javascript_while_brace_force = always -ij_javascript_while_on_new_line = false -ij_javascript_wrap_comments = false +ij_javascript_prefer_explicit_types_function_returns = false +ij_javascript_prefer_explicit_types_vars_fields = false +ij_javascript_prefer_parameters_wrap = false +ij_javascript_property_prefix = +ij_javascript_reformat_c_style_comments = true +ij_javascript_space_after_colon = true +ij_javascript_space_after_comma = true +ij_javascript_space_after_dots_in_rest_parameter = false +ij_javascript_space_after_generator_mult = true +ij_javascript_space_after_property_colon = true +ij_javascript_space_after_quest = true +ij_javascript_space_after_type_colon = true +ij_javascript_space_after_unary_not = false +ij_javascript_space_before_async_arrow_lparen = false +ij_javascript_space_before_catch_keyword = true +ij_javascript_space_before_catch_left_brace = false +ij_javascript_space_before_catch_parentheses = false +ij_javascript_space_before_class_lbrace = false +ij_javascript_space_before_class_left_brace = true +ij_javascript_space_before_colon = true +ij_javascript_space_before_comma = false +ij_javascript_space_before_do_left_brace = false +ij_javascript_space_before_else_keyword = true +ij_javascript_space_before_else_left_brace = false +ij_javascript_space_before_finally_keyword = true +ij_javascript_space_before_finally_left_brace = false +ij_javascript_space_before_for_left_brace = false +ij_javascript_space_before_for_parentheses = false +ij_javascript_space_before_for_semicolon = false +ij_javascript_space_before_function_left_parenth = false +ij_javascript_space_before_generator_mult = false +ij_javascript_space_before_if_left_brace = false +ij_javascript_space_before_if_parentheses = false +ij_javascript_space_before_method_call_parentheses = false +ij_javascript_space_before_method_left_brace = false +ij_javascript_space_before_method_parentheses = false +ij_javascript_space_before_property_colon = false +ij_javascript_space_before_quest = true +ij_javascript_space_before_switch_left_brace = false +ij_javascript_space_before_switch_parentheses = false +ij_javascript_space_before_try_left_brace = false +ij_javascript_space_before_type_colon = false +ij_javascript_space_before_unary_not = false +ij_javascript_space_before_while_keyword = true +ij_javascript_space_before_while_left_brace = false +ij_javascript_space_before_while_parentheses = false +ij_javascript_spaces_around_additive_operators = true +ij_javascript_spaces_around_arrow_function_operator = true +ij_javascript_spaces_around_assignment_operators = true +ij_javascript_spaces_around_bitwise_operators = true +ij_javascript_spaces_around_equality_operators = true +ij_javascript_spaces_around_logical_operators = true +ij_javascript_spaces_around_multiplicative_operators = true +ij_javascript_spaces_around_relational_operators = true +ij_javascript_spaces_around_shift_operators = true +ij_javascript_spaces_around_unary_operator = false +ij_javascript_spaces_within_array_initializer_brackets = false +ij_javascript_spaces_within_brackets = false +ij_javascript_spaces_within_catch_parentheses = false +ij_javascript_spaces_within_for_parentheses = false +ij_javascript_spaces_within_if_parentheses = false +ij_javascript_spaces_within_imports = false +ij_javascript_spaces_within_interpolation_expressions = false +ij_javascript_spaces_within_method_call_parentheses = false +ij_javascript_spaces_within_method_parentheses = false +ij_javascript_spaces_within_object_literal_braces = false +ij_javascript_spaces_within_object_type_braces = true +ij_javascript_spaces_within_parentheses = false +ij_javascript_spaces_within_switch_parentheses = false +ij_javascript_spaces_within_type_assertion = false +ij_javascript_spaces_within_union_types = true +ij_javascript_spaces_within_while_parentheses = false +ij_javascript_special_else_if_treatment = true +ij_javascript_ternary_operation_signs_on_next_line = false +ij_javascript_ternary_operation_wrap = on_every_item +ij_javascript_union_types_wrap = on_every_item +ij_javascript_use_chained_calls_group_indents = true +ij_javascript_use_double_quotes = true +ij_javascript_use_explicit_js_extension = auto +ij_javascript_use_path_mapping = always +ij_javascript_use_public_modifier = false +ij_javascript_use_semicolon_after_statement = true +ij_javascript_var_declaration_wrap = normal +ij_javascript_while_brace_force = always +ij_javascript_while_on_new_line = false +ij_javascript_wrap_comments = false [{*.comp,*.frag,*.fsh,*.geom,*.glsl,*.tesc,*.tese,*.vert,*.vsh}] ij_glsl_keep_indents_on_empty_lines = false [{*.har,*.jsb2,*.jsb3,*.json,*.jsonc,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,jest.config}] -indent_size = 2 -ij_json_array_wrapping = normal -ij_json_keep_blank_lines_in_code = 0 +indent_size = 2 +ij_json_array_wrapping = normal +ij_json_keep_blank_lines_in_code = 0 ij_json_keep_indents_on_empty_lines = false -ij_json_keep_line_breaks = true -ij_json_keep_trailing_comma = false -ij_json_object_wrapping = normal -ij_json_property_alignment = align_on_value -ij_json_space_after_colon = true -ij_json_space_after_comma = true -ij_json_space_before_colon = false -ij_json_space_before_comma = false -ij_json_spaces_within_braces = false -ij_json_spaces_within_brackets = false -ij_json_wrap_long_lines = false -indent_style = space +ij_json_keep_line_breaks = true +ij_json_keep_trailing_comma = false +ij_json_object_wrapping = normal +ij_json_property_alignment = align_on_value +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = false +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false +indent_style = space [{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}] -ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 -ij_html_align_attributes = true -ij_html_align_text = false -ij_html_attribute_wrap = normal -ij_html_block_comment_add_space = false -ij_html_block_comment_at_first_column = true +ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_add_space = false +ij_html_block_comment_at_first_column = true ij_html_do_not_align_children_of_min_lines = 0 -ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p -ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot -ij_html_enforce_quotes = false -ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var -ij_html_keep_blank_lines = 2 -ij_html_keep_indents_on_empty_lines = false -ij_html_keep_line_breaks = true -ij_html_keep_line_breaks_in_text = true -ij_html_keep_whitespaces = false -ij_html_keep_whitespaces_inside = span,pre,textarea -ij_html_line_comment_at_first_column = true -ij_html_new_line_after_last_attribute = never -ij_html_new_line_before_first_attribute = never -ij_html_quote_style = double -ij_html_remove_new_line_before_tags = br -ij_html_space_after_tag_name = false +ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p +ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span, pre, textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false ij_html_space_around_equality_in_attribute = false -ij_html_space_inside_empty_tag = false -ij_html_text_wrap = normal +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal [{*.http,*.rest}] -indent_size = 0 -ij_continuation_indent_size = 4 -ij_http-request_call_parameters_wrap = normal -ij_http-request_method_parameters_wrap = split_into_lines -ij_http-request_space_before_comma = true +indent_size = 0 +ij_continuation_indent_size = 4 +ij_http-request_call_parameters_wrap = normal +ij_http-request_method_parameters_wrap = split_into_lines +ij_http-request_space_before_comma = true ij_http-request_spaces_around_assignment_operators = true [{*.markdown,*.md}] ij_markdown_force_one_space_after_blockquote_symbol = true -ij_markdown_force_one_space_after_header_symbol = true -ij_markdown_force_one_space_after_list_bullet = true -ij_markdown_force_one_space_between_words = true -ij_markdown_format_tables = true -ij_markdown_insert_quote_arrows_on_wrap = true -ij_markdown_keep_indents_on_empty_lines = false -ij_markdown_keep_line_breaks_inside_text_blocks = true -ij_markdown_max_lines_around_block_elements = 1 -ij_markdown_max_lines_around_header = 1 -ij_markdown_max_lines_between_paragraphs = 1 -ij_markdown_min_lines_around_block_elements = 1 -ij_markdown_min_lines_around_header = 1 -ij_markdown_min_lines_between_paragraphs = 1 -ij_markdown_wrap_text_if_long = true -ij_markdown_wrap_text_inside_blockquotes = true +ij_markdown_force_one_space_after_header_symbol = true +ij_markdown_force_one_space_after_list_bullet = true +ij_markdown_force_one_space_between_words = true +ij_markdown_format_tables = true +ij_markdown_insert_quote_arrows_on_wrap = true +ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_keep_line_breaks_inside_text_blocks = true +ij_markdown_max_lines_around_block_elements = 1 +ij_markdown_max_lines_around_header = 1 +ij_markdown_max_lines_between_paragraphs = 1 +ij_markdown_min_lines_around_block_elements = 1 +ij_markdown_min_lines_around_header = 1 +ij_markdown_min_lines_between_paragraphs = 1 +ij_markdown_wrap_text_if_long = true +ij_markdown_wrap_text_inside_blockquotes = true [{*.ps1,*.psd1,*.psm1}] -max_line_length = 115 -ij_powershell_align_multiline_binary_operation = true -ij_powershell_align_multiline_chained_methods = false -ij_powershell_align_multiline_for = true -ij_powershell_align_multiline_parameters = true -ij_powershell_align_multiline_parameters_in_calls = false -ij_powershell_binary_operation_wrap = on_every_item -ij_powershell_block_brace_style = next_line -ij_powershell_call_parameters_new_line_after_left_paren = false -ij_powershell_call_parameters_right_paren_on_new_line = false -ij_powershell_call_parameters_wrap = on_every_item -ij_powershell_catch_on_new_line = true -ij_powershell_class_annotation_wrap = split_into_lines -ij_powershell_class_brace_style = next_line -ij_powershell_else_on_new_line = true -ij_powershell_field_annotation_wrap = off -ij_powershell_finally_on_new_line = true -ij_powershell_for_statement_new_line_after_left_paren = false -ij_powershell_for_statement_right_paren_on_new_line = false -ij_powershell_for_statement_wrap = on_every_item -ij_powershell_keep_blank_lines_in_code = 2 -ij_powershell_keep_first_column_comment = true -ij_powershell_keep_line_breaks = true -ij_powershell_keep_simple_blocks_in_one_line = true -ij_powershell_keep_simple_classes_in_one_line = false -ij_powershell_keep_simple_lambdas_in_one_line = true -ij_powershell_keep_simple_methods_in_one_line = true -ij_powershell_method_annotation_wrap = split_into_lines -ij_powershell_method_brace_style = next_line -ij_powershell_method_call_chain_wrap = on_every_item -ij_powershell_method_parameters_new_line_after_left_paren = false -ij_powershell_method_parameters_right_paren_on_new_line = false -ij_powershell_method_parameters_wrap = on_every_item -ij_powershell_parameter_annotation_wrap = off +max_line_length = 115 +ij_powershell_align_multiline_binary_operation = true +ij_powershell_align_multiline_chained_methods = false +ij_powershell_align_multiline_for = true +ij_powershell_align_multiline_parameters = true +ij_powershell_align_multiline_parameters_in_calls = false +ij_powershell_binary_operation_wrap = on_every_item +ij_powershell_block_brace_style = next_line +ij_powershell_call_parameters_new_line_after_left_paren = false +ij_powershell_call_parameters_right_paren_on_new_line = false +ij_powershell_call_parameters_wrap = on_every_item +ij_powershell_catch_on_new_line = true +ij_powershell_class_annotation_wrap = split_into_lines +ij_powershell_class_brace_style = next_line +ij_powershell_else_on_new_line = true +ij_powershell_field_annotation_wrap = off +ij_powershell_finally_on_new_line = true +ij_powershell_for_statement_new_line_after_left_paren = false +ij_powershell_for_statement_right_paren_on_new_line = false +ij_powershell_for_statement_wrap = on_every_item +ij_powershell_keep_blank_lines_in_code = 2 +ij_powershell_keep_first_column_comment = true +ij_powershell_keep_line_breaks = true +ij_powershell_keep_simple_blocks_in_one_line = true +ij_powershell_keep_simple_classes_in_one_line = false +ij_powershell_keep_simple_lambdas_in_one_line = true +ij_powershell_keep_simple_methods_in_one_line = true +ij_powershell_method_annotation_wrap = split_into_lines +ij_powershell_method_brace_style = next_line +ij_powershell_method_call_chain_wrap = on_every_item +ij_powershell_method_parameters_new_line_after_left_paren = false +ij_powershell_method_parameters_right_paren_on_new_line = false +ij_powershell_method_parameters_wrap = on_every_item +ij_powershell_parameter_annotation_wrap = off ij_powershell_parentheses_expression_new_line_after_left_paren = false -ij_powershell_parentheses_expression_right_paren_on_new_line = false -ij_powershell_space_after_colon = true -ij_powershell_space_after_comma = true -ij_powershell_space_after_for_semicolon = true -ij_powershell_space_after_type_cast = false -ij_powershell_space_before_annotation_parameter_list = false -ij_powershell_space_before_array_initializer_left_brace = false -ij_powershell_space_before_catch_keyword = true -ij_powershell_space_before_catch_left_brace = false -ij_powershell_space_before_class_left_brace = false -ij_powershell_space_before_colon = true -ij_powershell_space_before_comma = false -ij_powershell_space_before_do_left_brace = false -ij_powershell_space_before_else_keyword = true -ij_powershell_space_before_else_left_brace = false -ij_powershell_space_before_finally_keyword = true -ij_powershell_space_before_finally_left_brace = false -ij_powershell_space_before_for_left_brace = false -ij_powershell_space_before_for_parentheses = false -ij_powershell_space_before_for_semicolon = false -ij_powershell_space_before_if_left_brace = false -ij_powershell_space_before_if_parentheses = false -ij_powershell_space_before_method_call_parentheses = false -ij_powershell_space_before_method_left_brace = false -ij_powershell_space_before_method_parentheses = false -ij_powershell_space_before_switch_left_brace = false -ij_powershell_space_before_switch_parentheses = false -ij_powershell_space_before_try_left_brace = false -ij_powershell_space_before_while_keyword = true -ij_powershell_space_before_while_left_brace = false -ij_powershell_space_before_while_parentheses = false -ij_powershell_space_within_empty_method_call_parentheses = false -ij_powershell_space_within_empty_method_parentheses = false -ij_powershell_spaces_around_additive_operators = true -ij_powershell_spaces_around_assignment_operators = true -ij_powershell_spaces_around_bitwise_operators = true -ij_powershell_spaces_around_logical_operators = true -ij_powershell_spaces_around_method_ref_dbl_colon = false -ij_powershell_spaces_around_multiplicative_operators = true -ij_powershell_spaces_around_relational_operators = true -ij_powershell_spaces_around_unary_operator = false -ij_powershell_spaces_within_annotation_parentheses = false -ij_powershell_spaces_within_braces = true -ij_powershell_spaces_within_brackets = false -ij_powershell_spaces_within_cast_parentheses = false -ij_powershell_spaces_within_for_parentheses = false -ij_powershell_spaces_within_if_parentheses = false -ij_powershell_spaces_within_method_call_parentheses = false -ij_powershell_spaces_within_method_parentheses = false -ij_powershell_spaces_within_parentheses = false -ij_powershell_spaces_within_switch_parentheses = false -ij_powershell_spaces_within_while_parentheses = false -ij_powershell_special_else_if_treatment = true -ij_powershell_while_on_new_line = false -ij_powershell_wrap_first_method_in_call_chain = false -ij_powershell_wrap_long_lines = false +ij_powershell_parentheses_expression_right_paren_on_new_line = false +ij_powershell_space_after_colon = true +ij_powershell_space_after_comma = true +ij_powershell_space_after_for_semicolon = true +ij_powershell_space_after_type_cast = false +ij_powershell_space_before_annotation_parameter_list = false +ij_powershell_space_before_array_initializer_left_brace = false +ij_powershell_space_before_catch_keyword = true +ij_powershell_space_before_catch_left_brace = false +ij_powershell_space_before_class_left_brace = false +ij_powershell_space_before_colon = true +ij_powershell_space_before_comma = false +ij_powershell_space_before_do_left_brace = false +ij_powershell_space_before_else_keyword = true +ij_powershell_space_before_else_left_brace = false +ij_powershell_space_before_finally_keyword = true +ij_powershell_space_before_finally_left_brace = false +ij_powershell_space_before_for_left_brace = false +ij_powershell_space_before_for_parentheses = false +ij_powershell_space_before_for_semicolon = false +ij_powershell_space_before_if_left_brace = false +ij_powershell_space_before_if_parentheses = false +ij_powershell_space_before_method_call_parentheses = false +ij_powershell_space_before_method_left_brace = false +ij_powershell_space_before_method_parentheses = false +ij_powershell_space_before_switch_left_brace = false +ij_powershell_space_before_switch_parentheses = false +ij_powershell_space_before_try_left_brace = false +ij_powershell_space_before_while_keyword = true +ij_powershell_space_before_while_left_brace = false +ij_powershell_space_before_while_parentheses = false +ij_powershell_space_within_empty_method_call_parentheses = false +ij_powershell_space_within_empty_method_parentheses = false +ij_powershell_spaces_around_additive_operators = true +ij_powershell_spaces_around_assignment_operators = true +ij_powershell_spaces_around_bitwise_operators = true +ij_powershell_spaces_around_logical_operators = true +ij_powershell_spaces_around_method_ref_dbl_colon = false +ij_powershell_spaces_around_multiplicative_operators = true +ij_powershell_spaces_around_relational_operators = true +ij_powershell_spaces_around_unary_operator = false +ij_powershell_spaces_within_annotation_parentheses = false +ij_powershell_spaces_within_braces = true +ij_powershell_spaces_within_brackets = false +ij_powershell_spaces_within_cast_parentheses = false +ij_powershell_spaces_within_for_parentheses = false +ij_powershell_spaces_within_if_parentheses = false +ij_powershell_spaces_within_method_call_parentheses = false +ij_powershell_spaces_within_method_parentheses = false +ij_powershell_spaces_within_parentheses = false +ij_powershell_spaces_within_switch_parentheses = false +ij_powershell_spaces_within_while_parentheses = false +ij_powershell_special_else_if_treatment = true +ij_powershell_while_on_new_line = false +ij_powershell_wrap_first_method_in_call_chain = false +ij_powershell_wrap_long_lines = false [{*.py,*.pyw}] -ij_python_align_collections_and_comprehensions = true -ij_python_align_multiline_imports = true -ij_python_align_multiline_parameters = true -ij_python_align_multiline_parameters_in_calls = true -ij_python_blank_line_at_file_end = false -ij_python_blank_lines_after_imports = 1 -ij_python_blank_lines_after_local_imports = 0 -ij_python_blank_lines_around_class = 1 -ij_python_blank_lines_around_method = 1 -ij_python_blank_lines_around_top_level_classes_functions = 2 -ij_python_blank_lines_before_first_method = 0 -ij_python_call_parameters_new_line_after_left_paren = false -ij_python_call_parameters_right_paren_on_new_line = false -ij_python_call_parameters_wrap = on_every_item -ij_python_dict_alignment = 0 -ij_python_dict_new_line_after_left_brace = false -ij_python_dict_new_line_before_right_brace = false -ij_python_dict_wrapping = 5 -ij_python_from_import_new_line_after_left_parenthesis = false -ij_python_from_import_new_line_before_right_parenthesis = false -ij_python_from_import_parentheses_force_if_multiline = false -ij_python_from_import_trailing_comma_if_multiline = false -ij_python_from_import_wrapping = 5 -ij_python_hang_closing_brackets = true -ij_python_keep_blank_lines_in_code = 1 -ij_python_keep_blank_lines_in_declarations = 1 -ij_python_keep_indents_on_empty_lines = false -ij_python_keep_line_breaks = true -ij_python_method_parameters_new_line_after_left_paren = false -ij_python_method_parameters_right_paren_on_new_line = false -ij_python_method_parameters_wrap = on_every_item -ij_python_new_line_after_colon = false -ij_python_new_line_after_colon_multi_clause = true -ij_python_optimize_imports_always_split_from_imports = false -ij_python_optimize_imports_case_insensitive_order = true -ij_python_optimize_imports_join_from_imports_with_same_source = false -ij_python_optimize_imports_sort_by_type_first = true -ij_python_optimize_imports_sort_imports = true -ij_python_optimize_imports_sort_names_in_from_imports = true -ij_python_space_after_comma = true -ij_python_space_after_number_sign = true -ij_python_space_after_py_colon = true -ij_python_space_before_backslash = true -ij_python_space_before_comma = false -ij_python_space_before_for_semicolon = false -ij_python_space_before_lbracket = false -ij_python_space_before_method_call_parentheses = false -ij_python_space_before_method_parentheses = false -ij_python_space_before_number_sign = true -ij_python_space_before_py_colon = false -ij_python_space_within_empty_method_call_parentheses = false -ij_python_space_within_empty_method_parentheses = false -ij_python_spaces_around_additive_operators = true -ij_python_spaces_around_assignment_operators = true -ij_python_spaces_around_bitwise_operators = true -ij_python_spaces_around_eq_in_keyword_argument = false -ij_python_spaces_around_eq_in_named_parameter = false -ij_python_spaces_around_equality_operators = true -ij_python_spaces_around_multiplicative_operators = true -ij_python_spaces_around_power_operator = true -ij_python_spaces_around_relational_operators = true -ij_python_spaces_around_shift_operators = true -ij_python_spaces_within_braces = false -ij_python_spaces_within_brackets = false -ij_python_spaces_within_method_call_parentheses = false -ij_python_spaces_within_method_parentheses = false -ij_python_use_continuation_indent_for_arguments = false +ij_python_align_collections_and_comprehensions = true +ij_python_align_multiline_imports = true +ij_python_align_multiline_parameters = true +ij_python_align_multiline_parameters_in_calls = true +ij_python_blank_line_at_file_end = false +ij_python_blank_lines_after_imports = 1 +ij_python_blank_lines_after_local_imports = 0 +ij_python_blank_lines_around_class = 1 +ij_python_blank_lines_around_method = 1 +ij_python_blank_lines_around_top_level_classes_functions = 2 +ij_python_blank_lines_before_first_method = 0 +ij_python_call_parameters_new_line_after_left_paren = false +ij_python_call_parameters_right_paren_on_new_line = false +ij_python_call_parameters_wrap = on_every_item +ij_python_dict_alignment = 0 +ij_python_dict_new_line_after_left_brace = false +ij_python_dict_new_line_before_right_brace = false +ij_python_dict_wrapping = 5 +ij_python_from_import_new_line_after_left_parenthesis = false +ij_python_from_import_new_line_before_right_parenthesis = false +ij_python_from_import_parentheses_force_if_multiline = false +ij_python_from_import_trailing_comma_if_multiline = false +ij_python_from_import_wrapping = 5 +ij_python_hang_closing_brackets = true +ij_python_keep_blank_lines_in_code = 1 +ij_python_keep_blank_lines_in_declarations = 1 +ij_python_keep_indents_on_empty_lines = false +ij_python_keep_line_breaks = true +ij_python_method_parameters_new_line_after_left_paren = false +ij_python_method_parameters_right_paren_on_new_line = false +ij_python_method_parameters_wrap = on_every_item +ij_python_new_line_after_colon = false +ij_python_new_line_after_colon_multi_clause = true +ij_python_optimize_imports_always_split_from_imports = false +ij_python_optimize_imports_case_insensitive_order = true +ij_python_optimize_imports_join_from_imports_with_same_source = false +ij_python_optimize_imports_sort_by_type_first = true +ij_python_optimize_imports_sort_imports = true +ij_python_optimize_imports_sort_names_in_from_imports = true +ij_python_space_after_comma = true +ij_python_space_after_number_sign = true +ij_python_space_after_py_colon = true +ij_python_space_before_backslash = true +ij_python_space_before_comma = false +ij_python_space_before_for_semicolon = false +ij_python_space_before_lbracket = false +ij_python_space_before_method_call_parentheses = false +ij_python_space_before_method_parentheses = false +ij_python_space_before_number_sign = true +ij_python_space_before_py_colon = false +ij_python_space_within_empty_method_call_parentheses = false +ij_python_space_within_empty_method_parentheses = false +ij_python_spaces_around_additive_operators = true +ij_python_spaces_around_assignment_operators = true +ij_python_spaces_around_bitwise_operators = true +ij_python_spaces_around_eq_in_keyword_argument = false +ij_python_spaces_around_eq_in_named_parameter = false +ij_python_spaces_around_equality_operators = true +ij_python_spaces_around_multiplicative_operators = true +ij_python_spaces_around_power_operator = true +ij_python_spaces_around_relational_operators = true +ij_python_spaces_around_shift_operators = true +ij_python_spaces_within_braces = false +ij_python_spaces_within_brackets = false +ij_python_spaces_within_method_call_parentheses = false +ij_python_spaces_within_method_parentheses = false +ij_python_use_continuation_indent_for_arguments = false ij_python_use_continuation_indent_for_collection_and_comprehensions = false -ij_python_use_continuation_indent_for_parameters = true -ij_python_wrap_long_lines = false +ij_python_use_continuation_indent_for_parameters = true +ij_python_wrap_long_lines = false [{*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,poetry.lock}] ij_toml_keep_indents_on_empty_lines = false [{*.yaml,*.yml,pubspec.lock}] -indent_size = 2 -ij_yaml_align_values_properties = on_value -ij_yaml_autoinsert_sequence_marker = true -ij_yaml_block_mapping_on_new_line = false -ij_yaml_indent_sequence_value = true +indent_size = 2 +ij_yaml_align_values_properties = on_value +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true ij_yaml_keep_indents_on_empty_lines = false -ij_yaml_keep_line_breaks = true -ij_yaml_sequence_on_new_line = false -ij_yaml_space_before_colon = false -ij_yaml_spaces_within_braces = true -ij_yaml_spaces_within_brackets = true -indent_style = space +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true +indent_style = space [*.{appxmanifest,asax,ascx,aspx,axaml,build,c,c++,cc,cginc,compute,cp,cpp,cppm,cs,cshtml,cu,cuh,cxx,dtd,fs,fsi,fsscript,fsx,fx,fxh,h,hh,hlsl,hlsli,hlslinc,hpp,hxx,inc,inl,ino,ipp,ixx,master,ml,mli,mpp,mq4,mq5,mqh,nuspec,paml,razor,resw,resx,shader,skin,tpp,usf,ush,uxml,vb,xaml,xamlx,xoml,xsd}] indent_style = space -indent_size = 4 -tab_width = 4 +indent_size = 4 +tab_width = 4 diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption.csproj index 036ceda9d..998f3da01 100644 --- a/Aaru.Decryption.csproj +++ b/Aaru.Decryption.csproj @@ -33,8 +33,8 @@ CS1591;CS1574 - - + + $(Version)+{chash:8} @@ -43,9 +43,9 @@ - - - + + + diff --git a/Aaru.Decryption.csproj.DotSettings b/Aaru.Decryption.csproj.DotSettings index dc0dbdcef..67ed7f8db 100644 --- a/Aaru.Decryption.csproj.DotSettings +++ b/Aaru.Decryption.csproj.DotSettings @@ -1,2 +1,5 @@ - + True \ No newline at end of file diff --git a/DVD/CSS.cs b/DVD/CSS.cs index 3a28055a9..08f84c18c 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -58,99 +58,17 @@ public class CSS { static readonly byte[,] _playerKeys = { - { - 0x01, 0xaf, 0xe3, 0x12, 0x80 - }, - { - 0x12, 0x11, 0xca, 0x04, 0x3b - }, - { - 0x14, 0x0c, 0x9e, 0xd0, 0x09 - }, - { - 0x14, 0x71, 0x35, 0xba, 0xe2 - }, - { - 0x1a, 0xa4, 0x33, 0x21, 0xa6 - }, - { - 0x26, 0xec, 0xc4, 0xa7, 0x4e - }, - { - 0x2c, 0xb2, 0xc1, 0x09, 0xee - }, - { - 0x2f, 0x25, 0x9e, 0x96, 0xdd - }, - { - 0x33, 0x2f, 0x49, 0x6c, 0xe0 - }, - { - 0x35, 0x5b, 0xc1, 0x31, 0x0f - }, - { - 0x36, 0x67, 0xb2, 0xe3, 0x85 - }, - { - 0x39, 0x3d, 0xf1, 0xf1, 0xbd - }, - { - 0x3b, 0x31, 0x34, 0x0d, 0x91 - }, - { - 0x45, 0xed, 0x28, 0xeb, 0xd3 - }, - { - 0x48, 0xb7, 0x6c, 0xce, 0x69 - }, - { - 0x4b, 0x65, 0x0d, 0xc1, 0xee - }, - { - 0x4c, 0xbb, 0xf5, 0x5b, 0x23 - }, - { - 0x51, 0x67, 0x67, 0xc5, 0xe0 - }, - { - 0x53, 0x94, 0xe1, 0x75, 0xbf - }, - { - 0x57, 0x2c, 0x8b, 0x31, 0xae - }, - { - 0x63, 0xdb, 0x4c, 0x5b, 0x4a - }, - { - 0x7b, 0x1e, 0x5e, 0x2b, 0x57 - }, - { - 0x85, 0xf3, 0x85, 0xa0, 0xe0 - }, - { - 0xab, 0x1e, 0xe7, 0x7b, 0x72 - }, - { - 0xab, 0x36, 0xe3, 0xeb, 0x76 - }, - { - 0xb1, 0xb8, 0xf9, 0x38, 0x03 - }, - { - 0xb8, 0x5d, 0xd8, 0x53, 0xbd - }, - { - 0xbf, 0x92, 0xc3, 0xb0, 0xe2 - }, - { - 0xcf, 0x1a, 0xb2, 0xf8, 0x0a - }, - { - 0xec, 0xa0, 0xcf, 0xb3, 0xff - }, - { - 0xfc, 0x95, 0xa9, 0x87, 0x35 - } + { 0x01, 0xaf, 0xe3, 0x12, 0x80 }, { 0x12, 0x11, 0xca, 0x04, 0x3b }, { 0x14, 0x0c, 0x9e, 0xd0, 0x09 }, + { 0x14, 0x71, 0x35, 0xba, 0xe2 }, { 0x1a, 0xa4, 0x33, 0x21, 0xa6 }, { 0x26, 0xec, 0xc4, 0xa7, 0x4e }, + { 0x2c, 0xb2, 0xc1, 0x09, 0xee }, { 0x2f, 0x25, 0x9e, 0x96, 0xdd }, { 0x33, 0x2f, 0x49, 0x6c, 0xe0 }, + { 0x35, 0x5b, 0xc1, 0x31, 0x0f }, { 0x36, 0x67, 0xb2, 0xe3, 0x85 }, { 0x39, 0x3d, 0xf1, 0xf1, 0xbd }, + { 0x3b, 0x31, 0x34, 0x0d, 0x91 }, { 0x45, 0xed, 0x28, 0xeb, 0xd3 }, { 0x48, 0xb7, 0x6c, 0xce, 0x69 }, + { 0x4b, 0x65, 0x0d, 0xc1, 0xee }, { 0x4c, 0xbb, 0xf5, 0x5b, 0x23 }, { 0x51, 0x67, 0x67, 0xc5, 0xe0 }, + { 0x53, 0x94, 0xe1, 0x75, 0xbf }, { 0x57, 0x2c, 0x8b, 0x31, 0xae }, { 0x63, 0xdb, 0x4c, 0x5b, 0x4a }, + { 0x7b, 0x1e, 0x5e, 0x2b, 0x57 }, { 0x85, 0xf3, 0x85, 0xa0, 0xe0 }, { 0xab, 0x1e, 0xe7, 0x7b, 0x72 }, + { 0xab, 0x36, 0xe3, 0xeb, 0x76 }, { 0xb1, 0xb8, 0xf9, 0x38, 0x03 }, { 0xb8, 0x5d, 0xd8, 0x53, 0xbd }, + { 0xbf, 0x92, 0xc3, 0xb0, 0xe2 }, { 0xcf, 0x1a, 0xb2, 0xf8, 0x0a }, { 0xec, 0xa0, 0xcf, 0xb3, 0xff }, + { 0xfc, 0x95, 0xa9, 0x87, 0x35 } }; static readonly byte[] _cssTable1 = @@ -341,15 +259,7 @@ public class CSS static readonly byte[,] _permutationChallenge = { - { - 1, 3, 0, 7, 5, 2, 9, 6, 4, 8 - }, - { - 6, 1, 9, 3, 8, 5, 7, 4, 0, 2 - }, - { - 4, 0, 3, 5, 7, 2, 8, 6, 1, 9 - } + { 1, 3, 0, 7, 5, 2, 9, 6, 4, 8 }, { 6, 1, 9, 3, 8, 5, 7, 4, 0, 2 }, { 4, 0, 3, 5, 7, 2, 8, 6, 1, 9 } }; static readonly byte[,] _permutationVariant = @@ -370,10 +280,7 @@ public class CSS 0xF2, 0x2A, 0x79, 0x52, 0xFF, 0x1B, 0x7A, 0x11, 0xCA, 0x1A, 0x9B, 0x40, 0xAD, 0x01 }; - static readonly byte[] _secret = - { - 0x55, 0xD6, 0xC4, 0xC5, 0x28 - }; + static readonly byte[] _secret = { 0x55, 0xD6, 0xC4, 0xC5, 0x28 }; /// /// The disc key returned by the logical unit is encoded with the bus key to prevent man-in-the-middle attacks. @@ -391,7 +298,7 @@ public class CSS byte[] key = response.Skip(4).Take(2048).ToArray(); for(uint i = 0; i < key.Length; i++) - key[i] ^= busKey[4 - (i % busKey.Length)]; + key[i] ^= busKey[4 - i % busKey.Length]; return new CSS_CPRM.DiscKey { @@ -418,7 +325,7 @@ public class CSS byte[] key = response.Skip(5).Take(5).ToArray(); for(uint i = 0; i < key.Length; i++) - key[i] ^= busKey[4 - (i % busKey.Length)]; + key[i] ^= busKey[4 - i % busKey.Length]; return new CSS_CPRM.TitleKey { @@ -440,49 +347,49 @@ public class CSS /// The encrypted key. public static void EncryptKey(DvdCssKeyType keyType, uint variant, byte[] challenge, out byte[] key) { - byte[] bits = new byte[30]; - byte[] scratch = new byte[10]; - byte index = sizeof(byte) * 30; - byte[] temp1 = new byte[5]; - byte[] temp2 = new byte[5]; - byte carry = 0; + var bits = new byte[30]; + var scratch = new byte[10]; + byte index = sizeof(byte) * 30; + var temp1 = new byte[5]; + var temp2 = new byte[5]; + byte carry = 0; key = new byte[5]; - for(int i = 9; i >= 0; --i) + for(var i = 9; i >= 0; --i) scratch[i] = challenge[_permutationChallenge[(uint)keyType, i]]; - byte cssVariant = (byte)(keyType == 0 ? variant : _permutationVariant[(uint)keyType - 1, variant]); + var cssVariant = (byte)(keyType == 0 ? variant : _permutationVariant[(uint)keyType - 1, variant]); - for(int i = 5; --i >= 0;) + for(var i = 5; --i >= 0;) temp1[i] = (byte)(scratch[5 + i] ^ _secret[i] ^ _encryptTable2[i]); - uint lfsr0 = (uint)((temp1[0] << 17) | (temp1[1] << 9) | ((temp1[2] & ~7) << 1) | 8 | (temp1[2] & 7)); - uint lfsr1 = (uint)((temp1[3] << 9) | 0x100 | temp1[4]); + var lfsr0 = (uint)(temp1[0] << 17 | temp1[1] << 9 | (temp1[2] & ~7) << 1 | 8 | temp1[2] & 7); + var lfsr1 = (uint)(temp1[3] << 9 | 0x100 | temp1[4]); do { byte val = 0; - for(int bit = 0; bit < 8; ++bit) + for(var bit = 0; bit < 8; ++bit) { - byte oLfsr0 = (byte)(((lfsr0 >> 24) ^ (lfsr0 >> 21) ^ (lfsr0 >> 20) ^ (lfsr0 >> 12)) & 1); - lfsr0 = (lfsr0 << 1) | oLfsr0; + var oLfsr0 = (byte)((lfsr0 >> 24 ^ lfsr0 >> 21 ^ lfsr0 >> 20 ^ lfsr0 >> 12) & 1); + lfsr0 = lfsr0 << 1 | oLfsr0; - byte oLfsr1 = (byte)(((lfsr1 >> 16) ^ (lfsr1 >> 2)) & 1); - lfsr1 = (lfsr1 << 1) | oLfsr1; + var oLfsr1 = (byte)((lfsr1 >> 16 ^ lfsr1 >> 2) & 1); + lfsr1 = lfsr1 << 1 | oLfsr1; - byte combined = (byte)(Convert.ToByte(oLfsr1 == 0) + carry + Convert.ToByte(oLfsr0 == 0)); - carry = (byte)((combined >> 1) & 1); + var combined = (byte)(Convert.ToByte(oLfsr1 == 0) + carry + Convert.ToByte(oLfsr0 == 0)); + carry = (byte)(combined >> 1 & 1); val |= (byte)((combined & 1) << bit); } bits[--index] = val; } while(index > 0); - byte cse = (byte)(_variants[cssVariant] ^ _encryptTable2[cssVariant]); - int term = 0; + var cse = (byte)(_variants[cssVariant] ^ _encryptTable2[cssVariant]); + var term = 0; - for(int i = 5; --i >= 0; term = scratch[i]) + for(var i = 5; --i >= 0; term = scratch[i]) { index = (byte)(bits[25 + i] ^ scratch[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -493,7 +400,7 @@ public class CSS temp1[4] ^= temp1[0]; term = 0; - for(int i = 5; --i >= 0; term = temp1[i]) + for(var i = 5; --i >= 0; term = temp1[i]) { index = (byte)(bits[20 + i] ^ temp1[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -504,7 +411,7 @@ public class CSS temp2[4] ^= temp2[0]; term = 0; - for(int i = 5; --i >= 0; term = temp2[i]) + for(var i = 5; --i >= 0; term = temp2[i]) { index = (byte)(bits[15 + i] ^ temp2[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -516,7 +423,7 @@ public class CSS temp1[4] ^= temp1[0]; term = 0; - for(int i = 5; --i >= 0; term = temp1[i]) + for(var i = 5; --i >= 0; term = temp1[i]) { index = (byte)(bits[10 + i] ^ temp1[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -528,7 +435,7 @@ public class CSS temp2[4] ^= temp2[0]; term = 0; - for(int i = 5; --i >= 0; term = temp2[i]) + for(var i = 5; --i >= 0; term = temp2[i]) { index = (byte)(bits[5 + i] ^ temp2[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -539,7 +446,7 @@ public class CSS temp1[4] ^= temp1[0]; term = 0; - for(int i = 5; --i >= 0; term = temp1[i]) + for(var i = 5; --i >= 0; term = temp1[i]) { index = (byte)(bits[i] ^ temp1[i]); index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse); @@ -556,27 +463,27 @@ public class CSS static void DecryptKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) { decryptedKey = new byte[5]; - byte[] k = new byte[5]; + var k = new byte[5]; - uint lfsr1Lo = (uint)(cryptoKey[0] | 0x100); + var lfsr1Lo = (uint)(cryptoKey[0] | 0x100); uint lfsr1Hi = cryptoKey[1]; - uint lfsr0 = (uint)(((cryptoKey[4] << 17) | (cryptoKey[3] << 9) | (cryptoKey[2] << 1)) + 8 - - (cryptoKey[2] & 7)); + var lfsr0 = (uint)((cryptoKey[4] << 17 | cryptoKey[3] << 9 | cryptoKey[2] << 1) + 8 - + (cryptoKey[2] & 7)); - lfsr0 = (uint)((_cssTable4[lfsr0 & 0xff] << 24) | (_cssTable4[(lfsr0 >> 8) & 0xff] << 16) | - (_cssTable4[(lfsr0 >> 16) & 0xff] << 8) | _cssTable4[(lfsr0 >> 24) & 0xff]); + lfsr0 = (uint)(_cssTable4[lfsr0 & 0xff] << 24 | _cssTable4[lfsr0 >> 8 & 0xff] << 16 | + _cssTable4[lfsr0 >> 16 & 0xff] << 8 | _cssTable4[lfsr0 >> 24 & 0xff]); uint combined = 0; for(uint i = 0; i < 5; i++) { - byte oLfsr1 = (byte)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); + var oLfsr1 = (byte)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]); lfsr1Hi = lfsr1Lo >> 1; - lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; + lfsr1Lo = (lfsr1Lo & 1) << 8 ^ oLfsr1; oLfsr1 = _cssTable4[oLfsr1]; - byte oLfsr0 = (byte)(((((((lfsr0 >> 8) ^ lfsr0) >> 1) ^ lfsr0) >> 3) ^ lfsr0) >> 7); - lfsr0 = (lfsr0 >> 8) | ((uint)oLfsr0 << 24); + var oLfsr0 = (byte)((((lfsr0 >> 8 ^ lfsr0) >> 1 ^ lfsr0) >> 3 ^ lfsr0) >> 7); + lfsr0 = lfsr0 >> 8 | (uint)oLfsr0 << 24; combined += (uint)((oLfsr0 ^ invert) + oLfsr1); k[i] = (byte)(combined & 0xff); combined >>= 8; @@ -636,14 +543,14 @@ public class CSS /// Size of one sector. /// The decrypted sector. public static byte[] DecryptSector(byte[] sectorData, byte[] keyData, byte[]? cmiData, uint blocks = 1, - uint blockSize = 2048) + uint blockSize = 2048) { // None of the sectors are encrypted - if((cmiData != null && cmiData.All(static cmi => (cmi & 0x80) >> 7 == 0)) || + if(cmiData != null && cmiData.All(static cmi => (cmi & 0x80) >> 7 == 0) || keyData.All(static k => k == 0)) return sectorData; - byte[] decryptedBuffer = new byte[sectorData.Length]; + var decryptedBuffer = new byte[sectorData.Length]; for(uint i = 0; i < blocks; i++) { @@ -665,21 +572,21 @@ public class CSS } /// - /// Unscrambles a DVD sector with a title key. + /// Unscrambles a DVD sector with a title key. /// /// The title key. /// The scrambled sector. /// The unscrambled sector. static byte[] UnscrambleSector(IReadOnlyList key, byte[] sector) { - long lfsr1Lo = (key[0] ^ sector[0x54]) | 0x100; + long lfsr1Lo = key[0] ^ sector[0x54] | 0x100; long lfsr1Hi = key[1] ^ sector[0x55]; - long lfsr0 = (key[2] | (key[3] << 8) | (key[4] << 16)) ^ - (sector[0x56] | (sector[0x57] << 8) | (sector[0x58] << 16)); + long lfsr0 = (key[2] | key[3] << 8 | key[4] << 16) ^ + (sector[0x56] | sector[0x57] << 8 | sector[0x58] << 16); long oLfsr1 = lfsr0 & 7; - lfsr0 = (lfsr0 * 2) + 8 - oLfsr1; + lfsr0 = lfsr0 * 2 + 8 - oLfsr1; long combined = 0; @@ -687,13 +594,13 @@ public class CSS { oLfsr1 = _cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]; lfsr1Hi = lfsr1Lo >> 1; - lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; + lfsr1Lo = (lfsr1Lo & 1) << 8 ^ oLfsr1; oLfsr1 = _cssTable5[oLfsr1]; - long oLfsr0 = (((((((lfsr0 >> 3) ^ lfsr0) >> 1) ^ lfsr0) >> 8) ^ lfsr0) >> 5) & 0xff; - lfsr0 = (lfsr0 << 8) | oLfsr0; + long oLfsr0 = (((lfsr0 >> 3 ^ lfsr0) >> 1 ^ lfsr0) >> 8 ^ lfsr0) >> 5 & 0xff; + lfsr0 = lfsr0 << 8 | oLfsr0; oLfsr0 = _cssTable4[oLfsr0]; combined += oLfsr0 + oLfsr1; - sector[i] = (byte)(_cssTable1[sector[i]] ^ (combined & 0xff)); + sector[i] = (byte)(_cssTable1[sector[i]] ^ combined & 0xff); combined >>= 8; } @@ -705,14 +612,17 @@ public class CSS } /// - /// Analyzes data to try to figure out if the sector is encrypted, including - /// - /// If the packet is not an MPEG packet - /// If the CMI tells us the sector isn't encrypted - /// If the key is all zeroes - /// If the MPEG Packetized Elementary Stream scrambling control value tells us the packet is not scrambled - /// If if the packet is system_header, padding_stream or private_stream2 (cannot be encrypted according to libdvdcss) - /// + /// Analyzes data to try to figure out if the sector is encrypted, including + /// + /// If the packet is not an MPEG packet + /// If the CMI tells us the sector isn't encrypted + /// If the key is all zeroes + /// If the MPEG Packetized Elementary Stream scrambling control value tells us the packet is not scrambled + /// + /// If if the packet is system_header, padding_stream or private_stream2 (cannot be encrypted according to + /// libdvdcss) + /// + /// /// /// The Copyright Management Information. /// The title key. @@ -754,21 +664,21 @@ public class CSS if(cmi.RegionInformation is 0xFF or 0x00) return true; - return ((rpc.RegionMask & 0x01) == (cmi.RegionInformation & 0x01) && (rpc.RegionMask & 0x01) != 0x01) || - ((rpc.RegionMask & 0x02) == (cmi.RegionInformation & 0x02) && (rpc.RegionMask & 0x02) != 0x02) || - ((rpc.RegionMask & 0x04) == (cmi.RegionInformation & 0x04) && (rpc.RegionMask & 0x04) != 0x04) || - ((rpc.RegionMask & 0x08) == (cmi.RegionInformation & 0x08) && (rpc.RegionMask & 0x08) != 0x08) || - ((rpc.RegionMask & 0x10) == (cmi.RegionInformation & 0x10) && (rpc.RegionMask & 0x10) != 0x10) || - ((rpc.RegionMask & 0x20) == (cmi.RegionInformation & 0x20) && (rpc.RegionMask & 0x20) != 0x20) || - ((rpc.RegionMask & 0x40) == (cmi.RegionInformation & 0x40) && (rpc.RegionMask & 0x40) != 0x40) || - ((rpc.RegionMask & 0x80) == (cmi.RegionInformation & 0x80) && (rpc.RegionMask & 0x80) != 0x80); + return (rpc.RegionMask & 0x01) == (cmi.RegionInformation & 0x01) && (rpc.RegionMask & 0x01) != 0x01 || + (rpc.RegionMask & 0x02) == (cmi.RegionInformation & 0x02) && (rpc.RegionMask & 0x02) != 0x02 || + (rpc.RegionMask & 0x04) == (cmi.RegionInformation & 0x04) && (rpc.RegionMask & 0x04) != 0x04 || + (rpc.RegionMask & 0x08) == (cmi.RegionInformation & 0x08) && (rpc.RegionMask & 0x08) != 0x08 || + (rpc.RegionMask & 0x10) == (cmi.RegionInformation & 0x10) && (rpc.RegionMask & 0x10) != 0x10 || + (rpc.RegionMask & 0x20) == (cmi.RegionInformation & 0x20) && (rpc.RegionMask & 0x20) != 0x20 || + (rpc.RegionMask & 0x40) == (cmi.RegionInformation & 0x40) && (rpc.RegionMask & 0x40) != 0x40 || + (rpc.RegionMask & 0x80) == (cmi.RegionInformation & 0x80) && (rpc.RegionMask & 0x80) != 0x80; } /// - /// This tries to find a title key for a range of sectors by doing a brute force pattern search developed by - /// Ethan Hawke of DeCSSPlus. CSS encrypted sectors have parts of them that are unencrypted (byte 0x0 - 0x80). - /// We try to find a long pattern of repeated bytes just before the encryption starts. If we assume this - /// pattern continues into the encrypted part, we can force keys until one of them satisfies this condition. + /// This tries to find a title key for a range of sectors by doing a brute force pattern search developed by + /// Ethan Hawke of DeCSSPlus. CSS encrypted sectors have parts of them that are unencrypted (byte 0x0 - 0x80). + /// We try to find a long pattern of repeated bytes just before the encryption starts. If we assume this + /// pattern continues into the encrypted part, we can force keys until one of them satisfies this condition. /// /// The sector to analyze. /// The key found. @@ -782,7 +692,7 @@ public class CSS for(uint i = 2; i < 0x30; i++) { // Find the number of bytes that repeats in cycles. - for(uint j = i + 1; j < 0x80 && sector[0x7F - (j % i)] == sector[0x7F - j]; j++) + for(uint j = i + 1; j < 0x80 && sector[0x7F - j % i] == sector[0x7F - j]; j++) { if(j <= bestPatternLength) continue; @@ -798,18 +708,18 @@ public class CSS bestPatternLength / bestPattern < 2) return false; - int offset = (int)(0x80 - ((bestPatternLength / bestPattern) * bestPattern)); + var offset = (int)(0x80 - bestPatternLength / bestPattern * bestPattern); int result = RecoverTitleKey(0, sector.Skip(0x80).Take(sector.Length - 0x80).ToArray(), - sector.Skip(offset).Take((int)(sector.Length - offset)).ToArray(), + sector.Skip(offset).Take(sector.Length - offset).ToArray(), sector.Skip(0x54).Take(5).ToArray(), out key); return result >= 0; } /// - /// Takes a guessed plain text and a encrypted bytes and tries to recover the title key - /// from those. Attack developed by Frank Stevenson. + /// Takes a guessed plain text and a encrypted bytes and tries to recover the title key + /// from those. Attack developed by Frank Stevenson. /// /// Start position. /// Buffer with encrypted bytes. @@ -817,15 +727,15 @@ public class CSS /// This sector's seed values. /// The title key. /// Positive values on success. - static int RecoverTitleKey(uint start, byte[] encryptedBytes, byte[] decryptedBytes, byte[] sectorSeed, + static int RecoverTitleKey(uint start, byte[] encryptedBytes, byte[] decryptedBytes, byte[] sectorSeed, out byte[] key) { - byte[] buffer = new byte[10]; - long oLfsr1; - long oLfsr0; - long iTry; - uint i; - int exit = -1; + var buffer = new byte[10]; + long oLfsr1; + long oLfsr0; + long iTry; + uint i; + int exit = -1; key = new byte[5]; for(i = 0; i < 10; i++) @@ -833,7 +743,7 @@ public class CSS for(iTry = start; iTry < 0x10000; iTry++) { - long lfsr1Lo = (iTry >> 8) | 0x100; + long lfsr1Lo = iTry >> 8 | 0x100; long lfsr1Hi = iTry & 0xff; long lfsr0 = 0; long combined = 0; @@ -844,12 +754,12 @@ public class CSS // Advance LFSR1 normally oLfsr1 = _cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]; lfsr1Hi = lfsr1Lo >> 1; - lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; + lfsr1Lo = (lfsr1Lo & 1) << 8 ^ oLfsr1; oLfsr1 = _cssTable5[oLfsr1]; oLfsr0 = buffer[i]; if(combined > 0) - oLfsr0 = (oLfsr0 + 0xff) & 0x0ff; + oLfsr0 = oLfsr0 + 0xff & 0x0ff; if(oLfsr0 < oLfsr1) oLfsr0 += 0x100; @@ -857,7 +767,7 @@ public class CSS oLfsr0 -= oLfsr1; combined += oLfsr0 + oLfsr1; oLfsr0 = _cssTable4[oLfsr0]; - lfsr0 = (lfsr0 << 8) | oLfsr0; + lfsr0 = lfsr0 << 8 | oLfsr0; combined >>= 8; } @@ -868,10 +778,10 @@ public class CSS { oLfsr1 = _cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]; lfsr1Hi = lfsr1Lo >> 1; - lfsr1Lo = ((lfsr1Lo & 1) << 8) ^ oLfsr1; + lfsr1Lo = (lfsr1Lo & 1) << 8 ^ oLfsr1; oLfsr1 = _cssTable5[oLfsr1]; - oLfsr0 = (((((((lfsr0 >> 3) ^ lfsr0) >> 1) ^ lfsr0) >> 8) ^ lfsr0) >> 5) & 0xff; - lfsr0 = (lfsr0 << 8) | oLfsr0; + oLfsr0 = (((lfsr0 >> 3 ^ lfsr0) >> 1 ^ lfsr0) >> 8 ^ lfsr0) >> 5 & 0xff; + lfsr0 = lfsr0 << 8 | oLfsr0; oLfsr0 = _cssTable4[oLfsr0]; combined += oLfsr0 + oLfsr1; @@ -889,12 +799,12 @@ public class CSS for(i = 0; i < 4; i++) { lfsr1Lo = lfsr0 & 0xff; - lfsr0 = (lfsr0 >> 8); + lfsr0 = lfsr0 >> 8; for(uint j = 0; j < 256; j++) { - lfsr0 = (lfsr0 & 0x1ffff) | (j << 17); - oLfsr0 = (((((((lfsr0 >> 3) ^ lfsr0) >> 1) ^ lfsr0) >> 8) ^ lfsr0) >> 5) & 0xff; + lfsr0 = lfsr0 & 0x1ffff | j << 17; + oLfsr0 = (((lfsr0 >> 3 ^ lfsr0) >> 1 ^ lfsr0) >> 8 ^ lfsr0) >> 5 & 0xff; if(oLfsr0 == lfsr1Lo) break; @@ -905,14 +815,14 @@ public class CSS for(combined = 0; combined < 8; combined++) { - if(((oLfsr1 + combined) * 2) + 8 - ((oLfsr1 + combined) & 7) != lfsr0) + if((oLfsr1 + combined) * 2 + 8 - (oLfsr1 + combined & 7) != lfsr0) continue; key[0] = (byte)(iTry >> 8); - key[1] = (byte)(iTry & 0xFF); - key[2] = (byte)(((oLfsr1 + combined) >> 0) & 0xFF); - key[3] = (byte)(((oLfsr1 + combined) >> 8) & 0xFF); - key[4] = (byte)(((oLfsr1 + combined) >> 16) & 0xFF); + key[1] = (byte)(iTry & 0xFF); + key[2] = (byte)(oLfsr1 + combined >> 0 & 0xFF); + key[3] = (byte)(oLfsr1 + combined >> 8 & 0xFF); + key[4] = (byte)(oLfsr1 + combined >> 16 & 0xFF); exit = (int)(iTry + 1); } } @@ -930,7 +840,7 @@ public class CSS } /// - /// Tries to find a title key by attacking CSS vulnerabilities. + /// Tries to find a title key by attacking CSS vulnerabilities. /// /// IOpticalMediaImage to find the title key in. /// Sector index to begin search. @@ -938,7 +848,7 @@ public class CSS /// The title key. static byte[] FindTitleKey(IOpticalMediaImage input, ulong startSector, ulong sectorsToSearch = 20000) { - byte[] titleKey = new byte[5]; + var titleKey = new byte[5]; for(ulong i = 0; i < sectorsToSearch; i++) { @@ -955,7 +865,7 @@ public class CSS } /// - /// Generates title keys for all sectors in a track. + /// Generates title keys for all sectors in a track. /// /// IOpticalMediaImage to generate keys for. /// List of Partition to analyze. @@ -963,9 +873,9 @@ public class CSS /// /// A byte array with keys for every sector in the track. One key is 5 bytes. public static byte[] GenerateTitleKeys(IOpticalMediaImage input, List partitions, ulong trackSectors, - Type pluginType) + Type pluginType) { - byte[] keys = new byte[trackSectors * 5]; + var keys = new byte[trackSectors * 5]; foreach(Partition partition in partitions) { @@ -1004,7 +914,7 @@ public class CSS } /// - /// DVD video discs always have a VIDEO_TS folder. If it doesn't have one, it's not a DVD video. + /// DVD video discs always have a VIDEO_TS folder. If it doesn't have one, it's not a DVD video. /// /// IOpticalMediaImage to check for VIDEO_TS folder in. /// IReadOnlyFilesystem to check in. diff --git a/DVD/Dump.cs b/DVD/Dump.cs index b84ed2b3a..01bd9cec2 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -70,14 +70,14 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReportKey; cdb[7] = (byte)keyClass; cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.Asf ^ ((Agid & 0x03) << 6)); + cdb[10] = (byte)((byte)CssReportKeyFormat.Asf ^ (Agid & 0x03) << 6); _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -98,14 +98,14 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReportKey; cdb[7] = (byte)keyClass; cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.RpcState ^ ((Agid & 0x03) << 6)); + cdb[10] = (byte)((byte)CssReportKeyFormat.RpcState ^ (Agid & 0x03) << 6); _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -126,14 +126,14 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = Array.Empty(); cdb[0] = (byte)ScsiCommands.ReportKey; cdb[7] = (byte)keyClass; cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.InvalidateAgid ^ ((Agid & 0x03) << 6)); + cdb[10] = (byte)((byte)CssReportKeyFormat.InvalidateAgid ^ (Agid & 0x03) << 6); _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -154,14 +154,14 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[8]; cdb[0] = (byte)ScsiCommands.ReportKey; cdb[7] = (byte)keyClass; cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.AgidForCssCppm ^ ((Agid & 0x03) << 6)); + cdb[10] = (byte)((byte)CssReportKeyFormat.AgidForCssCppm ^ (Agid & 0x03) << 6); _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -183,14 +183,14 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[12]; cdb[0] = (byte)ScsiCommands.ReportKey; cdb[7] = (byte)keyClass; cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.Key1 ^ ((Agid & 0x03) << 6)); + cdb[10] = (byte)((byte)CssReportKeyFormat.Key1 ^ (Agid & 0x03) << 6); _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -211,14 +211,14 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[16]; cdb[0] = (byte)ScsiCommands.ReportKey; cdb[7] = (byte)keyClass; cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.ChallengeKey ^ ((Agid & 0x03) << 6)); + cdb[10] = (byte)((byte)CssReportKeyFormat.ChallengeKey ^ (Agid & 0x03) << 6); _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); @@ -236,20 +236,20 @@ public sealed class Dump /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// true if the command failed and contains the sense buffer. - public bool SendChallenge(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, byte[] challengeKey, - uint timeout, out double duration) + public bool SendChallenge(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, byte[] challengeKey, + uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[16]; cdb[0] = (byte)ScsiCommands.SendKey; cdb[7] = (byte)keyClass; cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssSendKeyFormat.ChallengeKey ^ ((Agid & 0x03) << 6)); - buffer[0] = (byte)(((buffer.Length - 2) & 0xFF00) >> 8); - buffer[1] = (byte)((buffer.Length - 2) & 0xFF); + cdb[10] = (byte)((byte)CssSendKeyFormat.ChallengeKey ^ (Agid & 0x03) << 6); + buffer[0] = (byte)((buffer.Length - 2 & 0xFF00) >> 8); + buffer[1] = (byte)(buffer.Length - 2 & 0xFF); buffer[4] = challengeKey[9]; buffer[5] = challengeKey[8]; buffer[6] = challengeKey[7]; @@ -283,16 +283,16 @@ public sealed class Dump out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[12]; cdb[0] = (byte)ScsiCommands.SendKey; cdb[7] = (byte)keyClass; cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssSendKeyFormat.Key2 ^ ((Agid & 0x03) << 6)); - buffer[0] = (byte)(((buffer.Length - 2) & 0xFF00) >> 8); - buffer[1] = (byte)((buffer.Length - 2) & 0xFF); + cdb[10] = (byte)((byte)CssSendKeyFormat.Key2 ^ (Agid & 0x03) << 6); + buffer[0] = (byte)((buffer.Length - 2 & 0xFF00) >> 8); + buffer[1] = (byte)(buffer.Length - 2 & 0xFF); buffer[4] = key2[4]; buffer[5] = key2[3]; buffer[6] = key2[2]; @@ -318,7 +318,7 @@ public sealed class Dump public bool ReadDiscKey(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[2052]; cdb[0] = (byte)ScsiCommands.ReadDiscStructure; @@ -348,10 +348,10 @@ public sealed class Dump buffer = Array.Empty(); senseBuffer = new byte[64]; - bool sense = false; - byte[] challenge = new byte[CHALLENGE_SIZE]; - byte[] key1 = new byte[KEY_SIZE]; - byte variant = 0; + var sense = false; + var challenge = new byte[CHALLENGE_SIZE]; + var key1 = new byte[KEY_SIZE]; + byte variant = 0; for(byte i = 0; i < 4; i++) { @@ -368,7 +368,8 @@ public sealed class Dump out duration); break; - case CopyrightType.CPRM: throw new NotImplementedException(); + case CopyrightType.CPRM: + throw new NotImplementedException(); } if(sense) @@ -450,8 +451,8 @@ public sealed class Dump /// Timeout in seconds. /// Duration in milliseconds it took for the device to execute the command. /// true if the command failed and contains the sense buffer. - public bool ReadTitleKey(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, ulong address, - uint timeout, out double duration) + public bool ReadTitleKey(out byte[] buffer, out byte[] senseBuffer, DvdCssKeyClass keyClass, ulong address, + uint timeout, out double duration) { // We need to be in a bus key state to read title keys. Only CSS has title keys. ReadBusKey(out buffer, out senseBuffer, CopyrightType.CSS, timeout, out duration); @@ -459,7 +460,7 @@ public sealed class Dump BusKey = buffer; senseBuffer = new byte[64]; - byte[] cdb = new byte[12]; + var cdb = new byte[12]; buffer = new byte[12]; cdb[0] = (byte)ScsiCommands.ReportKey; @@ -470,7 +471,7 @@ public sealed class Dump cdb[7] = (byte)keyClass; cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[9] = (byte)(buffer.Length & 0xFF); - cdb[10] = (byte)((byte)CssReportKeyFormat.TitleKey ^ ((Agid & 0x03) << 6)); + cdb[10] = (byte)((byte)CssReportKeyFormat.TitleKey ^ (Agid & 0x03) << 6); _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); diff --git a/DVD/MPEG.cs b/DVD/MPEG.cs index 70df521e5..e3081d6ef 100644 --- a/DVD/MPEG.cs +++ b/DVD/MPEG.cs @@ -44,44 +44,107 @@ namespace Aaru.Decryption.DVD; public class MPEG { - static byte[] _mpeg2PackHeaderStartCode = - { - 0x0, 0x0, 0x1 - }; +#region Mpeg2StreamId enum public enum Mpeg2StreamId : byte { - ProgramEnd = 0xB9, PackHeader = 0xBA, SystemHeader = 0xBB, - ProgramStreamMap = 0xBC, PrivateStream1 = 0xBD, PaddingStream = 0xBE, - PrivateStream2 = 0xBF, EcmStream = 0xF0, EmmStream = 0xF1, - ItuTRecH222_0_or_IsoIec13818_1AnnexA_or_IsoIec13818_6DsmccStream = 0xF2, IsoIec13522Stream = 0xF3, - ItuTRecH222_1TypeA = 0xF4, ItuTRecH222_1TypeB = 0xF5, ItuTRecH222_1TypeC = 0xF6, - ItuTRecH222_1TypeD = 0xF7, ItuTRecH222_1TypeE = 0xF8, AncillaryStream = 0xF9, - Reserved1 = 0xFA, Reserved2 = 0xFB, Reserved3 = 0xFC, - Reserved4 = 0xFD, Reserved5 = 0xFE, ProgramStreamDirectory = 0xFF, + ProgramEnd = 0xB9, + PackHeader = 0xBA, + SystemHeader = 0xBB, + ProgramStreamMap = 0xBC, + PrivateStream1 = 0xBD, + PaddingStream = 0xBE, + PrivateStream2 = 0xBF, + EcmStream = 0xF0, + EmmStream = 0xF1, + ItuTRecH222_0_or_IsoIec13818_1AnnexA_or_IsoIec13818_6DsmccStream = 0xF2, + IsoIec13522Stream = 0xF3, + ItuTRecH222_1TypeA = 0xF4, + ItuTRecH222_1TypeB = 0xF5, + ItuTRecH222_1TypeC = 0xF6, + ItuTRecH222_1TypeD = 0xF7, + ItuTRecH222_1TypeE = 0xF8, + AncillaryStream = 0xF9, + Reserved1 = 0xFA, + Reserved2 = 0xFB, + Reserved3 = 0xFC, + Reserved4 = 0xFD, + Reserved5 = 0xFE, + ProgramStreamDirectory = 0xFF, // DVD Video can only hold 8 audio streams - MpegAudioStream1 = 0xC0, MpegAudioStream2 = 0xC1, MpegAudioStream3 = 0xC2, - MpegAudioStream4 = 0xC3, MpegAudioStream5 = 0xC4, MpegAudioStream6 = 0xC5, - MpegAudioStream7 = 0xC6, MpegAudioStream8 = 0xC7, MpegAudioStream9 = 0xC8, - MpegAudioStream10 = 0xC9, MpegAudioStream11 = 0xCA, MpegAudioStream12 = 0xCB, - MpegAudioStream13 = 0xCC, MpegAudioStream14 = 0xCD, MpegAudioStream15 = 0xCE, - MpegAudioStream16 = 0xCF, MpegAudioStream17 = 0xD0, MpegAudioStream18 = 0xD1, - MpegAudioStream19 = 0xD2, MpegAudioStream20 = 0xD3, MpegAudioStream21 = 0xD4, - MpegAudioStream22 = 0xD5, MpegAudioStream23 = 0xD6, MpegAudioStream24 = 0xD7, - MpegAudioStream25 = 0xD8, MpegAudioStream26 = 0xD9, MpegAudioStream27 = 0xDA, - MpegAudioStream28 = 0xDB, MpegAudioStream29 = 0xDC, MpegAudioStream30 = 0xDD, - MpegAudioStream31 = 0xDE, MpegAudioStream32 = 0xDF, + MpegAudioStream1 = 0xC0, + MpegAudioStream2 = 0xC1, + MpegAudioStream3 = 0xC2, + MpegAudioStream4 = 0xC3, + MpegAudioStream5 = 0xC4, + MpegAudioStream6 = 0xC5, + MpegAudioStream7 = 0xC6, + MpegAudioStream8 = 0xC7, + MpegAudioStream9 = 0xC8, + MpegAudioStream10 = 0xC9, + MpegAudioStream11 = 0xCA, + MpegAudioStream12 = 0xCB, + MpegAudioStream13 = 0xCC, + MpegAudioStream14 = 0xCD, + MpegAudioStream15 = 0xCE, + MpegAudioStream16 = 0xCF, + MpegAudioStream17 = 0xD0, + MpegAudioStream18 = 0xD1, + MpegAudioStream19 = 0xD2, + MpegAudioStream20 = 0xD3, + MpegAudioStream21 = 0xD4, + MpegAudioStream22 = 0xD5, + MpegAudioStream23 = 0xD6, + MpegAudioStream24 = 0xD7, + MpegAudioStream25 = 0xD8, + MpegAudioStream26 = 0xD9, + MpegAudioStream27 = 0xDA, + MpegAudioStream28 = 0xDB, + MpegAudioStream29 = 0xDC, + MpegAudioStream30 = 0xDD, + MpegAudioStream31 = 0xDE, + MpegAudioStream32 = 0xDF, // DVD Video can only hold 1 video stream - MpegVideStream1 = 0xE0, MpegVideStream2 = 0xE1, MpegVideStream3 = 0xE2, - MpegVideStream4 = 0xE3, MpegVideStream5 = 0xE4, MpegVideStream6 = 0xE5, - MpegVideStream7 = 0xE6, MpegVideStream8 = 0xE7, MpegVideStream9 = 0xE8, - MpegVideStream10 = 0xE9, MpegVideStream11 = 0xEA, MpegVideStream12 = 0xEB, - MpegVideStream13 = 0xEC, MpegVideStream14 = 0xED, MpegVideStream15 = 0xEE, + MpegVideStream1 = 0xE0, + MpegVideStream2 = 0xE1, + MpegVideStream3 = 0xE2, + MpegVideStream4 = 0xE3, + MpegVideStream5 = 0xE4, + MpegVideStream6 = 0xE5, + MpegVideStream7 = 0xE6, + MpegVideStream8 = 0xE7, + MpegVideStream9 = 0xE8, + MpegVideStream10 = 0xE9, + MpegVideStream11 = 0xEA, + MpegVideStream12 = 0xEB, + MpegVideStream13 = 0xEC, + MpegVideStream14 = 0xED, + MpegVideStream15 = 0xEE, MpegVideStream16 = 0xEF } +#endregion + + static readonly byte[] _mpeg2PackHeaderStartCode = { 0x0, 0x0, 0x1 }; + + public static bool ContainsMpegPackets(byte[] sectorData, uint blocks = 1, uint blockSize = 2048) + { + for(uint i = 0; i < blocks; i++) + { + if(IsMpegPacket(sectorData.Skip((int)(i * blockSize)))) + return true; + } + + return false; + } + + public static bool IsMpegPacket(IEnumerable sector) => + sector.Take(3).ToArray().SequenceEqual(_mpeg2PackHeaderStartCode); + +#region Nested type: MpegHeader + public struct MpegHeader { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] @@ -94,15 +157,5 @@ public class MPEG byte packStuffingLengthBlock; } - public static bool ContainsMpegPackets(byte[] sectorData, uint blocks = 1, uint blockSize = 2048) - { - for(uint i = 0; i < blocks; i++) - if(IsMpegPacket(sectorData.Skip((int)(i * blockSize)))) - return true; - - return false; - } - - public static bool IsMpegPacket(IEnumerable sector) => - sector.Take(3).ToArray().SequenceEqual(_mpeg2PackHeaderStartCode); +#endregion } \ No newline at end of file diff --git a/Enums.cs b/Enums.cs index dcf25baa0..ae59bb14f 100644 --- a/Enums.cs +++ b/Enums.cs @@ -2,10 +2,13 @@ namespace Aaru.Decryption; public enum DvdCssKeyClass : byte { - DvdCssCppmOrCprm = 0, RewritableSecurityServicesA = 1 + DvdCssCppmOrCprm = 0, + RewritableSecurityServicesA = 1 } public enum DvdCssKeyType { - Key1 = 0, Key2 = 1, BusKey = 2 + Key1 = 0, + Key2 = 1, + BusKey = 2 } \ No newline at end of file diff --git a/Localization/Localization.Designer.cs b/Localization/Localization.Designer.cs index 90bad9bd3..5c7744828 100644 --- a/Localization/Localization.Designer.cs +++ b/Localization/Localization.Designer.cs @@ -11,32 +11,46 @@ namespace Aaru.Decryption { using System; - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [System.Diagnostics.DebuggerNonUserCodeAttribute()] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Localization { - private static System.Resources.ResourceManager resourceMan; + private static global::System.Resources.ResourceManager resourceMan; - private static System.Globalization.CultureInfo resourceCulture; + private static global::System.Globalization.CultureInfo resourceCulture; - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Localization() { } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] - internal static System.Resources.ResourceManager ResourceManager { + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { get { - if (object.Equals(null, resourceMan)) { - System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Aaru.Decryption.Localization.Localization", typeof(Localization).Assembly); + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Aaru.Decryption.Localization.Localization", typeof(Localization).Assembly); resourceMan = temp; } return resourceMan; } } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] - internal static System.Globalization.CultureInfo Culture { + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -45,52 +59,76 @@ namespace Aaru.Decryption { } } - internal static string REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms { + /// + /// Looks up a localized string similar to GET TITLE KEY (AGID: {1}, LBA: {2}, Sense: {3}) took {0} ms.. + /// + internal static string GET_TITLE_KEY_AGID_1_LBA_2_Sense_3_took_0_ms { get { - return ResourceManager.GetString("REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); + return ResourceManager.GetString("GET_TITLE_KEY_AGID_1_LBA_2_Sense_3_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to INVALIDATE AGID (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.. + /// internal static string INVALIDATE_AGID_AGID_1_Sense_2_Last_Error_3_took_0_ms { get { return ResourceManager.GetString("INVALIDATE_AGID_AGID_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to REPORT AGID CSS/CPPM (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.. + /// internal static string REPORT_AGID_CSS_CPPM_AGID_1_Sense_2_Last_Error_3_took_0_ms { get { return ResourceManager.GetString("REPORT_AGID_CSS_CPPM_AGID_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); } } - internal static string REPORT_KEY1_AGID_1_Sense_2_Last_Error_3_took_0_ms { + /// + /// Looks up a localized string similar to REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.. + /// + internal static string REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms { get { - return ResourceManager.GetString("REPORT_KEY1_AGID_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); + return ResourceManager.GetString("REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to REPORT CHALLENGE (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.. + /// internal static string REPORT_CHALLENGE_AGID_1_Sense_2_Last_Error_3_took_0_ms { get { return ResourceManager.GetString("REPORT_CHALLENGE_AGID_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to REPORT KEY1 (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms.. + /// + internal static string REPORT_KEY1_AGID_1_Sense_2_Last_Error_3_took_0_ms { + get { + return ResourceManager.GetString("REPORT_KEY1_AGID_1_Sense_2_Last_Error_3_took_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SEND CHALLENGE (AGID: {1}, Challenge {2}, Sense: {3}, Last Error: {4}) took {0} ms.. + /// internal static string SEND_CHALLENGE_AGID_1_Challenge_2_Sense_3_Last_Error_4_took_0_ms { get { return ResourceManager.GetString("SEND_CHALLENGE_AGID_1_Challenge_2_Sense_3_Last_Error_4_took_0_ms", resourceCulture); } } + /// + /// Looks up a localized string similar to SEND CHALLENGE (AGID: {1}, KEY2 {2}, Sense: {3}, Last Error: {4}) took {0} ms.. + /// internal static string SEND_CHALLENGE_AGID_1_KEY2_2_Sense_3_Last_Error_4_took_0_ms { get { return ResourceManager.GetString("SEND_CHALLENGE_AGID_1_KEY2_2_Sense_3_Last_Error_4_took_0_ms", resourceCulture); } } - - internal static string GET_TITLE_KEY_AGID_1_LBA_2_Sense_3_took_0_ms { - get { - return ResourceManager.GetString("GET_TITLE_KEY_AGID_1_LBA_2_Sense_3_took_0_ms", resourceCulture); - } - } } } diff --git a/Localization/Localization.es.resx b/Localization/Localization.es.resx index 52afa7b9b..6905f0a28 100644 --- a/Localization/Localization.es.resx +++ b/Localization/Localization.es.resx @@ -1,39 +1,43 @@ - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + GET TITLE KEY (AGID: {1}, LBA: {2}, Sense: {3}) tardó {0} ms. - + INVALIDATE AGID (AGID: {1}, Sense: {2}, Error: {3}) tardó {0} ms. - + REPORT AGID CSS/CPPM (AGID: {1}, Sense: {2}, Error: {3}) tardó {0} ms. - + REPORT ASF (AGID: {1}, Sense: {2}, Error: {3}) tardó {0} ms. - + REPORT CHALLENGE (AGID: {1}, Sense: {2}, Error: {3}) tardó {0} ms. - + REPORT KEY1 (AGID: {1}, Sense: {2}, Error: {3}) tardó {0} ms. - + SEND CHALLENGE (AGID: {1}, Desafío {2}, Sense: {3}, Error: {4}) tardó {0} ms. - + SEND CHALLENGE (AGID: {1}, KEY2 {2}, Sense: {3}, Error: {4}) tardó {0} ms. \ No newline at end of file diff --git a/Localization/Localization.resx b/Localization/Localization.resx index 32dc9b77d..6df08245a 100644 --- a/Localization/Localization.resx +++ b/Localization/Localization.resx @@ -1,48 +1,50 @@ - - - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, - PublicKeyToken=b77a5c561934e089 - - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, - PublicKeyToken=b77a5c561934e089 - - - + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + REPORT ASF (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms. - + INVALIDATE AGID (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms. - + REPORT AGID CSS/CPPM (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms. - + REPORT KEY1 (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms. - + REPORT CHALLENGE (AGID: {1}, Sense: {2}, Last Error: {3}) took {0} ms. - + SEND CHALLENGE (AGID: {1}, Challenge {2}, Sense: {3}, Last Error: {4}) took {0} ms. - + SEND CHALLENGE (AGID: {1}, KEY2 {2}, Sense: {3}, Last Error: {4}) took {0} ms. - + GET TITLE KEY (AGID: {1}, LBA: {2}, Sense: {3}) took {0} ms. \ No newline at end of file From 9f529da3c6527de8363b55e21f99cd504c2f2e1b Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 4 Oct 2023 08:29:55 +0100 Subject: [PATCH 45/53] Convert into primary constructor. --- DVD/Dump.cs | 58 +++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/DVD/Dump.cs b/DVD/Dump.cs index 01bd9cec2..3a1b8b039 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -42,22 +42,14 @@ using Aaru.Devices; namespace Aaru.Decryption.DVD; -public sealed class Dump +public sealed class Dump(Device dev) { - const byte KEY_SIZE = 5; - const byte CHALLENGE_SIZE = 2 * KEY_SIZE; - const string MODULE_NAME = "DVD decryption"; - readonly Device _dev; - - public Dump(Device dev) - { - _dev = dev; - BusKey = Array.Empty(); - Agid = 0; - } + const byte KEY_SIZE = 5; + const byte CHALLENGE_SIZE = 2 * KEY_SIZE; + const string MODULE_NAME = "DVD decryption"; public byte Agid { get; private set; } - public byte[] BusKey { get; private set; } + public byte[] BusKey { get; private set; } = Array.Empty(); /// Returns the Authentication Success Flag of the logical unit. /// true if the command failed and contains the sense buffer. @@ -79,10 +71,10 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.Asf ^ (Agid & 0x03) << 6); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms, - duration, Agid, sense, _dev.LastError); + duration, Agid, sense, dev.LastError); return sense; } @@ -107,10 +99,10 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.RpcState ^ (Agid & 0x03) << 6); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms, - duration, Agid, sense, _dev.LastError); + duration, Agid, sense, dev.LastError); return sense; } @@ -135,10 +127,10 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.InvalidateAgid ^ (Agid & 0x03) << 6); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.INVALIDATE_AGID_AGID_1_Sense_2_Last_Error_3_took_0_ms, - duration, Agid, sense, _dev.LastError); + duration, Agid, sense, dev.LastError); return sense; } @@ -163,11 +155,11 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.AgidForCssCppm ^ (Agid & 0x03) << 6); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_AGID_CSS_CPPM_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, - Agid, sense, _dev.LastError); + Agid, sense, dev.LastError); return sense; } @@ -192,10 +184,10 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.Key1 ^ (Agid & 0x03) << 6); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_KEY1_AGID_1_Sense_2_Last_Error_3_took_0_ms, - duration, Agid, sense, _dev.LastError); + duration, Agid, sense, dev.LastError); return sense; } @@ -220,10 +212,10 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.ChallengeKey ^ (Agid & 0x03) << 6); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_CHALLENGE_AGID_1_Sense_2_Last_Error_3_took_0_ms, - duration, Agid, sense, _dev.LastError); + duration, Agid, sense, dev.LastError); return sense; } @@ -261,12 +253,12 @@ public sealed class Dump buffer[12] = challengeKey[1]; buffer[13] = challengeKey[0]; - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, - out bool sense); + dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, + out bool sense); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.SEND_CHALLENGE_AGID_1_Challenge_2_Sense_3_Last_Error_4_took_0_ms, - duration, Agid, challengeKey, sense, _dev.LastError); + duration, Agid, challengeKey, sense, dev.LastError); return sense; } @@ -299,12 +291,12 @@ public sealed class Dump buffer[7] = key2[1]; buffer[8] = key2[0]; - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, - out bool sense); + dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, + out bool sense); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.SEND_CHALLENGE_AGID_1_KEY2_2_Sense_3_Last_Error_4_took_0_ms, duration, - Agid, key2, sense, _dev.LastError); + Agid, key2, sense, dev.LastError); return sense; } @@ -329,7 +321,7 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((Agid & 0x03) << 6); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); return sense; } @@ -473,7 +465,7 @@ public sealed class Dump cdb[9] = (byte)(buffer.Length & 0xFF); cdb[10] = (byte)((byte)CssReportKeyFormat.TitleKey ^ (Agid & 0x03) << 6); - _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.GET_TITLE_KEY_AGID_1_LBA_2_Sense_3_took_0_ms, duration, Agid, address, sense); From 7786e94ee52c8f65802f1fc071db994ab1b88c60 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 4 Oct 2023 17:34:34 +0100 Subject: [PATCH 46/53] Redo Reformat and cleanup. Rider EAP was having a bug interpreting .editorconfig that didn't generate the code style as we wanted. This is now done with Rider-stable. --- .editorconfig | 6 +- DVD/CSS.cs | 157 ++++++++++++++++++++++++++++++++++++++------------ DVD/Dump.cs | 19 +++--- DVD/MPEG.cs | 5 +- 4 files changed, 138 insertions(+), 49 deletions(-) diff --git a/.editorconfig b/.editorconfig index 71a05170a..103a5d927 100644 --- a/.editorconfig +++ b/.editorconfig @@ -83,7 +83,7 @@ resharper_braces_for_ifelse resharper_braces_for_while = required_for_multiline resharper_builtin_type_apply_to_native_integer = false resharper_constructor_or_destructor_body = expression_body -resharper_csharp_align_first_arg_by_paren = false +resharper_csharp_align_first_arg_by_paren = true resharper_csharp_empty_block_style = together_same_line resharper_csharp_place_comments_at_first_column = true resharper_csharp_prefer_qualified_reference = false @@ -108,6 +108,7 @@ resharper_int_align_enum_initializers resharper_int_align_eq = true resharper_keep_existing_embedded_arrangement = false resharper_keep_existing_initializer_arrangement = false +resharper_keep_existing_linebreaks = false resharper_keep_existing_list_patterns_arrangement = false resharper_keep_existing_property_patterns_arrangement = false resharper_keep_existing_switch_expression_arrangement = false @@ -125,6 +126,7 @@ resharper_outdent_statement_labels resharper_parentheses_redundancy_style = remove resharper_place_attribute_on_same_line = false resharper_place_simple_embedded_statement_on_same_line = false +resharper_place_simple_initializer_on_single_line = false resharper_qualified_using_at_nested_scope = true resharper_show_autodetect_configure_formatting_tip = false resharper_simple_block_style = on_single_line @@ -146,6 +148,8 @@ resharper_use_indent_from_vs resharper_wrap_after_dot_in_method_calls = true resharper_wrap_base_clause_style = chop_if_long resharper_wrap_braced_init_list_style = chop_if_long +resharper_wrap_chained_binary_expressions = chop_if_long +resharper_wrap_chained_method_calls = chop_if_long resharper_wrap_ctor_initializer_style = chop_if_long resharper_wrap_lines = true resharper_xmldoc_attribute_indent = align_by_first_attribute diff --git a/DVD/CSS.cs b/DVD/CSS.cs index 08f84c18c..787eb9c56 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -58,17 +58,99 @@ public class CSS { static readonly byte[,] _playerKeys = { - { 0x01, 0xaf, 0xe3, 0x12, 0x80 }, { 0x12, 0x11, 0xca, 0x04, 0x3b }, { 0x14, 0x0c, 0x9e, 0xd0, 0x09 }, - { 0x14, 0x71, 0x35, 0xba, 0xe2 }, { 0x1a, 0xa4, 0x33, 0x21, 0xa6 }, { 0x26, 0xec, 0xc4, 0xa7, 0x4e }, - { 0x2c, 0xb2, 0xc1, 0x09, 0xee }, { 0x2f, 0x25, 0x9e, 0x96, 0xdd }, { 0x33, 0x2f, 0x49, 0x6c, 0xe0 }, - { 0x35, 0x5b, 0xc1, 0x31, 0x0f }, { 0x36, 0x67, 0xb2, 0xe3, 0x85 }, { 0x39, 0x3d, 0xf1, 0xf1, 0xbd }, - { 0x3b, 0x31, 0x34, 0x0d, 0x91 }, { 0x45, 0xed, 0x28, 0xeb, 0xd3 }, { 0x48, 0xb7, 0x6c, 0xce, 0x69 }, - { 0x4b, 0x65, 0x0d, 0xc1, 0xee }, { 0x4c, 0xbb, 0xf5, 0x5b, 0x23 }, { 0x51, 0x67, 0x67, 0xc5, 0xe0 }, - { 0x53, 0x94, 0xe1, 0x75, 0xbf }, { 0x57, 0x2c, 0x8b, 0x31, 0xae }, { 0x63, 0xdb, 0x4c, 0x5b, 0x4a }, - { 0x7b, 0x1e, 0x5e, 0x2b, 0x57 }, { 0x85, 0xf3, 0x85, 0xa0, 0xe0 }, { 0xab, 0x1e, 0xe7, 0x7b, 0x72 }, - { 0xab, 0x36, 0xe3, 0xeb, 0x76 }, { 0xb1, 0xb8, 0xf9, 0x38, 0x03 }, { 0xb8, 0x5d, 0xd8, 0x53, 0xbd }, - { 0xbf, 0x92, 0xc3, 0xb0, 0xe2 }, { 0xcf, 0x1a, 0xb2, 0xf8, 0x0a }, { 0xec, 0xa0, 0xcf, 0xb3, 0xff }, - { 0xfc, 0x95, 0xa9, 0x87, 0x35 } + { + 0x01, 0xaf, 0xe3, 0x12, 0x80 + }, + { + 0x12, 0x11, 0xca, 0x04, 0x3b + }, + { + 0x14, 0x0c, 0x9e, 0xd0, 0x09 + }, + { + 0x14, 0x71, 0x35, 0xba, 0xe2 + }, + { + 0x1a, 0xa4, 0x33, 0x21, 0xa6 + }, + { + 0x26, 0xec, 0xc4, 0xa7, 0x4e + }, + { + 0x2c, 0xb2, 0xc1, 0x09, 0xee + }, + { + 0x2f, 0x25, 0x9e, 0x96, 0xdd + }, + { + 0x33, 0x2f, 0x49, 0x6c, 0xe0 + }, + { + 0x35, 0x5b, 0xc1, 0x31, 0x0f + }, + { + 0x36, 0x67, 0xb2, 0xe3, 0x85 + }, + { + 0x39, 0x3d, 0xf1, 0xf1, 0xbd + }, + { + 0x3b, 0x31, 0x34, 0x0d, 0x91 + }, + { + 0x45, 0xed, 0x28, 0xeb, 0xd3 + }, + { + 0x48, 0xb7, 0x6c, 0xce, 0x69 + }, + { + 0x4b, 0x65, 0x0d, 0xc1, 0xee + }, + { + 0x4c, 0xbb, 0xf5, 0x5b, 0x23 + }, + { + 0x51, 0x67, 0x67, 0xc5, 0xe0 + }, + { + 0x53, 0x94, 0xe1, 0x75, 0xbf + }, + { + 0x57, 0x2c, 0x8b, 0x31, 0xae + }, + { + 0x63, 0xdb, 0x4c, 0x5b, 0x4a + }, + { + 0x7b, 0x1e, 0x5e, 0x2b, 0x57 + }, + { + 0x85, 0xf3, 0x85, 0xa0, 0xe0 + }, + { + 0xab, 0x1e, 0xe7, 0x7b, 0x72 + }, + { + 0xab, 0x36, 0xe3, 0xeb, 0x76 + }, + { + 0xb1, 0xb8, 0xf9, 0x38, 0x03 + }, + { + 0xb8, 0x5d, 0xd8, 0x53, 0xbd + }, + { + 0xbf, 0x92, 0xc3, 0xb0, 0xe2 + }, + { + 0xcf, 0x1a, 0xb2, 0xf8, 0x0a + }, + { + 0xec, 0xa0, 0xcf, 0xb3, 0xff + }, + { + 0xfc, 0x95, 0xa9, 0x87, 0x35 + } }; static readonly byte[] _cssTable1 = @@ -259,7 +341,15 @@ public class CSS static readonly byte[,] _permutationChallenge = { - { 1, 3, 0, 7, 5, 2, 9, 6, 4, 8 }, { 6, 1, 9, 3, 8, 5, 7, 4, 0, 2 }, { 4, 0, 3, 5, 7, 2, 8, 6, 1, 9 } + { + 1, 3, 0, 7, 5, 2, 9, 6, 4, 8 + }, + { + 6, 1, 9, 3, 8, 5, 7, 4, 0, 2 + }, + { + 4, 0, 3, 5, 7, 2, 8, 6, 1, 9 + } }; static readonly byte[,] _permutationVariant = @@ -280,7 +370,10 @@ public class CSS 0xF2, 0x2A, 0x79, 0x52, 0xFF, 0x1B, 0x7A, 0x11, 0xCA, 0x1A, 0x9B, 0x40, 0xAD, 0x01 }; - static readonly byte[] _secret = { 0x55, 0xD6, 0xC4, 0xC5, 0x28 }; + static readonly byte[] _secret = + { + 0x55, 0xD6, 0xC4, 0xC5, 0x28 + }; /// /// The disc key returned by the logical unit is encoded with the bus key to prevent man-in-the-middle attacks. @@ -291,8 +384,7 @@ public class CSS /// A DiscKey struct with the decoded key. public static CSS_CPRM.DiscKey? DecodeDiscKey(byte[] response, byte[] busKey) { - if(response.Length != 2052 || - busKey.Length != 5) + if(response.Length != 2052 || busKey.Length != 5) return null; byte[] key = response.Skip(4).Take(2048).ToArray(); @@ -318,8 +410,7 @@ public class CSS /// A TitleKey struct with the decoded key. public static CSS_CPRM.TitleKey? DecodeTitleKey(byte[] response, byte[] busKey) { - if(response.Length != 12 || - busKey.Length != 5) + if(response.Length != 12 || busKey.Length != 5) return null; byte[] key = response.Skip(5).Take(5).ToArray(); @@ -468,11 +559,12 @@ public class CSS var lfsr1Lo = (uint)(cryptoKey[0] | 0x100); uint lfsr1Hi = cryptoKey[1]; - var lfsr0 = (uint)((cryptoKey[4] << 17 | cryptoKey[3] << 9 | cryptoKey[2] << 1) + 8 - - (cryptoKey[2] & 7)); + var lfsr0 = (uint)((cryptoKey[4] << 17 | cryptoKey[3] << 9 | cryptoKey[2] << 1) + 8 - (cryptoKey[2] & 7)); - lfsr0 = (uint)(_cssTable4[lfsr0 & 0xff] << 24 | _cssTable4[lfsr0 >> 8 & 0xff] << 16 | - _cssTable4[lfsr0 >> 16 & 0xff] << 8 | _cssTable4[lfsr0 >> 24 & 0xff]); + lfsr0 = (uint)(_cssTable4[lfsr0 & 0xff] << 24 | + _cssTable4[lfsr0 >> 8 & 0xff] << 16 | + _cssTable4[lfsr0 >> 16 & 0xff] << 8 | + _cssTable4[lfsr0 >> 24 & 0xff]); uint combined = 0; @@ -515,8 +607,8 @@ public class CSS for(uint n = 0; n < _playerKeys.GetLength(0); n++) { - byte[] currentPlayerKey = Enumerable.Range(0, _playerKeys.GetLength(1)).Select(x => _playerKeys[n, x]). - ToArray(); + byte[] currentPlayerKey = + Enumerable.Range(0, _playerKeys.GetLength(1)).Select(x => _playerKeys[n, x]).ToArray(); for(uint i = 1; i < 409; i++) { @@ -546,8 +638,7 @@ public class CSS uint blockSize = 2048) { // None of the sectors are encrypted - if(cmiData != null && cmiData.All(static cmi => (cmi & 0x80) >> 7 == 0) || - keyData.All(static k => k == 0)) + if(cmiData != null && cmiData.All(static cmi => (cmi & 0x80) >> 7 == 0) || keyData.All(static k => k == 0)) return sectorData; var decryptedBuffer = new byte[sectorData.Length]; @@ -582,8 +673,7 @@ public class CSS long lfsr1Lo = key[0] ^ sector[0x54] | 0x100; long lfsr1Hi = key[1] ^ sector[0x55]; - long lfsr0 = (key[2] | key[3] << 8 | key[4] << 16) ^ - (sector[0x56] | sector[0x57] << 8 | sector[0x58] << 16); + long lfsr0 = (key[2] | key[3] << 8 | key[4] << 16) ^ (sector[0x56] | sector[0x57] << 8 | sector[0x58] << 16); long oLfsr1 = lfsr0 & 7; lfsr0 = lfsr0 * 2 + 8 - oLfsr1; @@ -635,13 +725,11 @@ public class CSS return false; // The CMI tells us the sector is not encrypted. - if(cmi != null && - (cmi & 0x80) >> 7 == 0) + if(cmi != null && (cmi & 0x80) >> 7 == 0) return false; // We have the key but it's all zeroes, so sector is unencrypted. - if(key != null && - key.All(static k => k == 0)) + if(key != null && key.All(static k => k == 0)) return false; // These packet types cannot be encrypted @@ -703,9 +791,7 @@ public class CSS } // If we found an adequate pattern. - if(bestPattern <= 0 || - bestPatternLength <= 3 || - bestPatternLength / bestPattern < 2) + if(bestPattern <= 0 || bestPatternLength <= 3 || bestPatternLength / bestPattern < 2) return false; var offset = (int)(0x80 - bestPatternLength / bestPattern * bestPattern); @@ -890,8 +976,7 @@ public class CSS if(fs.OpenDir("VIDEO_TS", out IDirNode node) == ErrorNumber.NoError) { - while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError && - entry is not null) + while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError && entry is not null) { if(!entry.ToLower().EndsWith(".vob")) continue; diff --git a/DVD/Dump.cs b/DVD/Dump.cs index 3a1b8b039..a68c25f53 100644 --- a/DVD/Dump.cs +++ b/DVD/Dump.cs @@ -73,8 +73,8 @@ public sealed class Dump(Device dev) dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms, - duration, Agid, sense, dev.LastError); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, + Agid, sense, dev.LastError); return sense; } @@ -101,8 +101,8 @@ public sealed class Dump(Device dev) dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms, - duration, Agid, sense, dev.LastError); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_ASF_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, + Agid, sense, dev.LastError); return sense; } @@ -157,9 +157,8 @@ public sealed class Dump(Device dev) dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); - AaruConsole.DebugWriteLine(MODULE_NAME, - Localization.REPORT_AGID_CSS_CPPM_AGID_1_Sense_2_Last_Error_3_took_0_ms, duration, - Agid, sense, dev.LastError); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.REPORT_AGID_CSS_CPPM_AGID_1_Sense_2_Last_Error_3_took_0_ms, + duration, Agid, sense, dev.LastError); return sense; } @@ -253,8 +252,7 @@ public sealed class Dump(Device dev) buffer[12] = challengeKey[1]; buffer[13] = challengeKey[0]; - dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, - out bool sense); + dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out bool sense); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.SEND_CHALLENGE_AGID_1_Challenge_2_Sense_3_Last_Error_4_took_0_ms, @@ -291,8 +289,7 @@ public sealed class Dump(Device dev) buffer[7] = key2[1]; buffer[8] = key2[0]; - dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, - out bool sense); + dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration, out bool sense); AaruConsole.DebugWriteLine(MODULE_NAME, Localization.SEND_CHALLENGE_AGID_1_KEY2_2_Sense_3_Last_Error_4_took_0_ms, duration, diff --git a/DVD/MPEG.cs b/DVD/MPEG.cs index e3081d6ef..cceac4d2f 100644 --- a/DVD/MPEG.cs +++ b/DVD/MPEG.cs @@ -127,7 +127,10 @@ public class MPEG #endregion - static readonly byte[] _mpeg2PackHeaderStartCode = { 0x0, 0x0, 0x1 }; + static readonly byte[] _mpeg2PackHeaderStartCode = + { + 0x0, 0x0, 0x1 + }; public static bool ContainsMpegPackets(byte[] sectorData, uint blocks = 1, uint blockSize = 2048) { From a85f1ce494f35c23da7feba989c20ac1d45374de Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 5 Oct 2023 01:05:18 +0100 Subject: [PATCH 47/53] Annotate or remove unused elements. --- DVD/MPEG.cs | 4 ++++ Enums.cs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/DVD/MPEG.cs b/DVD/MPEG.cs index cceac4d2f..165002615 100644 --- a/DVD/MPEG.cs +++ b/DVD/MPEG.cs @@ -37,11 +37,15 @@ // http://www.mpucoder.com/DVD/vobov.html using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Runtime.InteropServices; +// ReSharper disable UnusedMember.Global + namespace Aaru.Decryption.DVD; +[SuppressMessage("ReSharper", "UnusedType.Global")] public class MPEG { #region Mpeg2StreamId enum diff --git a/Enums.cs b/Enums.cs index ae59bb14f..b3684dd58 100644 --- a/Enums.cs +++ b/Enums.cs @@ -1,3 +1,5 @@ +// ReSharper disable UnusedMember.Global + namespace Aaru.Decryption; public enum DvdCssKeyClass : byte From 39d11a44ca956bbcd168d69bf9734c9e598d0224 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 5 Oct 2023 01:52:47 +0100 Subject: [PATCH 48/53] Fix naming. --- DVD/CSS.cs | 8 ++++---- DVD/MPEG.cs | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/DVD/CSS.cs b/DVD/CSS.cs index 787eb9c56..fd0204818 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -721,7 +721,7 @@ public class CSS static bool IsEncrypted(byte? cmi, byte[]? key, IReadOnlyList sector) { // Only MPEG packets can be encrypted. - if(!MPEG.IsMpegPacket(sector)) + if(!Mpeg.IsMpegPacket(sector)) return false; // The CMI tells us the sector is not encrypted. @@ -733,9 +733,9 @@ public class CSS return false; // These packet types cannot be encrypted - if(sector[17] == (byte)MPEG.Mpeg2StreamId.SystemHeader || - sector[17] == (byte)MPEG.Mpeg2StreamId.PaddingStream || - sector[17] == (byte)MPEG.Mpeg2StreamId.PrivateStream2) + if(sector[17] == (byte)Mpeg.Mpeg2StreamId.SystemHeader || + sector[17] == (byte)Mpeg.Mpeg2StreamId.PaddingStream || + sector[17] == (byte)Mpeg.Mpeg2StreamId.PrivateStream2) return false; // MPEG Packetized Elementary Stream scrambling control value diff --git a/DVD/MPEG.cs b/DVD/MPEG.cs index 165002615..42320dd5b 100644 --- a/DVD/MPEG.cs +++ b/DVD/MPEG.cs @@ -46,7 +46,7 @@ using System.Runtime.InteropServices; namespace Aaru.Decryption.DVD; [SuppressMessage("ReSharper", "UnusedType.Global")] -public class MPEG +public class Mpeg { #region Mpeg2StreamId enum @@ -61,7 +61,7 @@ public class MPEG PrivateStream2 = 0xBF, EcmStream = 0xF0, EmmStream = 0xF1, - ItuTRecH222_0_or_IsoIec13818_1AnnexA_or_IsoIec13818_6DsmccStream = 0xF2, + ItuTRecH222_0_Or_IsoIec13818_1AnnexA_Or_IsoIec13818_6DsmccStream = 0xF2, IsoIec13522Stream = 0xF3, ItuTRecH222_1TypeA = 0xF4, ItuTRecH222_1TypeB = 0xF5, @@ -155,13 +155,13 @@ public class MPEG public struct MpegHeader { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] startCode; - public byte packIdentifier; + public byte[] StartCode; + public byte PackIdentifier; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] scrBlock; + public byte[] SCRBlock; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] programMuxRateBlock; - byte packStuffingLengthBlock; + public byte[] ProgramMuxRateBlock; + byte _packStuffingLengthBlock; } #endregion From 24557e80cdea503617d32d7d895ba040a443cf7b Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 5 Oct 2023 02:37:03 +0100 Subject: [PATCH 49/53] Move declarations closer to usage. --- DVD/CSS.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DVD/CSS.cs b/DVD/CSS.cs index fd0204818..8a3cd2f5b 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -817,8 +817,6 @@ public class CSS out byte[] key) { var buffer = new byte[10]; - long oLfsr1; - long oLfsr0; long iTry; uint i; int exit = -1; @@ -835,6 +833,8 @@ public class CSS long combined = 0; // Iterate cipher 4 times to reconstruct LFSR2 + long oLfsr1; + long oLfsr0; for(i = 0; i < 4; i++) { // Advance LFSR1 normally From 7fd2a0fc739ac72bae3f6cf75d210dbfb51b8236 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 5 Oct 2023 02:52:06 +0100 Subject: [PATCH 50/53] Use `string.EndsWith(string, StringComparison`. --- DVD/CSS.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DVD/CSS.cs b/DVD/CSS.cs index 8a3cd2f5b..e9acc5884 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -978,7 +978,7 @@ public class CSS { while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError && entry is not null) { - if(!entry.ToLower().EndsWith(".vob")) + if(!entry.EndsWith(".vob", StringComparison.InvariantCultureIgnoreCase)) continue; fs.Stat("VIDEO_TS" + "/" + entry, out FileEntryInfo stat); From 605e00ed85de6a875ff930b039565460ba43c7df Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 5 Oct 2023 16:55:03 +0100 Subject: [PATCH 51/53] [Plugin system] Move read-only filesystems to dependency injection. --- DVD/CSS.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DVD/CSS.cs b/DVD/CSS.cs index e9acc5884..8af8d156b 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -956,16 +956,16 @@ public class CSS /// IOpticalMediaImage to generate keys for. /// List of Partition to analyze. /// Total number of sectors for track. - /// + /// /// A byte array with keys for every sector in the track. One key is 5 bytes. - public static byte[] GenerateTitleKeys(IOpticalMediaImage input, List partitions, ulong trackSectors, - Type pluginType) + public static byte[] GenerateTitleKeys(IOpticalMediaImage input, List partitions, ulong trackSectors, + IReadOnlyFilesystem fs) { var keys = new byte[trackSectors * 5]; foreach(Partition partition in partitions) { - if(Activator.CreateInstance(pluginType) is not IReadOnlyFilesystem fs) + if(fs is null) continue; if(!HasVideoTsFolder(input, fs, partition)) From 3aa48889dd89ef22d346328bda8e23668dcd196a Mon Sep 17 00:00:00 2001 From: Rebecca Wallander Date: Sun, 15 Oct 2023 22:21:09 +0200 Subject: [PATCH 52/53] Add DecryptSectorLong for CSS --- DVD/CSS.cs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/DVD/CSS.cs b/DVD/CSS.cs index 8af8d156b..56869fb0d 100644 --- a/DVD/CSS.cs +++ b/DVD/CSS.cs @@ -662,6 +662,46 @@ public class CSS return decryptedBuffer; } + /// Takes a sector and a decrypted title key and returns the decrypted sector. + /// Encrypted sector data. + /// The Copyright Management Information. + /// The encryption keys. + /// Number of sectors in sectorData. + /// Size of one sector. + /// The decrypted sector. + public static byte[] DecryptSectorLong(byte[] sectorData, byte[] keyData, byte[]? cmiData, uint blocks = 1, + uint blockSize = 2048) + { + // None of the sectors are encrypted + if(cmiData != null && cmiData.All(static cmi => (cmi & 0x80) >> 7 == 0) || keyData.All(static k => k == 0)) + return sectorData; + + var decryptedBuffer = new byte[sectorData.Length]; + + for(uint i = 0; i < blocks; i++) + { + byte[] currentKey = keyData.Skip((int)(i * 5)).Take(5).ToArray(); + byte[] currentPrefix = sectorData.Skip((int)(i * 2064)).Take(12).ToArray(); + byte[] currentSuffix = sectorData.Skip((int)(2060 + i * 2064)).Take(4).ToArray(); + byte[] currentSector = sectorData.Skip((int)(12 + i * blockSize + (16 * i))).Take((int)blockSize).ToArray(); + + Array.Copy(currentPrefix, 0, decryptedBuffer, (int)(i * 2064), 12); + Array.Copy(currentSuffix, 0, decryptedBuffer, (int)(2060 + i * 2064), 4); + + if(!IsEncrypted(cmiData?[i], currentKey, currentSector)) + { + Array.Copy(currentSector, 0, decryptedBuffer, (int)(12 + i * blockSize + (16 * i)), blockSize); + + continue; + } + + Array.Copy(UnscrambleSector(currentKey, currentSector), 0, decryptedBuffer, + (int)(12 + i * blockSize + (16 * i)), blockSize); + } + + return decryptedBuffer; + } + /// /// Unscrambles a DVD sector with a title key. /// From 8a16d6ee9984219694d6c77c2981c31f32e9cb55 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 19 Dec 2023 13:42:38 +0000 Subject: [PATCH 53/53] Move all files into project subdirectory --- .editorconfig => Aaru.Decryption/.editorconfig | 0 .gitignore => Aaru.Decryption/.gitignore | 0 Aaru.Decryption.csproj => Aaru.Decryption/Aaru.Decryption.csproj | 0 .../Aaru.Decryption.csproj.DotSettings | 0 {DVD => Aaru.Decryption/DVD}/CSS.cs | 0 {DVD => Aaru.Decryption/DVD}/Dump.cs | 0 {DVD => Aaru.Decryption/DVD}/MPEG.cs | 0 Enums.cs => Aaru.Decryption/Enums.cs | 0 LICENSE => Aaru.Decryption/LICENSE | 0 .../Localization}/Localization.Designer.cs | 0 .../Localization}/Localization.es.resx | 0 {Localization => Aaru.Decryption/Localization}/Localization.resx | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename .editorconfig => Aaru.Decryption/.editorconfig (100%) rename .gitignore => Aaru.Decryption/.gitignore (100%) rename Aaru.Decryption.csproj => Aaru.Decryption/Aaru.Decryption.csproj (100%) rename Aaru.Decryption.csproj.DotSettings => Aaru.Decryption/Aaru.Decryption.csproj.DotSettings (100%) rename {DVD => Aaru.Decryption/DVD}/CSS.cs (100%) rename {DVD => Aaru.Decryption/DVD}/Dump.cs (100%) rename {DVD => Aaru.Decryption/DVD}/MPEG.cs (100%) rename Enums.cs => Aaru.Decryption/Enums.cs (100%) rename LICENSE => Aaru.Decryption/LICENSE (100%) rename {Localization => Aaru.Decryption/Localization}/Localization.Designer.cs (100%) rename {Localization => Aaru.Decryption/Localization}/Localization.es.resx (100%) rename {Localization => Aaru.Decryption/Localization}/Localization.resx (100%) diff --git a/.editorconfig b/Aaru.Decryption/.editorconfig similarity index 100% rename from .editorconfig rename to Aaru.Decryption/.editorconfig diff --git a/.gitignore b/Aaru.Decryption/.gitignore similarity index 100% rename from .gitignore rename to Aaru.Decryption/.gitignore diff --git a/Aaru.Decryption.csproj b/Aaru.Decryption/Aaru.Decryption.csproj similarity index 100% rename from Aaru.Decryption.csproj rename to Aaru.Decryption/Aaru.Decryption.csproj diff --git a/Aaru.Decryption.csproj.DotSettings b/Aaru.Decryption/Aaru.Decryption.csproj.DotSettings similarity index 100% rename from Aaru.Decryption.csproj.DotSettings rename to Aaru.Decryption/Aaru.Decryption.csproj.DotSettings diff --git a/DVD/CSS.cs b/Aaru.Decryption/DVD/CSS.cs similarity index 100% rename from DVD/CSS.cs rename to Aaru.Decryption/DVD/CSS.cs diff --git a/DVD/Dump.cs b/Aaru.Decryption/DVD/Dump.cs similarity index 100% rename from DVD/Dump.cs rename to Aaru.Decryption/DVD/Dump.cs diff --git a/DVD/MPEG.cs b/Aaru.Decryption/DVD/MPEG.cs similarity index 100% rename from DVD/MPEG.cs rename to Aaru.Decryption/DVD/MPEG.cs diff --git a/Enums.cs b/Aaru.Decryption/Enums.cs similarity index 100% rename from Enums.cs rename to Aaru.Decryption/Enums.cs diff --git a/LICENSE b/Aaru.Decryption/LICENSE similarity index 100% rename from LICENSE rename to Aaru.Decryption/LICENSE diff --git a/Localization/Localization.Designer.cs b/Aaru.Decryption/Localization/Localization.Designer.cs similarity index 100% rename from Localization/Localization.Designer.cs rename to Aaru.Decryption/Localization/Localization.Designer.cs diff --git a/Localization/Localization.es.resx b/Aaru.Decryption/Localization/Localization.es.resx similarity index 100% rename from Localization/Localization.es.resx rename to Aaru.Decryption/Localization/Localization.es.resx diff --git a/Localization/Localization.resx b/Aaru.Decryption/Localization/Localization.resx similarity index 100% rename from Localization/Localization.resx rename to Aaru.Decryption/Localization/Localization.resx