diff --git a/.editorconfig b/.editorconfig index 585e7fdd..22f64f1b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,16 +1,627 @@ +root = true + [*] charset=utf-8 -end_of_line=lf -trim_trailing_whitespace=true +next_line=crlf insert_final_newline=false indent_style=space indent_size=4 -[{.babelrc,.stylelintrc,.eslintrc,jest.config,*.uplugin,*.bowerrc,*.jsb3,*.jsb2,*.json}] -indent_style=space +# 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=false +place_simple_declaration_blocks_on_single_line=false +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 + +type_declaration_braces=next_line +invocable_declaration_braces=next_line +anonymous_method_declaration_braces=next_line + +indent_nested_usings_stmt=true + +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=wrap_if_long +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=true +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 + +# 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 -[{*.yml,*.yaml}] -indent_style=space +[*.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 = suggestion +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 = suggestion +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_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=wrap_if_long +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=false +csharp_space_between_keyword_and_type=false +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/DiscImageChef.CommonTypes b/DiscImageChef.CommonTypes index 8505b00e..681fd8e8 160000 --- a/DiscImageChef.CommonTypes +++ b/DiscImageChef.CommonTypes @@ -1 +1 @@ -Subproject commit 8505b00e04a221e20561dd9d388d761ae4b84aab +Subproject commit 681fd8e8b9578276346630e0817cdd244f2ad931 diff --git a/DiscImageChef.Server.Task/Program.cs b/DiscImageChef.Server.Task/Program.cs index c4a5a70b..ee840f8a 100644 --- a/DiscImageChef.Server.Task/Program.cs +++ b/DiscImageChef.Server.Task/Program.cs @@ -64,26 +64,27 @@ namespace DiscImageChef.Server.Task try { System.Console.WriteLine("{0}: Retrieving USB IDs from Linux USB...", DateTime.UtcNow); - start = DateTime.UtcNow; + start = DateTime.UtcNow; client = new WebClient(); var sr = new StringReader(client.DownloadString("http://www.linux-usb.org/usb.ids")); end = DateTime.UtcNow; System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds); - UsbVendor vendor = null; - var newVendors = 0; - var newProducts = 0; - var modifiedVendors = 0; - var modifiedProducts = 0; - var counter = 0; + UsbVendor vendor = null; + int newVendors = 0; + int newProducts = 0; + int modifiedVendors = 0; + int modifiedProducts = 0; + int counter = 0; start = DateTime.UtcNow; System.Console.WriteLine("{0}: Adding and updating database entries...", DateTime.UtcNow); + do { - if (counter == 1000) + if(counter == 1000) { - var start2 = DateTime.UtcNow; + DateTime start2 = DateTime.UtcNow; System.Console.WriteLine("{0}: Saving changes", start2); ctx.SaveChanges(); end = DateTime.UtcNow; @@ -91,52 +92,59 @@ namespace DiscImageChef.Server.Task counter = 0; } - var line = sr.ReadLine(); + string line = sr.ReadLine(); - if (line is null) break; + if(line is null) + break; - if (line.Length == 0 || line[0] == '#') continue; + if(line.Length == 0 || + line[0] == '#') + continue; ushort number; string name; - if (line[0] == '\t') + + if(line[0] == '\t') { try { number = Convert.ToUInt16(line.Substring(1, 4), 16); } - catch (FormatException) + catch(FormatException) { continue; } - if (number == 0) continue; + if(number == 0) + continue; name = line.Substring(7); - var product = - ctx.UsbProducts.FirstOrDefault(p => p.ProductId == number && p.Vendor != null && + UsbProduct product = + ctx.UsbProducts.FirstOrDefault(p => p.ProductId == number && p.Vendor != null && p.Vendor.VendorId == vendor.VendorId); - if (product is null) + if(product is null) { product = new UsbProduct(vendor, number, name); ctx.UsbProducts.Add(product); + System.Console.WriteLine("{0}: Will add product {1} with ID {2:X4} and vendor {3} ({4:X4})", - DateTime.UtcNow, product.Product, product.ProductId, - product.Vendor?.Vendor ?? "null", product.Vendor?.VendorId ?? 0); + DateTime.UtcNow, product.Product, product.ProductId, + product.Vendor?.Vendor ?? "null", product.Vendor?.VendorId ?? 0); + newProducts++; counter++; } - else if (name != product.Product) + else if(name != product.Product) { - System.Console - .WriteLine( - "{0}: Will modify product with ID {1:X4} and vendor {2} ({3:X4}) from \"{4}\" to \"{5}\"", - DateTime.UtcNow, product.ProductId, product.Vendor?.Vendor ?? "null", - product.Vendor?.VendorId ?? 0, - product.Product, name); - product.Product = name; + System.Console. + WriteLine("{0}: Will modify product with ID {1:X4} and vendor {2} ({3:X4}) from \"{4}\" to \"{5}\"", + DateTime.UtcNow, product.ProductId, product.Vendor?.Vendor ?? "null", + product.Vendor?.VendorId ?? 0, + product.Product, name); + + product.Product = name; product.ModifiedWhen = DateTime.UtcNow; modifiedProducts++; counter++; @@ -149,37 +157,40 @@ namespace DiscImageChef.Server.Task { number = Convert.ToUInt16(line.Substring(0, 4), 16); } - catch (FormatException) + catch(FormatException) { continue; } - if (number == 0) continue; + if(number == 0) + continue; name = line.Substring(6); vendor = ctx.UsbVendors.FirstOrDefault(v => v.VendorId == number); - if (vendor is null) + if(vendor is null) { vendor = new UsbVendor(number, name); ctx.UsbVendors.Add(vendor); + System.Console.WriteLine("{0}: Will add vendor {1} with ID {2:X4}", DateTime.UtcNow, - vendor.Vendor, - vendor.VendorId); + vendor.Vendor, vendor.VendorId); + newVendors++; counter++; } - else if (name != vendor.Vendor) + else if(name != vendor.Vendor) { System.Console.WriteLine("{0}: Will modify vendor with ID {1:X4} from \"{2}\" to \"{3}\"", - DateTime.UtcNow, vendor.VendorId, vendor.Vendor, name); - vendor.Vendor = name; + DateTime.UtcNow, vendor.VendorId, vendor.Vendor, name); + + vendor.Vendor = name; vendor.ModifiedWhen = DateTime.UtcNow; modifiedVendors++; counter++; } - } while (true); + } while(true); end = DateTime.UtcNow; System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds); @@ -196,36 +207,46 @@ namespace DiscImageChef.Server.Task System.Console.WriteLine("{0}: {1} products modified.", DateTime.UtcNow, modifiedProducts); System.Console.WriteLine("{0}: Looking up a vendor", DateTime.UtcNow); - start = DateTime.UtcNow; + start = DateTime.UtcNow; vendor = ctx.UsbVendors.FirstOrDefault(v => v.VendorId == 0x8086); - if (vendor is null) System.Console.WriteLine("{0}: Error, could not find vendor.", DateTime.UtcNow); + + if(vendor is null) + System.Console.WriteLine("{0}: Error, could not find vendor.", DateTime.UtcNow); else - System.Console.WriteLine("{0}: Found {1}.", DateTime.UtcNow, - vendor.Vendor); + System.Console.WriteLine("{0}: Found {1}.", DateTime.UtcNow, vendor.Vendor); + end = DateTime.UtcNow; System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds); System.Console.WriteLine("{0}: Looking up a product", DateTime.UtcNow); start = DateTime.UtcNow; - var prd = + + UsbProduct prd = ctx.UsbProducts.FirstOrDefault(p => p.ProductId == 0x0001 && p.Vendor.VendorId == 0x8086); - if (prd is null) System.Console.WriteLine("{0}: Error, could not find product.", DateTime.UtcNow); - else System.Console.WriteLine("{0}: Found {1}.", DateTime.UtcNow, prd.Product); + + if(prd is null) + System.Console.WriteLine("{0}: Error, could not find product.", DateTime.UtcNow); + else + System.Console.WriteLine("{0}: Found {1}.", DateTime.UtcNow, prd.Product); + end = DateTime.UtcNow; System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds); } - catch (Exception ex) + catch(Exception ex) { -#if DEBUG - if (Debugger.IsAttached) throw; -#endif + #if DEBUG + if(Debugger.IsAttached) + throw; + #endif System.Console.WriteLine("{0}: Exception {1} filling USB IDs...", DateTime.UtcNow, ex); } System.Console.WriteLine("{0}: Fixing all devices without modification time...", DateTime.UtcNow); start = DateTime.UtcNow; - foreach (var device in ctx.Devices.Where(d => d.ModifiedWhen == null)) + + foreach(Device device in ctx.Devices.Where(d => d.ModifiedWhen == null)) device.ModifiedWhen = device.AddedWhen; + end = DateTime.UtcNow; System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds); @@ -238,11 +259,12 @@ namespace DiscImageChef.Server.Task try { System.Console.WriteLine("{0}: Retrieving CompactDisc read offsets from AccurateRip...", - DateTime.UtcNow); + DateTime.UtcNow); + start = DateTime.UtcNow; client = new WebClient(); - var html = client.DownloadString("http://www.accuraterip.com/driveoffsets.htm"); + string html = client.DownloadString("http://www.accuraterip.com/driveoffsets.htm"); end = DateTime.UtcNow; System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds); @@ -252,133 +274,147 @@ namespace DiscImageChef.Server.Task var doc = new HtmlDocument(); doc.LoadHtml(html); - var firstTable = doc.DocumentNode.SelectSingleNode("/html[1]/body[1]/table[1]"); + HtmlNode firstTable = doc.DocumentNode.SelectSingleNode("/html[1]/body[1]/table[1]"); - var firstRow = true; + bool firstRow = true; - var addedOffsets = 0; - var modifiedOffsets = 0; + int addedOffsets = 0; + int modifiedOffsets = 0; System.Console.WriteLine("{0}: Processing offsets...", DateTime.UtcNow); start = DateTime.UtcNow; - foreach (var row in firstTable.Descendants("tr")) - { - var columns = row.Descendants("td").ToArray(); - if (columns.Length != 4) + foreach(HtmlNode row in firstTable.Descendants("tr")) + { + HtmlNode[] columns = row.Descendants("td").ToArray(); + + if(columns.Length != 4) { System.Console.WriteLine("{0}: Row does not have correct number of columns...", - DateTime.UtcNow); + DateTime.UtcNow); + continue; } - var column0 = columns[0].InnerText; - var column1 = columns[1].InnerText; - var column2 = columns[2].InnerText; - var column3 = columns[3].InnerText; + string column0 = columns[0].InnerText; + string column1 = columns[1].InnerText; + string column2 = columns[2].InnerText; + string column3 = columns[3].InnerText; - if (firstRow) + if(firstRow) { - if (column0.ToLowerInvariant() != "cd drive") + if(column0.ToLowerInvariant() != "cd drive") { System.Console.WriteLine("{0}: Unexpected header \"{1}\" found...", DateTime.UtcNow, - columns[0].InnerText); + columns[0].InnerText); + break; } - if (column1.ToLowerInvariant() != "correction offset") + if(column1.ToLowerInvariant() != "correction offset") { System.Console.WriteLine("{0}: Unexpected header \"{1}\" found...", DateTime.UtcNow, - columns[1].InnerText); + columns[1].InnerText); + break; } - if (column2.ToLowerInvariant() != "submitted by") + if(column2.ToLowerInvariant() != "submitted by") { System.Console.WriteLine("{0}: Unexpected header \"{1}\" found...", DateTime.UtcNow, - columns[2].InnerText); + columns[2].InnerText); + break; } - if (column3.ToLowerInvariant() != "percentage agree") + if(column3.ToLowerInvariant() != "percentage agree") { System.Console.WriteLine("{0}: Unexpected header \"{1}\" found...", DateTime.UtcNow, - columns[3].InnerText); + columns[3].InnerText); + break; } firstRow = false; + continue; } string manufacturer; string model; - if (column0[0] == '-' && column0[1] == ' ') + if(column0[0] == '-' && + column0[1] == ' ') { manufacturer = null; - model = column0.Substring(2).Trim(); + model = column0.Substring(2).Trim(); } else { - var cutOffset = column0.IndexOf(" - ", StringComparison.Ordinal); + int cutOffset = column0.IndexOf(" - ", StringComparison.Ordinal); - if (cutOffset == -1) + if(cutOffset == -1) { manufacturer = null; - model = column0; + model = column0; } else { manufacturer = column0.Substring(0, cutOffset).Trim(); - model = column0.Substring(cutOffset + 3).Trim(); + model = column0.Substring(cutOffset + 3).Trim(); } } - switch (manufacturer) + switch(manufacturer) { - case "Lite-ON": + case"Lite-ON": manufacturer = "JLMS"; + break; - case "LG Electronics": + case"LG Electronics": manufacturer = "HL-DT-ST"; + break; - case "Panasonic": + case"Panasonic": manufacturer = "MATSHITA"; + break; } - var cdOffset = + CompactDiscOffset cdOffset = ctx.CdOffsets.FirstOrDefault(o => o.Manufacturer == manufacturer && o.Model == model); - if (column1.ToLowerInvariant() == "[purged]") + if(column1.ToLowerInvariant() == "[purged]") { - if (cdOffset != null) ctx.CdOffsets.Remove(cdOffset); + if(cdOffset != null) + ctx.CdOffsets.Remove(cdOffset); + continue; } - if (!short.TryParse(column1, out var offset)) continue; - if (!int.TryParse(column2, out var submissions)) continue; + if(!short.TryParse(column1, out short offset)) + continue; - if (column3[column3.Length - 1] != '%') continue; + if(!int.TryParse(column2, out int submissions)) + continue; + + if(column3[column3.Length - 1] != '%') + continue; column3 = column3.Substring(0, column3.Length - 1); - if (!float.TryParse(column3, out var percentage)) continue; + if(!float.TryParse(column3, out float percentage)) + continue; percentage /= 100; - if (cdOffset is null) + if(cdOffset is null) { cdOffset = new CompactDiscOffset { - AddedWhen = DateTime.UtcNow, - ModifiedWhen = DateTime.UtcNow, - Agreement = percentage, - Manufacturer = manufacturer, - Model = model, - Offset = offset, - Submissions = submissions + AddedWhen = DateTime.UtcNow, ModifiedWhen = DateTime.UtcNow, Agreement = percentage, + Manufacturer = manufacturer, Model = model, Offset = offset, + Submissions = submissions }; ctx.CdOffsets.Add(cdOffset); @@ -386,40 +422,44 @@ namespace DiscImageChef.Server.Task } else { - if (Math.Abs(cdOffset.Agreement - percentage) > 0) + if(Math.Abs(cdOffset.Agreement - percentage) > 0) { - cdOffset.Agreement = percentage; + cdOffset.Agreement = percentage; cdOffset.ModifiedWhen = DateTime.UtcNow; } - if (cdOffset.Offset != offset) + if(cdOffset.Offset != offset) { - cdOffset.Offset = offset; + cdOffset.Offset = offset; cdOffset.ModifiedWhen = DateTime.UtcNow; } - if (cdOffset.Submissions != submissions) + if(cdOffset.Submissions != submissions) { - cdOffset.Submissions = submissions; + cdOffset.Submissions = submissions; cdOffset.ModifiedWhen = DateTime.UtcNow; } - if (Math.Abs(cdOffset.Agreement - percentage) > 0 || cdOffset.Offset != offset || - cdOffset.Submissions != submissions) modifiedOffsets++; + if(Math.Abs(cdOffset.Agreement - percentage) > 0 || + cdOffset.Offset != offset || + cdOffset.Submissions != submissions) + modifiedOffsets++; } - foreach (var device in ctx - .Devices - .Where(d => d.Manufacturer == null && d.Model != null && - d.Model.Trim() == model) - .Union(ctx.Devices.Where(d => d.Manufacturer != null && - d.Manufacturer.Trim() == manufacturer && - d.Model != null && - d.Model == model))) + foreach(Device device in ctx. + Devices. + Where(d => d.Manufacturer == null && d.Model != null && + d.Model.Trim() == model). + Union(ctx.Devices.Where(d => d.Manufacturer != null && + d.Manufacturer.Trim() == manufacturer && + d.Model != null && + d.Model == model))) { - if (device.CdOffset == cdOffset && device.ModifiedWhen == cdOffset.ModifiedWhen) continue; + if(device.CdOffset == cdOffset && + device.ModifiedWhen == cdOffset.ModifiedWhen) + continue; - device.CdOffset = cdOffset; + device.CdOffset = cdOffset; device.ModifiedWhen = cdOffset.ModifiedWhen; } } @@ -436,11 +476,12 @@ namespace DiscImageChef.Server.Task System.Console.WriteLine("{0}: Added {1} offsets", end, addedOffsets); System.Console.WriteLine("{0}: Modified {1} offsets", end, modifiedOffsets); } - catch (Exception ex) + catch(Exception ex) { -#if DEBUG - if (Debugger.IsAttached) throw; -#endif + #if DEBUG + if(Debugger.IsAttached) + throw; + #endif System.Console.WriteLine("{0}: Exception {1} filling CompactDisc read offsets...", DateTime.UtcNow, ex); } } diff --git a/DiscImageChef.Server/App_Start/Ata.cs b/DiscImageChef.Server/App_Start/Ata.cs index d7072079..d1617c83 100644 --- a/DiscImageChef.Server/App_Start/Ata.cs +++ b/DiscImageChef.Server/App_Start/Ata.cs @@ -40,8 +40,8 @@ namespace DiscImageChef.Server public static class Ata { /// - /// Takes the ATA part of a device report and prints it as a list of values and another list of key=value pairs to be - /// sequenced by ASP.NET in the rendering + /// Takes the ATA part of a device report and prints it as a list of values and another list of key=value pairs to + /// be sequenced by ASP.NET in the rendering /// /// ATA part of a device report /// true if compact flash device @@ -50,37 +50,33 @@ namespace DiscImageChef.Server /// List to put values on /// List to put key=value pairs on /// List of tested media - public static void Report(CommonTypes.Metadata.Ata ataReport, bool cfa, bool atapi, - ref bool removable, - ref List ataOneValue, ref Dictionary ataTwoValue, - ref List testedMedia) + public static void Report(CommonTypes.Metadata.Ata ataReport, bool cfa, bool atapi, ref bool removable, + ref List ataOneValue, ref Dictionary ataTwoValue, + ref List testedMedia) { uint logicalsectorsize = 0; - var ataIdentifyNullable = Identify.Decode(ataReport.Identify); - if (!ataIdentifyNullable.HasValue) return; + Identify.IdentifyDevice? ataIdentifyNullable = Identify.Decode(ataReport.Identify); - var ataIdentify = ataIdentifyNullable.Value; + if(!ataIdentifyNullable.HasValue) + return; - if (!string.IsNullOrEmpty(ataIdentify.Model)) ataTwoValue.Add("Model", ataIdentify.Model); - if (!string.IsNullOrEmpty(ataIdentify.FirmwareRevision)) + Identify.IdentifyDevice ataIdentify = ataIdentifyNullable.Value; + + if(!string.IsNullOrEmpty(ataIdentify.Model)) + ataTwoValue.Add("Model", ataIdentify.Model); + + if(!string.IsNullOrEmpty(ataIdentify.FirmwareRevision)) ataTwoValue.Add("Firmware revision", ataIdentify.FirmwareRevision); - if (!string.IsNullOrEmpty(ataIdentify.AdditionalPID)) + + if(!string.IsNullOrEmpty(ataIdentify.AdditionalPID)) ataTwoValue.Add("Additional product ID", ataIdentify.AdditionalPID); - bool ata1 = false, - ata2 = false, - ata3 = false, - ata4 = false, - ata5 = false, - ata6 = false, - ata7 = false, - acs = false, - acs2 = false, - acs3 = false, - acs4 = false; + bool ata1 = false, ata2 = false, ata3 = false, ata4 = false, ata5 = false, ata6 = false, ata7 = false, + acs = false, acs2 = false, acs3 = false, acs4 = false; - if ((ushort) ataIdentify.MajorVersion == 0x0000 || (ushort) ataIdentify.MajorVersion == 0xFFFF) + if((ushort)ataIdentify.MajorVersion == 0x0000 || + (ushort)ataIdentify.MajorVersion == 0xFFFF) { // Obsolete in ATA-2, if present, device supports ATA-1 ata1 |= ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.FastIDE) || @@ -91,13 +87,20 @@ namespace DiscImageChef.Server ataIdentify.ExtendedIdentify.HasFlag(Identify.ExtendedIdentifyBit.Words64to70Valid) || ataIdentify.ExtendedIdentify.HasFlag(Identify.ExtendedIdentifyBit.Word88Valid); - if (!ata1 && !ata2 && !atapi && !cfa) ata2 = true; + if(!ata1 && + !ata2 && + !atapi && + !cfa) + ata2 = true; ata4 |= atapi; ata3 |= cfa; - if (cfa && ata1) ata1 = false; - if (cfa && ata2) ata2 = false; + if(cfa && ata1) + ata1 = false; + + if(cfa && ata2) + ata2 = false; } else { @@ -108,242 +111,314 @@ namespace DiscImageChef.Server ata5 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.AtaAtapi5); ata6 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.AtaAtapi6); ata7 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.AtaAtapi7); - acs |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.Ata8ACS); + acs |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.Ata8ACS); acs2 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.ACS2); acs3 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.ACS3); acs4 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.ACS4); } - var maxatalevel = 0; - var minatalevel = 255; - var tmpString = ""; - if (ata1) + int maxatalevel = 0; + int minatalevel = 255; + string tmpString = ""; + + if(ata1) { - tmpString += "ATA-1 "; - maxatalevel = 1; - if (minatalevel > 1) minatalevel = 1; + tmpString += "ATA-1 "; + maxatalevel = 1; + + if(minatalevel > 1) + minatalevel = 1; } - if (ata2) + if(ata2) { - tmpString += "ATA-2 "; - maxatalevel = 2; - if (minatalevel > 2) minatalevel = 2; + tmpString += "ATA-2 "; + maxatalevel = 2; + + if(minatalevel > 2) + minatalevel = 2; } - if (ata3) + if(ata3) { - tmpString += "ATA-3 "; - maxatalevel = 3; - if (minatalevel > 3) minatalevel = 3; + tmpString += "ATA-3 "; + maxatalevel = 3; + + if(minatalevel > 3) + minatalevel = 3; } - if (ata4) + if(ata4) { - tmpString += "ATA/ATAPI-4 "; - maxatalevel = 4; - if (minatalevel > 4) minatalevel = 4; + tmpString += "ATA/ATAPI-4 "; + maxatalevel = 4; + + if(minatalevel > 4) + minatalevel = 4; } - if (ata5) + if(ata5) { - tmpString += "ATA/ATAPI-5 "; - maxatalevel = 5; - if (minatalevel > 5) minatalevel = 5; + tmpString += "ATA/ATAPI-5 "; + maxatalevel = 5; + + if(minatalevel > 5) + minatalevel = 5; } - if (ata6) + if(ata6) { - tmpString += "ATA/ATAPI-6 "; - maxatalevel = 6; - if (minatalevel > 6) minatalevel = 6; + tmpString += "ATA/ATAPI-6 "; + maxatalevel = 6; + + if(minatalevel > 6) + minatalevel = 6; } - if (ata7) + if(ata7) { - tmpString += "ATA/ATAPI-7 "; - maxatalevel = 7; - if (minatalevel > 7) minatalevel = 7; + tmpString += "ATA/ATAPI-7 "; + maxatalevel = 7; + + if(minatalevel > 7) + minatalevel = 7; } - if (acs) + if(acs) { - tmpString += "ATA8-ACS "; - maxatalevel = 8; - if (minatalevel > 8) minatalevel = 8; + tmpString += "ATA8-ACS "; + maxatalevel = 8; + + if(minatalevel > 8) + minatalevel = 8; } - if (acs2) + if(acs2) { - tmpString += "ATA8-ACS2 "; - maxatalevel = 9; - if (minatalevel > 9) minatalevel = 9; + tmpString += "ATA8-ACS2 "; + maxatalevel = 9; + + if(minatalevel > 9) + minatalevel = 9; } - if (acs3) + if(acs3) { - tmpString += "ATA8-ACS3 "; - maxatalevel = 10; - if (minatalevel > 10) minatalevel = 10; + tmpString += "ATA8-ACS3 "; + maxatalevel = 10; + + if(minatalevel > 10) + minatalevel = 10; } - if (acs4) + if(acs4) { - tmpString += "ATA8-ACS4 "; - maxatalevel = 11; - if (minatalevel > 11) minatalevel = 11; + tmpString += "ATA8-ACS4 "; + maxatalevel = 11; + + if(minatalevel > 11) + minatalevel = 11; } - if (tmpString != "") ataTwoValue.Add("Supported ATA versions", tmpString); + if(tmpString != "") + ataTwoValue.Add("Supported ATA versions", tmpString); - if (maxatalevel >= 3) + if(maxatalevel >= 3) { - switch (ataIdentify.MinorVersion) + switch(ataIdentify.MinorVersion) { case 0x0000: case 0xFFFF: tmpString = "Minor ATA version not specified"; + break; case 0x0001: tmpString = "ATA (ATA-1) X3T9.2 781D prior to revision 4"; + break; case 0x0002: tmpString = "ATA-1 published, ANSI X3.221-1994"; + break; case 0x0003: tmpString = "ATA (ATA-1) X3T9.2 781D revision 4"; + break; case 0x0004: tmpString = "ATA-2 published, ANSI X3.279-1996"; + break; case 0x0005: tmpString = "ATA-2 X3T10 948D prior to revision 2k"; + break; case 0x0006: tmpString = "ATA-3 X3T10 2008D revision 1"; + break; case 0x0007: tmpString = "ATA-2 X3T10 948D revision 2k"; + break; case 0x0008: tmpString = "ATA-3 X3T10 2008D revision 0"; + break; case 0x0009: tmpString = "ATA-2 X3T10 948D revision 3"; + break; case 0x000A: tmpString = "ATA-3 published, ANSI X3.298-1997"; + break; case 0x000B: tmpString = "ATA-3 X3T10 2008D revision 6"; + break; case 0x000C: tmpString = "ATA-3 X3T13 2008D revision 7"; + break; case 0x000D: tmpString = "ATA/ATAPI-4 X3T13 1153D revision 6"; + break; case 0x000E: tmpString = "ATA/ATAPI-4 T13 1153D revision 13"; + break; case 0x000F: tmpString = "ATA/ATAPI-4 X3T13 1153D revision 7"; + break; case 0x0010: tmpString = "ATA/ATAPI-4 T13 1153D revision 18"; + break; case 0x0011: tmpString = "ATA/ATAPI-4 T13 1153D revision 15"; + break; case 0x0012: tmpString = "ATA/ATAPI-4 published, ANSI INCITS 317-1998"; + break; case 0x0013: tmpString = "ATA/ATAPI-5 T13 1321D revision 3"; + break; case 0x0014: tmpString = "ATA/ATAPI-4 T13 1153D revision 14"; + break; case 0x0015: tmpString = "ATA/ATAPI-5 T13 1321D revision 1"; + break; case 0x0016: tmpString = "ATA/ATAPI-5 published, ANSI INCITS 340-2000"; + break; case 0x0017: tmpString = "ATA/ATAPI-4 T13 1153D revision 17"; + break; case 0x0018: tmpString = "ATA/ATAPI-6 T13 1410D revision 0"; + break; case 0x0019: tmpString = "ATA/ATAPI-6 T13 1410D revision 3a"; + break; case 0x001A: tmpString = "ATA/ATAPI-7 T13 1532D revision 1"; + break; case 0x001B: tmpString = "ATA/ATAPI-6 T13 1410D revision 2"; + break; case 0x001C: tmpString = "ATA/ATAPI-6 T13 1410D revision 1"; + break; case 0x001D: tmpString = "ATA/ATAPI-7 published ANSI INCITS 397-2005"; + break; case 0x001E: tmpString = "ATA/ATAPI-7 T13 1532D revision 0"; + break; case 0x001F: tmpString = "ACS-3 Revision 3b"; + break; case 0x0021: tmpString = "ATA/ATAPI-7 T13 1532D revision 4a"; + break; case 0x0022: tmpString = "ATA/ATAPI-6 published, ANSI INCITS 361-2002"; + break; case 0x0027: tmpString = "ATA8-ACS revision 3c"; + break; case 0x0028: tmpString = "ATA8-ACS revision 6"; + break; case 0x0029: tmpString = "ATA8-ACS revision 4"; + break; case 0x0031: tmpString = "ACS-2 Revision 2"; + break; case 0x0033: tmpString = "ATA8-ACS Revision 3e"; + break; case 0x0039: tmpString = "ATA8-ACS Revision 4c"; + break; case 0x0042: tmpString = "ATA8-ACS Revision 3f"; + break; case 0x0052: tmpString = "ATA8-ACS revision 3b"; + break; case 0x006D: tmpString = "ACS-3 Revision 5"; + break; case 0x0082: tmpString = "ACS-2 published, ANSI INCITS 482-2012"; + break; case 0x0107: tmpString = "ATA8-ACS revision 2d"; + break; case 0x0110: tmpString = "ACS-2 Revision 3"; + break; case 0x011B: tmpString = "ACS-3 Revision 4"; + break; default: tmpString = $"Unknown ATA revision 0x{ataIdentify.MinorVersion:X4}"; + break; } @@ -351,981 +426,1205 @@ namespace DiscImageChef.Server } tmpString = ""; - switch ((ataIdentify.TransportMajorVersion & 0xF000) >> 12) + + switch((ataIdentify.TransportMajorVersion & 0xF000) >> 12) { case 0x0: - if ((ataIdentify.TransportMajorVersion & 0x0002) == 0x0002) tmpString += "ATA/ATAPI-7 "; - if ((ataIdentify.TransportMajorVersion & 0x0001) == 0x0001) tmpString += "ATA8-APT "; + if((ataIdentify.TransportMajorVersion & 0x0002) == 0x0002) + tmpString += "ATA/ATAPI-7 "; + + if((ataIdentify.TransportMajorVersion & 0x0001) == 0x0001) + tmpString += "ATA8-APT "; + ataTwoValue.Add("Parallel ATA device", tmpString); + break; case 0x1: - if ((ataIdentify.TransportMajorVersion & 0x0001) == 0x0001) tmpString += "ATA8-AST "; - if ((ataIdentify.TransportMajorVersion & 0x0002) == 0x0002) tmpString += "SATA 1.0a "; - if ((ataIdentify.TransportMajorVersion & 0x0004) == 0x0004) tmpString += "SATA II Extensions "; - if ((ataIdentify.TransportMajorVersion & 0x0008) == 0x0008) tmpString += "SATA 2.5 "; - if ((ataIdentify.TransportMajorVersion & 0x0010) == 0x0010) tmpString += "SATA 2.6 "; - if ((ataIdentify.TransportMajorVersion & 0x0020) == 0x0020) tmpString += "SATA 3.0 "; - if ((ataIdentify.TransportMajorVersion & 0x0040) == 0x0040) tmpString += "SATA 3.1 "; + if((ataIdentify.TransportMajorVersion & 0x0001) == 0x0001) + tmpString += "ATA8-AST "; + + if((ataIdentify.TransportMajorVersion & 0x0002) == 0x0002) + tmpString += "SATA 1.0a "; + + if((ataIdentify.TransportMajorVersion & 0x0004) == 0x0004) + tmpString += "SATA II Extensions "; + + if((ataIdentify.TransportMajorVersion & 0x0008) == 0x0008) + tmpString += "SATA 2.5 "; + + if((ataIdentify.TransportMajorVersion & 0x0010) == 0x0010) + tmpString += "SATA 2.6 "; + + if((ataIdentify.TransportMajorVersion & 0x0020) == 0x0020) + tmpString += "SATA 3.0 "; + + if((ataIdentify.TransportMajorVersion & 0x0040) == 0x0040) + tmpString += "SATA 3.1 "; + ataTwoValue.Add("Serial ATA device: ", tmpString); + break; case 0xE: ataTwoValue.Add("SATA Express device", "No version"); + break; default: ataTwoValue.Add("Unknown transport type", - $"0x{(ataIdentify.TransportMajorVersion & 0xF000) >> 12:X1}"); + $"0x{(ataIdentify.TransportMajorVersion & 0xF000) >> 12:X1}"); + break; } - if (atapi) + if(atapi) { // Bits 12 to 8, SCSI Peripheral Device Type - switch ((PeripheralDeviceTypes) (((ushort) ataIdentify.GeneralConfiguration & 0x1F00) >> 8)) + switch((PeripheralDeviceTypes)(((ushort)ataIdentify.GeneralConfiguration & 0x1F00) >> 8)) { case PeripheralDeviceTypes.DirectAccess: //0x00, ataOneValue.Add("ATAPI Direct-access device"); + break; case PeripheralDeviceTypes.SequentialAccess: //0x01, ataOneValue.Add("ATAPI Sequential-access device"); + break; case PeripheralDeviceTypes.PrinterDevice: //0x02, ataOneValue.Add("ATAPI Printer device"); + break; case PeripheralDeviceTypes.ProcessorDevice: //0x03, ataOneValue.Add("ATAPI Processor device"); + break; case PeripheralDeviceTypes.WriteOnceDevice: //0x04, ataOneValue.Add("ATAPI Write-once device"); + break; case PeripheralDeviceTypes.MultiMediaDevice: //0x05, ataOneValue.Add("ATAPI CD-ROM/DVD/etc device"); + break; case PeripheralDeviceTypes.ScannerDevice: //0x06, ataOneValue.Add("ATAPI Scanner device"); + break; case PeripheralDeviceTypes.OpticalDevice: //0x07, ataOneValue.Add("ATAPI Optical memory device"); + break; case PeripheralDeviceTypes.MediumChangerDevice: //0x08, ataOneValue.Add("ATAPI Medium change device"); + break; case PeripheralDeviceTypes.CommsDevice: //0x09, ataOneValue.Add("ATAPI Communications device"); + break; case PeripheralDeviceTypes.PrePressDevice1: //0x0A, ataOneValue.Add("ATAPI Graphics arts pre-press device (defined in ASC IT8)"); + break; case PeripheralDeviceTypes.PrePressDevice2: //0x0B, ataOneValue.Add("ATAPI Graphics arts pre-press device (defined in ASC IT8)"); + break; case PeripheralDeviceTypes.ArrayControllerDevice: //0x0C, ataOneValue.Add("ATAPI Array controller device"); + break; case PeripheralDeviceTypes.EnclosureServiceDevice: //0x0D, ataOneValue.Add("ATAPI Enclosure services device"); + break; case PeripheralDeviceTypes.SimplifiedDevice: //0x0E, ataOneValue.Add("ATAPI Simplified direct-access device"); + break; case PeripheralDeviceTypes.OCRWDevice: //0x0F, ataOneValue.Add("ATAPI Optical card reader/writer device"); + break; case PeripheralDeviceTypes.BridgingExpander: //0x10, ataOneValue.Add("ATAPI Bridging Expanders"); + break; case PeripheralDeviceTypes.ObjectDevice: //0x11, ataOneValue.Add("ATAPI Object-based Storage Device"); + break; case PeripheralDeviceTypes.ADCDevice: //0x12, ataOneValue.Add("ATAPI Automation/Drive Interface"); + break; case PeripheralDeviceTypes.WellKnownDevice: //0x1E, ataOneValue.Add("ATAPI Well known logical unit"); + break; case PeripheralDeviceTypes.UnknownDevice: //0x1F ataOneValue.Add("ATAPI Unknown or no device type"); + break; default: - ataOneValue - .Add( - $"ATAPI Unknown device type field value 0x{((ushort) ataIdentify.GeneralConfiguration & 0x1F00) >> 8:X2}"); + ataOneValue. + Add($"ATAPI Unknown device type field value 0x{((ushort)ataIdentify.GeneralConfiguration & 0x1F00) >> 8:X2}"); + break; } // ATAPI DRQ behaviour - switch (((ushort) ataIdentify.GeneralConfiguration & 0x60) >> 5) + switch(((ushort)ataIdentify.GeneralConfiguration & 0x60) >> 5) { case 0: ataOneValue.Add("Device shall set DRQ within 3 ms of receiving PACKET"); + break; case 1: ataOneValue.Add("Device shall assert INTRQ when DRQ is set to one"); + break; case 2: ataOneValue.Add("Device shall set DRQ within 50 µs of receiving PACKET"); + break; default: - ataOneValue - .Add( - $"Unknown ATAPI DRQ behaviour code {((ushort) ataIdentify.GeneralConfiguration & 0x60) >> 5}"); + ataOneValue. + Add($"Unknown ATAPI DRQ behaviour code {((ushort)ataIdentify.GeneralConfiguration & 0x60) >> 5}"); + break; } // ATAPI PACKET size - switch ((ushort) ataIdentify.GeneralConfiguration & 0x03) + switch((ushort)ataIdentify.GeneralConfiguration & 0x03) { case 0: ataOneValue.Add("ATAPI device uses 12 byte command packet"); + break; case 1: ataOneValue.Add("ATAPI device uses 16 byte command packet"); + break; default: - ataOneValue - .Add($"Unknown ATAPI packet size code {(ushort) ataIdentify.GeneralConfiguration & 0x03}"); + ataOneValue. + Add($"Unknown ATAPI packet size code {(ushort)ataIdentify.GeneralConfiguration & 0x03}"); + break; } } - else if (!cfa) + else if(!cfa) { - if (minatalevel >= 5) - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.IncompleteResponse)) + if(minatalevel >= 5) + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.IncompleteResponse)) ataOneValue.Add("Incomplete identify response"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.NonMagnetic)) + + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.NonMagnetic)) ataOneValue.Add("Device uses non-magnetic media"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable)) + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable)) ataOneValue.Add("Device is removable"); - if (minatalevel <= 5) - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Fixed)) + if(minatalevel <= 5) + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Fixed)) ataOneValue.Add("Device is fixed"); - if (ata1) + if(ata1) { - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.SlowIDE)) + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.SlowIDE)) ataOneValue.Add("Device transfer rate is <= 5 Mb/s"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.FastIDE)) + + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.FastIDE)) ataOneValue.Add("Device transfer rate is > 5 Mb/s but <= 10 Mb/s"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.UltraFastIDE)) + + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.UltraFastIDE)) ataOneValue.Add("Device transfer rate is > 10 Mb/s"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.SoftSector)) + + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.SoftSector)) ataOneValue.Add("Device is soft sectored"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.HardSector)) + + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.HardSector)) ataOneValue.Add("Device is hard sectored"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.NotMFM)) + + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.NotMFM)) ataOneValue.Add("Device is not MFM encoded"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.FormatGapReq)) + + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.FormatGapReq)) ataOneValue.Add("Format speed tolerance gap is required"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.TrackOffset)) + + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.TrackOffset)) ataOneValue.Add("Track offset option is available"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.DataStrobeOffset)) + + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.DataStrobeOffset)) ataOneValue.Add("Data strobe offset option is available"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit - .RotationalSpeedTolerance)) + + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit. + RotationalSpeedTolerance)) ataOneValue.Add("Rotational speed tolerance is higher than 0,5%"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.SpindleControl)) + + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.SpindleControl)) ataOneValue.Add("Spindle motor control is implemented"); - if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.HighHeadSwitch)) + + if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.HighHeadSwitch)) ataOneValue.Add("Head switch time is bigger than 15 µs."); } } - if ((ushort) ataIdentify.SpecificConfiguration != 0x0000 && - (ushort) ataIdentify.SpecificConfiguration != 0xFFFF) - switch (ataIdentify.SpecificConfiguration) + if((ushort)ataIdentify.SpecificConfiguration != 0x0000 && + (ushort)ataIdentify.SpecificConfiguration != 0xFFFF) + switch(ataIdentify.SpecificConfiguration) { case Identify.SpecificConfigurationEnum.RequiresSetIncompleteResponse: - ataOneValue - .Add("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete."); + ataOneValue. + Add("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete."); + break; case Identify.SpecificConfigurationEnum.RequiresSetCompleteResponse: - ataOneValue - .Add("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is complete."); + ataOneValue. + Add("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is complete."); + break; case Identify.SpecificConfigurationEnum.NotRequiresSetIncompleteResponse: - ataOneValue - .Add( - "Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete."); + ataOneValue. + Add("Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete."); + break; case Identify.SpecificConfigurationEnum.NotRequiresSetCompleteResponse: - ataOneValue - .Add( - "Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is complete."); + ataOneValue. + Add("Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is complete."); + break; default: - ataOneValue - .Add( - $"Unknown device specific configuration 0x{(ushort) ataIdentify.SpecificConfiguration:X4}"); + ataOneValue. + Add($"Unknown device specific configuration 0x{(ushort)ataIdentify.SpecificConfiguration:X4}"); + break; } // Obsolete since ATA-2, however, it is yet used in ATA-8 devices - if (ataIdentify.BufferSize != 0x0000 && ataIdentify.BufferSize != 0xFFFF && - ataIdentify.BufferType != 0x0000 && ataIdentify.BufferType != 0xFFFF) - switch (ataIdentify.BufferType) + if(ataIdentify.BufferSize != 0x0000 && + ataIdentify.BufferSize != 0xFFFF && + ataIdentify.BufferType != 0x0000 && + ataIdentify.BufferType != 0xFFFF) + switch(ataIdentify.BufferType) { case 1: - ataOneValue - .Add( - $"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of single ported single sector buffer"); + ataOneValue. + Add($"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of single ported single sector buffer"); + break; case 2: - ataOneValue - .Add( - $"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer"); + ataOneValue. + Add($"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer"); + break; case 3: - ataOneValue - .Add( - $"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer with read caching"); + ataOneValue. + Add($"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer with read caching"); + break; default: - ataOneValue - .Add( - $"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of unknown type {ataIdentify.BufferType} buffer"); + ataOneValue. + Add($"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of unknown type {ataIdentify.BufferType} buffer"); + break; } ataOneValue.Add("Device capabilities:"); - if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.StandardStanbyTimer)) + + if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.StandardStanbyTimer)) ataOneValue.Add("Standby time values are standard"); - if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.IORDY)) + + if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.IORDY)) ataOneValue.Add(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.CanDisableIORDY) - ? "IORDY is supported and can be disabled" - : "IORDY is supported"); - if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.DMASupport)) + ? "IORDY is supported and can be disabled" : "IORDY is supported"); + + if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.DMASupport)) ataOneValue.Add("DMA is supported"); - if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.PhysicalAlignment1) || - ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.PhysicalAlignment0)) - ataOneValue.Add($"Long Physical Alignment setting is {(ushort) ataIdentify.Capabilities & 0x03}"); - if (atapi) + + if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.PhysicalAlignment1) || + ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.PhysicalAlignment0)) + ataOneValue.Add($"Long Physical Alignment setting is {(ushort)ataIdentify.Capabilities & 0x03}"); + + if(atapi) { - if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.InterleavedDMA)) + if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.InterleavedDMA)) ataOneValue.Add("ATAPI device supports interleaved DMA"); - if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.CommandQueue)) + + if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.CommandQueue)) ataOneValue.Add("ATAPI device supports command queueing"); - if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.OverlapOperation)) + + if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.OverlapOperation)) ataOneValue.Add("ATAPI device supports overlapped operations"); - if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.RequiresATASoftReset)) + + if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.RequiresATASoftReset)) ataOneValue.Add("ATAPI device requires ATA software reset"); } - if (ataIdentify.Capabilities2.HasFlag(Identify.CapabilitiesBit2.MustBeSet) && - !ataIdentify.Capabilities2.HasFlag(Identify.CapabilitiesBit2.MustBeClear)) - if (ataIdentify.Capabilities2.HasFlag(Identify.CapabilitiesBit2.SpecificStandbyTimer)) + if(ataIdentify.Capabilities2.HasFlag(Identify.CapabilitiesBit2.MustBeSet) && + !ataIdentify.Capabilities2.HasFlag(Identify.CapabilitiesBit2.MustBeClear)) + if(ataIdentify.Capabilities2.HasFlag(Identify.CapabilitiesBit2.SpecificStandbyTimer)) ataOneValue.Add("Device indicates a specific minimum standby timer value"); - if (ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.MultipleValid)) + if(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.MultipleValid)) { - ataOneValue.Add( - $"A maximum of {ataIdentify.MultipleSectorNumber} sectors can be transferred per interrupt on READ/WRITE MULTIPLE"); + ataOneValue. + Add($"A maximum of {ataIdentify.MultipleSectorNumber} sectors can be transferred per interrupt on READ/WRITE MULTIPLE"); + ataOneValue.Add($"Device supports setting a maximum of {ataIdentify.MultipleMaxSectors} sectors"); } - if (ata1) - if (ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.TrustedComputing)) + if(ata1) + if(ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.TrustedComputing)) ataOneValue.Add("Device supports doubleword I/O"); - if (minatalevel <= 3) + if(minatalevel <= 3) { - if (ataIdentify.PIOTransferTimingMode > 0) + if(ataIdentify.PIOTransferTimingMode > 0) ataTwoValue.Add("PIO timing mode", $"{ataIdentify.PIOTransferTimingMode}"); - if (ataIdentify.DMATransferTimingMode > 0) + + if(ataIdentify.DMATransferTimingMode > 0) ataTwoValue.Add("DMA timing mode", $"{ataIdentify.DMATransferTimingMode}"); } tmpString = ""; - if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode0)) tmpString += "PIO0 "; - if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode1)) tmpString += "PIO1 "; - if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode2)) tmpString += "PIO2 "; - if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode3)) tmpString += "PIO3 "; - if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode4)) tmpString += "PIO4 "; - if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode5)) tmpString += "PIO5 "; - if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode6)) tmpString += "PIO6 "; - if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode7)) tmpString += "PIO7 "; + if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode0)) + tmpString += "PIO0 "; - if (!string.IsNullOrEmpty(tmpString)) ataTwoValue.Add("Advanced PIO", tmpString); + if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode1)) + tmpString += "PIO1 "; - if (minatalevel <= 3 && !atapi) + if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode2)) + tmpString += "PIO2 "; + + if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode3)) + tmpString += "PIO3 "; + + if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode4)) + tmpString += "PIO4 "; + + if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode5)) + tmpString += "PIO5 "; + + if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode6)) + tmpString += "PIO6 "; + + if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode7)) + tmpString += "PIO7 "; + + if(!string.IsNullOrEmpty(tmpString)) + ataTwoValue.Add("Advanced PIO", tmpString); + + if(minatalevel <= 3 && + !atapi) { tmpString = ""; - if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode0)) + + if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode0)) { tmpString += "DMA0 "; - if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode0)) tmpString += "(active) "; + + if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode0)) + tmpString += "(active) "; } - if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode1)) + if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode1)) { tmpString += "DMA1 "; - if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode1)) tmpString += "(active) "; + + if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode1)) + tmpString += "(active) "; } - if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode2)) + if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode2)) { tmpString += "DMA2 "; - if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode2)) tmpString += "(active) "; + + if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode2)) + tmpString += "(active) "; } - if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode3)) + if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode3)) { tmpString += "DMA3 "; - if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode3)) tmpString += "(active) "; + + if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode3)) + tmpString += "(active) "; } - if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode4)) + if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode4)) { tmpString += "DMA4 "; - if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode4)) tmpString += "(active) "; + + if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode4)) + tmpString += "(active) "; } - if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode5)) + if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode5)) { tmpString += "DMA5 "; - if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode5)) tmpString += "(active) "; + + if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode5)) + tmpString += "(active) "; } - if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode6)) + if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode6)) { tmpString += "DMA6 "; - if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode6)) tmpString += "(active) "; + + if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode6)) + tmpString += "(active) "; } - if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode7)) + if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode7)) { tmpString += "DMA7 "; - if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode7)) tmpString += "(active) "; + + if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode7)) + tmpString += "(active) "; } - if (!string.IsNullOrEmpty(tmpString)) ataTwoValue.Add("Single-word DMA", tmpString); + if(!string.IsNullOrEmpty(tmpString)) + ataTwoValue.Add("Single-word DMA", tmpString); } tmpString = ""; - if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode0)) + + if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode0)) { tmpString += "MDMA0 "; - if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode0)) tmpString += "(active) "; + + if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode0)) + tmpString += "(active) "; } - if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode1)) + if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode1)) { tmpString += "MDMA1 "; - if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode1)) tmpString += "(active) "; + + if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode1)) + tmpString += "(active) "; } - if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode2)) + if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode2)) { tmpString += "MDMA2 "; - if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode2)) tmpString += "(active) "; + + if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode2)) + tmpString += "(active) "; } - if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode3)) + if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode3)) { tmpString += "MDMA3 "; - if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode3)) tmpString += "(active) "; + + if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode3)) + tmpString += "(active) "; } - if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode4)) + if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode4)) { tmpString += "MDMA4 "; - if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode4)) tmpString += "(active) "; + + if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode4)) + tmpString += "(active) "; } - if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode5)) + if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode5)) { tmpString += "MDMA5 "; - if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode5)) tmpString += "(active) "; + + if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode5)) + tmpString += "(active) "; } - if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode6)) + if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode6)) { tmpString += "MDMA6 "; - if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode6)) tmpString += "(active) "; + + if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode6)) + tmpString += "(active) "; } - if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode7)) + if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode7)) { tmpString += "MDMA7 "; - if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode7)) tmpString += "(active) "; + + if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode7)) + tmpString += "(active) "; } - if (!string.IsNullOrEmpty(tmpString)) ataTwoValue.Add("Multi-word DMA", tmpString); + if(!string.IsNullOrEmpty(tmpString)) + ataTwoValue.Add("Multi-word DMA", tmpString); tmpString = ""; - if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode0)) + + if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode0)) { tmpString += "UDMA0 "; - if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode0)) tmpString += "(active) "; + + if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode0)) + tmpString += "(active) "; } - if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode1)) + if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode1)) { tmpString += "UDMA1 "; - if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode1)) tmpString += "(active) "; + + if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode1)) + tmpString += "(active) "; } - if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode2)) + if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode2)) { tmpString += "UDMA2 "; - if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode2)) tmpString += "(active) "; + + if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode2)) + tmpString += "(active) "; } - if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode3)) + if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode3)) { tmpString += "UDMA3 "; - if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode3)) tmpString += "(active) "; + + if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode3)) + tmpString += "(active) "; } - if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode4)) + if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode4)) { tmpString += "UDMA4 "; - if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode4)) tmpString += "(active) "; + + if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode4)) + tmpString += "(active) "; } - if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode5)) + if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode5)) { tmpString += "UDMA5 "; - if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode5)) tmpString += "(active) "; + + if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode5)) + tmpString += "(active) "; } - if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode6)) + if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode6)) { tmpString += "UDMA6 "; - if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode6)) tmpString += "(active) "; + + if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode6)) + tmpString += "(active) "; } - if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode7)) + if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode7)) { tmpString += "UDMA7 "; - if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode7)) tmpString += "(active) "; + + if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode7)) + tmpString += "(active) "; } - if (!string.IsNullOrEmpty(tmpString)) ataTwoValue.Add("Ultra DMA", tmpString); + if(!string.IsNullOrEmpty(tmpString)) + ataTwoValue.Add("Ultra DMA", tmpString); - if (ataIdentify.MinMDMACycleTime != 0 && ataIdentify.RecMDMACycleTime != 0) - ataOneValue.Add( - $"At minimum {ataIdentify.MinMDMACycleTime} ns. transfer cycle time per word in MDMA, " + - $"{ataIdentify.RecMDMACycleTime} ns. recommended"); - if (ataIdentify.MinPIOCycleTimeNoFlow != 0) - ataOneValue.Add( - $"At minimum {ataIdentify.MinPIOCycleTimeNoFlow} ns. transfer cycle time per word in PIO, " + - "without flow control"); - if (ataIdentify.MinPIOCycleTimeFlow != 0) - ataOneValue.Add( - $"At minimum {ataIdentify.MinPIOCycleTimeFlow} ns. transfer cycle time per word in PIO, " + - "with IORDY flow control"); + if(ataIdentify.MinMDMACycleTime != 0 && + ataIdentify.RecMDMACycleTime != 0) + ataOneValue. + Add($"At minimum {ataIdentify.MinMDMACycleTime} ns. transfer cycle time per word in MDMA, " + + $"{ataIdentify.RecMDMACycleTime} ns. recommended"); - if (ataIdentify.MaxQueueDepth != 0) + if(ataIdentify.MinPIOCycleTimeNoFlow != 0) + ataOneValue. + Add($"At minimum {ataIdentify.MinPIOCycleTimeNoFlow} ns. transfer cycle time per word in PIO, " + + "without flow control"); + + if(ataIdentify.MinPIOCycleTimeFlow != 0) + ataOneValue. + Add($"At minimum {ataIdentify.MinPIOCycleTimeFlow} ns. transfer cycle time per word in PIO, " + + "with IORDY flow control"); + + if(ataIdentify.MaxQueueDepth != 0) ataOneValue.Add($"{ataIdentify.MaxQueueDepth + 1} depth of queue maximum"); - if (atapi) + if(atapi) { - if (ataIdentify.PacketBusRelease != 0) - ataOneValue - .Add($"{ataIdentify.PacketBusRelease} ns. typical to release bus from receipt of PACKET"); - if (ataIdentify.ServiceBusyClear != 0) - ataOneValue - .Add($"{ataIdentify.ServiceBusyClear} ns. typical to clear BSY bit from receipt of SERVICE"); + if(ataIdentify.PacketBusRelease != 0) + ataOneValue. + Add($"{ataIdentify.PacketBusRelease} ns. typical to release bus from receipt of PACKET"); + + if(ataIdentify.ServiceBusyClear != 0) + ataOneValue. + Add($"{ataIdentify.ServiceBusyClear} ns. typical to clear BSY bit from receipt of SERVICE"); } - if ((ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0x1 || - (ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0xE) + if((ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0x1 || + (ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0xE) { - if (!ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Clear)) + if(!ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Clear)) { - if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Gen1Speed)) + if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Gen1Speed)) ataOneValue.Add("SATA 1.5Gb/s is supported"); - if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Gen2Speed)) + + if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Gen2Speed)) ataOneValue.Add("SATA 3.0Gb/s is supported"); - if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Gen3Speed)) + + if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Gen3Speed)) ataOneValue.Add("SATA 6.0Gb/s is supported"); - if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.PowerReceipt)) + + if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.PowerReceipt)) ataOneValue.Add("Receipt of host initiated power management requests is supported"); - if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.PHYEventCounter)) + + if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.PHYEventCounter)) ataOneValue.Add("PHY Event counters are supported"); - if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.HostSlumbTrans)) + + if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.HostSlumbTrans)) ataOneValue.Add("Supports host automatic partial to slumber transitions is supported"); - if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.DevSlumbTrans)) + + if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.DevSlumbTrans)) ataOneValue.Add("Supports device automatic partial to slumber transitions is supported"); - if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.NCQ)) + + if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.NCQ)) { ataOneValue.Add("NCQ is supported"); - if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.NCQPriority)) + if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.NCQPriority)) ataOneValue.Add("NCQ priority is supported"); - if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.UnloadNCQ)) + + if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.UnloadNCQ)) ataOneValue.Add("Unload is supported with outstanding NCQ commands"); } } - if (!ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.Clear)) + if(!ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.Clear)) { - if (!ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Clear) && - ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.NCQ)) + if(!ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Clear) && + ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.NCQ)) { - if (ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.NCQMgmt)) + if(ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.NCQMgmt)) ataOneValue.Add("NCQ queue management is supported"); - if (ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.NCQStream)) + + if(ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.NCQStream)) ataOneValue.Add("NCQ streaming is supported"); } - if (atapi) + if(atapi) { - if (ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.HostEnvDetect)) + if(ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.HostEnvDetect)) ataOneValue.Add("ATAPI device supports host environment detection"); - if (ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.DevAttSlimline)) + + if(ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.DevAttSlimline)) ataOneValue.Add("ATAPI device supports attention on slimline connected devices"); } } } - if (ataIdentify.InterseekDelay != 0x0000 && ataIdentify.InterseekDelay != 0xFFFF) - ataOneValue.Add( - $"{ataIdentify.InterseekDelay} microseconds of interseek delay for ISO-7779 accoustic testing"); + if(ataIdentify.InterseekDelay != 0x0000 && + ataIdentify.InterseekDelay != 0xFFFF) + ataOneValue. + Add($"{ataIdentify.InterseekDelay} microseconds of interseek delay for ISO-7779 accoustic testing"); - if ((ushort) ataIdentify.DeviceFormFactor != 0x0000 && (ushort) ataIdentify.DeviceFormFactor != 0xFFFF) - switch (ataIdentify.DeviceFormFactor) + if((ushort)ataIdentify.DeviceFormFactor != 0x0000 && + (ushort)ataIdentify.DeviceFormFactor != 0xFFFF) + switch(ataIdentify.DeviceFormFactor) { case Identify.DeviceFormFactorEnum.FiveAndQuarter: ataOneValue.Add("Device nominal size is 5.25\""); + break; case Identify.DeviceFormFactorEnum.ThreeAndHalf: ataOneValue.Add("Device nominal size is 3.5\""); + break; case Identify.DeviceFormFactorEnum.TwoAndHalf: ataOneValue.Add("Device nominal size is 2.5\""); + break; case Identify.DeviceFormFactorEnum.OnePointEight: ataOneValue.Add("Device nominal size is 1.8\""); + break; case Identify.DeviceFormFactorEnum.LessThanOnePointEight: ataOneValue.Add("Device nominal size is smaller than 1.8\""); + break; default: ataOneValue.Add($"Device nominal size field value {ataIdentify.DeviceFormFactor} is unknown"); + break; } - if (atapi) - if (ataIdentify.ATAPIByteCount > 0) + if(atapi) + if(ataIdentify.ATAPIByteCount > 0) ataOneValue.Add($"{ataIdentify.ATAPIByteCount} bytes count limit for ATAPI"); - if (cfa) - if ((ataIdentify.CFAPowerMode & 0x8000) == 0x8000) + if(cfa) + if((ataIdentify.CFAPowerMode & 0x8000) == 0x8000) { ataOneValue.Add("CompactFlash device supports power mode 1"); - if ((ataIdentify.CFAPowerMode & 0x2000) == 0x2000) + + if((ataIdentify.CFAPowerMode & 0x2000) == 0x2000) ataOneValue.Add("CompactFlash power mode 1 required for one or more commands"); - if ((ataIdentify.CFAPowerMode & 0x1000) == 0x1000) + + if((ataIdentify.CFAPowerMode & 0x1000) == 0x1000) ataOneValue.Add("CompactFlash power mode 1 is disabled"); ataOneValue.Add($"CompactFlash device uses a maximum of {ataIdentify.CFAPowerMode & 0x0FFF} mA"); } ataOneValue.Add("Command set and features:"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Nop)) + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Nop)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.Nop) - ? "NOP is supported and enabled" - : "NOP is supported"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.ReadBuffer)) + ? "NOP is supported and enabled" : "NOP is supported"); + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.ReadBuffer)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.ReadBuffer) - ? "READ BUFFER is supported and enabled" - : "READ BUFFER is supported"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.WriteBuffer)) + ? "READ BUFFER is supported and enabled" : "READ BUFFER is supported"); + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.WriteBuffer)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.WriteBuffer) - ? "WRITE BUFFER is supported and enabled" - : "WRITE BUFFER is supported"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.HPA)) + ? "WRITE BUFFER is supported and enabled" : "WRITE BUFFER is supported"); + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.HPA)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.HPA) - ? "Host Protected Area is supported and enabled" - : "Host Protected Area is supported"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.DeviceReset)) + ? "Host Protected Area is supported and enabled" + : "Host Protected Area is supported"); + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.DeviceReset)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.DeviceReset) - ? "DEVICE RESET is supported and enabled" - : "DEVICE RESET is supported"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Service)) + ? "DEVICE RESET is supported and enabled" : "DEVICE RESET is supported"); + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Service)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.Service) - ? "SERVICE interrupt is supported and enabled" - : "SERVICE interrupt is supported"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Release)) + ? "SERVICE interrupt is supported and enabled" : "SERVICE interrupt is supported"); + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Release)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.Release) - ? "Release is supported and enabled" - : "Release is supported"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.LookAhead)) + ? "Release is supported and enabled" : "Release is supported"); + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.LookAhead)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.LookAhead) - ? "Look-ahead read is supported and enabled" - : "Look-ahead read is supported"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.WriteCache)) + ? "Look-ahead read is supported and enabled" : "Look-ahead read is supported"); + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.WriteCache)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.WriteCache) - ? "Write cache is supported and enabled" - : "Write cache is supported"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Packet)) + ? "Write cache is supported and enabled" : "Write cache is supported"); + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Packet)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.Packet) - ? "PACKET is supported and enabled" - : "PACKET is supported"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.PowerManagement)) + ? "PACKET is supported and enabled" : "PACKET is supported"); + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.PowerManagement)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.PowerManagement) - ? "Power management is supported and enabled" - : "Power management is supported"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.RemovableMedia)) + ? "Power management is supported and enabled" : "Power management is supported"); + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.RemovableMedia)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.RemovableMedia) - ? "Removable media feature set is supported and enabled" - : "Removable media feature set is supported"); - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.SecurityMode)) + ? "Removable media feature set is supported and enabled" + : "Removable media feature set is supported"); + + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.SecurityMode)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.SecurityMode) - ? "Security mode is supported and enabled" - : "Security mode is supported"); - if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport)) + ? "Security mode is supported and enabled" : "Security mode is supported"); + + if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport)) ataOneValue.Add("28-bit LBA is supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.MustBeSet) && - !ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.MustBeClear)) + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.MustBeSet) && + !ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.MustBeClear)) { - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48)) + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48)) ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.LBA48) - ? "48-bit LBA is supported and enabled" - : "48-bit LBA is supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.FlushCache)) + ? "48-bit LBA is supported and enabled" : "48-bit LBA is supported"); + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.FlushCache)) ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.FlushCache) - ? "FLUSH CACHE is supported and enabled" - : "FLUSH CACHE is supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.FlushCacheExt)) + ? "FLUSH CACHE is supported and enabled" : "FLUSH CACHE is supported"); + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.FlushCacheExt)) ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.FlushCacheExt) - ? "FLUSH CACHE EXT is supported and enabled" - : "FLUSH CACHE EXT is supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.DCO)) + ? "FLUSH CACHE EXT is supported and enabled" : "FLUSH CACHE EXT is supported"); + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.DCO)) ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.DCO) - ? "Device Configuration Overlay feature set is supported and enabled" - : "Device Configuration Overlay feature set is supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.AAM)) + ? "Device Configuration Overlay feature set is supported and enabled" + : "Device Configuration Overlay feature set is supported"); + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.AAM)) ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.AAM) - ? $"Automatic Acoustic Management is supported and enabled with value {ataIdentify.CurrentAAM} (vendor recommends {ataIdentify.RecommendedAAM}" - : "Automatic Acoustic Management is supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.SetMax)) + ? $"Automatic Acoustic Management is supported and enabled with value {ataIdentify.CurrentAAM} (vendor recommends {ataIdentify.RecommendedAAM}" + : "Automatic Acoustic Management is supported"); + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.SetMax)) ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.SetMax) - ? "SET MAX security extension is supported and enabled" - : "SET MAX security extension is supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.AddressOffsetReservedAreaBoot)) - ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2 - .AddressOffsetReservedAreaBoot) - ? "Address Offset Reserved Area Boot is supported and enabled" - : "Address Offset Reserved Area Boot is supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.SetFeaturesRequired)) + ? "SET MAX security extension is supported and enabled" + : "SET MAX security extension is supported"); + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.AddressOffsetReservedAreaBoot)) + ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2. + AddressOffsetReservedAreaBoot) + ? "Address Offset Reserved Area Boot is supported and enabled" + : "Address Offset Reserved Area Boot is supported"); + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.SetFeaturesRequired)) ataOneValue.Add("SET FEATURES is required before spin-up"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.PowerUpInStandby)) + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.PowerUpInStandby)) ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.PowerUpInStandby) - ? "Power-up in standby is supported and enabled" - : "Power-up in standby is supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.RemovableNotification)) - ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2 - .RemovableNotification) - ? "Removable Media Status Notification is supported and enabled" - : "Removable Media Status Notification is supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.APM)) + ? "Power-up in standby is supported and enabled" + : "Power-up in standby is supported"); + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.RemovableNotification)) + ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2. + RemovableNotification) + ? "Removable Media Status Notification is supported and enabled" + : "Removable Media Status Notification is supported"); + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.APM)) ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.APM) - ? $"Advanced Power Management is supported and enabled with value {ataIdentify.CurrentAPM}" - : "Advanced Power Management is supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.CompactFlash)) + ? $"Advanced Power Management is supported and enabled with value {ataIdentify.CurrentAPM}" + : "Advanced Power Management is supported"); + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.CompactFlash)) ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.CompactFlash) - ? "CompactFlash feature set is supported and enabled" - : "CompactFlash feature set is supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.RWQueuedDMA)) + ? "CompactFlash feature set is supported and enabled" + : "CompactFlash feature set is supported"); + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.RWQueuedDMA)) ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.RWQueuedDMA) - ? "READ DMA QUEUED and WRITE DMA QUEUED are supported and enabled" - : "READ DMA QUEUED and WRITE DMA QUEUED are supported"); - if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.DownloadMicrocode)) + ? "READ DMA QUEUED and WRITE DMA QUEUED are supported and enabled" + : "READ DMA QUEUED and WRITE DMA QUEUED are supported"); + + if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.DownloadMicrocode)) ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.DownloadMicrocode) - ? "DOWNLOAD MICROCODE is supported and enabled" - : "DOWNLOAD MICROCODE is supported"); + ? "DOWNLOAD MICROCODE is supported and enabled" + : "DOWNLOAD MICROCODE is supported"); } - if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.SMART)) + if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.SMART)) ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.SMART) - ? "S.M.A.R.T. is supported and enabled" - : "S.M.A.R.T. is supported"); + ? "S.M.A.R.T. is supported and enabled" : "S.M.A.R.T. is supported"); - if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.Supported)) + if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.Supported)) ataOneValue.Add("S.M.A.R.T. Command Transport is supported"); - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeSet) && - !ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeClear)) + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeSet) && + !ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeClear)) { - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.SMARTSelfTest)) + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.SMARTSelfTest)) ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.SMARTSelfTest) - ? "S.M.A.R.T. self-testing is supported and enabled" - : "S.M.A.R.T. self-testing is supported"); - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.SMARTLog)) + ? "S.M.A.R.T. self-testing is supported and enabled" + : "S.M.A.R.T. self-testing is supported"); + + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.SMARTLog)) ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.SMARTLog) - ? "S.M.A.R.T. error logging is supported and enabled" - : "S.M.A.R.T. error logging is supported"); - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.IdleImmediate)) + ? "S.M.A.R.T. error logging is supported and enabled" + : "S.M.A.R.T. error logging is supported"); + + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.IdleImmediate)) ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.IdleImmediate) - ? "IDLE IMMEDIATE with UNLOAD FEATURE is supported and enabled" - : "IDLE IMMEDIATE with UNLOAD FEATURE is supported"); - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.WriteURG)) + ? "IDLE IMMEDIATE with UNLOAD FEATURE is supported and enabled" + : "IDLE IMMEDIATE with UNLOAD FEATURE is supported"); + + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.WriteURG)) ataOneValue.Add("URG bit is supported in WRITE STREAM DMA EXT and WRITE STREAM EXT"); - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.ReadURG)) + + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.ReadURG)) ataOneValue.Add("URG bit is supported in READ STREAM DMA EXT and READ STREAM EXT"); - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.WWN)) + + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.WWN)) ataOneValue.Add("Device has a World Wide Name"); - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.FUAWriteQ)) + + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.FUAWriteQ)) ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.FUAWriteQ) - ? "WRITE DMA QUEUED FUA EXT is supported and enabled" - : "WRITE DMA QUEUED FUA EXT is supported"); - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.FUAWrite)) + ? "WRITE DMA QUEUED FUA EXT is supported and enabled" + : "WRITE DMA QUEUED FUA EXT is supported"); + + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.FUAWrite)) ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.FUAWrite) - ? "WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported and enabled" - : "WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported"); - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.GPL)) + ? "WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported and enabled" + : "WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported"); + + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.GPL)) ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.GPL) - ? "General Purpose Logging is supported and enabled" - : "General Purpose Logging is supported"); - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.Streaming)) + ? "General Purpose Logging is supported and enabled" + : "General Purpose Logging is supported"); + + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.Streaming)) ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.Streaming) - ? "Streaming feature set is supported and enabled" - : "Streaming feature set is supported"); - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MCPT)) + ? "Streaming feature set is supported and enabled" + : "Streaming feature set is supported"); + + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MCPT)) ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.MCPT) - ? "Media Card Pass Through command set is supported and enabled" - : "Media Card Pass Through command set is supported"); - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MediaSerial)) + ? "Media Card Pass Through command set is supported and enabled" + : "Media Card Pass Through command set is supported"); + + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MediaSerial)) ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.MediaSerial) - ? "Media Serial is supported and valid" - : "Media Serial is supported"); + ? "Media Serial is supported and valid" : "Media Serial is supported"); } - if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.MustBeSet) && - !ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.MustBeClear)) + if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.MustBeSet) && + !ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.MustBeClear)) { - if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.DSN)) + if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.DSN)) ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.DSN) - ? "DSN feature set is supported and enabled" - : "DSN feature set is supported"); - if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.AMAC)) + ? "DSN feature set is supported and enabled" : "DSN feature set is supported"); + + if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.AMAC)) ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.AMAC) - ? "Accessible Max Address Configuration is supported and enabled" - : "Accessible Max Address Configuration is supported"); - if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.ExtPowerCond)) + ? "Accessible Max Address Configuration is supported and enabled" + : "Accessible Max Address Configuration is supported"); + + if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.ExtPowerCond)) ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.ExtPowerCond) - ? "Extended Power Conditions are supported and enabled" - : "Extended Power Conditions are supported"); - if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.ExtStatusReport)) + ? "Extended Power Conditions are supported and enabled" + : "Extended Power Conditions are supported"); + + if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.ExtStatusReport)) ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.ExtStatusReport) - ? "Extended Status Reporting is supported and enabled" - : "Extended Status Reporting is supported"); - if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.FreeFallControl)) + ? "Extended Status Reporting is supported and enabled" + : "Extended Status Reporting is supported"); + + if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.FreeFallControl)) ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.FreeFallControl) - ? "Free-fall control feature set is supported and enabled" - : "Free-fall control feature set is supported"); - if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.SegmentedDownloadMicrocode)) - ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4 - .SegmentedDownloadMicrocode) - ? "Segmented feature in DOWNLOAD MICROCODE is supported and enabled" - : "Segmented feature in DOWNLOAD MICROCODE is supported"); - if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.RWDMAExtGpl)) + ? "Free-fall control feature set is supported and enabled" + : "Free-fall control feature set is supported"); + + if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.SegmentedDownloadMicrocode)) + ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4. + SegmentedDownloadMicrocode) + ? "Segmented feature in DOWNLOAD MICROCODE is supported and enabled" + : "Segmented feature in DOWNLOAD MICROCODE is supported"); + + if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.RWDMAExtGpl)) ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.RWDMAExtGpl) - ? "READ/WRITE DMA EXT GPL are supported and enabled" - : "READ/WRITE DMA EXT GPL are supported"); - if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.WriteUnc)) + ? "READ/WRITE DMA EXT GPL are supported and enabled" + : "READ/WRITE DMA EXT GPL are supported"); + + if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.WriteUnc)) ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.WriteUnc) - ? "WRITE UNCORRECTABLE is supported and enabled" - : "WRITE UNCORRECTABLE is supported"); - if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.WRV)) + ? "WRITE UNCORRECTABLE is supported and enabled" + : "WRITE UNCORRECTABLE is supported"); + + if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.WRV)) { ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.WRV) - ? "Write/Read/Verify is supported and enabled" - : "Write/Read/Verify is supported"); + ? "Write/Read/Verify is supported and enabled" + : "Write/Read/Verify is supported"); + ataOneValue.Add($"{ataIdentify.WRVSectorCountMode2} sectors for Write/Read/Verify mode 2"); ataOneValue.Add($"{ataIdentify.WRVSectorCountMode3} sectors for Write/Read/Verify mode 3"); - if (ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.WRV)) + + if(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.WRV)) ataOneValue.Add($"Current Write/Read/Verify mode: {ataIdentify.WRVMode}"); } - if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.DT1825)) + if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.DT1825)) ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.DT1825) - ? "DT1825 is supported and enabled" - : "DT1825 is supported"); + ? "DT1825 is supported and enabled" : "DT1825 is supported"); } - if (true) + if(true) { - if (ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.BlockErase)) + if(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.BlockErase)) ataOneValue.Add("BLOCK ERASE EXT is supported"); - if (ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.Overwrite)) + + if(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.Overwrite)) ataOneValue.Add("OVERWRITE EXT is supported"); - if (ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.CryptoScramble)) + + if(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.CryptoScramble)) ataOneValue.Add("CRYPTO SCRAMBLE EXT is supported"); } - if (true) + if(true) { - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.DeviceConfDMA)) + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.DeviceConfDMA)) ataOneValue.Add("DEVICE CONFIGURATION IDENTIFY DMA and DEVICE CONFIGURATION SET DMA are supported"); - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ReadBufferDMA)) + + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ReadBufferDMA)) ataOneValue.Add("READ BUFFER DMA is supported"); - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.WriteBufferDMA)) + + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.WriteBufferDMA)) ataOneValue.Add("WRITE BUFFER DMA is supported"); - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.DownloadMicroCodeDMA)) + + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.DownloadMicroCodeDMA)) ataOneValue.Add("DOWNLOAD MICROCODE DMA is supported"); - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.SetMaxDMA)) + + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.SetMaxDMA)) ataOneValue.Add("SET PASSWORD DMA and SET UNLOCK DMA are supported"); - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.Ata28)) + + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.Ata28)) ataOneValue.Add("Not all 28-bit commands are supported"); - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.CFast)) + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.CFast)) ataOneValue.Add("Device follows CFast specification"); - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.IEEE1667)) + + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.IEEE1667)) ataOneValue.Add("Device follows IEEE-1667"); - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.DeterministicTrim)) + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.DeterministicTrim)) { ataOneValue.Add("Read after TRIM is deterministic"); - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ReadZeroTrim)) + + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ReadZeroTrim)) ataOneValue.Add("Read after TRIM returns empty data"); } - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.LongPhysSectorAligError)) + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.LongPhysSectorAligError)) ataOneValue.Add("Device supports Long Physical Sector Alignment Error Reporting Control"); - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.Encrypted)) + + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.Encrypted)) ataOneValue.Add("Device encrypts all user data"); - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.AllCacheNV)) + + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.AllCacheNV)) ataOneValue.Add("Device's write cache is non-volatile"); - if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ZonedBit0) || - ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ZonedBit1)) + + if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ZonedBit0) || + ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ZonedBit1)) ataOneValue.Add("Device is zoned"); } - if (true) - if (ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.Sanitize)) + if(true) + if(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.Sanitize)) { ataOneValue.Add("Sanitize feature set is supported"); - ataOneValue.Add(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.SanitizeCommands) - ? "Sanitize commands are specified by ACS-3 or higher" - : "Sanitize commands are specified by ACS-2"); - if (ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.SanitizeAntifreeze)) + ataOneValue.Add(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.SanitizeCommands) + ? "Sanitize commands are specified by ACS-3 or higher" + : "Sanitize commands are specified by ACS-2"); + + if(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.SanitizeAntifreeze)) ataOneValue.Add("SANITIZE ANTIFREEZE LOCK EXT is supported"); } - if (!ata1 && maxatalevel >= 8) - if (ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.Set) && - !ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.Clear) && - ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.TrustedComputing)) + if(!ata1 && + maxatalevel >= 8) + if(ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.Set) && + !ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.Clear) && + ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.TrustedComputing)) ataOneValue.Add("Trusted Computing feature set is supported"); - if ((ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0x1 || - (ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0xE) + if((ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0x1 || + (ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0xE) { - if (true) - if (!ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Clear)) - if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.ReadLogDMAExt)) + if(true) + if(!ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Clear)) + if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.ReadLogDMAExt)) ataOneValue.Add("READ LOG DMA EXT is supported"); - if (true) - if (!ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.Clear)) - if (ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.FPDMAQ)) + if(true) + if(!ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.Clear)) + if(ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.FPDMAQ)) ataOneValue.Add("RECEIVE FPDMA QUEUED and SEND FPDMA QUEUED are supported"); - if (true) - if (!ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.Clear)) + if(true) + if(!ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.Clear)) { - if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.NonZeroBufferOffset)) - ataOneValue.Add(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit - .NonZeroBufferOffset) - ? "Non-zero buffer offsets are supported and enabled" - : "Non-zero buffer offsets are supported"); - if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.DMASetup)) + if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.NonZeroBufferOffset)) + ataOneValue.Add(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit. + NonZeroBufferOffset) + ? "Non-zero buffer offsets are supported and enabled" + : "Non-zero buffer offsets are supported"); + + if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.DMASetup)) ataOneValue.Add(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.DMASetup) - ? "DMA Setup auto-activation is supported and enabled" - : "DMA Setup auto-activation is supported"); - if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.InitPowerMgmt)) - ataOneValue.Add(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit - .InitPowerMgmt) - ? "Device-initiated power management is supported and enabled" - : "Device-initiated power management is supported"); - if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.InOrderData)) - ataOneValue.Add(ataIdentify.EnabledSATAFeatures - .HasFlag(Identify.SATAFeaturesBit.InOrderData) - ? "In-order data delivery is supported and enabled" - : "In-order data delivery is supported"); - if (!atapi) - if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.HardwareFeatureControl)) - ataOneValue.Add(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit - .HardwareFeatureControl) - ? "Hardware Feature Control is supported and enabled" - : "Hardware Feature Control is supported"); - if (atapi) - if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.AsyncNotification)) - if (ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.AsyncNotification)) + ? "DMA Setup auto-activation is supported and enabled" + : "DMA Setup auto-activation is supported"); + + if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.InitPowerMgmt)) + ataOneValue.Add(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit. + InitPowerMgmt) + ? "Device-initiated power management is supported and enabled" + : "Device-initiated power management is supported"); + + if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.InOrderData)) + ataOneValue.Add(ataIdentify. + EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.InOrderData) + ? "In-order data delivery is supported and enabled" + : "In-order data delivery is supported"); + + if(!atapi) + if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.HardwareFeatureControl)) + ataOneValue.Add(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit. + HardwareFeatureControl) + ? "Hardware Feature Control is supported and enabled" + : "Hardware Feature Control is supported"); + + if(atapi) + if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.AsyncNotification)) + if(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.AsyncNotification)) ataOneValue.Add("Asynchronous notification is supported"); else ataOneValue.Add("Asynchronous notification is supported"); - if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.SettingsPreserve)) - if (ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.SettingsPreserve)) + + if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.SettingsPreserve)) + if(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.SettingsPreserve)) ataOneValue.Add("Software Settings Preservation is supported"); else ataOneValue.Add("Software Settings Preservation is supported"); - if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.NCQAutoSense)) + + if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.NCQAutoSense)) ataOneValue.Add("NCQ Autosense is supported"); - if (ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.EnabledSlumber)) + + if(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.EnabledSlumber)) ataOneValue.Add("Automatic Partial to Slumber transitions are enabled"); } } - if ((ataIdentify.RemovableStatusSet & 0x03) > 0) + if((ataIdentify.RemovableStatusSet & 0x03) > 0) ataOneValue.Add("Removable Media Status Notification feature set is supported"); - if (ataIdentify.FreeFallSensitivity != 0x00 && ataIdentify.FreeFallSensitivity != 0xFF) + if(ataIdentify.FreeFallSensitivity != 0x00 && + ataIdentify.FreeFallSensitivity != 0xFF) ataOneValue.Add($"Free-fall sensitivity set to {ataIdentify.FreeFallSensitivity}"); - if (ataIdentify.DataSetMgmt.HasFlag(Identify.DataSetMgmtBit.Trim)) ataOneValue.Add("TRIM is supported"); - if (ataIdentify.DataSetMgmtSize > 0) - ataOneValue.Add( - $"DATA SET MANAGEMENT can receive a maximum of {ataIdentify.DataSetMgmtSize} blocks of 512 bytes"); + if(ataIdentify.DataSetMgmt.HasFlag(Identify.DataSetMgmtBit.Trim)) + ataOneValue.Add("TRIM is supported"); - if (ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Supported)) + if(ataIdentify.DataSetMgmtSize > 0) + ataOneValue. + Add($"DATA SET MANAGEMENT can receive a maximum of {ataIdentify.DataSetMgmtSize} blocks of 512 bytes"); + + if(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Supported)) { ataOneValue.Add("Security:"); - if (ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Enabled)) + + if(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Enabled)) { ataOneValue.Add("Security is enabled"); + ataOneValue.Add(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Locked) - ? "Security is locked" - : "Security is not locked"); + ? "Security is locked" : "Security is not locked"); ataOneValue.Add(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Frozen) - ? "Security is frozen" - : "Security is not frozen"); + ? "Security is frozen" : "Security is not frozen"); ataOneValue.Add(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Expired) - ? "Security count has expired" - : "Security count has notexpired"); + ? "Security count has expired" : "Security count has notexpired"); ataOneValue.Add(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Maximum) - ? "Security level is maximum" - : "Security level is high"); + ? "Security level is maximum" : "Security level is high"); } else { ataOneValue.Add("Security is not enabled"); } - if (ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Enhanced)) + if(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Enhanced)) ataOneValue.Add("Supports enhanced security erase"); ataOneValue.Add($"{ataIdentify.SecurityEraseTime * 2} minutes to complete secure erase"); - if (ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Enhanced)) - ataOneValue - .Add($"{ataIdentify.EnhancedSecurityEraseTime * 2} minutes to complete enhanced secure erase"); + + if(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Enhanced)) + ataOneValue. + Add($"{ataIdentify.EnhancedSecurityEraseTime * 2} minutes to complete enhanced secure erase"); ataOneValue.Add($"Master password revision code: {ataIdentify.MasterPasswordRevisionCode}"); } - if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeSet) && - !ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeClear) && - ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.Streaming)) + if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeSet) && + !ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeClear) && + ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.Streaming)) { ataOneValue.Add("Streaming:"); ataOneValue.Add($"Minimum request size is {ataIdentify.StreamMinReqSize}"); @@ -1335,30 +1634,36 @@ namespace DiscImageChef.Server ataOneValue.Add($"Streaming performance granularity is {ataIdentify.StreamPerformanceGranularity}"); } - if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.Supported)) + if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.Supported)) { ataOneValue.Add("S.M.A.R.T. Command Transport (SCT):"); - if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.LongSectorAccess)) + + if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.LongSectorAccess)) ataOneValue.Add("SCT Long Sector Address is supported"); - if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.WriteSame)) + + if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.WriteSame)) ataOneValue.Add("SCT Write Same is supported"); - if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.ErrorRecoveryControl)) + + if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.ErrorRecoveryControl)) ataOneValue.Add("SCT Error Recovery Control is supported"); - if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.FeaturesControl)) + + if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.FeaturesControl)) ataOneValue.Add("SCT Features Control is supported"); - if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.DataTables)) + + if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.DataTables)) ataOneValue.Add("SCT Data Tables are supported"); } - if ((ataIdentify.NVCacheCaps & 0x0010) == 0x0010) + if((ataIdentify.NVCacheCaps & 0x0010) == 0x0010) { ataOneValue.Add("Non-Volatile Cache:"); ataOneValue.Add($"Version {(ataIdentify.NVCacheCaps & 0xF000) >> 12}"); - if ((ataIdentify.NVCacheCaps & 0x0001) == 0x0001) + + if((ataIdentify.NVCacheCaps & 0x0001) == 0x0001) { ataOneValue.Add((ataIdentify.NVCacheCaps & 0x0002) == 0x0002 - ? "Power mode feature set is supported and enabled" - : "Power mode feature set is supported"); + ? "Power mode feature set is supported and enabled" + : "Power mode feature set is supported"); ataOneValue.Add($"Version {(ataIdentify.NVCacheCaps & 0x0F00) >> 8}"); } @@ -1366,149 +1671,168 @@ namespace DiscImageChef.Server ataOneValue.Add($"Non-Volatile Cache is {ataIdentify.NVCacheSize * logicalsectorsize} bytes"); } - if (ataReport.ReadCapabilities != null) + if(ataReport.ReadCapabilities != null) { removable = false; ataOneValue.Add(""); - if (ataReport.ReadCapabilities.NominalRotationRate != null && - ataReport.ReadCapabilities.NominalRotationRate != 0x0000 && - ataReport.ReadCapabilities.NominalRotationRate != 0xFFFF) - ataOneValue.Add(ataReport.ReadCapabilities.NominalRotationRate == 0x0001 - ? "Device does not rotate." - : $"Device rotates at {ataReport.ReadCapabilities.NominalRotationRate} rpm"); + if(ataReport.ReadCapabilities.NominalRotationRate != null && + ataReport.ReadCapabilities.NominalRotationRate != 0x0000 && + ataReport.ReadCapabilities.NominalRotationRate != 0xFFFF) + ataOneValue.Add(ataReport.ReadCapabilities.NominalRotationRate == 0x0001 ? "Device does not rotate." + : $"Device rotates at {ataReport.ReadCapabilities.NominalRotationRate} rpm"); - if (!atapi) + if(!atapi) { - if (ataReport.ReadCapabilities.BlockSize != null) + if(ataReport.ReadCapabilities.BlockSize != null) { ataTwoValue.Add("Logical sector size", $"{ataReport.ReadCapabilities.BlockSize} bytes"); logicalsectorsize = ataReport.ReadCapabilities.BlockSize.Value; } - if (ataReport.ReadCapabilities.PhysicalBlockSize != null) + if(ataReport.ReadCapabilities.PhysicalBlockSize != null) ataTwoValue.Add("Physical sector size", - $"{ataReport.ReadCapabilities.PhysicalBlockSize} bytes"); - if (ataReport.ReadCapabilities.LongBlockSize != null) + $"{ataReport.ReadCapabilities.PhysicalBlockSize} bytes"); + + if(ataReport.ReadCapabilities.LongBlockSize != null) ataTwoValue.Add("READ LONG sector size", $"{ataReport.ReadCapabilities.LongBlockSize} bytes"); - if (ataReport.ReadCapabilities.BlockSize != null && - ataReport.ReadCapabilities.PhysicalBlockSize != null && - ataReport.ReadCapabilities.BlockSize.Value != - ataReport.ReadCapabilities.PhysicalBlockSize.Value && - (ataReport.ReadCapabilities.LogicalAlignment & 0x8000) == 0x0000 && - (ataReport.ReadCapabilities.LogicalAlignment & 0x4000) == 0x4000) - ataOneValue - .Add( - $"Logical sector starts at offset {ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF} from physical sector"); + if(ataReport.ReadCapabilities.BlockSize != null && + ataReport.ReadCapabilities.PhysicalBlockSize != null && + ataReport.ReadCapabilities.BlockSize.Value != + ataReport.ReadCapabilities.PhysicalBlockSize.Value && + (ataReport.ReadCapabilities.LogicalAlignment & 0x8000) == 0x0000 && + (ataReport.ReadCapabilities.LogicalAlignment & 0x4000) == 0x4000) + ataOneValue. + Add($"Logical sector starts at offset {ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF} from physical sector"); - if (ataReport.ReadCapabilities.CHS != null && ataReport.ReadCapabilities.CurrentCHS != null) + if(ataReport.ReadCapabilities.CHS != null && + ataReport.ReadCapabilities.CurrentCHS != null) { - var currentSectors = ataReport.ReadCapabilities.CurrentCHS.Cylinders * - ataReport.ReadCapabilities.CurrentCHS.Heads * + int currentSectors = ataReport.ReadCapabilities.CurrentCHS.Cylinders * + ataReport.ReadCapabilities.CurrentCHS.Heads * ataReport.ReadCapabilities.CurrentCHS.Sectors; + ataTwoValue.Add("Cylinders", - $"{ataReport.ReadCapabilities.CHS.Cylinders} max., {ataReport.ReadCapabilities.CurrentCHS.Cylinders} current"); + $"{ataReport.ReadCapabilities.CHS.Cylinders} max., {ataReport.ReadCapabilities.CurrentCHS.Cylinders} current"); + ataTwoValue.Add("Heads", - $"{ataReport.ReadCapabilities.CHS.Heads} max., {ataReport.ReadCapabilities.CurrentCHS.Heads} current"); + $"{ataReport.ReadCapabilities.CHS.Heads} max., {ataReport.ReadCapabilities.CurrentCHS.Heads} current"); + ataTwoValue.Add("Sectors per track", - $"{ataReport.ReadCapabilities.CHS.Sectors} max., {ataReport.ReadCapabilities.CurrentCHS.Sectors} current"); + $"{ataReport.ReadCapabilities.CHS.Sectors} max., {ataReport.ReadCapabilities.CurrentCHS.Sectors} current"); + ataTwoValue.Add("Sectors addressable in CHS mode", - $"{ataReport.ReadCapabilities.CHS.Cylinders * ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors} max., {currentSectors} current"); + $"{ataReport.ReadCapabilities.CHS.Cylinders * ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors} max., {currentSectors} current"); + ataTwoValue.Add("Device size in CHS mode", - $"{(ulong) currentSectors * logicalsectorsize} bytes, {(ulong) currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double) ((ulong) currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); + $"{(ulong)currentSectors * logicalsectorsize} bytes, {(ulong)currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); } - else if (ataReport.ReadCapabilities.CHS != null) + else if(ataReport.ReadCapabilities.CHS != null) { - var currentSectors = ataReport.ReadCapabilities.CHS.Cylinders * - ataReport.ReadCapabilities.CHS.Heads * + int currentSectors = ataReport.ReadCapabilities.CHS.Cylinders * + ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors; - ataTwoValue.Add("Cylinders", - $"{ataReport.ReadCapabilities.CHS.Cylinders}"); + + ataTwoValue.Add("Cylinders", $"{ataReport.ReadCapabilities.CHS.Cylinders}"); ataTwoValue.Add("Heads", $"{ataReport.ReadCapabilities.CHS.Heads}"); ataTwoValue.Add("Sectors per track", $"{ataReport.ReadCapabilities.CHS.Sectors}"); ataTwoValue.Add("Sectors addressable in CHS mode", $"{currentSectors}"); + ataTwoValue.Add("Device size in CHS mode", - $"{(ulong) currentSectors * logicalsectorsize} bytes, {(ulong) currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double) ((ulong) currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); + $"{(ulong)currentSectors * logicalsectorsize} bytes, {(ulong)currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); } - if (ataReport.ReadCapabilities.LBASectors != null) + if(ataReport.ReadCapabilities.LBASectors != null) { ataTwoValue.Add("Sectors addressable in sectors in 28-bit LBA mode", - $"{ataReport.ReadCapabilities.LBASectors}"); + $"{ataReport.ReadCapabilities.LBASectors}"); - if ((ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1024 / 1024 > 1000000) + if((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1024 / 1024 > 1000000) ataTwoValue.Add("Device size in 28-bit LBA mode", - $"{(ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000} Tb, {(double) ((ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); - else if ((ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1024 / 1024 > 1000) + $"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000} Tb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); + else if((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1024 / 1024 > 1000) ataTwoValue.Add("Device size in 28-bit LBA mode", - $"{(ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000 / 1000} Gb, {(double) ((ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024:F2} GiB"); + $"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000 / 1000} Gb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024:F2} GiB"); else ataTwoValue.Add("Device size in 28-bit LBA mode", - $"{(ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000} Mb, {(double) ((ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); + $"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000} Mb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); } - if (ataReport.ReadCapabilities.LBA48Sectors != null) + if(ataReport.ReadCapabilities.LBA48Sectors != null) { ataTwoValue.Add("Sectors addressable in sectors in 48-bit LBA mode", - $"{ataReport.ReadCapabilities.LBA48Sectors}"); + $"{ataReport.ReadCapabilities.LBA48Sectors}"); - if (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000000) + if(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000000) ataTwoValue.Add("Device size in 48-bit LBA mode", - $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000} Tb, {(double) (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); - else if (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000) + $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); + else if(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000) ataTwoValue.Add("Device size in 48-bit LBA mode", - $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000 / 1000} Gb, {(double) (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024:F2} GiB"); + $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000 / 1000} Gb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024:F2} GiB"); else ataTwoValue.Add("Device size in 48-bit LBA mode", - $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000} Mb, {(double) (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); + $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000} Mb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); } - if (ata1 || cfa) + if(ata1 || cfa) { - if (ataReport.ReadCapabilities.UnformattedBPT > 0) + if(ataReport.ReadCapabilities.UnformattedBPT > 0) ataTwoValue.Add("Bytes per unformatted track", - $"{ataReport.ReadCapabilities.UnformattedBPT}"); - if (ataReport.ReadCapabilities.UnformattedBPS > 0) + $"{ataReport.ReadCapabilities.UnformattedBPT}"); + + if(ataReport.ReadCapabilities.UnformattedBPS > 0) ataTwoValue.Add("Bytes per unformatted sector", - $"{ataReport.ReadCapabilities.UnformattedBPS}"); + $"{ataReport.ReadCapabilities.UnformattedBPS}"); } } - if (ataReport.ReadCapabilities.SupportsReadSectors == true) + if(ataReport.ReadCapabilities.SupportsReadSectors == true) ataOneValue.Add("Device supports READ SECTOR(S) command in CHS mode"); - if (ataReport.ReadCapabilities.SupportsReadRetry == true) + + if(ataReport.ReadCapabilities.SupportsReadRetry == true) ataOneValue.Add("Device supports READ SECTOR(S) RETRY command in CHS mode"); - if (ataReport.ReadCapabilities.SupportsReadDma == true) + + if(ataReport.ReadCapabilities.SupportsReadDma == true) ataOneValue.Add("Device supports READ DMA command in CHS mode"); - if (ataReport.ReadCapabilities.SupportsReadDmaRetry == true) + + if(ataReport.ReadCapabilities.SupportsReadDmaRetry == true) ataOneValue.Add("Device supports READ DMA RETRY command in CHS mode"); - if (ataReport.ReadCapabilities.SupportsReadLong == true) + + if(ataReport.ReadCapabilities.SupportsReadLong == true) ataOneValue.Add("Device supports READ LONG command in CHS mode"); - if (ataReport.ReadCapabilities.SupportsReadLongRetry == true) + + if(ataReport.ReadCapabilities.SupportsReadLongRetry == true) ataOneValue.Add("Device supports READ LONG RETRY command in CHS mode"); - if (ataReport.ReadCapabilities.SupportsReadLba == true) + if(ataReport.ReadCapabilities.SupportsReadLba == true) ataOneValue.Add("Device supports READ SECTOR(S) command in 28-bit LBA mode"); - if (ataReport.ReadCapabilities.SupportsReadRetryLba == true) + + if(ataReport.ReadCapabilities.SupportsReadRetryLba == true) ataOneValue.Add("Device supports READ SECTOR(S) RETRY command in 28-bit LBA mode"); - if (ataReport.ReadCapabilities.SupportsReadDmaLba == true) + + if(ataReport.ReadCapabilities.SupportsReadDmaLba == true) ataOneValue.Add("Device supports READ DMA command in 28-bit LBA mode"); - if (ataReport.ReadCapabilities.SupportsReadDmaRetryLba == true) + + if(ataReport.ReadCapabilities.SupportsReadDmaRetryLba == true) ataOneValue.Add("Device supports READ DMA RETRY command in 28-bit LBA mode"); - if (ataReport.ReadCapabilities.SupportsReadLongLba == true) + + if(ataReport.ReadCapabilities.SupportsReadLongLba == true) ataOneValue.Add("Device supports READ LONG command in 28-bit LBA mode"); - if (ataReport.ReadCapabilities.SupportsReadLongRetryLba == true) + + if(ataReport.ReadCapabilities.SupportsReadLongRetryLba == true) ataOneValue.Add("Device supports READ LONG RETRY command in 28-bit LBA mode"); - if (ataReport.ReadCapabilities.SupportsReadLba48 == true) + if(ataReport.ReadCapabilities.SupportsReadLba48 == true) ataOneValue.Add("Device supports READ SECTOR(S) command in 48-bit LBA mode"); - if (ataReport.ReadCapabilities.SupportsReadDmaLba48 == true) + + if(ataReport.ReadCapabilities.SupportsReadDmaLba48 == true) ataOneValue.Add("Device supports READ DMA command in 48-bit LBA mode"); - if (ataReport.ReadCapabilities.SupportsSeek == true) + if(ataReport.ReadCapabilities.SupportsSeek == true) ataOneValue.Add("Device supports SEEK command in CHS mode"); - if (ataReport.ReadCapabilities.SupportsSeekLba == true) + + if(ataReport.ReadCapabilities.SupportsSeekLba == true) ataOneValue.Add("Device supports SEEK command in 28-bit LBA mode"); } else diff --git a/DiscImageChef.Server/App_Start/ScsiEvpd.cs b/DiscImageChef.Server/App_Start/ScsiEvpd.cs index dc3092d2..d30d063a 100644 --- a/DiscImageChef.Server/App_Start/ScsiEvpd.cs +++ b/DiscImageChef.Server/App_Start/ScsiEvpd.cs @@ -39,52 +39,72 @@ namespace DiscImageChef.Server public static class ScsiEvpd { /// - /// Takes the SCSI EVPD part of a device report and prints it as a list key=value pairs to be sequenced by ASP.NET in - /// the rendering + /// Takes the SCSI EVPD part of a device report and prints it as a list key=value pairs to be sequenced by ASP.NET + /// in the rendering /// /// EVPD pages /// SCSI vendor string /// List to put the key=value pairs on public static void Report(IEnumerable pages, string vendor, ref Dictionary evpdPages) { - foreach (var evpd in pages) + foreach(ScsiPage evpd in pages) { string decoded; - if (evpd.page >= 0x01 && evpd.page <= 0x7F) decoded = EVPD.DecodeASCIIPage(evpd.value); - else if (evpd.page == 0x81) decoded = EVPD.PrettifyPage_81(evpd.value); - else if (evpd.page == 0x82) decoded = EVPD.DecodePage82(evpd.value); - else if (evpd.page == 0x83) decoded = EVPD.PrettifyPage_83(evpd.value); - else if (evpd.page == 0x84) decoded = EVPD.PrettifyPage_84(evpd.value); - else if (evpd.page == 0x85) decoded = EVPD.PrettifyPage_85(evpd.value); - else if (evpd.page == 0x86) decoded = EVPD.PrettifyPage_86(evpd.value); - else if (evpd.page == 0x89) decoded = EVPD.PrettifyPage_89(evpd.value); - else if (evpd.page == 0xB0) decoded = EVPD.PrettifyPage_B0(evpd.value); - else if (evpd.page == 0xB2) - decoded = - $"TapeAlert Supported Flags Bitmap: 0x{EVPD.DecodePageB2(evpd.value):X16}
"; - else if (evpd.page == 0xB4) decoded = EVPD.DecodePageB4(evpd.value); - else if (evpd.page == 0xC0 && vendor.Trim() == "quantum") - decoded = EVPD.PrettifyPage_C0_Quantum(evpd.value); - else if (evpd.page == 0xC0 && vendor.Trim() == "seagate") - decoded = - EVPD.PrettifyPage_C0_Seagate(evpd.value); - else if (evpd.page == 0xC0 && vendor.Trim() == "ibm") - decoded = EVPD.PrettifyPage_C0_IBM(evpd.value); - else if (evpd.page == 0xC1 && vendor.Trim() == "ibm") - decoded = EVPD.PrettifyPage_C1_IBM(evpd.value); - else if ((evpd.page == 0xC0 || evpd.page == 0xC1) && vendor.Trim() == "certance") - decoded = EVPD.PrettifyPage_C0_C1_Certance(evpd.value); - else if ((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 || - evpd.page == 0xC6) && - vendor.Trim() == "certance") decoded = EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(evpd.value); - else if ((evpd.page == 0xC0 || evpd.page == 0xC1 || evpd.page == 0xC2 || evpd.page == 0xC3 || - evpd.page == 0xC4 || evpd.page == 0xC5) && - vendor.Trim() == "hp") decoded = EVPD.PrettifyPage_C0_to_C5_HP(evpd.value); - else if (evpd.page == 0xDF && vendor.Trim() == "certance") - decoded = EVPD.PrettifyPage_DF_Certance(evpd.value); - else decoded = "Undecoded"; - if (!string.IsNullOrEmpty(decoded)) decoded = decoded.Replace("\n", "
"); + if(evpd.page >= 0x01 && + evpd.page <= 0x7F) + decoded = EVPD.DecodeASCIIPage(evpd.value); + else if(evpd.page == 0x81) + decoded = EVPD.PrettifyPage_81(evpd.value); + else if(evpd.page == 0x82) + decoded = EVPD.DecodePage82(evpd.value); + else if(evpd.page == 0x83) + decoded = EVPD.PrettifyPage_83(evpd.value); + else if(evpd.page == 0x84) + decoded = EVPD.PrettifyPage_84(evpd.value); + else if(evpd.page == 0x85) + decoded = EVPD.PrettifyPage_85(evpd.value); + else if(evpd.page == 0x86) + decoded = EVPD.PrettifyPage_86(evpd.value); + else if(evpd.page == 0x89) + decoded = EVPD.PrettifyPage_89(evpd.value); + else if(evpd.page == 0xB0) + decoded = EVPD.PrettifyPage_B0(evpd.value); + else if(evpd.page == 0xB2) + decoded = $"TapeAlert Supported Flags Bitmap: 0x{EVPD.DecodePageB2(evpd.value):X16}
"; + else if(evpd.page == 0xB4) + decoded = EVPD.DecodePageB4(evpd.value); + else if(evpd.page == 0xC0 && + vendor.Trim() == "quantum") + decoded = EVPD.PrettifyPage_C0_Quantum(evpd.value); + else if(evpd.page == 0xC0 && + vendor.Trim() == "seagate") + decoded = EVPD.PrettifyPage_C0_Seagate(evpd.value); + else if(evpd.page == 0xC0 && + vendor.Trim() == "ibm") + decoded = EVPD.PrettifyPage_C0_IBM(evpd.value); + else if(evpd.page == 0xC1 && + vendor.Trim() == "ibm") + decoded = EVPD.PrettifyPage_C1_IBM(evpd.value); + else if((evpd.page == 0xC0 || evpd.page == 0xC1) && + vendor.Trim() == "certance") + decoded = EVPD.PrettifyPage_C0_C1_Certance(evpd.value); + else if((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 || + evpd.page == 0xC6) && + vendor.Trim() == "certance") + decoded = EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(evpd.value); + else if((evpd.page == 0xC0 || evpd.page == 0xC1 || evpd.page == 0xC2 || evpd.page == 0xC3 || + evpd.page == 0xC4 || evpd.page == 0xC5) && + vendor.Trim() == "hp") + decoded = EVPD.PrettifyPage_C0_to_C5_HP(evpd.value); + else if(evpd.page == 0xDF && + vendor.Trim() == "certance") + decoded = EVPD.PrettifyPage_DF_Certance(evpd.value); + else + decoded = "Undecoded"; + + if(!string.IsNullOrEmpty(decoded)) + decoded = decoded.Replace("\n", "
"); evpdPages.Add($"EVPD page {evpd.page:X2}h", decoded); } diff --git a/DiscImageChef.Server/App_Start/ScsiInquiry.cs b/DiscImageChef.Server/App_Start/ScsiInquiry.cs index c481b89b..ba9b1be5 100644 --- a/DiscImageChef.Server/App_Start/ScsiInquiry.cs +++ b/DiscImageChef.Server/App_Start/ScsiInquiry.cs @@ -38,877 +38,1187 @@ namespace DiscImageChef.Server internal static class ScsiInquiry { /// - /// Takes the SCSI INQUIRY part of a device report and prints it as a list of values to be sequenced by ASP.NET in the - /// rendering + /// Takes the SCSI INQUIRY part of a device report and prints it as a list of values to be sequenced by ASP.NET in + /// the rendering /// /// INQUIRY part of the report /// List of values internal static IEnumerable Report(Inquiry.SCSIInquiry? inquiryNullable) { - var scsiOneValue = new List(); + List scsiOneValue = new List(); - if (!inquiryNullable.HasValue) return scsiOneValue; + if(!inquiryNullable.HasValue) + return scsiOneValue; - var inquiry = inquiryNullable.Value; + Inquiry.SCSIInquiry inquiry = inquiryNullable.Value; - switch ((PeripheralQualifiers) inquiry.PeripheralQualifier) + switch((PeripheralQualifiers)inquiry.PeripheralQualifier) { case PeripheralQualifiers.Supported: scsiOneValue.Add("Device is connected and supported."); + break; case PeripheralQualifiers.Unconnected: scsiOneValue.Add("Device is supported but not connected."); + break; case PeripheralQualifiers.Reserved: scsiOneValue.Add("Reserved value set in Peripheral Qualifier field."); + break; case PeripheralQualifiers.Unsupported: scsiOneValue.Add("Device is connected but unsupported."); + break; default: scsiOneValue.Add($"Vendor value {inquiry.PeripheralQualifier} set in Peripheral Qualifier field."); + break; } - switch ((PeripheralDeviceTypes) inquiry.PeripheralDeviceType) + switch((PeripheralDeviceTypes)inquiry.PeripheralDeviceType) { case PeripheralDeviceTypes.DirectAccess: //0x00, scsiOneValue.Add("Direct-access device"); + break; case PeripheralDeviceTypes.SequentialAccess: //0x01, scsiOneValue.Add("Sequential-access device"); + break; case PeripheralDeviceTypes.PrinterDevice: //0x02, scsiOneValue.Add("Printer device"); + break; case PeripheralDeviceTypes.ProcessorDevice: //0x03, scsiOneValue.Add("Processor device"); + break; case PeripheralDeviceTypes.WriteOnceDevice: //0x04, scsiOneValue.Add("Write-once device"); + break; case PeripheralDeviceTypes.MultiMediaDevice: //0x05, scsiOneValue.Add("CD-ROM/DVD/etc device"); + break; case PeripheralDeviceTypes.ScannerDevice: //0x06, scsiOneValue.Add("Scanner device"); + break; case PeripheralDeviceTypes.OpticalDevice: //0x07, scsiOneValue.Add("Optical memory device"); + break; case PeripheralDeviceTypes.MediumChangerDevice: //0x08, scsiOneValue.Add("Medium change device"); + break; case PeripheralDeviceTypes.CommsDevice: //0x09, scsiOneValue.Add("Communications device"); + break; case PeripheralDeviceTypes.PrePressDevice1: //0x0A, scsiOneValue.Add("Graphics arts pre-press device (defined in ASC IT8)"); + break; case PeripheralDeviceTypes.PrePressDevice2: //0x0B, scsiOneValue.Add("Graphics arts pre-press device (defined in ASC IT8)"); + break; case PeripheralDeviceTypes.ArrayControllerDevice: //0x0C, scsiOneValue.Add("Array controller device"); + break; case PeripheralDeviceTypes.EnclosureServiceDevice: //0x0D, scsiOneValue.Add("Enclosure services device"); + break; case PeripheralDeviceTypes.SimplifiedDevice: //0x0E, scsiOneValue.Add("Simplified direct-access device"); + break; case PeripheralDeviceTypes.OCRWDevice: //0x0F, scsiOneValue.Add("Optical card reader/writer device"); + break; case PeripheralDeviceTypes.BridgingExpander: //0x10, scsiOneValue.Add("Bridging Expanders"); + break; case PeripheralDeviceTypes.ObjectDevice: //0x11, scsiOneValue.Add("Object-based Storage Device"); + break; case PeripheralDeviceTypes.ADCDevice: //0x12, scsiOneValue.Add("Automation/Drive Interface"); + break; case PeripheralDeviceTypes.SCSISecurityManagerDevice: //0x13, scsiOneValue.Add("Security Manager Device"); + break; case PeripheralDeviceTypes.SCSIZonedBlockDevice: //0x14 scsiOneValue.Add("Host managed zoned block device"); + break; case PeripheralDeviceTypes.WellKnownDevice: //0x1E, scsiOneValue.Add("Well known logical unit"); + break; case PeripheralDeviceTypes.UnknownDevice: //0x1F scsiOneValue.Add("Unknown or no device type"); + break; default: scsiOneValue.Add($"Unknown device type field value 0x{inquiry.PeripheralDeviceType:X2}"); + break; } - switch ((ANSIVersions) inquiry.ANSIVersion) + switch((ANSIVersions)inquiry.ANSIVersion) { case ANSIVersions.ANSINoVersion: scsiOneValue.Add("Device does not claim to comply with any SCSI ANSI standard"); + break; case ANSIVersions.ANSI1986Version: scsiOneValue.Add("Device claims to comply with ANSI X3.131:1986 (SCSI-1)"); + break; case ANSIVersions.ANSI1994Version: scsiOneValue.Add("Device claims to comply with ANSI X3.131:1994 (SCSI-2)"); + break; case ANSIVersions.ANSI1997Version: scsiOneValue.Add("Device claims to comply with ANSI X3.301:1997 (SPC-1)"); + break; case ANSIVersions.ANSI2001Version: scsiOneValue.Add("Device claims to comply with ANSI X3.351:2001 (SPC-2)"); + break; case ANSIVersions.ANSI2005Version: scsiOneValue.Add("Device claims to comply with ANSI X3.408:2005 (SPC-3)"); + break; case ANSIVersions.ANSI2008Version: scsiOneValue.Add("Device claims to comply with ANSI X3.408:2005 (SPC-4)"); + break; default: - scsiOneValue - .Add( - $"Device claims to comply with unknown SCSI ANSI standard value 0x{inquiry.ANSIVersion:X2})"); + scsiOneValue. + Add($"Device claims to comply with unknown SCSI ANSI standard value 0x{inquiry.ANSIVersion:X2})"); + break; } - switch ((ECMAVersions) inquiry.ECMAVersion) + switch((ECMAVersions)inquiry.ECMAVersion) { case ECMAVersions.ECMANoVersion: scsiOneValue.Add("Device does not claim to comply with any SCSI ECMA standard"); + break; case ECMAVersions.ECMA111: scsiOneValue.Add("Device claims to comply ECMA-111: Small Computer System Interface SCSI"); + break; default: - scsiOneValue - .Add( - $"Device claims to comply with unknown SCSI ECMA standard value 0x{inquiry.ECMAVersion:X2})"); + scsiOneValue. + Add($"Device claims to comply with unknown SCSI ECMA standard value 0x{inquiry.ECMAVersion:X2})"); + break; } - switch ((ISOVersions) inquiry.ISOVersion) + switch((ISOVersions)inquiry.ISOVersion) { case ISOVersions.ISONoVersion: scsiOneValue.Add("Device does not claim to comply with any SCSI ISO/IEC standard"); + break; case ISOVersions.ISO1995Version: scsiOneValue.Add("Device claims to comply with ISO/IEC 9316:1995"); + break; default: - scsiOneValue - .Add( - $"Device claims to comply with unknown SCSI ISO/IEC standard value 0x{inquiry.ISOVersion:X2})"); + scsiOneValue. + Add($"Device claims to comply with unknown SCSI ISO/IEC standard value 0x{inquiry.ISOVersion:X2})"); + break; } - if (inquiry.RMB) scsiOneValue.Add("Device is removable"); - if (inquiry.AERC) scsiOneValue.Add("Device supports Asynchronous Event Reporting Capability"); - if (inquiry.TrmTsk) scsiOneValue.Add("Device supports TERMINATE TASK command"); - if (inquiry.NormACA) scsiOneValue.Add("Device supports setting Normal ACA"); - if (inquiry.HiSup) scsiOneValue.Add("Device supports LUN hierarchical addressing"); - if (inquiry.SCCS) scsiOneValue.Add("Device contains an embedded storage array controller"); - if (inquiry.ACC) scsiOneValue.Add("Device contains an Access Control Coordinator"); - if (inquiry.ThreePC) scsiOneValue.Add("Device supports third-party copy commands"); - if (inquiry.Protect) scsiOneValue.Add("Device supports protection information"); - if (inquiry.BQue) scsiOneValue.Add("Device supports basic queueing"); - if (inquiry.EncServ) scsiOneValue.Add("Device contains an embedded enclosure services component"); - if (inquiry.MultiP) scsiOneValue.Add("Multi-port device"); - if (inquiry.MChngr) scsiOneValue.Add("Device contains or is attached to a medium changer"); - if (inquiry.ACKREQQ) scsiOneValue.Add("Device supports request and acknowledge handshakes"); - if (inquiry.Addr32) scsiOneValue.Add("Device supports 32-bit wide SCSI addresses"); - if (inquiry.Addr16) scsiOneValue.Add("Device supports 16-bit wide SCSI addresses"); - if (inquiry.RelAddr) scsiOneValue.Add("Device supports relative addressing"); - if (inquiry.WBus32) scsiOneValue.Add("Device supports 32-bit wide data transfers"); - if (inquiry.WBus16) scsiOneValue.Add("Device supports 16-bit wide data transfers"); - if (inquiry.Sync) scsiOneValue.Add("Device supports synchronous data transfer"); - if (inquiry.Linked) scsiOneValue.Add("Device supports linked commands"); - if (inquiry.TranDis) scsiOneValue.Add("Device supports CONTINUE TASK and TARGET TRANSFER DISABLE commands"); - if (inquiry.QAS) scsiOneValue.Add("Device supports Quick Arbitration and Selection"); - if (inquiry.CmdQue) scsiOneValue.Add("Device supports TCQ queue"); - if (inquiry.IUS) scsiOneValue.Add("Device supports information unit transfers"); - if (inquiry.SftRe) scsiOneValue.Add("Device implements RESET as a soft reset"); + if(inquiry.RMB) + scsiOneValue.Add("Device is removable"); - switch ((TGPSValues) inquiry.TPGS) + if(inquiry.AERC) + scsiOneValue.Add("Device supports Asynchronous Event Reporting Capability"); + + if(inquiry.TrmTsk) + scsiOneValue.Add("Device supports TERMINATE TASK command"); + + if(inquiry.NormACA) + scsiOneValue.Add("Device supports setting Normal ACA"); + + if(inquiry.HiSup) + scsiOneValue.Add("Device supports LUN hierarchical addressing"); + + if(inquiry.SCCS) + scsiOneValue.Add("Device contains an embedded storage array controller"); + + if(inquiry.ACC) + scsiOneValue.Add("Device contains an Access Control Coordinator"); + + if(inquiry.ThreePC) + scsiOneValue.Add("Device supports third-party copy commands"); + + if(inquiry.Protect) + scsiOneValue.Add("Device supports protection information"); + + if(inquiry.BQue) + scsiOneValue.Add("Device supports basic queueing"); + + if(inquiry.EncServ) + scsiOneValue.Add("Device contains an embedded enclosure services component"); + + if(inquiry.MultiP) + scsiOneValue.Add("Multi-port device"); + + if(inquiry.MChngr) + scsiOneValue.Add("Device contains or is attached to a medium changer"); + + if(inquiry.ACKREQQ) + scsiOneValue.Add("Device supports request and acknowledge handshakes"); + + if(inquiry.Addr32) + scsiOneValue.Add("Device supports 32-bit wide SCSI addresses"); + + if(inquiry.Addr16) + scsiOneValue.Add("Device supports 16-bit wide SCSI addresses"); + + if(inquiry.RelAddr) + scsiOneValue.Add("Device supports relative addressing"); + + if(inquiry.WBus32) + scsiOneValue.Add("Device supports 32-bit wide data transfers"); + + if(inquiry.WBus16) + scsiOneValue.Add("Device supports 16-bit wide data transfers"); + + if(inquiry.Sync) + scsiOneValue.Add("Device supports synchronous data transfer"); + + if(inquiry.Linked) + scsiOneValue.Add("Device supports linked commands"); + + if(inquiry.TranDis) + scsiOneValue.Add("Device supports CONTINUE TASK and TARGET TRANSFER DISABLE commands"); + + if(inquiry.QAS) + scsiOneValue.Add("Device supports Quick Arbitration and Selection"); + + if(inquiry.CmdQue) + scsiOneValue.Add("Device supports TCQ queue"); + + if(inquiry.IUS) + scsiOneValue.Add("Device supports information unit transfers"); + + if(inquiry.SftRe) + scsiOneValue.Add("Device implements RESET as a soft reset"); + + switch((TGPSValues)inquiry.TPGS) { case TGPSValues.NotSupported: scsiOneValue.Add("Device does not support assymetrical access"); + break; case TGPSValues.OnlyImplicit: scsiOneValue.Add("Device only supports implicit assymetrical access"); + break; case TGPSValues.OnlyExplicit: scsiOneValue.Add("Device only supports explicit assymetrical access"); + break; case TGPSValues.Both: scsiOneValue.Add("Device supports implicit and explicit assymetrical access"); + break; default: scsiOneValue.Add($"Unknown value in TPGS field 0x{inquiry.TPGS:X2}"); + break; } - switch ((SPIClocking) inquiry.Clocking) + switch((SPIClocking)inquiry.Clocking) { case SPIClocking.ST: scsiOneValue.Add("Device supports only ST clocking"); + break; case SPIClocking.DT: scsiOneValue.Add("Device supports only DT clocking"); + break; case SPIClocking.Reserved: scsiOneValue.Add("Reserved value 0x02 found in SPI clocking field"); + break; case SPIClocking.STandDT: scsiOneValue.Add("Device supports ST and DT clocking"); + break; default: scsiOneValue.Add($"Unknown value in SPI clocking field 0x{inquiry.Clocking:X2}"); + break; } - if (inquiry.VersionDescriptors == null) return scsiOneValue; + if(inquiry.VersionDescriptors == null) + return scsiOneValue; - foreach (var versionDescriptor in inquiry.VersionDescriptors) - switch (versionDescriptor) + foreach(ushort versionDescriptor in inquiry.VersionDescriptors) + switch(versionDescriptor) { case 0xFFFF: case 0x0000: break; case 0x0020: scsiOneValue.Add("Device complies with SAM (no version claimed)"); + break; case 0x003B: scsiOneValue.Add("Device complies with SAM T10/0994-D revision 18"); + break; case 0x003C: scsiOneValue.Add("Device complies with SAM ANSI INCITS 270-1996"); + break; case 0x0040: scsiOneValue.Add("Device complies with SAM-2 (no version claimed)"); + break; case 0x0054: scsiOneValue.Add("Device complies with SAM-2 T10/1157-D revision 23"); + break; case 0x0055: scsiOneValue.Add("Device complies with SAM-2 T10/1157-D revision 24"); + break; case 0x005C: scsiOneValue.Add("Device complies with SAM-2 ANSI INCITS 366-2003"); + break; case 0x005E: scsiOneValue.Add("Device complies with SAM-2 ISO/IEC 14776-412"); + break; case 0x0060: scsiOneValue.Add("Device complies with SAM-3 (no version claimed)"); + break; case 0x0062: scsiOneValue.Add("Device complies with SAM-3 T10/1561-D revision 7"); + break; case 0x0075: scsiOneValue.Add("Device complies with SAM-3 T10/1561-D revision 13"); + break; case 0x0076: scsiOneValue.Add("Device complies with SAM-3 T10/1561-D revision 14"); + break; case 0x0077: scsiOneValue.Add("Device complies with SAM-3 ANSI INCITS 402-2005"); + break; case 0x0080: scsiOneValue.Add("Device complies with SAM-4 (no version claimed)"); + break; case 0x0087: scsiOneValue.Add("Device complies with SAM-4 T10/1683-D revision 13"); + break; case 0x008B: scsiOneValue.Add("Device complies with SAM-4 T10/1683-D revision 14"); + break; case 0x0090: scsiOneValue.Add("Device complies with SAM-4 ANSI INCITS 447-2008"); + break; case 0x0092: scsiOneValue.Add("Device complies with SAM-4 ISO/IEC 14776-414"); + break; case 0x00A0: scsiOneValue.Add("Device complies with SAM-5 (no version claimed)"); + break; case 0x00A2: scsiOneValue.Add("Device complies with SAM-5 T10/2104-D revision 4"); + break; case 0x00A4: scsiOneValue.Add("Device complies with SAM-5 T10/2104-D revision 20"); + break; case 0x00A6: scsiOneValue.Add("Device complies with SAM-5 T10/2104-D revision 21"); + break; case 0x00C0: scsiOneValue.Add("Device complies with SAM-6 (no version claimed)"); + break; case 0x0120: scsiOneValue.Add("Device complies with SPC (no version claimed)"); + break; case 0x013B: scsiOneValue.Add("Device complies with SPC T10/0995-D revision 11a"); + break; case 0x013C: scsiOneValue.Add("Device complies with SPC ANSI INCITS 301-1997"); + break; case 0x0140: scsiOneValue.Add("Device complies with MMC (no version claimed)"); + break; case 0x015B: scsiOneValue.Add("Device complies with MMC T10/1048-D revision 10a"); + break; case 0x015C: scsiOneValue.Add("Device complies with MMC ANSI INCITS 304-1997"); + break; case 0x0160: scsiOneValue.Add("Device complies with SCC (no version claimed)"); + break; case 0x017B: scsiOneValue.Add("Device complies with SCC T10/1047-D revision 06c"); + break; case 0x017C: scsiOneValue.Add("Device complies with SCC ANSI INCITS 276-1997"); + break; case 0x0180: scsiOneValue.Add("Device complies with SBC (no version claimed)"); + break; case 0x019B: scsiOneValue.Add("Device complies with SBC T10/0996-D revision 08c"); + break; case 0x019C: scsiOneValue.Add("Device complies with SBC ANSI INCITS 306-1998"); + break; case 0x01A0: scsiOneValue.Add("Device complies with SMC (no version claimed)"); + break; case 0x01BB: scsiOneValue.Add("Device complies with SMC T10/0999-D revision 10a"); + break; case 0x01BC: scsiOneValue.Add("Device complies with SMC ANSI INCITS 314-1998"); + break; case 0x01BE: scsiOneValue.Add("Device complies with SMC ISO/IEC 14776-351"); + break; case 0x01C0: scsiOneValue.Add("Device complies with SES (no version claimed)"); + break; case 0x01DB: scsiOneValue.Add("Device complies with SES T10/1212-D revision 08b"); + break; case 0x01DC: scsiOneValue.Add("Device complies with SES ANSI INCITS 305-1998"); + break; case 0x01DD: - scsiOneValue - .Add( - "Device complies with SES T10/1212 revision 08b w/ Amendment ANSI INCITS.305/AM1-2000"); + scsiOneValue. + Add("Device complies with SES T10/1212 revision 08b w/ Amendment ANSI INCITS.305/AM1-2000"); + break; case 0x01DE: - scsiOneValue - .Add("Device complies with SES ANSI INCITS 305-1998 w/ Amendment ANSI INCITS.305/AM1-2000"); + scsiOneValue. + Add("Device complies with SES ANSI INCITS 305-1998 w/ Amendment ANSI INCITS.305/AM1-2000"); + break; case 0x01E0: scsiOneValue.Add("Device complies with SCC-2 (no version claimed)"); + break; case 0x01FB: scsiOneValue.Add("Device complies with SCC-2 T10/1125-D revision 04"); + break; case 0x01FC: scsiOneValue.Add("Device complies with SCC-2 ANSI INCITS 318-1998"); + break; case 0x0200: scsiOneValue.Add("Device complies with SSC (no version claimed)"); + break; case 0x0201: scsiOneValue.Add("Device complies with SSC T10/0997-D revision 17"); + break; case 0x0207: scsiOneValue.Add("Device complies with SSC T10/0997-D revision 22"); + break; case 0x021C: scsiOneValue.Add("Device complies with SSC ANSI INCITS 335-2000"); + break; case 0x0220: scsiOneValue.Add("Device complies with RBC (no version claimed)"); + break; case 0x0238: scsiOneValue.Add("Device complies with RBC T10/1240-D revision 10a"); + break; case 0x023C: scsiOneValue.Add("Device complies with RBC ANSI INCITS 330-2000"); + break; case 0x0240: scsiOneValue.Add("Device complies with MMC-2 (no version claimed)"); + break; case 0x0255: scsiOneValue.Add("Device complies with MMC-2 T10/1228-D revision 11"); + break; case 0x025B: scsiOneValue.Add("Device complies with MMC-2 T10/1228-D revision 11a"); + break; case 0x025C: scsiOneValue.Add("Device complies with MMC-2 ANSI INCITS 333-2000"); + break; case 0x0260: scsiOneValue.Add("Device complies with SPC-2 (no version claimed)"); + break; case 0x0267: scsiOneValue.Add("Device complies with SPC-2 T10/1236-D revision 12"); + break; case 0x0269: scsiOneValue.Add("Device complies with SPC-2 T10/1236-D revision 18"); + break; case 0x0275: scsiOneValue.Add("Device complies with SPC-2 T10/1236-D revision 19"); + break; case 0x0276: scsiOneValue.Add("Device complies with SPC-2 T10/1236-D revision 20"); + break; case 0x0277: scsiOneValue.Add("Device complies with SPC-2 ANSI INCITS 351-2001"); + break; case 0x0278: scsiOneValue.Add("Device complies with SPC-2 ISO/IEC 14776-452"); + break; case 0x0280: scsiOneValue.Add("Device complies with OCRW (no version claimed)"); + break; case 0x029E: scsiOneValue.Add("Device complies with OCRW ISO/IEC 14776-381"); + break; case 0x02A0: scsiOneValue.Add("Device complies with MMC-3 (no version claimed)"); + break; case 0x02B5: scsiOneValue.Add("Device complies with MMC-3 T10/1363-D revision 9"); + break; case 0x02B6: scsiOneValue.Add("Device complies with MMC-3 T10/1363-D revision 10g"); + break; case 0x02B8: scsiOneValue.Add("Device complies with MMC-3 ANSI INCITS 360-2002"); + break; case 0x02E0: scsiOneValue.Add("Device complies with SMC-2 (no version claimed)"); + break; case 0x02F5: scsiOneValue.Add("Device complies with SMC-2 T10/1383-D revision 5"); + break; case 0x02FC: scsiOneValue.Add("Device complies with SMC-2 T10/1383-D revision 6"); + break; case 0x02FD: scsiOneValue.Add("Device complies with SMC-2 T10/1383-D revision 7"); + break; case 0x02FE: scsiOneValue.Add("Device complies with SMC-2 ANSI INCITS 382-2004"); + break; case 0x0300: scsiOneValue.Add("Device complies with SPC-3 (no version claimed)"); + break; case 0x0301: scsiOneValue.Add("Device complies with SPC-3 T10/1416-D revision 7"); + break; case 0x0307: scsiOneValue.Add("Device complies with SPC-3 T10/1416-D revision 21"); + break; case 0x030F: scsiOneValue.Add("Device complies with SPC-3 T10/1416-D revision 22"); + break; case 0x0312: scsiOneValue.Add("Device complies with SPC-3 T10/1416-D revision 23"); + break; case 0x0314: scsiOneValue.Add("Device complies with SPC-3 ANSI INCITS 408-2005"); + break; case 0x0316: scsiOneValue.Add("Device complies with SPC-3 ISO/IEC 14776-453"); + break; case 0x0320: scsiOneValue.Add("Device complies with SBC-2 (no version claimed)"); + break; case 0x0322: scsiOneValue.Add("Device complies with SBC-2 T10/1417-D revision 5a"); + break; case 0x0324: scsiOneValue.Add("Device complies with SBC-2 T10/1417-D revision 15"); + break; case 0x033B: scsiOneValue.Add("Device complies with SBC-2 T10/1417-D revision 16"); + break; case 0x033D: scsiOneValue.Add("Device complies with SBC-2 ANSI INCITS 405-2005"); + break; case 0x033E: scsiOneValue.Add("Device complies with SBC-2 ISO/IEC 14776-322"); + break; case 0x0340: scsiOneValue.Add("Device complies with OSD (no version claimed)"); + break; case 0x0341: scsiOneValue.Add("Device complies with OSD T10/1355-D revision 0"); + break; case 0x0342: scsiOneValue.Add("Device complies with OSD T10/1355-D revision 7a"); + break; case 0x0343: scsiOneValue.Add("Device complies with OSD T10/1355-D revision 8"); + break; case 0x0344: scsiOneValue.Add("Device complies with OSD T10/1355-D revision 9"); + break; case 0x0355: scsiOneValue.Add("Device complies with OSD T10/1355-D revision 10"); + break; case 0x0356: scsiOneValue.Add("Device complies with OSD ANSI INCITS 400-2004"); + break; case 0x0360: scsiOneValue.Add("Device complies with SSC-2 (no version claimed)"); + break; case 0x0374: scsiOneValue.Add("Device complies with SSC-2 T10/1434-D revision 7"); + break; case 0x0375: scsiOneValue.Add("Device complies with SSC-2 T10/1434-D revision 9"); + break; case 0x037D: scsiOneValue.Add("Device complies with SSC-2 ANSI INCITS 380-2003"); + break; case 0x0380: scsiOneValue.Add("Device complies with BCC (no version claimed)"); + break; case 0x03A0: scsiOneValue.Add("Device complies with MMC-4 (no version claimed)"); + break; case 0x03B0: scsiOneValue.Add("Device complies with MMC-4 T10/1545-D revision 5"); + break; case 0x03B1: scsiOneValue.Add("Device complies with MMC-4 T10/1545-D revision 5a"); + break; case 0x03BD: scsiOneValue.Add("Device complies with MMC-4 T10/1545-D revision 3"); + break; case 0x03BE: scsiOneValue.Add("Device complies with MMC-4 T10/1545-D revision 3d"); + break; case 0x03BF: scsiOneValue.Add("Device complies with MMC-4 ANSI INCITS 401-2005"); + break; case 0x03C0: scsiOneValue.Add("Device complies with ADC (no version claimed)"); + break; case 0x03D5: scsiOneValue.Add("Device complies with ADC T10/1558-D revision 6"); + break; case 0x03D6: scsiOneValue.Add("Device complies with ADC T10/1558-D revision 7"); + break; case 0x03D7: scsiOneValue.Add("Device complies with ADC ANSI INCITS 403-2005"); + break; case 0x03E0: scsiOneValue.Add("Device complies with SES-2 (no version claimed)"); + break; case 0x03E1: scsiOneValue.Add("Device complies with SES-2 T10/1559-D revision 16"); + break; case 0x03E7: scsiOneValue.Add("Device complies with SES-2 T10/1559-D revision 19"); + break; case 0x03EB: scsiOneValue.Add("Device complies with SES-2 T10/1559-D revision 20"); + break; case 0x03F0: scsiOneValue.Add("Device complies with SES-2 ANSI INCITS 448-2008"); + break; case 0x03F2: scsiOneValue.Add("Device complies with SES-2 ISO/IEC 14776-372"); + break; case 0x0400: scsiOneValue.Add("Device complies with SSC-3 (no version claimed)"); + break; case 0x0403: scsiOneValue.Add("Device complies with SSC-3 T10/1611-D revision 04a"); + break; case 0x0407: scsiOneValue.Add("Device complies with SSC-3 T10/1611-D revision 05"); + break; case 0x0409: scsiOneValue.Add("Device complies with SSC-3 ANSI INCITS 467-2011"); + break; case 0x040B: scsiOneValue.Add("Device complies with SSC-3 ISO/IEC 14776-333:2013"); + break; case 0x0420: scsiOneValue.Add("Device complies with MMC-5 (no version claimed)"); + break; case 0x042F: scsiOneValue.Add("Device complies with MMC-5 T10/1675-D revision 03"); + break; case 0x0431: scsiOneValue.Add("Device complies with MMC-5 T10/1675-D revision 03b"); + break; case 0x0432: scsiOneValue.Add("Device complies with MMC-5 T10/1675-D revision 04"); + break; case 0x0434: scsiOneValue.Add("Device complies with MMC-5 ANSI INCITS 430-2007"); + break; case 0x0440: scsiOneValue.Add("Device complies with OSD-2 (no version claimed)"); + break; case 0x0444: scsiOneValue.Add("Device complies with OSD-2 T10/1729-D revision 4"); + break; case 0x0446: scsiOneValue.Add("Device complies with OSD-2 T10/1729-D revision 5"); + break; case 0x0448: scsiOneValue.Add("Device complies with OSD-2 ANSI INCITS 458-2011"); + break; case 0x0460: scsiOneValue.Add("Device complies with SPC-4 (no version claimed)"); + break; case 0x0461: scsiOneValue.Add("Device complies with SPC-4 T10/BSR INCITS 513 revision 16"); + break; case 0x0462: scsiOneValue.Add("Device complies with SPC-4 T10/BSR INCITS 513 revision 18"); + break; case 0x0463: scsiOneValue.Add("Device complies with SPC-4 T10/BSR INCITS 513 revision 23"); + break; case 0x0466: scsiOneValue.Add("Device complies with SPC-4 T10/BSR INCITS 513 revision 36"); + break; case 0x0468: scsiOneValue.Add("Device complies with SPC-4 T10/BSR INCITS 513 revision 37"); + break; case 0x0469: scsiOneValue.Add("Device complies with SPC-4 T10/BSR INCITS 513 revision 37a"); + break; case 0x046C: scsiOneValue.Add("Device complies with SPC-4 ANSI INCITS 513-2015"); + break; case 0x0480: scsiOneValue.Add("Device complies with SMC-3 (no version claimed)"); + break; case 0x0482: scsiOneValue.Add("Device complies with SMC-3 T10/1730-D revision 15"); + break; case 0x0484: scsiOneValue.Add("Device complies with SMC-3 T10/1730-D revision 16"); + break; case 0x0486: scsiOneValue.Add("Device complies with SMC-3 ANSI INCITS 484-2012"); + break; case 0x04A0: scsiOneValue.Add("Device complies with ADC-2 (no version claimed)"); + break; case 0x04A7: scsiOneValue.Add("Device complies with ADC-2 T10/1741-D revision 7"); + break; case 0x04AA: scsiOneValue.Add("Device complies with ADC-2 T10/1741-D revision 8"); + break; case 0x04AC: scsiOneValue.Add("Device complies with ADC-2 ANSI INCITS 441-2008"); + break; case 0x04C0: scsiOneValue.Add("Device complies with SBC-3 (no version claimed)"); + break; case 0x04C3: scsiOneValue.Add("Device complies with SBC-3 T10/BSR INCITS 514 revision 35"); + break; case 0x04C5: scsiOneValue.Add("Device complies with SBC-3 T10/BSR INCITS 514 revision 36"); + break; case 0x04C8: scsiOneValue.Add("Device complies with SBC-3 ANSI INCITS 514-2014"); + break; case 0x04E0: scsiOneValue.Add("Device complies with MMC-6 (no version claimed)"); + break; case 0x04E3: scsiOneValue.Add("Device complies with MMC-6 T10/1836-D revision 02b"); + break; case 0x04E5: scsiOneValue.Add("Device complies with MMC-6 T10/1836-D revision 02g"); + break; case 0x04E6: scsiOneValue.Add("Device complies with MMC-6 ANSI INCITS 468-2010"); + break; case 0x04E7: - scsiOneValue - .Add( - "Device complies with MMC-6 ANSI INCITS 468-2010 + MMC-6/AM1 ANSI INCITS 468-2010/AM 1"); + scsiOneValue. + Add("Device complies with MMC-6 ANSI INCITS 468-2010 + MMC-6/AM1 ANSI INCITS 468-2010/AM 1"); + break; case 0x0500: scsiOneValue.Add("Device complies with ADC-3 (no version claimed)"); + break; case 0x0502: scsiOneValue.Add("Device complies with ADC-3 T10/1895-D revision 04"); + break; case 0x0504: scsiOneValue.Add("Device complies with ADC-3 T10/1895-D revision 05"); + break; case 0x0506: scsiOneValue.Add("Device complies with ADC-3 T10/1895-D revision 05a"); + break; case 0x050A: scsiOneValue.Add("Device complies with ADC-3 ANSI INCITS 497-2012"); + break; case 0x0520: scsiOneValue.Add("Device complies with SSC-4 (no version claimed)"); + break; case 0x0523: scsiOneValue.Add("Device complies with SSC-4 T10/BSR INCITS 516 revision 2"); + break; case 0x0525: scsiOneValue.Add("Device complies with SSC-4 T10/BSR INCITS 516 revision 3"); + break; case 0x0527: scsiOneValue.Add("Device complies with SSC-4 ANSI INCITS 516-2013"); + break; case 0x0560: scsiOneValue.Add("Device complies with OSD-3 (no version claimed)"); + break; case 0x0580: scsiOneValue.Add("Device complies with SES-3 (no version claimed)"); + break; case 0x05A0: scsiOneValue.Add("Device complies with SSC-5 (no version claimed)"); + break; case 0x05C0: scsiOneValue.Add("Device complies with SPC-5 (no version claimed)"); + break; case 0x05E0: scsiOneValue.Add("Device complies with SFSC (no version claimed)"); + break; case 0x05E3: scsiOneValue.Add("Device complies with SFSC BSR INCITS 501 revision 01"); + break; case 0x0600: scsiOneValue.Add("Device complies with SBC-4 (no version claimed)"); + break; case 0x0620: scsiOneValue.Add("Device complies with ZBC (no version claimed)"); + break; case 0x0622: scsiOneValue.Add("Device complies with ZBC BSR INCITS 536 revision 02"); + break; case 0x0640: scsiOneValue.Add("Device complies with ADC-4 (no version claimed)"); + break; case 0x0820: scsiOneValue.Add("Device complies with SSA-TL2 (no version claimed)"); + break; case 0x083B: scsiOneValue.Add("Device complies with SSA-TL2 T10.1/1147-D revision 05b"); + break; case 0x083C: scsiOneValue.Add("Device complies with SSA-TL2 ANSI INCITS 308-1998"); + break; case 0x0840: scsiOneValue.Add("Device complies with SSA-TL1 (no version claimed)"); + break; case 0x085B: scsiOneValue.Add("Device complies with SSA-TL1 T10.1/0989-D revision 10b"); + break; case 0x085C: scsiOneValue.Add("Device complies with SSA-TL1 ANSI INCITS 295-1996"); + break; case 0x0860: scsiOneValue.Add("Device complies with SSA-S3P (no version claimed)"); + break; case 0x087B: scsiOneValue.Add("Device complies with SSA-S3P T10.1/1051-D revision 05b"); + break; case 0x087C: scsiOneValue.Add("Device complies with SSA-S3P ANSI INCITS 309-1998"); + break; case 0x0880: scsiOneValue.Add("Device complies with SSA-S2P (no version claimed)"); + break; case 0x089B: scsiOneValue.Add("Device complies with SSA-S2P T10.1/1121-D revision 07b"); + break; case 0x089C: scsiOneValue.Add("Device complies with SSA-S2P ANSI INCITS 294-1996"); + break; case 0x08A0: scsiOneValue.Add("Device complies with SIP (no version claimed)"); + break; case 0x08BB: scsiOneValue.Add("Device complies with SIP T10/0856-D revision 10"); + break; case 0x08BC: scsiOneValue.Add("Device complies with SIP ANSI INCITS 292-1997"); + break; case 0x08C0: scsiOneValue.Add("Device complies with FCP (no version claimed)"); + break; case 0x08DB: scsiOneValue.Add("Device complies with FCP T10/0993-D revision 12"); + break; case 0x08DC: scsiOneValue.Add("Device complies with FCP ANSI INCITS 269-1996"); + break; case 0x08E0: scsiOneValue.Add("Device complies with SBP-2 (no version claimed)"); + break; case 0x08FB: scsiOneValue.Add("Device complies with SBP-2 T10/1155-D revision 04"); + break; case 0x08FC: scsiOneValue.Add("Device complies with SBP-2 ANSI INCITS 325-1998"); + break; case 0x0900: scsiOneValue.Add("Device complies with FCP-2 (no version claimed)"); + break; case 0x0901: scsiOneValue.Add("Device complies with FCP-2 T10/1144-D revision 4"); + break; case 0x0915: scsiOneValue.Add("Device complies with FCP-2 T10/1144-D revision 7"); + break; case 0x0916: scsiOneValue.Add("Device complies with FCP-2 T10/1144-D revision 7a"); + break; case 0x0917: scsiOneValue.Add("Device complies with FCP-2 ANSI INCITS 350-2003"); + break; case 0x0918: scsiOneValue.Add("Device complies with FCP-2 T10/1144-D revision 8"); + break; case 0x0920: scsiOneValue.Add("Device complies with SST (no version claimed)"); + break; case 0x0935: scsiOneValue.Add("Device complies with SST T10/1380-D revision 8b"); + break; case 0x0940: scsiOneValue.Add("Device complies with SRP (no version claimed)"); + break; case 0x0954: scsiOneValue.Add("Device complies with SRP T10/1415-D revision 10"); + break; case 0x0955: scsiOneValue.Add("Device complies with SRP T10/1415-D revision 16a"); + break; case 0x095C: scsiOneValue.Add("Device complies with SRP ANSI INCITS 365-2002"); + break; case 0x0960: scsiOneValue.Add("Device complies with iSCSI (no version claimed)"); + break; case 0x0961: case 0x0962: @@ -942,768 +1252,1013 @@ namespace DiscImageChef.Server case 0x097E: case 0x097F: scsiOneValue.Add($"Device complies with iSCSI revision {versionDescriptor & 0x1F}"); + break; case 0x0980: scsiOneValue.Add("Device complies with SBP-3 (no version claimed)"); + break; case 0x0982: scsiOneValue.Add("Device complies with SBP-3 T10/1467-D revision 1f"); + break; case 0x0994: scsiOneValue.Add("Device complies with SBP-3 T10/1467-D revision 3"); + break; case 0x099A: scsiOneValue.Add("Device complies with SBP-3 T10/1467-D revision 4"); + break; case 0x099B: scsiOneValue.Add("Device complies with SBP-3 T10/1467-D revision 5"); + break; case 0x099C: scsiOneValue.Add("Device complies with SBP-3 ANSI INCITS 375-2004"); + break; case 0x09C0: scsiOneValue.Add("Device complies with ADP (no version claimed)"); + break; case 0x09E0: scsiOneValue.Add("Device complies with ADT (no version claimed)"); + break; case 0x09F9: scsiOneValue.Add("Device complies with ADT T10/1557-D revision 11"); + break; case 0x09FA: scsiOneValue.Add("Device complies with ADT T10/1557-D revision 14"); + break; case 0x09FD: scsiOneValue.Add("Device complies with ADT ANSI INCITS 406-2005"); + break; case 0x0A00: scsiOneValue.Add("Device complies with FCP-3 (no version claimed)"); + break; case 0x0A07: scsiOneValue.Add("Device complies with FCP-3 T10/1560-D revision 3f"); + break; case 0x0A0F: scsiOneValue.Add("Device complies with FCP-3 T10/1560-D revision 4"); + break; case 0x0A11: scsiOneValue.Add("Device complies with FCP-3 ANSI INCITS 416-2006"); + break; case 0x0A1C: scsiOneValue.Add("Device complies with FCP-3 ISO/IEC 14776-223"); + break; case 0x0A20: scsiOneValue.Add("Device complies with ADT-2 (no version claimed)"); + break; case 0x0A22: scsiOneValue.Add("Device complies with ADT-2 T10/1742-D revision 06"); + break; case 0x0A27: scsiOneValue.Add("Device complies with ADT-2 T10/1742-D revision 08"); + break; case 0x0A28: scsiOneValue.Add("Device complies with ADT-2 T10/1742-D revision 09"); + break; case 0x0A2B: scsiOneValue.Add("Device complies with ADT-2 ANSI INCITS 472-2011"); + break; case 0x0A40: scsiOneValue.Add("Device complies with FCP-4 (no version claimed)"); + break; case 0x0A42: scsiOneValue.Add("Device complies with FCP-4 T10/1828-D revision 01"); + break; case 0x0A44: scsiOneValue.Add("Device complies with FCP-4 T10/1828-D revision 02"); + break; case 0x0A45: scsiOneValue.Add("Device complies with FCP-4 T10/1828-D revision 02b"); + break; case 0x0A46: scsiOneValue.Add("Device complies with FCP-4 ANSI INCITS 481-2012"); + break; case 0x0A60: scsiOneValue.Add("Device complies with ADT-3 (no version claimed)"); + break; case 0x0AA0: scsiOneValue.Add("Device complies with SPI (no version claimed)"); + break; case 0x0AB9: scsiOneValue.Add("Device complies with SPI T10/0855-D revision 15a"); + break; case 0x0ABA: scsiOneValue.Add("Device complies with SPI ANSI INCITS 253-1995"); + break; case 0x0ABB: scsiOneValue.Add("Device complies with SPI T10/0855-D revision 15a with SPI Amnd revision 3a"); + break; case 0x0ABC: - scsiOneValue - .Add( - "Device complies with SPI ANSI INCITS 253-1995 with SPI Amnd ANSI INCITS 253/AM1-1998"); + scsiOneValue. + Add("Device complies with SPI ANSI INCITS 253-1995 with SPI Amnd ANSI INCITS 253/AM1-1998"); + break; case 0x0AC0: scsiOneValue.Add("Device complies with Fast-20 (no version claimed)"); + break; case 0x0ADB: scsiOneValue.Add("Device complies with Fast-20 T10/1071 revision 06"); + break; case 0x0ADC: scsiOneValue.Add("Device complies with Fast-20 ANSI INCITS 277-1996"); + break; case 0x0AE0: scsiOneValue.Add("Device complies with SPI-2 (no version claimed)"); + break; case 0x0AFB: scsiOneValue.Add("Device complies with SPI-2 T10/1142-D revision 20b"); + break; case 0x0AFC: scsiOneValue.Add("Device complies with SPI-2 ANSI INCITS 302-1999"); + break; case 0x0B00: scsiOneValue.Add("Device complies with SPI-3 (no version claimed)"); + break; case 0x0B18: scsiOneValue.Add("Device complies with SPI-3 T10/1302-D revision 10"); + break; case 0x0B19: scsiOneValue.Add("Device complies with SPI-3 T10/1302-D revision 13a"); + break; case 0x0B1A: scsiOneValue.Add("Device complies with SPI-3 T10/1302-D revision 14"); + break; case 0x0B1C: scsiOneValue.Add("Device complies with SPI-3 ANSI INCITS 336-2000"); + break; case 0x0B20: scsiOneValue.Add("Device complies with EPI (no version claimed)"); + break; case 0x0B3B: scsiOneValue.Add("Device complies with EPI T10/1134 revision 16"); + break; case 0x0B3C: scsiOneValue.Add("Device complies with EPI ANSI INCITS TR-23 1999"); + break; case 0x0B40: scsiOneValue.Add("Device complies with SPI-4 (no version claimed)"); + break; case 0x0B54: scsiOneValue.Add("Device complies with SPI-4 T10/1365-D revision 7"); + break; case 0x0B55: scsiOneValue.Add("Device complies with SPI-4 T10/1365-D revision 9"); + break; case 0x0B56: scsiOneValue.Add("Device complies with SPI-4 ANSI INCITS 362-2002"); + break; case 0x0B59: scsiOneValue.Add("Device complies with SPI-4 T10/1365-D revision 10"); + break; case 0x0B60: scsiOneValue.Add("Device complies with SPI-5 (no version claimed)"); + break; case 0x0B79: scsiOneValue.Add("Device complies with SPI-5 T10/1525-D revision 3"); + break; case 0x0B7A: scsiOneValue.Add("Device complies with SPI-5 T10/1525-D revision 5"); + break; case 0x0B7B: scsiOneValue.Add("Device complies with SPI-5 T10/1525-D revision 6"); + break; case 0x0B7C: scsiOneValue.Add("Device complies with SPI-5 ANSI INCITS 367-2003"); + break; case 0x0BE0: scsiOneValue.Add("Device complies with SAS (no version claimed)"); + break; case 0x0BE1: scsiOneValue.Add("Device complies with SAS T10/1562-D revision 01"); + break; case 0x0BF5: scsiOneValue.Add("Device complies with SAS T10/1562-D revision 03"); + break; case 0x0BFA: scsiOneValue.Add("Device complies with SAS T10/1562-D revision 04"); + break; case 0x0BFB: scsiOneValue.Add("Device complies with SAS T10/1562-D revision 04"); + break; case 0x0BFC: scsiOneValue.Add("Device complies with SAS T10/1562-D revision 05"); + break; case 0x0BFD: scsiOneValue.Add("Device complies with SAS ANSI INCITS 376-2003"); + break; case 0x0C00: scsiOneValue.Add("Device complies with SAS-1.1 (no version claimed)"); + break; case 0x0C07: scsiOneValue.Add("Device complies with SAS-1.1 T10/1601-D revision 9"); + break; case 0x0C0F: scsiOneValue.Add("Device complies with SAS-1.1 T10/1601-D revision 10"); + break; case 0x0C11: scsiOneValue.Add("Device complies with SAS-1.1 ANSI INCITS 417-2006"); + break; case 0x0C12: scsiOneValue.Add("Device complies with SAS-1.1 ISO/IEC 14776-151"); + break; case 0x0C20: scsiOneValue.Add("Device complies with SAS-2 (no version claimed)"); + break; case 0x0C23: scsiOneValue.Add("Device complies with SAS-2 T10/1760-D revision 14"); + break; case 0x0C27: scsiOneValue.Add("Device complies with SAS-2 T10/1760-D revision 15"); + break; case 0x0C28: scsiOneValue.Add("Device complies with SAS-2 T10/1760-D revision 16"); + break; case 0x0C2A: scsiOneValue.Add("Device complies with SAS-2 ANSI INCITS 457-2010"); + break; case 0x0C40: scsiOneValue.Add("Device complies with SAS-2.1 (no version claimed)"); + break; case 0x0C48: scsiOneValue.Add("Device complies with SAS-2.1 T10/2125-D revision 04"); + break; case 0x0C4A: scsiOneValue.Add("Device complies with SAS-2.1 T10/2125-D revision 06"); + break; case 0x0C4B: scsiOneValue.Add("Device complies with SAS-2.1 T10/2125-D revision 07"); + break; case 0x0C4E: scsiOneValue.Add("Device complies with SAS-2.1 ANSI INCITS 478-2011"); + break; case 0x0C4F: - scsiOneValue - .Add( - "Device complies with SAS-2.1 ANSI INCITS 478-2011 w/ Amnd 1 ANSI INCITS 478/AM1-2014"); + scsiOneValue. + Add("Device complies with SAS-2.1 ANSI INCITS 478-2011 w/ Amnd 1 ANSI INCITS 478/AM1-2014"); + break; case 0x0C52: scsiOneValue.Add("Device complies with SAS-2.1 ISO/IEC 14776-153"); + break; case 0x0C60: scsiOneValue.Add("Device complies with SAS-3 (no version claimed)"); + break; case 0x0C63: scsiOneValue.Add("Device complies with SAS-3 T10/BSR INCITS 519 revision 05a"); + break; case 0x0C65: scsiOneValue.Add("Device complies with SAS-3 T10/BSR INCITS 519 revision 06"); + break; case 0x0C68: scsiOneValue.Add("Device complies with SAS-3 ANSI INCITS 519-2014"); + break; case 0x0C80: scsiOneValue.Add("Device complies with SAS-4 (no version claimed)"); + break; case 0x0D20: scsiOneValue.Add("Device complies with FC-PH (no version claimed)"); + break; case 0x0D3B: scsiOneValue.Add("Device complies with FC-PH ANSI INCITS 230-1994"); + break; case 0x0D3C: - scsiOneValue - .Add( - "Device complies with FC-PH ANSI INCITS 230-1994 with Amnd 1 ANSI INCITS 230/AM1-1996"); + scsiOneValue. + Add("Device complies with FC-PH ANSI INCITS 230-1994 with Amnd 1 ANSI INCITS 230/AM1-1996"); + break; case 0x0D40: scsiOneValue.Add("Device complies with FC-AL (no version claimed)"); + break; case 0x0D5C: scsiOneValue.Add("Device complies with FC-AL ANSI INCITS 272-1996"); + break; case 0x0D60: scsiOneValue.Add("Device complies with FC-AL-2 (no version claimed)"); + break; case 0x0D61: scsiOneValue.Add("Device complies with FC-AL-2 T11/1133-D revision 7.0"); + break; case 0x0D63: scsiOneValue.Add("Device complies with FC-AL-2 ANSI INCITS 332-1999 with AM1-2003 & AM2-2006"); + break; case 0x0D64: scsiOneValue.Add("Device complies with FC-AL-2 ANSI INCITS 332-1999 with Amnd 2 AM2-2006"); + break; case 0x0D65: scsiOneValue.Add("Device complies with FC-AL-2 ISO/IEC 14165-122 with AM1 & AM2"); + break; case 0x0D7C: scsiOneValue.Add("Device complies with FC-AL-2 ANSI INCITS 332-1999"); + break; case 0x0D7D: scsiOneValue.Add("Device complies with FC-AL-2 ANSI INCITS 332-1999 with Amnd 1 AM1-2003"); + break; case 0x0D80: scsiOneValue.Add("Device complies with FC-PH-3 (no version claimed)"); + break; case 0x0D9C: scsiOneValue.Add("Device complies with FC-PH-3 ANSI INCITS 303-1998"); + break; case 0x0DA0: scsiOneValue.Add("Device complies with FC-FS (no version claimed)"); + break; case 0x0DB7: scsiOneValue.Add("Device complies with FC-FS T11/1331-D revision 1.2"); + break; case 0x0DB8: scsiOneValue.Add("Device complies with FC-FS T11/1331-D revision 1.7"); + break; case 0x0DBC: scsiOneValue.Add("Device complies with FC-FS ANSI INCITS 373-2003"); + break; case 0x0DBD: scsiOneValue.Add("Device complies with FC-FS ISO/IEC 14165-251"); + break; case 0x0DC0: scsiOneValue.Add("Device complies with FC-PI (no version claimed)"); + break; case 0x0DDC: scsiOneValue.Add("Device complies with FC-PI ANSI INCITS 352-2002"); + break; case 0x0DE0: scsiOneValue.Add("Device complies with FC-PI-2 (no version claimed)"); + break; case 0x0DE2: scsiOneValue.Add("Device complies with FC-PI-2 T11/1506-D revision 5.0"); + break; case 0x0DE4: scsiOneValue.Add("Device complies with FC-PI-2 ANSI INCITS 404-2006"); + break; case 0x0E00: scsiOneValue.Add("Device complies with FC-FS-2 (no version claimed)"); + break; case 0x0E02: scsiOneValue.Add("Device complies with FC-FS-2 ANSI INCITS 242-2007"); + break; case 0x0E03: - scsiOneValue - .Add("Device complies with FC-FS-2 ANSI INCITS 242-2007 with AM1 ANSI INCITS 242/AM1-2007"); + scsiOneValue. + Add("Device complies with FC-FS-2 ANSI INCITS 242-2007 with AM1 ANSI INCITS 242/AM1-2007"); + break; case 0x0E20: scsiOneValue.Add("Device complies with FC-LS (no version claimed)"); + break; case 0x0E21: scsiOneValue.Add("Device complies with FC-LS T11/1620-D revision 1.62"); + break; case 0x0E29: scsiOneValue.Add("Device complies with FC-LS ANSI INCITS 433-2007"); + break; case 0x0E40: scsiOneValue.Add("Device complies with FC-SP (no version claimed)"); + break; case 0x0E42: scsiOneValue.Add("Device complies with FC-SP T11/1570-D revision 1.6"); + break; case 0x0E45: scsiOneValue.Add("Device complies with FC-SP ANSI INCITS 426-2007"); + break; case 0x0E60: scsiOneValue.Add("Device complies with FC-PI-3 (no version claimed)"); + break; case 0x0E62: scsiOneValue.Add("Device complies with FC-PI-3 T11/1625-D revision 2.0"); + break; case 0x0E68: scsiOneValue.Add("Device complies with FC-PI-3 T11/1625-D revision 2.1"); + break; case 0x0E6A: scsiOneValue.Add("Device complies with FC-PI-3 T11/1625-D revision 4.0"); + break; case 0x0E6E: scsiOneValue.Add("Device complies with FC-PI-3 ANSI INCITS 460-2011"); + break; case 0x0E80: scsiOneValue.Add("Device complies with FC-PI-4 (no version claimed)"); + break; case 0x0E82: scsiOneValue.Add("Device complies with FC-PI-4 T11/1647-D revision 8.0"); + break; case 0x0E88: scsiOneValue.Add("Device complies with FC-PI-4 ANSI INCITS 450-2009"); + break; case 0x0EA0: scsiOneValue.Add("Device complies with FC 10GFC (no version claimed)"); + break; case 0x0EA2: scsiOneValue.Add("Device complies with FC 10GFC ANSI INCITS 364-2003"); + break; case 0x0EA3: scsiOneValue.Add("Device complies with FC 10GFC ISO/IEC 14165-116"); + break; case 0x0EA5: scsiOneValue.Add("Device complies with FC 10GFC ISO/IEC 14165-116 with AM1"); + break; case 0x0EA6: - scsiOneValue - .Add( - "Device complies with FC 10GFC ANSI INCITS 364-2003 with AM1 ANSI INCITS 364/AM1-2007"); + scsiOneValue. + Add("Device complies with FC 10GFC ANSI INCITS 364-2003 with AM1 ANSI INCITS 364/AM1-2007"); + break; case 0x0EC0: scsiOneValue.Add("Device complies with FC-SP-2 (no version claimed)"); + break; case 0x0EE0: scsiOneValue.Add("Device complies with FC-FS-3 (no version claimed)"); + break; case 0x0EE2: scsiOneValue.Add("Device complies with FC-FS-3 T11/1861-D revision 0.9"); + break; case 0x0EE7: scsiOneValue.Add("Device complies with FC-FS-3 T11/1861-D revision 1.0"); + break; case 0x0EE9: scsiOneValue.Add("Device complies with FC-FS-3 T11/1861-D revision 1.10"); + break; case 0x0EEB: scsiOneValue.Add("Device complies with FC-FS-3 ANSI INCITS 470-2011"); + break; case 0x0F00: scsiOneValue.Add("Device complies with FC-LS-2 (no version claimed)"); + break; case 0x0F03: scsiOneValue.Add("Device complies with FC-LS-2 T11/2103-D revision 2.11"); + break; case 0x0F05: scsiOneValue.Add("Device complies with FC-LS-2 T11/2103-D revision 2.21"); + break; case 0x0F07: scsiOneValue.Add("Device complies with FC-LS-2 ANSI INCITS 477-2011"); + break; case 0x0F20: scsiOneValue.Add("Device complies with FC-PI-5 (no version claimed)"); + break; case 0x0F27: scsiOneValue.Add("Device complies with FC-PI-5 T11/2118-D revision 2.00"); + break; case 0x0F28: scsiOneValue.Add("Device complies with FC-PI-5 T11/2118-D revision 3.00"); + break; case 0x0F2A: scsiOneValue.Add("Device complies with FC-PI-5 T11/2118-D revision 6.00"); + break; case 0x0F2B: scsiOneValue.Add("Device complies with FC-PI-5 T11/2118-D revision 6.10"); + break; case 0x0F2E: scsiOneValue.Add("Device complies with FC-PI-5 ANSI INCITS 479-2011"); + break; case 0x0F40: scsiOneValue.Add("Device complies with FC-PI-6 (no version claimed)"); + break; case 0x0F60: scsiOneValue.Add("Device complies with FC-FS-4 (no version claimed)"); + break; case 0x0F80: scsiOneValue.Add("Device complies with FC-LS-3 (no version claimed)"); + break; case 0x12A0: scsiOneValue.Add("Device complies with FC-SCM (no version claimed)"); + break; case 0x12A3: scsiOneValue.Add("Device complies with FC-SCM T11/1824DT revision 1.0"); + break; case 0x12A5: scsiOneValue.Add("Device complies with FC-SCM T11/1824DT revision 1.1"); + break; case 0x12A7: scsiOneValue.Add("Device complies with FC-SCM T11/1824DT revision 1.4"); + break; case 0x12AA: scsiOneValue.Add("Device complies with FC-SCM INCITS TR-47 2012"); + break; case 0x12C0: scsiOneValue.Add("Device complies with FC-DA-2 (no version claimed)"); + break; case 0x12C3: scsiOneValue.Add("Device complies with FC-DA-2 T11/1870DT revision 1.04"); + break; case 0x12C5: scsiOneValue.Add("Device complies with FC-DA-2 T11/1870DT revision 1.06"); + break; case 0x12C9: scsiOneValue.Add("Device complies with FC-DA-2 INCITS TR-49 2012"); + break; case 0x12E0: scsiOneValue.Add("Device complies with FC-DA (no version claimed)"); + break; case 0x12E2: scsiOneValue.Add("Device complies with FC-DA T11/1513-DT revision 3.1"); + break; case 0x12E8: scsiOneValue.Add("Device complies with FC-DA ANSI INCITS TR-36 2004"); + break; case 0x12E9: scsiOneValue.Add("Device complies with FC-DA ISO/IEC 14165-341"); + break; case 0x1300: scsiOneValue.Add("Device complies with FC-Tape (no version claimed)"); + break; case 0x1301: scsiOneValue.Add("Device complies with FC-Tape T11/1315 revision 1.16"); + break; case 0x131B: scsiOneValue.Add("Device complies with FC-Tape T11/1315 revision 1.17"); + break; case 0x131C: scsiOneValue.Add("Device complies with FC-Tape ANSI INCITS TR-24 1999"); + break; case 0x1320: scsiOneValue.Add("Device complies with FC-FLA (no version claimed)"); + break; case 0x133B: scsiOneValue.Add("Device complies with FC-FLA T11/1235 revision 7"); + break; case 0x133C: scsiOneValue.Add("Device complies with FC-FLA ANSI INCITS TR-20 1998"); + break; case 0x1340: scsiOneValue.Add("Device complies with FC-PLDA (no version claimed)"); + break; case 0x135B: scsiOneValue.Add("Device complies with FC-PLDA T11/1162 revision 2.1"); + break; case 0x135C: scsiOneValue.Add("Device complies with FC-PLDA ANSI INCITS TR-19 1998"); + break; case 0x1360: scsiOneValue.Add("Device complies with SSA-PH2 (no version claimed)"); + break; case 0x137B: scsiOneValue.Add("Device complies with SSA-PH2 T10.1/1145-D revision 09c"); + break; case 0x137C: scsiOneValue.Add("Device complies with SSA-PH2 ANSI INCITS 293-1996"); + break; case 0x1380: scsiOneValue.Add("Device complies with SSA-PH3 (no version claimed)"); + break; case 0x139B: scsiOneValue.Add("Device complies with SSA-PH3 T10.1/1146-D revision 05b"); + break; case 0x139C: scsiOneValue.Add("Device complies with SSA-PH3 ANSI INCITS 307-1998"); + break; case 0x14A0: scsiOneValue.Add("Device complies with IEEE 1394 (no version claimed)"); + break; case 0x14BD: scsiOneValue.Add("Device complies with ANSI IEEE 1394-1995"); + break; case 0x14C0: scsiOneValue.Add("Device complies with IEEE 1394a (no version claimed)"); + break; case 0x14E0: scsiOneValue.Add("Device complies with IEEE 1394b (no version claimed)"); + break; case 0x15E0: scsiOneValue.Add("Device complies with ATA/ATAPI-6 (no version claimed)"); + break; case 0x15FD: scsiOneValue.Add("Device complies with ATA/ATAPI-6 ANSI INCITS 361-2002"); + break; case 0x1600: scsiOneValue.Add("Device complies with ATA/ATAPI-7 (no version claimed)"); + break; case 0x1602: scsiOneValue.Add("Device complies with ATA/ATAPI-7 T13/1532-D revision 3"); + break; case 0x161C: scsiOneValue.Add("Device complies with ATA/ATAPI-7 ANSI INCITS 397-2005"); + break; case 0x161E: scsiOneValue.Add("Device complies with ATA/ATAPI-7 ISO/IEC 24739"); + break; case 0x1620: scsiOneValue.Add("Device complies with ATA/ATAPI-8 ATA8-AAM (no version claimed)"); + break; case 0x1621: - scsiOneValue - .Add("Device complies with ATA/ATAPI-8 ATA8-APT Parallel Transport (no version claimed)"); + scsiOneValue. + Add("Device complies with ATA/ATAPI-8 ATA8-APT Parallel Transport (no version claimed)"); + break; case 0x1622: - scsiOneValue - .Add("Device complies with ATA/ATAPI-8 ATA8-AST Serial Transport (no version claimed)"); + scsiOneValue. + Add("Device complies with ATA/ATAPI-8 ATA8-AST Serial Transport (no version claimed)"); + break; case 0x1623: - scsiOneValue - .Add( - "Device complies with ATA/ATAPI-8 ATA8-ACS ATA/ATAPI Command Set (no version claimed)"); + scsiOneValue. + Add("Device complies with ATA/ATAPI-8 ATA8-ACS ATA/ATAPI Command Set (no version claimed)"); + break; case 0x1628: scsiOneValue.Add("Device complies with ATA/ATAPI-8 ATA8-AAM ANSI INCITS 451-2008"); + break; case 0x162A: - scsiOneValue - .Add("Device complies with ATA/ATAPI-8 ATA8-ACS ANSI INCITS 452-2009 w/ Amendment 1"); + scsiOneValue. + Add("Device complies with ATA/ATAPI-8 ATA8-ACS ANSI INCITS 452-2009 w/ Amendment 1"); + break; case 0x1728: scsiOneValue.Add("Device complies with Universal Serial Bus Specification, Revision 1.1"); + break; case 0x1729: scsiOneValue.Add("Device complies with Universal Serial Bus Specification, Revision 2.0"); + break; case 0x1730: - scsiOneValue - .Add("Device complies with USB Mass Storage Class Bulk-Only Transport, Revision 1.0"); + scsiOneValue. + Add("Device complies with USB Mass Storage Class Bulk-Only Transport, Revision 1.0"); + break; case 0x1740: scsiOneValue.Add("Device complies with UAS (no version claimed)"); + break; case 0x1743: scsiOneValue.Add("Device complies with UAS T10/2095-D revision 02"); + break; case 0x1747: scsiOneValue.Add("Device complies with UAS T10/2095-D revision 04"); + break; case 0x1748: scsiOneValue.Add("Device complies with UAS ANSI INCITS 471-2010"); + break; case 0x1749: scsiOneValue.Add("Device complies with UAS ISO/IEC 14776-251:2014"); + break; case 0x1761: scsiOneValue.Add("Device complies with ACS-2 (no version claimed)"); + break; case 0x1762: scsiOneValue.Add("Device complies with ACS-2 ANSI INCITS 482-2013"); + break; case 0x1765: scsiOneValue.Add("Device complies with ACS-3 (no version claimed)"); + break; case 0x1780: scsiOneValue.Add("Device complies with UAS-2 (no version claimed)"); + break; case 0x1EA0: scsiOneValue.Add("Device complies with SAT (no version claimed)"); + break; case 0x1EA7: scsiOneValue.Add("Device complies with SAT T10/1711-D revision 8"); + break; case 0x1EAB: scsiOneValue.Add("Device complies with SAT T10/1711-D revision 9"); + break; case 0x1EAD: scsiOneValue.Add("Device complies with SAT ANSI INCITS 431-2007"); + break; case 0x1EC0: scsiOneValue.Add("Device complies with SAT-2 (no version claimed)"); + break; case 0x1EC4: scsiOneValue.Add("Device complies with SAT-2 T10/1826-D revision 06"); + break; case 0x1EC8: scsiOneValue.Add("Device complies with SAT-2 T10/1826-D revision 09"); + break; case 0x1ECA: scsiOneValue.Add("Device complies with SAT-2 ANSI INCITS 465-2010"); + break; case 0x1EE0: scsiOneValue.Add("Device complies with SAT-3 (no version claimed)"); + break; case 0x1EE2: scsiOneValue.Add("Device complies with SAT-3 T10/BSR INCITS 517 revision 4"); + break; case 0x1EE4: scsiOneValue.Add("Device complies with SAT-3 T10/BSR INCITS 517 revision 7"); + break; case 0x1EE8: scsiOneValue.Add("Device complies with SAT-3 ANSI INCITS 517-2015"); + break; case 0x1F00: scsiOneValue.Add("Device complies with SAT-4 (no version claimed)"); + break; case 0x20A0: scsiOneValue.Add("Device complies with SPL (no version claimed)"); + break; case 0x20A3: scsiOneValue.Add("Device complies with SPL T10/2124-D revision 6a"); + break; case 0x20A5: scsiOneValue.Add("Device complies with SPL T10/2124-D revision 7"); + break; case 0x20A7: scsiOneValue.Add("Device complies with SPL ANSI INCITS 476-2011"); + break; case 0x20A8: scsiOneValue.Add("Device complies with SPL ANSI INCITS 476-2011 + SPL AM1 INCITS 476/AM1 2012"); + break; case 0x20AA: scsiOneValue.Add("Device complies with SPL ISO/IEC 14776-261:2012"); + break; case 0x20C0: scsiOneValue.Add("Device complies with SPL-2 (no version claimed)"); + break; case 0x20C2: scsiOneValue.Add("Device complies with SPL-2 T10/BSR INCITS 505 revision 4"); + break; case 0x20C4: scsiOneValue.Add("Device complies with SPL-2 T10/BSR INCITS 505 revision 5"); + break; case 0x20C8: scsiOneValue.Add("Device complies with SPL-2 ANSI INCITS 505-2013"); + break; case 0x20E0: scsiOneValue.Add("Device complies with SPL-3 (no version claimed)"); + break; case 0x20E4: scsiOneValue.Add("Device complies with SPL-3 T10/BSR INCITS 492 revision 6"); + break; case 0x20E6: scsiOneValue.Add("Device complies with SPL-3 T10/BSR INCITS 492 revision 7"); + break; case 0x20E8: scsiOneValue.Add("Device complies with SPL-3 ANSI INCITS 492-2015"); + break; case 0x2100: scsiOneValue.Add("Device complies with SPL-4 (no version claimed)"); + break; case 0x21E0: scsiOneValue.Add("Device complies with SOP (no version claimed)"); + break; case 0x21E4: scsiOneValue.Add("Device complies with SOP T10/BSR INCITS 489 revision 4"); + break; case 0x21E6: scsiOneValue.Add("Device complies with SOP T10/BSR INCITS 489 revision 5"); + break; case 0x21E8: scsiOneValue.Add("Device complies with SOP ANSI INCITS 489-2014"); + break; case 0x2200: scsiOneValue.Add("Device complies with PQI (no version claimed)"); + break; case 0x2204: scsiOneValue.Add("Device complies with PQI T10/BSR INCITS 490 revision 6"); + break; case 0x2206: scsiOneValue.Add("Device complies with PQI T10/BSR INCITS 490 revision 7"); + break; case 0x2208: scsiOneValue.Add("Device complies with PQI ANSI INCITS 490-2014"); + break; case 0x2220: scsiOneValue.Add("Device complies with SOP-2 (no version claimed)"); + break; case 0x2240: scsiOneValue.Add("Device complies with PQI-2 (no version claimed)"); + break; case 0xFFC0: scsiOneValue.Add("Device complies with IEEE 1667 (no version claimed)"); + break; case 0xFFC1: scsiOneValue.Add("Device complies with IEEE 1667-2006"); + break; case 0xFFC2: scsiOneValue.Add("Device complies with IEEE 1667-2009"); + break; default: scsiOneValue.Add($"Device complies with unknown standard code 0x{versionDescriptor:X4}"); + break; } diff --git a/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs b/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs index 7b908898..6bb5bf20 100644 --- a/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs +++ b/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs @@ -39,251 +39,480 @@ namespace DiscImageChef.Server public static class ScsiMmcFeatures { /// - /// Takes the MMC FEATURES part of a device report and prints it as a list of values to be sequenced by ASP.NET in the - /// rendering + /// Takes the MMC FEATURES part of a device report and prints it as a list of values to be sequenced by ASP.NET in + /// the rendering /// /// FEATURES part of the report /// List to put the values on public static void Report(MmcFeatures ftr, ref List mmcOneValue) { - if (ftr.SupportsAACS && ftr.AACSVersion.HasValue) + if(ftr.SupportsAACS && + ftr.AACSVersion.HasValue) mmcOneValue.Add($"Drive supports AACS version {ftr.AACSVersion}"); - else if (ftr.SupportsAACS) mmcOneValue.Add("Drive supports AACS"); - if (ftr.AGIDs.HasValue) mmcOneValue.Add($"Drive supports {ftr.AGIDs} AGIDs concurrently"); - if (ftr.CanGenerateBindingNonce) + else if(ftr.SupportsAACS) + mmcOneValue.Add("Drive supports AACS"); + + if(ftr.AGIDs.HasValue) + mmcOneValue.Add($"Drive supports {ftr.AGIDs} AGIDs concurrently"); + + if(ftr.CanGenerateBindingNonce) { mmcOneValue.Add("Drive supports generating the binding nonce"); - if (ftr.BindingNonceBlocks.HasValue) + + if(ftr.BindingNonceBlocks.HasValue) mmcOneValue.Add($"{ftr.BindingNonceBlocks} media blocks are required for the binding nonce"); } - if (ftr.BlocksPerReadableUnit > 1) + if(ftr.BlocksPerReadableUnit > 1) mmcOneValue.Add($"{ftr.BlocksPerReadableUnit} logical blocks per media writable unit"); - if (ftr.BufferUnderrunFreeInDVD) mmcOneValue.Add("Drive supports zero loss linking writing DVDs"); - if (ftr.BufferUnderrunFreeInSAO) - mmcOneValue.Add("Drive supports zero loss linking in Session at Once Mode"); - if (ftr.BufferUnderrunFreeInTAO) mmcOneValue.Add("Drive supports zero loss linking in Track at Once Mode"); - if (ftr.CanAudioScan) mmcOneValue.Add("Drive supports the SCAN command"); - if (ftr.CanEject) mmcOneValue.Add("Drive can eject media"); - if (ftr.CanEraseSector) mmcOneValue.Add("Drive supports media that require erasing before writing"); - if (ftr.CanExpandBDRESpareArea) - mmcOneValue.Add("Drive can expand the spare area on a formatted BD-RE disc"); - if (ftr.CanFormat) mmcOneValue.Add("Drive can format media into logical blocks"); - if (ftr.CanFormatBDREWithoutSpare) mmcOneValue.Add("Drive can format BD-RE with no spares allocated"); - if (ftr.CanFormatQCert) mmcOneValue.Add("Drive can format BD-RE discs with quick certification"); - if (ftr.CanFormatCert) mmcOneValue.Add("Drive can format BD-RE discs with full certification"); - if (ftr.CanFormatFRF) mmcOneValue.Add("Drive can fast re-format BD-RE discs"); - if (ftr.CanFormatRRM) mmcOneValue.Add("Drive can format BD-R discs with RRM format"); - if (ftr.CanLoad) mmcOneValue.Add("Drive can load media"); - if (ftr.CanMuteSeparateChannels) mmcOneValue.Add("Drive is able to mute channels separately"); - if (ftr.CanOverwriteSAOTrack) mmcOneValue.Add("Drive can overwrite a SAO track with another in CD-RWs"); - if (ftr.CanOverwriteTAOTrack) mmcOneValue.Add("Drive can overwrite a TAO track with another in CD-RWs"); - if (ftr.CanPlayCDAudio) mmcOneValue.Add("Drive has an analogue audio output"); - if (ftr.CanPseudoOverwriteBDR) mmcOneValue.Add("Drive can write BD-R on Pseudo-OVerwrite SRM mode"); - if (ftr.CanReadAllDualR) mmcOneValue.Add("Drive can read DVD-R DL from all recording modes"); - if (ftr.CanReadAllDualRW) mmcOneValue.Add("Drive can read DVD-RW DL from all recording modes"); - if (ftr.CanReadBD) mmcOneValue.Add("Drive can read BD-ROM"); - if (ftr.CanReadBDR) mmcOneValue.Add("Drive can read BD-R Ver.1"); - if (ftr.CanReadBDRE1) mmcOneValue.Add("Drive can read BD-RE Ver.1"); - if (ftr.CanReadBDRE2) mmcOneValue.Add("Drive can read BD-RE Ver.2"); - if (ftr.CanReadBDROM) mmcOneValue.Add("Drive can read BD-ROM Ver.1"); - if (ftr.CanReadBluBCA) mmcOneValue.Add("Drive can read BD's Burst Cutting Area"); - if (ftr.CanReadCD) mmcOneValue.Add("Drive can read CD-ROM"); - if (ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW) - mmcOneValue.Add("Drive can read and write CD-MRW and DVD+MRW"); - else if (ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW) - mmcOneValue.Add("Drive can read and write DVD+MRW"); - else if (ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW) - mmcOneValue.Add("Drive and read DVD+MRW and read and write CD-MRW"); - else if (ftr.CanWriteCDMRW) mmcOneValue.Add("Drive can read and write CD-MRW"); - else if (ftr.CanReadDVDPlusMRW) mmcOneValue.Add("Drive can read CD-MRW and DVD+MRW"); - else if (ftr.CanReadCDMRW) mmcOneValue.Add("Drive can read CD-MRW"); - if (ftr.CanReadCPRM_MKB) mmcOneValue.Add("Drive supports reading Media Key Block of CPRM"); - if (ftr.CanReadDDCD) mmcOneValue.Add("Drive can read DDCDs"); - if (ftr.CanReadDVD) mmcOneValue.Add("Drive can read DVD"); - if (ftr.CanWriteDVDPlusRW) mmcOneValue.Add("Drive can read and write DVD+RW"); - else if (ftr.CanReadDVDPlusRW) mmcOneValue.Add("Drive can read DVD+RW"); - if (ftr.CanWriteDVDPlusR) mmcOneValue.Add("Drive can read and write DVD+R"); - else if (ftr.CanReadDVDPlusR) mmcOneValue.Add("Drive can read DVD+R"); - if (ftr.CanWriteDVDPlusRDL) mmcOneValue.Add("Drive can read and write DVD+R DL"); - else if (ftr.CanReadDVDPlusRDL) mmcOneValue.Add("Drive can read DVD+R DL"); - if (ftr.CanReadDriveAACSCertificate) mmcOneValue.Add("Drive supports reading the Drive Certificate"); - if (ftr.CanReadHDDVD && ftr.CanReadHDDVDR && ftr.CanReadHDDVDRAM) - mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM"); - else if (ftr.CanReadHDDVD && ftr.CanReadHDDVDR) - mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R"); - else if (ftr.CanReadHDDVD && ftr.CanReadHDDVDRAM) - mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM"); - else if (ftr.CanReadHDDVD) mmcOneValue.Add("Drive can read HD DVD-ROM and HD DVD-RW"); - if (ftr.CanReadLeadInCDText) mmcOneValue.Add("Drive can return CD-Text from Lead-In"); - if (ftr.CanReadOldBDR) mmcOneValue.Add("Drive can read BD-R pre-1.0"); - if (ftr.CanReadOldBDRE) mmcOneValue.Add("Drive can read BD-RE pre-1.0"); - if (ftr.CanReadOldBDROM) mmcOneValue.Add("Drive can read BD-ROM pre-1.0"); - if (ftr.CanReadSpareAreaInformation) mmcOneValue.Add("Drive can return Spare Area Information"); - if (ftr.CanReportDriveSerial) mmcOneValue.Add("Drive is to report drive serial number"); - if (ftr.CanReportMediaSerial) mmcOneValue.Add("Drive is to read media serial number"); - if (ftr.CanTestWriteDDCDR) mmcOneValue.Add("Drive can do a test writing with DDCD-R"); - if (ftr.CanTestWriteDVD) mmcOneValue.Add("Drive can do a test writing with DVDs"); - if (ftr.CanTestWriteInSAO) mmcOneValue.Add("Drive can do a test writing in Session at Once Mode"); - if (ftr.CanTestWriteInTAO) mmcOneValue.Add("Drive can do a test writing in Track at Once Mode"); - if (ftr.CanUpgradeFirmware) mmcOneValue.Add("Drive supports Microcode Upgrade"); - if (ftr.ErrorRecoveryPage) mmcOneValue.Add("Drive shall report Read/Write Error Recovery mode page"); - if (ftr.Locked) mmcOneValue.Add("Drive can lock media"); - if (ftr.LogicalBlockSize > 0) mmcOneValue.Add($"{ftr.LogicalBlockSize} bytes per logical block"); - if (ftr.MultiRead) - mmcOneValue.Add( - "Drive claims capability to read all CD formats according to OSTA Multi-Read Specification"); - if (ftr.PhysicalInterfaceStandard.HasValue) - switch (ftr.PhysicalInterfaceStandard) + if(ftr.BufferUnderrunFreeInDVD) + mmcOneValue.Add("Drive supports zero loss linking writing DVDs"); + + if(ftr.BufferUnderrunFreeInSAO) + mmcOneValue.Add("Drive supports zero loss linking in Session at Once Mode"); + + if(ftr.BufferUnderrunFreeInTAO) + mmcOneValue.Add("Drive supports zero loss linking in Track at Once Mode"); + + if(ftr.CanAudioScan) + mmcOneValue.Add("Drive supports the SCAN command"); + + if(ftr.CanEject) + mmcOneValue.Add("Drive can eject media"); + + if(ftr.CanEraseSector) + mmcOneValue.Add("Drive supports media that require erasing before writing"); + + if(ftr.CanExpandBDRESpareArea) + mmcOneValue.Add("Drive can expand the spare area on a formatted BD-RE disc"); + + if(ftr.CanFormat) + mmcOneValue.Add("Drive can format media into logical blocks"); + + if(ftr.CanFormatBDREWithoutSpare) + mmcOneValue.Add("Drive can format BD-RE with no spares allocated"); + + if(ftr.CanFormatQCert) + mmcOneValue.Add("Drive can format BD-RE discs with quick certification"); + + if(ftr.CanFormatCert) + mmcOneValue.Add("Drive can format BD-RE discs with full certification"); + + if(ftr.CanFormatFRF) + mmcOneValue.Add("Drive can fast re-format BD-RE discs"); + + if(ftr.CanFormatRRM) + mmcOneValue.Add("Drive can format BD-R discs with RRM format"); + + if(ftr.CanLoad) + mmcOneValue.Add("Drive can load media"); + + if(ftr.CanMuteSeparateChannels) + mmcOneValue.Add("Drive is able to mute channels separately"); + + if(ftr.CanOverwriteSAOTrack) + mmcOneValue.Add("Drive can overwrite a SAO track with another in CD-RWs"); + + if(ftr.CanOverwriteTAOTrack) + mmcOneValue.Add("Drive can overwrite a TAO track with another in CD-RWs"); + + if(ftr.CanPlayCDAudio) + mmcOneValue.Add("Drive has an analogue audio output"); + + if(ftr.CanPseudoOverwriteBDR) + mmcOneValue.Add("Drive can write BD-R on Pseudo-OVerwrite SRM mode"); + + if(ftr.CanReadAllDualR) + mmcOneValue.Add("Drive can read DVD-R DL from all recording modes"); + + if(ftr.CanReadAllDualRW) + mmcOneValue.Add("Drive can read DVD-RW DL from all recording modes"); + + if(ftr.CanReadBD) + mmcOneValue.Add("Drive can read BD-ROM"); + + if(ftr.CanReadBDR) + mmcOneValue.Add("Drive can read BD-R Ver.1"); + + if(ftr.CanReadBDRE1) + mmcOneValue.Add("Drive can read BD-RE Ver.1"); + + if(ftr.CanReadBDRE2) + mmcOneValue.Add("Drive can read BD-RE Ver.2"); + + if(ftr.CanReadBDROM) + mmcOneValue.Add("Drive can read BD-ROM Ver.1"); + + if(ftr.CanReadBluBCA) + mmcOneValue.Add("Drive can read BD's Burst Cutting Area"); + + if(ftr.CanReadCD) + mmcOneValue.Add("Drive can read CD-ROM"); + + if(ftr.CanWriteCDMRW && + ftr.CanReadDVDPlusMRW && + ftr.CanWriteDVDPlusMRW) + mmcOneValue.Add("Drive can read and write CD-MRW and DVD+MRW"); + else if(ftr.CanReadDVDPlusMRW && + ftr.CanWriteDVDPlusMRW) + mmcOneValue.Add("Drive can read and write DVD+MRW"); + else if(ftr.CanWriteCDMRW && + ftr.CanReadDVDPlusMRW) + mmcOneValue.Add("Drive and read DVD+MRW and read and write CD-MRW"); + else if(ftr.CanWriteCDMRW) + mmcOneValue.Add("Drive can read and write CD-MRW"); + else if(ftr.CanReadDVDPlusMRW) + mmcOneValue.Add("Drive can read CD-MRW and DVD+MRW"); + else if(ftr.CanReadCDMRW) + mmcOneValue.Add("Drive can read CD-MRW"); + + if(ftr.CanReadCPRM_MKB) + mmcOneValue.Add("Drive supports reading Media Key Block of CPRM"); + + if(ftr.CanReadDDCD) + mmcOneValue.Add("Drive can read DDCDs"); + + if(ftr.CanReadDVD) + mmcOneValue.Add("Drive can read DVD"); + + if(ftr.CanWriteDVDPlusRW) + mmcOneValue.Add("Drive can read and write DVD+RW"); + else if(ftr.CanReadDVDPlusRW) + mmcOneValue.Add("Drive can read DVD+RW"); + + if(ftr.CanWriteDVDPlusR) + mmcOneValue.Add("Drive can read and write DVD+R"); + else if(ftr.CanReadDVDPlusR) + mmcOneValue.Add("Drive can read DVD+R"); + + if(ftr.CanWriteDVDPlusRDL) + mmcOneValue.Add("Drive can read and write DVD+R DL"); + else if(ftr.CanReadDVDPlusRDL) + mmcOneValue.Add("Drive can read DVD+R DL"); + + if(ftr.CanReadDriveAACSCertificate) + mmcOneValue.Add("Drive supports reading the Drive Certificate"); + + if(ftr.CanReadHDDVD && + ftr.CanReadHDDVDR && + ftr.CanReadHDDVDRAM) + mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM"); + else if(ftr.CanReadHDDVD && + ftr.CanReadHDDVDR) + mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R"); + else if(ftr.CanReadHDDVD && + ftr.CanReadHDDVDRAM) + mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM"); + else if(ftr.CanReadHDDVD) + mmcOneValue.Add("Drive can read HD DVD-ROM and HD DVD-RW"); + + if(ftr.CanReadLeadInCDText) + mmcOneValue.Add("Drive can return CD-Text from Lead-In"); + + if(ftr.CanReadOldBDR) + mmcOneValue.Add("Drive can read BD-R pre-1.0"); + + if(ftr.CanReadOldBDRE) + mmcOneValue.Add("Drive can read BD-RE pre-1.0"); + + if(ftr.CanReadOldBDROM) + mmcOneValue.Add("Drive can read BD-ROM pre-1.0"); + + if(ftr.CanReadSpareAreaInformation) + mmcOneValue.Add("Drive can return Spare Area Information"); + + if(ftr.CanReportDriveSerial) + mmcOneValue.Add("Drive is to report drive serial number"); + + if(ftr.CanReportMediaSerial) + mmcOneValue.Add("Drive is to read media serial number"); + + if(ftr.CanTestWriteDDCDR) + mmcOneValue.Add("Drive can do a test writing with DDCD-R"); + + if(ftr.CanTestWriteDVD) + mmcOneValue.Add("Drive can do a test writing with DVDs"); + + if(ftr.CanTestWriteInSAO) + mmcOneValue.Add("Drive can do a test writing in Session at Once Mode"); + + if(ftr.CanTestWriteInTAO) + mmcOneValue.Add("Drive can do a test writing in Track at Once Mode"); + + if(ftr.CanUpgradeFirmware) + mmcOneValue.Add("Drive supports Microcode Upgrade"); + + if(ftr.ErrorRecoveryPage) + mmcOneValue.Add("Drive shall report Read/Write Error Recovery mode page"); + + if(ftr.Locked) + mmcOneValue.Add("Drive can lock media"); + + if(ftr.LogicalBlockSize > 0) + mmcOneValue.Add($"{ftr.LogicalBlockSize} bytes per logical block"); + + if(ftr.MultiRead) + mmcOneValue. + Add("Drive claims capability to read all CD formats according to OSTA Multi-Read Specification"); + + if(ftr.PhysicalInterfaceStandard.HasValue) + switch(ftr.PhysicalInterfaceStandard) { case PhysicalInterfaces.Unspecified: mmcOneValue.Add("Drive uses an unspecified physical interface"); + break; case PhysicalInterfaces.SCSI: mmcOneValue.Add("Drive uses SCSI interface"); + break; case PhysicalInterfaces.ATAPI: mmcOneValue.Add("Drive uses ATAPI interface"); + break; case PhysicalInterfaces.IEEE1394: mmcOneValue.Add("Drive uses IEEE-1394 interface"); + break; case PhysicalInterfaces.IEEE1394A: mmcOneValue.Add("Drive uses IEEE-1394A interface"); + break; case PhysicalInterfaces.FC: mmcOneValue.Add("Drive uses Fibre Channel interface"); + break; case PhysicalInterfaces.IEEE1394B: mmcOneValue.Add("Drive uses IEEE-1394B interface"); + break; case PhysicalInterfaces.SerialATAPI: mmcOneValue.Add("Drive uses Serial ATAPI interface"); + break; case PhysicalInterfaces.USB: mmcOneValue.Add("Drive uses USB interface"); + break; case PhysicalInterfaces.Vendor: mmcOneValue.Add("Drive uses a vendor unique interface"); + break; default: - mmcOneValue - .Add($"Drive uses an unknown interface with code {(uint) ftr.PhysicalInterfaceStandard}"); + mmcOneValue. + Add($"Drive uses an unknown interface with code {(uint)ftr.PhysicalInterfaceStandard}"); + break; } - if (ftr.PreventJumper) mmcOneValue.Add("Drive power ups locked"); - if (ftr.SupportsBusEncryption) mmcOneValue.Add("Drive supports bus encryption"); - if (ftr.CanWriteBD) mmcOneValue.Add("Drive can write BD-R or BD-RE"); - if (ftr.CanWriteBDR) mmcOneValue.Add("Drive can write BD-R Ver.1"); - if (ftr.CanWriteBDRE1) mmcOneValue.Add("Drive can write BD-RE Ver.1"); - if (ftr.CanWriteBDRE2) mmcOneValue.Add("Drive can write BD-RE Ver.2"); - if (ftr.CanWriteBusEncryptedBlocks) mmcOneValue.Add("Drive supports writing with bus encryption"); - if (ftr.CanWriteCDRW) mmcOneValue.Add("Drive can write CD-RW"); - if (ftr.CanWriteCDRWCAV) mmcOneValue.Add("Drive can write High-Speed CD-RW"); - if (ftr.CanWriteCDSAO && !ftr.CanWriteRaw) + if(ftr.PreventJumper) + mmcOneValue.Add("Drive power ups locked"); + + if(ftr.SupportsBusEncryption) + mmcOneValue.Add("Drive supports bus encryption"); + + if(ftr.CanWriteBD) + mmcOneValue.Add("Drive can write BD-R or BD-RE"); + + if(ftr.CanWriteBDR) + mmcOneValue.Add("Drive can write BD-R Ver.1"); + + if(ftr.CanWriteBDRE1) + mmcOneValue.Add("Drive can write BD-RE Ver.1"); + + if(ftr.CanWriteBDRE2) + mmcOneValue.Add("Drive can write BD-RE Ver.2"); + + if(ftr.CanWriteBusEncryptedBlocks) + mmcOneValue.Add("Drive supports writing with bus encryption"); + + if(ftr.CanWriteCDRW) + mmcOneValue.Add("Drive can write CD-RW"); + + if(ftr.CanWriteCDRWCAV) + mmcOneValue.Add("Drive can write High-Speed CD-RW"); + + if(ftr.CanWriteCDSAO && + !ftr.CanWriteRaw) mmcOneValue.Add("Drive can write CDs in Session at Once Mode:"); - else if (!ftr.CanWriteCDSAO && ftr.CanWriteRaw) mmcOneValue.Add("Drive can write CDs in raw Mode:"); - else if (ftr.CanWriteCDSAO && ftr.CanWriteRaw) + else if(!ftr.CanWriteCDSAO && + ftr.CanWriteRaw) + mmcOneValue.Add("Drive can write CDs in raw Mode:"); + else if(ftr.CanWriteCDSAO && + ftr.CanWriteRaw) mmcOneValue.Add("Drive can write CDs in Session at Once and in Raw Modes:"); - if (ftr.CanWriteCDTAO) mmcOneValue.Add("Drive can write CDs in Track at Once Mode:"); - if (ftr.CanWriteCSSManagedDVD) mmcOneValue.Add("Drive can write CSS managed DVDs"); - if (ftr.CanWriteDDCDR) mmcOneValue.Add("Drive supports writing DDCD-R"); - if (ftr.CanWriteDDCDRW) mmcOneValue.Add("Drive supports writing DDCD-RW"); - if (ftr.CanWriteDVDPlusRWDL) mmcOneValue.Add("Drive can read and write DVD+RW DL"); - else if (ftr.CanReadDVDPlusRWDL) mmcOneValue.Add("Drive can read DVD+RW DL"); - if (ftr.CanWriteDVDR && ftr.CanWriteDVDRW && ftr.CanWriteDVDRDL) + + if(ftr.CanWriteCDTAO) + mmcOneValue.Add("Drive can write CDs in Track at Once Mode:"); + + if(ftr.CanWriteCSSManagedDVD) + mmcOneValue.Add("Drive can write CSS managed DVDs"); + + if(ftr.CanWriteDDCDR) + mmcOneValue.Add("Drive supports writing DDCD-R"); + + if(ftr.CanWriteDDCDRW) + mmcOneValue.Add("Drive supports writing DDCD-RW"); + + if(ftr.CanWriteDVDPlusRWDL) + mmcOneValue.Add("Drive can read and write DVD+RW DL"); + else if(ftr.CanReadDVDPlusRWDL) + mmcOneValue.Add("Drive can read DVD+RW DL"); + + if(ftr.CanWriteDVDR && + ftr.CanWriteDVDRW && + ftr.CanWriteDVDRDL) mmcOneValue.Add("Drive supports writing DVD-R, DVD-RW and DVD-R DL"); - else if (ftr.CanWriteDVDR && ftr.CanWriteDVDRDL) + else if(ftr.CanWriteDVDR && + ftr.CanWriteDVDRDL) mmcOneValue.Add("Drive supports writing DVD-R and DVD-R DL"); - else if (ftr.CanWriteDVDR && ftr.CanWriteDVDRW) mmcOneValue.Add("Drive supports writing DVD-R and DVD-RW"); - else if (ftr.CanWriteDVDR) mmcOneValue.Add("Drive supports writing DVD-R"); - if (ftr.CanWriteHDDVDR && ftr.CanWriteHDDVDRAM) + else if(ftr.CanWriteDVDR && + ftr.CanWriteDVDRW) + mmcOneValue.Add("Drive supports writing DVD-R and DVD-RW"); + else if(ftr.CanWriteDVDR) + mmcOneValue.Add("Drive supports writing DVD-R"); + + if(ftr.CanWriteHDDVDR && + ftr.CanWriteHDDVDRAM) mmcOneValue.Add("Drive can write HD DVD-RW, HD DVD-R and HD DVD-RAM"); - else if (ftr.CanWriteHDDVDR) mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-R"); - else if (ftr.CanWriteHDDVDRAM) mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-RAM"); + else if(ftr.CanWriteHDDVDR) + mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-R"); + else if(ftr.CanWriteHDDVDRAM) + mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-RAM"); + // TODO: Write HD DVD-RW /* else mmcOneValue.Add("Drive can write HD DVD-RW"); */ - if (ftr.CanWriteOldBDR) mmcOneValue.Add("Drive can write BD-R pre-1.0"); - if (ftr.CanWriteOldBDRE) mmcOneValue.Add("Drive can write BD-RE pre-1.0"); - if (ftr.CanWriteRWSubchannelInTAO) + if(ftr.CanWriteOldBDR) + mmcOneValue.Add("Drive can write BD-R pre-1.0"); + + if(ftr.CanWriteOldBDRE) + mmcOneValue.Add("Drive can write BD-RE pre-1.0"); + + if(ftr.CanWriteRWSubchannelInTAO) { mmcOneValue.Add("Drive can write user provided data in the R-W subchannels in Track at Once Mode"); - if (ftr.CanWriteRawSubchannelInTAO) + + if(ftr.CanWriteRawSubchannelInTAO) mmcOneValue.Add("Drive accepts RAW R-W subchannel data in Track at Once Mode"); - if (ftr.CanWritePackedSubchannelInTAO) + + if(ftr.CanWritePackedSubchannelInTAO) mmcOneValue.Add("Drive accepts Packed R-W subchannel data in Track at Once Mode"); } - if (ftr.CanWriteRWSubchannelInSAO) + if(ftr.CanWriteRWSubchannelInSAO) mmcOneValue.Add("Drive can write user provided data in the R-W subchannels in Session at Once Mode"); - if (ftr.CanWriteRaw && ftr.CanWriteRawMultiSession) + + if(ftr.CanWriteRaw && + ftr.CanWriteRawMultiSession) mmcOneValue.Add("Drive can write multi-session CDs in raw mode"); - if (ftr.EmbeddedChanger) + + if(ftr.EmbeddedChanger) { mmcOneValue.Add("Drive contains an embedded changer"); - if (ftr.ChangerIsSideChangeCapable) mmcOneValue.Add("Drive can change disc side"); - if (ftr.ChangerSupportsDiscPresent) + if(ftr.ChangerIsSideChangeCapable) + mmcOneValue.Add("Drive can change disc side"); + + if(ftr.ChangerSupportsDiscPresent) mmcOneValue.Add("Drive is able to report slots contents after a reset or change"); mmcOneValue.Add($"Drive has {ftr.ChangerSlots + 1} slots"); } - if (ftr.SupportsCSS && ftr.CSSVersion.HasValue) + if(ftr.SupportsCSS && + ftr.CSSVersion.HasValue) mmcOneValue.Add($"Drive supports DVD CSS/CPPM version {ftr.CSSVersion}"); - else if (ftr.SupportsCSS) mmcOneValue.Add("Drive supports DVD CSS/CPRM"); - if (ftr.SupportsCPRM && ftr.CPRMVersion.HasValue) - mmcOneValue.Add($"Drive supports DVD CPPM version {ftr.CPRMVersion}"); - else if (ftr.SupportsCPRM) mmcOneValue.Add("Drive supports DVD CPRM"); - if (ftr.DBML) mmcOneValue.Add("Drive reports Device Busy Class events during medium loading/unloading"); - if (ftr.DVDMultiRead) mmcOneValue.Add("Drive conforms to DVD Multi Drive Read-only Specifications"); - if (ftr.FirmwareDate.HasValue) mmcOneValue.Add($"Drive firmware is dated {ftr.FirmwareDate}"); - if (ftr.SupportsC2) mmcOneValue.Add("Drive supports C2 Error Pointers"); - if (ftr.SupportsDAP) mmcOneValue.Add("Drive supports the DAP bit in the READ CD and READ CD MSF commands"); - if (ftr.SupportsDeviceBusyEvent) mmcOneValue.Add("Drive supports Device Busy events"); + else if(ftr.SupportsCSS) + mmcOneValue.Add("Drive supports DVD CSS/CPRM"); - if (ftr.LoadingMechanismType.HasValue) - switch (ftr.LoadingMechanismType) + if(ftr.SupportsCPRM && + ftr.CPRMVersion.HasValue) + mmcOneValue.Add($"Drive supports DVD CPPM version {ftr.CPRMVersion}"); + else if(ftr.SupportsCPRM) + mmcOneValue.Add("Drive supports DVD CPRM"); + + if(ftr.DBML) + mmcOneValue.Add("Drive reports Device Busy Class events during medium loading/unloading"); + + if(ftr.DVDMultiRead) + mmcOneValue.Add("Drive conforms to DVD Multi Drive Read-only Specifications"); + + if(ftr.FirmwareDate.HasValue) + mmcOneValue.Add($"Drive firmware is dated {ftr.FirmwareDate}"); + + if(ftr.SupportsC2) + mmcOneValue.Add("Drive supports C2 Error Pointers"); + + if(ftr.SupportsDAP) + mmcOneValue.Add("Drive supports the DAP bit in the READ CD and READ CD MSF commands"); + + if(ftr.SupportsDeviceBusyEvent) + mmcOneValue.Add("Drive supports Device Busy events"); + + if(ftr.LoadingMechanismType.HasValue) + switch(ftr.LoadingMechanismType) { case 0: mmcOneValue.Add("Drive uses media caddy"); + break; case 1: mmcOneValue.Add("Drive uses a tray"); + break; case 2: mmcOneValue.Add("Drive is pop-up"); + break; case 4: mmcOneValue.Add("Drive is a changer with individually changeable discs"); + break; case 5: mmcOneValue.Add("Drive is a changer using cartridges"); + break; default: mmcOneValue.Add($"Drive uses unknown loading mechanism type {ftr.LoadingMechanismType}"); + break; } - if (ftr.SupportsHybridDiscs) mmcOneValue.Add("Drive is able to access Hybrid discs"); - if (ftr.SupportsModePage1Ch) + if(ftr.SupportsHybridDiscs) + mmcOneValue.Add("Drive is able to access Hybrid discs"); + + if(ftr.SupportsModePage1Ch) mmcOneValue.Add("Drive supports the Informational Exceptions Control mode page 1Ch"); - if (ftr.SupportsOSSC) + + if(ftr.SupportsOSSC) mmcOneValue.Add("Drive supports the Trusted Computing Group Optical Security Subsystem Class"); - if (ftr.SupportsPWP) mmcOneValue.Add("Drive supports set/release of PWP status"); - if (ftr.SupportsSWPP) mmcOneValue.Add("Drive supports the SWPP bit of the Timeout and Protect mode page"); - if (ftr.SupportsSecurDisc) mmcOneValue.Add("Drive supports SecurDisc"); - if (ftr.SupportsSeparateVolume) mmcOneValue.Add("Drive supports separate volume per channel"); - if (ftr.SupportsVCPS) mmcOneValue.Add("Drive supports VCPS"); - if (ftr.VolumeLevels.HasValue) mmcOneValue.Add($"Drive has {ftr.VolumeLevels + 1} volume levels"); - if (ftr.SupportsWriteProtectPAC) + + if(ftr.SupportsPWP) + mmcOneValue.Add("Drive supports set/release of PWP status"); + + if(ftr.SupportsSWPP) + mmcOneValue.Add("Drive supports the SWPP bit of the Timeout and Protect mode page"); + + if(ftr.SupportsSecurDisc) + mmcOneValue.Add("Drive supports SecurDisc"); + + if(ftr.SupportsSeparateVolume) + mmcOneValue.Add("Drive supports separate volume per channel"); + + if(ftr.SupportsVCPS) + mmcOneValue.Add("Drive supports VCPS"); + + if(ftr.VolumeLevels.HasValue) + mmcOneValue.Add($"Drive has {ftr.VolumeLevels + 1} volume levels"); + + if(ftr.SupportsWriteProtectPAC) mmcOneValue.Add("Drive supports reading/writing the Disc Write Protect PAC on BD-R/-RE media"); - if (ftr.SupportsWriteInhibitDCB) + + if(ftr.SupportsWriteInhibitDCB) mmcOneValue.Add("Drive supports writing the Write Inhibit DCB on DVD+RW media"); mmcOneValue.Sort(); diff --git a/DiscImageChef.Server/App_Start/ScsiMmcMode.cs b/DiscImageChef.Server/App_Start/ScsiMmcMode.cs index 8e41a954..76716584 100644 --- a/DiscImageChef.Server/App_Start/ScsiMmcMode.cs +++ b/DiscImageChef.Server/App_Start/ScsiMmcMode.cs @@ -39,135 +39,188 @@ namespace DiscImageChef.Server public static class ScsiMmcMode { /// - /// Takes the MODE PAGE 2Ah part of a device report and prints it as a list of values to be sequenced by ASP.NET in the - /// rendering + /// Takes the MODE PAGE 2Ah part of a device report and prints it as a list of values to be sequenced by ASP.NET + /// in the rendering /// /// MODE PAGE 2Ah part of the report /// List to put the values on public static void Report(Modes.ModePage_2A mode, ref List mmcOneValue) { - if (mode.AudioPlay) mmcOneValue.Add("Drive can play audio"); - if (mode.Mode2Form1) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format"); - if (mode.Mode2Form2) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format"); - if (mode.MultiSession) mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD"); + if(mode.AudioPlay) + mmcOneValue.Add("Drive can play audio"); - if (mode.CDDACommand) mmcOneValue.Add("Drive can read digital audio"); - if (mode.AccurateCDDA) mmcOneValue.Add("Drive can continue from streaming loss"); - if (mode.Subchannel) mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels"); - if (mode.DeinterlaveSubchannel) mmcOneValue.Add("Drive can read, deinterleave and correct R-W subchannels"); - if (mode.C2Pointer) mmcOneValue.Add("Drive supports C2 pointers"); - if (mode.UPC) mmcOneValue.Add("Drive can read Media Catalogue Number"); - if (mode.ISRC) mmcOneValue.Add("Drive can read ISRC"); + if(mode.Mode2Form1) + mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format"); - switch (mode.LoadingMechanism) + if(mode.Mode2Form2) + mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format"); + + if(mode.MultiSession) + mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD"); + + if(mode.CDDACommand) + mmcOneValue.Add("Drive can read digital audio"); + + if(mode.AccurateCDDA) + mmcOneValue.Add("Drive can continue from streaming loss"); + + if(mode.Subchannel) + mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels"); + + if(mode.DeinterlaveSubchannel) + mmcOneValue.Add("Drive can read, deinterleave and correct R-W subchannels"); + + if(mode.C2Pointer) + mmcOneValue.Add("Drive supports C2 pointers"); + + if(mode.UPC) + mmcOneValue.Add("Drive can read Media Catalogue Number"); + + if(mode.ISRC) + mmcOneValue.Add("Drive can read ISRC"); + + switch(mode.LoadingMechanism) { case 0: mmcOneValue.Add("Drive uses media caddy"); + break; case 1: mmcOneValue.Add("Drive uses a tray"); + break; case 2: mmcOneValue.Add("Drive is pop-up"); + break; case 4: mmcOneValue.Add("Drive is a changer with individually changeable discs"); + break; case 5: mmcOneValue.Add("Drive is a changer using cartridges"); + break; default: mmcOneValue.Add($"Drive uses unknown loading mechanism type {mode.LoadingMechanism}"); + break; } - if (mode.Lock) mmcOneValue.Add("Drive can lock media"); - if (mode.PreventJumper) + if(mode.Lock) + mmcOneValue.Add("Drive can lock media"); + + if(mode.PreventJumper) { mmcOneValue.Add("Drive power ups locked"); - mmcOneValue.Add(mode.LockState - ? "Drive is locked, media cannot be ejected or inserted" - : "Drive is not locked, media can be ejected and inserted"); + + mmcOneValue.Add(mode.LockState ? "Drive is locked, media cannot be ejected or inserted" + : "Drive is not locked, media can be ejected and inserted"); } else { mmcOneValue.Add(mode.LockState - ? "Drive is locked, media cannot be ejected, but if empty, can be inserted" - : "Drive is not locked, media can be ejected and inserted"); + ? "Drive is locked, media cannot be ejected, but if empty, can be inserted" + : "Drive is not locked, media can be ejected and inserted"); } - if (mode.Eject) mmcOneValue.Add("Drive can eject media"); + if(mode.Eject) + mmcOneValue.Add("Drive can eject media"); - if (mode.SeparateChannelMute) mmcOneValue.Add("Each channel can be muted independently"); - if (mode.SeparateChannelVolume) mmcOneValue.Add("Each channel's volume can be controlled independently"); + if(mode.SeparateChannelMute) + mmcOneValue.Add("Each channel can be muted independently"); - if (mode.SupportedVolumeLevels > 0) + if(mode.SeparateChannelVolume) + mmcOneValue.Add("Each channel's volume can be controlled independently"); + + if(mode.SupportedVolumeLevels > 0) mmcOneValue.Add($"Drive supports {mode.SupportedVolumeLevels} volume levels"); - if (mode.BufferSize > 0) mmcOneValue.Add($"Drive has {mode.BufferSize} Kbyte of buffer"); - if (mode.MaximumSpeed > 0) + + if(mode.BufferSize > 0) + mmcOneValue.Add($"Drive has {mode.BufferSize} Kbyte of buffer"); + + if(mode.MaximumSpeed > 0) mmcOneValue.Add($"Drive's maximum reading speed is {mode.MaximumSpeed} Kbyte/sec."); - if (mode.CurrentSpeed > 0) + + if(mode.CurrentSpeed > 0) mmcOneValue.Add($"Drive's current reading speed is {mode.CurrentSpeed} Kbyte/sec."); - if (mode.ReadCDR) + if(mode.ReadCDR) { mmcOneValue.Add(mode.WriteCDR ? "Drive can read and write CD-R" : "Drive can read CD-R"); - if (mode.Method2) mmcOneValue.Add("Drive supports reading CD-R packet media"); + if(mode.Method2) + mmcOneValue.Add("Drive supports reading CD-R packet media"); } - if (mode.ReadCDRW) + if(mode.ReadCDRW) mmcOneValue.Add(mode.WriteCDRW ? "Drive can read and write CD-RW" : "Drive can read CD-RW"); - if (mode.ReadDVDROM) mmcOneValue.Add("Drive can read DVD-ROM"); - if (mode.ReadDVDR) + if(mode.ReadDVDROM) + mmcOneValue.Add("Drive can read DVD-ROM"); + + if(mode.ReadDVDR) mmcOneValue.Add(mode.WriteDVDR ? "Drive can read and write DVD-R" : "Drive can read DVD-R"); - if (mode.ReadDVDRAM) + + if(mode.ReadDVDRAM) mmcOneValue.Add(mode.WriteDVDRAM ? "Drive can read and write DVD-RAM" : "Drive can read DVD-RAM"); - if (mode.Composite) mmcOneValue.Add("Drive can deliver a composite audio and video data stream"); - if (mode.DigitalPort1) mmcOneValue.Add("Drive supports IEC-958 digital output on port 1"); - if (mode.DigitalPort2) mmcOneValue.Add("Drive supports IEC-958 digital output on port 2"); + if(mode.Composite) + mmcOneValue.Add("Drive can deliver a composite audio and video data stream"); - if (mode.SDP) mmcOneValue.Add("Drive contains a changer that can report the exact contents of the slots"); - if (mode.CurrentWriteSpeedSelected > 0) + if(mode.DigitalPort1) + mmcOneValue.Add("Drive supports IEC-958 digital output on port 1"); + + if(mode.DigitalPort2) + mmcOneValue.Add("Drive supports IEC-958 digital output on port 2"); + + if(mode.SDP) + mmcOneValue.Add("Drive contains a changer that can report the exact contents of the slots"); + + if(mode.CurrentWriteSpeedSelected > 0) { - if (mode.RotationControlSelected == 0) - mmcOneValue - .Add( - $"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode"); - else if (mode.RotationControlSelected == 1) - mmcOneValue - .Add( - $"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode"); + if(mode.RotationControlSelected == 0) + mmcOneValue. + Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode"); + else if(mode.RotationControlSelected == 1) + mmcOneValue. + Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode"); } else { - if (mode.MaxWriteSpeed > 0) + if(mode.MaxWriteSpeed > 0) mmcOneValue.Add($"Drive's maximum writing speed is {mode.MaxWriteSpeed} Kbyte/sec."); - if (mode.CurrentWriteSpeed > 0) + + if(mode.CurrentWriteSpeed > 0) mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeed} Kbyte/sec."); } - if (mode.WriteSpeedPerformanceDescriptors != null) - foreach (var descriptor in + if(mode.WriteSpeedPerformanceDescriptors != null) + foreach(Modes.ModePage_2A_WriteDescriptor descriptor in mode.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0)) - if (descriptor.RotationControl == 0) + if(descriptor.RotationControl == 0) mmcOneValue.Add($"Drive supports writing at {descriptor.WriteSpeed} Kbyte/sec. in CLV mode"); - else if (descriptor.RotationControl == 1) - mmcOneValue - .Add($"Drive supports writing at is {descriptor.WriteSpeed} Kbyte/sec. in pure CAV mode"); + else if(descriptor.RotationControl == 1) + mmcOneValue. + Add($"Drive supports writing at is {descriptor.WriteSpeed} Kbyte/sec. in pure CAV mode"); - if (mode.TestWrite) mmcOneValue.Add("Drive supports test writing"); + if(mode.TestWrite) + mmcOneValue.Add("Drive supports test writing"); - if (mode.ReadBarcode) mmcOneValue.Add("Drive can read barcode"); + if(mode.ReadBarcode) + mmcOneValue.Add("Drive can read barcode"); - if (mode.SCC) mmcOneValue.Add("Drive can read both sides of a disc"); - if (mode.LeadInPW) mmcOneValue.Add("Drive an read raw R-W subchannel from the Lead-In"); + if(mode.SCC) + mmcOneValue.Add("Drive can read both sides of a disc"); - if (mode.CMRSupported == 1) mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM"); + if(mode.LeadInPW) + mmcOneValue.Add("Drive an read raw R-W subchannel from the Lead-In"); - if (mode.BUF) mmcOneValue.Add("Drive supports buffer under-run free recording"); + if(mode.CMRSupported == 1) + mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM"); + + if(mode.BUF) + mmcOneValue.Add("Drive supports buffer under-run free recording"); mmcOneValue.Sort(); mmcOneValue.Add(""); diff --git a/DiscImageChef.Server/App_Start/ScsiModeSense.cs b/DiscImageChef.Server/App_Start/ScsiModeSense.cs index 06cc4b4a..69fba677 100644 --- a/DiscImageChef.Server/App_Start/ScsiModeSense.cs +++ b/DiscImageChef.Server/App_Start/ScsiModeSense.cs @@ -39,195 +39,221 @@ namespace DiscImageChef.Server public static class ScsiModeSense { /// - /// Takes the MODE PAGEs part of a device report and prints it as a list of values and another list of key=value pairs - /// to be sequenced by ASP.NET in the rendering + /// Takes the MODE PAGEs part of a device report and prints it as a list of values and another list of key=value + /// pairs to be sequenced by ASP.NET in the rendering /// /// MODE PAGEs part of a device report /// SCSI vendor string /// SCSI peripheral device type /// List to put values on /// List to put key=value pairs on - public static void Report(ScsiMode modeSense, string vendor, - PeripheralDeviceTypes deviceType, - ref List scsiOneValue, ref Dictionary modePages) + public static void Report(ScsiMode modeSense, string vendor, PeripheralDeviceTypes deviceType, + ref List scsiOneValue, ref Dictionary modePages) { - if (modeSense.MediumType.HasValue) scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h"); - if (modeSense.WriteProtected) scsiOneValue.Add("Device is write protected."); - if (modeSense.BlockDescriptors != null) - foreach (var descriptor in modeSense.BlockDescriptors) - if (descriptor.Blocks.HasValue && descriptor.BlockLength.HasValue) - scsiOneValue - .Add( - $"Density code {descriptor.Density:X2}h has {descriptor.Blocks} blocks of {descriptor.BlockLength} bytes each"); + if(modeSense.MediumType.HasValue) + scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h"); + + if(modeSense.WriteProtected) + scsiOneValue.Add("Device is write protected."); + + if(modeSense.BlockDescriptors != null) + foreach(BlockDescriptor descriptor in modeSense.BlockDescriptors) + if(descriptor.Blocks.HasValue && + descriptor.BlockLength.HasValue) + scsiOneValue. + Add($"Density code {descriptor.Density:X2}h has {descriptor.Blocks} blocks of {descriptor.BlockLength} bytes each"); else scsiOneValue.Add($"Density code {descriptor.Density:X2}h"); - if (modeSense.DPOandFUA) scsiOneValue.Add("Drive supports DPO and FUA bits"); - if (modeSense.BlankCheckEnabled) scsiOneValue.Add("Blank checking during write is enabled"); - if (modeSense.BufferedMode.HasValue) - switch (modeSense.BufferedMode) + if(modeSense.DPOandFUA) + scsiOneValue.Add("Drive supports DPO and FUA bits"); + + if(modeSense.BlankCheckEnabled) + scsiOneValue.Add("Blank checking during write is enabled"); + + if(modeSense.BufferedMode.HasValue) + switch(modeSense.BufferedMode) { case 0: scsiOneValue.Add("Device writes directly to media"); + break; case 1: scsiOneValue.Add("Device uses a write cache"); + break; case 2: scsiOneValue.Add("Device uses a write cache but doesn't return until cache is flushed"); + break; default: scsiOneValue.Add($"Unknown buffered mode code 0x{modeSense.BufferedMode:X2}"); + break; } - if (modeSense.ModePages == null) return; + if(modeSense.ModePages == null) + return; - foreach (var page in modeSense.ModePages) - switch (page.page) + foreach(ScsiPage page in modeSense.ModePages) + switch(page.page) { case 0x00: { - if (deviceType == PeripheralDeviceTypes.MultiMediaDevice && page.subpage == 0) + if(deviceType == PeripheralDeviceTypes.MultiMediaDevice && + page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_00_SFF(page.value)); else - modePages - .Add( - page.subpage != 0 - ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" - : $"MODE page {page.page:X2}h", + modePages. + Add(page.subpage != 0 ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" : $"MODE page {page.page:X2}h", "Unknown vendor mode page"); + break; } case 0x01: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", - deviceType == PeripheralDeviceTypes.MultiMediaDevice - ? Modes.PrettifyModePage_01_MMC(page.value) - : Modes.PrettifyModePage_01(page.value)); - else goto default; + deviceType == PeripheralDeviceTypes.MultiMediaDevice + ? Modes.PrettifyModePage_01_MMC(page.value) + : Modes.PrettifyModePage_01(page.value)); + else + goto default; break; } case 0x02: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_02(page.value)); - else goto default; + else + goto default; break; } case 0x03: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_03(page.value)); - else goto default; + else + goto default; break; } case 0x04: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_04(page.value)); - else goto default; + else + goto default; break; } case 0x05: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_05(page.value)); - else goto default; + else + goto default; break; } case 0x06: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_06(page.value)); - else goto default; + else + goto default; break; } case 0x07: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", - deviceType == PeripheralDeviceTypes.MultiMediaDevice - ? Modes.PrettifyModePage_07_MMC(page.value) - : Modes.PrettifyModePage_07(page.value)); - else goto default; + deviceType == PeripheralDeviceTypes.MultiMediaDevice + ? Modes.PrettifyModePage_07_MMC(page.value) + : Modes.PrettifyModePage_07(page.value)); + else + goto default; break; } case 0x08: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_08(page.value)); - else goto default; + else + goto default; break; } case 0x0A: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0A(page.value)); - else if (page.subpage == 1) + else if(page.subpage == 1) modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h", - Modes.PrettifyModePage_0A_S01(page.value)); - else goto default; + Modes.PrettifyModePage_0A_S01(page.value)); + else + goto default; break; } case 0x0B: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0B(page.value)); - else goto default; + else + goto default; break; } case 0x0D: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0D(page.value)); - else goto default; + else + goto default; break; } case 0x0E: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0E(page.value)); - else goto default; + else + goto default; break; } case 0x0F: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0F(page.value)); - else goto default; + else + goto default; break; } case 0x10: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", - deviceType == PeripheralDeviceTypes.SequentialAccess - ? Modes.PrettifyModePage_10_SSC(page.value) - : Modes.PrettifyModePage_10(page.value)); - else goto default; + deviceType == PeripheralDeviceTypes.SequentialAccess + ? Modes.PrettifyModePage_10_SSC(page.value) + : Modes.PrettifyModePage_10(page.value)); + else + goto default; break; } case 0x11: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_11(page.value)); - else goto default; + else + goto default; break; } @@ -235,152 +261,167 @@ namespace DiscImageChef.Server case 0x13: case 0x14: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_12_13_14(page.value)); - else goto default; + else + goto default; break; } case 0x1A: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1A(page.value)); - else if (page.subpage == 1) + else if(page.subpage == 1) modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h", - Modes.PrettifyModePage_1A_S01(page.value)); - else goto default; + Modes.PrettifyModePage_1A_S01(page.value)); + else + goto default; break; } case 0x1B: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1B(page.value)); - else goto default; + else + goto default; break; } case 0x1C: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", - deviceType == PeripheralDeviceTypes.MultiMediaDevice - ? Modes.PrettifyModePage_1C_SFF(page.value) - : Modes.PrettifyModePage_1C(page.value)); - else if (page.subpage == 1) + deviceType == PeripheralDeviceTypes.MultiMediaDevice + ? Modes.PrettifyModePage_1C_SFF(page.value) + : Modes.PrettifyModePage_1C(page.value)); + else if(page.subpage == 1) modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h", - Modes.PrettifyModePage_1C_S01(page.value)); - else goto default; + Modes.PrettifyModePage_1C_S01(page.value)); + else + goto default; break; } case 0x1D: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1D(page.value)); - else goto default; + else + goto default; break; } case 0x21: { - if (vendor == "CERTANCE") + if(vendor == "CERTANCE") modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyCertanceModePage_21(page.value)); - else goto default; + else + goto default; break; } case 0x22: { - if (vendor == "CERTANCE") + if(vendor == "CERTANCE") modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyCertanceModePage_22(page.value)); - else goto default; + else + goto default; break; } case 0x24: { - if (vendor == "IBM") + if(vendor == "IBM") modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_24(page.value)); - else goto default; + else + goto default; break; } case 0x2A: { - if (page.subpage == 0) + if(page.subpage == 0) modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_2A(page.value)); - else goto default; + else + goto default; break; } case 0x2F: { - if (vendor == "IBM") + if(vendor == "IBM") modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_2F(page.value)); - else goto default; + else + goto default; break; } case 0x30: { - if (Modes.IsAppleModePage_30(page.value)) + if(Modes.IsAppleModePage_30(page.value)) modePages.Add("MODE page 30h", "Drive identifies as an Apple OEM drive"); - else goto default; + else + goto default; break; } case 0x3B: { - if (vendor == "HP") + if(vendor == "HP") modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3B(page.value)); - else goto default; + else + goto default; break; } case 0x3C: { - if (vendor == "HP") + if(vendor == "HP") modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3C(page.value)); - else goto default; + else + goto default; break; } case 0x3D: { - if (vendor == "IBM") + if(vendor == "IBM") modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_3D(page.value)); - else if (vendor == "HP") + else if(vendor == "HP") modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3D(page.value)); - else goto default; + else + goto default; break; } case 0x3E: { - if (vendor == "FUJITSU") + if(vendor == "FUJITSU") modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyFujitsuModePage_3E(page.value)); - else if (vendor == "HP") + else if(vendor == "HP") modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3E(page.value)); - else goto default; + else + goto default; break; } default: { - modePages.Add( - page.subpage != 0 - ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" - : $"MODE page {page.page:X2}h", - "Unknown mode page"); + modePages. + Add(page.subpage != 0 ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" : $"MODE page {page.page:X2}h", + "Unknown mode page"); } + break; } - var newModePages = new Dictionary(); - foreach (var kvp in modePages) + Dictionary newModePages = new Dictionary(); + + foreach(KeyValuePair kvp in modePages) newModePages.Add(kvp.Key, - string.IsNullOrWhiteSpace(kvp.Value) ? "Undecoded" : kvp.Value.Replace("\n", "
")); + string.IsNullOrWhiteSpace(kvp.Value) ? "Undecoded" : kvp.Value.Replace("\n", "
")); modePages = newModePages; } diff --git a/DiscImageChef.Server/App_Start/SscTestedMedia.cs b/DiscImageChef.Server/App_Start/SscTestedMedia.cs index f783261b..0719321f 100644 --- a/DiscImageChef.Server/App_Start/SscTestedMedia.cs +++ b/DiscImageChef.Server/App_Start/SscTestedMedia.cs @@ -37,21 +37,21 @@ namespace DiscImageChef.Server { public static class SscTestedMedia { - /// - /// Takes the tested media from SCSI Streaming devices of a device report and prints it as a list of values - /// + /// Takes the tested media from SCSI Streaming devices of a device report and prints it as a list of values /// List to put values on /// List of tested media public static void Report(IEnumerable testedMedia, ref List mediaOneValue) { - foreach (var media in testedMedia) + foreach(TestedSequentialMedia media in testedMedia) { - if (!string.IsNullOrWhiteSpace(media.MediumTypeName)) + if(!string.IsNullOrWhiteSpace(media.MediumTypeName)) { mediaOneValue.Add($"Information for medium named \"{media.MediumTypeName}\""); - if (media.MediumType.HasValue) mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h"); + + if(media.MediumType.HasValue) + mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h"); } - else if (media.MediumType.HasValue) + else if(media.MediumType.HasValue) { mediaOneValue.Add($"Information for medium type {media.MediumType:X2}h"); } @@ -60,13 +60,20 @@ namespace DiscImageChef.Server mediaOneValue.Add("Information for unknown medium type"); } - if (!string.IsNullOrWhiteSpace(media.Manufacturer)) + if(!string.IsNullOrWhiteSpace(media.Manufacturer)) mediaOneValue.Add($"Medium manufactured by: {media.Manufacturer}"); - if (!string.IsNullOrWhiteSpace(media.Model)) mediaOneValue.Add($"Medium model: {media.Model}"); - if (media.Density.HasValue) mediaOneValue.Add($"Medium has density code {media.Density:X2}h"); - if (media.CanReadMediaSerial == true) mediaOneValue.Add("Drive can read medium serial number."); - if (media.MediaIsRecognized) mediaOneValue.Add("Drive recognizes this medium."); + if(!string.IsNullOrWhiteSpace(media.Model)) + mediaOneValue.Add($"Medium model: {media.Model}"); + + if(media.Density.HasValue) + mediaOneValue.Add($"Medium has density code {media.Density:X2}h"); + + if(media.CanReadMediaSerial == true) + mediaOneValue.Add("Drive can read medium serial number."); + + if(media.MediaIsRecognized) + mediaOneValue.Add("Drive recognizes this medium."); mediaOneValue.Add(""); } diff --git a/DiscImageChef.Server/App_Start/StatsConverter.cs b/DiscImageChef.Server/App_Start/StatsConverter.cs index 1e140a86..4d447230 100644 --- a/DiscImageChef.Server/App_Start/StatsConverter.cs +++ b/DiscImageChef.Server/App_Start/StatsConverter.cs @@ -43,323 +43,447 @@ namespace DiscImageChef.Server { var ctx = new DicServerContext(); - if (newStats.Commands != null) + if(newStats.Commands != null) { - if (newStats.Commands.Analyze > 0) + if(newStats.Commands.Analyze > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "analyze"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "analyze"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.Analyze, Name = "analyze"}); - else existing.Count += newStats.Commands.Analyze; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.Analyze, Name = "analyze" + }); + else + existing.Count += newStats.Commands.Analyze; } - if (newStats.Commands.Benchmark > 0) + if(newStats.Commands.Benchmark > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "benchmark"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "benchmark"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.Benchmark, Name = "benchmark"}); - else existing.Count += newStats.Commands.Benchmark; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.Benchmark, Name = "benchmark" + }); + else + existing.Count += newStats.Commands.Benchmark; } - if (newStats.Commands.Checksum > 0) + if(newStats.Commands.Checksum > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "checksum"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "checksum"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.Checksum, Name = "checksum"}); - else existing.Count += newStats.Commands.Checksum; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.Checksum, Name = "checksum" + }); + else + existing.Count += newStats.Commands.Checksum; } - if (newStats.Commands.Compare > 0) + if(newStats.Commands.Compare > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "compare"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "compare"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.Compare, Name = "compare"}); - else existing.Count += newStats.Commands.Compare; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.Compare, Name = "compare" + }); + else + existing.Count += newStats.Commands.Compare; } - if (newStats.Commands.CreateSidecar > 0) + if(newStats.Commands.CreateSidecar > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "create-sidecar"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "create-sidecar"); - if (existing == null) + if(existing == null) ctx.Commands.Add(new Command { Count = newStats.Commands.CreateSidecar, Name = "create-sidecar" }); - else existing.Count += newStats.Commands.CreateSidecar; + else + existing.Count += newStats.Commands.CreateSidecar; } - if (newStats.Commands.Decode > 0) + if(newStats.Commands.Decode > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "decode"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "decode"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.Decode, Name = "decode"}); - else existing.Count += newStats.Commands.Decode; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.Decode, Name = "decode" + }); + else + existing.Count += newStats.Commands.Decode; } - if (newStats.Commands.DeviceInfo > 0) + if(newStats.Commands.DeviceInfo > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-info"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-info"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.DeviceInfo, Name = "device-info"}); - else existing.Count += newStats.Commands.DeviceInfo; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.DeviceInfo, Name = "device-info" + }); + else + existing.Count += newStats.Commands.DeviceInfo; } - if (newStats.Commands.DeviceReport > 0) + if(newStats.Commands.DeviceReport > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-report"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-report"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.DeviceReport, Name = "device-report"}); - else existing.Count += newStats.Commands.DeviceReport; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.DeviceReport, Name = "device-report" + }); + else + existing.Count += newStats.Commands.DeviceReport; } - if (newStats.Commands.DumpMedia > 0) + if(newStats.Commands.DumpMedia > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "dump-media"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "dump-media"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.DumpMedia, Name = "dump-media"}); - else existing.Count += newStats.Commands.DumpMedia; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.DumpMedia, Name = "dump-media" + }); + else + existing.Count += newStats.Commands.DumpMedia; } - if (newStats.Commands.Entropy > 0) + if(newStats.Commands.Entropy > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "entropy"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "entropy"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.Entropy, Name = "entropy"}); - else existing.Count += newStats.Commands.Entropy; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.Entropy, Name = "entropy" + }); + else + existing.Count += newStats.Commands.Entropy; } - if (newStats.Commands.Formats > 0) + if(newStats.Commands.Formats > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "formats"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "formats"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.Formats, Name = "formats"}); - else existing.Count += newStats.Commands.Formats; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.Formats, Name = "formats" + }); + else + existing.Count += newStats.Commands.Formats; } - if (newStats.Commands.MediaInfo > 0) + if(newStats.Commands.MediaInfo > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-info"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-info"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.MediaInfo, Name = "media-info"}); - else existing.Count += newStats.Commands.MediaInfo; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.MediaInfo, Name = "media-info" + }); + else + existing.Count += newStats.Commands.MediaInfo; } - if (newStats.Commands.MediaScan > 0) + if(newStats.Commands.MediaScan > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-scan"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-scan"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.MediaScan, Name = "media-scan"}); - else existing.Count += newStats.Commands.MediaScan; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.MediaScan, Name = "media-scan" + }); + else + existing.Count += newStats.Commands.MediaScan; } - if (newStats.Commands.PrintHex > 0) + if(newStats.Commands.PrintHex > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "printhex"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "printhex"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.PrintHex, Name = "printhex"}); - else existing.Count += newStats.Commands.PrintHex; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.PrintHex, Name = "printhex" + }); + else + existing.Count += newStats.Commands.PrintHex; } - if (newStats.Commands.Verify > 0) + if(newStats.Commands.Verify > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "verify"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "verify"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.Verify, Name = "verify"}); - else existing.Count += newStats.Commands.Verify; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.Verify, Name = "verify" + }); + else + existing.Count += newStats.Commands.Verify; } - if (newStats.Commands.Ls > 0) + if(newStats.Commands.Ls > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "ls"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "ls"); - if (existing == null) ctx.Commands.Add(new Command {Count = newStats.Commands.Ls, Name = "ls"}); - else existing.Count += newStats.Commands.Ls; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.Ls, Name = "ls" + }); + else + existing.Count += newStats.Commands.Ls; } - if (newStats.Commands.ExtractFiles > 0) + if(newStats.Commands.ExtractFiles > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "extract-files"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "extract-files"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.ExtractFiles, Name = "extract-files"}); - else existing.Count += newStats.Commands.ExtractFiles; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.ExtractFiles, Name = "extract-files" + }); + else + existing.Count += newStats.Commands.ExtractFiles; } - if (newStats.Commands.ListDevices > 0) + if(newStats.Commands.ListDevices > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-devices"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-devices"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.ListDevices, Name = "list-devices"}); - else existing.Count += newStats.Commands.ListDevices; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.ListDevices, Name = "list-devices" + }); + else + existing.Count += newStats.Commands.ListDevices; } - if (newStats.Commands.ListEncodings > 0) + if(newStats.Commands.ListEncodings > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-encodings"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-encodings"); - if (existing == null) + if(existing == null) ctx.Commands.Add(new Command { Count = newStats.Commands.ListEncodings, Name = "list-encodings" }); - else existing.Count += newStats.Commands.ListEncodings; + else + existing.Count += newStats.Commands.ListEncodings; } - if (newStats.Commands.ConvertImage > 0) + if(newStats.Commands.ConvertImage > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "convert-image"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "convert-image"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.ConvertImage, Name = "convert-image"}); - else existing.Count += newStats.Commands.ConvertImage; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.ConvertImage, Name = "convert-image" + }); + else + existing.Count += newStats.Commands.ConvertImage; } - if (newStats.Commands.ImageInfo > 0) + if(newStats.Commands.ImageInfo > 0) { - var existing = ctx.Commands.FirstOrDefault(c => c.Name == "image-info"); + Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "image-info"); - if (existing == null) - ctx.Commands.Add(new Command {Count = newStats.Commands.ImageInfo, Name = "image-info"}); - else existing.Count += newStats.Commands.ImageInfo; + if(existing == null) + ctx.Commands.Add(new Command + { + Count = newStats.Commands.ImageInfo, Name = "image-info" + }); + else + existing.Count += newStats.Commands.ImageInfo; } } - if (newStats.OperatingSystems != null) + if(newStats.OperatingSystems != null) { - foreach (var operatingSystem in newStats.OperatingSystems) + foreach(OsStats operatingSystem in newStats.OperatingSystems) { - if (string.IsNullOrWhiteSpace(operatingSystem.name) || - string.IsNullOrWhiteSpace(operatingSystem.version)) continue; + if(string.IsNullOrWhiteSpace(operatingSystem.name) || + string.IsNullOrWhiteSpace(operatingSystem.version)) + continue; - var existing = - ctx.OperatingSystems.FirstOrDefault(c => c.Name == operatingSystem.name && + OperatingSystem existing = + ctx.OperatingSystems.FirstOrDefault(c => c.Name == operatingSystem.name && c.Version == operatingSystem.version); - if (existing == null) + if(existing == null) ctx.OperatingSystems.Add(new OperatingSystem { - Count = operatingSystem.Value, - Name = operatingSystem.name, + Count = operatingSystem.Value, Name = operatingSystem.name, Version = operatingSystem.version }); - else existing.Count += operatingSystem.Value; + else + existing.Count += operatingSystem.Value; } } else { - var existing = + OperatingSystem existing = ctx.OperatingSystems.FirstOrDefault(c => c.Name == "Linux" && c.Version == null); - if (existing == null) ctx.OperatingSystems.Add(new OperatingSystem {Count = 1, Name = "Linux"}); - else existing.Count++; + if(existing == null) + ctx.OperatingSystems.Add(new OperatingSystem + { + Count = 1, Name = "Linux" + }); + else + existing.Count++; } - if (newStats.Versions != null) + if(newStats.Versions != null) { - foreach (var nvs in newStats.Versions) + foreach(NameValueStats nvs in newStats.Versions) { - if (string.IsNullOrWhiteSpace(nvs.name)) continue; + if(string.IsNullOrWhiteSpace(nvs.name)) + continue; - var existing = ctx.Versions.FirstOrDefault(c => c.Value == nvs.name); + Version existing = ctx.Versions.FirstOrDefault(c => c.Value == nvs.name); - if (existing == null) ctx.Versions.Add(new Version {Count = nvs.Value, Value = nvs.name}); - else existing.Count += nvs.Value; + if(existing == null) + ctx.Versions.Add(new Version + { + Count = nvs.Value, Value = nvs.name + }); + else + existing.Count += nvs.Value; } } else { - var existing = ctx.Versions.FirstOrDefault(c => c.Value == "previous"); + Version existing = ctx.Versions.FirstOrDefault(c => c.Value == "previous"); - if (existing == null) ctx.Versions.Add(new Version {Count = 1, Value = "previous"}); - else existing.Count++; + if(existing == null) + ctx.Versions.Add(new Version + { + Count = 1, Value = "previous" + }); + else + existing.Count++; } - if (newStats.Filesystems != null) - foreach (var nvs in newStats.Filesystems) + if(newStats.Filesystems != null) + foreach(NameValueStats nvs in newStats.Filesystems) { - if (string.IsNullOrWhiteSpace(nvs.name)) continue; + if(string.IsNullOrWhiteSpace(nvs.name)) + continue; - var existing = ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name); + Filesystem existing = ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name); - if (existing == null) ctx.Filesystems.Add(new Filesystem {Count = nvs.Value, Name = nvs.name}); - else existing.Count += nvs.Value; + if(existing == null) + ctx.Filesystems.Add(new Filesystem + { + Count = nvs.Value, Name = nvs.name + }); + else + existing.Count += nvs.Value; } - if (newStats.Partitions != null) - foreach (var nvs in newStats.Partitions) + if(newStats.Partitions != null) + foreach(NameValueStats nvs in newStats.Partitions) { - if (string.IsNullOrWhiteSpace(nvs.name)) continue; + if(string.IsNullOrWhiteSpace(nvs.name)) + continue; - var existing = ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name); + Partition existing = ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name); - if (existing == null) ctx.Partitions.Add(new Partition {Count = nvs.Value, Name = nvs.name}); - else existing.Count += nvs.Value; + if(existing == null) + ctx.Partitions.Add(new Partition + { + Count = nvs.Value, Name = nvs.name + }); + else + existing.Count += nvs.Value; } - if (newStats.MediaImages != null) - foreach (var nvs in newStats.MediaImages) + if(newStats.MediaImages != null) + foreach(NameValueStats nvs in newStats.MediaImages) { - if (string.IsNullOrWhiteSpace(nvs.name)) continue; + if(string.IsNullOrWhiteSpace(nvs.name)) + continue; - var existing = ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name); + MediaFormat existing = ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name); - if (existing == null) ctx.MediaFormats.Add(new MediaFormat {Count = nvs.Value, Name = nvs.name}); - else existing.Count += nvs.Value; + if(existing == null) + ctx.MediaFormats.Add(new MediaFormat + { + Count = nvs.Value, Name = nvs.name + }); + else + existing.Count += nvs.Value; } - if (newStats.Filters != null) - foreach (var nvs in newStats.Filters) + if(newStats.Filters != null) + foreach(NameValueStats nvs in newStats.Filters) { - if (string.IsNullOrWhiteSpace(nvs.name)) continue; + if(string.IsNullOrWhiteSpace(nvs.name)) + continue; - var existing = ctx.Filters.FirstOrDefault(c => c.Name == nvs.name); + Filter existing = ctx.Filters.FirstOrDefault(c => c.Name == nvs.name); - if (existing == null) ctx.Filters.Add(new Filter {Count = nvs.Value, Name = nvs.name}); - else existing.Count += nvs.Value; + if(existing == null) + ctx.Filters.Add(new Filter + { + Count = nvs.Value, Name = nvs.name + }); + else + existing.Count += nvs.Value; } - if (newStats.Devices != null) - foreach (var device in newStats.Devices) + if(newStats.Devices != null) + foreach(DeviceStats device in newStats.Devices) { - if (string.IsNullOrWhiteSpace(device.Model)) continue; + if(string.IsNullOrWhiteSpace(device.Model)) + continue; - if (!ctx.DeviceStats.Any(c => c.Bus == device.Bus && c.Manufacturer == device.Manufacturer && - c.Model == device.Model && c.Revision == device.Revision)) + if(!ctx.DeviceStats.Any(c => c.Bus == device.Bus && c.Manufacturer == device.Manufacturer && + c.Model == device.Model && c.Revision == device.Revision)) ctx.DeviceStats.Add(new DeviceStat { - Bus = device.Bus, - Manufacturer = device.Manufacturer, - Model = device.Model, + Bus = device.Bus, Manufacturer = device.Manufacturer, Model = device.Model, Revision = device.Revision }); } - if (newStats.Medias != null) - foreach (var media in newStats.Medias) + if(newStats.Medias != null) + foreach(MediaStats media in newStats.Medias) { - if (string.IsNullOrWhiteSpace(media.type)) continue; + if(string.IsNullOrWhiteSpace(media.type)) + continue; - var existing = ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real); + Media existing = ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real); - if (existing == null) - ctx.Medias.Add(new Media {Count = media.Value, Real = media.real, Type = media.type}); - else existing.Count += media.Value; + if(existing == null) + ctx.Medias.Add(new Media + { + Count = media.Value, Real = media.real, Type = media.type + }); + else + existing.Count += media.Value; } ctx.SaveChanges(); diff --git a/DiscImageChef.Server/App_Start/TestedMedia.cs b/DiscImageChef.Server/App_Start/TestedMedia.cs index e57b8c4f..8d214f11 100644 --- a/DiscImageChef.Server/App_Start/TestedMedia.cs +++ b/DiscImageChef.Server/App_Start/TestedMedia.cs @@ -36,23 +36,22 @@ namespace DiscImageChef.Server.App_Start { public static class TestedMedia { - /// - /// Takes the tested media from a device report and prints it as a list of values - /// + /// Takes the tested media from a device report and prints it as a list of values /// true if device report is from an ATA device /// List to put values on /// List of tested media public static void Report(List testedMedias, ref List mediaOneValue) { - foreach (var testedMedia in testedMedias) + foreach(CommonTypes.Metadata.TestedMedia testedMedia in testedMedias) { - if (!string.IsNullOrWhiteSpace(testedMedia.MediumTypeName)) + if(!string.IsNullOrWhiteSpace(testedMedia.MediumTypeName)) { mediaOneValue.Add($"Information for medium named \"{testedMedia.MediumTypeName}\""); - if (testedMedia.MediumType != null) + + if(testedMedia.MediumType != null) mediaOneValue.Add($"Medium type code: {testedMedia.MediumType:X2}h"); } - else if (testedMedia.MediumType != null) + else if(testedMedia.MediumType != null) { mediaOneValue.Add($"Information for medium type {testedMedia.MediumType:X2}h"); } @@ -61,265 +60,318 @@ namespace DiscImageChef.Server.App_Start mediaOneValue.Add("Information for unknown medium type"); } - mediaOneValue.Add(testedMedia.MediaIsRecognized - ? "Drive recognizes this medium." - : "Drive does not recognize this medium."); + mediaOneValue.Add(testedMedia.MediaIsRecognized ? "Drive recognizes this medium." + : "Drive does not recognize this medium."); - if (!string.IsNullOrWhiteSpace(testedMedia.Manufacturer)) + if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer)) mediaOneValue.Add($"Medium manufactured by: {testedMedia.Manufacturer}"); - if (!string.IsNullOrWhiteSpace(testedMedia.Model)) - mediaOneValue.Add($"Medium model: {testedMedia.Model}"); - if (testedMedia.Density != null) mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h"); - if (testedMedia.BlockSize != null) + if(!string.IsNullOrWhiteSpace(testedMedia.Model)) + mediaOneValue.Add($"Medium model: {testedMedia.Model}"); + + if(testedMedia.Density != null) + mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h"); + + if(testedMedia.BlockSize != null) mediaOneValue.Add($"Logical sector size: {testedMedia.BlockSize} bytes"); - if (testedMedia.PhysicalBlockSize != null) + + if(testedMedia.PhysicalBlockSize != null) mediaOneValue.Add($"Physical sector size: {testedMedia.PhysicalBlockSize} bytes"); - if (testedMedia.LongBlockSize != null) + + if(testedMedia.LongBlockSize != null) mediaOneValue.Add($"READ LONG sector size: {testedMedia.LongBlockSize} bytes"); - if (testedMedia.Blocks != null && testedMedia.BlockSize != null) + if(testedMedia.Blocks != null && + testedMedia.BlockSize != null) { mediaOneValue.Add($"Medium has {testedMedia.Blocks} blocks of {testedMedia.BlockSize} bytes each"); - if (testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000000) - mediaOneValue - .Add( - $"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double) (testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); - else if (testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000) - mediaOneValue - .Add( - $"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double) (testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); + if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000000) + mediaOneValue. + Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); + else if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000) + mediaOneValue. + Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); else - mediaOneValue - .Add( - $"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) (testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); + mediaOneValue. + Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } - if (testedMedia.CHS != null && testedMedia.CurrentCHS != null) + if(testedMedia.CHS != null && + testedMedia.CurrentCHS != null) { - var currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads * + int currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads * testedMedia.CurrentCHS.Sectors; - mediaOneValue - .Add( - $"Cylinders: {testedMedia.CHS.Cylinders} max., {testedMedia.CurrentCHS.Cylinders} current"); + + mediaOneValue. + Add($"Cylinders: {testedMedia.CHS.Cylinders} max., {testedMedia.CurrentCHS.Cylinders} current"); + mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads} max., {testedMedia.CurrentCHS.Heads} current"); - mediaOneValue - .Add( - $"Sectors per track: {testedMedia.CHS.Sectors} max., {testedMedia.CurrentCHS.Sectors} current"); - mediaOneValue - .Add( - $"Sectors addressable in CHS mode: {testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors} max., {currentSectors} current"); - mediaOneValue - .Add( - $"Medium size in CHS mode: {(ulong) currentSectors * testedMedia.BlockSize} bytes, {(ulong) currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) ((ulong) currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); + + mediaOneValue. + Add($"Sectors per track: {testedMedia.CHS.Sectors} max., {testedMedia.CurrentCHS.Sectors} current"); + + mediaOneValue. + Add($"Sectors addressable in CHS mode: {testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors} max., {currentSectors} current"); + + mediaOneValue. + Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } - else if (testedMedia.CHS != null) + else if(testedMedia.CHS != null) { - var currentSectors = testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors; + int currentSectors = testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors; mediaOneValue.Add($"Cylinders: {testedMedia.CHS.Cylinders}"); mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads}"); mediaOneValue.Add($"Sectors per track: {testedMedia.CHS.Sectors}"); mediaOneValue.Add($"Sectors addressable in CHS mode: {currentSectors}"); - mediaOneValue - .Add( - $"Medium size in CHS mode: {(ulong) currentSectors * testedMedia.BlockSize} bytes, {(ulong) currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) ((ulong) currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); + + mediaOneValue. + Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } - if (testedMedia.LBASectors != null) + if(testedMedia.LBASectors != null) { mediaOneValue.Add($"Sectors addressable in sectors in 28-bit LBA mode: {testedMedia.LBASectors}"); - if ((ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000000) - mediaOneValue - .Add( - $"Medium size in 28-bit LBA mode: {(ulong) testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double) ((ulong) testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); - else if ((ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000) - mediaOneValue - .Add( - $"Medium size in 28-bit LBA mode: {(ulong) testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double) ((ulong) testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); + if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000000) + mediaOneValue. + Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); + else if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000) + mediaOneValue. + Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); else - mediaOneValue - .Add( - $"Medium size in 28-bit LBA mode: {(ulong) testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) ((ulong) testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); + mediaOneValue. + Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } - if (testedMedia.LBA48Sectors != null) + if(testedMedia.LBA48Sectors != null) { mediaOneValue.Add($"Sectors addressable in sectors in 48-bit LBA mode: {testedMedia.LBA48Sectors}"); - if (testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000000) - mediaOneValue - .Add( - $"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double) (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); - else if (testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000) - mediaOneValue - .Add( - $"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double) (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); + if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000000) + mediaOneValue. + Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); + else if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000) + mediaOneValue. + Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); else - mediaOneValue - .Add( - $"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); + mediaOneValue. + Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } - if (testedMedia.NominalRotationRate != null && testedMedia.NominalRotationRate != 0x0000 && - testedMedia.NominalRotationRate != 0xFFFF) - mediaOneValue.Add(testedMedia.NominalRotationRate == 0x0001 - ? "Medium does not rotate." - : $"Medium rotates at {testedMedia.NominalRotationRate} rpm"); + if(testedMedia.NominalRotationRate != null && + testedMedia.NominalRotationRate != 0x0000 && + testedMedia.NominalRotationRate != 0xFFFF) + mediaOneValue.Add(testedMedia.NominalRotationRate == 0x0001 ? "Medium does not rotate." + : $"Medium rotates at {testedMedia.NominalRotationRate} rpm"); - if (testedMedia.BlockSize != null && - testedMedia.PhysicalBlockSize != null && - testedMedia.BlockSize.Value != testedMedia.PhysicalBlockSize.Value && - (testedMedia.LogicalAlignment & 0x8000) == 0x0000 && - (testedMedia.LogicalAlignment & 0x4000) == 0x4000) - mediaOneValue - .Add( - $"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector"); + if(testedMedia.BlockSize != null && + testedMedia.PhysicalBlockSize != null && + testedMedia.BlockSize.Value != testedMedia.PhysicalBlockSize.Value && + (testedMedia.LogicalAlignment & 0x8000) == 0x0000 && + (testedMedia.LogicalAlignment & 0x4000) == 0x4000) + mediaOneValue. + Add($"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector"); - if (testedMedia.SupportsReadSectors == true) + if(testedMedia.SupportsReadSectors == true) mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium"); - if (testedMedia.SupportsReadRetry == true) + + if(testedMedia.SupportsReadRetry == true) mediaOneValue.Add("Device can use the READ SECTOR(S) RETRY command in CHS mode with this medium"); - if (testedMedia.SupportsReadDma == true) + + if(testedMedia.SupportsReadDma == true) mediaOneValue.Add("Device can use the READ DMA command in CHS mode with this medium"); - if (testedMedia.SupportsReadDmaRetry == true) + + if(testedMedia.SupportsReadDmaRetry == true) mediaOneValue.Add("Device can use the READ DMA RETRY command in CHS mode with this medium"); - if (testedMedia.SupportsReadLong == true) + + if(testedMedia.SupportsReadLong == true) mediaOneValue.Add("Device can use the READ LONG command in CHS mode with this medium"); - if (testedMedia.SupportsReadLongRetry == true) + + if(testedMedia.SupportsReadLongRetry == true) mediaOneValue.Add("Device can use the READ LONG RETRY command in CHS mode with this medium"); - if (testedMedia.SupportsReadLba == true) + if(testedMedia.SupportsReadLba == true) mediaOneValue.Add("Device can use the READ SECTOR(S) command in 28-bit LBA mode with this medium"); - if (testedMedia.SupportsReadRetryLba == true) - mediaOneValue - .Add("Device can use the READ SECTOR(S) RETRY command in 28-bit LBA mode with this medium"); - if (testedMedia.SupportsReadDmaLba == true) + + if(testedMedia.SupportsReadRetryLba == true) + mediaOneValue. + Add("Device can use the READ SECTOR(S) RETRY command in 28-bit LBA mode with this medium"); + + if(testedMedia.SupportsReadDmaLba == true) mediaOneValue.Add("Device can use the READ DMA command in 28-bit LBA mode with this medium"); - if (testedMedia.SupportsReadDmaRetryLba == true) + + if(testedMedia.SupportsReadDmaRetryLba == true) mediaOneValue.Add("Device can use the READ DMA RETRY command in 28-bit LBA mode with this medium"); - if (testedMedia.SupportsReadLongLba == true) + + if(testedMedia.SupportsReadLongLba == true) mediaOneValue.Add("Device can use the READ LONG command in 28-bit LBA mode with this medium"); - if (testedMedia.SupportsReadLongRetryLba == true) + + if(testedMedia.SupportsReadLongRetryLba == true) mediaOneValue.Add("Device can use the READ LONG RETRY command in 28-bit LBA mode with this medium"); - if (testedMedia.SupportsReadLba48 == true) + if(testedMedia.SupportsReadLba48 == true) mediaOneValue.Add("Device can use the READ SECTOR(S) command in 48-bit LBA mode with this medium"); - if (testedMedia.SupportsReadDmaLba48 == true) + + if(testedMedia.SupportsReadDmaLba48 == true) mediaOneValue.Add("Device can use the READ DMA command in 48-bit LBA mode with this medium"); - if (testedMedia.SupportsSeek == true) + if(testedMedia.SupportsSeek == true) mediaOneValue.Add("Device can use the SEEK command in CHS mode with this medium"); - if (testedMedia.SupportsSeekLba == true) + + if(testedMedia.SupportsSeekLba == true) mediaOneValue.Add("Device can use the SEEK command in 28-bit LBA mode with this medium"); - if (testedMedia.SupportsReadCapacity == true) + if(testedMedia.SupportsReadCapacity == true) mediaOneValue.Add("Device can use the READ CAPACITY (10) command with this medium"); - if (testedMedia.SupportsReadCapacity16 == true) + + if(testedMedia.SupportsReadCapacity16 == true) mediaOneValue.Add("Device can use the READ CAPACITY (16) command with this medium"); - if (testedMedia.SupportsRead6 == true) + + if(testedMedia.SupportsRead6 == true) mediaOneValue.Add("Device can use the READ (6) command with this medium"); - if (testedMedia.SupportsRead10 == true) + + if(testedMedia.SupportsRead10 == true) mediaOneValue.Add("Device can use the READ (10) command with this medium"); - if (testedMedia.SupportsRead12 == true) + + if(testedMedia.SupportsRead12 == true) mediaOneValue.Add("Device can use the READ (12) command with this medium"); - if (testedMedia.SupportsRead16 == true) + + if(testedMedia.SupportsRead16 == true) mediaOneValue.Add("Device can use the READ (16) command with this medium"); - if (testedMedia.SupportsReadLong == true) + + if(testedMedia.SupportsReadLong == true) mediaOneValue.Add("Device can use the READ LONG (10) command with this medium"); - if (testedMedia.SupportsReadLong16 == true) + + if(testedMedia.SupportsReadLong16 == true) mediaOneValue.Add("Device can use the READ LONG (16) command with this medium"); - if (testedMedia.SupportsReadCd == true) + if(testedMedia.SupportsReadCd == true) mediaOneValue.Add("Device can use the READ CD command with LBA addressing with this medium"); - if (testedMedia.SupportsReadCdMsf == true) - mediaOneValue.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium"); - if (testedMedia.SupportsReadCdRaw == true) - mediaOneValue - .Add( - "Device can use the READ CD command with LBA addressing with this medium to read raw sector"); - if (testedMedia.SupportsReadCdMsfRaw == true) - mediaOneValue - .Add( - "Device can use the READ CD command with MM:SS:FF addressing with this medium read raw sector"); - if (testedMedia.SupportsHLDTSTReadRawDVD == true) + if(testedMedia.SupportsReadCdMsf == true) + mediaOneValue.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium"); + + if(testedMedia.SupportsReadCdRaw == true) + mediaOneValue. + Add("Device can use the READ CD command with LBA addressing with this medium to read raw sector"); + + if(testedMedia.SupportsReadCdMsfRaw == true) + mediaOneValue. + Add("Device can use the READ CD command with MM:SS:FF addressing with this medium read raw sector"); + + if(testedMedia.SupportsHLDTSTReadRawDVD == true) mediaOneValue.Add("Device can use the HL-DT-ST vendor READ DVD (RAW) command with this medium"); - if (testedMedia.SupportsNECReadCDDA == true) + + if(testedMedia.SupportsNECReadCDDA == true) mediaOneValue.Add("Device can use the NEC vendor READ CD-DA command with this medium"); - if (testedMedia.SupportsPioneerReadCDDA == true) + + if(testedMedia.SupportsPioneerReadCDDA == true) mediaOneValue.Add("Device can use the PIONEER vendor READ CD-DA command with this medium"); - if (testedMedia.SupportsPioneerReadCDDAMSF == true) + + if(testedMedia.SupportsPioneerReadCDDAMSF == true) mediaOneValue.Add("Device can use the PIONEER vendor READ CD-DA MSF command with this medium"); - if (testedMedia.SupportsPlextorReadCDDA == true) + + if(testedMedia.SupportsPlextorReadCDDA == true) mediaOneValue.Add("Device can use the PLEXTOR vendor READ CD-DA command with this medium"); - if (testedMedia.SupportsPlextorReadRawDVD == true) + + if(testedMedia.SupportsPlextorReadRawDVD == true) mediaOneValue.Add("Device can use the PLEXOR vendor READ DVD (RAW) command with this medium"); - if (testedMedia.CanReadAACS == true) + if(testedMedia.CanReadAACS == true) mediaOneValue.Add("Device can read the Advanced Access Content System from this medium"); - if (testedMedia.CanReadADIP == true) + + if(testedMedia.CanReadADIP == true) mediaOneValue.Add("Device can read the DVD ADress-In-Pregroove from this medium"); - if (testedMedia.CanReadATIP == true) + + if(testedMedia.CanReadATIP == true) mediaOneValue.Add("Device can read the CD Absolute-Time-In-Pregroove from this medium"); - if (testedMedia.CanReadBCA == true) + + if(testedMedia.CanReadBCA == true) mediaOneValue.Add("Device can read the Burst Cutting Area from this medium"); - if (testedMedia.CanReadC2Pointers == true) + + if(testedMedia.CanReadC2Pointers == true) mediaOneValue.Add("Device can report the C2 pointers when reading from this medium"); - if (testedMedia.CanReadCMI == true) + + if(testedMedia.CanReadCMI == true) mediaOneValue.Add("Device can read the Copyright Management Information from this medium"); - if (testedMedia.CanReadCorrectedSubchannel == true) + + if(testedMedia.CanReadCorrectedSubchannel == true) mediaOneValue.Add("Device can correct subchannels when reading from this medium"); - if (testedMedia.CanReadCorrectedSubchannelWithC2 == true) - mediaOneValue - .Add("Device can correct subchannels and report the C2 pointers when reading from this medium"); - if (testedMedia.CanReadDCB == true) + + if(testedMedia.CanReadCorrectedSubchannelWithC2 == true) + mediaOneValue. + Add("Device can correct subchannels and report the C2 pointers when reading from this medium"); + + if(testedMedia.CanReadDCB == true) mediaOneValue.Add("Device can read the Disc Control Blocks from this medium"); - if (testedMedia.CanReadDDS == true) + + if(testedMedia.CanReadDDS == true) mediaOneValue.Add("Device can read the Disc Definition Structure from this medium"); - if (testedMedia.CanReadDMI == true) + + if(testedMedia.CanReadDMI == true) mediaOneValue.Add("Device can read the Disc Manufacurer Information from this medium"); - if (testedMedia.CanReadDiscInformation == true) + + if(testedMedia.CanReadDiscInformation == true) mediaOneValue.Add("Device can read the Disc Information from this medium"); - if (testedMedia.CanReadFullTOC == true) + + if(testedMedia.CanReadFullTOC == true) mediaOneValue.Add("Device can read the Table of Contents from this medium, without processing it"); - if (testedMedia.CanReadHDCMI == true) + + if(testedMedia.CanReadHDCMI == true) mediaOneValue.Add("Device can read the HD DVD Copyright Management Information from this medium"); - if (testedMedia.CanReadLayerCapacity == true) + + if(testedMedia.CanReadLayerCapacity == true) mediaOneValue.Add("Device can read the layer capacity from this medium"); - if (testedMedia.CanReadFirstTrackPreGap == true) + + if(testedMedia.CanReadFirstTrackPreGap == true) mediaOneValue.Add("Device can read the first track's pregap data"); - if (testedMedia.CanReadLeadIn == true) + + if(testedMedia.CanReadLeadIn == true) mediaOneValue.Add("Device can read the Lead-In from this medium"); - if (testedMedia.CanReadLeadOut == true) + + if(testedMedia.CanReadLeadOut == true) mediaOneValue.Add("Device can read the Lead-Out from this medium"); - if (testedMedia.CanReadMediaID == true) + + if(testedMedia.CanReadMediaID == true) mediaOneValue.Add("Device can read the Media ID from this medium"); - if (testedMedia.CanReadMediaSerial == true) + + if(testedMedia.CanReadMediaSerial == true) mediaOneValue.Add("Device can read the Media Serial Number from this medium"); - if (testedMedia.CanReadPAC == true) mediaOneValue.Add("Device can read the PAC from this medium"); - if (testedMedia.CanReadPFI == true) + + if(testedMedia.CanReadPAC == true) + mediaOneValue.Add("Device can read the PAC from this medium"); + + if(testedMedia.CanReadPFI == true) mediaOneValue.Add("Device can read the Physical Format Information from this medium"); - if (testedMedia.CanReadPMA == true) + + if(testedMedia.CanReadPMA == true) mediaOneValue.Add("Device can read the Power Management Area from this medium"); - if (testedMedia.CanReadPQSubchannel == true) + + if(testedMedia.CanReadPQSubchannel == true) mediaOneValue.Add("Device can read the P to Q subchannels from this medium"); - if (testedMedia.CanReadPQSubchannelWithC2 == true) - mediaOneValue - .Add("Device can read the P to Q subchannels from this medium reporting the C2 pointers"); - if (testedMedia.CanReadPRI == true) + + if(testedMedia.CanReadPQSubchannelWithC2 == true) + mediaOneValue. + Add("Device can read the P to Q subchannels from this medium reporting the C2 pointers"); + + if(testedMedia.CanReadPRI == true) mediaOneValue.Add("Device can read the Pre-Recorded Information from this medium"); - if (testedMedia.CanReadRWSubchannel == true) + + if(testedMedia.CanReadRWSubchannel == true) mediaOneValue.Add("Device can read the R to W subchannels from this medium"); - if (testedMedia.CanReadRWSubchannelWithC2 == true) - mediaOneValue - .Add("Device can read the R to W subchannels from this medium reporting the C2 pointers"); - if (testedMedia.CanReadRecordablePFI == true) + + if(testedMedia.CanReadRWSubchannelWithC2 == true) + mediaOneValue. + Add("Device can read the R to W subchannels from this medium reporting the C2 pointers"); + + if(testedMedia.CanReadRecordablePFI == true) mediaOneValue.Add("Device can read the Physical Format Information from Lead-In from this medium"); - if (testedMedia.CanReadSpareAreaInformation == true) + + if(testedMedia.CanReadSpareAreaInformation == true) mediaOneValue.Add("Device can read the Spare Area Information from this medium"); - if (testedMedia.CanReadTOC == true) + + if(testedMedia.CanReadTOC == true) mediaOneValue.Add("Device can read the Table of Contents from this medium"); mediaOneValue.Add(""); diff --git a/DiscImageChef.Server/Controllers/HomeController.cs b/DiscImageChef.Server/Controllers/HomeController.cs index 01d2cc46..bd8d3e06 100644 --- a/DiscImageChef.Server/Controllers/HomeController.cs +++ b/DiscImageChef.Server/Controllers/HomeController.cs @@ -41,21 +41,18 @@ namespace DiscImageChef.Server.Controllers { public class HomeController : Controller { - private readonly IWebHostEnvironment _environment; + readonly IWebHostEnvironment _environment; - public HomeController(IWebHostEnvironment environment) - { - _environment = environment; - } + public HomeController(IWebHostEnvironment environment) => _environment = environment; - [Route("")] - [Route("README")] + [Route(""), Route("README")] public ActionResult Index() { var sr = new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "docs", "README.md")); - var mdcontent = sr.ReadToEnd(); + "docs", "README.md")); + + string mdcontent = sr.ReadToEnd(); sr.Close(); mdcontent = mdcontent.Replace(".md)", ")"); @@ -72,8 +69,9 @@ namespace DiscImageChef.Server.Controllers { var sr = new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "docs", "Changelog.md")); - var mdcontent = sr.ReadToEnd(); + "docs", "Changelog.md")); + + string mdcontent = sr.ReadToEnd(); sr.Close(); mdcontent = mdcontent.Replace(".md)", ")"); @@ -90,8 +88,9 @@ namespace DiscImageChef.Server.Controllers { var sr = new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "docs", "CODE_OF_CONDUCT.md")); - var mdcontent = sr.ReadToEnd(); + "docs", "CODE_OF_CONDUCT.md")); + + string mdcontent = sr.ReadToEnd(); sr.Close(); mdcontent = mdcontent.Replace(".md)", ")").Replace("(.github/", "("); @@ -108,8 +107,9 @@ namespace DiscImageChef.Server.Controllers { var sr = new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "docs", "PULL_REQUEST_TEMPLATE.md")); - var mdcontent = sr.ReadToEnd(); + "docs", "PULL_REQUEST_TEMPLATE.md")); + + string mdcontent = sr.ReadToEnd(); sr.Close(); mdcontent = mdcontent.Replace(".md)", ")").Replace("(.github/", "("); @@ -126,8 +126,9 @@ namespace DiscImageChef.Server.Controllers { var sr = new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "docs", "ISSUE_TEMPLATE.md")); - var mdcontent = sr.ReadToEnd(); + "docs", "ISSUE_TEMPLATE.md")); + + string mdcontent = sr.ReadToEnd(); sr.Close(); mdcontent = mdcontent.Replace(".md)", ")").Replace("(.github/", "("); @@ -144,8 +145,9 @@ namespace DiscImageChef.Server.Controllers { var sr = new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "docs", "CONTRIBUTING.md")); - var mdcontent = sr.ReadToEnd(); + "docs", "CONTRIBUTING.md")); + + string mdcontent = sr.ReadToEnd(); sr.Close(); mdcontent = mdcontent.Replace(".md)", ")").Replace("(.github/", "("); @@ -162,8 +164,9 @@ namespace DiscImageChef.Server.Controllers { var sr = new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "docs", "DONATING.md")); - var mdcontent = sr.ReadToEnd(); + "docs", "DONATING.md")); + + string mdcontent = sr.ReadToEnd(); sr.Close(); mdcontent = mdcontent.Replace(".md)", ")"); @@ -180,8 +183,9 @@ namespace DiscImageChef.Server.Controllers { var sr = new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "docs", "TODO.md")); - var mdcontent = sr.ReadToEnd(); + "docs", "TODO.md")); + + string mdcontent = sr.ReadToEnd(); sr.Close(); mdcontent = mdcontent.Replace(".md)", ")"); diff --git a/DiscImageChef.Server/Controllers/ReportController.cs b/DiscImageChef.Server/Controllers/ReportController.cs index 51f5eb1d..22ac25bb 100644 --- a/DiscImageChef.Server/Controllers/ReportController.cs +++ b/DiscImageChef.Server/Controllers/ReportController.cs @@ -39,99 +39,100 @@ using DiscImageChef.Decoders.SCSI; using DiscImageChef.Server.Models; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; +using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple; namespace DiscImageChef.Server.Controllers { public class ReportController : Controller { - private readonly DicServerContext _ctx; + readonly DicServerContext _ctx; - public ReportController(DicServerContext context) - { - _ctx = context; - } + public ReportController(DicServerContext context) => _ctx = context; - public ActionResult Index() + public ActionResult Index() => RedirectToAction("View", "Report", new RouteValueDictionary { - return RedirectToAction("View", "Report", new RouteValueDictionary {{"id", 1}}); - } + { + "id", 1 + } + }); public ActionResult View(int? id) { - if (id == null || id <= 0) return Content("Incorrect device report request"); + if(id == null || + id <= 0) + return Content("Incorrect device report request"); try { - var report = _ctx.Devices.FirstOrDefault(d => d.Id == id); + Device report = _ctx.Devices.FirstOrDefault(d => d.Id == id); - if (report is null) return Content("Cannot find requested report"); + if(report is null) + return Content("Cannot find requested report"); ViewBag.lblManufacturer = report.Manufacturer; - ViewBag.lblModel = report.Model; - ViewBag.lblRevision = report.Revision; + ViewBag.lblModel = report.Model; + ViewBag.lblRevision = report.Revision; - if (report.USB != null) + if(report.USB != null) { - string usbVendorDescription = null; + string usbVendorDescription = null; string usbProductDescription = null; - var dbProduct = - _ctx.UsbProducts.FirstOrDefault(p => p.ProductId == report.USB.ProductID && - p.Vendor != null && + UsbProduct dbProduct = + _ctx.UsbProducts.FirstOrDefault(p => p.ProductId == report.USB.ProductID && + p.Vendor != null && p.Vendor.VendorId == report.USB.VendorID); - if (dbProduct is null) + if(dbProduct is null) { - var dbVendor = _ctx.UsbVendors.FirstOrDefault(v => v.VendorId == report.USB.VendorID); + UsbVendor dbVendor = _ctx.UsbVendors.FirstOrDefault(v => v.VendorId == report.USB.VendorID); - if (!(dbVendor is null)) usbVendorDescription = dbVendor.Vendor; + if(!(dbVendor is null)) + usbVendorDescription = dbVendor.Vendor; } else { usbProductDescription = dbProduct.Product; - usbVendorDescription = dbProduct.Vendor.Vendor; + usbVendorDescription = dbProduct.Vendor.Vendor; } ViewBag.UsbItem = new Item { - Manufacturer = report.USB.Manufacturer, - Product = report.USB.Product, - VendorDescription = - usbVendorDescription != null - ? $"0x{report.USB.VendorID:x4} ({usbVendorDescription})" - : $"0x{report.USB.VendorID:x4}", + Manufacturer = report.USB.Manufacturer, Product = report.USB.Product, + VendorDescription = usbVendorDescription != null + ? $"0x{report.USB.VendorID:x4} ({usbVendorDescription})" + : $"0x{report.USB.VendorID:x4}", ProductDescription = usbProductDescription != null - ? $"0x{report.USB.ProductID:x4} ({usbProductDescription})" - : $"0x{report.USB.ProductID:x4}" + ? $"0x{report.USB.ProductID:x4} ({usbProductDescription})" + : $"0x{report.USB.ProductID:x4}" }; } - if (report.FireWire != null) + if(report.FireWire != null) ViewBag.FireWireItem = new Item { - Manufacturer = report.FireWire.Manufacturer, - Product = report.FireWire.Product, - VendorDescription = $"0x{report.FireWire.VendorID:x8}", + Manufacturer = report.FireWire.Manufacturer, Product = report.FireWire.Product, + VendorDescription = $"0x{report.FireWire.VendorID:x8}", ProductDescription = $"0x{report.FireWire.ProductID:x8}" }; - if (report.PCMCIA != null) + if(report.PCMCIA != null) { ViewBag.PcmciaItem = new PcmciaItem { - Manufacturer = report.PCMCIA.Manufacturer, - Product = report.PCMCIA.ProductName, - VendorDescription = $"0x{report.PCMCIA.ManufacturerCode:x4}", - ProductDescription = $"0x{report.PCMCIA.CardCode:x4}", - Compliance = report.PCMCIA.Compliance + Manufacturer = report.PCMCIA.Manufacturer, Product = report.PCMCIA.ProductName, + VendorDescription = $"0x{report.PCMCIA.ManufacturerCode:x4}", + ProductDescription = $"0x{report.PCMCIA.CardCode:x4}", Compliance = report.PCMCIA.Compliance }; - var tuples = CIS.GetTuples(report.PCMCIA.CIS); - if (tuples != null) + Tuple[] tuples = CIS.GetTuples(report.PCMCIA.CIS); + + if(tuples != null) { - var decodedTuples = new Dictionary(); - foreach (var tuple in tuples) - switch (tuple.Code) + Dictionary decodedTuples = new Dictionary(); + + foreach(Tuple tuple in tuples) + switch(tuple.Code) { case TupleCodes.CISTPL_NULL: case TupleCodes.CISTPL_END: @@ -139,20 +140,25 @@ namespace DiscImageChef.Server.Controllers case TupleCodes.CISTPL_VERS_1: break; case TupleCodes.CISTPL_DEVICEGEO: case TupleCodes.CISTPL_DEVICEGEO_A: - var geom = CIS.DecodeDeviceGeometryTuple(tuple.Data); - if (geom?.Geometries != null) - foreach (var geometry in geom.Geometries) + DeviceGeometryTuple geom = CIS.DecodeDeviceGeometryTuple(tuple.Data); + + if(geom?.Geometries != null) + foreach(DeviceGeometry geometry in geom.Geometries) { decodedTuples.Add("Device width", - $"{(1 << (geometry.CardInterface - 1)) * 8} bits"); + $"{(1 << (geometry.CardInterface - 1)) * 8} bits"); + decodedTuples.Add("Erase block", - $"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes"); + $"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes"); + decodedTuples.Add("Read block", - $"{(1 << (geometry.ReadBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes"); + $"{(1 << (geometry.ReadBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes"); + decodedTuples.Add("Write block", - $"{(1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes"); + $"{(1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes"); + decodedTuples.Add("Partition alignment", - $"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) * (1 << (geometry.Partitions - 1))} bytes"); + $"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) * (1 << (geometry.Partitions - 1))} bytes"); } break; @@ -191,46 +197,53 @@ namespace DiscImageChef.Server.Controllers case TupleCodes.CISTPL_SWIL: case TupleCodes.CISTPL_VERS_2: decodedTuples.Add("Undecoded tuple ID", tuple.Code.ToString()); + break; default: - decodedTuples.Add("Unknown tuple ID", $"0x{(byte) tuple.Code:X2}"); + decodedTuples.Add("Unknown tuple ID", $"0x{(byte)tuple.Code:X2}"); + break; } - if (decodedTuples.Count > 0) ViewBag.repPcmciaTuples = decodedTuples; + if(decodedTuples.Count > 0) + ViewBag.repPcmciaTuples = decodedTuples; } } - var removable = true; + bool removable = true; List testedMedia = null; - var ata = false; - var atapi = false; - var sscMedia = false; + bool ata = false; + bool atapi = false; + bool sscMedia = false; - if (report.ATA != null || report.ATAPI != null) + if(report.ATA != null || + report.ATAPI != null) { ata = true; - var ataOneValue = new List(); - var ataTwoValue = new Dictionary(); - CommonTypes.Metadata.Ata ataReport; + List ataOneValue = new List(); + Dictionary ataTwoValue = new Dictionary(); + CommonTypes.Metadata.Ata ataReport; - if (report.ATAPI != null) + if(report.ATAPI != null) { ViewBag.AtaItem = "ATAPI"; - ataReport = report.ATAPI; - atapi = true; + ataReport = report.ATAPI; + atapi = true; } else { ViewBag.AtaItem = "ATA"; - ataReport = report.ATA; + ataReport = report.ATA; } - var cfa = report.CompactFlash; + bool cfa = report.CompactFlash; - if (atapi && !cfa) ViewBag.lblAtaDeviceType = "ATAPI device"; - else if (!atapi && cfa) ViewBag.lblAtaDeviceType = "CompactFlash device"; - else ViewBag.lblAtaDeviceType = "ATA device"; + if(atapi && !cfa) + ViewBag.lblAtaDeviceType = "ATAPI device"; + else if(!atapi && cfa) + ViewBag.lblAtaDeviceType = "CompactFlash device"; + else + ViewBag.lblAtaDeviceType = "ATA device"; Ata.Report(ataReport, cfa, atapi, ref removable, ref ataOneValue, ref ataTwoValue, ref testedMedia); @@ -238,62 +251,78 @@ namespace DiscImageChef.Server.Controllers ViewBag.repAtaTwo = ataTwoValue; } - if (report.SCSI != null) + if(report.SCSI != null) { - var scsiOneValue = new List(); - var modePages = new Dictionary(); - var evpdPages = new Dictionary(); + List scsiOneValue = new List(); + Dictionary modePages = new Dictionary(); + Dictionary evpdPages = new Dictionary(); - var vendorId = StringHandlers.CToString(report.SCSI.Inquiry?.VendorIdentification); - if (report.SCSI.Inquiry != null) + string vendorId = StringHandlers.CToString(report.SCSI.Inquiry?.VendorIdentification); + + if(report.SCSI.Inquiry != null) { - var inq = report.SCSI.Inquiry.Value; + Inquiry.SCSIInquiry inq = report.SCSI.Inquiry.Value; + ViewBag.lblScsiVendor = VendorString.Prettify(vendorId) != vendorId - ? $"{vendorId} ({VendorString.Prettify(vendorId)})" - : vendorId; - ViewBag.lblScsiProduct = StringHandlers.CToString(inq.ProductIdentification); + ? $"{vendorId} ({VendorString.Prettify(vendorId)})" : vendorId; + + ViewBag.lblScsiProduct = StringHandlers.CToString(inq.ProductIdentification); ViewBag.lblScsiRevision = StringHandlers.CToString(inq.ProductRevisionLevel); } scsiOneValue.AddRange(ScsiInquiry.Report(report.SCSI.Inquiry)); - if (report.SCSI.SupportsModeSense6) scsiOneValue.Add("Device supports MODE SENSE (6)"); - if (report.SCSI.SupportsModeSense10) scsiOneValue.Add("Device supports MODE SENSE (10)"); - if (report.SCSI.SupportsModeSubpages) scsiOneValue.Add("Device supports MODE SENSE subpages"); + if(report.SCSI.SupportsModeSense6) + scsiOneValue.Add("Device supports MODE SENSE (6)"); - if (report.SCSI.ModeSense != null) + if(report.SCSI.SupportsModeSense10) + scsiOneValue.Add("Device supports MODE SENSE (10)"); + + if(report.SCSI.SupportsModeSubpages) + scsiOneValue.Add("Device supports MODE SENSE subpages"); + + if(report.SCSI.ModeSense != null) { var devType = PeripheralDeviceTypes.DirectAccess; - if (report.SCSI.Inquiry != null) - devType = (PeripheralDeviceTypes) report.SCSI.Inquiry.Value.PeripheralDeviceType; + + if(report.SCSI.Inquiry != null) + devType = (PeripheralDeviceTypes)report.SCSI.Inquiry.Value.PeripheralDeviceType; + ScsiModeSense.Report(report.SCSI.ModeSense, vendorId, devType, ref scsiOneValue, ref modePages); } - if (modePages.Count > 0) ViewBag.repModeSense = modePages; + if(modePages.Count > 0) + ViewBag.repModeSense = modePages; - if (report.SCSI.EVPDPages != null) ScsiEvpd.Report(report.SCSI.EVPDPages, vendorId, ref evpdPages); + if(report.SCSI.EVPDPages != null) + ScsiEvpd.Report(report.SCSI.EVPDPages, vendorId, ref evpdPages); - if (evpdPages.Count > 0) ViewBag.repEvpd = evpdPages; + if(evpdPages.Count > 0) + ViewBag.repEvpd = evpdPages; - if (report.SCSI.MultiMediaDevice != null) + if(report.SCSI.MultiMediaDevice != null) { testedMedia = report.SCSI.MultiMediaDevice.TestedMedia; - if (report.SCSI.MultiMediaDevice.ModeSense2A != null) + if(report.SCSI.MultiMediaDevice.ModeSense2A != null) { - var mmcModeOneValue = new List(); + List mmcModeOneValue = new List(); ScsiMmcMode.Report(report.SCSI.MultiMediaDevice.ModeSense2A, ref mmcModeOneValue); - if (mmcModeOneValue.Count > 0) ViewBag.repScsiMmcMode = mmcModeOneValue; + + if(mmcModeOneValue.Count > 0) + ViewBag.repScsiMmcMode = mmcModeOneValue; } - if (report.SCSI.MultiMediaDevice.Features != null) + if(report.SCSI.MultiMediaDevice.Features != null) { - var mmcFeaturesOneValue = new List(); + List mmcFeaturesOneValue = new List(); ScsiMmcFeatures.Report(report.SCSI.MultiMediaDevice.Features, ref mmcFeaturesOneValue); - if (mmcFeaturesOneValue.Count > 0) ViewBag.repScsiMmcFeatures = mmcFeaturesOneValue; + + if(mmcFeaturesOneValue.Count > 0) + ViewBag.repScsiMmcFeatures = mmcFeaturesOneValue; } } - else if (report.SCSI.SequentialDevice != null) + else if(report.SCSI.SequentialDevice != null) { ViewBag.divScsiSscVisible = true; @@ -306,75 +335,82 @@ namespace DiscImageChef.Server.Controllers ViewBag.lblScsiSscMinBlock = report.SCSI.SequentialDevice.MinBlockLength?.ToString() ?? "Unspecified"; - if (report.SCSI.SequentialDevice.SupportedDensities != null) + if(report.SCSI.SequentialDevice.SupportedDensities != null) ViewBag.repScsiSscDensities = report.SCSI.SequentialDevice.SupportedDensities; - if (report.SCSI.SequentialDevice.SupportedMediaTypes != null) + if(report.SCSI.SequentialDevice.SupportedMediaTypes != null) ViewBag.repScsiSscMedias = report.SCSI.SequentialDevice.SupportedMediaTypes; - if (report.SCSI.SequentialDevice.TestedMedia != null) + if(report.SCSI.SequentialDevice.TestedMedia != null) { - var mediaOneValue = new List(); + List mediaOneValue = new List(); SscTestedMedia.Report(report.SCSI.SequentialDevice.TestedMedia, ref mediaOneValue); - if (mediaOneValue.Count > 0) + + if(mediaOneValue.Count > 0) { - sscMedia = true; + sscMedia = true; ViewBag.repTestedMedia = mediaOneValue; } } } - else if (report.SCSI.ReadCapabilities != null) + else if(report.SCSI.ReadCapabilities != null) { removable = false; scsiOneValue.Add(""); - if (report.SCSI.ReadCapabilities.Blocks.HasValue && - report.SCSI.ReadCapabilities.BlockSize.HasValue) + if(report.SCSI.ReadCapabilities.Blocks.HasValue && + report.SCSI.ReadCapabilities.BlockSize.HasValue) { - scsiOneValue - .Add( - $"Device has {report.SCSI.ReadCapabilities.Blocks} blocks of {report.SCSI.ReadCapabilities.BlockSize} bytes each"); + scsiOneValue. + Add($"Device has {report.SCSI.ReadCapabilities.Blocks} blocks of {report.SCSI.ReadCapabilities.BlockSize} bytes each"); - if (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 / - 1024 > 1000000) - scsiOneValue - .Add( - $"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double) (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); - else if (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / - 1024 / - 1024 > 1000) - scsiOneValue - .Add( - $"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000} Gb, {(double) (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); + if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 / + 1024 > 1000000) + scsiOneValue. + Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); + else if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / + 1024 / + 1024 > 1000) + scsiOneValue. + Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); else - scsiOneValue - .Add( - $"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000} Mb, {(double) (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024:F2} MiB"); + scsiOneValue. + Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000} Mb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024:F2} MiB"); } - if (report.SCSI.ReadCapabilities.MediumType.HasValue) + if(report.SCSI.ReadCapabilities.MediumType.HasValue) scsiOneValue.Add($"Medium type code: {report.SCSI.ReadCapabilities.MediumType:X2}h"); - if (report.SCSI.ReadCapabilities.Density.HasValue) + + if(report.SCSI.ReadCapabilities.Density.HasValue) scsiOneValue.Add($"Density code: {report.SCSI.ReadCapabilities.Density:X2}h"); - if ((report.SCSI.ReadCapabilities.SupportsReadLong == true || - report.SCSI.ReadCapabilities.SupportsReadLong16 == true) && - report.SCSI.ReadCapabilities.LongBlockSize.HasValue) + + if((report.SCSI.ReadCapabilities.SupportsReadLong == true || + report.SCSI.ReadCapabilities.SupportsReadLong16 == true) && + report.SCSI.ReadCapabilities.LongBlockSize.HasValue) scsiOneValue.Add($"Long block size: {report.SCSI.ReadCapabilities.LongBlockSize} bytes"); - if (report.SCSI.ReadCapabilities.SupportsReadCapacity == true) + + if(report.SCSI.ReadCapabilities.SupportsReadCapacity == true) scsiOneValue.Add("Device supports READ CAPACITY (10) command."); - if (report.SCSI.ReadCapabilities.SupportsReadCapacity16 == true) + + if(report.SCSI.ReadCapabilities.SupportsReadCapacity16 == true) scsiOneValue.Add("Device supports READ CAPACITY (16) command."); - if (report.SCSI.ReadCapabilities.SupportsRead6 == true) + + if(report.SCSI.ReadCapabilities.SupportsRead6 == true) scsiOneValue.Add("Device supports READ (6) command."); - if (report.SCSI.ReadCapabilities.SupportsRead10 == true) + + if(report.SCSI.ReadCapabilities.SupportsRead10 == true) scsiOneValue.Add("Device supports READ (10) command."); - if (report.SCSI.ReadCapabilities.SupportsRead12 == true) + + if(report.SCSI.ReadCapabilities.SupportsRead12 == true) scsiOneValue.Add("Device supports READ (12) command."); - if (report.SCSI.ReadCapabilities.SupportsRead16 == true) + + if(report.SCSI.ReadCapabilities.SupportsRead16 == true) scsiOneValue.Add("Device supports READ (16) command."); - if (report.SCSI.ReadCapabilities.SupportsReadLong == true) + + if(report.SCSI.ReadCapabilities.SupportsReadLong == true) scsiOneValue.Add("Device supports READ LONG (10) command."); - if (report.SCSI.ReadCapabilities.SupportsReadLong16 == true) + + if(report.SCSI.ReadCapabilities.SupportsReadLong16 == true) scsiOneValue.Add("Device supports READ LONG (16) command."); } else @@ -385,88 +421,100 @@ namespace DiscImageChef.Server.Controllers ViewBag.repScsi = scsiOneValue; } - if (report.MultiMediaCard != null) + if(report.MultiMediaCard != null) { - var mmcOneValue = new List(); + List mmcOneValue = new List(); - if (report.MultiMediaCard.CID != null) + if(report.MultiMediaCard.CID != null) { - mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCID(report.MultiMediaCard.CID) - .Replace("\n", "
")); + mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCID(report.MultiMediaCard.CID). + Replace("\n", "
")); + mmcOneValue.Add(""); } - if (report.MultiMediaCard.CSD != null) + if(report.MultiMediaCard.CSD != null) { - mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.CSD) - .Replace("\n", "
")); + mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.CSD). + Replace("\n", "
")); + mmcOneValue.Add(""); } - if (report.MultiMediaCard.ExtendedCSD != null) + if(report.MultiMediaCard.ExtendedCSD != null) { - mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyExtendedCSD(report.MultiMediaCard.ExtendedCSD) - .Replace("\n", "
")); + mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyExtendedCSD(report.MultiMediaCard.ExtendedCSD). + Replace("\n", "
")); + mmcOneValue.Add(""); } - if (report.MultiMediaCard.OCR != null) + if(report.MultiMediaCard.OCR != null) { - mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.OCR) - .Replace("\n", "
")); + mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.OCR). + Replace("\n", "
")); + mmcOneValue.Add(""); } ViewBag.repMMC = mmcOneValue; } - if (report.SecureDigital != null) + if(report.SecureDigital != null) { - var sdOneValue = new List(); + List sdOneValue = new List(); - if (report.SecureDigital.CID != null) + if(report.SecureDigital.CID != null) { - sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCID(report.SecureDigital.CID) - .Replace("\n", "
")); + sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCID(report.SecureDigital.CID). + Replace("\n", "
")); + sdOneValue.Add(""); } - if (report.SecureDigital.CSD != null) + if(report.SecureDigital.CSD != null) { - sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.CSD) - .Replace("\n", "
")); + sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.CSD). + Replace("\n", "
")); + sdOneValue.Add(""); } - if (report.SecureDigital.SCR != null) + if(report.SecureDigital.SCR != null) { - sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifySCR(report.SecureDigital.SCR) - .Replace("\n", "
")); + sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifySCR(report.SecureDigital.SCR). + Replace("\n", "
")); + sdOneValue.Add(""); } - if (report.SecureDigital.OCR != null) + if(report.SecureDigital.OCR != null) { - sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.OCR) - .Replace("\n", "
")); + sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.OCR). + Replace("\n", "
")); + sdOneValue.Add(""); } ViewBag.repSD = sdOneValue; } - if (removable && !sscMedia && testedMedia != null) + if(removable && + !sscMedia && + testedMedia != null) { - var mediaOneValue = new List(); + List mediaOneValue = new List(); App_Start.TestedMedia.Report(testedMedia, ref mediaOneValue); - if (mediaOneValue.Count > 0) ViewBag.repTestedMedia = mediaOneValue; + + if(mediaOneValue.Count > 0) + ViewBag.repTestedMedia = mediaOneValue; } } - catch (Exception) + catch(Exception) { -#if DEBUG + #if DEBUG throw; -#endif + #endif return Content("Could not load device report"); } diff --git a/DiscImageChef.Server/Controllers/StatsController.cs b/DiscImageChef.Server/Controllers/StatsController.cs index 29a6ca58..39ba8b2c 100644 --- a/DiscImageChef.Server/Controllers/StatsController.cs +++ b/DiscImageChef.Server/Controllers/StatsController.cs @@ -44,27 +44,27 @@ using DiscImageChef.Server.Models; using Highsoft.Web.Mvc.Charts; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; +using OperatingSystem = DiscImageChef.Server.Models.OperatingSystem; using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID; +using Version = DiscImageChef.Server.Models.Version; namespace DiscImageChef.Server.Controllers { - /// - /// Renders a page with statistics, list of media type, devices, etc - /// + /// Renders a page with statistics, list of media type, devices, etc public class StatsController : Controller { - private readonly IWebHostEnvironment _environment; - private readonly DicServerContext ctx; - private List devices; - private List operatingSystems; - private List realMedia; - private List versions; - private List virtualMedia; + readonly IWebHostEnvironment _environment; + readonly DicServerContext ctx; + List devices; + List operatingSystems; + List realMedia; + List versions; + List virtualMedia; public StatsController(IWebHostEnvironment environment, DicServerContext context) { _environment = environment; - ctx = context; + ctx = context; } public ActionResult Index() @@ -73,121 +73,122 @@ namespace DiscImageChef.Server.Controllers try { - if ( - System.IO.File - .Exists(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "Statistics", "Statistics.xml"))) + if( + System.IO.File. + Exists(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), + "Statistics", "Statistics.xml"))) try { var statistics = new Stats(); var xs = new XmlSerializer(statistics.GetType()); - var fs = - WaitForFile( - Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "Statistics", "Statistics.xml"), - FileMode.Open, FileAccess.Read, FileShare.Read); - statistics = (Stats) xs.Deserialize(fs); + + FileStream fs = + WaitForFile(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), "Statistics", "Statistics.xml"), + FileMode.Open, FileAccess.Read, FileShare.Read); + + statistics = (Stats)xs.Deserialize(fs); fs.Close(); StatsConverter.Convert(statistics); - System.IO.File - .Delete(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "Statistics", "Statistics.xml")); + System.IO.File. + Delete(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), + "Statistics", "Statistics.xml")); } - catch (XmlException) + catch(XmlException) { // Do nothing } - if (ctx.OperatingSystems.Any()) + if(ctx.OperatingSystems.Any()) { operatingSystems = new List(); - foreach (var nvs in ctx.OperatingSystems) + + foreach(OperatingSystem nvs in ctx.OperatingSystems) operatingSystems.Add(new NameValueStats { name = - $"{DetectOS.GetPlatformName((PlatformID) Enum.Parse(typeof(PlatformID), nvs.Name), nvs.Version)}{(string.IsNullOrEmpty(nvs.Version) ? "" : " ")}{nvs.Version}", + $"{DetectOS.GetPlatformName((PlatformID)Enum.Parse(typeof(PlatformID), nvs.Name), nvs.Version)}{(string.IsNullOrEmpty(nvs.Version) ? "" : " ")}{nvs.Version}", Value = nvs.Count }); ViewBag.repOperatingSystems = operatingSystems.OrderBy(os => os.name).ToList(); - var osPieData = new List(); + List osPieData = new List(); decimal totalOsCount = ctx.OperatingSystems.Sum(o => o.Count); - foreach (var os in ctx.OperatingSystems.Select(o => o.Name).Distinct().ToList()) + + foreach(string os in ctx.OperatingSystems.Select(o => o.Name).Distinct().ToList()) { decimal osCount = ctx.OperatingSystems.Where(o => o.Name == os).Sum(o => o.Count); osPieData.Add(new PieSeriesData { - Name = - DetectOS.GetPlatformName((PlatformID) Enum.Parse(typeof(PlatformID), - os)), - Y = (double?) (osCount / totalOsCount), - Sliced = os == "Linux", - Selected = os == "Linux" + Name = DetectOS.GetPlatformName((PlatformID)Enum.Parse(typeof(PlatformID), os)), + Y = (double?)(osCount / totalOsCount), Sliced = os == "Linux", Selected = os == "Linux" }); } ViewData["osPieData"] = osPieData; - var linuxPieData = new List(); + List linuxPieData = new List(); - decimal linuxCount = ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString()) - .Sum(o => o.Count); - foreach (var version in + decimal linuxCount = ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString()). + Sum(o => o.Count); + + foreach(OperatingSystem version in ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString())) linuxPieData.Add(new PieSeriesData { Name = $"{DetectOS.GetPlatformName(PlatformID.Linux, version.Version)}{(string.IsNullOrEmpty(version.Version) ? "" : " ")}{version.Version}", - Y = (double?) (version.Count / linuxCount) + Y = (double?)(version.Count / linuxCount) }); ViewData["linuxPieData"] = linuxPieData; - var macosPieData = new List(); + List macosPieData = new List(); - decimal macosCount = ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString()) - .Sum(o => o.Count); - foreach (var version in + decimal macosCount = ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString()). + Sum(o => o.Count); + + foreach(OperatingSystem version in ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString())) macosPieData.Add(new PieSeriesData { Name = $"{DetectOS.GetPlatformName(PlatformID.MacOSX, version.Version)}{(string.IsNullOrEmpty(version.Version) ? "" : " ")}{version.Version}", - Y = (double?) (version.Count / macosCount) + Y = (double?)(version.Count / macosCount) }); ViewData["macosPieData"] = macosPieData; - var windowsPieData = new List(); + List windowsPieData = new List(); - decimal windowsCount = ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString()) - .Sum(o => o.Count); - foreach (var version in + decimal windowsCount = ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString()). + Sum(o => o.Count); + + foreach(OperatingSystem version in ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString())) windowsPieData.Add(new PieSeriesData { Name = $"{DetectOS.GetPlatformName(PlatformID.Win32NT, version.Version)}{(string.IsNullOrEmpty(version.Version) ? "" : " ")}{version.Version}", - Y = (double?) (version.Count / windowsCount) + Y = (double?)(version.Count / windowsCount) }); ViewData["windowsPieData"] = windowsPieData; } - if (ctx.Versions.Any()) + if(ctx.Versions.Any()) { versions = new List(); - foreach (var nvs in ctx.Versions) + + foreach(Version nvs in ctx.Versions) versions.Add(new NameValueStats { - name = nvs.Value == "previous" ? "Previous than 3.4.99.0" : nvs.Value, - Value = nvs.Count + name = nvs.Value == "previous" ? "Previous than 3.4.99.0" : nvs.Value, Value = nvs.Count }); ViewBag.repVersions = versions.OrderBy(ver => ver.name).ToList(); @@ -196,272 +197,264 @@ namespace DiscImageChef.Server.Controllers ViewData["versionsPieData"] = ctx.Versions.Select(version => new PieSeriesData { - Name = - version.Value == "previous" - ? "Previous than 3.4.99.0" - : version.Value, - Y = (double?) (version.Count / - totalVersionCount), - Sliced = version.Value == "previous", - Selected = version.Value == "previous" + Name = version.Value == "previous" ? "Previous than 3.4.99.0" : version.Value, + Y = (double?)(version.Count / totalVersionCount), Sliced = version.Value == "previous", + Selected = version.Value == "previous" }).ToList(); } - if (ctx.Commands.Any()) + if(ctx.Commands.Any()) { ViewBag.repCommands = ctx.Commands.OrderBy(c => c.Name).ToList(); decimal totalCommandCount = ctx.Commands.Sum(o => o.Count); - ViewData["commandsPieData"] = ctx - .Commands.Select(command => new PieSeriesData - { - Name = command.Name, - Y = (double?) (command.Count / - totalCommandCount), - Sliced = command.Name == "analyze", - Selected = command.Name == "analyze" - }).ToList(); + ViewData["commandsPieData"] = ctx.Commands.Select(command => new PieSeriesData + { + Name = command.Name, Y = (double?)(command.Count / totalCommandCount), + Sliced = command.Name == "analyze", Selected = command.Name == "analyze" + }).ToList(); } - if (ctx.Filters.Any()) + if(ctx.Filters.Any()) { ViewBag.repFilters = ctx.Filters.OrderBy(filter => filter.Name).ToList(); - var filtersPieData = new List(); + List filtersPieData = new List(); decimal totalFiltersCount = ctx.Filters.Sum(o => o.Count); - foreach (var filter in ctx.Filters.ToList()) + + foreach(Filter filter in ctx.Filters.ToList()) filtersPieData.Add(new PieSeriesData { - Name = filter.Name, - Y = (double?) (filter.Count / totalFiltersCount), - Sliced = filter.Name == "No filter", - Selected = filter.Name == "No filter" + Name = filter.Name, Y = (double?)(filter.Count / totalFiltersCount), + Sliced = filter.Name == "No filter", Selected = filter.Name == "No filter" }); ViewData["filtersPieData"] = filtersPieData; } - if (ctx.MediaFormats.Any()) + if(ctx.MediaFormats.Any()) { ViewBag.repMediaImages = ctx.MediaFormats.OrderBy(filter => filter.Name).ToList(); - var formatsPieData = new List(); + List formatsPieData = new List(); decimal totalFormatsCount = ctx.MediaFormats.Sum(o => o.Count); - decimal top10FormatCount = 0; + decimal top10FormatCount = 0; - foreach (var format in ctx.MediaFormats.OrderByDescending(o => o.Count).Take(10)) + foreach(MediaFormat format in ctx.MediaFormats.OrderByDescending(o => o.Count).Take(10)) { top10FormatCount += format.Count; formatsPieData.Add(new PieSeriesData { - Name = format.Name, Y = (double?) (format.Count / totalFormatsCount) + Name = format.Name, Y = (double?)(format.Count / totalFormatsCount) }); } formatsPieData.Add(new PieSeriesData { - Name = "Other", - Y = (double?) ((totalFormatsCount - top10FormatCount) / - totalFormatsCount), - Sliced = true, - Selected = true + Name = "Other", Y = (double?)((totalFormatsCount - top10FormatCount) / totalFormatsCount), + Sliced = true, Selected = true }); ViewData["formatsPieData"] = formatsPieData; } - if (ctx.Partitions.Any()) + if(ctx.Partitions.Any()) { ViewBag.repPartitions = ctx.Partitions.OrderBy(filter => filter.Name).ToList(); - var partitionsPieData = new List(); + List partitionsPieData = new List(); decimal totalPartitionsCount = ctx.Partitions.Sum(o => o.Count); - decimal top10PartitionCount = 0; + decimal top10PartitionCount = 0; - foreach (var partition in ctx.Partitions.OrderByDescending(o => o.Count).Take(10)) + foreach(Partition partition in ctx.Partitions.OrderByDescending(o => o.Count).Take(10)) { top10PartitionCount += partition.Count; partitionsPieData.Add(new PieSeriesData { - Name = partition.Name, - Y = (double?) (partition.Count / totalPartitionsCount) + Name = partition.Name, Y = (double?)(partition.Count / totalPartitionsCount) }); } partitionsPieData.Add(new PieSeriesData { - Name = "Other", - Y = (double?) ((totalPartitionsCount - top10PartitionCount) / - totalPartitionsCount), - Sliced = true, - Selected = true + Name = "Other", + Y = (double?)((totalPartitionsCount - top10PartitionCount) / totalPartitionsCount), + Sliced = true, Selected = true }); ViewData["partitionsPieData"] = partitionsPieData; } - if (ctx.Filesystems.Any()) + if(ctx.Filesystems.Any()) { ViewBag.repFilesystems = ctx.Filesystems.OrderBy(filter => filter.Name).ToList(); - var filesystemsPieData = new List(); + List filesystemsPieData = new List(); decimal totalFilesystemsCount = ctx.Filesystems.Sum(o => o.Count); - decimal top10FilesystemCount = 0; + decimal top10FilesystemCount = 0; - foreach (var filesystem in ctx.Filesystems.OrderByDescending(o => o.Count).Take(10)) + foreach(Filesystem filesystem in ctx.Filesystems.OrderByDescending(o => o.Count).Take(10)) { top10FilesystemCount += filesystem.Count; filesystemsPieData.Add(new PieSeriesData { - Name = filesystem.Name, - Y = (double?) (filesystem.Count / totalFilesystemsCount) + Name = filesystem.Name, Y = (double?)(filesystem.Count / totalFilesystemsCount) }); } filesystemsPieData.Add(new PieSeriesData { - Name = "Other", - Y = (double?) ((totalFilesystemsCount - top10FilesystemCount) / - totalFilesystemsCount), - Sliced = true, - Selected = true + Name = "Other", + Y = (double?)((totalFilesystemsCount - top10FilesystemCount) / totalFilesystemsCount), + Sliced = true, Selected = true }); ViewData["filesystemsPieData"] = filesystemsPieData; } - if (ctx.Medias.Any()) + if(ctx.Medias.Any()) { - realMedia = new List(); + realMedia = new List(); virtualMedia = new List(); - foreach (var nvs in ctx.Medias) + + foreach(Media nvs in ctx.Medias) try { - MediaType - .MediaTypeToString( - (CommonTypes.MediaType) Enum.Parse(typeof(CommonTypes.MediaType), nvs.Type), - out var type, out var subtype); + MediaType. + MediaTypeToString((CommonTypes.MediaType)Enum.Parse(typeof(CommonTypes.MediaType), nvs.Type), + out string type, out string subtype); - if (nvs.Real) - realMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Count}); - else virtualMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Count}); + if(nvs.Real) + realMedia.Add(new MediaItem + { + Type = type, SubType = subtype, Count = nvs.Count + }); + else + virtualMedia.Add(new MediaItem + { + Type = type, SubType = subtype, Count = nvs.Count + }); } catch { - if (nvs.Real) - realMedia.Add(new MediaItem {Type = nvs.Type, SubType = null, Count = nvs.Count}); - else virtualMedia.Add(new MediaItem {Type = nvs.Type, SubType = null, Count = nvs.Count}); + if(nvs.Real) + realMedia.Add(new MediaItem + { + Type = nvs.Type, SubType = null, Count = nvs.Count + }); + else + virtualMedia.Add(new MediaItem + { + Type = nvs.Type, SubType = null, Count = nvs.Count + }); } - if (realMedia.Count > 0) + if(realMedia.Count > 0) { ViewBag.repRealMedia = realMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList(); - var realMediaPieData = new List(); + List realMediaPieData = new List(); decimal totalRealMediaCount = realMedia.Sum(o => o.Count); decimal top10RealMediaCount = 0; - foreach (var realMediaItem in realMedia.OrderByDescending(o => o.Count).Take(10)) + foreach(MediaItem realMediaItem in realMedia.OrderByDescending(o => o.Count).Take(10)) { top10RealMediaCount += realMediaItem.Count; realMediaPieData.Add(new PieSeriesData { Name = $"{realMediaItem.Type} ({realMediaItem.SubType})", - Y = (double?) (realMediaItem.Count / totalRealMediaCount) + Y = (double?)(realMediaItem.Count / totalRealMediaCount) }); } realMediaPieData.Add(new PieSeriesData { - Name = "Other", - Y = (double?) ((totalRealMediaCount - top10RealMediaCount) / - totalRealMediaCount), - Sliced = true, - Selected = true + Name = "Other", + Y = (double?)((totalRealMediaCount - top10RealMediaCount) / totalRealMediaCount), + Sliced = true, Selected = true }); ViewData["realMediaPieData"] = realMediaPieData; } - if (virtualMedia.Count > 0) + if(virtualMedia.Count > 0) { ViewBag.repVirtualMedia = virtualMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList(); - var virtualMediaPieData = new List(); + List virtualMediaPieData = new List(); decimal totalVirtualMediaCount = virtualMedia.Sum(o => o.Count); decimal top10VirtualMediaCount = 0; - foreach (var virtualMediaItem in virtualMedia.OrderByDescending(o => o.Count).Take(10)) + foreach(MediaItem virtualMediaItem in virtualMedia.OrderByDescending(o => o.Count).Take(10)) { top10VirtualMediaCount += virtualMediaItem.Count; virtualMediaPieData.Add(new PieSeriesData { - Name = - $"{virtualMediaItem.Type} ({virtualMediaItem.SubType})", - Y = (double?) (virtualMediaItem.Count / - totalVirtualMediaCount) + Name = $"{virtualMediaItem.Type} ({virtualMediaItem.SubType})", + Y = (double?)(virtualMediaItem.Count / totalVirtualMediaCount) }); } virtualMediaPieData.Add(new PieSeriesData { Name = "Other", - Y = (double?) - ((totalVirtualMediaCount - top10VirtualMediaCount) / - totalVirtualMediaCount), - Sliced = true, - Selected = true + Y = (double?)((totalVirtualMediaCount - top10VirtualMediaCount) / + totalVirtualMediaCount), + Sliced = true, Selected = true }); ViewData["virtualMediaPieData"] = virtualMediaPieData; } } - if (ctx.DeviceStats.Any()) + if(ctx.DeviceStats.Any()) { devices = new List(); - foreach (var device in ctx.DeviceStats.ToList()) + + foreach(DeviceStat device in ctx.DeviceStats.ToList()) { string xmlFile; - if (!string.IsNullOrWhiteSpace(device.Manufacturer) && - !string.IsNullOrWhiteSpace(device.Model) && - !string.IsNullOrWhiteSpace(device.Revision)) + + if(!string.IsNullOrWhiteSpace(device.Manufacturer) && + !string.IsNullOrWhiteSpace(device.Model) && + !string.IsNullOrWhiteSpace(device.Revision)) xmlFile = device.Manufacturer + "_" + device.Model + "_" + device.Revision + ".xml"; - else if (!string.IsNullOrWhiteSpace(device.Manufacturer) && - !string.IsNullOrWhiteSpace(device.Model)) + else if(!string.IsNullOrWhiteSpace(device.Manufacturer) && + !string.IsNullOrWhiteSpace(device.Model)) xmlFile = device.Manufacturer + "_" + device.Model + ".xml"; - else if (!string.IsNullOrWhiteSpace(device.Model) && - !string.IsNullOrWhiteSpace(device.Revision)) + else if(!string.IsNullOrWhiteSpace(device.Model) && + !string.IsNullOrWhiteSpace(device.Revision)) xmlFile = device.Model + "_" + device.Revision + ".xml"; - else xmlFile = device.Model + ".xml"; + else + xmlFile = device.Model + ".xml"; xmlFile = xmlFile.Replace('/', '_').Replace('\\', '_').Replace('?', '_'); - if (System.IO.File.Exists(Path.Combine(_environment.ContentRootPath, "Reports", xmlFile))) + if(System.IO.File.Exists(Path.Combine(_environment.ContentRootPath, "Reports", xmlFile))) { var deviceReport = new DeviceReport(); var xs = new XmlSerializer(deviceReport.GetType()); - var fs = - WaitForFile( - Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "Reports", xmlFile), - FileMode.Open, FileAccess.Read, FileShare.Read); - deviceReport = (DeviceReport) xs.Deserialize(fs); + + FileStream fs = + WaitForFile(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), "Reports", xmlFile), + FileMode.Open, FileAccess.Read, FileShare.Read); + + deviceReport = (DeviceReport)xs.Deserialize(fs); fs.Close(); var deviceReportV2 = new DeviceReportV2(deviceReport); @@ -469,70 +462,64 @@ namespace DiscImageChef.Server.Controllers device.Report = ctx.Devices.Add(new Device(deviceReportV2)).Entity; ctx.SaveChanges(); - System.IO.File - .Delete(Path.Combine( - _environment.ContentRootPath ?? throw new InvalidOperationException(), - "Reports", xmlFile)); + System.IO.File. + Delete(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), + "Reports", xmlFile)); } devices.Add(new DeviceItem { - Manufacturer = device.Manufacturer, - Model = device.Model, - Revision = device.Revision, - Bus = device.Bus, - ReportId = device.Report != null && device.Report.Id != 0 - ? device.Report.Id - : 0 + Manufacturer = device.Manufacturer, Model = device.Model, Revision = device.Revision, + Bus = device.Bus, + ReportId = device.Report != null && device.Report.Id != 0 ? device.Report.Id : 0 }); } - ViewBag.repDevices = devices.OrderBy(device => device.Manufacturer).ThenBy(device => device.Model) - .ThenBy(device => device.Revision).ThenBy(device => device.Bus) - .ToList(); + ViewBag.repDevices = devices.OrderBy(device => device.Manufacturer).ThenBy(device => device.Model). + ThenBy(device => device.Revision).ThenBy(device => device.Bus). + ToList(); ViewData["devicesBusPieData"] = (from deviceBus in devices.Select(d => d.Bus).Distinct() - let deviceBusCount = devices.Count(d => d.Bus == deviceBus) - select new PieSeriesData - { - Name = deviceBus, - Y = deviceBusCount / (double) devices.Count - }).ToList(); + let deviceBusCount = devices.Count(d => d.Bus == deviceBus) + select new PieSeriesData + { + Name = deviceBus, Y = deviceBusCount / (double)devices.Count + }).ToList(); ViewData["devicesManufacturerPieData"] = - (from manufacturer in - devices.Where(d => d.Manufacturer != null) - .Select(d => d.Manufacturer.ToLowerInvariant()) - .Distinct() - let manufacturerCount = - devices.Count(d => d.Manufacturer?.ToLowerInvariant() == manufacturer) - select new PieSeriesData - {Name = manufacturer, Y = manufacturerCount / (double) devices.Count}) - .ToList(); + (from manufacturer in devices.Where(d => d.Manufacturer != null). + Select(d => d.Manufacturer.ToLowerInvariant()).Distinct() + let manufacturerCount = devices.Count(d => d.Manufacturer?.ToLowerInvariant() == manufacturer) + select new PieSeriesData + { + Name = manufacturer, Y = manufacturerCount / (double)devices.Count + }).ToList(); } } - catch (Exception) + catch(Exception) { -#if DEBUG + #if DEBUG throw; -#endif + #endif return Content("Could not read statistics"); } return View(); } - private static FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share) + static FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share) { - for (var numTries = 0; numTries < 100; numTries++) + for(int numTries = 0; numTries < 100; numTries++) { FileStream fs = null; + try { fs = new FileStream(fullPath, mode, access, share); + return fs; } - catch (IOException) + catch(IOException) { fs?.Dispose(); Thread.Sleep(50); diff --git a/DiscImageChef.Server/Controllers/UpdateController.cs b/DiscImageChef.Server/Controllers/UpdateController.cs index da3fe40c..ad780d35 100644 --- a/DiscImageChef.Server/Controllers/UpdateController.cs +++ b/DiscImageChef.Server/Controllers/UpdateController.cs @@ -30,6 +30,7 @@ // Copyright © 2011-2019 Natalia Portillo // ****************************************************************************/ +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -45,60 +46,63 @@ namespace DiscImageChef.Server.Controllers { public class UpdateController : Controller { - private readonly DicServerContext _ctx; + readonly DicServerContext _ctx; - public UpdateController(DicServerContext ctx) - { - _ctx = ctx; - } + public UpdateController(DicServerContext ctx) => _ctx = ctx; - /// - /// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server - /// + /// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server /// HTTP response - [Route("api/update")] - [HttpGet] + [Route("api/update"), HttpGet] public ActionResult Update(long timestamp) { - var sync = new SyncDto(); - var lastSync = DateHandlers.UnixToDateTime(timestamp); + var sync = new SyncDto(); + DateTime lastSync = DateHandlers.UnixToDateTime(timestamp); sync.UsbVendors = new List(); - foreach (var vendor in _ctx.UsbVendors.Where(v => v.ModifiedWhen > lastSync)) - sync.UsbVendors.Add(new UsbVendorDto {VendorId = vendor.VendorId, Vendor = vendor.Vendor}); + + foreach(UsbVendor vendor in _ctx.UsbVendors.Where(v => v.ModifiedWhen > lastSync)) + sync.UsbVendors.Add(new UsbVendorDto + { + VendorId = vendor.VendorId, Vendor = vendor.Vendor + }); sync.UsbProducts = new List(); - foreach (var product in _ctx.UsbProducts.Include(p => p.Vendor).Where(p => p.ModifiedWhen > lastSync)) + + foreach(UsbProduct product in _ctx.UsbProducts.Include(p => p.Vendor).Where(p => p.ModifiedWhen > lastSync)) sync.UsbProducts.Add(new UsbProductDto { - Id = product.Id, - Product = product.Product, - ProductId = product.ProductId, + Id = product.Id, Product = product.Product, ProductId = product.ProductId, VendorId = product.Vendor.VendorId }); sync.Offsets = new List(); - foreach (var offset in _ctx.CdOffsets.Where(o => o.ModifiedWhen > lastSync)) + + foreach(CompactDiscOffset offset in _ctx.CdOffsets.Where(o => o.ModifiedWhen > lastSync)) sync.Offsets.Add(new CdOffsetDto(offset, offset.Id)); sync.Devices = new List(); - foreach (var device in _ctx.Devices.Where(d => d.ModifiedWhen > lastSync).ToList()) - sync.Devices.Add(new - DeviceDto( - JsonConvert.DeserializeObject(JsonConvert.SerializeObject(device, - Formatting.None, - new JsonSerializerSettings {ReferenceLoopHandling = ReferenceLoopHandling.Ignore})), - device.Id, device.OptimalMultipleSectorsRead)); - var js = JsonSerializer.Create(); - var sw = new StringWriter(); + foreach(Device device in _ctx.Devices.Where(d => d.ModifiedWhen > lastSync).ToList()) + sync.Devices.Add(new DeviceDto(JsonConvert. + DeserializeObject(JsonConvert.SerializeObject(device, + Formatting. + None, + new + JsonSerializerSettings + { + ReferenceLoopHandling + = ReferenceLoopHandling. + Ignore + })), + device.Id, device.OptimalMultipleSectorsRead)); + + JsonSerializer js = JsonSerializer.Create(); + var sw = new StringWriter(); js.Serialize(sw, sync); return new ContentResult { - StatusCode = (int) HttpStatusCode.OK, - Content = sw.ToString(), - ContentType = "application/json" + StatusCode = (int)HttpStatusCode.OK, Content = sw.ToString(), ContentType = "application/json" }; } } diff --git a/DiscImageChef.Server/Controllers/UploadReportController.cs b/DiscImageChef.Server/Controllers/UploadReportController.cs index 0f15d01b..33077288 100644 --- a/DiscImageChef.Server/Controllers/UploadReportController.cs +++ b/DiscImageChef.Server/Controllers/UploadReportController.cs @@ -42,6 +42,7 @@ using DiscImageChef.CommonTypes.Metadata; using DiscImageChef.Server.Models; using MailKit.Net.Smtp; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using MimeKit; using Newtonsoft.Json; @@ -50,71 +51,80 @@ namespace DiscImageChef.Server.Controllers { public class UploadReportController : Controller { - private readonly IWebHostEnvironment _environment; - private readonly DicServerContext ctx; + readonly IWebHostEnvironment _environment; + readonly DicServerContext ctx; public UploadReportController(IWebHostEnvironment environment, DicServerContext _ctx) { _environment = environment; - ctx = _ctx; + ctx = _ctx; } - /// - /// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server - /// + /// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server /// HTTP response - [Route("api/uploadreport")] - [HttpPost] + [Route("api/uploadreport"), HttpPost] public async Task UploadReport() { - var response = new ContentResult {StatusCode = (int) HttpStatusCode.OK, ContentType = "text/plain"}; + var response = new ContentResult + { + StatusCode = (int)HttpStatusCode.OK, ContentType = "text/plain" + }; try { - var newReport = new DeviceReport(); - var request = HttpContext.Request; + var newReport = new DeviceReport(); + HttpRequest request = HttpContext.Request; var xs = new XmlSerializer(newReport.GetType()); - newReport = (DeviceReport) xs.Deserialize( - new StringReader(await new StreamReader(request.Body).ReadToEndAsync())); - if (newReport == null) + newReport = + (DeviceReport) + xs.Deserialize(new StringReader(await new StreamReader(request.Body).ReadToEndAsync())); + + if(newReport == null) { response.Content = "notstats"; + return response; } var reportV2 = new DeviceReportV2(newReport); - var jsonSw = new StringWriter(); - jsonSw.Write(JsonConvert.SerializeObject(reportV2, Formatting.Indented, - new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - })); - var reportV2String = jsonSw.ToString(); + var jsonSw = new StringWriter(); + + jsonSw.Write(JsonConvert.SerializeObject(reportV2, Formatting.Indented, new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore + })); + + string reportV2String = jsonSw.ToString(); jsonSw.Close(); ctx.Reports.Add(new UploadedReport(reportV2)); ctx.SaveChanges(); - var pgpIn = new MemoryStream(Encoding.UTF8.GetBytes(reportV2String)); + var pgpIn = new MemoryStream(Encoding.UTF8.GetBytes(reportV2String)); var pgpOut = new MemoryStream(); - var pgp = new ChoPGPEncryptDecrypt(); + var pgp = new ChoPGPEncryptDecrypt(); + pgp.Encrypt(pgpIn, pgpOut, - Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "public.asc")); + Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), + "public.asc")); + pgpOut.Position = 0; - reportV2String = Encoding.UTF8.GetString(pgpOut.ToArray()); + reportV2String = Encoding.UTF8.GetString(pgpOut.ToArray()); var message = new MimeMessage { - Subject = "New device report (old version)", - Body = new TextPart("plain") {Text = reportV2String} + Subject = "New device report (old version)", Body = new TextPart("plain") + { + Text = reportV2String + } }; + message.From.Add(new MailboxAddress("DiscImageChef", "dic@claunia.com")); message.To.Add(new MailboxAddress("Natalia Portillo", "claunia@claunia.com")); - using (var client = new SmtpClient()) + using(var client = new SmtpClient()) { client.Connect("mail.claunia.com", 25, false); client.Send(message); @@ -122,63 +132,74 @@ namespace DiscImageChef.Server.Controllers } response.Content = "ok"; + return response; } + // ReSharper disable once RedundantCatchClause catch { -#if DEBUG - if (Debugger.IsAttached) throw; -#endif + #if DEBUG + if(Debugger.IsAttached) + throw; + #endif response.Content = "error"; + return response; } } - /// - /// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server - /// + /// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server /// HTTP response - [Route("api/uploadreportv2")] - [HttpPost] + [Route("api/uploadreportv2"), HttpPost] public async Task UploadReportV2() { - var response = new ContentResult {StatusCode = (int) HttpStatusCode.OK, ContentType = "text/plain"}; + var response = new ContentResult + { + StatusCode = (int)HttpStatusCode.OK, ContentType = "text/plain" + }; try { - var request = HttpContext.Request; + HttpRequest request = HttpContext.Request; - var sr = new StreamReader(request.Body); - var reportJson = await sr.ReadToEndAsync(); - var newReport = JsonConvert.DeserializeObject(reportJson); + var sr = new StreamReader(request.Body); + string reportJson = await sr.ReadToEndAsync(); + var newReport = JsonConvert.DeserializeObject(reportJson); - if (newReport == null) + if(newReport == null) { response.Content = "notstats"; + return response; } ctx.Reports.Add(new UploadedReport(newReport)); ctx.SaveChanges(); - var pgpIn = new MemoryStream(Encoding.UTF8.GetBytes(reportJson)); + var pgpIn = new MemoryStream(Encoding.UTF8.GetBytes(reportJson)); var pgpOut = new MemoryStream(); - var pgp = new ChoPGPEncryptDecrypt(); + var pgp = new ChoPGPEncryptDecrypt(); + pgp.Encrypt(pgpIn, pgpOut, - Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), - "public.asc")); + Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), + "public.asc")); + pgpOut.Position = 0; - reportJson = Encoding.UTF8.GetString(pgpOut.ToArray()); + reportJson = Encoding.UTF8.GetString(pgpOut.ToArray()); var message = new MimeMessage { - Subject = "New device report", Body = new TextPart("plain") {Text = reportJson} + Subject = "New device report", Body = new TextPart("plain") + { + Text = reportJson + } }; + message.From.Add(new MailboxAddress("DiscImageChef", "dic@claunia.com")); message.To.Add(new MailboxAddress("Natalia Portillo", "claunia@claunia.com")); - using (var client = new SmtpClient()) + using(var client = new SmtpClient()) { client.Connect("mail.claunia.com", 25, false); client.Send(message); @@ -186,15 +207,19 @@ namespace DiscImageChef.Server.Controllers } response.Content = "ok"; + return response; } + // ReSharper disable once RedundantCatchClause catch { -#if DEBUG - if (Debugger.IsAttached) throw; -#endif + #if DEBUG + if(Debugger.IsAttached) + throw; + #endif response.Content = "error"; + return response; } } diff --git a/DiscImageChef.Server/Controllers/UploadStatsController.cs b/DiscImageChef.Server/Controllers/UploadStatsController.cs index f780a936..c6974b28 100644 --- a/DiscImageChef.Server/Controllers/UploadStatsController.cs +++ b/DiscImageChef.Server/Controllers/UploadStatsController.cs @@ -41,6 +41,7 @@ using System.Xml.Serialization; using DiscImageChef.CommonTypes.Metadata; using DiscImageChef.Server.Models; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using OperatingSystem = DiscImageChef.Server.Models.OperatingSystem; @@ -50,176 +51,216 @@ namespace DiscImageChef.Server.Controllers { public class UploadStatsController : Controller { - private readonly DicServerContext _ctx; - private IWebHostEnvironment _environment; + readonly DicServerContext _ctx; + IWebHostEnvironment _environment; public UploadStatsController(IWebHostEnvironment environment, DicServerContext ctx) { _environment = environment; - _ctx = ctx; + _ctx = ctx; } /// - /// Receives statistics from DiscImageChef.Core, processes them and adds them to a server-side global statistics XML + /// Receives statistics from DiscImageChef.Core, processes them and adds them to a server-side global statistics + /// XML /// /// HTTP response - [Route("api/uploadstats")] - [HttpPost] + [Route("api/uploadstats"), HttpPost] public async Task UploadStats() { - var response = new ContentResult {StatusCode = (int) HttpStatusCode.OK, ContentType = "text/plain"}; + var response = new ContentResult + { + StatusCode = (int)HttpStatusCode.OK, ContentType = "text/plain" + }; try { - var newStats = new Stats(); - var request = HttpContext.Request; + var newStats = new Stats(); + HttpRequest request = HttpContext.Request; var xs = new XmlSerializer(newStats.GetType()); - newStats = (Stats) xs.Deserialize( - new StringReader(await new StreamReader(request.Body).ReadToEndAsync())); - if (newStats == null) + newStats = + (Stats)xs.Deserialize(new StringReader(await new StreamReader(request.Body).ReadToEndAsync())); + + if(newStats == null) { response.Content = "notstats"; + return response; } StatsConverter.Convert(newStats); response.Content = "ok"; + return response; } - catch (Exception ex) + catch(Exception ex) { -#if DEBUG - if (Debugger.IsAttached) throw; -#endif + #if DEBUG + if(Debugger.IsAttached) + throw; + #endif response.Content = "error"; + return response; } } - /// - /// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server - /// + /// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server /// HTTP response - [Route("api/uploadstatsv2")] - [HttpPost] + [Route("api/uploadstatsv2"), HttpPost] public async Task UploadStatsV2() { - var response = new ContentResult {StatusCode = (int) HttpStatusCode.OK, ContentType = "text/plain"}; + var response = new ContentResult + { + StatusCode = (int)HttpStatusCode.OK, ContentType = "text/plain" + }; try { - var request = HttpContext.Request; + HttpRequest request = HttpContext.Request; - var sr = new StreamReader(request.Body); - var statsString = await sr.ReadToEndAsync(); - var newstats = JsonConvert.DeserializeObject(statsString); + var sr = new StreamReader(request.Body); + string statsString = await sr.ReadToEndAsync(); + var newstats = JsonConvert.DeserializeObject(statsString); - if (newstats == null) + if(newstats == null) { response.Content = "notstats"; + return response; } - if (newstats.Commands != null) - foreach (var nvs in newstats.Commands) + if(newstats.Commands != null) + foreach(NameValueStats nvs in newstats.Commands) { - var existing = _ctx.Commands.FirstOrDefault(c => c.Name == nvs.name); + Command existing = _ctx.Commands.FirstOrDefault(c => c.Name == nvs.name); - if (existing == null) _ctx.Commands.Add(new Command {Name = nvs.name, Count = nvs.Value}); - else existing.Count += nvs.Value; + if(existing == null) + _ctx.Commands.Add(new Command + { + Name = nvs.name, Count = nvs.Value + }); + else + existing.Count += nvs.Value; } - if (newstats.Versions != null) - foreach (var nvs in newstats.Versions) + if(newstats.Versions != null) + foreach(NameValueStats nvs in newstats.Versions) { - var existing = _ctx.Versions.FirstOrDefault(c => c.Value == nvs.name); + Version existing = _ctx.Versions.FirstOrDefault(c => c.Value == nvs.name); - if (existing == null) _ctx.Versions.Add(new Version {Value = nvs.name, Count = nvs.Value}); - else existing.Count += nvs.Value; + if(existing == null) + _ctx.Versions.Add(new Version + { + Value = nvs.name, Count = nvs.Value + }); + else + existing.Count += nvs.Value; } - if (newstats.Filesystems != null) - foreach (var nvs in newstats.Filesystems) + if(newstats.Filesystems != null) + foreach(NameValueStats nvs in newstats.Filesystems) { - var existing = _ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name); + Filesystem existing = _ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name); - if (existing == null) _ctx.Filesystems.Add(new Filesystem {Name = nvs.name, Count = nvs.Value}); - else existing.Count += nvs.Value; + if(existing == null) + _ctx.Filesystems.Add(new Filesystem + { + Name = nvs.name, Count = nvs.Value + }); + else + existing.Count += nvs.Value; } - if (newstats.Partitions != null) - foreach (var nvs in newstats.Partitions) + if(newstats.Partitions != null) + foreach(NameValueStats nvs in newstats.Partitions) { - var existing = _ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name); + Partition existing = _ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name); - if (existing == null) _ctx.Partitions.Add(new Partition {Name = nvs.name, Count = nvs.Value}); - else existing.Count += nvs.Value; + if(existing == null) + _ctx.Partitions.Add(new Partition + { + Name = nvs.name, Count = nvs.Value + }); + else + existing.Count += nvs.Value; } - if (newstats.MediaFormats != null) - foreach (var nvs in newstats.MediaFormats) + if(newstats.MediaFormats != null) + foreach(NameValueStats nvs in newstats.MediaFormats) { - var existing = _ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name); + MediaFormat existing = _ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name); - if (existing == null) - _ctx.MediaFormats.Add(new MediaFormat {Name = nvs.name, Count = nvs.Value}); - else existing.Count += nvs.Value; + if(existing == null) + _ctx.MediaFormats.Add(new MediaFormat + { + Name = nvs.name, Count = nvs.Value + }); + else + existing.Count += nvs.Value; } - if (newstats.Filters != null) - foreach (var nvs in newstats.Filters) + if(newstats.Filters != null) + foreach(NameValueStats nvs in newstats.Filters) { - var existing = _ctx.Filters.FirstOrDefault(c => c.Name == nvs.name); + Filter existing = _ctx.Filters.FirstOrDefault(c => c.Name == nvs.name); - if (existing == null) _ctx.Filters.Add(new Filter {Name = nvs.name, Count = nvs.Value}); - else existing.Count += nvs.Value; + if(existing == null) + _ctx.Filters.Add(new Filter + { + Name = nvs.name, Count = nvs.Value + }); + else + existing.Count += nvs.Value; } - if (newstats.OperatingSystems != null) - foreach (var operatingSystem in newstats.OperatingSystems) + if(newstats.OperatingSystems != null) + foreach(OsStats operatingSystem in newstats.OperatingSystems) { - var existing = - _ctx.OperatingSystems.FirstOrDefault(c => c.Name == operatingSystem.name && + OperatingSystem existing = + _ctx.OperatingSystems.FirstOrDefault(c => c.Name == operatingSystem.name && c.Version == operatingSystem.version); - if (existing == null) + if(existing == null) _ctx.OperatingSystems.Add(new OperatingSystem { - Name = operatingSystem.name, - Version = operatingSystem.version, + Name = operatingSystem.name, Version = operatingSystem.version, Count = operatingSystem.Value }); - else existing.Count += operatingSystem.Value; + else + existing.Count += operatingSystem.Value; } - if (newstats.Medias != null) - foreach (var media in newstats.Medias) + if(newstats.Medias != null) + foreach(MediaStats media in newstats.Medias) { - var existing = _ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real); + Media existing = _ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real); - if (existing == null) - _ctx.Medias.Add(new Media {Type = media.type, Real = media.real, Count = media.Value}); - else existing.Count += media.Value; + if(existing == null) + _ctx.Medias.Add(new Media + { + Type = media.type, Real = media.real, Count = media.Value + }); + else + existing.Count += media.Value; } - if (newstats.Devices != null) - foreach (var device in newstats.Devices) + if(newstats.Devices != null) + foreach(DeviceStats device in newstats.Devices) { - var existing = - _ctx.DeviceStats.FirstOrDefault(c => c.Bus == device.Bus && + DeviceStat existing = + _ctx.DeviceStats.FirstOrDefault(c => c.Bus == device.Bus && c.Manufacturer == device.Manufacturer && - c.Model == device.Model && - c.Revision == device.Revision); + c.Model == device.Model && + c.Revision == device.Revision); - if (existing == null) + if(existing == null) _ctx.DeviceStats.Add(new DeviceStat { - Bus = device.Bus, - Manufacturer = device.Manufacturer, - Model = device.Model, + Bus = device.Bus, Manufacturer = device.Manufacturer, Model = device.Model, Revision = device.Revision }); } @@ -227,32 +268,40 @@ namespace DiscImageChef.Server.Controllers _ctx.SaveChanges(); response.Content = "ok"; + return response; } + // ReSharper disable once RedundantCatchClause catch { -#if DEBUG - if (Debugger.IsAttached) throw; -#endif + #if DEBUG + if(Debugger.IsAttached) + throw; + #endif response.Content = "error"; + return response; } } - private FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share) + FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share) { - for (var numTries = 0; numTries < 100; numTries++) + for(int numTries = 0; numTries < 100; numTries++) { FileStream fs = null; + try { fs = new FileStream(fullPath, mode, access, share); + return fs; } - catch (IOException) + catch(IOException) { - if (fs != null) fs.Dispose(); + if(fs != null) + fs.Dispose(); + Thread.Sleep(50); } } diff --git a/DiscImageChef.Server/Migrations/20191102132240_InitialMigration.cs b/DiscImageChef.Server/Migrations/20191102132240_InitialMigration.cs index ed8c583c..63d169ca 100644 --- a/DiscImageChef.Server/Migrations/20191102132240_InitialMigration.cs +++ b/DiscImageChef.Server/Migrations/20191102132240_InitialMigration.cs @@ -10,508 +10,447 @@ namespace DiscImageChef.Server.Migrations protected override void Up(MigrationBuilder migrationBuilder) { #region Check for old tables - - var AtasExists = DicServerContext.TableExists("Atas"); - var BlockDescriptorsExists = DicServerContext.TableExists("BlockDescriptors"); - var ChsExists = DicServerContext.TableExists("Chs"); - var CommandsExists = DicServerContext.TableExists("Commands"); - var CompactDiscOffsetsExists = DicServerContext.TableExists("CompactDiscOffsets"); - var DensityCodesExists = DicServerContext.TableExists("DensityCodes"); - var DevicesExists = DicServerContext.TableExists("Devices"); - var DeviceStatsExists = DicServerContext.TableExists("DeviceStats"); - var FilesystemsExists = DicServerContext.TableExists("Filesystems"); - var FiltersExists = DicServerContext.TableExists("Filters"); - var FireWiresExists = DicServerContext.TableExists("FireWires"); - var MediaExists = DicServerContext.TableExists("Media"); - var MediaFormatsExists = DicServerContext.TableExists("MediaFormats"); - var MmcFeaturesExists = DicServerContext.TableExists("MmcFeatures"); - var MmcsExists = DicServerContext.TableExists("Mmcs"); - var MmcSdsExists = DicServerContext.TableExists("MmcSds"); - var OperatingSystemsExists = DicServerContext.TableExists("OperatingSystems"); - var PartitionsExists = DicServerContext.TableExists("Partitions"); - var PcmciasExists = DicServerContext.TableExists("Pcmcias"); - var ScsiModesExists = DicServerContext.TableExists("ScsiModes"); - var ScsiPagesExists = DicServerContext.TableExists("ScsiPages"); - var ScsisExists = DicServerContext.TableExists("Scsis"); - var SscsExists = DicServerContext.TableExists("Sscs"); - var SscSupportedMediasExists = DicServerContext.TableExists("SscSupportedMedias"); - var SupportedDensitiesExists = DicServerContext.TableExists("SupportedDensities"); - var TestedMediasExists = DicServerContext.TableExists("TestedMedias"); - var TestedSequentialMediasExists = DicServerContext.TableExists("TestedSequentialMedias"); - var UploadedReportsExists = DicServerContext.TableExists("UploadedReports"); - var UsbProductsExists = DicServerContext.TableExists("UsbProducts"); - var UsbsExists = DicServerContext.TableExists("Usbs"); - var UsbVendorsExists = DicServerContext.TableExists("UsbVendors"); - var VersionsExists = DicServerContext.TableExists("Versions"); - var EFExists = DicServerContext.TableExists("__MigrationHistory"); - + bool AtasExists = DicServerContext.TableExists("Atas"); + bool BlockDescriptorsExists = DicServerContext.TableExists("BlockDescriptors"); + bool ChsExists = DicServerContext.TableExists("Chs"); + bool CommandsExists = DicServerContext.TableExists("Commands"); + bool CompactDiscOffsetsExists = DicServerContext.TableExists("CompactDiscOffsets"); + bool DensityCodesExists = DicServerContext.TableExists("DensityCodes"); + bool DevicesExists = DicServerContext.TableExists("Devices"); + bool DeviceStatsExists = DicServerContext.TableExists("DeviceStats"); + bool FilesystemsExists = DicServerContext.TableExists("Filesystems"); + bool FiltersExists = DicServerContext.TableExists("Filters"); + bool FireWiresExists = DicServerContext.TableExists("FireWires"); + bool MediaExists = DicServerContext.TableExists("Media"); + bool MediaFormatsExists = DicServerContext.TableExists("MediaFormats"); + bool MmcFeaturesExists = DicServerContext.TableExists("MmcFeatures"); + bool MmcsExists = DicServerContext.TableExists("Mmcs"); + bool MmcSdsExists = DicServerContext.TableExists("MmcSds"); + bool OperatingSystemsExists = DicServerContext.TableExists("OperatingSystems"); + bool PartitionsExists = DicServerContext.TableExists("Partitions"); + bool PcmciasExists = DicServerContext.TableExists("Pcmcias"); + bool ScsiModesExists = DicServerContext.TableExists("ScsiModes"); + bool ScsiPagesExists = DicServerContext.TableExists("ScsiPages"); + bool ScsisExists = DicServerContext.TableExists("Scsis"); + bool SscsExists = DicServerContext.TableExists("Sscs"); + bool SscSupportedMediasExists = DicServerContext.TableExists("SscSupportedMedias"); + bool SupportedDensitiesExists = DicServerContext.TableExists("SupportedDensities"); + bool TestedMediasExists = DicServerContext.TableExists("TestedMedias"); + bool TestedSequentialMediasExists = DicServerContext.TableExists("TestedSequentialMedias"); + bool UploadedReportsExists = DicServerContext.TableExists("UploadedReports"); + bool UsbProductsExists = DicServerContext.TableExists("UsbProducts"); + bool UsbsExists = DicServerContext.TableExists("Usbs"); + bool UsbVendorsExists = DicServerContext.TableExists("UsbVendors"); + bool VersionsExists = DicServerContext.TableExists("Versions"); + bool EFExists = DicServerContext.TableExists("__MigrationHistory"); #endregion #region Drop old restrictions - - if (AtasExists) + if(AtasExists) migrationBuilder.DropForeignKey("FK_Atas_TestedMedias_ReadCapabilities_Id", "Atas"); - if (BlockDescriptorsExists) + + if(BlockDescriptorsExists) migrationBuilder.DropForeignKey("FK_BlockDescriptors_ScsiModes_ScsiMode_Id", "BlockDescriptors"); - if (DensityCodesExists) - migrationBuilder.DropForeignKey( - "FK_DensityCodes_SscSupportedMedias_SscSupportedMedia_Id", "DensityCodes"); - if (DevicesExists) + + if(DensityCodesExists) + migrationBuilder.DropForeignKey("FK_DensityCodes_SscSupportedMedias_SscSupportedMedia_Id", + "DensityCodes"); + + if(DevicesExists) { - migrationBuilder.DropForeignKey( - "FK_Devices_Atas_ATA_Id", "Devices"); - migrationBuilder.DropForeignKey( - "FK_Devices_Atas_ATAPI_Id", "Devices"); - migrationBuilder.DropForeignKey( - "FK_Devices_CompactDiscOffsets_CdOffset_Id", "Devices"); - migrationBuilder.DropForeignKey( - "FK_Devices_FireWires_FireWire_Id", "Devices"); - migrationBuilder.DropForeignKey( - "FK_Devices_MmcSds_MultiMediaCard_Id", "Devices"); - migrationBuilder.DropForeignKey( - "FK_Devices_MmcSds_SecureDigital_Id", "Devices"); - migrationBuilder.DropForeignKey( - "FK_Devices_Pcmcias_PCMCIA_Id", "Devices"); - migrationBuilder.DropForeignKey( - "FK_Devices_Scsis_SCSI_Id", "Devices"); - migrationBuilder.DropForeignKey( - "FK_Devices_Usbs_USB_Id", "Devices"); + migrationBuilder.DropForeignKey("FK_Devices_Atas_ATA_Id", "Devices"); + migrationBuilder.DropForeignKey("FK_Devices_Atas_ATAPI_Id", "Devices"); + migrationBuilder.DropForeignKey("FK_Devices_CompactDiscOffsets_CdOffset_Id", "Devices"); + migrationBuilder.DropForeignKey("FK_Devices_FireWires_FireWire_Id", "Devices"); + migrationBuilder.DropForeignKey("FK_Devices_MmcSds_MultiMediaCard_Id", "Devices"); + migrationBuilder.DropForeignKey("FK_Devices_MmcSds_SecureDigital_Id", "Devices"); + migrationBuilder.DropForeignKey("FK_Devices_Pcmcias_PCMCIA_Id", "Devices"); + migrationBuilder.DropForeignKey("FK_Devices_Scsis_SCSI_Id", "Devices"); + migrationBuilder.DropForeignKey("FK_Devices_Usbs_USB_Id", "Devices"); } - if (DeviceStatsExists) - migrationBuilder.DropForeignKey( - "FK_DeviceStats_Devices_Report_Id", "DeviceStats"); - if (MmcsExists) - migrationBuilder.DropForeignKey( - "FK_Mmcs_MmcFeatures_Features_Id", "Mmcs"); - if (ScsiPagesExists) + if(DeviceStatsExists) + migrationBuilder.DropForeignKey("FK_DeviceStats_Devices_Report_Id", "DeviceStats"); + + if(MmcsExists) + migrationBuilder.DropForeignKey("FK_Mmcs_MmcFeatures_Features_Id", "Mmcs"); + + if(ScsiPagesExists) { - migrationBuilder.DropForeignKey( - "FK_ScsiPages_ScsiModes_ScsiMode_Id", "ScsiPages"); - migrationBuilder.DropForeignKey( - "FK_ScsiPages_Scsis_Scsi_Id", "ScsiPages"); + migrationBuilder.DropForeignKey("FK_ScsiPages_ScsiModes_ScsiMode_Id", "ScsiPages"); + migrationBuilder.DropForeignKey("FK_ScsiPages_Scsis_Scsi_Id", "ScsiPages"); } - if (ScsisExists) + if(ScsisExists) { - migrationBuilder.DropForeignKey( - "FK_Scsis_Mmcs_MultiMediaDevice_Id", "Scsis"); - migrationBuilder.DropForeignKey( - "FK_Scsis_ScsiModes_ModeSense_Id", "Scsis"); - migrationBuilder.DropForeignKey( - "FK_Scsis_Sscs_SequentialDevice_Id", "Scsis"); - migrationBuilder.DropForeignKey( - "FK_Scsis_TestedMedias_ReadCapabilities_Id", "Scsis"); + migrationBuilder.DropForeignKey("FK_Scsis_Mmcs_MultiMediaDevice_Id", "Scsis"); + migrationBuilder.DropForeignKey("FK_Scsis_ScsiModes_ModeSense_Id", "Scsis"); + migrationBuilder.DropForeignKey("FK_Scsis_Sscs_SequentialDevice_Id", "Scsis"); + migrationBuilder.DropForeignKey("FK_Scsis_TestedMedias_ReadCapabilities_Id", "Scsis"); } - if (SscSupportedMediasExists) + if(SscSupportedMediasExists) { - migrationBuilder.DropForeignKey( - "FK_a812ec60296b45bcb3d245a5c6d01d73", "SscSupportedMedias"); - migrationBuilder.DropForeignKey( - "FK_SscSupportedMedias_Sscs_Ssc_Id", "SscSupportedMedias"); + migrationBuilder.DropForeignKey("FK_a812ec60296b45bcb3d245a5c6d01d73", "SscSupportedMedias"); + migrationBuilder.DropForeignKey("FK_SscSupportedMedias_Sscs_Ssc_Id", "SscSupportedMedias"); } - if (SupportedDensitiesExists) + if(SupportedDensitiesExists) { - migrationBuilder.DropForeignKey( - "FK_783f1b3552774280af1caf44fb27e285", "SupportedDensities"); - migrationBuilder.DropForeignKey( - "FK_SupportedDensities_Sscs_Ssc_Id", "SupportedDensities"); + migrationBuilder.DropForeignKey("FK_783f1b3552774280af1caf44fb27e285", "SupportedDensities"); + migrationBuilder.DropForeignKey("FK_SupportedDensities_Sscs_Ssc_Id", "SupportedDensities"); } - if (TestedMediasExists) + if(TestedMediasExists) { - migrationBuilder.DropForeignKey( - "FK_TestedMedias_Atas_Ata_Id", "TestedMedias"); - migrationBuilder.DropForeignKey( - "FK_TestedMedias_Chs_CHS_Id", "TestedMedias"); - migrationBuilder.DropForeignKey( - "FK_TestedMedias_Chs_CurrentCHS_Id", "TestedMedias"); - migrationBuilder.DropForeignKey( - "FK_TestedMedias_Mmcs_Mmc_Id", "TestedMedias"); - migrationBuilder.DropForeignKey( - "FK_TestedMedias_Scsis_Scsi_Id", "TestedMedias"); + migrationBuilder.DropForeignKey("FK_TestedMedias_Atas_Ata_Id", "TestedMedias"); + migrationBuilder.DropForeignKey("FK_TestedMedias_Chs_CHS_Id", "TestedMedias"); + migrationBuilder.DropForeignKey("FK_TestedMedias_Chs_CurrentCHS_Id", "TestedMedias"); + migrationBuilder.DropForeignKey("FK_TestedMedias_Mmcs_Mmc_Id", "TestedMedias"); + migrationBuilder.DropForeignKey("FK_TestedMedias_Scsis_Scsi_Id", "TestedMedias"); } - if (TestedSequentialMediasExists) - migrationBuilder.DropForeignKey( - "FK_TestedSequentialMedias_Sscs_Ssc_Id", "TestedSequentialMedias"); - if (UploadedReportsExists) + if(TestedSequentialMediasExists) + migrationBuilder.DropForeignKey("FK_TestedSequentialMedias_Sscs_Ssc_Id", "TestedSequentialMedias"); + + if(UploadedReportsExists) { - migrationBuilder.DropForeignKey( - "FK_UploadedReports_Atas_ATA_Id", "UploadedReports"); - migrationBuilder.DropForeignKey( - "FK_UploadedReports_Atas_ATAPI_Id", "UploadedReports"); - migrationBuilder.DropForeignKey( - "FK_UploadedReports_FireWires_FireWire_Id", "UploadedReports"); - migrationBuilder.DropForeignKey( - "FK_UploadedReports_MmcSds_MultiMediaCard_Id", "UploadedReports"); - migrationBuilder.DropForeignKey( - "FK_UploadedReports_MmcSds_SecureDigital_Id", "UploadedReports"); - migrationBuilder.DropForeignKey( - "FK_UploadedReports_Pcmcias_PCMCIA_Id", "UploadedReports"); - migrationBuilder.DropForeignKey( - "FK_UploadedReports_Scsis_SCSI_Id", "UploadedReports"); - migrationBuilder.DropForeignKey( - "FK_UploadedReports_Usbs_USB_Id", "UploadedReports"); + migrationBuilder.DropForeignKey("FK_UploadedReports_Atas_ATA_Id", "UploadedReports"); + migrationBuilder.DropForeignKey("FK_UploadedReports_Atas_ATAPI_Id", "UploadedReports"); + migrationBuilder.DropForeignKey("FK_UploadedReports_FireWires_FireWire_Id", "UploadedReports"); + migrationBuilder.DropForeignKey("FK_UploadedReports_MmcSds_MultiMediaCard_Id", "UploadedReports"); + migrationBuilder.DropForeignKey("FK_UploadedReports_MmcSds_SecureDigital_Id", "UploadedReports"); + migrationBuilder.DropForeignKey("FK_UploadedReports_Pcmcias_PCMCIA_Id", "UploadedReports"); + migrationBuilder.DropForeignKey("FK_UploadedReports_Scsis_SCSI_Id", "UploadedReports"); + migrationBuilder.DropForeignKey("FK_UploadedReports_Usbs_USB_Id", "UploadedReports"); } - if (UsbProductsExists) - migrationBuilder.DropForeignKey( - "FK_UsbProducts_UsbVendors_VendorId", "UsbProducts"); - + if(UsbProductsExists) + migrationBuilder.DropForeignKey("FK_UsbProducts_UsbVendors_VendorId", "UsbProducts"); #endregion #region TABLE: CdOffsets - - migrationBuilder.CreateTable( - "CdOffsets", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Manufacturer = table.Column(nullable: true), - Model = table.Column(nullable: true), - Offset = table.Column(), - Submissions = table.Column(), - Agreement = table.Column(), - AddedWhen = table.Column(), - ModifiedWhen = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_CdOffsets", x => x.Id); }); - - if (CompactDiscOffsetsExists) + migrationBuilder.CreateTable("CdOffsets", table => new { - migrationBuilder.Sql( - "INSERT INTO CdOffsets (Id, Manufacturer, Model, Offset, Submissions, Agreement, AddedWhen, ModifiedWhen) SELECT Id, Manufacturer, Model, Offset, Submissions, Agreement, AddedWhen, ModifiedWhen FROM CompactDiscOffsets"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Manufacturer = table.Column(nullable: true), Model = table.Column(nullable: true), + Offset = table.Column(), Submissions = table.Column(), + Agreement = table.Column(), + AddedWhen = table.Column(), ModifiedWhen = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_CdOffsets", x => x.Id); + }); + + if(CompactDiscOffsetsExists) + { + migrationBuilder. + Sql("INSERT INTO CdOffsets (Id, Manufacturer, Model, Offset, Submissions, Agreement, AddedWhen, ModifiedWhen) SELECT Id, Manufacturer, Model, Offset, Submissions, Agreement, AddedWhen, ModifiedWhen FROM CompactDiscOffsets"); + migrationBuilder.DropTable("CompactDiscOffsets"); } - #endregion #region TABLE: Chs - - if (ChsExists) + if(ChsExists) migrationBuilder.RenameTable("Chs", newName: "Chs_old"); - migrationBuilder.CreateTable( - "Chs", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Cylinders = table.Column(), - Heads = table.Column(), - Sectors = table.Column(), - CylindersSql = table.Column(), - HeadsSql = table.Column(), - SectorsSql = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_Chs", x => x.Id); }); - - if (ChsExists) + migrationBuilder.CreateTable("Chs", table => new { - migrationBuilder.Sql( - "INSERT INTO Chs (Id, Cylinders, Heads, Sectors, CylindersSql, HeadsSql, SectorsSql) SELECT Id, CylindersSql AS Cylinders, HeadsSql AS Heads, SectorsSql AS Sectors, CylindersSql, HeadsSql, SectorsSql FROM Chs_old"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Cylinders = table.Column(), Heads = table.Column(), + Sectors = table.Column(), + CylindersSql = table.Column(), HeadsSql = table.Column(), + SectorsSql = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_Chs", x => x.Id); + }); + + if(ChsExists) + { + migrationBuilder. + Sql("INSERT INTO Chs (Id, Cylinders, Heads, Sectors, CylindersSql, HeadsSql, SectorsSql) SELECT Id, CylindersSql AS Cylinders, HeadsSql AS Heads, SectorsSql AS Sectors, CylindersSql, HeadsSql, SectorsSql FROM Chs_old"); + migrationBuilder.DropTable("Chs_old"); } - #endregion #region TABLE: Commands - - if (CommandsExists) + if(CommandsExists) migrationBuilder.RenameTable("Commands", newName: "Commands_old"); - migrationBuilder.CreateTable( - "Commands", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(nullable: true), - Count = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_Commands", x => x.Id); }); - - if (CommandsExists) + migrationBuilder.CreateTable("Commands", table => new { - migrationBuilder.Sql( - "INSERT INTO Commands (Id, Name, Count) SELECT Id, Name, Count FROM Commands_old"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(nullable: true), Count = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_Commands", x => x.Id); + }); + + if(CommandsExists) + { + migrationBuilder.Sql("INSERT INTO Commands (Id, Name, Count) SELECT Id, Name, Count FROM Commands_old"); migrationBuilder.DropTable("Commands_old"); } - #endregion #region TABLE: Filesystems - - if (FilesystemsExists) + if(FilesystemsExists) migrationBuilder.RenameTable("Filesystems", newName: "Filesystems_old"); - migrationBuilder.CreateTable( - "Filesystems", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(nullable: true), - Count = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_Filesystems", x => x.Id); }); - - if (FilesystemsExists) + migrationBuilder.CreateTable("Filesystems", table => new { - migrationBuilder.Sql( - "INSERT INTO Filesystems (Id, Name, Count) SELECT Id, Name, Count FROM Filesystems_old"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(nullable: true), Count = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_Filesystems", x => x.Id); + }); + + if(FilesystemsExists) + { + migrationBuilder. + Sql("INSERT INTO Filesystems (Id, Name, Count) SELECT Id, Name, Count FROM Filesystems_old"); + migrationBuilder.DropTable("Filesystems_old"); } - #endregion #region TABLE: Filters - - if (FiltersExists) + if(FiltersExists) migrationBuilder.RenameTable("Filters", newName: "Filters_old"); - migrationBuilder.CreateTable( - "Filters", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(nullable: true), - Count = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_Filters", x => x.Id); }); - - if (FiltersExists) + migrationBuilder.CreateTable("Filters", table => new { - migrationBuilder.Sql( - "INSERT INTO Filters (Id, Name, Count) SELECT Id, Name, Count FROM Filters_old"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(nullable: true), Count = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_Filters", x => x.Id); + }); + + if(FiltersExists) + { + migrationBuilder.Sql("INSERT INTO Filters (Id, Name, Count) SELECT Id, Name, Count FROM Filters_old"); migrationBuilder.DropTable("Filters_old"); } - #endregion #region TABLE: FireWire - - migrationBuilder.CreateTable( - "FireWire", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - VendorID = table.Column(), - ProductID = table.Column(), - Manufacturer = table.Column(nullable: true), - Product = table.Column(nullable: true), - RemovableMedia = table.Column(), - VendorIDSql = table.Column(), - ProductIDSql = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_FireWire", x => x.Id); }); - - if (FireWiresExists) + migrationBuilder.CreateTable("FireWire", table => new { - migrationBuilder.Sql( - "INSERT INTO FireWire (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, VendorIDSql, ProductIDSql) SELECT Id, VendorIDSql AS VendorID, ProductIDSql AS ProductID, Manufacturer, Product, RemovableMedia, VendorIDSql, ProductIDSql FROM FireWires"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + VendorID = table.Column(), ProductID = table.Column(), + Manufacturer = table.Column(nullable: true), Product = table.Column(nullable: true), + RemovableMedia = table.Column(), VendorIDSql = table.Column(), + ProductIDSql = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_FireWire", x => x.Id); + }); + + if(FireWiresExists) + { + migrationBuilder. + Sql("INSERT INTO FireWire (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, VendorIDSql, ProductIDSql) SELECT Id, VendorIDSql AS VendorID, ProductIDSql AS ProductID, Manufacturer, Product, RemovableMedia, VendorIDSql, ProductIDSql FROM FireWires"); + migrationBuilder.DropTable("FireWires"); } - #endregion #region TABLE: MediaFormats - - if (MediaFormatsExists) + if(MediaFormatsExists) migrationBuilder.RenameTable("MediaFormats", newName: "MediaFormats_old"); - migrationBuilder.CreateTable( - "MediaFormats", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(nullable: true), - Count = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_MediaFormats", x => x.Id); }); - - if (MediaFormatsExists) + migrationBuilder.CreateTable("MediaFormats", table => new { - migrationBuilder.Sql( - "INSERT INTO MediaFormats (Id, Name, Count) SELECT Id, Name, Count FROM MediaFormats_old"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(nullable: true), Count = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_MediaFormats", x => x.Id); + }); + + if(MediaFormatsExists) + { + migrationBuilder. + Sql("INSERT INTO MediaFormats (Id, Name, Count) SELECT Id, Name, Count FROM MediaFormats_old"); + migrationBuilder.DropTable("MediaFormats_old"); } - #endregion #region TABLE: Medias - - migrationBuilder.CreateTable( - "Medias", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Type = table.Column(nullable: true), - Real = table.Column(), - Count = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_Medias", x => x.Id); }); - - if (MediaExists) + migrationBuilder.CreateTable("Medias", table => new { - migrationBuilder.Sql( - "INSERT INTO Medias (`Id`, `Type`, `Real`, `Count`) SELECT `Id`, `Type`, `Real`, `Count` FROM Media"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Type = table.Column(nullable: true), Real = table.Column(), Count = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_Medias", x => x.Id); + }); + + if(MediaExists) + { + migrationBuilder. + Sql("INSERT INTO Medias (`Id`, `Type`, `Real`, `Count`) SELECT `Id`, `Type`, `Real`, `Count` FROM Media"); + migrationBuilder.DropTable("Media"); } - #endregion #region TABLE: MmcFeatures - - if (MmcFeaturesExists) + if(MmcFeaturesExists) migrationBuilder.RenameTable("MmcFeatures", newName: "MmcFeatures_old"); - migrationBuilder.CreateTable( - "MmcFeatures", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - AACSVersion = table.Column(nullable: true), - AGIDs = table.Column(nullable: true), - BindingNonceBlocks = table.Column(nullable: true), - BlocksPerReadableUnit = table.Column(nullable: true), - BufferUnderrunFreeInDVD = table.Column(), - BufferUnderrunFreeInSAO = table.Column(), - BufferUnderrunFreeInTAO = table.Column(), - CanAudioScan = table.Column(), - CanEject = table.Column(), - CanEraseSector = table.Column(), - CanExpandBDRESpareArea = table.Column(), - CanFormat = table.Column(), - CanFormatBDREWithoutSpare = table.Column(), - CanFormatCert = table.Column(), - CanFormatFRF = table.Column(), - CanFormatQCert = table.Column(), - CanFormatRRM = table.Column(), - CanGenerateBindingNonce = table.Column(), - CanLoad = table.Column(), - CanMuteSeparateChannels = table.Column(), - CanOverwriteSAOTrack = table.Column(), - CanOverwriteTAOTrack = table.Column(), - CanPlayCDAudio = table.Column(), - CanPseudoOverwriteBDR = table.Column(), - CanReadAllDualR = table.Column(), - CanReadAllDualRW = table.Column(), - CanReadBD = table.Column(), - CanReadBDR = table.Column(), - CanReadBDRE1 = table.Column(), - CanReadBDRE2 = table.Column(), - CanReadBDROM = table.Column(), - CanReadBluBCA = table.Column(), - CanReadCD = table.Column(), - CanReadCDMRW = table.Column(), - CanReadCPRM_MKB = table.Column(), - CanReadDDCD = table.Column(), - CanReadDVD = table.Column(), - CanReadDVDPlusMRW = table.Column(), - CanReadDVDPlusR = table.Column(), - CanReadDVDPlusRDL = table.Column(), - CanReadDVDPlusRW = table.Column(), - CanReadDVDPlusRWDL = table.Column(), - CanReadDriveAACSCertificate = table.Column(), - CanReadHDDVD = table.Column(), - CanReadHDDVDR = table.Column(), - CanReadHDDVDRAM = table.Column(), - CanReadLeadInCDText = table.Column(), - CanReadOldBDR = table.Column(), - CanReadOldBDRE = table.Column(), - CanReadOldBDROM = table.Column(), - CanReadSpareAreaInformation = table.Column(), - CanReportDriveSerial = table.Column(), - CanReportMediaSerial = table.Column(), - CanTestWriteDDCDR = table.Column(), - CanTestWriteDVD = table.Column(), - CanTestWriteInSAO = table.Column(), - CanTestWriteInTAO = table.Column(), - CanUpgradeFirmware = table.Column(), - CanWriteBD = table.Column(), - CanWriteBDR = table.Column(), - CanWriteBDRE1 = table.Column(), - CanWriteBDRE2 = table.Column(), - CanWriteBusEncryptedBlocks = table.Column(), - CanWriteCDMRW = table.Column(), - CanWriteCDRW = table.Column(), - CanWriteCDRWCAV = table.Column(), - CanWriteCDSAO = table.Column(), - CanWriteCDTAO = table.Column(), - CanWriteCSSManagedDVD = table.Column(), - CanWriteDDCDR = table.Column(), - CanWriteDDCDRW = table.Column(), - CanWriteDVDPlusMRW = table.Column(), - CanWriteDVDPlusR = table.Column(), - CanWriteDVDPlusRDL = table.Column(), - CanWriteDVDPlusRW = table.Column(), - CanWriteDVDPlusRWDL = table.Column(), - CanWriteDVDR = table.Column(), - CanWriteDVDRDL = table.Column(), - CanWriteDVDRW = table.Column(), - CanWriteHDDVDR = table.Column(), - CanWriteHDDVDRAM = table.Column(), - CanWriteOldBDR = table.Column(), - CanWriteOldBDRE = table.Column(), - CanWritePackedSubchannelInTAO = table.Column(), - CanWriteRWSubchannelInSAO = table.Column(), - CanWriteRWSubchannelInTAO = table.Column(), - CanWriteRaw = table.Column(), - CanWriteRawMultiSession = table.Column(), - CanWriteRawSubchannelInTAO = table.Column(), - ChangerIsSideChangeCapable = table.Column(), - ChangerSlots = table.Column(), - ChangerSupportsDiscPresent = table.Column(), - CPRMVersion = table.Column(nullable: true), - CSSVersion = table.Column(nullable: true), - DBML = table.Column(), - DVDMultiRead = table.Column(), - EmbeddedChanger = table.Column(), - ErrorRecoveryPage = table.Column(), - FirmwareDate = table.Column(nullable: true), - LoadingMechanismType = table.Column(nullable: true), - Locked = table.Column(), - LogicalBlockSize = table.Column(nullable: true), - MultiRead = table.Column(), - PhysicalInterfaceStandardNumber = table.Column(nullable: true), - PreventJumper = table.Column(), - SupportsAACS = table.Column(), - SupportsBusEncryption = table.Column(), - SupportsC2 = table.Column(), - SupportsCPRM = table.Column(), - SupportsCSS = table.Column(), - SupportsDAP = table.Column(), - SupportsDeviceBusyEvent = table.Column(), - SupportsHybridDiscs = table.Column(), - SupportsModePage1Ch = table.Column(), - SupportsOSSC = table.Column(), - SupportsPWP = table.Column(), - SupportsSWPP = table.Column(), - SupportsSecurDisc = table.Column(), - SupportsSeparateVolume = table.Column(), - SupportsVCPS = table.Column(), - SupportsWriteInhibitDCB = table.Column(), - SupportsWriteProtectPAC = table.Column(), - VolumeLevels = table.Column(nullable: true), - BinaryData = table.Column(nullable: true), - BlocksPerReadableUnitSql = table.Column(nullable: true), - LogicalBlockSizeSql = table.Column(nullable: true), - PhysicalInterfaceStandardNumberSql = table.Column(nullable: true), - VolumeLevelsSql = table.Column(nullable: true) - }, - constraints: table => { table.PrimaryKey("PK_MmcFeatures", x => x.Id); }); + migrationBuilder.CreateTable("MmcFeatures", table => new + { + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + AACSVersion = table.Column(nullable: true), + AGIDs = table.Column(nullable: true), + BindingNonceBlocks = table.Column(nullable: true), + BlocksPerReadableUnit = table.Column(nullable: true), + BufferUnderrunFreeInDVD = table.Column(), + BufferUnderrunFreeInSAO = table.Column(), + BufferUnderrunFreeInTAO = table.Column(), + CanAudioScan = table.Column(), + CanEject = table.Column(), + CanEraseSector = table.Column(), + CanExpandBDRESpareArea = table.Column(), + CanFormat = table.Column(), + CanFormatBDREWithoutSpare = table.Column(), + CanFormatCert = table.Column(), + CanFormatFRF = table.Column(), + CanFormatQCert = table.Column(), + CanFormatRRM = table.Column(), + CanGenerateBindingNonce = table.Column(), + CanLoad = table.Column(), + CanMuteSeparateChannels = table.Column(), + CanOverwriteSAOTrack = table.Column(), + CanOverwriteTAOTrack = table.Column(), + CanPlayCDAudio = table.Column(), + CanPseudoOverwriteBDR = table.Column(), + CanReadAllDualR = table.Column(), + CanReadAllDualRW = table.Column(), + CanReadBD = table.Column(), + CanReadBDR = table.Column(), + CanReadBDRE1 = table.Column(), + CanReadBDRE2 = table.Column(), + CanReadBDROM = table.Column(), + CanReadBluBCA = table.Column(), + CanReadCD = table.Column(), + CanReadCDMRW = table.Column(), + CanReadCPRM_MKB = table.Column(), + CanReadDDCD = table.Column(), + CanReadDVD = table.Column(), + CanReadDVDPlusMRW = table.Column(), + CanReadDVDPlusR = table.Column(), + CanReadDVDPlusRDL = table.Column(), + CanReadDVDPlusRW = table.Column(), + CanReadDVDPlusRWDL = table.Column(), + CanReadDriveAACSCertificate = table.Column(), + CanReadHDDVD = table.Column(), + CanReadHDDVDR = table.Column(), + CanReadHDDVDRAM = table.Column(), + CanReadLeadInCDText = table.Column(), + CanReadOldBDR = table.Column(), + CanReadOldBDRE = table.Column(), + CanReadOldBDROM = table.Column(), + CanReadSpareAreaInformation = table.Column(), + CanReportDriveSerial = table.Column(), + CanReportMediaSerial = table.Column(), + CanTestWriteDDCDR = table.Column(), + CanTestWriteDVD = table.Column(), + CanTestWriteInSAO = table.Column(), + CanTestWriteInTAO = table.Column(), + CanUpgradeFirmware = table.Column(), + CanWriteBD = table.Column(), + CanWriteBDR = table.Column(), + CanWriteBDRE1 = table.Column(), + CanWriteBDRE2 = table.Column(), + CanWriteBusEncryptedBlocks = table.Column(), + CanWriteCDMRW = table.Column(), + CanWriteCDRW = table.Column(), + CanWriteCDRWCAV = table.Column(), + CanWriteCDSAO = table.Column(), + CanWriteCDTAO = table.Column(), + CanWriteCSSManagedDVD = table.Column(), + CanWriteDDCDR = table.Column(), + CanWriteDDCDRW = table.Column(), + CanWriteDVDPlusMRW = table.Column(), + CanWriteDVDPlusR = table.Column(), + CanWriteDVDPlusRDL = table.Column(), + CanWriteDVDPlusRW = table.Column(), + CanWriteDVDPlusRWDL = table.Column(), + CanWriteDVDR = table.Column(), + CanWriteDVDRDL = table.Column(), + CanWriteDVDRW = table.Column(), + CanWriteHDDVDR = table.Column(), + CanWriteHDDVDRAM = table.Column(), + CanWriteOldBDR = table.Column(), + CanWriteOldBDRE = table.Column(), + CanWritePackedSubchannelInTAO = table.Column(), + CanWriteRWSubchannelInSAO = table.Column(), + CanWriteRWSubchannelInTAO = table.Column(), + CanWriteRaw = table.Column(), + CanWriteRawMultiSession = table.Column(), + CanWriteRawSubchannelInTAO = table.Column(), + ChangerIsSideChangeCapable = table.Column(), + ChangerSlots = table.Column(), + ChangerSupportsDiscPresent = table.Column(), + CPRMVersion = table.Column(nullable: true), + CSSVersion = table.Column(nullable: true), + DBML = table.Column(), + DVDMultiRead = table.Column(), + EmbeddedChanger = table.Column(), + ErrorRecoveryPage = table.Column(), + FirmwareDate = table.Column(nullable: true), + LoadingMechanismType = table.Column(nullable: true), + Locked = table.Column(), + LogicalBlockSize = table.Column(nullable: true), + MultiRead = table.Column(), + PhysicalInterfaceStandardNumber = table.Column(nullable: true), + PreventJumper = table.Column(), + SupportsAACS = table.Column(), + SupportsBusEncryption = table.Column(), + SupportsC2 = table.Column(), + SupportsCPRM = table.Column(), + SupportsCSS = table.Column(), + SupportsDAP = table.Column(), + SupportsDeviceBusyEvent = table.Column(), + SupportsHybridDiscs = table.Column(), + SupportsModePage1Ch = table.Column(), + SupportsOSSC = table.Column(), + SupportsPWP = table.Column(), + SupportsSWPP = table.Column(), + SupportsSecurDisc = table.Column(), + SupportsSeparateVolume = table.Column(), + SupportsVCPS = table.Column(), + SupportsWriteInhibitDCB = table.Column(), + SupportsWriteProtectPAC = table.Column(), + VolumeLevels = table.Column(nullable: true), + BinaryData = table.Column(nullable: true), + BlocksPerReadableUnitSql = table.Column(nullable: true), + LogicalBlockSizeSql = table.Column(nullable: true), + PhysicalInterfaceStandardNumberSql = table.Column(nullable: true), + VolumeLevelsSql = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_MmcFeatures", x => x.Id); + }); - if (MmcFeaturesExists) + if(MmcFeaturesExists) { migrationBuilder.Sql(@"INSERT INTO MmcFeatures (AACSVersion, AGIDs, @@ -768,6 +707,7 @@ BlocksPerReadableUnitSql, LogicalBlockSizeSql, PhysicalInterfaceStandardNumberSql, VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql >= 0 OR VolumeLevelsSql IS NULL"); + migrationBuilder.Sql(@"INSERT INTO MmcFeatures (AACSVersion, AGIDs, BindingNonceBlocks, @@ -1023,905 +963,749 @@ BlocksPerReadableUnitSql, LogicalBlockSizeSql, PhysicalInterfaceStandardNumberSql, VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0"); + migrationBuilder.DropTable("MmcFeatures_old"); } - #endregion #region TABLE: MmcSd - - migrationBuilder.CreateTable( - "MmcSd", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CID = table.Column(nullable: true), - CSD = table.Column(nullable: true), - OCR = table.Column(nullable: true), - SCR = table.Column(nullable: true), - ExtendedCSD = table.Column(nullable: true) - }, - constraints: table => { table.PrimaryKey("PK_MmcSd", x => x.Id); }); - - if (MmcSdsExists) + migrationBuilder.CreateTable("MmcSd", table => new { - migrationBuilder.Sql( - "INSERT INTO MmcSd (Id, CID, CSD, OCR, SCR, ExtendedCSD) SELECT Id, CID, CSD, OCR, SCR, ExtendedCSD FROM MmcSds"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CID = table.Column(nullable: true), CSD = table.Column(nullable: true), + OCR = table.Column(nullable: true), SCR = table.Column(nullable: true), + ExtendedCSD = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_MmcSd", x => x.Id); + }); + + if(MmcSdsExists) + { + migrationBuilder. + Sql("INSERT INTO MmcSd (Id, CID, CSD, OCR, SCR, ExtendedCSD) SELECT Id, CID, CSD, OCR, SCR, ExtendedCSD FROM MmcSds"); + migrationBuilder.DropTable("MmcSds"); } - #endregion #region TABLE: OperatingSystems - - if (OperatingSystemsExists) + if(OperatingSystemsExists) migrationBuilder.RenameTable("OperatingSystems", newName: "OperatingSystems_old"); - migrationBuilder.CreateTable( - "OperatingSystems", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(nullable: true), - Version = table.Column(nullable: true), - Count = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_OperatingSystems", x => x.Id); }); - - if (OperatingSystemsExists) + migrationBuilder.CreateTable("OperatingSystems", table => new { - migrationBuilder.Sql( - "INSERT INTO OperatingSystems (Id, Name, Version, Count) SELECT Id, Name, Version, Count FROM OperatingSystems_old"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(nullable: true), Version = table.Column(nullable: true), + Count = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_OperatingSystems", x => x.Id); + }); + + if(OperatingSystemsExists) + { + migrationBuilder. + Sql("INSERT INTO OperatingSystems (Id, Name, Version, Count) SELECT Id, Name, Version, Count FROM OperatingSystems_old"); + migrationBuilder.DropTable("OperatingSystems_old"); } - #endregion #region TABLE: Partitions - - if (PartitionsExists) + if(PartitionsExists) migrationBuilder.RenameTable("Partitions", newName: "Partitions_old"); - migrationBuilder.CreateTable( - "Partitions", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(nullable: true), - Count = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_Partitions", x => x.Id); }); - - if (PartitionsExists) + migrationBuilder.CreateTable("Partitions", table => new { - migrationBuilder.Sql( - "INSERT INTO Partitions (Id, Name, Count) SELECT Id, Name, Count FROM Partitions_old"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(nullable: true), Count = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_Partitions", x => x.Id); + }); + + if(PartitionsExists) + { + migrationBuilder. + Sql("INSERT INTO Partitions (Id, Name, Count) SELECT Id, Name, Count FROM Partitions_old"); + migrationBuilder.DropTable("Partitions_old"); } - #endregion #region TABLE: Pcmcia - - migrationBuilder.CreateTable( - "Pcmcia", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CIS = table.Column(nullable: true), - Compliance = table.Column(nullable: true), - ManufacturerCode = table.Column(nullable: true), - CardCode = table.Column(nullable: true), - Manufacturer = table.Column(nullable: true), - ProductName = table.Column(nullable: true), - ManufacturerCodeSql = table.Column(nullable: true), - CardCodeSql = table.Column(nullable: true) - }, - constraints: table => { table.PrimaryKey("PK_Pcmcia", x => x.Id); }); - - if (PcmciasExists) + migrationBuilder.CreateTable("Pcmcia", table => new { - migrationBuilder.Sql( - "INSERT INTO Pcmcia (Id, CIS, Compliance, ManufacturerCode, CardCode, Manufacturer, ProductName, ManufacturerCodeSql, CardCodeSql) SELECT Id, CIS, Compliance, ManufacturerCodeSql AS ManufacturerCode, CardCodeSql AS CardCode, Manufacturer, ProductName, ManufacturerCodeSql, CardCodeSql FROM Pcmcias"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CIS = table.Column(nullable: true), + Compliance = table.Column(nullable: true), + ManufacturerCode = table.Column(nullable: true), + CardCode = table.Column(nullable: true), + Manufacturer = table.Column(nullable: true), + ProductName = table.Column(nullable: true), + ManufacturerCodeSql = table.Column(nullable: true), + CardCodeSql = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_Pcmcia", x => x.Id); + }); + + if(PcmciasExists) + { + migrationBuilder. + Sql("INSERT INTO Pcmcia (Id, CIS, Compliance, ManufacturerCode, CardCode, Manufacturer, ProductName, ManufacturerCodeSql, CardCodeSql) SELECT Id, CIS, Compliance, ManufacturerCodeSql AS ManufacturerCode, CardCodeSql AS CardCode, Manufacturer, ProductName, ManufacturerCodeSql, CardCodeSql FROM Pcmcias"); + migrationBuilder.DropTable("Pcmcias"); } - #endregion #region TABLE: ScsiMode - - migrationBuilder.CreateTable( - "ScsiMode", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - MediumType = table.Column(nullable: true), - WriteProtected = table.Column(), - Speed = table.Column(nullable: true), - BufferedMode = table.Column(nullable: true), - BlankCheckEnabled = table.Column(), - DPOandFUA = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_ScsiMode", x => x.Id); }); - - if (ScsiModesExists) + migrationBuilder.CreateTable("ScsiMode", table => new { - migrationBuilder.Sql( - "INSERT INTO ScsiMode (Id, MediumType, WriteProtected, Speed, BufferedMode, BlankCheckEnabled, DPOandFUA) SELECT Id, MediumType, WriteProtected, Speed, BufferedMode, BlankCheckEnabled, DPOandFUA FROM ScsiModes"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + MediumType = table.Column(nullable: true), WriteProtected = table.Column(), + Speed = table.Column(nullable: true), + BufferedMode = table.Column(nullable: true), + BlankCheckEnabled = table.Column(), DPOandFUA = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_ScsiMode", x => x.Id); + }); + + if(ScsiModesExists) + { + migrationBuilder. + Sql("INSERT INTO ScsiMode (Id, MediumType, WriteProtected, Speed, BufferedMode, BlankCheckEnabled, DPOandFUA) SELECT Id, MediumType, WriteProtected, Speed, BufferedMode, BlankCheckEnabled, DPOandFUA FROM ScsiModes"); + migrationBuilder.DropTable("ScsiModes"); } - #endregion #region TABLE: Ssc - - migrationBuilder.CreateTable( - "Ssc", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - BlockSizeGranularity = table.Column(nullable: true), - MaxBlockLength = table.Column(nullable: true), - MinBlockLength = table.Column(nullable: true), - MaxBlockLengthSql = table.Column(nullable: true), - MinBlockLengthSql = table.Column(nullable: true) - }, - constraints: table => { table.PrimaryKey("PK_Ssc", x => x.Id); }); - - if (SscsExists) + migrationBuilder.CreateTable("Ssc", table => new { - migrationBuilder.Sql( - "INSERT INTO Ssc (Id, BlockSizeGranularity, MaxBlockLength, MinBlockLength, MaxBlockLengthSql, MinBlockLengthSql) SELECT Id, BlockSizeGranularity, MaxBlockLengthSql AS MaxBlockLength, MinBlockLengthSql AS MinBlockLength, MaxBlockLengthSql, MinBlockLengthSql FROM Sscs"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + BlockSizeGranularity = table.Column(nullable: true), + MaxBlockLength = table.Column(nullable: true), + MinBlockLength = table.Column(nullable: true), + MaxBlockLengthSql = table.Column(nullable: true), + MinBlockLengthSql = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_Ssc", x => x.Id); + }); + + if(SscsExists) + { + migrationBuilder. + Sql("INSERT INTO Ssc (Id, BlockSizeGranularity, MaxBlockLength, MinBlockLength, MaxBlockLengthSql, MinBlockLengthSql) SELECT Id, BlockSizeGranularity, MaxBlockLengthSql AS MaxBlockLength, MinBlockLengthSql AS MinBlockLength, MaxBlockLengthSql, MinBlockLengthSql FROM Sscs"); + migrationBuilder.DropTable("Sscs"); } - #endregion #region TABLE: Usb - - migrationBuilder.CreateTable( - "Usb", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - VendorID = table.Column(), - ProductID = table.Column(), - Manufacturer = table.Column(nullable: true), - Product = table.Column(nullable: true), - RemovableMedia = table.Column(), - Descriptors = table.Column(nullable: true), - VendorIDSql = table.Column(), - ProductIDSql = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_Usb", x => x.Id); }); - - if (UsbsExists) + migrationBuilder.CreateTable("Usb", table => new { - migrationBuilder.Sql( - "INSERT INTO Usb (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql) SELECT Id, VendorIDSql AS VendorID, ProductIDSql AS ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql FROM Usbs WHERE VendorIDSql >= 0 AND ProductIDSql >= 0"); - migrationBuilder.Sql( - "INSERT INTO Usb (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql) SELECT Id, (65536+VendorIDSql) AS VendorID, ProductIDSql AS ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql FROM Usbs WHERE VendorIDSql < 0 AND ProductIDSql >= 0"); - migrationBuilder.Sql( - "INSERT INTO Usb (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql) SELECT Id, VendorIDSql AS VendorID, (65536+ProductIDSql) AS ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql FROM Usbs WHERE VendorIDSql >= 0 AND ProductIDSql < 0"); - migrationBuilder.Sql( - "INSERT INTO Usb (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql) SELECT Id, (65536+VendorIDSql) AS VendorID, (65536+ProductIDSql) AS ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql FROM Usbs WHERE VendorIDSql < 0 AND ProductIDSql < 0"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + VendorID = table.Column(), ProductID = table.Column(), + Manufacturer = table.Column(nullable: true), Product = table.Column(nullable: true), + RemovableMedia = table.Column(), Descriptors = table.Column(nullable: true), + VendorIDSql = table.Column(), ProductIDSql = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_Usb", x => x.Id); + }); + + if(UsbsExists) + { + migrationBuilder. + Sql("INSERT INTO Usb (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql) SELECT Id, VendorIDSql AS VendorID, ProductIDSql AS ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql FROM Usbs WHERE VendorIDSql >= 0 AND ProductIDSql >= 0"); + + migrationBuilder. + Sql("INSERT INTO Usb (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql) SELECT Id, (65536+VendorIDSql) AS VendorID, ProductIDSql AS ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql FROM Usbs WHERE VendorIDSql < 0 AND ProductIDSql >= 0"); + + migrationBuilder. + Sql("INSERT INTO Usb (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql) SELECT Id, VendorIDSql AS VendorID, (65536+ProductIDSql) AS ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql FROM Usbs WHERE VendorIDSql >= 0 AND ProductIDSql < 0"); + + migrationBuilder. + Sql("INSERT INTO Usb (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql) SELECT Id, (65536+VendorIDSql) AS VendorID, (65536+ProductIDSql) AS ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql FROM Usbs WHERE VendorIDSql < 0 AND ProductIDSql < 0"); + migrationBuilder.DropTable("Usbs"); } - #endregion #region TABLE: UsbVendors - - if (UsbVendorsExists) + if(UsbVendorsExists) migrationBuilder.RenameTable("UsbVendors", newName: "UsbVendors_old"); - migrationBuilder.CreateTable( - "UsbVendors", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - VendorId = table.Column(), - Vendor = table.Column(nullable: true), - AddedWhen = table.Column(), - ModifiedWhen = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_UsbVendors", x => x.Id); }); - - if (UsbVendorsExists) + migrationBuilder.CreateTable("UsbVendors", table => new { - migrationBuilder.Sql( - "INSERT INTO UsbVendors (Id, VendorId, Vendor, AddedWhen, ModifiedWhen) SELECT Id, VendorId, Vendor, AddedWhen, ModifiedWhen FROM UsbVendors_old"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + VendorId = table.Column(), Vendor = table.Column(nullable: true), + AddedWhen = table.Column(), ModifiedWhen = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_UsbVendors", x => x.Id); + }); + + if(UsbVendorsExists) + { + migrationBuilder. + Sql("INSERT INTO UsbVendors (Id, VendorId, Vendor, AddedWhen, ModifiedWhen) SELECT Id, VendorId, Vendor, AddedWhen, ModifiedWhen FROM UsbVendors_old"); + migrationBuilder.DropTable("UsbVendors_old"); } - #endregion #region TABLE: Versions - - if (VersionsExists) + if(VersionsExists) migrationBuilder.RenameTable("Versions", newName: "Versions_old"); - migrationBuilder.CreateTable( - "Versions", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Value = table.Column(nullable: true), - Count = table.Column() - }, - constraints: table => { table.PrimaryKey("PK_Versions", x => x.Id); }); - - if (VersionsExists) + migrationBuilder.CreateTable("Versions", table => new { - migrationBuilder.Sql( - "INSERT INTO Versions (`Id`, `Value`, `Count`) SELECT `Id`, `Value`, `Count` FROM Versions_old"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Value = table.Column(nullable: true), Count = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_Versions", x => x.Id); + }); + + if(VersionsExists) + { + migrationBuilder. + Sql("INSERT INTO Versions (`Id`, `Value`, `Count`) SELECT `Id`, `Value`, `Count` FROM Versions_old"); + migrationBuilder.DropTable("Versions_old"); } - #endregion #region TABLE: Mmc - - migrationBuilder.CreateTable( - "Mmc", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - FeaturesId = table.Column(nullable: true), - ModeSense2AData = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Mmc", x => x.Id); - table.ForeignKey( - "FK_Mmc_MmcFeatures_FeaturesId", - x => x.FeaturesId, - "MmcFeatures", - "Id", - onDelete: ReferentialAction.Restrict); - }); - - if (MmcsExists) + migrationBuilder.CreateTable("Mmc", table => new { - migrationBuilder.Sql( - "INSERT INTO Mmc (Id, FeaturesId, ModeSense2AData) SELECT Id, Features_Id, ModeSense2AData FROM Mmcs WHERE EXISTS(SELECT 1 FROM MmcFeatures WHERE MmcFeatures.Id = Features_Id) OR Features_Id IS NULL"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + FeaturesId = table.Column(nullable: true), ModeSense2AData = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_Mmc", x => x.Id); + + table.ForeignKey("FK_Mmc_MmcFeatures_FeaturesId", x => x.FeaturesId, "MmcFeatures", "Id", + onDelete: ReferentialAction.Restrict); + }); + + if(MmcsExists) + { + migrationBuilder. + Sql("INSERT INTO Mmc (Id, FeaturesId, ModeSense2AData) SELECT Id, Features_Id, ModeSense2AData FROM Mmcs WHERE EXISTS(SELECT 1 FROM MmcFeatures WHERE MmcFeatures.Id = Features_Id) OR Features_Id IS NULL"); + migrationBuilder.DropTable("Mmcs"); } - #endregion #region TABLE: BlockDescriptor - - migrationBuilder.CreateTable( - "BlockDescriptor", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Density = table.Column(), - Blocks = table.Column(nullable: true), - BlockLength = table.Column(nullable: true), - BlocksSql = table.Column(nullable: true), - BlockLengthSql = table.Column(nullable: true), - ScsiModeId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_BlockDescriptor", x => x.Id); - table.ForeignKey( - "FK_BlockDescriptor_ScsiMode_ScsiModeId", - x => x.ScsiModeId, - "ScsiMode", - "Id", - onDelete: ReferentialAction.Restrict); - }); - - if (BlockDescriptorsExists) + migrationBuilder.CreateTable("BlockDescriptor", table => new { - migrationBuilder.Sql( - "INSERT INTO BlockDescriptor (Id, Density, Blocks, BlocksSql, BlockLength, BlockLengthSql, ScsiModeId) SELECT Id, Density, BlocksSql AS Blocks, BlocksSql, BlockLengthSql AS BlockLength, BlockLengthSql, ScsiMode_Id FROM BlockDescriptors"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Density = table.Column(), Blocks = table.Column(nullable: true), + BlockLength = table.Column(nullable: true), BlocksSql = table.Column(nullable: true), + BlockLengthSql = table.Column(nullable: true), ScsiModeId = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_BlockDescriptor", x => x.Id); + + table.ForeignKey("FK_BlockDescriptor_ScsiMode_ScsiModeId", x => x.ScsiModeId, "ScsiMode", "Id", + onDelete: ReferentialAction.Restrict); + }); + + if(BlockDescriptorsExists) + { + migrationBuilder. + Sql("INSERT INTO BlockDescriptor (Id, Density, Blocks, BlocksSql, BlockLength, BlockLengthSql, ScsiModeId) SELECT Id, Density, BlocksSql AS Blocks, BlocksSql, BlockLengthSql AS BlockLength, BlockLengthSql, ScsiMode_Id FROM BlockDescriptors"); + migrationBuilder.DropTable("BlockDescriptors"); } - #endregion #region TABLE: TestedSequentialMedia - - migrationBuilder.CreateTable( - "TestedSequentialMedia", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CanReadMediaSerial = table.Column(nullable: true), - Density = table.Column(nullable: true), - Manufacturer = table.Column(nullable: true), - MediaIsRecognized = table.Column(), - MediumType = table.Column(nullable: true), - MediumTypeName = table.Column(nullable: true), - Model = table.Column(nullable: true), - ModeSense6Data = table.Column(nullable: true), - ModeSense10Data = table.Column(nullable: true), - SscId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_TestedSequentialMedia", x => x.Id); - table.ForeignKey( - "FK_TestedSequentialMedia_Ssc_SscId", - x => x.SscId, - "Ssc", - "Id", - onDelete: ReferentialAction.Restrict); - }); - - if (TestedSequentialMediasExists) + migrationBuilder.CreateTable("TestedSequentialMedia", table => new { - migrationBuilder.Sql( - "INSERT INTO TestedSequentialMedia (Id, CanReadMediaSerial, Density, Manufacturer, MediaIsRecognized, MediumType, MediumTypeName, Model, ModeSense6Data, ModeSense10Data, SscId) SELECT Id, CanReadMediaSerial, Density, Manufacturer, MediaIsRecognized, MediumType, MediumTypeName, Model, ModeSense6Data, ModeSense10Data, Ssc_Id FROM TestedSequentialMedias"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CanReadMediaSerial = table.Column(nullable: true), + Density = table.Column(nullable: true), + Manufacturer = table.Column(nullable: true), MediaIsRecognized = table.Column(), + MediumType = table.Column(nullable: true), + MediumTypeName = table.Column(nullable: true), + Model = table.Column(nullable: true), + ModeSense6Data = table.Column(nullable: true), + ModeSense10Data = table.Column(nullable: true), + SscId = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_TestedSequentialMedia", x => x.Id); + + table.ForeignKey("FK_TestedSequentialMedia_Ssc_SscId", x => x.SscId, "Ssc", "Id", + onDelete: ReferentialAction.Restrict); + }); + + if(TestedSequentialMediasExists) + { + migrationBuilder. + Sql("INSERT INTO TestedSequentialMedia (Id, CanReadMediaSerial, Density, Manufacturer, MediaIsRecognized, MediumType, MediumTypeName, Model, ModeSense6Data, ModeSense10Data, SscId) SELECT Id, CanReadMediaSerial, Density, Manufacturer, MediaIsRecognized, MediumType, MediumTypeName, Model, ModeSense6Data, ModeSense10Data, Ssc_Id FROM TestedSequentialMedias"); + migrationBuilder.DropTable("TestedSequentialMedias"); } - #endregion #region TABLE: UsbProducts + if(UsbProductsExists) + migrationBuilder.RenameTable("UsbProducts", newName: "UsbProducts_old"); - if (UsbProductsExists) migrationBuilder.RenameTable("UsbProducts", newName: "UsbProducts_old"); - - migrationBuilder.CreateTable( - "UsbProducts", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - ProductId = table.Column(), - Product = table.Column(nullable: true), - AddedWhen = table.Column(), - ModifiedWhen = table.Column(), - VendorId = table.Column() - }, - constraints: table => - { - table.PrimaryKey("PK_UsbProducts", x => x.Id); - table.ForeignKey( - "FK_UsbProducts_UsbVendors_VendorId", - x => x.VendorId, - "UsbVendors", - "Id", - onDelete: ReferentialAction.Cascade); - }); - - if (UsbProductsExists) + migrationBuilder.CreateTable("UsbProducts", table => new { - migrationBuilder.Sql( - "INSERT INTO UsbProducts (Id, ProductId, Product, AddedWhen, ModifiedWhen, VendorId) SELECT Id, ProductId, Product, AddedWhen, ModifiedWhen, VendorId FROM UsbProducts_old"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ProductId = table.Column(), Product = table.Column(nullable: true), + AddedWhen = table.Column(), ModifiedWhen = table.Column(), + VendorId = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_UsbProducts", x => x.Id); + + table.ForeignKey("FK_UsbProducts_UsbVendors_VendorId", x => x.VendorId, "UsbVendors", "Id", + onDelete: ReferentialAction.Cascade); + }); + + if(UsbProductsExists) + { + migrationBuilder. + Sql("INSERT INTO UsbProducts (Id, ProductId, Product, AddedWhen, ModifiedWhen, VendorId) SELECT Id, ProductId, Product, AddedWhen, ModifiedWhen, VendorId FROM UsbProducts_old"); + migrationBuilder.DropTable("UsbProducts_old"); } - #endregion #region TABLE: SscSupportedMedia - - migrationBuilder.CreateTable( - "SscSupportedMedia", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - MediumType = table.Column(), - Width = table.Column(), - Length = table.Column(), - Organization = table.Column(nullable: true), - Name = table.Column(nullable: true), - Description = table.Column(nullable: true), - WidthSql = table.Column(), - LengthSql = table.Column(), - SscId = table.Column(nullable: true), - TestedSequentialMediaId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_SscSupportedMedia", x => x.Id); - table.ForeignKey( - "FK_SscSupportedMedia_Ssc_SscId", - x => x.SscId, - "Ssc", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_SscSupportedMedia_TestedSequentialMedia_TestedSequentialMedi~", - x => x.TestedSequentialMediaId, - "TestedSequentialMedia", - "Id", - onDelete: ReferentialAction.Restrict); - }); - - if (SscSupportedMediasExists) + migrationBuilder.CreateTable("SscSupportedMedia", table => new { - migrationBuilder.Sql( - "INSERT INTO SscSupportedMedia (Id, MediumType, Width, Length, Organization, Name, Description, WidthSql, LengthSql, SscId, TestedSequentialMediaId) SELECT Id, MediumType, WidthSql AS Width, LengthSql AS Length, Organization, Name, Description, WidthSql, LengthSql, Ssc_Id, TestedSequentialMedia_Id FROM SscSupportedMedias"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + MediumType = table.Column(), Width = table.Column(), + Length = table.Column(), + Organization = table.Column(nullable: true), + Name = table.Column(nullable: true), + Description = table.Column(nullable: true), WidthSql = table.Column(), + LengthSql = table.Column(), + SscId = table.Column(nullable: true), + TestedSequentialMediaId = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_SscSupportedMedia", x => x.Id); + + table.ForeignKey("FK_SscSupportedMedia_Ssc_SscId", x => x.SscId, "Ssc", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_SscSupportedMedia_TestedSequentialMedia_TestedSequentialMedi~", + x => x.TestedSequentialMediaId, "TestedSequentialMedia", "Id", + onDelete: ReferentialAction.Restrict); + }); + + if(SscSupportedMediasExists) + { + migrationBuilder. + Sql("INSERT INTO SscSupportedMedia (Id, MediumType, Width, Length, Organization, Name, Description, WidthSql, LengthSql, SscId, TestedSequentialMediaId) SELECT Id, MediumType, WidthSql AS Width, LengthSql AS Length, Organization, Name, Description, WidthSql, LengthSql, Ssc_Id, TestedSequentialMedia_Id FROM SscSupportedMedias"); + migrationBuilder.DropTable("SscSupportedMedias"); } - #endregion #region TABLE: SupportedDensity - - migrationBuilder.CreateTable( - "SupportedDensity", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - PrimaryCode = table.Column(), - SecondaryCode = table.Column(), - Writable = table.Column(), - Duplicate = table.Column(), - DefaultDensity = table.Column(), - BitsPerMm = table.Column(), - Width = table.Column(), - Tracks = table.Column(), - Capacity = table.Column(), - Organization = table.Column(nullable: true), - Name = table.Column(nullable: true), - Description = table.Column(nullable: true), - BitsPerMmSql = table.Column(), - WidthSql = table.Column(), - TracksSql = table.Column(), - CapacitySql = table.Column(), - SscId = table.Column(nullable: true), - TestedSequentialMediaId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_SupportedDensity", x => x.Id); - table.ForeignKey( - "FK_SupportedDensity_Ssc_SscId", - x => x.SscId, - "Ssc", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_SupportedDensity_TestedSequentialMedia_TestedSequentialMedia~", - x => x.TestedSequentialMediaId, - "TestedSequentialMedia", - "Id", - onDelete: ReferentialAction.Restrict); - }); - - if (SupportedDensitiesExists) + migrationBuilder.CreateTable("SupportedDensity", table => new { - migrationBuilder.Sql( - "INSERT INTO SupportedDensity (PrimaryCode, SecondaryCode, Writable, Duplicate, DefaultDensity, BitsPerMm, Width, Tracks, Capacity, Organization, Name, Description, BitsPerMmSql, WidthSql, TracksSql, CapacitySql, SscId, TestedSequentialMediaId) SELECT PrimaryCode, SecondaryCode, Writable, Duplicate, DefaultDensity, BitsPerMmSql AS BitsPerMm, WidthSql AS Width, TracksSql AS Tracks, CapacitySql AS Capacity, Organization, Name, Description, BitsPerMmSql, WidthSql, TracksSql, CapacitySql, Ssc_Id, TestedSequentialMedia_Id FROM SupportedDensities"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + PrimaryCode = table.Column(), SecondaryCode = table.Column(), + Writable = table.Column(), Duplicate = table.Column(), + DefaultDensity = table.Column(), BitsPerMm = table.Column(), + Width = table.Column(), + Tracks = table.Column(), Capacity = table.Column(), + Organization = table.Column(nullable: true), + Name = table.Column(nullable: true), + Description = table.Column(nullable: true), BitsPerMmSql = table.Column(), + WidthSql = table.Column(), TracksSql = table.Column(), + CapacitySql = table.Column(), + SscId = table.Column(nullable: true), + TestedSequentialMediaId = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_SupportedDensity", x => x.Id); + + table.ForeignKey("FK_SupportedDensity_Ssc_SscId", x => x.SscId, "Ssc", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_SupportedDensity_TestedSequentialMedia_TestedSequentialMedia~", + x => x.TestedSequentialMediaId, "TestedSequentialMedia", "Id", + onDelete: ReferentialAction.Restrict); + }); + + if(SupportedDensitiesExists) + { + migrationBuilder. + Sql("INSERT INTO SupportedDensity (PrimaryCode, SecondaryCode, Writable, Duplicate, DefaultDensity, BitsPerMm, Width, Tracks, Capacity, Organization, Name, Description, BitsPerMmSql, WidthSql, TracksSql, CapacitySql, SscId, TestedSequentialMediaId) SELECT PrimaryCode, SecondaryCode, Writable, Duplicate, DefaultDensity, BitsPerMmSql AS BitsPerMm, WidthSql AS Width, TracksSql AS Tracks, CapacitySql AS Capacity, Organization, Name, Description, BitsPerMmSql, WidthSql, TracksSql, CapacitySql, Ssc_Id, TestedSequentialMedia_Id FROM SupportedDensities"); + migrationBuilder.DropTable("SupportedDensities"); } - #endregion #region TABLE: DensityCode - - migrationBuilder.CreateTable( - "DensityCode", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Code = table.Column(), - SscSupportedMediaId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_DensityCode", x => x.Id); - table.ForeignKey( - "FK_DensityCode_SscSupportedMedia_SscSupportedMediaId", - x => x.SscSupportedMediaId, - "SscSupportedMedia", - "Id", - onDelete: ReferentialAction.Restrict); - }); - - if (DensityCodesExists) + migrationBuilder.CreateTable("DensityCode", table => new { - migrationBuilder.Sql( - "INSERT INTO DensityCode (Id, Code, SscSupportedMediaId) SELECT Id, Code, SscSupportedMedia_Id FROM DensityCodes"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(), SscSupportedMediaId = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_DensityCode", x => x.Id); + + table.ForeignKey("FK_DensityCode_SscSupportedMedia_SscSupportedMediaId", x => x.SscSupportedMediaId, + "SscSupportedMedia", "Id", onDelete: ReferentialAction.Restrict); + }); + + if(DensityCodesExists) + { + migrationBuilder. + Sql("INSERT INTO DensityCode (Id, Code, SscSupportedMediaId) SELECT Id, Code, SscSupportedMedia_Id FROM DensityCodes"); + migrationBuilder.DropTable("DensityCodes"); } - #endregion #region TABLE: Devices - - if (DevicesExists) + if(DevicesExists) migrationBuilder.RenameTable("Devices", newName: "Devices_old"); - migrationBuilder.CreateTable( - "Devices", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - USBId = table.Column(nullable: true), - FireWireId = table.Column(nullable: true), - PCMCIAId = table.Column(nullable: true), - CompactFlash = table.Column(), - ATAId = table.Column(nullable: true), - ATAPIId = table.Column(nullable: true), - SCSIId = table.Column(nullable: true), - MultiMediaCardId = table.Column(nullable: true), - SecureDigitalId = table.Column(nullable: true), - Manufacturer = table.Column(nullable: true), - Model = table.Column(nullable: true), - Revision = table.Column(nullable: true), - Type = table.Column(), - AddedWhen = table.Column(), - ModifiedWhen = table.Column(nullable: true), - CdOffsetId = table.Column(nullable: true), - OptimalMultipleSectorsRead = table.Column() - }, - constraints: table => - { - table.PrimaryKey("PK_Devices", x => x.Id); - table.ForeignKey( - "FK_Devices_CdOffsets_CdOffsetId", - x => x.CdOffsetId, - "CdOffsets", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_Devices_FireWire_FireWireId", - x => x.FireWireId, - "FireWire", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_Devices_MmcSd_MultiMediaCardId", - x => x.MultiMediaCardId, - "MmcSd", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_Devices_Pcmcia_PCMCIAId", - x => x.PCMCIAId, - "Pcmcia", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_Devices_MmcSd_SecureDigitalId", - x => x.SecureDigitalId, - "MmcSd", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_Devices_Usb_USBId", - x => x.USBId, - "Usb", - "Id", - onDelete: ReferentialAction.Restrict); - }); - - if (DevicesExists) + migrationBuilder.CreateTable("Devices", table => new { - migrationBuilder.Sql( - "INSERT INTO Devices (Id, USBId, FireWireId, PCMCIAId, CompactFlash, ATAId, ATAPIId, SCSIId, MultiMediaCardId, SecureDigitalId, Manufacturer, Model, Revision, Type, AddedWhen, ModifiedWhen, CdOffsetId, OptimalMultipleSectorsRead) SELECT Id, USB_Id, FireWire_Id, PCMCIA_Id, CompactFlash, ATA_Id, ATAPI_Id, SCSI_Id, MultiMediaCard_Id, SecureDigital_Id, Manufacturer, Model, Revision, Type, AddedWhen, ModifiedWhen, CdOffset_Id, OptimalMultipleSectorsRead FROM Devices_old"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + USBId = table.Column(nullable: true), + FireWireId = table.Column(nullable: true), + PCMCIAId = table.Column(nullable: true), CompactFlash = table.Column(), + ATAId = table.Column(nullable: true), + ATAPIId = table.Column(nullable: true), + SCSIId = table.Column(nullable: true), + MultiMediaCardId = table.Column(nullable: true), + SecureDigitalId = table.Column(nullable: true), + Manufacturer = table.Column(nullable: true), + Model = table.Column(nullable: true), + Revision = table.Column(nullable: true), Type = table.Column(), + AddedWhen = table.Column(), + ModifiedWhen = table.Column(nullable: true), + CdOffsetId = table.Column(nullable: true), OptimalMultipleSectorsRead = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_Devices", x => x.Id); + + table.ForeignKey("FK_Devices_CdOffsets_CdOffsetId", x => x.CdOffsetId, "CdOffsets", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_Devices_FireWire_FireWireId", x => x.FireWireId, "FireWire", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_Devices_MmcSd_MultiMediaCardId", x => x.MultiMediaCardId, "MmcSd", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_Devices_Pcmcia_PCMCIAId", x => x.PCMCIAId, "Pcmcia", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_Devices_MmcSd_SecureDigitalId", x => x.SecureDigitalId, "MmcSd", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_Devices_Usb_USBId", x => x.USBId, "Usb", "Id", + onDelete: ReferentialAction.Restrict); + }); + + if(DevicesExists) + { + migrationBuilder. + Sql("INSERT INTO Devices (Id, USBId, FireWireId, PCMCIAId, CompactFlash, ATAId, ATAPIId, SCSIId, MultiMediaCardId, SecureDigitalId, Manufacturer, Model, Revision, Type, AddedWhen, ModifiedWhen, CdOffsetId, OptimalMultipleSectorsRead) SELECT Id, USB_Id, FireWire_Id, PCMCIA_Id, CompactFlash, ATA_Id, ATAPI_Id, SCSI_Id, MultiMediaCard_Id, SecureDigital_Id, Manufacturer, Model, Revision, Type, AddedWhen, ModifiedWhen, CdOffset_Id, OptimalMultipleSectorsRead FROM Devices_old"); + migrationBuilder.DropTable("Devices_old"); } - #endregion #region TABLE: DeviceStats - - if (DeviceStatsExists) + if(DeviceStatsExists) migrationBuilder.RenameTable("DeviceStats", newName: "DeviceStats_old"); - migrationBuilder.CreateTable( - "DeviceStats", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Manufacturer = table.Column(nullable: true), - Model = table.Column(nullable: true), - Revision = table.Column(nullable: true), - Bus = table.Column(nullable: true), - ReportId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_DeviceStats", x => x.Id); - table.ForeignKey( - "FK_DeviceStats_Devices_ReportId", - x => x.ReportId, - "Devices", - "Id", - onDelete: ReferentialAction.Restrict); - }); - - if (DeviceStatsExists) + migrationBuilder.CreateTable("DeviceStats", table => new { - migrationBuilder.Sql( - "INSERT INTO DeviceStats (Id, Manufacturer, Model, Revision, Bus, ReportId) SELECT Id, Manufacturer, Model, Revision, Bus, Report_Id FROM DeviceStats_old"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Manufacturer = table.Column(nullable: true), Model = table.Column(nullable: true), + Revision = table.Column(nullable: true), Bus = table.Column(nullable: true), + ReportId = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_DeviceStats", x => x.Id); + + table.ForeignKey("FK_DeviceStats_Devices_ReportId", x => x.ReportId, "Devices", "Id", + onDelete: ReferentialAction.Restrict); + }); + + if(DeviceStatsExists) + { + migrationBuilder. + Sql("INSERT INTO DeviceStats (Id, Manufacturer, Model, Revision, Bus, ReportId) SELECT Id, Manufacturer, Model, Revision, Bus, Report_Id FROM DeviceStats_old"); + migrationBuilder.DropTable("DeviceStats_old"); } - #endregion #region TABLE: Reports - - migrationBuilder.CreateTable( - "Reports", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - USBId = table.Column(nullable: true), - FireWireId = table.Column(nullable: true), - PCMCIAId = table.Column(nullable: true), - CompactFlash = table.Column(), - ATAId = table.Column(nullable: true), - ATAPIId = table.Column(nullable: true), - SCSIId = table.Column(nullable: true), - MultiMediaCardId = table.Column(nullable: true), - SecureDigitalId = table.Column(nullable: true), - Manufacturer = table.Column(nullable: true), - Model = table.Column(nullable: true), - Revision = table.Column(nullable: true), - Type = table.Column(), - UploadedWhen = table.Column() - }, - constraints: table => - { - table.PrimaryKey("PK_Reports", x => x.Id); - table.ForeignKey( - "FK_Reports_FireWire_FireWireId", - x => x.FireWireId, - "FireWire", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_Reports_MmcSd_MultiMediaCardId", - x => x.MultiMediaCardId, - "MmcSd", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_Reports_Pcmcia_PCMCIAId", - x => x.PCMCIAId, - "Pcmcia", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_Reports_MmcSd_SecureDigitalId", - x => x.SecureDigitalId, - "MmcSd", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_Reports_Usb_USBId", - x => x.USBId, - "Usb", - "Id", - onDelete: ReferentialAction.Restrict); - }); - - if (UploadedReportsExists) + migrationBuilder.CreateTable("Reports", table => new { - migrationBuilder.Sql( - "INSERT INTO Reports (Id, USBId, FireWireId, PCMCIAId, CompactFlash, ATAId, ATAPIId, SCSIId, MultiMediaCardId, SecureDigitalId, Manufacturer, Model, Revision, Type, UploadedWhen) SELECT Id, USB_Id, FireWire_Id, PCMCIA_Id, CompactFlash, ATA_Id, ATAPI_Id, SCSI_Id, MultiMediaCard_Id, SecureDigital_Id, Manufacturer, Model, Revision, Type, UploadedWhen FROM UploadedReports"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + USBId = table.Column(nullable: true), + FireWireId = table.Column(nullable: true), + PCMCIAId = table.Column(nullable: true), CompactFlash = table.Column(), + ATAId = table.Column(nullable: true), + ATAPIId = table.Column(nullable: true), + SCSIId = table.Column(nullable: true), + MultiMediaCardId = table.Column(nullable: true), + SecureDigitalId = table.Column(nullable: true), + Manufacturer = table.Column(nullable: true), Model = table.Column(nullable: true), + Revision = table.Column(nullable: true), Type = table.Column(), + UploadedWhen = table.Column() + }, constraints: table => + { + table.PrimaryKey("PK_Reports", x => x.Id); + + table.ForeignKey("FK_Reports_FireWire_FireWireId", x => x.FireWireId, "FireWire", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_Reports_MmcSd_MultiMediaCardId", x => x.MultiMediaCardId, "MmcSd", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_Reports_Pcmcia_PCMCIAId", x => x.PCMCIAId, "Pcmcia", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_Reports_MmcSd_SecureDigitalId", x => x.SecureDigitalId, "MmcSd", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_Reports_Usb_USBId", x => x.USBId, "Usb", "Id", + onDelete: ReferentialAction.Restrict); + }); + + if(UploadedReportsExists) + { + migrationBuilder. + Sql("INSERT INTO Reports (Id, USBId, FireWireId, PCMCIAId, CompactFlash, ATAId, ATAPIId, SCSIId, MultiMediaCardId, SecureDigitalId, Manufacturer, Model, Revision, Type, UploadedWhen) SELECT Id, USB_Id, FireWire_Id, PCMCIA_Id, CompactFlash, ATA_Id, ATAPI_Id, SCSI_Id, MultiMediaCard_Id, SecureDigital_Id, Manufacturer, Model, Revision, Type, UploadedWhen FROM UploadedReports"); + migrationBuilder.DropTable("UploadedReports"); } - #endregion #region TABLE: TestedMedia - - migrationBuilder.CreateTable( - "TestedMedia", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - IdentifyData = table.Column(nullable: true), - Blocks = table.Column(nullable: true), - BlockSize = table.Column(nullable: true), - CanReadAACS = table.Column(nullable: true), - CanReadADIP = table.Column(nullable: true), - CanReadATIP = table.Column(nullable: true), - CanReadBCA = table.Column(nullable: true), - CanReadC2Pointers = table.Column(nullable: true), - CanReadCMI = table.Column(nullable: true), - CanReadCorrectedSubchannel = table.Column(nullable: true), - CanReadCorrectedSubchannelWithC2 = table.Column(nullable: true), - CanReadDCB = table.Column(nullable: true), - CanReadDDS = table.Column(nullable: true), - CanReadDMI = table.Column(nullable: true), - CanReadDiscInformation = table.Column(nullable: true), - CanReadFullTOC = table.Column(nullable: true), - CanReadHDCMI = table.Column(nullable: true), - CanReadLayerCapacity = table.Column(nullable: true), - CanReadFirstTrackPreGap = table.Column(nullable: true), - CanReadLeadIn = table.Column(nullable: true), - CanReadLeadOut = table.Column(nullable: true), - CanReadMediaID = table.Column(nullable: true), - CanReadMediaSerial = table.Column(nullable: true), - CanReadPAC = table.Column(nullable: true), - CanReadPFI = table.Column(nullable: true), - CanReadPMA = table.Column(nullable: true), - CanReadPQSubchannel = table.Column(nullable: true), - CanReadPQSubchannelWithC2 = table.Column(nullable: true), - CanReadPRI = table.Column(nullable: true), - CanReadRWSubchannel = table.Column(nullable: true), - CanReadRWSubchannelWithC2 = table.Column(nullable: true), - CanReadRecordablePFI = table.Column(nullable: true), - CanReadSpareAreaInformation = table.Column(nullable: true), - CanReadTOC = table.Column(nullable: true), - Density = table.Column(nullable: true), - LongBlockSize = table.Column(nullable: true), - Manufacturer = table.Column(nullable: true), - MediaIsRecognized = table.Column(), - MediumType = table.Column(nullable: true), - MediumTypeName = table.Column(nullable: true), - Model = table.Column(nullable: true), - SupportsHLDTSTReadRawDVD = table.Column(nullable: true), - SupportsNECReadCDDA = table.Column(nullable: true), - SupportsPioneerReadCDDA = table.Column(nullable: true), - SupportsPioneerReadCDDAMSF = table.Column(nullable: true), - SupportsPlextorReadCDDA = table.Column(nullable: true), - SupportsPlextorReadRawDVD = table.Column(nullable: true), - SupportsRead10 = table.Column(nullable: true), - SupportsRead12 = table.Column(nullable: true), - SupportsRead16 = table.Column(nullable: true), - SupportsRead6 = table.Column(nullable: true), - SupportsReadCapacity16 = table.Column(nullable: true), - SupportsReadCapacity = table.Column(nullable: true), - SupportsReadCd = table.Column(nullable: true), - SupportsReadCdMsf = table.Column(nullable: true), - SupportsReadCdRaw = table.Column(nullable: true), - SupportsReadCdMsfRaw = table.Column(nullable: true), - SupportsReadLong16 = table.Column(nullable: true), - SupportsReadLong = table.Column(nullable: true), - ModeSense6Data = table.Column(nullable: true), - ModeSense10Data = table.Column(nullable: true), - CHSId = table.Column(nullable: true), - CurrentCHSId = table.Column(nullable: true), - LBASectors = table.Column(nullable: true), - LBA48Sectors = table.Column(nullable: true), - LogicalAlignment = table.Column(nullable: true), - NominalRotationRate = table.Column(nullable: true), - PhysicalBlockSize = table.Column(nullable: true), - SolidStateDevice = table.Column(nullable: true), - UnformattedBPT = table.Column(nullable: true), - UnformattedBPS = table.Column(nullable: true), - SupportsReadDmaLba = table.Column(nullable: true), - SupportsReadDmaRetryLba = table.Column(nullable: true), - SupportsReadLba = table.Column(nullable: true), - SupportsReadRetryLba = table.Column(nullable: true), - SupportsReadLongLba = table.Column(nullable: true), - SupportsReadLongRetryLba = table.Column(nullable: true), - SupportsSeekLba = table.Column(nullable: true), - SupportsReadDmaLba48 = table.Column(nullable: true), - SupportsReadLba48 = table.Column(nullable: true), - SupportsReadDma = table.Column(nullable: true), - SupportsReadDmaRetry = table.Column(nullable: true), - SupportsReadRetry = table.Column(nullable: true), - SupportsReadSectors = table.Column(nullable: true), - SupportsReadLongRetry = table.Column(nullable: true), - SupportsSeek = table.Column(nullable: true), - CanReadingIntersessionLeadIn = table.Column(nullable: true), - CanReadingIntersessionLeadOut = table.Column(nullable: true), - IntersessionLeadInData = table.Column(nullable: true), - IntersessionLeadOutData = table.Column(nullable: true), - BlocksSql = table.Column(nullable: true), - BlockSizeSql = table.Column(nullable: true), - LongBlockSizeSql = table.Column(nullable: true), - LBASectorsSql = table.Column(nullable: true), - LBA48SectorsSql = table.Column(nullable: true), - LogicalAlignmentSql = table.Column(nullable: true), - NominalRotationRateSql = table.Column(nullable: true), - PhysicalBlockSizeSql = table.Column(nullable: true), - UnformattedBPTSql = table.Column(nullable: true), - UnformattedBPSSql = table.Column(nullable: true), - Read6Data = table.Column(nullable: true), - Read10Data = table.Column(nullable: true), - Read12Data = table.Column(nullable: true), - Read16Data = table.Column(nullable: true), - ReadLong10Data = table.Column(nullable: true), - ReadLong16Data = table.Column(nullable: true), - ReadSectorsData = table.Column(nullable: true), - ReadSectorsRetryData = table.Column(nullable: true), - ReadDmaData = table.Column(nullable: true), - ReadDmaRetryData = table.Column(nullable: true), - ReadLbaData = table.Column(nullable: true), - ReadRetryLbaData = table.Column(nullable: true), - ReadDmaLbaData = table.Column(nullable: true), - ReadDmaRetryLbaData = table.Column(nullable: true), - ReadLba48Data = table.Column(nullable: true), - ReadDmaLba48Data = table.Column(nullable: true), - ReadLongData = table.Column(nullable: true), - ReadLongRetryData = table.Column(nullable: true), - ReadLongLbaData = table.Column(nullable: true), - ReadLongRetryLbaData = table.Column(nullable: true), - TocData = table.Column(nullable: true), - FullTocData = table.Column(nullable: true), - AtipData = table.Column(nullable: true), - PmaData = table.Column(nullable: true), - ReadCdData = table.Column(nullable: true), - ReadCdMsfData = table.Column(nullable: true), - ReadCdFullData = table.Column(nullable: true), - ReadCdMsfFullData = table.Column(nullable: true), - Track1PregapData = table.Column(nullable: true), - LeadInData = table.Column(nullable: true), - LeadOutData = table.Column(nullable: true), - C2PointersData = table.Column(nullable: true), - PQSubchannelData = table.Column(nullable: true), - RWSubchannelData = table.Column(nullable: true), - CorrectedSubchannelData = table.Column(nullable: true), - PQSubchannelWithC2Data = table.Column(nullable: true), - RWSubchannelWithC2Data = table.Column(nullable: true), - CorrectedSubchannelWithC2Data = table.Column(nullable: true), - PfiData = table.Column(nullable: true), - DmiData = table.Column(nullable: true), - CmiData = table.Column(nullable: true), - DvdBcaData = table.Column(nullable: true), - DvdAacsData = table.Column(nullable: true), - DvdDdsData = table.Column(nullable: true), - DvdSaiData = table.Column(nullable: true), - PriData = table.Column(nullable: true), - EmbossedPfiData = table.Column(nullable: true), - AdipData = table.Column(nullable: true), - DcbData = table.Column(nullable: true), - HdCmiData = table.Column(nullable: true), - DvdLayerData = table.Column(nullable: true), - BluBcaData = table.Column(nullable: true), - BluDdsData = table.Column(nullable: true), - BluSaiData = table.Column(nullable: true), - BluDiData = table.Column(nullable: true), - BluPacData = table.Column(nullable: true), - PlextorReadCddaData = table.Column(nullable: true), - PioneerReadCddaData = table.Column(nullable: true), - PioneerReadCddaMsfData = table.Column(nullable: true), - NecReadCddaData = table.Column(nullable: true), - PlextorReadRawDVDData = table.Column(nullable: true), - HLDTSTReadRawDVDData = table.Column(nullable: true), - AtaId = table.Column(nullable: true), - MmcId = table.Column(nullable: true), - ScsiId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_TestedMedia", x => x.Id); - table.ForeignKey( - "FK_TestedMedia_Chs_CHSId", - x => x.CHSId, - "Chs", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_TestedMedia_Chs_CurrentCHSId", - x => x.CurrentCHSId, - "Chs", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_TestedMedia_Mmc_MmcId", - x => x.MmcId, - "Mmc", - "Id", - onDelete: ReferentialAction.Restrict); - }); - - if (TestedMediasExists) + migrationBuilder.CreateTable("TestedMedia", table => new { - var preFormat = + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + IdentifyData = table.Column(nullable: true), + Blocks = table.Column(nullable: true), + BlockSize = table.Column(nullable: true), + CanReadAACS = table.Column(nullable: true), + CanReadADIP = table.Column(nullable: true), + CanReadATIP = table.Column(nullable: true), + CanReadBCA = table.Column(nullable: true), + CanReadC2Pointers = table.Column(nullable: true), + CanReadCMI = table.Column(nullable: true), + CanReadCorrectedSubchannel = table.Column(nullable: true), + CanReadCorrectedSubchannelWithC2 = table.Column(nullable: true), + CanReadDCB = table.Column(nullable: true), + CanReadDDS = table.Column(nullable: true), + CanReadDMI = table.Column(nullable: true), + CanReadDiscInformation = table.Column(nullable: true), + CanReadFullTOC = table.Column(nullable: true), + CanReadHDCMI = table.Column(nullable: true), + CanReadLayerCapacity = table.Column(nullable: true), + CanReadFirstTrackPreGap = table.Column(nullable: true), + CanReadLeadIn = table.Column(nullable: true), + CanReadLeadOut = table.Column(nullable: true), + CanReadMediaID = table.Column(nullable: true), + CanReadMediaSerial = table.Column(nullable: true), + CanReadPAC = table.Column(nullable: true), + CanReadPFI = table.Column(nullable: true), + CanReadPMA = table.Column(nullable: true), + CanReadPQSubchannel = table.Column(nullable: true), + CanReadPQSubchannelWithC2 = table.Column(nullable: true), + CanReadPRI = table.Column(nullable: true), + CanReadRWSubchannel = table.Column(nullable: true), + CanReadRWSubchannelWithC2 = table.Column(nullable: true), + CanReadRecordablePFI = table.Column(nullable: true), + CanReadSpareAreaInformation = table.Column(nullable: true), + CanReadTOC = table.Column(nullable: true), + Density = table.Column(nullable: true), + LongBlockSize = table.Column(nullable: true), + Manufacturer = table.Column(nullable: true), + MediaIsRecognized = table.Column(), + MediumType = table.Column(nullable: true), + MediumTypeName = table.Column(nullable: true), + Model = table.Column(nullable: true), + SupportsHLDTSTReadRawDVD = table.Column(nullable: true), + SupportsNECReadCDDA = table.Column(nullable: true), + SupportsPioneerReadCDDA = table.Column(nullable: true), + SupportsPioneerReadCDDAMSF = table.Column(nullable: true), + SupportsPlextorReadCDDA = table.Column(nullable: true), + SupportsPlextorReadRawDVD = table.Column(nullable: true), + SupportsRead10 = table.Column(nullable: true), + SupportsRead12 = table.Column(nullable: true), + SupportsRead16 = table.Column(nullable: true), + SupportsRead6 = table.Column(nullable: true), + SupportsReadCapacity16 = table.Column(nullable: true), + SupportsReadCapacity = table.Column(nullable: true), + SupportsReadCd = table.Column(nullable: true), + SupportsReadCdMsf = table.Column(nullable: true), + SupportsReadCdRaw = table.Column(nullable: true), + SupportsReadCdMsfRaw = table.Column(nullable: true), + SupportsReadLong16 = table.Column(nullable: true), + SupportsReadLong = table.Column(nullable: true), + ModeSense6Data = table.Column(nullable: true), + ModeSense10Data = table.Column(nullable: true), + CHSId = table.Column(nullable: true), + CurrentCHSId = table.Column(nullable: true), + LBASectors = table.Column(nullable: true), + LBA48Sectors = table.Column(nullable: true), + LogicalAlignment = table.Column(nullable: true), + NominalRotationRate = table.Column(nullable: true), + PhysicalBlockSize = table.Column(nullable: true), + SolidStateDevice = table.Column(nullable: true), + UnformattedBPT = table.Column(nullable: true), + UnformattedBPS = table.Column(nullable: true), + SupportsReadDmaLba = table.Column(nullable: true), + SupportsReadDmaRetryLba = table.Column(nullable: true), + SupportsReadLba = table.Column(nullable: true), + SupportsReadRetryLba = table.Column(nullable: true), + SupportsReadLongLba = table.Column(nullable: true), + SupportsReadLongRetryLba = table.Column(nullable: true), + SupportsSeekLba = table.Column(nullable: true), + SupportsReadDmaLba48 = table.Column(nullable: true), + SupportsReadLba48 = table.Column(nullable: true), + SupportsReadDma = table.Column(nullable: true), + SupportsReadDmaRetry = table.Column(nullable: true), + SupportsReadRetry = table.Column(nullable: true), + SupportsReadSectors = table.Column(nullable: true), + SupportsReadLongRetry = table.Column(nullable: true), + SupportsSeek = table.Column(nullable: true), + CanReadingIntersessionLeadIn = table.Column(nullable: true), + CanReadingIntersessionLeadOut = table.Column(nullable: true), + IntersessionLeadInData = table.Column(nullable: true), + IntersessionLeadOutData = table.Column(nullable: true), + BlocksSql = table.Column(nullable: true), + BlockSizeSql = table.Column(nullable: true), + LongBlockSizeSql = table.Column(nullable: true), + LBASectorsSql = table.Column(nullable: true), + LBA48SectorsSql = table.Column(nullable: true), + LogicalAlignmentSql = table.Column(nullable: true), + NominalRotationRateSql = table.Column(nullable: true), + PhysicalBlockSizeSql = table.Column(nullable: true), + UnformattedBPTSql = table.Column(nullable: true), + UnformattedBPSSql = table.Column(nullable: true), + Read6Data = table.Column(nullable: true), + Read10Data = table.Column(nullable: true), + Read12Data = table.Column(nullable: true), + Read16Data = table.Column(nullable: true), + ReadLong10Data = table.Column(nullable: true), + ReadLong16Data = table.Column(nullable: true), + ReadSectorsData = table.Column(nullable: true), + ReadSectorsRetryData = table.Column(nullable: true), + ReadDmaData = table.Column(nullable: true), + ReadDmaRetryData = table.Column(nullable: true), + ReadLbaData = table.Column(nullable: true), + ReadRetryLbaData = table.Column(nullable: true), + ReadDmaLbaData = table.Column(nullable: true), + ReadDmaRetryLbaData = table.Column(nullable: true), + ReadLba48Data = table.Column(nullable: true), + ReadDmaLba48Data = table.Column(nullable: true), + ReadLongData = table.Column(nullable: true), + ReadLongRetryData = table.Column(nullable: true), + ReadLongLbaData = table.Column(nullable: true), + ReadLongRetryLbaData = table.Column(nullable: true), + TocData = table.Column(nullable: true), + FullTocData = table.Column(nullable: true), + AtipData = table.Column(nullable: true), + PmaData = table.Column(nullable: true), + ReadCdData = table.Column(nullable: true), + ReadCdMsfData = table.Column(nullable: true), + ReadCdFullData = table.Column(nullable: true), + ReadCdMsfFullData = table.Column(nullable: true), + Track1PregapData = table.Column(nullable: true), + LeadInData = table.Column(nullable: true), + LeadOutData = table.Column(nullable: true), + C2PointersData = table.Column(nullable: true), + PQSubchannelData = table.Column(nullable: true), + RWSubchannelData = table.Column(nullable: true), + CorrectedSubchannelData = table.Column(nullable: true), + PQSubchannelWithC2Data = table.Column(nullable: true), + RWSubchannelWithC2Data = table.Column(nullable: true), + CorrectedSubchannelWithC2Data = table.Column(nullable: true), + PfiData = table.Column(nullable: true), + DmiData = table.Column(nullable: true), + CmiData = table.Column(nullable: true), + DvdBcaData = table.Column(nullable: true), + DvdAacsData = table.Column(nullable: true), + DvdDdsData = table.Column(nullable: true), + DvdSaiData = table.Column(nullable: true), + PriData = table.Column(nullable: true), + EmbossedPfiData = table.Column(nullable: true), + AdipData = table.Column(nullable: true), + DcbData = table.Column(nullable: true), + HdCmiData = table.Column(nullable: true), + DvdLayerData = table.Column(nullable: true), + BluBcaData = table.Column(nullable: true), + BluDdsData = table.Column(nullable: true), + BluSaiData = table.Column(nullable: true), + BluDiData = table.Column(nullable: true), + BluPacData = table.Column(nullable: true), + PlextorReadCddaData = table.Column(nullable: true), + PioneerReadCddaData = table.Column(nullable: true), + PioneerReadCddaMsfData = table.Column(nullable: true), + NecReadCddaData = table.Column(nullable: true), + PlextorReadRawDVDData = table.Column(nullable: true), + HLDTSTReadRawDVDData = table.Column(nullable: true), + AtaId = table.Column(nullable: true), + MmcId = table.Column(nullable: true), + ScsiId = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_TestedMedia", x => x.Id); + + table.ForeignKey("FK_TestedMedia_Chs_CHSId", x => x.CHSId, "Chs", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_TestedMedia_Chs_CurrentCHSId", x => x.CurrentCHSId, "Chs", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_TestedMedia_Mmc_MmcId", x => x.MmcId, "Mmc", "Id", + onDelete: ReferentialAction.Restrict); + }); + + if(TestedMediasExists) + { + string preFormat = @"INSERT INTO TestedMedia (Id, IdentifyData, Blocks, BlockSize, CanReadAACS, CanReadADIP, CanReadATIP, CanReadBCA, CanReadC2Pointers, CanReadCMI, CanReadCorrectedSubchannel, CanReadCorrectedSubchannelWithC2, CanReadDCB, CanReadDDS, CanReadDMI, CanReadDiscInformation, @@ -2001,543 +1785,296 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0"); migrationBuilder.DropTable("TestedMedias"); } - #endregion #region TABLE: Ata - - migrationBuilder.CreateTable( - "Ata", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Identify = table.Column(nullable: true), - ReadCapabilitiesId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Ata", x => x.Id); - table.ForeignKey( - "FK_Ata_TestedMedia_ReadCapabilitiesId", - x => x.ReadCapabilitiesId, - "TestedMedia", - "Id", - onDelete: ReferentialAction.Restrict); - }); - - if (AtasExists) + migrationBuilder.CreateTable("Ata", table => new { - migrationBuilder.Sql( - "INSERT INTO Ata (Id, Identify, ReadCapabilitiesId) SELECT Id, Identify, ReadCapabilities_Id FROM Atas"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Identify = table.Column(nullable: true), ReadCapabilitiesId = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_Ata", x => x.Id); + + table.ForeignKey("FK_Ata_TestedMedia_ReadCapabilitiesId", x => x.ReadCapabilitiesId, "TestedMedia", + "Id", onDelete: ReferentialAction.Restrict); + }); + + if(AtasExists) + { + migrationBuilder. + Sql("INSERT INTO Ata (Id, Identify, ReadCapabilitiesId) SELECT Id, Identify, ReadCapabilities_Id FROM Atas"); + migrationBuilder.DropTable("Atas"); } - #endregion #region TABLE: Scsi + migrationBuilder.CreateTable("Scsi", table => new + { + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + InquiryData = table.Column(nullable: true), + SupportsModeSense6 = table.Column(), + SupportsModeSense10 = table.Column(), + SupportsModeSubpages = table.Column(), + ModeSenseId = table.Column(nullable: true), + MultiMediaDeviceId = table.Column(nullable: true), + ReadCapabilitiesId = table.Column(nullable: true), + SequentialDeviceId = table.Column(nullable: true), + ModeSense6Data = table.Column(nullable: true), + ModeSense10Data = table.Column(nullable: true), + ModeSense6CurrentData = table.Column(nullable: true), + ModeSense10CurrentData = table.Column(nullable: true), + ModeSense6ChangeableData = table.Column(nullable: true), + ModeSense10ChangeableData = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_Scsi", x => x.Id); - migrationBuilder.CreateTable( - "Scsi", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - InquiryData = table.Column(nullable: true), - SupportsModeSense6 = table.Column(), - SupportsModeSense10 = table.Column(), - SupportsModeSubpages = table.Column(), - ModeSenseId = table.Column(nullable: true), - MultiMediaDeviceId = table.Column(nullable: true), - ReadCapabilitiesId = table.Column(nullable: true), - SequentialDeviceId = table.Column(nullable: true), - ModeSense6Data = table.Column(nullable: true), - ModeSense10Data = table.Column(nullable: true), - ModeSense6CurrentData = table.Column(nullable: true), - ModeSense10CurrentData = table.Column(nullable: true), - ModeSense6ChangeableData = table.Column(nullable: true), - ModeSense10ChangeableData = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Scsi", x => x.Id); - table.ForeignKey( - "FK_Scsi_ScsiMode_ModeSenseId", - x => x.ModeSenseId, - "ScsiMode", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_Scsi_Mmc_MultiMediaDeviceId", - x => x.MultiMediaDeviceId, - "Mmc", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_Scsi_TestedMedia_ReadCapabilitiesId", - x => x.ReadCapabilitiesId, - "TestedMedia", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_Scsi_Ssc_SequentialDeviceId", - x => x.SequentialDeviceId, - "Ssc", - "Id", - onDelete: ReferentialAction.Restrict); - }); + table.ForeignKey("FK_Scsi_ScsiMode_ModeSenseId", x => x.ModeSenseId, "ScsiMode", "Id", + onDelete: ReferentialAction.Restrict); - if (ScsisExists) + table.ForeignKey("FK_Scsi_Mmc_MultiMediaDeviceId", x => x.MultiMediaDeviceId, "Mmc", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_Scsi_TestedMedia_ReadCapabilitiesId", x => x.ReadCapabilitiesId, "TestedMedia", + "Id", onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_Scsi_Ssc_SequentialDeviceId", x => x.SequentialDeviceId, "Ssc", "Id", + onDelete: ReferentialAction.Restrict); + }); + + if(ScsisExists) { migrationBuilder.Sql( - "INSERT INTO Scsi (Id, InquiryData, SupportsModeSense6, SupportsModeSense10, SupportsModeSubpages, ModeSenseId, MultiMediaDeviceId, ReadCapabilitiesId, SequentialDeviceId, ModeSense6Data, ModeSense10Data, ModeSense6CurrentData, ModeSense10CurrentData, ModeSense6ChangeableData, ModeSense10ChangeableData) SELECT Id, InquiryData, SupportsModeSense6, SupportsModeSense10, SupportsModeSubpages, ModeSense_Id, MultiMediaDevice_Id, ReadCapabilities_Id, SequentialDevice_Id, ModeSense6Data, ModeSense10Data, ModeSense6CurrentData, ModeSense10CurrentData, ModeSense6ChangeableData, ModeSense10ChangeableData FROM Scsis WHERE EXISTS(SELECT 1 from Mmc WHERE Mmc.Id = Scsis.MultiMediaDevice_Id) OR MultiMediaDevice_Id IS NULL"); + "INSERT INTO Scsi (Id, InquiryData, SupportsModeSense6, SupportsModeSense10, SupportsModeSubpages, ModeSenseId, MultiMediaDeviceId, ReadCapabilitiesId, SequentialDeviceId, ModeSense6Data, ModeSense10Data, ModeSense6CurrentData, ModeSense10CurrentData, ModeSense6ChangeableData, ModeSense10ChangeableData) SELECT Id, InquiryData, SupportsModeSense6, SupportsModeSense10, SupportsModeSubpages, ModeSense_Id, MultiMediaDevice_Id, ReadCapabilities_Id, SequentialDevice_Id, ModeSense6Data, ModeSense10Data, ModeSense6CurrentData, ModeSense10CurrentData, ModeSense6ChangeableData, ModeSense10ChangeableData FROM Scsis WHERE EXISTS(SELECT 1 from Mmc WHERE Mmc.Id = Scsis.MultiMediaDevice_Id) OR MultiMediaDevice_Id IS NULL"); + migrationBuilder.DropTable("Scsis"); } - #endregion #region TABLE: ScsiPage - - migrationBuilder.CreateTable( - "ScsiPage", - table => new - { - Id = table.Column() - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - page = table.Column(), - subpage = table.Column(nullable: true), - value = table.Column(nullable: true), - ScsiId = table.Column(nullable: true), - ScsiModeId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ScsiPage", x => x.Id); - table.ForeignKey( - "FK_ScsiPage_Scsi_ScsiId", - x => x.ScsiId, - "Scsi", - "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - "FK_ScsiPage_ScsiMode_ScsiModeId", - x => x.ScsiModeId, - "ScsiMode", - "Id", - onDelete: ReferentialAction.Restrict); - }); - - if (ScsiPagesExists) + migrationBuilder.CreateTable("ScsiPage", table => new { - migrationBuilder.Sql( - "INSERT INTO ScsiPage (Id, page, subpage, value, ScsiId, ScsiModeId) SELECT Id, page, subpage, value, Scsi_Id, ScsiMode_Id FROM ScsiPages"); + Id = table.Column(). + Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + page = table.Column(), subpage = table.Column(nullable: true), + value = table.Column(nullable: true), ScsiId = table.Column(nullable: true), + ScsiModeId = table.Column(nullable: true) + }, constraints: table => + { + table.PrimaryKey("PK_ScsiPage", x => x.Id); + + table.ForeignKey("FK_ScsiPage_Scsi_ScsiId", x => x.ScsiId, "Scsi", "Id", + onDelete: ReferentialAction.Restrict); + + table.ForeignKey("FK_ScsiPage_ScsiMode_ScsiModeId", x => x.ScsiModeId, "ScsiMode", "Id", + onDelete: ReferentialAction.Restrict); + }); + + if(ScsiPagesExists) + { + migrationBuilder. + Sql("INSERT INTO ScsiPage (Id, page, subpage, value, ScsiId, ScsiModeId) SELECT Id, page, subpage, value, Scsi_Id, ScsiMode_Id FROM ScsiPages"); + migrationBuilder.DropTable("ScsiPages"); } - #endregion - migrationBuilder.CreateIndex( - "IX_Ata_ReadCapabilitiesId", - "Ata", - "ReadCapabilitiesId"); + migrationBuilder.CreateIndex("IX_Ata_ReadCapabilitiesId", "Ata", "ReadCapabilitiesId"); - migrationBuilder.CreateIndex( - "IX_BlockDescriptor_ScsiModeId", - "BlockDescriptor", - "ScsiModeId"); + migrationBuilder.CreateIndex("IX_BlockDescriptor_ScsiModeId", "BlockDescriptor", "ScsiModeId"); - migrationBuilder.CreateIndex( - "IX_CdOffsets_ModifiedWhen", - "CdOffsets", - "ModifiedWhen"); + migrationBuilder.CreateIndex("IX_CdOffsets_ModifiedWhen", "CdOffsets", "ModifiedWhen"); - migrationBuilder.CreateIndex( - "IX_DensityCode_SscSupportedMediaId", - "DensityCode", - "SscSupportedMediaId"); + migrationBuilder.CreateIndex("IX_DensityCode_SscSupportedMediaId", "DensityCode", "SscSupportedMediaId"); - migrationBuilder.CreateIndex( - "IX_Devices_ATAId", - "Devices", - "ATAId"); + migrationBuilder.CreateIndex("IX_Devices_ATAId", "Devices", "ATAId"); - migrationBuilder.CreateIndex( - "IX_Devices_ATAPIId", - "Devices", - "ATAPIId"); + migrationBuilder.CreateIndex("IX_Devices_ATAPIId", "Devices", "ATAPIId"); - migrationBuilder.CreateIndex( - "IX_Devices_CdOffsetId", - "Devices", - "CdOffsetId"); + migrationBuilder.CreateIndex("IX_Devices_CdOffsetId", "Devices", "CdOffsetId"); - migrationBuilder.CreateIndex( - "IX_Devices_FireWireId", - "Devices", - "FireWireId"); + migrationBuilder.CreateIndex("IX_Devices_FireWireId", "Devices", "FireWireId"); - migrationBuilder.CreateIndex( - "IX_Devices_ModifiedWhen", - "Devices", - "ModifiedWhen"); + migrationBuilder.CreateIndex("IX_Devices_ModifiedWhen", "Devices", "ModifiedWhen"); - migrationBuilder.CreateIndex( - "IX_Devices_MultiMediaCardId", - "Devices", - "MultiMediaCardId"); + migrationBuilder.CreateIndex("IX_Devices_MultiMediaCardId", "Devices", "MultiMediaCardId"); - migrationBuilder.CreateIndex( - "IX_Devices_PCMCIAId", - "Devices", - "PCMCIAId"); + migrationBuilder.CreateIndex("IX_Devices_PCMCIAId", "Devices", "PCMCIAId"); - migrationBuilder.CreateIndex( - "IX_Devices_SCSIId", - "Devices", - "SCSIId"); + migrationBuilder.CreateIndex("IX_Devices_SCSIId", "Devices", "SCSIId"); - migrationBuilder.CreateIndex( - "IX_Devices_SecureDigitalId", - "Devices", - "SecureDigitalId"); + migrationBuilder.CreateIndex("IX_Devices_SecureDigitalId", "Devices", "SecureDigitalId"); - migrationBuilder.CreateIndex( - "IX_Devices_USBId", - "Devices", - "USBId"); + migrationBuilder.CreateIndex("IX_Devices_USBId", "Devices", "USBId"); - migrationBuilder.CreateIndex( - "IX_DeviceStats_ReportId", - "DeviceStats", - "ReportId"); + migrationBuilder.CreateIndex("IX_DeviceStats_ReportId", "DeviceStats", "ReportId"); - migrationBuilder.CreateIndex( - "IX_Mmc_FeaturesId", - "Mmc", - "FeaturesId"); + migrationBuilder.CreateIndex("IX_Mmc_FeaturesId", "Mmc", "FeaturesId"); - migrationBuilder.CreateIndex( - "IX_Reports_ATAId", - "Reports", - "ATAId"); + migrationBuilder.CreateIndex("IX_Reports_ATAId", "Reports", "ATAId"); - migrationBuilder.CreateIndex( - "IX_Reports_ATAPIId", - "Reports", - "ATAPIId"); + migrationBuilder.CreateIndex("IX_Reports_ATAPIId", "Reports", "ATAPIId"); - migrationBuilder.CreateIndex( - "IX_Reports_FireWireId", - "Reports", - "FireWireId"); + migrationBuilder.CreateIndex("IX_Reports_FireWireId", "Reports", "FireWireId"); - migrationBuilder.CreateIndex( - "IX_Reports_MultiMediaCardId", - "Reports", - "MultiMediaCardId"); + migrationBuilder.CreateIndex("IX_Reports_MultiMediaCardId", "Reports", "MultiMediaCardId"); - migrationBuilder.CreateIndex( - "IX_Reports_PCMCIAId", - "Reports", - "PCMCIAId"); + migrationBuilder.CreateIndex("IX_Reports_PCMCIAId", "Reports", "PCMCIAId"); - migrationBuilder.CreateIndex( - "IX_Reports_SCSIId", - "Reports", - "SCSIId"); + migrationBuilder.CreateIndex("IX_Reports_SCSIId", "Reports", "SCSIId"); - migrationBuilder.CreateIndex( - "IX_Reports_SecureDigitalId", - "Reports", - "SecureDigitalId"); + migrationBuilder.CreateIndex("IX_Reports_SecureDigitalId", "Reports", "SecureDigitalId"); - migrationBuilder.CreateIndex( - "IX_Reports_USBId", - "Reports", - "USBId"); + migrationBuilder.CreateIndex("IX_Reports_USBId", "Reports", "USBId"); - migrationBuilder.CreateIndex( - "IX_Scsi_ModeSenseId", - "Scsi", - "ModeSenseId"); + migrationBuilder.CreateIndex("IX_Scsi_ModeSenseId", "Scsi", "ModeSenseId"); - migrationBuilder.CreateIndex( - "IX_Scsi_MultiMediaDeviceId", - "Scsi", - "MultiMediaDeviceId"); + migrationBuilder.CreateIndex("IX_Scsi_MultiMediaDeviceId", "Scsi", "MultiMediaDeviceId"); - migrationBuilder.CreateIndex( - "IX_Scsi_ReadCapabilitiesId", - "Scsi", - "ReadCapabilitiesId"); + migrationBuilder.CreateIndex("IX_Scsi_ReadCapabilitiesId", "Scsi", "ReadCapabilitiesId"); - migrationBuilder.CreateIndex( - "IX_Scsi_SequentialDeviceId", - "Scsi", - "SequentialDeviceId"); + migrationBuilder.CreateIndex("IX_Scsi_SequentialDeviceId", "Scsi", "SequentialDeviceId"); - migrationBuilder.CreateIndex( - "IX_ScsiPage_ScsiId", - "ScsiPage", - "ScsiId"); + migrationBuilder.CreateIndex("IX_ScsiPage_ScsiId", "ScsiPage", "ScsiId"); - migrationBuilder.CreateIndex( - "IX_ScsiPage_ScsiModeId", - "ScsiPage", - "ScsiModeId"); + migrationBuilder.CreateIndex("IX_ScsiPage_ScsiModeId", "ScsiPage", "ScsiModeId"); - migrationBuilder.CreateIndex( - "IX_SscSupportedMedia_SscId", - "SscSupportedMedia", - "SscId"); + migrationBuilder.CreateIndex("IX_SscSupportedMedia_SscId", "SscSupportedMedia", "SscId"); - migrationBuilder.CreateIndex( - "IX_SscSupportedMedia_TestedSequentialMediaId", - "SscSupportedMedia", - "TestedSequentialMediaId"); + migrationBuilder.CreateIndex("IX_SscSupportedMedia_TestedSequentialMediaId", "SscSupportedMedia", + "TestedSequentialMediaId"); - migrationBuilder.CreateIndex( - "IX_SupportedDensity_SscId", - "SupportedDensity", - "SscId"); + migrationBuilder.CreateIndex("IX_SupportedDensity_SscId", "SupportedDensity", "SscId"); - migrationBuilder.CreateIndex( - "IX_SupportedDensity_TestedSequentialMediaId", - "SupportedDensity", - "TestedSequentialMediaId"); + migrationBuilder.CreateIndex("IX_SupportedDensity_TestedSequentialMediaId", "SupportedDensity", + "TestedSequentialMediaId"); - migrationBuilder.CreateIndex( - "IX_TestedMedia_AtaId", - "TestedMedia", - "AtaId"); + migrationBuilder.CreateIndex("IX_TestedMedia_AtaId", "TestedMedia", "AtaId"); - migrationBuilder.CreateIndex( - "IX_TestedMedia_CHSId", - "TestedMedia", - "CHSId"); + migrationBuilder.CreateIndex("IX_TestedMedia_CHSId", "TestedMedia", "CHSId"); - migrationBuilder.CreateIndex( - "IX_TestedMedia_CurrentCHSId", - "TestedMedia", - "CurrentCHSId"); + migrationBuilder.CreateIndex("IX_TestedMedia_CurrentCHSId", "TestedMedia", "CurrentCHSId"); - migrationBuilder.CreateIndex( - "IX_TestedMedia_MmcId", - "TestedMedia", - "MmcId"); + migrationBuilder.CreateIndex("IX_TestedMedia_MmcId", "TestedMedia", "MmcId"); - migrationBuilder.CreateIndex( - "IX_TestedMedia_ScsiId", - "TestedMedia", - "ScsiId"); + migrationBuilder.CreateIndex("IX_TestedMedia_ScsiId", "TestedMedia", "ScsiId"); - migrationBuilder.CreateIndex( - "IX_TestedSequentialMedia_SscId", - "TestedSequentialMedia", - "SscId"); + migrationBuilder.CreateIndex("IX_TestedSequentialMedia_SscId", "TestedSequentialMedia", "SscId"); - migrationBuilder.CreateIndex( - "IX_UsbProducts_ModifiedWhen", - "UsbProducts", - "ModifiedWhen"); + migrationBuilder.CreateIndex("IX_UsbProducts_ModifiedWhen", "UsbProducts", "ModifiedWhen"); - migrationBuilder.CreateIndex( - "IX_UsbProducts_ProductId", - "UsbProducts", - "ProductId"); + migrationBuilder.CreateIndex("IX_UsbProducts_ProductId", "UsbProducts", "ProductId"); - migrationBuilder.CreateIndex( - "IX_UsbProducts_VendorId", - "UsbProducts", - "VendorId"); + migrationBuilder.CreateIndex("IX_UsbProducts_VendorId", "UsbProducts", "VendorId"); - migrationBuilder.CreateIndex( - "IX_UsbVendors_ModifiedWhen", - "UsbVendors", - "ModifiedWhen"); + migrationBuilder.CreateIndex("IX_UsbVendors_ModifiedWhen", "UsbVendors", "ModifiedWhen"); - migrationBuilder.CreateIndex( - "IX_UsbVendors_VendorId", - "UsbVendors", - "VendorId", - unique: true); + migrationBuilder.CreateIndex("IX_UsbVendors_VendorId", "UsbVendors", "VendorId", unique: true); - migrationBuilder.AddForeignKey( - "FK_Devices_Ata_ATAId", - "Devices", - "ATAId", - "Ata", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey("FK_Devices_Ata_ATAId", "Devices", "ATAId", "Ata", principalColumn: "Id", + onDelete: ReferentialAction.Restrict); - migrationBuilder.AddForeignKey( - "FK_Devices_Ata_ATAPIId", - "Devices", - "ATAPIId", - "Ata", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey("FK_Devices_Ata_ATAPIId", "Devices", "ATAPIId", "Ata", principalColumn: "Id", + onDelete: ReferentialAction.Restrict); - migrationBuilder.AddForeignKey( - "FK_Devices_Scsi_SCSIId", - "Devices", - "SCSIId", - "Scsi", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey("FK_Devices_Scsi_SCSIId", "Devices", "SCSIId", "Scsi", principalColumn: "Id", + onDelete: ReferentialAction.Restrict); - migrationBuilder.AddForeignKey( - "FK_Reports_Ata_ATAId", - "Reports", - "ATAId", - "Ata", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey("FK_Reports_Ata_ATAId", "Reports", "ATAId", "Ata", principalColumn: "Id", + onDelete: ReferentialAction.Restrict); - migrationBuilder.AddForeignKey( - "FK_Reports_Ata_ATAPIId", - "Reports", - "ATAPIId", - "Ata", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey("FK_Reports_Ata_ATAPIId", "Reports", "ATAPIId", "Ata", principalColumn: "Id", + onDelete: ReferentialAction.Restrict); - migrationBuilder.Sql( - "DELETE FROM Reports WHERE NOT EXISTS(SELECT 1 from Scsi WHERE Scsi.Id = SCSIId) AND SCSIId IS NOT NULL"); + migrationBuilder. + Sql("DELETE FROM Reports WHERE NOT EXISTS(SELECT 1 from Scsi WHERE Scsi.Id = SCSIId) AND SCSIId IS NOT NULL"); - migrationBuilder.AddForeignKey( - "FK_Reports_Scsi_SCSIId", - "Reports", - "SCSIId", - "Scsi", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey("FK_Reports_Scsi_SCSIId", "Reports", "SCSIId", "Scsi", principalColumn: "Id", + onDelete: ReferentialAction.Restrict); - migrationBuilder.AddForeignKey( - "FK_TestedMedia_Ata_AtaId", - "TestedMedia", - "AtaId", - "Ata", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey("FK_TestedMedia_Ata_AtaId", "TestedMedia", "AtaId", "Ata", + principalColumn: "Id", onDelete: ReferentialAction.Restrict); - migrationBuilder.AddForeignKey( - "FK_TestedMedia_Scsi_ScsiId", - "TestedMedia", - "ScsiId", - "Scsi", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey("FK_TestedMedia_Scsi_ScsiId", "TestedMedia", "ScsiId", "Scsi", + principalColumn: "Id", onDelete: ReferentialAction.Restrict); - if (EFExists) + if(EFExists) migrationBuilder.DropTable("__MigrationHistory"); } protected override void Down(MigrationBuilder migrationBuilder) { - migrationBuilder.DropForeignKey( - "FK_Ata_TestedMedia_ReadCapabilitiesId", - "Ata"); + migrationBuilder.DropForeignKey("FK_Ata_TestedMedia_ReadCapabilitiesId", "Ata"); - migrationBuilder.DropForeignKey( - "FK_Scsi_TestedMedia_ReadCapabilitiesId", - "Scsi"); + migrationBuilder.DropForeignKey("FK_Scsi_TestedMedia_ReadCapabilitiesId", "Scsi"); - migrationBuilder.DropTable( - "BlockDescriptor"); + migrationBuilder.DropTable("BlockDescriptor"); - migrationBuilder.DropTable( - "Commands"); + migrationBuilder.DropTable("Commands"); - migrationBuilder.DropTable( - "DensityCode"); + migrationBuilder.DropTable("DensityCode"); - migrationBuilder.DropTable( - "DeviceStats"); + migrationBuilder.DropTable("DeviceStats"); - migrationBuilder.DropTable( - "Filesystems"); + migrationBuilder.DropTable("Filesystems"); - migrationBuilder.DropTable( - "Filters"); + migrationBuilder.DropTable("Filters"); - migrationBuilder.DropTable( - "MediaFormats"); + migrationBuilder.DropTable("MediaFormats"); - migrationBuilder.DropTable( - "Medias"); + migrationBuilder.DropTable("Medias"); - migrationBuilder.DropTable( - "OperatingSystems"); + migrationBuilder.DropTable("OperatingSystems"); - migrationBuilder.DropTable( - "Partitions"); + migrationBuilder.DropTable("Partitions"); - migrationBuilder.DropTable( - "Reports"); + migrationBuilder.DropTable("Reports"); - migrationBuilder.DropTable( - "ScsiPage"); + migrationBuilder.DropTable("ScsiPage"); - migrationBuilder.DropTable( - "SupportedDensity"); + migrationBuilder.DropTable("SupportedDensity"); - migrationBuilder.DropTable( - "UsbProducts"); + migrationBuilder.DropTable("UsbProducts"); - migrationBuilder.DropTable( - "Versions"); + migrationBuilder.DropTable("Versions"); - migrationBuilder.DropTable( - "SscSupportedMedia"); + migrationBuilder.DropTable("SscSupportedMedia"); - migrationBuilder.DropTable( - "Devices"); + migrationBuilder.DropTable("Devices"); - migrationBuilder.DropTable( - "UsbVendors"); + migrationBuilder.DropTable("UsbVendors"); - migrationBuilder.DropTable( - "TestedSequentialMedia"); + migrationBuilder.DropTable("TestedSequentialMedia"); - migrationBuilder.DropTable( - "CdOffsets"); + migrationBuilder.DropTable("CdOffsets"); - migrationBuilder.DropTable( - "FireWire"); + migrationBuilder.DropTable("FireWire"); - migrationBuilder.DropTable( - "MmcSd"); + migrationBuilder.DropTable("MmcSd"); - migrationBuilder.DropTable( - "Pcmcia"); + migrationBuilder.DropTable("Pcmcia"); - migrationBuilder.DropTable( - "Usb"); + migrationBuilder.DropTable("Usb"); - migrationBuilder.DropTable( - "TestedMedia"); + migrationBuilder.DropTable("TestedMedia"); - migrationBuilder.DropTable( - "Ata"); + migrationBuilder.DropTable("Ata"); - migrationBuilder.DropTable( - "Chs"); + migrationBuilder.DropTable("Chs"); - migrationBuilder.DropTable( - "Scsi"); + migrationBuilder.DropTable("Scsi"); - migrationBuilder.DropTable( - "ScsiMode"); + migrationBuilder.DropTable("ScsiMode"); - migrationBuilder.DropTable( - "Mmc"); + migrationBuilder.DropTable("Mmc"); - migrationBuilder.DropTable( - "Ssc"); + migrationBuilder.DropTable("Ssc"); - migrationBuilder.DropTable( - "MmcFeatures"); + migrationBuilder.DropTable("MmcFeatures"); } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Migrations/20191102231633_MakeFieldsUnsigned.cs b/DiscImageChef.Server/Migrations/20191102231633_MakeFieldsUnsigned.cs index bf5430d4..8f1ca026 100644 --- a/DiscImageChef.Server/Migrations/20191102231633_MakeFieldsUnsigned.cs +++ b/DiscImageChef.Server/Migrations/20191102231633_MakeFieldsUnsigned.cs @@ -6,379 +6,160 @@ namespace DiscImageChef.Server.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.DropColumn( - name: "ProductIDSql", - table: "Usb"); + migrationBuilder.DropColumn("ProductIDSql", "Usb"); - migrationBuilder.DropColumn( - name: "VendorIDSql", - table: "Usb"); + migrationBuilder.DropColumn("VendorIDSql", "Usb"); - migrationBuilder.DropColumn( - name: "BlockSizeSql", - table: "TestedMedia"); + migrationBuilder.DropColumn("BlockSizeSql", "TestedMedia"); - migrationBuilder.DropColumn( - name: "BlocksSql", - table: "TestedMedia"); + migrationBuilder.DropColumn("BlocksSql", "TestedMedia"); - migrationBuilder.DropColumn( - name: "LBA48SectorsSql", - table: "TestedMedia"); + migrationBuilder.DropColumn("LBA48SectorsSql", "TestedMedia"); - migrationBuilder.DropColumn( - name: "LBASectorsSql", - table: "TestedMedia"); + migrationBuilder.DropColumn("LBASectorsSql", "TestedMedia"); - migrationBuilder.DropColumn( - name: "LogicalAlignmentSql", - table: "TestedMedia"); + migrationBuilder.DropColumn("LogicalAlignmentSql", "TestedMedia"); - migrationBuilder.DropColumn( - name: "LongBlockSizeSql", - table: "TestedMedia"); + migrationBuilder.DropColumn("LongBlockSizeSql", "TestedMedia"); - migrationBuilder.DropColumn( - name: "NominalRotationRateSql", - table: "TestedMedia"); + migrationBuilder.DropColumn("NominalRotationRateSql", "TestedMedia"); - migrationBuilder.DropColumn( - name: "PhysicalBlockSizeSql", - table: "TestedMedia"); + migrationBuilder.DropColumn("PhysicalBlockSizeSql", "TestedMedia"); - migrationBuilder.DropColumn( - name: "UnformattedBPSSql", - table: "TestedMedia"); + migrationBuilder.DropColumn("UnformattedBPSSql", "TestedMedia"); - migrationBuilder.DropColumn( - name: "UnformattedBPTSql", - table: "TestedMedia"); + migrationBuilder.DropColumn("UnformattedBPTSql", "TestedMedia"); - migrationBuilder.DropColumn( - name: "BitsPerMmSql", - table: "SupportedDensity"); + migrationBuilder.DropColumn("BitsPerMmSql", "SupportedDensity"); - migrationBuilder.DropColumn( - name: "CapacitySql", - table: "SupportedDensity"); + migrationBuilder.DropColumn("CapacitySql", "SupportedDensity"); - migrationBuilder.DropColumn( - name: "TracksSql", - table: "SupportedDensity"); + migrationBuilder.DropColumn("TracksSql", "SupportedDensity"); - migrationBuilder.DropColumn( - name: "WidthSql", - table: "SupportedDensity"); + migrationBuilder.DropColumn("WidthSql", "SupportedDensity"); - migrationBuilder.DropColumn( - name: "LengthSql", - table: "SscSupportedMedia"); + migrationBuilder.DropColumn("LengthSql", "SscSupportedMedia"); - migrationBuilder.DropColumn( - name: "WidthSql", - table: "SscSupportedMedia"); + migrationBuilder.DropColumn("WidthSql", "SscSupportedMedia"); - migrationBuilder.DropColumn( - name: "MaxBlockLengthSql", - table: "Ssc"); + migrationBuilder.DropColumn("MaxBlockLengthSql", "Ssc"); - migrationBuilder.DropColumn( - name: "MinBlockLengthSql", - table: "Ssc"); + migrationBuilder.DropColumn("MinBlockLengthSql", "Ssc"); - migrationBuilder.DropColumn( - name: "CardCodeSql", - table: "Pcmcia"); + migrationBuilder.DropColumn("CardCodeSql", "Pcmcia"); - migrationBuilder.DropColumn( - name: "ManufacturerCodeSql", - table: "Pcmcia"); + migrationBuilder.DropColumn("ManufacturerCodeSql", "Pcmcia"); - migrationBuilder.DropColumn( - name: "BlocksPerReadableUnitSql", - table: "MmcFeatures"); + migrationBuilder.DropColumn("BlocksPerReadableUnitSql", "MmcFeatures"); - migrationBuilder.DropColumn( - name: "LogicalBlockSizeSql", - table: "MmcFeatures"); + migrationBuilder.DropColumn("LogicalBlockSizeSql", "MmcFeatures"); - migrationBuilder.DropColumn( - name: "PhysicalInterfaceStandardNumberSql", - table: "MmcFeatures"); + migrationBuilder.DropColumn("PhysicalInterfaceStandardNumberSql", "MmcFeatures"); - migrationBuilder.DropColumn( - name: "VolumeLevelsSql", - table: "MmcFeatures"); + migrationBuilder.DropColumn("VolumeLevelsSql", "MmcFeatures"); - migrationBuilder.DropColumn( - name: "ProductIDSql", - table: "FireWire"); + migrationBuilder.DropColumn("ProductIDSql", "FireWire"); - migrationBuilder.DropColumn( - name: "VendorIDSql", - table: "FireWire"); + migrationBuilder.DropColumn("VendorIDSql", "FireWire"); - migrationBuilder.DropColumn( - name: "CylindersSql", - table: "Chs"); + migrationBuilder.DropColumn("CylindersSql", "Chs"); - migrationBuilder.DropColumn( - name: "HeadsSql", - table: "Chs"); + migrationBuilder.DropColumn("HeadsSql", "Chs"); - migrationBuilder.DropColumn( - name: "SectorsSql", - table: "Chs"); + migrationBuilder.DropColumn("SectorsSql", "Chs"); - migrationBuilder.DropColumn( - name: "BlockLengthSql", - table: "BlockDescriptor"); + migrationBuilder.DropColumn("BlockLengthSql", "BlockDescriptor"); - migrationBuilder.DropColumn( - name: "BlocksSql", - table: "BlockDescriptor"); + migrationBuilder.DropColumn("BlocksSql", "BlockDescriptor"); - migrationBuilder.AlterColumn( - name: "VendorId", - table: "UsbVendors", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); + migrationBuilder.AlterColumn("VendorId", "UsbVendors", nullable: false, oldClrType: typeof(int), + oldType: "int"); - migrationBuilder.AlterColumn( - name: "ProductId", - table: "UsbProducts", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); + migrationBuilder.AlterColumn("ProductId", "UsbProducts", nullable: false, oldClrType: typeof(int), + oldType: "int"); } protected override void Down(MigrationBuilder migrationBuilder) { - migrationBuilder.AlterColumn( - name: "VendorId", - table: "UsbVendors", - type: "int", - nullable: false, - oldClrType: typeof(ushort)); + migrationBuilder.AlterColumn("VendorId", "UsbVendors", "int", nullable: false, + oldClrType: typeof(ushort)); - migrationBuilder.AlterColumn( - name: "ProductId", - table: "UsbProducts", - type: "int", - nullable: false, - oldClrType: typeof(ushort)); + migrationBuilder.AlterColumn("ProductId", "UsbProducts", "int", nullable: false, + oldClrType: typeof(ushort)); - migrationBuilder.AddColumn( - name: "ProductIDSql", - table: "Usb", - type: "smallint", - nullable: false, - defaultValue: (short)0); + migrationBuilder.AddColumn("ProductIDSql", "Usb", "smallint", nullable: false, + defaultValue: (short)0); - migrationBuilder.AddColumn( - name: "VendorIDSql", - table: "Usb", - type: "smallint", - nullable: false, - defaultValue: (short)0); + migrationBuilder.AddColumn("VendorIDSql", "Usb", "smallint", nullable: false, + defaultValue: (short)0); - migrationBuilder.AddColumn( - name: "BlockSizeSql", - table: "TestedMedia", - type: "int", - nullable: true); + migrationBuilder.AddColumn("BlockSizeSql", "TestedMedia", "int", nullable: true); - migrationBuilder.AddColumn( - name: "BlocksSql", - table: "TestedMedia", - type: "bigint", - nullable: true); + migrationBuilder.AddColumn("BlocksSql", "TestedMedia", "bigint", nullable: true); - migrationBuilder.AddColumn( - name: "LBA48SectorsSql", - table: "TestedMedia", - type: "bigint", - nullable: true); + migrationBuilder.AddColumn("LBA48SectorsSql", "TestedMedia", "bigint", nullable: true); - migrationBuilder.AddColumn( - name: "LBASectorsSql", - table: "TestedMedia", - type: "int", - nullable: true); + migrationBuilder.AddColumn("LBASectorsSql", "TestedMedia", "int", nullable: true); - migrationBuilder.AddColumn( - name: "LogicalAlignmentSql", - table: "TestedMedia", - type: "smallint", - nullable: true); + migrationBuilder.AddColumn("LogicalAlignmentSql", "TestedMedia", "smallint", nullable: true); - migrationBuilder.AddColumn( - name: "LongBlockSizeSql", - table: "TestedMedia", - type: "int", - nullable: true); + migrationBuilder.AddColumn("LongBlockSizeSql", "TestedMedia", "int", nullable: true); - migrationBuilder.AddColumn( - name: "NominalRotationRateSql", - table: "TestedMedia", - type: "smallint", - nullable: true); + migrationBuilder.AddColumn("NominalRotationRateSql", "TestedMedia", "smallint", nullable: true); - migrationBuilder.AddColumn( - name: "PhysicalBlockSizeSql", - table: "TestedMedia", - type: "int", - nullable: true); + migrationBuilder.AddColumn("PhysicalBlockSizeSql", "TestedMedia", "int", nullable: true); - migrationBuilder.AddColumn( - name: "UnformattedBPSSql", - table: "TestedMedia", - type: "smallint", - nullable: true); + migrationBuilder.AddColumn("UnformattedBPSSql", "TestedMedia", "smallint", nullable: true); - migrationBuilder.AddColumn( - name: "UnformattedBPTSql", - table: "TestedMedia", - type: "smallint", - nullable: true); + migrationBuilder.AddColumn("UnformattedBPTSql", "TestedMedia", "smallint", nullable: true); - migrationBuilder.AddColumn( - name: "BitsPerMmSql", - table: "SupportedDensity", - type: "int", - nullable: false, - defaultValue: 0); + migrationBuilder.AddColumn("BitsPerMmSql", "SupportedDensity", "int", nullable: false, + defaultValue: 0); - migrationBuilder.AddColumn( - name: "CapacitySql", - table: "SupportedDensity", - type: "int", - nullable: false, - defaultValue: 0); + migrationBuilder.AddColumn("CapacitySql", "SupportedDensity", "int", nullable: false, defaultValue: 0); - migrationBuilder.AddColumn( - name: "TracksSql", - table: "SupportedDensity", - type: "smallint", - nullable: false, - defaultValue: (short)0); + migrationBuilder.AddColumn("TracksSql", "SupportedDensity", "smallint", nullable: false, + defaultValue: (short)0); - migrationBuilder.AddColumn( - name: "WidthSql", - table: "SupportedDensity", - type: "smallint", - nullable: false, - defaultValue: (short)0); + migrationBuilder.AddColumn("WidthSql", "SupportedDensity", "smallint", nullable: false, + defaultValue: (short)0); - migrationBuilder.AddColumn( - name: "LengthSql", - table: "SscSupportedMedia", - type: "smallint", - nullable: false, - defaultValue: (short)0); + migrationBuilder.AddColumn("LengthSql", "SscSupportedMedia", "smallint", nullable: false, + defaultValue: (short)0); - migrationBuilder.AddColumn( - name: "WidthSql", - table: "SscSupportedMedia", - type: "smallint", - nullable: false, - defaultValue: (short)0); + migrationBuilder.AddColumn("WidthSql", "SscSupportedMedia", "smallint", nullable: false, + defaultValue: (short)0); - migrationBuilder.AddColumn( - name: "MaxBlockLengthSql", - table: "Ssc", - type: "int", - nullable: true); + migrationBuilder.AddColumn("MaxBlockLengthSql", "Ssc", "int", nullable: true); - migrationBuilder.AddColumn( - name: "MinBlockLengthSql", - table: "Ssc", - type: "int", - nullable: true); + migrationBuilder.AddColumn("MinBlockLengthSql", "Ssc", "int", nullable: true); - migrationBuilder.AddColumn( - name: "CardCodeSql", - table: "Pcmcia", - type: "smallint", - nullable: true); + migrationBuilder.AddColumn("CardCodeSql", "Pcmcia", "smallint", nullable: true); - migrationBuilder.AddColumn( - name: "ManufacturerCodeSql", - table: "Pcmcia", - type: "smallint", - nullable: true); + migrationBuilder.AddColumn("ManufacturerCodeSql", "Pcmcia", "smallint", nullable: true); - migrationBuilder.AddColumn( - name: "BlocksPerReadableUnitSql", - table: "MmcFeatures", - type: "smallint", - nullable: true); + migrationBuilder.AddColumn("BlocksPerReadableUnitSql", "MmcFeatures", "smallint", nullable: true); - migrationBuilder.AddColumn( - name: "LogicalBlockSizeSql", - table: "MmcFeatures", - type: "int", - nullable: true); + migrationBuilder.AddColumn("LogicalBlockSizeSql", "MmcFeatures", "int", nullable: true); - migrationBuilder.AddColumn( - name: "PhysicalInterfaceStandardNumberSql", - table: "MmcFeatures", - type: "int", - nullable: true); + migrationBuilder.AddColumn("PhysicalInterfaceStandardNumberSql", "MmcFeatures", "int", nullable: true); - migrationBuilder.AddColumn( - name: "VolumeLevelsSql", - table: "MmcFeatures", - type: "smallint", - nullable: true); + migrationBuilder.AddColumn("VolumeLevelsSql", "MmcFeatures", "smallint", nullable: true); - migrationBuilder.AddColumn( - name: "ProductIDSql", - table: "FireWire", - type: "int", - nullable: false, - defaultValue: 0); + migrationBuilder.AddColumn("ProductIDSql", "FireWire", "int", nullable: false, defaultValue: 0); - migrationBuilder.AddColumn( - name: "VendorIDSql", - table: "FireWire", - type: "int", - nullable: false, - defaultValue: 0); + migrationBuilder.AddColumn("VendorIDSql", "FireWire", "int", nullable: false, defaultValue: 0); - migrationBuilder.AddColumn( - name: "CylindersSql", - table: "Chs", - type: "smallint", - nullable: false, - defaultValue: (short)0); + migrationBuilder.AddColumn("CylindersSql", "Chs", "smallint", nullable: false, + defaultValue: (short)0); - migrationBuilder.AddColumn( - name: "HeadsSql", - table: "Chs", - type: "smallint", - nullable: false, - defaultValue: (short)0); + migrationBuilder.AddColumn("HeadsSql", "Chs", "smallint", nullable: false, defaultValue: (short)0); - migrationBuilder.AddColumn( - name: "SectorsSql", - table: "Chs", - type: "smallint", - nullable: false, - defaultValue: (short)0); + migrationBuilder.AddColumn("SectorsSql", "Chs", "smallint", nullable: false, defaultValue: (short)0); - migrationBuilder.AddColumn( - name: "BlockLengthSql", - table: "BlockDescriptor", - type: "int", - nullable: true); + migrationBuilder.AddColumn("BlockLengthSql", "BlockDescriptor", "int", nullable: true); - migrationBuilder.AddColumn( - name: "BlocksSql", - table: "BlockDescriptor", - type: "bigint", - nullable: true); + migrationBuilder.AddColumn("BlocksSql", "BlockDescriptor", "bigint", nullable: true); } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/Migrations/DicServerContextModelSnapshot.cs b/DiscImageChef.Server/Migrations/DicServerContextModelSnapshot.cs index c3976950..e77d42b4 100644 --- a/DiscImageChef.Server/Migrations/DicServerContextModelSnapshot.cs +++ b/DiscImageChef.Server/Migrations/DicServerContextModelSnapshot.cs @@ -1,1997 +1,1430 @@ // + using System; using DiscImageChef.Server.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace DiscImageChef.Server.Migrations { [DbContext(typeof(DicServerContext))] - partial class DicServerContextModelSnapshot : ModelSnapshot + internal class DicServerContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 64); + #pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "3.0.0").HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Ata", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Identify") - .HasColumnType("longblob"); + b.Property("Identify").HasColumnType("longblob"); - b.Property("ReadCapabilitiesId") - .HasColumnType("int"); + b.Property("ReadCapabilitiesId").HasColumnType("int"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ReadCapabilitiesId"); + b.HasIndex("ReadCapabilitiesId"); - b.ToTable("Ata"); - }); + b.ToTable("Ata"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.BlockDescriptor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("BlockLength") - .HasColumnType("int unsigned"); + b.Property("BlockLength").HasColumnType("int unsigned"); - b.Property("Blocks") - .HasColumnType("bigint unsigned"); + b.Property("Blocks").HasColumnType("bigint unsigned"); - b.Property("Density") - .HasColumnType("tinyint unsigned"); + b.Property("Density").HasColumnType("tinyint unsigned"); - b.Property("ScsiModeId") - .HasColumnType("int"); + b.Property("ScsiModeId").HasColumnType("int"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ScsiModeId"); + b.HasIndex("ScsiModeId"); - b.ToTable("BlockDescriptor"); - }); + b.ToTable("BlockDescriptor"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Chs", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Cylinders") - .HasColumnType("smallint unsigned"); + b.Property("Cylinders").HasColumnType("smallint unsigned"); - b.Property("Heads") - .HasColumnType("smallint unsigned"); + b.Property("Heads").HasColumnType("smallint unsigned"); - b.Property("Sectors") - .HasColumnType("smallint unsigned"); + b.Property("Sectors").HasColumnType("smallint unsigned"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Chs"); - }); + b.ToTable("Chs"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.DensityCode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Code") - .HasColumnType("int"); + b.Property("Code").HasColumnType("int"); - b.Property("SscSupportedMediaId") - .HasColumnType("int"); + b.Property("SscSupportedMediaId").HasColumnType("int"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("SscSupportedMediaId"); + b.HasIndex("SscSupportedMediaId"); - b.ToTable("DensityCode"); - }); + b.ToTable("DensityCode"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.FireWire", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Manufacturer") - .HasColumnType("longtext"); + b.Property("Manufacturer").HasColumnType("longtext"); - b.Property("Product") - .HasColumnType("longtext"); + b.Property("Product").HasColumnType("longtext"); - b.Property("ProductID") - .HasColumnType("int unsigned"); + b.Property("ProductID").HasColumnType("int unsigned"); - b.Property("RemovableMedia") - .HasColumnType("bit"); + b.Property("RemovableMedia").HasColumnType("bit"); - b.Property("VendorID") - .HasColumnType("int unsigned"); + b.Property("VendorID").HasColumnType("int unsigned"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("FireWire"); - }); + b.ToTable("FireWire"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Mmc", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("FeaturesId") - .HasColumnType("int"); + b.Property("FeaturesId").HasColumnType("int"); - b.Property("ModeSense2AData") - .HasColumnType("longblob"); + b.Property("ModeSense2AData").HasColumnType("longblob"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("FeaturesId"); + b.HasIndex("FeaturesId"); - b.ToTable("Mmc"); - }); + b.ToTable("Mmc"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.MmcFeatures", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("AACSVersion") - .HasColumnType("tinyint unsigned"); + b.Property("AACSVersion").HasColumnType("tinyint unsigned"); - b.Property("AGIDs") - .HasColumnType("tinyint unsigned"); + b.Property("AGIDs").HasColumnType("tinyint unsigned"); - b.Property("BinaryData") - .HasColumnType("longblob"); + b.Property("BinaryData").HasColumnType("longblob"); - b.Property("BindingNonceBlocks") - .HasColumnType("tinyint unsigned"); + b.Property("BindingNonceBlocks").HasColumnType("tinyint unsigned"); - b.Property("BlocksPerReadableUnit") - .HasColumnType("smallint unsigned"); + b.Property("BlocksPerReadableUnit").HasColumnType("smallint unsigned"); - b.Property("BufferUnderrunFreeInDVD") - .HasColumnType("bit"); + b.Property("BufferUnderrunFreeInDVD").HasColumnType("bit"); - b.Property("BufferUnderrunFreeInSAO") - .HasColumnType("bit"); + b.Property("BufferUnderrunFreeInSAO").HasColumnType("bit"); - b.Property("BufferUnderrunFreeInTAO") - .HasColumnType("bit"); + b.Property("BufferUnderrunFreeInTAO").HasColumnType("bit"); - b.Property("CPRMVersion") - .HasColumnType("tinyint unsigned"); + b.Property("CPRMVersion").HasColumnType("tinyint unsigned"); - b.Property("CSSVersion") - .HasColumnType("tinyint unsigned"); + b.Property("CSSVersion").HasColumnType("tinyint unsigned"); - b.Property("CanAudioScan") - .HasColumnType("bit"); + b.Property("CanAudioScan").HasColumnType("bit"); - b.Property("CanEject") - .HasColumnType("bit"); + b.Property("CanEject").HasColumnType("bit"); - b.Property("CanEraseSector") - .HasColumnType("bit"); + b.Property("CanEraseSector").HasColumnType("bit"); - b.Property("CanExpandBDRESpareArea") - .HasColumnType("bit"); + b.Property("CanExpandBDRESpareArea").HasColumnType("bit"); - b.Property("CanFormat") - .HasColumnType("bit"); + b.Property("CanFormat").HasColumnType("bit"); - b.Property("CanFormatBDREWithoutSpare") - .HasColumnType("bit"); + b.Property("CanFormatBDREWithoutSpare").HasColumnType("bit"); - b.Property("CanFormatCert") - .HasColumnType("bit"); + b.Property("CanFormatCert").HasColumnType("bit"); - b.Property("CanFormatFRF") - .HasColumnType("bit"); + b.Property("CanFormatFRF").HasColumnType("bit"); - b.Property("CanFormatQCert") - .HasColumnType("bit"); + b.Property("CanFormatQCert").HasColumnType("bit"); - b.Property("CanFormatRRM") - .HasColumnType("bit"); + b.Property("CanFormatRRM").HasColumnType("bit"); - b.Property("CanGenerateBindingNonce") - .HasColumnType("bit"); + b.Property("CanGenerateBindingNonce").HasColumnType("bit"); - b.Property("CanLoad") - .HasColumnType("bit"); + b.Property("CanLoad").HasColumnType("bit"); - b.Property("CanMuteSeparateChannels") - .HasColumnType("bit"); + b.Property("CanMuteSeparateChannels").HasColumnType("bit"); - b.Property("CanOverwriteSAOTrack") - .HasColumnType("bit"); + b.Property("CanOverwriteSAOTrack").HasColumnType("bit"); - b.Property("CanOverwriteTAOTrack") - .HasColumnType("bit"); + b.Property("CanOverwriteTAOTrack").HasColumnType("bit"); - b.Property("CanPlayCDAudio") - .HasColumnType("bit"); + b.Property("CanPlayCDAudio").HasColumnType("bit"); - b.Property("CanPseudoOverwriteBDR") - .HasColumnType("bit"); + b.Property("CanPseudoOverwriteBDR").HasColumnType("bit"); - b.Property("CanReadAllDualR") - .HasColumnType("bit"); + b.Property("CanReadAllDualR").HasColumnType("bit"); - b.Property("CanReadAllDualRW") - .HasColumnType("bit"); + b.Property("CanReadAllDualRW").HasColumnType("bit"); - b.Property("CanReadBD") - .HasColumnType("bit"); + b.Property("CanReadBD").HasColumnType("bit"); - b.Property("CanReadBDR") - .HasColumnType("bit"); + b.Property("CanReadBDR").HasColumnType("bit"); - b.Property("CanReadBDRE1") - .HasColumnType("bit"); + b.Property("CanReadBDRE1").HasColumnType("bit"); - b.Property("CanReadBDRE2") - .HasColumnType("bit"); + b.Property("CanReadBDRE2").HasColumnType("bit"); - b.Property("CanReadBDROM") - .HasColumnType("bit"); + b.Property("CanReadBDROM").HasColumnType("bit"); - b.Property("CanReadBluBCA") - .HasColumnType("bit"); + b.Property("CanReadBluBCA").HasColumnType("bit"); - b.Property("CanReadCD") - .HasColumnType("bit"); + b.Property("CanReadCD").HasColumnType("bit"); - b.Property("CanReadCDMRW") - .HasColumnType("bit"); + b.Property("CanReadCDMRW").HasColumnType("bit"); - b.Property("CanReadCPRM_MKB") - .HasColumnType("bit"); + b.Property("CanReadCPRM_MKB").HasColumnType("bit"); - b.Property("CanReadDDCD") - .HasColumnType("bit"); + b.Property("CanReadDDCD").HasColumnType("bit"); - b.Property("CanReadDVD") - .HasColumnType("bit"); + b.Property("CanReadDVD").HasColumnType("bit"); - b.Property("CanReadDVDPlusMRW") - .HasColumnType("bit"); + b.Property("CanReadDVDPlusMRW").HasColumnType("bit"); - b.Property("CanReadDVDPlusR") - .HasColumnType("bit"); + b.Property("CanReadDVDPlusR").HasColumnType("bit"); - b.Property("CanReadDVDPlusRDL") - .HasColumnType("bit"); + b.Property("CanReadDVDPlusRDL").HasColumnType("bit"); - b.Property("CanReadDVDPlusRW") - .HasColumnType("bit"); + b.Property("CanReadDVDPlusRW").HasColumnType("bit"); - b.Property("CanReadDVDPlusRWDL") - .HasColumnType("bit"); + b.Property("CanReadDVDPlusRWDL").HasColumnType("bit"); - b.Property("CanReadDriveAACSCertificate") - .HasColumnType("bit"); + b.Property("CanReadDriveAACSCertificate").HasColumnType("bit"); - b.Property("CanReadHDDVD") - .HasColumnType("bit"); + b.Property("CanReadHDDVD").HasColumnType("bit"); - b.Property("CanReadHDDVDR") - .HasColumnType("bit"); + b.Property("CanReadHDDVDR").HasColumnType("bit"); - b.Property("CanReadHDDVDRAM") - .HasColumnType("bit"); + b.Property("CanReadHDDVDRAM").HasColumnType("bit"); - b.Property("CanReadLeadInCDText") - .HasColumnType("bit"); + b.Property("CanReadLeadInCDText").HasColumnType("bit"); - b.Property("CanReadOldBDR") - .HasColumnType("bit"); + b.Property("CanReadOldBDR").HasColumnType("bit"); - b.Property("CanReadOldBDRE") - .HasColumnType("bit"); + b.Property("CanReadOldBDRE").HasColumnType("bit"); - b.Property("CanReadOldBDROM") - .HasColumnType("bit"); + b.Property("CanReadOldBDROM").HasColumnType("bit"); - b.Property("CanReadSpareAreaInformation") - .HasColumnType("bit"); + b.Property("CanReadSpareAreaInformation").HasColumnType("bit"); - b.Property("CanReportDriveSerial") - .HasColumnType("bit"); + b.Property("CanReportDriveSerial").HasColumnType("bit"); - b.Property("CanReportMediaSerial") - .HasColumnType("bit"); + b.Property("CanReportMediaSerial").HasColumnType("bit"); - b.Property("CanTestWriteDDCDR") - .HasColumnType("bit"); + b.Property("CanTestWriteDDCDR").HasColumnType("bit"); - b.Property("CanTestWriteDVD") - .HasColumnType("bit"); + b.Property("CanTestWriteDVD").HasColumnType("bit"); - b.Property("CanTestWriteInSAO") - .HasColumnType("bit"); + b.Property("CanTestWriteInSAO").HasColumnType("bit"); - b.Property("CanTestWriteInTAO") - .HasColumnType("bit"); + b.Property("CanTestWriteInTAO").HasColumnType("bit"); - b.Property("CanUpgradeFirmware") - .HasColumnType("bit"); + b.Property("CanUpgradeFirmware").HasColumnType("bit"); - b.Property("CanWriteBD") - .HasColumnType("bit"); + b.Property("CanWriteBD").HasColumnType("bit"); - b.Property("CanWriteBDR") - .HasColumnType("bit"); + b.Property("CanWriteBDR").HasColumnType("bit"); - b.Property("CanWriteBDRE1") - .HasColumnType("bit"); + b.Property("CanWriteBDRE1").HasColumnType("bit"); - b.Property("CanWriteBDRE2") - .HasColumnType("bit"); + b.Property("CanWriteBDRE2").HasColumnType("bit"); - b.Property("CanWriteBusEncryptedBlocks") - .HasColumnType("bit"); + b.Property("CanWriteBusEncryptedBlocks").HasColumnType("bit"); - b.Property("CanWriteCDMRW") - .HasColumnType("bit"); + b.Property("CanWriteCDMRW").HasColumnType("bit"); - b.Property("CanWriteCDRW") - .HasColumnType("bit"); + b.Property("CanWriteCDRW").HasColumnType("bit"); - b.Property("CanWriteCDRWCAV") - .HasColumnType("bit"); + b.Property("CanWriteCDRWCAV").HasColumnType("bit"); - b.Property("CanWriteCDSAO") - .HasColumnType("bit"); + b.Property("CanWriteCDSAO").HasColumnType("bit"); - b.Property("CanWriteCDTAO") - .HasColumnType("bit"); + b.Property("CanWriteCDTAO").HasColumnType("bit"); - b.Property("CanWriteCSSManagedDVD") - .HasColumnType("bit"); + b.Property("CanWriteCSSManagedDVD").HasColumnType("bit"); - b.Property("CanWriteDDCDR") - .HasColumnType("bit"); + b.Property("CanWriteDDCDR").HasColumnType("bit"); - b.Property("CanWriteDDCDRW") - .HasColumnType("bit"); + b.Property("CanWriteDDCDRW").HasColumnType("bit"); - b.Property("CanWriteDVDPlusMRW") - .HasColumnType("bit"); + b.Property("CanWriteDVDPlusMRW").HasColumnType("bit"); - b.Property("CanWriteDVDPlusR") - .HasColumnType("bit"); + b.Property("CanWriteDVDPlusR").HasColumnType("bit"); - b.Property("CanWriteDVDPlusRDL") - .HasColumnType("bit"); + b.Property("CanWriteDVDPlusRDL").HasColumnType("bit"); - b.Property("CanWriteDVDPlusRW") - .HasColumnType("bit"); + b.Property("CanWriteDVDPlusRW").HasColumnType("bit"); - b.Property("CanWriteDVDPlusRWDL") - .HasColumnType("bit"); + b.Property("CanWriteDVDPlusRWDL").HasColumnType("bit"); - b.Property("CanWriteDVDR") - .HasColumnType("bit"); + b.Property("CanWriteDVDR").HasColumnType("bit"); - b.Property("CanWriteDVDRDL") - .HasColumnType("bit"); + b.Property("CanWriteDVDRDL").HasColumnType("bit"); - b.Property("CanWriteDVDRW") - .HasColumnType("bit"); + b.Property("CanWriteDVDRW").HasColumnType("bit"); - b.Property("CanWriteHDDVDR") - .HasColumnType("bit"); + b.Property("CanWriteHDDVDR").HasColumnType("bit"); - b.Property("CanWriteHDDVDRAM") - .HasColumnType("bit"); + b.Property("CanWriteHDDVDRAM").HasColumnType("bit"); - b.Property("CanWriteOldBDR") - .HasColumnType("bit"); + b.Property("CanWriteOldBDR").HasColumnType("bit"); - b.Property("CanWriteOldBDRE") - .HasColumnType("bit"); + b.Property("CanWriteOldBDRE").HasColumnType("bit"); - b.Property("CanWritePackedSubchannelInTAO") - .HasColumnType("bit"); + b.Property("CanWritePackedSubchannelInTAO").HasColumnType("bit"); - b.Property("CanWriteRWSubchannelInSAO") - .HasColumnType("bit"); + b.Property("CanWriteRWSubchannelInSAO").HasColumnType("bit"); - b.Property("CanWriteRWSubchannelInTAO") - .HasColumnType("bit"); + b.Property("CanWriteRWSubchannelInTAO").HasColumnType("bit"); - b.Property("CanWriteRaw") - .HasColumnType("bit"); + b.Property("CanWriteRaw").HasColumnType("bit"); - b.Property("CanWriteRawMultiSession") - .HasColumnType("bit"); + b.Property("CanWriteRawMultiSession").HasColumnType("bit"); - b.Property("CanWriteRawSubchannelInTAO") - .HasColumnType("bit"); + b.Property("CanWriteRawSubchannelInTAO").HasColumnType("bit"); - b.Property("ChangerIsSideChangeCapable") - .HasColumnType("bit"); + b.Property("ChangerIsSideChangeCapable").HasColumnType("bit"); - b.Property("ChangerSlots") - .HasColumnType("tinyint unsigned"); + b.Property("ChangerSlots").HasColumnType("tinyint unsigned"); - b.Property("ChangerSupportsDiscPresent") - .HasColumnType("bit"); + b.Property("ChangerSupportsDiscPresent").HasColumnType("bit"); - b.Property("DBML") - .HasColumnType("bit"); + b.Property("DBML").HasColumnType("bit"); - b.Property("DVDMultiRead") - .HasColumnType("bit"); + b.Property("DVDMultiRead").HasColumnType("bit"); - b.Property("EmbeddedChanger") - .HasColumnType("bit"); + b.Property("EmbeddedChanger").HasColumnType("bit"); - b.Property("ErrorRecoveryPage") - .HasColumnType("bit"); + b.Property("ErrorRecoveryPage").HasColumnType("bit"); - b.Property("FirmwareDate") - .HasColumnType("datetime(6)"); + b.Property("FirmwareDate").HasColumnType("datetime(6)"); - b.Property("LoadingMechanismType") - .HasColumnType("tinyint unsigned"); + b.Property("LoadingMechanismType").HasColumnType("tinyint unsigned"); - b.Property("Locked") - .HasColumnType("bit"); + b.Property("Locked").HasColumnType("bit"); - b.Property("LogicalBlockSize") - .HasColumnType("int unsigned"); + b.Property("LogicalBlockSize").HasColumnType("int unsigned"); - b.Property("MultiRead") - .HasColumnType("bit"); + b.Property("MultiRead").HasColumnType("bit"); - b.Property("PhysicalInterfaceStandardNumber") - .HasColumnType("int unsigned"); + b.Property("PhysicalInterfaceStandardNumber").HasColumnType("int unsigned"); - b.Property("PreventJumper") - .HasColumnType("bit"); + b.Property("PreventJumper").HasColumnType("bit"); - b.Property("SupportsAACS") - .HasColumnType("bit"); + b.Property("SupportsAACS").HasColumnType("bit"); - b.Property("SupportsBusEncryption") - .HasColumnType("bit"); + b.Property("SupportsBusEncryption").HasColumnType("bit"); - b.Property("SupportsC2") - .HasColumnType("bit"); + b.Property("SupportsC2").HasColumnType("bit"); - b.Property("SupportsCPRM") - .HasColumnType("bit"); + b.Property("SupportsCPRM").HasColumnType("bit"); - b.Property("SupportsCSS") - .HasColumnType("bit"); + b.Property("SupportsCSS").HasColumnType("bit"); - b.Property("SupportsDAP") - .HasColumnType("bit"); + b.Property("SupportsDAP").HasColumnType("bit"); - b.Property("SupportsDeviceBusyEvent") - .HasColumnType("bit"); + b.Property("SupportsDeviceBusyEvent").HasColumnType("bit"); - b.Property("SupportsHybridDiscs") - .HasColumnType("bit"); + b.Property("SupportsHybridDiscs").HasColumnType("bit"); - b.Property("SupportsModePage1Ch") - .HasColumnType("bit"); + b.Property("SupportsModePage1Ch").HasColumnType("bit"); - b.Property("SupportsOSSC") - .HasColumnType("bit"); + b.Property("SupportsOSSC").HasColumnType("bit"); - b.Property("SupportsPWP") - .HasColumnType("bit"); + b.Property("SupportsPWP").HasColumnType("bit"); - b.Property("SupportsSWPP") - .HasColumnType("bit"); + b.Property("SupportsSWPP").HasColumnType("bit"); - b.Property("SupportsSecurDisc") - .HasColumnType("bit"); + b.Property("SupportsSecurDisc").HasColumnType("bit"); - b.Property("SupportsSeparateVolume") - .HasColumnType("bit"); + b.Property("SupportsSeparateVolume").HasColumnType("bit"); - b.Property("SupportsVCPS") - .HasColumnType("bit"); + b.Property("SupportsVCPS").HasColumnType("bit"); - b.Property("SupportsWriteInhibitDCB") - .HasColumnType("bit"); + b.Property("SupportsWriteInhibitDCB").HasColumnType("bit"); - b.Property("SupportsWriteProtectPAC") - .HasColumnType("bit"); + b.Property("SupportsWriteProtectPAC").HasColumnType("bit"); - b.Property("VolumeLevels") - .HasColumnType("smallint unsigned"); + b.Property("VolumeLevels").HasColumnType("smallint unsigned"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("MmcFeatures"); - }); + b.ToTable("MmcFeatures"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.MmcSd", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("CID") - .HasColumnType("longblob"); + b.Property("CID").HasColumnType("longblob"); - b.Property("CSD") - .HasColumnType("longblob"); + b.Property("CSD").HasColumnType("longblob"); - b.Property("ExtendedCSD") - .HasColumnType("longblob"); + b.Property("ExtendedCSD").HasColumnType("longblob"); - b.Property("OCR") - .HasColumnType("longblob"); + b.Property("OCR").HasColumnType("longblob"); - b.Property("SCR") - .HasColumnType("longblob"); + b.Property("SCR").HasColumnType("longblob"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("MmcSd"); - }); + b.ToTable("MmcSd"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Pcmcia", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("CIS") - .HasColumnType("longblob"); + b.Property("CIS").HasColumnType("longblob"); - b.Property("CardCode") - .HasColumnType("smallint unsigned"); + b.Property("CardCode").HasColumnType("smallint unsigned"); - b.Property("Compliance") - .HasColumnType("longtext"); + b.Property("Compliance").HasColumnType("longtext"); - b.Property("Manufacturer") - .HasColumnType("longtext"); + b.Property("Manufacturer").HasColumnType("longtext"); - b.Property("ManufacturerCode") - .HasColumnType("smallint unsigned"); + b.Property("ManufacturerCode").HasColumnType("smallint unsigned"); - b.Property("ProductName") - .HasColumnType("longtext"); + b.Property("ProductName").HasColumnType("longtext"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Pcmcia"); - }); + b.ToTable("Pcmcia"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Scsi", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("InquiryData") - .HasColumnType("longblob"); + b.Property("InquiryData").HasColumnType("longblob"); - b.Property("ModeSense10ChangeableData") - .HasColumnType("longblob"); + b.Property("ModeSense10ChangeableData").HasColumnType("longblob"); - b.Property("ModeSense10CurrentData") - .HasColumnType("longblob"); + b.Property("ModeSense10CurrentData").HasColumnType("longblob"); - b.Property("ModeSense10Data") - .HasColumnType("longblob"); + b.Property("ModeSense10Data").HasColumnType("longblob"); - b.Property("ModeSense6ChangeableData") - .HasColumnType("longblob"); + b.Property("ModeSense6ChangeableData").HasColumnType("longblob"); - b.Property("ModeSense6CurrentData") - .HasColumnType("longblob"); + b.Property("ModeSense6CurrentData").HasColumnType("longblob"); - b.Property("ModeSense6Data") - .HasColumnType("longblob"); + b.Property("ModeSense6Data").HasColumnType("longblob"); - b.Property("ModeSenseId") - .HasColumnType("int"); + b.Property("ModeSenseId").HasColumnType("int"); - b.Property("MultiMediaDeviceId") - .HasColumnType("int"); + b.Property("MultiMediaDeviceId").HasColumnType("int"); - b.Property("ReadCapabilitiesId") - .HasColumnType("int"); + b.Property("ReadCapabilitiesId").HasColumnType("int"); - b.Property("SequentialDeviceId") - .HasColumnType("int"); + b.Property("SequentialDeviceId").HasColumnType("int"); - b.Property("SupportsModeSense10") - .HasColumnType("bit"); + b.Property("SupportsModeSense10").HasColumnType("bit"); - b.Property("SupportsModeSense6") - .HasColumnType("bit"); + b.Property("SupportsModeSense6").HasColumnType("bit"); - b.Property("SupportsModeSubpages") - .HasColumnType("bit"); + b.Property("SupportsModeSubpages").HasColumnType("bit"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ModeSenseId"); + b.HasIndex("ModeSenseId"); - b.HasIndex("MultiMediaDeviceId"); + b.HasIndex("MultiMediaDeviceId"); - b.HasIndex("ReadCapabilitiesId"); + b.HasIndex("ReadCapabilitiesId"); - b.HasIndex("SequentialDeviceId"); + b.HasIndex("SequentialDeviceId"); - b.ToTable("Scsi"); - }); + b.ToTable("Scsi"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.ScsiMode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("BlankCheckEnabled") - .HasColumnType("bit"); + b.Property("BlankCheckEnabled").HasColumnType("bit"); - b.Property("BufferedMode") - .HasColumnType("tinyint unsigned"); + b.Property("BufferedMode").HasColumnType("tinyint unsigned"); - b.Property("DPOandFUA") - .HasColumnType("bit"); + b.Property("DPOandFUA").HasColumnType("bit"); - b.Property("MediumType") - .HasColumnType("tinyint unsigned"); + b.Property("MediumType").HasColumnType("tinyint unsigned"); - b.Property("Speed") - .HasColumnType("tinyint unsigned"); + b.Property("Speed").HasColumnType("tinyint unsigned"); - b.Property("WriteProtected") - .HasColumnType("bit"); + b.Property("WriteProtected").HasColumnType("bit"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("ScsiMode"); - }); + b.ToTable("ScsiMode"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.ScsiPage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("ScsiId") - .HasColumnType("int"); + b.Property("ScsiId").HasColumnType("int"); - b.Property("ScsiModeId") - .HasColumnType("int"); + b.Property("ScsiModeId").HasColumnType("int"); - b.Property("page") - .HasColumnType("tinyint unsigned"); + b.Property("page").HasColumnType("tinyint unsigned"); - b.Property("subpage") - .HasColumnType("tinyint unsigned"); + b.Property("subpage").HasColumnType("tinyint unsigned"); - b.Property("value") - .HasColumnType("longblob"); + b.Property("value").HasColumnType("longblob"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ScsiId"); + b.HasIndex("ScsiId"); - b.HasIndex("ScsiModeId"); + b.HasIndex("ScsiModeId"); - b.ToTable("ScsiPage"); - }); + b.ToTable("ScsiPage"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Ssc", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("BlockSizeGranularity") - .HasColumnType("tinyint unsigned"); + b.Property("BlockSizeGranularity").HasColumnType("tinyint unsigned"); - b.Property("MaxBlockLength") - .HasColumnType("int unsigned"); + b.Property("MaxBlockLength").HasColumnType("int unsigned"); - b.Property("MinBlockLength") - .HasColumnType("int unsigned"); + b.Property("MinBlockLength").HasColumnType("int unsigned"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Ssc"); - }); + b.ToTable("Ssc"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.SscSupportedMedia", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Description") - .HasColumnType("longtext"); + b.Property("Description").HasColumnType("longtext"); - b.Property("Length") - .HasColumnType("smallint unsigned"); + b.Property("Length").HasColumnType("smallint unsigned"); - b.Property("MediumType") - .HasColumnType("tinyint unsigned"); + b.Property("MediumType").HasColumnType("tinyint unsigned"); - b.Property("Name") - .HasColumnType("longtext"); + b.Property("Name").HasColumnType("longtext"); - b.Property("Organization") - .HasColumnType("longtext"); + b.Property("Organization").HasColumnType("longtext"); - b.Property("SscId") - .HasColumnType("int"); + b.Property("SscId").HasColumnType("int"); - b.Property("TestedSequentialMediaId") - .HasColumnType("int"); + b.Property("TestedSequentialMediaId").HasColumnType("int"); - b.Property("Width") - .HasColumnType("smallint unsigned"); + b.Property("Width").HasColumnType("smallint unsigned"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("SscId"); + b.HasIndex("SscId"); - b.HasIndex("TestedSequentialMediaId"); + b.HasIndex("TestedSequentialMediaId"); - b.ToTable("SscSupportedMedia"); - }); + b.ToTable("SscSupportedMedia"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.SupportedDensity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("BitsPerMm") - .HasColumnType("int unsigned"); + b.Property("BitsPerMm").HasColumnType("int unsigned"); - b.Property("Capacity") - .HasColumnType("int unsigned"); + b.Property("Capacity").HasColumnType("int unsigned"); - b.Property("DefaultDensity") - .HasColumnType("bit"); + b.Property("DefaultDensity").HasColumnType("bit"); - b.Property("Description") - .HasColumnType("longtext"); + b.Property("Description").HasColumnType("longtext"); - b.Property("Duplicate") - .HasColumnType("bit"); + b.Property("Duplicate").HasColumnType("bit"); - b.Property("Name") - .HasColumnType("longtext"); + b.Property("Name").HasColumnType("longtext"); - b.Property("Organization") - .HasColumnType("longtext"); + b.Property("Organization").HasColumnType("longtext"); - b.Property("PrimaryCode") - .HasColumnType("tinyint unsigned"); + b.Property("PrimaryCode").HasColumnType("tinyint unsigned"); - b.Property("SecondaryCode") - .HasColumnType("tinyint unsigned"); + b.Property("SecondaryCode").HasColumnType("tinyint unsigned"); - b.Property("SscId") - .HasColumnType("int"); + b.Property("SscId").HasColumnType("int"); - b.Property("TestedSequentialMediaId") - .HasColumnType("int"); + b.Property("TestedSequentialMediaId").HasColumnType("int"); - b.Property("Tracks") - .HasColumnType("smallint unsigned"); + b.Property("Tracks").HasColumnType("smallint unsigned"); - b.Property("Width") - .HasColumnType("smallint unsigned"); + b.Property("Width").HasColumnType("smallint unsigned"); - b.Property("Writable") - .HasColumnType("bit"); + b.Property("Writable").HasColumnType("bit"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("SscId"); + b.HasIndex("SscId"); - b.HasIndex("TestedSequentialMediaId"); + b.HasIndex("TestedSequentialMediaId"); - b.ToTable("SupportedDensity"); - }); + b.ToTable("SupportedDensity"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.TestedMedia", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("AdipData") - .HasColumnType("longblob"); + b.Property("AdipData").HasColumnType("longblob"); - b.Property("AtaId") - .HasColumnType("int"); + b.Property("AtaId").HasColumnType("int"); - b.Property("AtipData") - .HasColumnType("longblob"); + b.Property("AtipData").HasColumnType("longblob"); - b.Property("BlockSize") - .HasColumnType("int unsigned"); + b.Property("BlockSize").HasColumnType("int unsigned"); - b.Property("Blocks") - .HasColumnType("bigint unsigned"); + b.Property("Blocks").HasColumnType("bigint unsigned"); - b.Property("BluBcaData") - .HasColumnType("longblob"); + b.Property("BluBcaData").HasColumnType("longblob"); - b.Property("BluDdsData") - .HasColumnType("longblob"); + b.Property("BluDdsData").HasColumnType("longblob"); - b.Property("BluDiData") - .HasColumnType("longblob"); + b.Property("BluDiData").HasColumnType("longblob"); - b.Property("BluPacData") - .HasColumnType("longblob"); + b.Property("BluPacData").HasColumnType("longblob"); - b.Property("BluSaiData") - .HasColumnType("longblob"); + b.Property("BluSaiData").HasColumnType("longblob"); - b.Property("C2PointersData") - .HasColumnType("longblob"); + b.Property("C2PointersData").HasColumnType("longblob"); - b.Property("CHSId") - .HasColumnType("int"); + b.Property("CHSId").HasColumnType("int"); - b.Property("CanReadAACS") - .HasColumnType("bit"); + b.Property("CanReadAACS").HasColumnType("bit"); - b.Property("CanReadADIP") - .HasColumnType("bit"); + b.Property("CanReadADIP").HasColumnType("bit"); - b.Property("CanReadATIP") - .HasColumnType("bit"); + b.Property("CanReadATIP").HasColumnType("bit"); - b.Property("CanReadBCA") - .HasColumnType("bit"); + b.Property("CanReadBCA").HasColumnType("bit"); - b.Property("CanReadC2Pointers") - .HasColumnType("bit"); + b.Property("CanReadC2Pointers").HasColumnType("bit"); - b.Property("CanReadCMI") - .HasColumnType("bit"); + b.Property("CanReadCMI").HasColumnType("bit"); - b.Property("CanReadCorrectedSubchannel") - .HasColumnType("bit"); + b.Property("CanReadCorrectedSubchannel").HasColumnType("bit"); - b.Property("CanReadCorrectedSubchannelWithC2") - .HasColumnType("bit"); + b.Property("CanReadCorrectedSubchannelWithC2").HasColumnType("bit"); - b.Property("CanReadDCB") - .HasColumnType("bit"); + b.Property("CanReadDCB").HasColumnType("bit"); - b.Property("CanReadDDS") - .HasColumnType("bit"); + b.Property("CanReadDDS").HasColumnType("bit"); - b.Property("CanReadDMI") - .HasColumnType("bit"); + b.Property("CanReadDMI").HasColumnType("bit"); - b.Property("CanReadDiscInformation") - .HasColumnType("bit"); + b.Property("CanReadDiscInformation").HasColumnType("bit"); - b.Property("CanReadFirstTrackPreGap") - .HasColumnType("bit"); + b.Property("CanReadFirstTrackPreGap").HasColumnType("bit"); - b.Property("CanReadFullTOC") - .HasColumnType("bit"); + b.Property("CanReadFullTOC").HasColumnType("bit"); - b.Property("CanReadHDCMI") - .HasColumnType("bit"); + b.Property("CanReadHDCMI").HasColumnType("bit"); - b.Property("CanReadLayerCapacity") - .HasColumnType("bit"); + b.Property("CanReadLayerCapacity").HasColumnType("bit"); - b.Property("CanReadLeadIn") - .HasColumnType("bit"); + b.Property("CanReadLeadIn").HasColumnType("bit"); - b.Property("CanReadLeadOut") - .HasColumnType("bit"); + b.Property("CanReadLeadOut").HasColumnType("bit"); - b.Property("CanReadMediaID") - .HasColumnType("bit"); + b.Property("CanReadMediaID").HasColumnType("bit"); - b.Property("CanReadMediaSerial") - .HasColumnType("bit"); + b.Property("CanReadMediaSerial").HasColumnType("bit"); - b.Property("CanReadPAC") - .HasColumnType("bit"); + b.Property("CanReadPAC").HasColumnType("bit"); - b.Property("CanReadPFI") - .HasColumnType("bit"); + b.Property("CanReadPFI").HasColumnType("bit"); - b.Property("CanReadPMA") - .HasColumnType("bit"); + b.Property("CanReadPMA").HasColumnType("bit"); - b.Property("CanReadPQSubchannel") - .HasColumnType("bit"); + b.Property("CanReadPQSubchannel").HasColumnType("bit"); - b.Property("CanReadPQSubchannelWithC2") - .HasColumnType("bit"); + b.Property("CanReadPQSubchannelWithC2").HasColumnType("bit"); - b.Property("CanReadPRI") - .HasColumnType("bit"); + b.Property("CanReadPRI").HasColumnType("bit"); - b.Property("CanReadRWSubchannel") - .HasColumnType("bit"); + b.Property("CanReadRWSubchannel").HasColumnType("bit"); - b.Property("CanReadRWSubchannelWithC2") - .HasColumnType("bit"); + b.Property("CanReadRWSubchannelWithC2").HasColumnType("bit"); - b.Property("CanReadRecordablePFI") - .HasColumnType("bit"); + b.Property("CanReadRecordablePFI").HasColumnType("bit"); - b.Property("CanReadSpareAreaInformation") - .HasColumnType("bit"); + b.Property("CanReadSpareAreaInformation").HasColumnType("bit"); - b.Property("CanReadTOC") - .HasColumnType("bit"); + b.Property("CanReadTOC").HasColumnType("bit"); - b.Property("CanReadingIntersessionLeadIn") - .HasColumnType("bit"); + b.Property("CanReadingIntersessionLeadIn").HasColumnType("bit"); - b.Property("CanReadingIntersessionLeadOut") - .HasColumnType("bit"); + b.Property("CanReadingIntersessionLeadOut").HasColumnType("bit"); - b.Property("CmiData") - .HasColumnType("longblob"); + b.Property("CmiData").HasColumnType("longblob"); - b.Property("CorrectedSubchannelData") - .HasColumnType("longblob"); + b.Property("CorrectedSubchannelData").HasColumnType("longblob"); - b.Property("CorrectedSubchannelWithC2Data") - .HasColumnType("longblob"); + b.Property("CorrectedSubchannelWithC2Data").HasColumnType("longblob"); - b.Property("CurrentCHSId") - .HasColumnType("int"); + b.Property("CurrentCHSId").HasColumnType("int"); - b.Property("DcbData") - .HasColumnType("longblob"); + b.Property("DcbData").HasColumnType("longblob"); - b.Property("Density") - .HasColumnType("tinyint unsigned"); + b.Property("Density").HasColumnType("tinyint unsigned"); - b.Property("DmiData") - .HasColumnType("longblob"); + b.Property("DmiData").HasColumnType("longblob"); - b.Property("DvdAacsData") - .HasColumnType("longblob"); + b.Property("DvdAacsData").HasColumnType("longblob"); - b.Property("DvdBcaData") - .HasColumnType("longblob"); + b.Property("DvdBcaData").HasColumnType("longblob"); - b.Property("DvdDdsData") - .HasColumnType("longblob"); + b.Property("DvdDdsData").HasColumnType("longblob"); - b.Property("DvdLayerData") - .HasColumnType("longblob"); + b.Property("DvdLayerData").HasColumnType("longblob"); - b.Property("DvdSaiData") - .HasColumnType("longblob"); + b.Property("DvdSaiData").HasColumnType("longblob"); - b.Property("EmbossedPfiData") - .HasColumnType("longblob"); + b.Property("EmbossedPfiData").HasColumnType("longblob"); - b.Property("FullTocData") - .HasColumnType("longblob"); + b.Property("FullTocData").HasColumnType("longblob"); - b.Property("HLDTSTReadRawDVDData") - .HasColumnType("longblob"); + b.Property("HLDTSTReadRawDVDData").HasColumnType("longblob"); - b.Property("HdCmiData") - .HasColumnType("longblob"); + b.Property("HdCmiData").HasColumnType("longblob"); - b.Property("IdentifyData") - .HasColumnType("longblob"); + b.Property("IdentifyData").HasColumnType("longblob"); - b.Property("IntersessionLeadInData") - .HasColumnType("longblob"); + b.Property("IntersessionLeadInData").HasColumnType("longblob"); - b.Property("IntersessionLeadOutData") - .HasColumnType("longblob"); + b.Property("IntersessionLeadOutData").HasColumnType("longblob"); - b.Property("LBA48Sectors") - .HasColumnType("bigint unsigned"); + b.Property("LBA48Sectors").HasColumnType("bigint unsigned"); - b.Property("LBASectors") - .HasColumnType("int unsigned"); + b.Property("LBASectors").HasColumnType("int unsigned"); - b.Property("LeadInData") - .HasColumnType("longblob"); + b.Property("LeadInData").HasColumnType("longblob"); - b.Property("LeadOutData") - .HasColumnType("longblob"); + b.Property("LeadOutData").HasColumnType("longblob"); - b.Property("LogicalAlignment") - .HasColumnType("smallint unsigned"); + b.Property("LogicalAlignment").HasColumnType("smallint unsigned"); - b.Property("LongBlockSize") - .HasColumnType("int unsigned"); + b.Property("LongBlockSize").HasColumnType("int unsigned"); - b.Property("Manufacturer") - .HasColumnType("longtext"); + b.Property("Manufacturer").HasColumnType("longtext"); - b.Property("MediaIsRecognized") - .HasColumnType("bit"); + b.Property("MediaIsRecognized").HasColumnType("bit"); - b.Property("MediumType") - .HasColumnType("tinyint unsigned"); + b.Property("MediumType").HasColumnType("tinyint unsigned"); - b.Property("MediumTypeName") - .HasColumnType("longtext"); + b.Property("MediumTypeName").HasColumnType("longtext"); - b.Property("MmcId") - .HasColumnType("int"); + b.Property("MmcId").HasColumnType("int"); - b.Property("ModeSense10Data") - .HasColumnType("longblob"); + b.Property("ModeSense10Data").HasColumnType("longblob"); - b.Property("ModeSense6Data") - .HasColumnType("longblob"); + b.Property("ModeSense6Data").HasColumnType("longblob"); - b.Property("Model") - .HasColumnType("longtext"); + b.Property("Model").HasColumnType("longtext"); - b.Property("NecReadCddaData") - .HasColumnType("longblob"); + b.Property("NecReadCddaData").HasColumnType("longblob"); - b.Property("NominalRotationRate") - .HasColumnType("smallint unsigned"); + b.Property("NominalRotationRate").HasColumnType("smallint unsigned"); - b.Property("PQSubchannelData") - .HasColumnType("longblob"); + b.Property("PQSubchannelData").HasColumnType("longblob"); - b.Property("PQSubchannelWithC2Data") - .HasColumnType("longblob"); + b.Property("PQSubchannelWithC2Data").HasColumnType("longblob"); - b.Property("PfiData") - .HasColumnType("longblob"); + b.Property("PfiData").HasColumnType("longblob"); - b.Property("PhysicalBlockSize") - .HasColumnType("int unsigned"); + b.Property("PhysicalBlockSize").HasColumnType("int unsigned"); - b.Property("PioneerReadCddaData") - .HasColumnType("longblob"); + b.Property("PioneerReadCddaData").HasColumnType("longblob"); - b.Property("PioneerReadCddaMsfData") - .HasColumnType("longblob"); + b.Property("PioneerReadCddaMsfData").HasColumnType("longblob"); - b.Property("PlextorReadCddaData") - .HasColumnType("longblob"); + b.Property("PlextorReadCddaData").HasColumnType("longblob"); - b.Property("PlextorReadRawDVDData") - .HasColumnType("longblob"); + b.Property("PlextorReadRawDVDData").HasColumnType("longblob"); - b.Property("PmaData") - .HasColumnType("longblob"); + b.Property("PmaData").HasColumnType("longblob"); - b.Property("PriData") - .HasColumnType("longblob"); + b.Property("PriData").HasColumnType("longblob"); - b.Property("RWSubchannelData") - .HasColumnType("longblob"); + b.Property("RWSubchannelData").HasColumnType("longblob"); - b.Property("RWSubchannelWithC2Data") - .HasColumnType("longblob"); + b.Property("RWSubchannelWithC2Data").HasColumnType("longblob"); - b.Property("Read10Data") - .HasColumnType("longblob"); + b.Property("Read10Data").HasColumnType("longblob"); - b.Property("Read12Data") - .HasColumnType("longblob"); + b.Property("Read12Data").HasColumnType("longblob"); - b.Property("Read16Data") - .HasColumnType("longblob"); + b.Property("Read16Data").HasColumnType("longblob"); - b.Property("Read6Data") - .HasColumnType("longblob"); + b.Property("Read6Data").HasColumnType("longblob"); - b.Property("ReadCdData") - .HasColumnType("longblob"); + b.Property("ReadCdData").HasColumnType("longblob"); - b.Property("ReadCdFullData") - .HasColumnType("longblob"); + b.Property("ReadCdFullData").HasColumnType("longblob"); - b.Property("ReadCdMsfData") - .HasColumnType("longblob"); + b.Property("ReadCdMsfData").HasColumnType("longblob"); - b.Property("ReadCdMsfFullData") - .HasColumnType("longblob"); + b.Property("ReadCdMsfFullData").HasColumnType("longblob"); - b.Property("ReadDmaData") - .HasColumnType("longblob"); + b.Property("ReadDmaData").HasColumnType("longblob"); - b.Property("ReadDmaLba48Data") - .HasColumnType("longblob"); + b.Property("ReadDmaLba48Data").HasColumnType("longblob"); - b.Property("ReadDmaLbaData") - .HasColumnType("longblob"); + b.Property("ReadDmaLbaData").HasColumnType("longblob"); - b.Property("ReadDmaRetryData") - .HasColumnType("longblob"); + b.Property("ReadDmaRetryData").HasColumnType("longblob"); - b.Property("ReadDmaRetryLbaData") - .HasColumnType("longblob"); + b.Property("ReadDmaRetryLbaData").HasColumnType("longblob"); - b.Property("ReadLba48Data") - .HasColumnType("longblob"); + b.Property("ReadLba48Data").HasColumnType("longblob"); - b.Property("ReadLbaData") - .HasColumnType("longblob"); + b.Property("ReadLbaData").HasColumnType("longblob"); - b.Property("ReadLong10Data") - .HasColumnType("longblob"); + b.Property("ReadLong10Data").HasColumnType("longblob"); - b.Property("ReadLong16Data") - .HasColumnType("longblob"); + b.Property("ReadLong16Data").HasColumnType("longblob"); - b.Property("ReadLongData") - .HasColumnType("longblob"); + b.Property("ReadLongData").HasColumnType("longblob"); - b.Property("ReadLongLbaData") - .HasColumnType("longblob"); + b.Property("ReadLongLbaData").HasColumnType("longblob"); - b.Property("ReadLongRetryData") - .HasColumnType("longblob"); + b.Property("ReadLongRetryData").HasColumnType("longblob"); - b.Property("ReadLongRetryLbaData") - .HasColumnType("longblob"); + b.Property("ReadLongRetryLbaData").HasColumnType("longblob"); - b.Property("ReadRetryLbaData") - .HasColumnType("longblob"); + b.Property("ReadRetryLbaData").HasColumnType("longblob"); - b.Property("ReadSectorsData") - .HasColumnType("longblob"); + b.Property("ReadSectorsData").HasColumnType("longblob"); - b.Property("ReadSectorsRetryData") - .HasColumnType("longblob"); + b.Property("ReadSectorsRetryData").HasColumnType("longblob"); - b.Property("ScsiId") - .HasColumnType("int"); + b.Property("ScsiId").HasColumnType("int"); - b.Property("SolidStateDevice") - .HasColumnType("bit"); + b.Property("SolidStateDevice").HasColumnType("bit"); - b.Property("SupportsHLDTSTReadRawDVD") - .HasColumnType("bit"); + b.Property("SupportsHLDTSTReadRawDVD").HasColumnType("bit"); - b.Property("SupportsNECReadCDDA") - .HasColumnType("bit"); + b.Property("SupportsNECReadCDDA").HasColumnType("bit"); - b.Property("SupportsPioneerReadCDDA") - .HasColumnType("bit"); + b.Property("SupportsPioneerReadCDDA").HasColumnType("bit"); - b.Property("SupportsPioneerReadCDDAMSF") - .HasColumnType("bit"); + b.Property("SupportsPioneerReadCDDAMSF").HasColumnType("bit"); - b.Property("SupportsPlextorReadCDDA") - .HasColumnType("bit"); + b.Property("SupportsPlextorReadCDDA").HasColumnType("bit"); - b.Property("SupportsPlextorReadRawDVD") - .HasColumnType("bit"); + b.Property("SupportsPlextorReadRawDVD").HasColumnType("bit"); - b.Property("SupportsRead10") - .HasColumnType("bit"); + b.Property("SupportsRead10").HasColumnType("bit"); - b.Property("SupportsRead12") - .HasColumnType("bit"); + b.Property("SupportsRead12").HasColumnType("bit"); - b.Property("SupportsRead16") - .HasColumnType("bit"); + b.Property("SupportsRead16").HasColumnType("bit"); - b.Property("SupportsRead6") - .HasColumnType("bit"); + b.Property("SupportsRead6").HasColumnType("bit"); - b.Property("SupportsReadCapacity") - .HasColumnType("bit"); + b.Property("SupportsReadCapacity").HasColumnType("bit"); - b.Property("SupportsReadCapacity16") - .HasColumnType("bit"); + b.Property("SupportsReadCapacity16").HasColumnType("bit"); - b.Property("SupportsReadCd") - .HasColumnType("bit"); + b.Property("SupportsReadCd").HasColumnType("bit"); - b.Property("SupportsReadCdMsf") - .HasColumnType("bit"); + b.Property("SupportsReadCdMsf").HasColumnType("bit"); - b.Property("SupportsReadCdMsfRaw") - .HasColumnType("bit"); + b.Property("SupportsReadCdMsfRaw").HasColumnType("bit"); - b.Property("SupportsReadCdRaw") - .HasColumnType("bit"); + b.Property("SupportsReadCdRaw").HasColumnType("bit"); - b.Property("SupportsReadDma") - .HasColumnType("bit"); + b.Property("SupportsReadDma").HasColumnType("bit"); - b.Property("SupportsReadDmaLba") - .HasColumnType("bit"); + b.Property("SupportsReadDmaLba").HasColumnType("bit"); - b.Property("SupportsReadDmaLba48") - .HasColumnType("bit"); + b.Property("SupportsReadDmaLba48").HasColumnType("bit"); - b.Property("SupportsReadDmaRetry") - .HasColumnType("bit"); + b.Property("SupportsReadDmaRetry").HasColumnType("bit"); - b.Property("SupportsReadDmaRetryLba") - .HasColumnType("bit"); + b.Property("SupportsReadDmaRetryLba").HasColumnType("bit"); - b.Property("SupportsReadLba") - .HasColumnType("bit"); + b.Property("SupportsReadLba").HasColumnType("bit"); - b.Property("SupportsReadLba48") - .HasColumnType("bit"); + b.Property("SupportsReadLba48").HasColumnType("bit"); - b.Property("SupportsReadLong") - .HasColumnType("bit"); + b.Property("SupportsReadLong").HasColumnType("bit"); - b.Property("SupportsReadLong16") - .HasColumnType("bit"); + b.Property("SupportsReadLong16").HasColumnType("bit"); - b.Property("SupportsReadLongLba") - .HasColumnType("bit"); + b.Property("SupportsReadLongLba").HasColumnType("bit"); - b.Property("SupportsReadLongRetry") - .HasColumnType("bit"); + b.Property("SupportsReadLongRetry").HasColumnType("bit"); - b.Property("SupportsReadLongRetryLba") - .HasColumnType("bit"); + b.Property("SupportsReadLongRetryLba").HasColumnType("bit"); - b.Property("SupportsReadRetry") - .HasColumnType("bit"); + b.Property("SupportsReadRetry").HasColumnType("bit"); - b.Property("SupportsReadRetryLba") - .HasColumnType("bit"); + b.Property("SupportsReadRetryLba").HasColumnType("bit"); - b.Property("SupportsReadSectors") - .HasColumnType("bit"); + b.Property("SupportsReadSectors").HasColumnType("bit"); - b.Property("SupportsSeek") - .HasColumnType("bit"); + b.Property("SupportsSeek").HasColumnType("bit"); - b.Property("SupportsSeekLba") - .HasColumnType("bit"); + b.Property("SupportsSeekLba").HasColumnType("bit"); - b.Property("TocData") - .HasColumnType("longblob"); + b.Property("TocData").HasColumnType("longblob"); - b.Property("Track1PregapData") - .HasColumnType("longblob"); + b.Property("Track1PregapData").HasColumnType("longblob"); - b.Property("UnformattedBPS") - .HasColumnType("smallint unsigned"); + b.Property("UnformattedBPS").HasColumnType("smallint unsigned"); - b.Property("UnformattedBPT") - .HasColumnType("smallint unsigned"); + b.Property("UnformattedBPT").HasColumnType("smallint unsigned"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("AtaId"); + b.HasIndex("AtaId"); - b.HasIndex("CHSId"); + b.HasIndex("CHSId"); - b.HasIndex("CurrentCHSId"); + b.HasIndex("CurrentCHSId"); - b.HasIndex("MmcId"); + b.HasIndex("MmcId"); - b.HasIndex("ScsiId"); + b.HasIndex("ScsiId"); - b.ToTable("TestedMedia"); - }); + b.ToTable("TestedMedia"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("CanReadMediaSerial") - .HasColumnType("bit"); + b.Property("CanReadMediaSerial").HasColumnType("bit"); - b.Property("Density") - .HasColumnType("tinyint unsigned"); + b.Property("Density").HasColumnType("tinyint unsigned"); - b.Property("Manufacturer") - .HasColumnType("longtext"); + b.Property("Manufacturer").HasColumnType("longtext"); - b.Property("MediaIsRecognized") - .HasColumnType("bit"); + b.Property("MediaIsRecognized").HasColumnType("bit"); - b.Property("MediumType") - .HasColumnType("tinyint unsigned"); + b.Property("MediumType").HasColumnType("tinyint unsigned"); - b.Property("MediumTypeName") - .HasColumnType("longtext"); + b.Property("MediumTypeName").HasColumnType("longtext"); - b.Property("ModeSense10Data") - .HasColumnType("longblob"); + b.Property("ModeSense10Data").HasColumnType("longblob"); - b.Property("ModeSense6Data") - .HasColumnType("longblob"); + b.Property("ModeSense6Data").HasColumnType("longblob"); - b.Property("Model") - .HasColumnType("longtext"); + b.Property("Model").HasColumnType("longtext"); - b.Property("SscId") - .HasColumnType("int"); + b.Property("SscId").HasColumnType("int"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("SscId"); + b.HasIndex("SscId"); - b.ToTable("TestedSequentialMedia"); - }); + b.ToTable("TestedSequentialMedia"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Usb", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Descriptors") - .HasColumnType("longblob"); + b.Property("Descriptors").HasColumnType("longblob"); - b.Property("Manufacturer") - .HasColumnType("longtext"); + b.Property("Manufacturer").HasColumnType("longtext"); - b.Property("Product") - .HasColumnType("longtext"); + b.Property("Product").HasColumnType("longtext"); - b.Property("ProductID") - .HasColumnType("smallint unsigned"); + b.Property("ProductID").HasColumnType("smallint unsigned"); - b.Property("RemovableMedia") - .HasColumnType("bit"); + b.Property("RemovableMedia").HasColumnType("bit"); - b.Property("VendorID") - .HasColumnType("smallint unsigned"); + b.Property("VendorID").HasColumnType("smallint unsigned"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Usb"); - }); + b.ToTable("Usb"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.Command", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Count") - .HasColumnType("bigint"); + b.Property("Count").HasColumnType("bigint"); - b.Property("Name") - .HasColumnType("longtext"); + b.Property("Name").HasColumnType("longtext"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Commands"); - }); + b.ToTable("Commands"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.CompactDiscOffset", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("AddedWhen") - .HasColumnType("datetime(6)"); + b.Property("AddedWhen").HasColumnType("datetime(6)"); - b.Property("Agreement") - .HasColumnType("float"); + b.Property("Agreement").HasColumnType("float"); - b.Property("Manufacturer") - .HasColumnType("longtext"); + b.Property("Manufacturer").HasColumnType("longtext"); - b.Property("Model") - .HasColumnType("longtext"); + b.Property("Model").HasColumnType("longtext"); - b.Property("ModifiedWhen") - .HasColumnType("datetime(6)"); + b.Property("ModifiedWhen").HasColumnType("datetime(6)"); - b.Property("Offset") - .HasColumnType("smallint"); + b.Property("Offset").HasColumnType("smallint"); - b.Property("Submissions") - .HasColumnType("int"); + b.Property("Submissions").HasColumnType("int"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ModifiedWhen"); + b.HasIndex("ModifiedWhen"); - b.ToTable("CdOffsets"); - }); + b.ToTable("CdOffsets"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.Device", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("ATAId") - .HasColumnType("int"); + b.Property("ATAId").HasColumnType("int"); - b.Property("ATAPIId") - .HasColumnType("int"); + b.Property("ATAPIId").HasColumnType("int"); - b.Property("AddedWhen") - .HasColumnType("datetime(6)"); + b.Property("AddedWhen").HasColumnType("datetime(6)"); - b.Property("CdOffsetId") - .HasColumnType("int"); + b.Property("CdOffsetId").HasColumnType("int"); - b.Property("CompactFlash") - .HasColumnType("bit"); + b.Property("CompactFlash").HasColumnType("bit"); - b.Property("FireWireId") - .HasColumnType("int"); + b.Property("FireWireId").HasColumnType("int"); - b.Property("Manufacturer") - .HasColumnType("longtext"); + b.Property("Manufacturer").HasColumnType("longtext"); - b.Property("Model") - .HasColumnType("longtext"); + b.Property("Model").HasColumnType("longtext"); - b.Property("ModifiedWhen") - .HasColumnType("datetime(6)"); + b.Property("ModifiedWhen").HasColumnType("datetime(6)"); - b.Property("MultiMediaCardId") - .HasColumnType("int"); + b.Property("MultiMediaCardId").HasColumnType("int"); - b.Property("OptimalMultipleSectorsRead") - .HasColumnType("int"); + b.Property("OptimalMultipleSectorsRead").HasColumnType("int"); - b.Property("PCMCIAId") - .HasColumnType("int"); + b.Property("PCMCIAId").HasColumnType("int"); - b.Property("Revision") - .HasColumnType("longtext"); + b.Property("Revision").HasColumnType("longtext"); - b.Property("SCSIId") - .HasColumnType("int"); + b.Property("SCSIId").HasColumnType("int"); - b.Property("SecureDigitalId") - .HasColumnType("int"); + b.Property("SecureDigitalId").HasColumnType("int"); - b.Property("Type") - .HasColumnType("int"); + b.Property("Type").HasColumnType("int"); - b.Property("USBId") - .HasColumnType("int"); + b.Property("USBId").HasColumnType("int"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ATAId"); + b.HasIndex("ATAId"); - b.HasIndex("ATAPIId"); + b.HasIndex("ATAPIId"); - b.HasIndex("CdOffsetId"); + b.HasIndex("CdOffsetId"); - b.HasIndex("FireWireId"); + b.HasIndex("FireWireId"); - b.HasIndex("ModifiedWhen"); + b.HasIndex("ModifiedWhen"); - b.HasIndex("MultiMediaCardId"); + b.HasIndex("MultiMediaCardId"); - b.HasIndex("PCMCIAId"); + b.HasIndex("PCMCIAId"); - b.HasIndex("SCSIId"); + b.HasIndex("SCSIId"); - b.HasIndex("SecureDigitalId"); + b.HasIndex("SecureDigitalId"); - b.HasIndex("USBId"); + b.HasIndex("USBId"); - b.ToTable("Devices"); - }); + b.ToTable("Devices"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.DeviceStat", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Bus") - .HasColumnType("longtext"); + b.Property("Bus").HasColumnType("longtext"); - b.Property("Manufacturer") - .HasColumnType("longtext"); + b.Property("Manufacturer").HasColumnType("longtext"); - b.Property("Model") - .HasColumnType("longtext"); + b.Property("Model").HasColumnType("longtext"); - b.Property("ReportId") - .HasColumnType("int"); + b.Property("ReportId").HasColumnType("int"); - b.Property("Revision") - .HasColumnType("longtext"); + b.Property("Revision").HasColumnType("longtext"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ReportId"); + b.HasIndex("ReportId"); - b.ToTable("DeviceStats"); - }); + b.ToTable("DeviceStats"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.Filesystem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Count") - .HasColumnType("bigint"); + b.Property("Count").HasColumnType("bigint"); - b.Property("Name") - .HasColumnType("longtext"); + b.Property("Name").HasColumnType("longtext"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Filesystems"); - }); + b.ToTable("Filesystems"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.Filter", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Count") - .HasColumnType("bigint"); + b.Property("Count").HasColumnType("bigint"); - b.Property("Name") - .HasColumnType("longtext"); + b.Property("Name").HasColumnType("longtext"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Filters"); - }); + b.ToTable("Filters"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.Media", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Count") - .HasColumnType("bigint"); + b.Property("Count").HasColumnType("bigint"); - b.Property("Real") - .HasColumnType("bit"); + b.Property("Real").HasColumnType("bit"); - b.Property("Type") - .HasColumnType("longtext"); + b.Property("Type").HasColumnType("longtext"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Medias"); - }); + b.ToTable("Medias"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.MediaFormat", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Count") - .HasColumnType("bigint"); + b.Property("Count").HasColumnType("bigint"); - b.Property("Name") - .HasColumnType("longtext"); + b.Property("Name").HasColumnType("longtext"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("MediaFormats"); - }); + b.ToTable("MediaFormats"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.OperatingSystem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Count") - .HasColumnType("bigint"); + b.Property("Count").HasColumnType("bigint"); - b.Property("Name") - .HasColumnType("longtext"); + b.Property("Name").HasColumnType("longtext"); - b.Property("Version") - .HasColumnType("longtext"); + b.Property("Version").HasColumnType("longtext"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("OperatingSystems"); - }); + b.ToTable("OperatingSystems"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.Partition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Count") - .HasColumnType("bigint"); + b.Property("Count").HasColumnType("bigint"); - b.Property("Name") - .HasColumnType("longtext"); + b.Property("Name").HasColumnType("longtext"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Partitions"); - }); + b.ToTable("Partitions"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.UploadedReport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("ATAId") - .HasColumnType("int"); + b.Property("ATAId").HasColumnType("int"); - b.Property("ATAPIId") - .HasColumnType("int"); + b.Property("ATAPIId").HasColumnType("int"); - b.Property("CompactFlash") - .HasColumnType("bit"); + b.Property("CompactFlash").HasColumnType("bit"); - b.Property("FireWireId") - .HasColumnType("int"); + b.Property("FireWireId").HasColumnType("int"); - b.Property("Manufacturer") - .HasColumnType("longtext"); + b.Property("Manufacturer").HasColumnType("longtext"); - b.Property("Model") - .HasColumnType("longtext"); + b.Property("Model").HasColumnType("longtext"); - b.Property("MultiMediaCardId") - .HasColumnType("int"); + b.Property("MultiMediaCardId").HasColumnType("int"); - b.Property("PCMCIAId") - .HasColumnType("int"); + b.Property("PCMCIAId").HasColumnType("int"); - b.Property("Revision") - .HasColumnType("longtext"); + b.Property("Revision").HasColumnType("longtext"); - b.Property("SCSIId") - .HasColumnType("int"); + b.Property("SCSIId").HasColumnType("int"); - b.Property("SecureDigitalId") - .HasColumnType("int"); + b.Property("SecureDigitalId").HasColumnType("int"); - b.Property("Type") - .HasColumnType("int"); + b.Property("Type").HasColumnType("int"); - b.Property("USBId") - .HasColumnType("int"); + b.Property("USBId").HasColumnType("int"); - b.Property("UploadedWhen") - .HasColumnType("datetime(6)"); + b.Property("UploadedWhen").HasColumnType("datetime(6)"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ATAId"); + b.HasIndex("ATAId"); - b.HasIndex("ATAPIId"); + b.HasIndex("ATAPIId"); - b.HasIndex("FireWireId"); + b.HasIndex("FireWireId"); - b.HasIndex("MultiMediaCardId"); + b.HasIndex("MultiMediaCardId"); - b.HasIndex("PCMCIAId"); + b.HasIndex("PCMCIAId"); - b.HasIndex("SCSIId"); + b.HasIndex("SCSIId"); - b.HasIndex("SecureDigitalId"); + b.HasIndex("SecureDigitalId"); - b.HasIndex("USBId"); + b.HasIndex("USBId"); - b.ToTable("Reports"); - }); + b.ToTable("Reports"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.UsbProduct", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("AddedWhen") - .HasColumnType("datetime(6)"); + b.Property("AddedWhen").HasColumnType("datetime(6)"); - b.Property("ModifiedWhen") - .HasColumnType("datetime(6)"); + b.Property("ModifiedWhen").HasColumnType("datetime(6)"); - b.Property("Product") - .HasColumnType("longtext"); + b.Property("Product").HasColumnType("longtext"); - b.Property("ProductId") - .HasColumnType("smallint unsigned"); + b.Property("ProductId").HasColumnType("smallint unsigned"); - b.Property("VendorId") - .HasColumnType("int"); + b.Property("VendorId").HasColumnType("int"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ModifiedWhen"); + b.HasIndex("ModifiedWhen"); - b.HasIndex("ProductId"); + b.HasIndex("ProductId"); - b.HasIndex("VendorId"); + b.HasIndex("VendorId"); - b.ToTable("UsbProducts"); - }); + b.ToTable("UsbProducts"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.UsbVendor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("AddedWhen") - .HasColumnType("datetime(6)"); + b.Property("AddedWhen").HasColumnType("datetime(6)"); - b.Property("ModifiedWhen") - .HasColumnType("datetime(6)"); + b.Property("ModifiedWhen").HasColumnType("datetime(6)"); - b.Property("Vendor") - .HasColumnType("longtext"); + b.Property("Vendor").HasColumnType("longtext"); - b.Property("VendorId") - .HasColumnType("smallint unsigned"); + b.Property("VendorId").HasColumnType("smallint unsigned"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("ModifiedWhen"); + b.HasIndex("ModifiedWhen"); - b.HasIndex("VendorId") - .IsUnique(); + b.HasIndex("VendorId").IsUnique(); - b.ToTable("UsbVendors"); - }); + b.ToTable("UsbVendors"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.Version", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); + { + b.Property("Id").ValueGeneratedOnAdd().HasColumnType("int"); - b.Property("Count") - .HasColumnType("bigint"); + b.Property("Count").HasColumnType("bigint"); - b.Property("Value") - .HasColumnType("longtext"); + b.Property("Value").HasColumnType("longtext"); - b.HasKey("Id"); + b.HasKey("Id"); - b.ToTable("Versions"); - }); + b.ToTable("Versions"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Ata", b => - { - b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedMedia", "ReadCapabilities") - .WithMany() - .HasForeignKey("ReadCapabilitiesId"); - }); + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany(). + HasForeignKey("ReadCapabilitiesId"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.BlockDescriptor", b => - { - b.HasOne("DiscImageChef.CommonTypes.Metadata.ScsiMode", null) - .WithMany("BlockDescriptors") - .HasForeignKey("ScsiModeId"); - }); + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.ScsiMode", null).WithMany("BlockDescriptors"). + HasForeignKey("ScsiModeId"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.DensityCode", b => - { - b.HasOne("DiscImageChef.CommonTypes.Metadata.SscSupportedMedia", null) - .WithMany("DensityCodes") - .HasForeignKey("SscSupportedMediaId"); - }); + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.SscSupportedMedia", null).WithMany("DensityCodes"). + HasForeignKey("SscSupportedMediaId"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Mmc", b => - { - b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcFeatures", "Features") - .WithMany() - .HasForeignKey("FeaturesId"); - }); + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcFeatures", "Features").WithMany(). + HasForeignKey("FeaturesId"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Scsi", b => - { - b.HasOne("DiscImageChef.CommonTypes.Metadata.ScsiMode", "ModeSense") - .WithMany() - .HasForeignKey("ModeSenseId"); + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.ScsiMode", "ModeSense").WithMany(). + HasForeignKey("ModeSenseId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Mmc", "MultiMediaDevice") - .WithMany() - .HasForeignKey("MultiMediaDeviceId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Mmc", "MultiMediaDevice").WithMany(). + HasForeignKey("MultiMediaDeviceId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedMedia", "ReadCapabilities") - .WithMany() - .HasForeignKey("ReadCapabilitiesId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany(). + HasForeignKey("ReadCapabilitiesId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", "SequentialDevice") - .WithMany() - .HasForeignKey("SequentialDeviceId"); - }); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", "SequentialDevice").WithMany(). + HasForeignKey("SequentialDeviceId"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.ScsiPage", b => - { - b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", null) - .WithMany("EVPDPages") - .HasForeignKey("ScsiId"); + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", null).WithMany("EVPDPages").HasForeignKey("ScsiId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.ScsiMode", null) - .WithMany("ModePages") - .HasForeignKey("ScsiModeId"); - }); + b.HasOne("DiscImageChef.CommonTypes.Metadata.ScsiMode", null).WithMany("ModePages"). + HasForeignKey("ScsiModeId"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.SscSupportedMedia", b => - { - b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", null) - .WithMany("SupportedMediaTypes") - .HasForeignKey("SscId"); + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", null).WithMany("SupportedMediaTypes"). + HasForeignKey("SscId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", null) - .WithMany("SupportedMediaTypes") - .HasForeignKey("TestedSequentialMediaId"); - }); + b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", null). + WithMany("SupportedMediaTypes").HasForeignKey("TestedSequentialMediaId"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.SupportedDensity", b => - { - b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", null) - .WithMany("SupportedDensities") - .HasForeignKey("SscId"); + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", null).WithMany("SupportedDensities"). + HasForeignKey("SscId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", null) - .WithMany("SupportedDensities") - .HasForeignKey("TestedSequentialMediaId"); - }); + b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", null). + WithMany("SupportedDensities").HasForeignKey("TestedSequentialMediaId"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.TestedMedia", b => - { - b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", null) - .WithMany("RemovableMedias") - .HasForeignKey("AtaId"); + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", null).WithMany("RemovableMedias"). + HasForeignKey("AtaId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Chs", "CHS") - .WithMany() - .HasForeignKey("CHSId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Chs", "CHS").WithMany().HasForeignKey("CHSId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Chs", "CurrentCHS") - .WithMany() - .HasForeignKey("CurrentCHSId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Chs", "CurrentCHS").WithMany(). + HasForeignKey("CurrentCHSId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Mmc", null) - .WithMany("TestedMedia") - .HasForeignKey("MmcId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Mmc", null).WithMany("TestedMedia").HasForeignKey("MmcId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", null) - .WithMany("RemovableMedias") - .HasForeignKey("ScsiId"); - }); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", null).WithMany("RemovableMedias"). + HasForeignKey("ScsiId"); + }); modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", b => - { - b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", null) - .WithMany("TestedMedia") - .HasForeignKey("SscId"); - }); + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", null).WithMany("TestedMedia").HasForeignKey("SscId"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.Device", b => - { - b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATA") - .WithMany() - .HasForeignKey("ATAId"); + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATA").WithMany().HasForeignKey("ATAId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATAPI") - .WithMany() - .HasForeignKey("ATAPIId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATAPI").WithMany().HasForeignKey("ATAPIId"); - b.HasOne("DiscImageChef.Server.Models.CompactDiscOffset", "CdOffset") - .WithMany("Devices") - .HasForeignKey("CdOffsetId"); + b.HasOne("DiscImageChef.Server.Models.CompactDiscOffset", "CdOffset").WithMany("Devices"). + HasForeignKey("CdOffsetId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.FireWire", "FireWire") - .WithMany() - .HasForeignKey("FireWireId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.FireWire", "FireWire").WithMany(). + HasForeignKey("FireWireId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "MultiMediaCard") - .WithMany() - .HasForeignKey("MultiMediaCardId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "MultiMediaCard").WithMany(). + HasForeignKey("MultiMediaCardId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Pcmcia", "PCMCIA") - .WithMany() - .HasForeignKey("PCMCIAId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Pcmcia", "PCMCIA").WithMany().HasForeignKey("PCMCIAId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", "SCSI") - .WithMany() - .HasForeignKey("SCSIId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", "SCSI").WithMany().HasForeignKey("SCSIId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "SecureDigital") - .WithMany() - .HasForeignKey("SecureDigitalId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "SecureDigital").WithMany(). + HasForeignKey("SecureDigitalId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Usb", "USB") - .WithMany() - .HasForeignKey("USBId"); - }); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Usb", "USB").WithMany().HasForeignKey("USBId"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.DeviceStat", b => - { - b.HasOne("DiscImageChef.Server.Models.Device", "Report") - .WithMany() - .HasForeignKey("ReportId"); - }); + { + b.HasOne("DiscImageChef.Server.Models.Device", "Report").WithMany().HasForeignKey("ReportId"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.UploadedReport", b => - { - b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATA") - .WithMany() - .HasForeignKey("ATAId"); + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATA").WithMany().HasForeignKey("ATAId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATAPI") - .WithMany() - .HasForeignKey("ATAPIId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATAPI").WithMany().HasForeignKey("ATAPIId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.FireWire", "FireWire") - .WithMany() - .HasForeignKey("FireWireId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.FireWire", "FireWire").WithMany(). + HasForeignKey("FireWireId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "MultiMediaCard") - .WithMany() - .HasForeignKey("MultiMediaCardId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "MultiMediaCard").WithMany(). + HasForeignKey("MultiMediaCardId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Pcmcia", "PCMCIA") - .WithMany() - .HasForeignKey("PCMCIAId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Pcmcia", "PCMCIA").WithMany().HasForeignKey("PCMCIAId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", "SCSI") - .WithMany() - .HasForeignKey("SCSIId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", "SCSI").WithMany().HasForeignKey("SCSIId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "SecureDigital") - .WithMany() - .HasForeignKey("SecureDigitalId"); + b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "SecureDigital").WithMany(). + HasForeignKey("SecureDigitalId"); - b.HasOne("DiscImageChef.CommonTypes.Metadata.Usb", "USB") - .WithMany() - .HasForeignKey("USBId"); - }); + b.HasOne("DiscImageChef.CommonTypes.Metadata.Usb", "USB").WithMany().HasForeignKey("USBId"); + }); modelBuilder.Entity("DiscImageChef.Server.Models.UsbProduct", b => - { - b.HasOne("DiscImageChef.Server.Models.UsbVendor", "Vendor") - .WithMany("Products") - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 + { + b.HasOne("DiscImageChef.Server.Models.UsbVendor", "Vendor").WithMany("Products"). + HasForeignKey("VendorId").OnDelete(DeleteBehavior.Cascade).IsRequired(); + }); + #pragma warning restore 612, 618 } } -} +} \ No newline at end of file diff --git a/DiscImageChef.Server/Models/CdOffset.cs b/DiscImageChef.Server/Models/CdOffset.cs index 70793e83..3f7b4c13 100644 --- a/DiscImageChef.Server/Models/CdOffset.cs +++ b/DiscImageChef.Server/Models/CdOffset.cs @@ -38,33 +38,31 @@ namespace DiscImageChef.Server.Models { public class CompactDiscOffset : CdOffset { - public CompactDiscOffset() - { - } + public CompactDiscOffset() { } public CompactDiscOffset(string manufacturer, string model, short offset, int submissions, float agreement) { Manufacturer = manufacturer; - Model = model; - Offset = offset; - Submissions = submissions; - Agreement = agreement; - AddedWhen = ModifiedWhen = DateTime.UtcNow; + Model = model; + Offset = offset; + Submissions = submissions; + Agreement = agreement; + AddedWhen = ModifiedWhen = DateTime.UtcNow; } public CompactDiscOffset(CdOffset offset) { Manufacturer = offset.Manufacturer; - Model = offset.Model; - Offset = offset.Offset; - Submissions = offset.Submissions; - Agreement = offset.Agreement; - AddedWhen = ModifiedWhen = DateTime.UtcNow; + Model = offset.Model; + Offset = offset.Offset; + Submissions = offset.Submissions; + Agreement = offset.Agreement; + AddedWhen = ModifiedWhen = DateTime.UtcNow; } - public int Id { get; set; } - public DateTime AddedWhen { get; set; } - public DateTime ModifiedWhen { get; set; } - public virtual ICollection Devices { get; set; } + public int Id { get; set; } + public DateTime AddedWhen { get; set; } + public DateTime ModifiedWhen { get; set; } + public virtual ICollection Devices { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/Command.cs b/DiscImageChef.Server/Models/Command.cs index ebb44090..9c5d3bf6 100644 --- a/DiscImageChef.Server/Models/Command.cs +++ b/DiscImageChef.Server/Models/Command.cs @@ -36,9 +36,10 @@ namespace DiscImageChef.Server.Models { public class Command { - [Key] public int Id { get; set; } + [Key] + public int Id { get; set; } - public string Name { get; set; } - public long Count { get; set; } + public string Name { get; set; } + public long Count { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/Context.cs b/DiscImageChef.Server/Models/Context.cs index 8e685804..6f65ce07 100644 --- a/DiscImageChef.Server/Models/Context.cs +++ b/DiscImageChef.Server/Models/Context.cs @@ -30,6 +30,7 @@ // Copyright © 2011-2019 Natalia Portillo // ****************************************************************************/ +using System.Data.Common; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; @@ -37,36 +38,32 @@ namespace DiscImageChef.Server.Models { public sealed class DicServerContext : DbContext { - public DicServerContext() - { - } + public DicServerContext() { } - public DicServerContext(DbContextOptions options) : base(options) - { - } + public DicServerContext(DbContextOptions options) : base(options) { } - public DbSet Devices { get; set; } - public DbSet Reports { get; set; } - public DbSet Commands { get; set; } - public DbSet DeviceStats { get; set; } - public DbSet Filesystems { get; set; } - public DbSet Filters { get; set; } - public DbSet Medias { get; set; } - public DbSet MediaFormats { get; set; } - public DbSet OperatingSystems { get; set; } - public DbSet Partitions { get; set; } - public DbSet Versions { get; set; } - public DbSet UsbVendors { get; set; } - public DbSet UsbProducts { get; set; } - public DbSet CdOffsets { get; set; } + public DbSet Devices { get; set; } + public DbSet Reports { get; set; } + public DbSet Commands { get; set; } + public DbSet DeviceStats { get; set; } + public DbSet Filesystems { get; set; } + public DbSet Filters { get; set; } + public DbSet Medias { get; set; } + public DbSet MediaFormats { get; set; } + public DbSet OperatingSystems { get; set; } + public DbSet Partitions { get; set; } + public DbSet Versions { get; set; } + public DbSet UsbVendors { get; set; } + public DbSet UsbProducts { get; set; } + public DbSet CdOffsets { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - if (optionsBuilder.IsConfigured) return; + if(optionsBuilder.IsConfigured) + return; - - var builder = new ConfigurationBuilder().AddJsonFile("appsettings.json"); - var configuration = builder.Build(); + IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile("appsettings.json"); + IConfigurationRoot configuration = builder.Build(); optionsBuilder.UseMySql(configuration.GetConnectionString("DefaultConnection")); } @@ -86,16 +83,17 @@ namespace DiscImageChef.Server.Models internal static bool TableExists(string tableName) { - using (var db = new DicServerContext()) + using(var db = new DicServerContext()) { - var connection = db.Database.GetDbConnection(); + DbConnection connection = db.Database.GetDbConnection(); connection.Open(); - var command = connection.CreateCommand(); + DbCommand command = connection.CreateCommand(); + command.CommandText = $"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME=\"{tableName}\""; - var result = (long) command.ExecuteScalar(); + long result = (long)command.ExecuteScalar(); return result != 0; } diff --git a/DiscImageChef.Server/Models/Device.cs b/DiscImageChef.Server/Models/Device.cs index 4ff0c2d9..5d77efaa 100644 --- a/DiscImageChef.Server/Models/Device.cs +++ b/DiscImageChef.Server/Models/Device.cs @@ -38,34 +38,32 @@ namespace DiscImageChef.Server.Models { public class Device : DeviceReportV2 { - public Device() - { - AddedWhen = DateTime.UtcNow; - } + public Device() => AddedWhen = DateTime.UtcNow; public Device(DeviceReportV2 report) { - ATA = report.ATA; - ATAPI = report.ATAPI; - CompactFlash = report.CompactFlash; - FireWire = report.FireWire; - AddedWhen = DateTime.UtcNow; - ModifiedWhen = DateTime.UtcNow; + ATA = report.ATA; + ATAPI = report.ATAPI; + CompactFlash = report.CompactFlash; + FireWire = report.FireWire; + AddedWhen = DateTime.UtcNow; + ModifiedWhen = DateTime.UtcNow; MultiMediaCard = report.MultiMediaCard; - PCMCIA = report.PCMCIA; - SCSI = report.SCSI; - SecureDigital = report.SecureDigital; - USB = report.USB; - Manufacturer = report.Manufacturer; - Model = report.Model; - Revision = report.Revision; - Type = report.Type; + PCMCIA = report.PCMCIA; + SCSI = report.SCSI; + SecureDigital = report.SecureDigital; + USB = report.USB; + Manufacturer = report.Manufacturer; + Model = report.Model; + Revision = report.Revision; + Type = report.Type; } - public DateTime AddedWhen { get; set; } - public DateTime? ModifiedWhen { get; set; } - public virtual CompactDiscOffset CdOffset { get; set; } + public DateTime AddedWhen { get; set; } + public DateTime? ModifiedWhen { get; set; } + public virtual CompactDiscOffset CdOffset { get; set; } - [DefaultValue(0)] public int OptimalMultipleSectorsRead { get; set; } + [DefaultValue(0)] + public int OptimalMultipleSectorsRead { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/DeviceItem.cs b/DiscImageChef.Server/Models/DeviceItem.cs index 24a7fccb..2be4ec8b 100644 --- a/DiscImageChef.Server/Models/DeviceItem.cs +++ b/DiscImageChef.Server/Models/DeviceItem.cs @@ -35,9 +35,9 @@ namespace DiscImageChef.Server.Models public class DeviceItem { public string Manufacturer { get; set; } - public string Model { get; set; } - public string Revision { get; set; } - public string Bus { get; set; } - public int ReportId { get; set; } + public string Model { get; set; } + public string Revision { get; set; } + public string Bus { get; set; } + public int ReportId { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/DeviceStat.cs b/DiscImageChef.Server/Models/DeviceStat.cs index 719fbd36..ca677b8c 100644 --- a/DiscImageChef.Server/Models/DeviceStat.cs +++ b/DiscImageChef.Server/Models/DeviceStat.cs @@ -36,12 +36,13 @@ namespace DiscImageChef.Server.Models { public class DeviceStat { - [Key] public int Id { get; set; } + [Key] + public int Id { get; set; } - public string Manufacturer { get; set; } - public string Model { get; set; } - public string Revision { get; set; } - public string Bus { get; set; } - public virtual Device Report { get; set; } + public string Manufacturer { get; set; } + public string Model { get; set; } + public string Revision { get; set; } + public string Bus { get; set; } + public virtual Device Report { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/Filesystem.cs b/DiscImageChef.Server/Models/Filesystem.cs index c6eb3eb2..be57e4a7 100644 --- a/DiscImageChef.Server/Models/Filesystem.cs +++ b/DiscImageChef.Server/Models/Filesystem.cs @@ -36,9 +36,10 @@ namespace DiscImageChef.Server.Models { public class Filesystem { - [Key] public int Id { get; set; } + [Key] + public int Id { get; set; } - public string Name { get; set; } - public long Count { get; set; } + public string Name { get; set; } + public long Count { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/Filter.cs b/DiscImageChef.Server/Models/Filter.cs index 214b96e9..b573cc32 100644 --- a/DiscImageChef.Server/Models/Filter.cs +++ b/DiscImageChef.Server/Models/Filter.cs @@ -36,9 +36,10 @@ namespace DiscImageChef.Server.Models { public class Filter { - [Key] public int Id { get; set; } + [Key] + public int Id { get; set; } - public string Name { get; set; } - public long Count { get; set; } + public string Name { get; set; } + public long Count { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/Media.cs b/DiscImageChef.Server/Models/Media.cs index feefb42b..4771676f 100644 --- a/DiscImageChef.Server/Models/Media.cs +++ b/DiscImageChef.Server/Models/Media.cs @@ -36,10 +36,11 @@ namespace DiscImageChef.Server.Models { public class Media { - [Key] public int Id { get; set; } + [Key] + public int Id { get; set; } - public string Type { get; set; } - public bool Real { get; set; } - public long Count { get; set; } + public string Type { get; set; } + public bool Real { get; set; } + public long Count { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/MediaFormat.cs b/DiscImageChef.Server/Models/MediaFormat.cs index d9a68b41..e62d66d9 100644 --- a/DiscImageChef.Server/Models/MediaFormat.cs +++ b/DiscImageChef.Server/Models/MediaFormat.cs @@ -36,9 +36,10 @@ namespace DiscImageChef.Server.Models { public class MediaFormat { - [Key] public int Id { get; set; } + [Key] + public int Id { get; set; } - public string Name { get; set; } - public long Count { get; set; } + public string Name { get; set; } + public long Count { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/MediaItem.cs b/DiscImageChef.Server/Models/MediaItem.cs index 3d767491..3063e3a6 100644 --- a/DiscImageChef.Server/Models/MediaItem.cs +++ b/DiscImageChef.Server/Models/MediaItem.cs @@ -34,8 +34,8 @@ namespace DiscImageChef.Server.Models { public class MediaItem { - public string Type { get; set; } + public string Type { get; set; } public string SubType { get; set; } - public long Count { get; set; } + public long Count { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/OperatingSystem.cs b/DiscImageChef.Server/Models/OperatingSystem.cs index ba03b27b..d8c0676c 100644 --- a/DiscImageChef.Server/Models/OperatingSystem.cs +++ b/DiscImageChef.Server/Models/OperatingSystem.cs @@ -36,10 +36,11 @@ namespace DiscImageChef.Server.Models { public class OperatingSystem { - [Key] public int Id { get; set; } + [Key] + public int Id { get; set; } - public string Name { get; set; } + public string Name { get; set; } public string Version { get; set; } - public long Count { get; set; } + public long Count { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/Partition.cs b/DiscImageChef.Server/Models/Partition.cs index 9276ad94..36b74f66 100644 --- a/DiscImageChef.Server/Models/Partition.cs +++ b/DiscImageChef.Server/Models/Partition.cs @@ -36,9 +36,10 @@ namespace DiscImageChef.Server.Models { public class Partition { - [Key] public int Id { get; set; } + [Key] + public int Id { get; set; } - public string Name { get; set; } - public long Count { get; set; } + public string Name { get; set; } + public long Count { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/UploadedReport.cs b/DiscImageChef.Server/Models/UploadedReport.cs index 01ceb427..f2896247 100644 --- a/DiscImageChef.Server/Models/UploadedReport.cs +++ b/DiscImageChef.Server/Models/UploadedReport.cs @@ -37,27 +37,24 @@ namespace DiscImageChef.Server.Models { public class UploadedReport : DeviceReportV2 { - public UploadedReport() - { - UploadedWhen = DateTime.UtcNow; - } + public UploadedReport() => UploadedWhen = DateTime.UtcNow; public UploadedReport(DeviceReportV2 report) { - ATA = report.ATA; - ATAPI = report.ATAPI; - CompactFlash = report.CompactFlash; - FireWire = report.FireWire; - UploadedWhen = DateTime.UtcNow; + ATA = report.ATA; + ATAPI = report.ATAPI; + CompactFlash = report.CompactFlash; + FireWire = report.FireWire; + UploadedWhen = DateTime.UtcNow; MultiMediaCard = report.MultiMediaCard; - PCMCIA = report.PCMCIA; - SCSI = report.SCSI; - SecureDigital = report.SecureDigital; - USB = report.USB; - Manufacturer = report.Manufacturer; - Model = report.Model; - Revision = report.Revision; - Type = report.Type; + PCMCIA = report.PCMCIA; + SCSI = report.SCSI; + SecureDigital = report.SecureDigital; + USB = report.USB; + Manufacturer = report.Manufacturer; + Model = report.Model; + Revision = report.Revision; + Type = report.Type; } public DateTime UploadedWhen { get; set; } diff --git a/DiscImageChef.Server/Models/UsbProduct.cs b/DiscImageChef.Server/Models/UsbProduct.cs index 3a732c6a..45b22237 100644 --- a/DiscImageChef.Server/Models/UsbProduct.cs +++ b/DiscImageChef.Server/Models/UsbProduct.cs @@ -38,26 +38,26 @@ namespace DiscImageChef.Server.Models { public class UsbProduct { - public UsbProduct() - { - } + public UsbProduct() { } public UsbProduct(UsbVendor vendor, ushort id, string product) { ProductId = id; - Product = product; + Product = product; AddedWhen = ModifiedWhen = DateTime.UtcNow; - Vendor = vendor; + Vendor = vendor; } - [Key] public int Id { get; set; } + [Key] + public int Id { get; set; } - public ushort ProductId { get; set; } - public string Product { get; set; } - public DateTime AddedWhen { get; set; } + public ushort ProductId { get; set; } + public string Product { get; set; } + public DateTime AddedWhen { get; set; } public DateTime ModifiedWhen { get; set; } - public int VendorId { get; set; } + public int VendorId { get; set; } - [JsonIgnore] public virtual UsbVendor Vendor { get; set; } + [JsonIgnore] + public virtual UsbVendor Vendor { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/UsbVendor.cs b/DiscImageChef.Server/Models/UsbVendor.cs index deb766b1..a95752e7 100644 --- a/DiscImageChef.Server/Models/UsbVendor.cs +++ b/DiscImageChef.Server/Models/UsbVendor.cs @@ -39,24 +39,24 @@ namespace DiscImageChef.Server.Models { public class UsbVendor { - public UsbVendor() - { - } + public UsbVendor() { } public UsbVendor(ushort id, string vendor) { - VendorId = id; - Vendor = vendor; + VendorId = id; + Vendor = vendor; AddedWhen = ModifiedWhen = DateTime.UtcNow; } - [Key] public int Id { get; set; } + [Key] + public int Id { get; set; } - public ushort VendorId { get; set; } - public string Vendor { get; set; } - public DateTime AddedWhen { get; set; } + public ushort VendorId { get; set; } + public string Vendor { get; set; } + public DateTime AddedWhen { get; set; } public DateTime ModifiedWhen { get; set; } - [JsonIgnore] public virtual ICollection Products { get; set; } + [JsonIgnore] + public virtual ICollection Products { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Models/Version.cs b/DiscImageChef.Server/Models/Version.cs index 952cbebb..25bfa08c 100644 --- a/DiscImageChef.Server/Models/Version.cs +++ b/DiscImageChef.Server/Models/Version.cs @@ -36,9 +36,10 @@ namespace DiscImageChef.Server.Models { public class Version { - [Key] public int Id { get; set; } + [Key] + public int Id { get; set; } public string Value { get; set; } - public long Count { get; set; } + public long Count { get; set; } } } \ No newline at end of file diff --git a/DiscImageChef.Server/Program.cs b/DiscImageChef.Server/Program.cs index 48f26dff..b67fd5d9 100644 --- a/DiscImageChef.Server/Program.cs +++ b/DiscImageChef.Server/Program.cs @@ -19,72 +19,71 @@ namespace DiscImageChef.Server System.Console.Clear(); System.Console.Write( - "\u001b[32m . ,,\n" + - "\u001b[32m ;,. '0d.\n" + - "\u001b[32m oc oWd \u001b[31m" + - @"__/\\\\\\\\\\\\_____/\\\\\\\\\\\________/\\\\\\\\\_ " + - "\n\u001b[0m" + - "\u001b[32m ;X. 'WN' \u001b[31m" + - @" _\/\\\////////\\\__\/////\\\///______/\\\////////__ " + - "\n\u001b[0m" + - "\u001b[32m oMo cMM: \u001b[31m" + - @" _\/\\\______\//\\\_____\/\\\_______/\\\/___________ " + - "\n\u001b[0m" + - "\u001b[32m ;MM. .MMM; \u001b[31m" + - @" _\/\\\_______\/\\\_____\/\\\______/\\\_____________ " + - "\n\u001b[0m" + - "\u001b[32m NMM WMMW \u001b[31m" + - @" _\/\\\_______\/\\\_____\/\\\_____\/\\\_____________ " + - "\n\u001b[0m" + - "\u001b[32m 'MMM MMMM; \u001b[31m" + - @" _\/\\\_______\/\\\_____\/\\\_____\//\\\____________ " + - "\n\u001b[0m" + - "\u001b[32m ,MMM: dMMMM: \u001b[31m" + - @" _\/\\\_______/\\\______\/\\\______\///\\\__________ " + - "\n\u001b[0m" + - "\u001b[32m .MMMW. :MMMMM. \u001b[31m" + - @" _\/\\\\\\\\\\\\/____/\\\\\\\\\\\____\////\\\\\\\\\_ " + - "\n\u001b[0m" + - "\u001b[32m XMMMW: .:xKNMMMMMMN0d, lMMMMMd \u001b[31m" + - @" _\////////////_____\///////////________\/////////__" + - "\n\u001b[0m" + - "\u001b[32m :MMMMMK; cWMNkl:;;;:lxKMXc .0MMMMMO\u001b[0m\n" + - "\u001b[32m ..KMMMMMMNo,. ,OMMMMMMW:,. \u001b[37;1m DiscImageChef Website\u001b[0m\n" + - "\u001b[32m .;d0NMMMMMMMMMMMMMMW0d:' .;lOWMMMMMMMMMMMMMXkl. \u001b[37;1m Version \u001b[0m\u001b[33m{0}\u001b[37;1m-\u001b[0m\u001b[31m{1}\u001b[0m\n" + - "\u001b[32m :KMMMMMMMMMMMMMMMMMMMMMMMMc WMMMMMMMMMMMMMMMMMMMMMMWk'\u001b[0m\n" + - "\u001b[32m ;NMMMMWX0kkkkO0XMMMMMMMMMMM0' dNMMMMMMMMMMW0xl:;,;:oOWMMX; \u001b[37;1m Running under \u001b[35;1m{2}\u001b[37;1m, \u001b[35m{3}-bit\u001b[37;1m in \u001b[35m{4}-bit\u001b[37;1m mode.\u001b[0m\n" + - "\u001b[32m xMMWk:. .c0MMMMMW' OMMMMMM0c'.. .oNMO \u001b[37;1m Using \u001b[33;1m{5}\u001b[37;1m version \u001b[31;1m{6}\u001b[0m\n" + - "\u001b[32m OMNc .MNc oWMMk 'WMMNl. .MMK ;KX.\u001b[0m\n" + - "\u001b[32m xMO WMN ; ., , ': ,MMx lK\u001b[0m\n" + - "\u001b[32m ,Md cMMl .XMMMWWMMMO XMW. :\u001b[0m\n" + - "\u001b[32m Ok xMMl XMMMMMMMMc 0MW,\u001b[0m\n" + - "\u001b[32m 0 oMM0' lMMMMMMMM. :NMN'\u001b[0m\n" + - "\u001b[32m . .0MMKl ;MMMMMMMM oNMWd\u001b[0m\n" + - "\u001b[32m .dNW cMMMMMMMM, XKl\u001b[0m\n" + - "\u001b[32m 0MMMMMMMMK\u001b[0m\n" + - "\u001b[32m ;MMMMMMMMMMO \u001b[37;1m Proudly presented to you by:\u001b[0m\n" + - "\u001b[32m 'WMMMMKxMMMMM0 \u001b[34;1m Natalia Portillo\u001b[0m\n" + - "\u001b[32m oMMMMNc :WMMMMN:\u001b[0m\n" + - "\u001b[32m .dWMMM0; dWMMMMXl. \u001b[37;1m Thanks to all contributors, collaborators, translators, donators and friends.\u001b[0m\n" + - "\u001b[32m .......,cd0WMMNk: c0MMMMMWKkolc:clodc'\u001b[0m\n" + - "\u001b[32m .';loddol:'. ':oxkkOkkxoc,.\u001b[0m\n" + - "\u001b[0m\n", Version.GetVersion(), -#if DEBUG - "DEBUG" -#else + "\u001b[32m . ,,\n" + + "\u001b[32m ;,. '0d.\n" + + "\u001b[32m oc oWd \u001b[31m" + + @"__/\\\\\\\\\\\\_____/\\\\\\\\\\\________/\\\\\\\\\_ " + + "\n\u001b[0m" + + "\u001b[32m ;X. 'WN' \u001b[31m" + + @" _\/\\\////////\\\__\/////\\\///______/\\\////////__ " + + "\n\u001b[0m" + + "\u001b[32m oMo cMM: \u001b[31m" + + @" _\/\\\______\//\\\_____\/\\\_______/\\\/___________ " + + "\n\u001b[0m" + + "\u001b[32m ;MM. .MMM; \u001b[31m" + + @" _\/\\\_______\/\\\_____\/\\\______/\\\_____________ " + + "\n\u001b[0m" + + "\u001b[32m NMM WMMW \u001b[31m" + + @" _\/\\\_______\/\\\_____\/\\\_____\/\\\_____________ " + + "\n\u001b[0m" + + "\u001b[32m 'MMM MMMM; \u001b[31m" + + @" _\/\\\_______\/\\\_____\/\\\_____\//\\\____________ " + + "\n\u001b[0m" + + "\u001b[32m ,MMM: dMMMM: \u001b[31m" + + @" _\/\\\_______/\\\______\/\\\______\///\\\__________ " + + "\n\u001b[0m" + + "\u001b[32m .MMMW. :MMMMM. \u001b[31m" + + @" _\/\\\\\\\\\\\\/____/\\\\\\\\\\\____\////\\\\\\\\\_ " + + "\n\u001b[0m" + + "\u001b[32m XMMMW: .:xKNMMMMMMN0d, lMMMMMd \u001b[31m" + + @" _\////////////_____\///////////________\/////////__" + + "\n\u001b[0m" + + "\u001b[32m :MMMMMK; cWMNkl:;;;:lxKMXc .0MMMMMO\u001b[0m\n" + + "\u001b[32m ..KMMMMMMNo,. ,OMMMMMMW:,. \u001b[37;1m DiscImageChef Website\u001b[0m\n" + + "\u001b[32m .;d0NMMMMMMMMMMMMMMW0d:' .;lOWMMMMMMMMMMMMMXkl. \u001b[37;1m Version \u001b[0m\u001b[33m{0}\u001b[37;1m-\u001b[0m\u001b[31m{1}\u001b[0m\n" + + "\u001b[32m :KMMMMMMMMMMMMMMMMMMMMMMMMc WMMMMMMMMMMMMMMMMMMMMMMWk'\u001b[0m\n" + + "\u001b[32m ;NMMMMWX0kkkkO0XMMMMMMMMMMM0' dNMMMMMMMMMMW0xl:;,;:oOWMMX; \u001b[37;1m Running under \u001b[35;1m{2}\u001b[37;1m, \u001b[35m{3}-bit\u001b[37;1m in \u001b[35m{4}-bit\u001b[37;1m mode.\u001b[0m\n" + + "\u001b[32m xMMWk:. .c0MMMMMW' OMMMMMM0c'.. .oNMO \u001b[37;1m Using \u001b[33;1m{5}\u001b[37;1m version \u001b[31;1m{6}\u001b[0m\n" + + "\u001b[32m OMNc .MNc oWMMk 'WMMNl. .MMK ;KX.\u001b[0m\n" + + "\u001b[32m xMO WMN ; ., , ': ,MMx lK\u001b[0m\n" + + "\u001b[32m ,Md cMMl .XMMMWWMMMO XMW. :\u001b[0m\n" + + "\u001b[32m Ok xMMl XMMMMMMMMc 0MW,\u001b[0m\n" + + "\u001b[32m 0 oMM0' lMMMMMMMM. :NMN'\u001b[0m\n" + + "\u001b[32m . .0MMKl ;MMMMMMMM oNMWd\u001b[0m\n" + + "\u001b[32m .dNW cMMMMMMMM, XKl\u001b[0m\n" + + "\u001b[32m 0MMMMMMMMK\u001b[0m\n" + + "\u001b[32m ;MMMMMMMMMMO \u001b[37;1m Proudly presented to you by:\u001b[0m\n" + + "\u001b[32m 'WMMMMKxMMMMM0 \u001b[34;1m Natalia Portillo\u001b[0m\n" + + "\u001b[32m oMMMMNc :WMMMMN:\u001b[0m\n" + + "\u001b[32m .dWMMM0; dWMMMMXl. \u001b[37;1m Thanks to all contributors, collaborators, translators, donators and friends.\u001b[0m\n" + + "\u001b[32m .......,cd0WMMNk: c0MMMMMWKkolc:clodc'\u001b[0m\n" + + "\u001b[32m .';loddol:'. ':oxkkOkkxoc,.\u001b[0m\n" + + "\u001b[0m\n", Version.GetVersion(), + #if DEBUG + "DEBUG" + #else "RELEASE" -#endif - , DetectOS.GetPlatformName(DetectOS.GetRealPlatformID()), - Environment.Is64BitOperatingSystem ? 64 : 32, Environment.Is64BitProcess ? 64 : 32, - DetectOS.IsMono ? "Mono" : ".NET Core", - DetectOS.IsMono ? Version.GetMonoVersion() : Version.GetNetCoreVersion()); + #endif + , DetectOS.GetPlatformName(DetectOS.GetRealPlatformID()), + Environment.Is64BitOperatingSystem ? 64 : 32, Environment.Is64BitProcess ? 64 : 32, + DetectOS.IsMono ? "Mono" : ".NET Core", + DetectOS.IsMono ? Version.GetMonoVersion() : Version.GetNetCoreVersion()); - var host = CreateHostBuilder(args).Build(); + IHost host = CreateHostBuilder(args).Build(); - - using (var scope = host.Services.CreateScope()) + using(IServiceScope scope = host.Services.CreateScope()) { - var services = scope.ServiceProvider; + IServiceProvider services = scope.ServiceProvider; try { @@ -93,15 +92,16 @@ namespace DiscImageChef.Server var context = services.GetRequiredService(); context.Database.Migrate(); end = DateTime.Now; + System.Console.WriteLine("\u001b[31;1mTook \u001b[32;1m{0} seconds\u001b[31;1m...\u001b[0m", - (end - start).TotalSeconds); + (end - start).TotalSeconds); } - catch (Exception ex) + catch(Exception ex) { System.Console.WriteLine("\u001b[31;1mCould not open database...\u001b[0m"); -#if DEBUG + #if DEBUG System.Console.WriteLine("\u001b[31;1mException: {0}\u001b[0m", ex.Message); -#endif + #endif return; } } @@ -110,10 +110,11 @@ namespace DiscImageChef.Server host.Run(); } - public static IHostBuilder CreateHostBuilder(string[] args) - { - return Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); - } + public static IHostBuilder CreateHostBuilder(string[] args) => Host. + CreateDefaultBuilder(args). + ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); } } \ No newline at end of file diff --git a/DiscImageChef.Server/Startup.cs b/DiscImageChef.Server/Startup.cs index 6274ad2f..0c4aeaf2 100644 --- a/DiscImageChef.Server/Startup.cs +++ b/DiscImageChef.Server/Startup.cs @@ -12,10 +12,7 @@ namespace DiscImageChef.Server { public class Startup { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } + public Startup(IConfiguration configuration) => Configuration = configuration; public IConfiguration Configuration { get; } @@ -23,7 +20,8 @@ namespace DiscImageChef.Server public void ConfigureServices(IServiceCollection services) { services.AddDbContext(options => - options.UseMySql(Configuration.GetConnectionString("DefaultConnection"))); + options.UseMySql(Configuration. + GetConnectionString("DefaultConnection"))); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0); } @@ -36,13 +34,14 @@ namespace DiscImageChef.Server ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); - if (env.IsDevelopment()) + if(env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } @@ -55,9 +54,7 @@ namespace DiscImageChef.Server app.UseEndpoints(endpoints => { - endpoints.MapControllerRoute( - "default", - "{controller=Home}/{action=Index}/{id?}"); + endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); }); } } diff --git a/DiscImageChef.Server/Views/Home/CODE_OF_CONDUCT.cshtml b/DiscImageChef.Server/Views/Home/CODE_OF_CONDUCT.cshtml index aec00607..6b6bda17 100644 --- a/DiscImageChef.Server/Views/Home/CODE_OF_CONDUCT.cshtml +++ b/DiscImageChef.Server/Views/Home/CODE_OF_CONDUCT.cshtml @@ -36,7 +36,7 @@ // ****************************************************************************/ }

- @Html.ActionLink("Return to main page.", "Index")
+ @Html.ActionLink("Return to main page.", "Index")
DiscImageChef's code of conduct:

@Html.Raw(ViewBag.Markdown)
\ No newline at end of file diff --git a/DiscImageChef.Server/Views/Home/CONTRIBUTING.cshtml b/DiscImageChef.Server/Views/Home/CONTRIBUTING.cshtml index 900ced77..65d75687 100644 --- a/DiscImageChef.Server/Views/Home/CONTRIBUTING.cshtml +++ b/DiscImageChef.Server/Views/Home/CONTRIBUTING.cshtml @@ -36,7 +36,7 @@ // ****************************************************************************/ }

- @Html.ActionLink("Return to main page.", "Index")
+ @Html.ActionLink("Return to main page.", "Index")
How to contribute to DiscImageChef:

@Html.Raw(ViewBag.Markdown)
\ No newline at end of file diff --git a/DiscImageChef.Server/Views/Home/Changelog.cshtml b/DiscImageChef.Server/Views/Home/Changelog.cshtml index 73d12202..82cd302b 100644 --- a/DiscImageChef.Server/Views/Home/Changelog.cshtml +++ b/DiscImageChef.Server/Views/Home/Changelog.cshtml @@ -36,7 +36,7 @@ // ****************************************************************************/ }

- @Html.ActionLink("Return to main page.", "Index")
+ @Html.ActionLink("Return to main page.", "Index")
DiscImageChef list of changes:

@Html.Raw(ViewBag.Markdown)
\ No newline at end of file diff --git a/DiscImageChef.Server/Views/Home/DONATING.cshtml b/DiscImageChef.Server/Views/Home/DONATING.cshtml index d070d374..18538340 100644 --- a/DiscImageChef.Server/Views/Home/DONATING.cshtml +++ b/DiscImageChef.Server/Views/Home/DONATING.cshtml @@ -36,7 +36,7 @@ // ****************************************************************************/ }

- @Html.ActionLink("Return to main page.", "Index")
+ @Html.ActionLink("Return to main page.", "Index")
DiscImageChef list of things to be donated:

@Html.Raw(ViewBag.Markdown)
\ No newline at end of file diff --git a/DiscImageChef.Server/Views/Home/ISSUE_TEMPLATE.cshtml b/DiscImageChef.Server/Views/Home/ISSUE_TEMPLATE.cshtml index 045564e5..c29d744d 100644 --- a/DiscImageChef.Server/Views/Home/ISSUE_TEMPLATE.cshtml +++ b/DiscImageChef.Server/Views/Home/ISSUE_TEMPLATE.cshtml @@ -36,7 +36,7 @@ // ****************************************************************************/ }

- @Html.ActionLink("Return to main page.", "Index")
+ @Html.ActionLink("Return to main page.", "Index")
DiscImageChef's template for issue reports:

@Html.Raw(ViewBag.Markdown)
\ No newline at end of file diff --git a/DiscImageChef.Server/Views/Home/Index.cshtml b/DiscImageChef.Server/Views/Home/Index.cshtml index 9b98e8ab..142cbe60 100644 --- a/DiscImageChef.Server/Views/Home/Index.cshtml +++ b/DiscImageChef.Server/Views/Home/Index.cshtml @@ -38,8 +38,7 @@
Welcome to - + DiscImageChef Server version @ViewBag.lblVersion diff --git a/DiscImageChef.Server/Views/Home/PULL_REQUEST_TEMPLATE.cshtml b/DiscImageChef.Server/Views/Home/PULL_REQUEST_TEMPLATE.cshtml index d4f44b67..b613a629 100644 --- a/DiscImageChef.Server/Views/Home/PULL_REQUEST_TEMPLATE.cshtml +++ b/DiscImageChef.Server/Views/Home/PULL_REQUEST_TEMPLATE.cshtml @@ -36,7 +36,7 @@ // ****************************************************************************/ }

- @Html.ActionLink("Return to main page.", "Index")
+ @Html.ActionLink("Return to main page.", "Index")
DiscImageChef's template for pull requests:

@Html.Raw(ViewBag.Markdown)
\ No newline at end of file diff --git a/DiscImageChef.Server/Views/Home/TODO.cshtml b/DiscImageChef.Server/Views/Home/TODO.cshtml index acc4dc3e..db382d34 100644 --- a/DiscImageChef.Server/Views/Home/TODO.cshtml +++ b/DiscImageChef.Server/Views/Home/TODO.cshtml @@ -36,7 +36,7 @@ // ****************************************************************************/ }

- @Html.ActionLink("Return to main page.", "Index")
+ @Html.ActionLink("Return to main page.", "Index")
DiscImageChef list of things to do:

@Html.Raw(ViewBag.Markdown)
\ No newline at end of file diff --git a/DiscImageChef.Server/Views/Report/View.cshtml b/DiscImageChef.Server/Views/Report/View.cshtml index 50db6f5e..2b597ea8 100644 --- a/DiscImageChef.Server/Views/Report/View.cshtml +++ b/DiscImageChef.Server/Views/Report/View.cshtml @@ -45,11 +45,12 @@ DiscImageChef Report for @if (ViewBag.UsbItem != null) {
-
- USB characteristics:
- Manufacturer: @ViewBag.UsbItem.Manufacturer
- Product: @ViewBag.UsbItem.Product
- Vendor ID: @ViewBag.UsbItem.VendorDescription
+
+ USB characteristics: +
+ Manufacturer: @ViewBag.UsbItem.Manufacturer
+ Product: @ViewBag.UsbItem.Product
+ Vendor ID: @ViewBag.UsbItem.VendorDescription
Product ID: @ViewBag.UsbItem.ProductDescription
} @@ -57,11 +58,12 @@ DiscImageChef Report for @if (ViewBag.FireWireItem != null) {
-
- FireWire characteristics:
- Manufacturer: @ViewBag.FireWire.Manufacturer
- Product: @ViewBag.FireWire.Product
- Vendor ID: @ViewBag.FireWire.VendorDescription
+
+ FireWire characteristics: +
+ Manufacturer: @ViewBag.FireWire.Manufacturer
+ Product: @ViewBag.FireWire.Product
+ Vendor ID: @ViewBag.FireWire.VendorDescription
Product ID: @ViewBag.FireWire.ProductDescription
} @@ -69,18 +71,20 @@ DiscImageChef Report for @if (ViewBag.PcmciaItem != null) {
-
- PCMCIA characteristics:
- Manufacturer: @ViewBag.PcmciaItem.Manufacturer
- Product: @ViewBag.PcmciaItem.ProductName
- Manufacturer code: @ViewBag.PcmciaItem.VendorDescription
- Card code: @ViewBag.PcmciaItem.CardCode
- Compliance: @ViewBag.PcmciaItem.Compliance
+
+ PCMCIA characteristics: +
+ Manufacturer: @ViewBag.PcmciaItem.Manufacturer
+ Product: @ViewBag.PcmciaItem.ProductName
+ Manufacturer code: @ViewBag.PcmciaItem.VendorDescription
+ Card code: @ViewBag.PcmciaItem.CardCode
+ Compliance: @ViewBag.PcmciaItem.Compliance
@if (ViewBag.repPcmciaTuples != null) { foreach (KeyValuePair kvp in ViewBag.repPcmciaTuples) { - @kvp.Key: @kvp.Value
+ + @kvp.Key: @kvp.Value
} }
@@ -89,38 +93,42 @@ DiscImageChef Report for @if (ViewBag.AtaItem != null) {
-
+
@ViewBag.AtaItem characteristics: -
- @ViewBag.lblAtaDeviceType
+ +
+ @ViewBag.lblAtaDeviceType
@foreach (KeyValuePair kvp in ViewBag.repAtaTwo) { - @kvp.Key: @kvp.Value
+ + @kvp.Key: @kvp.Value
} -
+
@foreach (string item in ViewBag.repAtaOne) { - @Html.Raw(item)
+ @Html.Raw(item)
}
} @if (ViewBag.repScsi != null) {
-
- SCSI characteristics:
- Vendor: @ViewBag.lblScsiVendor
- Product: @ViewBag.lblScsiProduct
- Revision: @ViewBag.lblScsiRevision
+
+ SCSI characteristics: +
+ Vendor: @ViewBag.lblScsiVendor
+ Product: @ViewBag.lblScsiProduct
+ Revision: @ViewBag.lblScsiRevision
@foreach (string item in ViewBag.repScsi) { - @Html.Raw(item)
+ @Html.Raw(item)
} @if (ViewBag.repModeSense != null) {
-
SCSI mode sense pages: +
+ SCSI mode sense pages: @@ -143,7 +151,8 @@ DiscImageChef Report for @if (ViewBag.repEvpd != null) {
-
SCSI extended vital product data pages: +
+ SCSI extended vital product data pages:
Mode
@@ -166,47 +175,57 @@ DiscImageChef Report for @if (ViewBag.repScsiMmcMode != null) {
-
SCSI CD-ROM capabilities:
+
+ SCSI CD-ROM capabilities: +
@foreach (string item in ViewBag.repScsiMmcMode) { - @Html.Raw(item)
+ @Html.Raw(item)
}
} @if (ViewBag.repScsiMmcFeatures != null) {
-
SCSI MMC features:
+
+ SCSI MMC features: +
@foreach (string item in ViewBag.repScsiMmcFeatures) { - @Html.Raw(item)
+ @Html.Raw(item)
}
} @if (ViewBag.divScsiSscVisible == true) {
-
SCSI Streaming device capabilities:
- Block size granularity: @ViewBag.lblScsiSscGranularity
- Maximum block length: @ViewBag.lblScsiSscMaxBlock bytes
- Minimum block length: @ViewBag.lblScsiSscMinBlock bytes
+
+ SCSI Streaming device capabilities: +
+ Block size granularity: @ViewBag.lblScsiSscGranularity
+ Maximum block length: @ViewBag.lblScsiSscMaxBlock bytes +
+ Minimum block length: @ViewBag.lblScsiSscMinBlock bytes +
@if (ViewBag.repScsiSscDensities != null) { foreach (SupportedDensity density in ViewBag.repScsiSscDensities) { -
+
Information for supported density with primary code @($"{density.PrimaryCode:X2h}") and secondary code @($"{density.SecondaryCode:X2h}") -
- Drive can write this density: @density.Writable
- Duplicate density: @density.Duplicate
- Default density: @density.DefaultDensity
+ +
+ Drive can write this density: @density.Writable
+ Duplicate density: @density.Duplicate
+ Default density: @density.DefaultDensity
Density has @density.BitsPerMm bits per mm, with @density.Tracks tracks in a @density.Width mm width tape - Name: @density.Name
- Organization: @density.Organization
- Description: @density.Description
- Maximum capacity: @density.Capacity megabytes
+ Name: @density.Name
+ Organization: @density.Organization
+ Description: @density.Description
+ Maximum capacity: @density.Capacity megabytes +
} } @@ -215,14 +234,15 @@ DiscImageChef Report for foreach (SscSupportedMedia media in ViewBag.repScsiSscMedias) { -
+
Information for supported media with type code @($"{media.MediumType:X2h}") -
+ +
Media is @media.Length m long in a @media.Width mm width tape - Name: @media.Name
- Organization: @media.Organization
- Description: @media.Description
+ Name: @media.Name
+ Organization: @media.Organization
+ Description: @media.Description
} } @@ -233,32 +253,36 @@ DiscImageChef Report for @if (ViewBag.repTestedMedia != null) {
-
Tested media:
+
+ Tested media: +
@foreach (string item in ViewBag.repTestedMedia) { - @Html.Raw(item)
+ @Html.Raw(item)
}
} @if (ViewBag.repMMC != null) {
-
- MultiMediaCard device:
+
+ MultiMediaCard device: +
@foreach (string item in ViewBag.repMMC) { - @Html.Raw(item)
+ @Html.Raw(item)
}
} @if (ViewBag.repSD != null) {
-
- SecureDigital device:
+
+ SecureDigital device: +
@foreach (string item in ViewBag.repSD) { - @Html.Raw(item)
+ @Html.Raw(item)
}
} diff --git a/DiscImageChef.Server/Views/Shared/Error.cshtml b/DiscImageChef.Server/Views/Shared/Error.cshtml index 4d96f6a7..757f9b16 100644 --- a/DiscImageChef.Server/Views/Shared/Error.cshtml +++ b/DiscImageChef.Server/Views/Shared/Error.cshtml @@ -2,24 +2,26 @@ @{ ViewData["Title"] = "Error"; } -

Error.

An error occurred while processing your request.

- @if (Model.ShowRequestId) {

- Request ID: @Model.RequestId + Request ID: + @Model.RequestId

} -

Development Mode

- Swapping to Development environment will display more detailed information about the error that occurred. + Swapping to + Development environment will display more detailed information about the error that occurred.

The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. - For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + For local debugging, enable the + Development environment by setting the + ASPNETCORE_ENVIRONMENT environment variable to + Development and restarting the app.

\ No newline at end of file diff --git a/DiscImageChef.Server/Views/Shared/_Layout.cshtml b/DiscImageChef.Server/Views/Shared/_Layout.cshtml index ed840c09..72b602ac 100644 --- a/DiscImageChef.Server/Views/Shared/_Layout.cshtml +++ b/DiscImageChef.Server/Views/Shared/_Layout.cshtml @@ -39,23 +39,18 @@ { // 24th January, Macintosh launch case 24: - - + + break; default: - - + + break; } - + @ViewBag.Title - + - - + + + \ No newline at end of file diff --git a/DiscImageChef.Server/Views/Stats/Index.cshtml b/DiscImageChef.Server/Views/Stats/Index.cshtml index 1919c2df..7420b3aa 100644 --- a/DiscImageChef.Server/Views/Stats/Index.cshtml +++ b/DiscImageChef.Server/Views/Stats/Index.cshtml @@ -39,8 +39,7 @@
Welcome to - + DiscImageChef Server version @ViewBag.Version @@ -48,87 +47,57 @@
@if (ViewBag.repOperatingSystems != null) { -
-
EVPD
@foreach (NameValueStats os in ViewBag.repOperatingSystems) { } @@ -137,44 +106,32 @@ -
+
} @if (ViewBag.repVersions != null) { -
-
+
+
-
+
-
+

-

- -
+
- DiscImageChef has run on @os.name @os.Value times. + DiscImageChef has run on + @os.name @os.Value times.
@foreach (NameValueStats version in ViewBag.repVersions) { } @@ -183,37 +140,24 @@ -
+
} @if (ViewBag.repCommands != null) { -
-
+
+
-
+
-
+

-

- -
+
- DiscImageChef version @version.name has been used @version.Value times. + DiscImageChef version + @version.name has been used @version.Value times.
@foreach (Command command in ViewBag.repCommands) @@ -229,37 +173,24 @@ -
+
} @if (ViewBag.repFilters != null) { -
-
+
+
-
+
-
+

-

- -
+
@@ -286,32 +217,19 @@ } @if (ViewBag.repMediaImages != null) { -
-
+
+
-
+
-
+

-

- -
+
@@ -338,32 +256,19 @@ } @if (ViewBag.repPartitions != null) { -
-
+
+
-
+
-
+

-

- -
+
@@ -390,32 +295,19 @@ } @if (ViewBag.repFilesystems != null) { -
-
+
+
-
+
-
+

-

- -
+
@@ -442,32 +334,19 @@ } @if (ViewBag.repVirtualMedia != null) { -
-
+
+
-
+
-
+

-

- -
+
@@ -498,32 +377,19 @@ } @if (ViewBag.repRealMedia != null) { -
-
+
+
-
+
-
+

-

- -
+
@@ -554,49 +420,31 @@ } @if (ViewBag.repDevices != null) { -
-
@if (device.ReportId != 0) { - @Html.ActionLink("Yes", "View", "Report", new {id = device.ReportId}, new {target = "_blank"}) + @Html.ActionLink("Yes", "View", "Report", new + { + id = device.ReportId + }, new + { + target = "_blank" + }) } else {