Reformat code

This commit is contained in:
2023-06-01 04:17:16 +02:00
parent 23bfda2d75
commit ef92878cbd
53 changed files with 975 additions and 523 deletions

579
.editorconfig Normal file
View File

@@ -0,0 +1,579 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = false
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = true
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false
[*.css]
ij_css_align_closing_brace_with_properties = false
ij_css_blank_lines_around_nested_selector = 1
ij_css_blank_lines_between_blocks = 1
ij_css_block_comment_add_space = false
ij_css_brace_placement = end_of_line
ij_css_enforce_quotes_on_format = false
ij_css_hex_color_long_format = false
ij_css_hex_color_lower_case = false
ij_css_hex_color_short_format = false
ij_css_hex_color_upper_case = false
ij_css_keep_blank_lines_in_code = 2
ij_css_keep_indents_on_empty_lines = false
ij_css_keep_single_line_blocks = false
ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_css_space_after_colon = true
ij_css_space_before_opening_brace = true
ij_css_use_double_quotes = true
ij_css_value_alignment = do_not_align
[*.less]
indent_size = 2
ij_less_align_closing_brace_with_properties = false
ij_less_blank_lines_around_nested_selector = 1
ij_less_blank_lines_between_blocks = 1
ij_less_block_comment_add_space = false
ij_less_brace_placement = 0
ij_less_enforce_quotes_on_format = false
ij_less_hex_color_long_format = false
ij_less_hex_color_lower_case = false
ij_less_hex_color_short_format = false
ij_less_hex_color_upper_case = false
ij_less_keep_blank_lines_in_code = 2
ij_less_keep_indents_on_empty_lines = false
ij_less_keep_single_line_blocks = false
ij_less_line_comment_add_space = false
ij_less_line_comment_at_first_column = false
ij_less_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_less_space_after_colon = true
ij_less_space_before_opening_brace = true
ij_less_use_double_quotes = true
ij_less_value_alignment = 0
[*.properties]
ij_properties_align_group_field_declarations = false
ij_properties_keep_blank_lines = false
ij_properties_key_value_delimiter = equals
ij_properties_spaces_around_key_value_delimiter = false
[*.sass]
indent_size = 2
ij_sass_align_closing_brace_with_properties = false
ij_sass_blank_lines_around_nested_selector = 1
ij_sass_blank_lines_between_blocks = 1
ij_sass_brace_placement = 0
ij_sass_enforce_quotes_on_format = false
ij_sass_hex_color_long_format = false
ij_sass_hex_color_lower_case = false
ij_sass_hex_color_short_format = false
ij_sass_hex_color_upper_case = false
ij_sass_keep_blank_lines_in_code = 2
ij_sass_keep_indents_on_empty_lines = false
ij_sass_keep_single_line_blocks = false
ij_sass_line_comment_add_space = false
ij_sass_line_comment_at_first_column = false
ij_sass_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_sass_space_after_colon = true
ij_sass_space_before_opening_brace = true
ij_sass_use_double_quotes = true
ij_sass_value_alignment = 0
[*.scss]
indent_size = 2
ij_scss_align_closing_brace_with_properties = false
ij_scss_blank_lines_around_nested_selector = 1
ij_scss_blank_lines_between_blocks = 1
ij_scss_block_comment_add_space = false
ij_scss_brace_placement = 0
ij_scss_enforce_quotes_on_format = false
ij_scss_hex_color_long_format = false
ij_scss_hex_color_lower_case = false
ij_scss_hex_color_short_format = false
ij_scss_hex_color_upper_case = false
ij_scss_keep_blank_lines_in_code = 2
ij_scss_keep_indents_on_empty_lines = false
ij_scss_keep_single_line_blocks = false
ij_scss_line_comment_add_space = false
ij_scss_line_comment_at_first_column = false
ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_scss_space_after_colon = true
ij_scss_space_before_opening_brace = true
ij_scss_use_double_quotes = true
ij_scss_value_alignment = 0
[*.vue]
indent_size = 2
tab_width = 2
ij_continuation_indent_size = 4
ij_vue_indent_children_of_top_level = template
ij_vue_interpolation_new_line_after_start_delimiter = true
ij_vue_interpolation_new_line_before_end_delimiter = true
ij_vue_interpolation_wrap = off
ij_vue_keep_indents_on_empty_lines = false
ij_vue_spaces_within_interpolation_expressions = true
[.editorconfig]
ij_editorconfig_align_group_field_declarations = false
ij_editorconfig_space_after_colon = false
ij_editorconfig_space_after_comma = true
ij_editorconfig_space_before_colon = false
ij_editorconfig_space_before_comma = false
ij_editorconfig_spaces_around_assignment_operators = true
[{*.ant,*.appxmanifest,*.axml,*.cscfg,*.csdef,*.disco,*.dotsettings,*.filelayout,*.fxml,*.jhm,*.jnlp,*.jrxml,*.manifest,*.myapp,*.nuspec,*.rng,*.stylecop,*.svcmap,*.tld,*.wadcfgx,*.webref,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul,StyleCop.Cache}]
ij_xml_align_attributes = true
ij_xml_align_text = false
ij_xml_attribute_wrap = normal
ij_xml_block_comment_add_space = false
ij_xml_block_comment_at_first_column = true
ij_xml_keep_blank_lines = 2
ij_xml_keep_indents_on_empty_lines = false
ij_xml_keep_line_breaks = true
ij_xml_keep_line_breaks_in_text = true
ij_xml_keep_whitespaces = false
ij_xml_keep_whitespaces_around_cdata = preserve
ij_xml_keep_whitespaces_inside_cdata = false
ij_xml_line_comment_at_first_column = true
ij_xml_space_after_tag_name = false
ij_xml_space_around_equals_in_attribute = false
ij_xml_space_inside_empty_tag = false
ij_xml_text_wrap = normal
[{*.ats,*.cts,*.mts,*.ts}]
ij_continuation_indent_size = 4
ij_typescript_align_imports = false
ij_typescript_align_multiline_array_initializer_expression = false
ij_typescript_align_multiline_binary_operation = false
ij_typescript_align_multiline_chained_methods = false
ij_typescript_align_multiline_extends_list = false
ij_typescript_align_multiline_for = true
ij_typescript_align_multiline_parameters = true
ij_typescript_align_multiline_parameters_in_calls = false
ij_typescript_align_multiline_ternary_operation = false
ij_typescript_align_object_properties = 0
ij_typescript_align_union_types = false
ij_typescript_align_var_statements = 0
ij_typescript_array_initializer_new_line_after_left_brace = false
ij_typescript_array_initializer_right_brace_on_new_line = false
ij_typescript_array_initializer_wrap = off
ij_typescript_assignment_wrap = off
ij_typescript_binary_operation_sign_on_next_line = false
ij_typescript_binary_operation_wrap = off
ij_typescript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/**
ij_typescript_blank_lines_after_imports = 1
ij_typescript_blank_lines_around_class = 1
ij_typescript_blank_lines_around_field = 0
ij_typescript_blank_lines_around_field_in_interface = 0
ij_typescript_blank_lines_around_function = 1
ij_typescript_blank_lines_around_method = 1
ij_typescript_blank_lines_around_method_in_interface = 1
ij_typescript_block_brace_style = end_of_line
ij_typescript_block_comment_add_space = false
ij_typescript_block_comment_at_first_column = true
ij_typescript_call_parameters_new_line_after_left_paren = false
ij_typescript_call_parameters_right_paren_on_new_line = false
ij_typescript_call_parameters_wrap = off
ij_typescript_catch_on_new_line = false
ij_typescript_chained_call_dot_on_new_line = true
ij_typescript_class_brace_style = end_of_line
ij_typescript_comma_on_new_line = false
ij_typescript_do_while_brace_force = never
ij_typescript_else_on_new_line = false
ij_typescript_enforce_trailing_comma = keep
ij_typescript_enum_constants_wrap = on_every_item
ij_typescript_extends_keyword_wrap = off
ij_typescript_extends_list_wrap = off
ij_typescript_field_prefix = _
ij_typescript_file_name_style = relaxed
ij_typescript_finally_on_new_line = false
ij_typescript_for_brace_force = never
ij_typescript_for_statement_new_line_after_left_paren = false
ij_typescript_for_statement_right_paren_on_new_line = false
ij_typescript_for_statement_wrap = off
ij_typescript_force_quote_style = false
ij_typescript_force_semicolon_style = false
ij_typescript_function_expression_brace_style = end_of_line
ij_typescript_if_brace_force = never
ij_typescript_import_merge_members = global
ij_typescript_import_prefer_absolute_path = global
ij_typescript_import_sort_members = true
ij_typescript_import_sort_module_name = false
ij_typescript_import_use_node_resolution = true
ij_typescript_imports_wrap = on_every_item
ij_typescript_indent_case_from_switch = true
ij_typescript_indent_chained_calls = true
ij_typescript_indent_package_children = 0
ij_typescript_jsdoc_include_types = false
ij_typescript_jsx_attribute_value = braces
ij_typescript_keep_blank_lines_in_code = 2
ij_typescript_keep_first_column_comment = true
ij_typescript_keep_indents_on_empty_lines = false
ij_typescript_keep_line_breaks = true
ij_typescript_keep_simple_blocks_in_one_line = false
ij_typescript_keep_simple_methods_in_one_line = false
ij_typescript_line_comment_add_space = true
ij_typescript_line_comment_at_first_column = false
ij_typescript_method_brace_style = end_of_line
ij_typescript_method_call_chain_wrap = off
ij_typescript_method_parameters_new_line_after_left_paren = false
ij_typescript_method_parameters_right_paren_on_new_line = false
ij_typescript_method_parameters_wrap = off
ij_typescript_object_literal_wrap = on_every_item
ij_typescript_object_types_wrap = on_every_item
ij_typescript_parentheses_expression_new_line_after_left_paren = false
ij_typescript_parentheses_expression_right_paren_on_new_line = false
ij_typescript_place_assignment_sign_on_next_line = false
ij_typescript_prefer_as_type_cast = false
ij_typescript_prefer_explicit_types_function_expression_returns = false
ij_typescript_prefer_explicit_types_function_returns = false
ij_typescript_prefer_explicit_types_vars_fields = false
ij_typescript_prefer_parameters_wrap = false
ij_typescript_reformat_c_style_comments = false
ij_typescript_space_after_colon = true
ij_typescript_space_after_comma = true
ij_typescript_space_after_dots_in_rest_parameter = false
ij_typescript_space_after_generator_mult = true
ij_typescript_space_after_property_colon = true
ij_typescript_space_after_quest = true
ij_typescript_space_after_type_colon = true
ij_typescript_space_after_unary_not = false
ij_typescript_space_before_async_arrow_lparen = true
ij_typescript_space_before_catch_keyword = true
ij_typescript_space_before_catch_left_brace = true
ij_typescript_space_before_catch_parentheses = true
ij_typescript_space_before_class_lbrace = true
ij_typescript_space_before_class_left_brace = true
ij_typescript_space_before_colon = true
ij_typescript_space_before_comma = false
ij_typescript_space_before_do_left_brace = true
ij_typescript_space_before_else_keyword = true
ij_typescript_space_before_else_left_brace = true
ij_typescript_space_before_finally_keyword = true
ij_typescript_space_before_finally_left_brace = true
ij_typescript_space_before_for_left_brace = true
ij_typescript_space_before_for_parentheses = true
ij_typescript_space_before_for_semicolon = false
ij_typescript_space_before_function_left_parenth = true
ij_typescript_space_before_generator_mult = false
ij_typescript_space_before_if_left_brace = true
ij_typescript_space_before_if_parentheses = true
ij_typescript_space_before_method_call_parentheses = false
ij_typescript_space_before_method_left_brace = true
ij_typescript_space_before_method_parentheses = false
ij_typescript_space_before_property_colon = false
ij_typescript_space_before_quest = true
ij_typescript_space_before_switch_left_brace = true
ij_typescript_space_before_switch_parentheses = true
ij_typescript_space_before_try_left_brace = true
ij_typescript_space_before_type_colon = false
ij_typescript_space_before_unary_not = false
ij_typescript_space_before_while_keyword = true
ij_typescript_space_before_while_left_brace = true
ij_typescript_space_before_while_parentheses = true
ij_typescript_spaces_around_additive_operators = true
ij_typescript_spaces_around_arrow_function_operator = true
ij_typescript_spaces_around_assignment_operators = true
ij_typescript_spaces_around_bitwise_operators = true
ij_typescript_spaces_around_equality_operators = true
ij_typescript_spaces_around_logical_operators = true
ij_typescript_spaces_around_multiplicative_operators = true
ij_typescript_spaces_around_relational_operators = true
ij_typescript_spaces_around_shift_operators = true
ij_typescript_spaces_around_unary_operator = false
ij_typescript_spaces_within_array_initializer_brackets = false
ij_typescript_spaces_within_brackets = false
ij_typescript_spaces_within_catch_parentheses = false
ij_typescript_spaces_within_for_parentheses = false
ij_typescript_spaces_within_if_parentheses = false
ij_typescript_spaces_within_imports = false
ij_typescript_spaces_within_interpolation_expressions = false
ij_typescript_spaces_within_method_call_parentheses = false
ij_typescript_spaces_within_method_parentheses = false
ij_typescript_spaces_within_object_literal_braces = false
ij_typescript_spaces_within_object_type_braces = true
ij_typescript_spaces_within_parentheses = false
ij_typescript_spaces_within_switch_parentheses = false
ij_typescript_spaces_within_type_assertion = false
ij_typescript_spaces_within_union_types = true
ij_typescript_spaces_within_while_parentheses = false
ij_typescript_special_else_if_treatment = true
ij_typescript_ternary_operation_signs_on_next_line = false
ij_typescript_ternary_operation_wrap = off
ij_typescript_union_types_wrap = on_every_item
ij_typescript_use_chained_calls_group_indents = false
ij_typescript_use_double_quotes = true
ij_typescript_use_explicit_js_extension = auto
ij_typescript_use_path_mapping = always
ij_typescript_use_public_modifier = false
ij_typescript_use_semicolon_after_statement = true
ij_typescript_var_declaration_wrap = normal
ij_typescript_while_brace_force = never
ij_typescript_while_on_new_line = false
ij_typescript_wrap_comments = false
[{*.bash,*.sh,*.zsh}]
indent_size = 2
tab_width = 2
ij_shell_binary_ops_start_line = false
ij_shell_keep_column_alignment_padding = false
ij_shell_minify_program = false
ij_shell_redirect_followed_by_space = false
ij_shell_switch_cases_indented = false
ij_shell_use_unix_line_separator = true
[{*.cjs,*.js}]
ij_continuation_indent_size = 4
ij_javascript_align_imports = false
ij_javascript_align_multiline_array_initializer_expression = false
ij_javascript_align_multiline_binary_operation = false
ij_javascript_align_multiline_chained_methods = false
ij_javascript_align_multiline_extends_list = false
ij_javascript_align_multiline_for = true
ij_javascript_align_multiline_parameters = true
ij_javascript_align_multiline_parameters_in_calls = false
ij_javascript_align_multiline_ternary_operation = false
ij_javascript_align_object_properties = 0
ij_javascript_align_union_types = false
ij_javascript_align_var_statements = 0
ij_javascript_array_initializer_new_line_after_left_brace = false
ij_javascript_array_initializer_right_brace_on_new_line = false
ij_javascript_array_initializer_wrap = off
ij_javascript_assignment_wrap = off
ij_javascript_binary_operation_sign_on_next_line = false
ij_javascript_binary_operation_wrap = off
ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/**
ij_javascript_blank_lines_after_imports = 1
ij_javascript_blank_lines_around_class = 1
ij_javascript_blank_lines_around_field = 0
ij_javascript_blank_lines_around_function = 1
ij_javascript_blank_lines_around_method = 1
ij_javascript_block_brace_style = end_of_line
ij_javascript_block_comment_add_space = false
ij_javascript_block_comment_at_first_column = true
ij_javascript_call_parameters_new_line_after_left_paren = false
ij_javascript_call_parameters_right_paren_on_new_line = false
ij_javascript_call_parameters_wrap = off
ij_javascript_catch_on_new_line = false
ij_javascript_chained_call_dot_on_new_line = true
ij_javascript_class_brace_style = end_of_line
ij_javascript_comma_on_new_line = false
ij_javascript_do_while_brace_force = never
ij_javascript_else_on_new_line = false
ij_javascript_enforce_trailing_comma = keep
ij_javascript_extends_keyword_wrap = off
ij_javascript_extends_list_wrap = off
ij_javascript_field_prefix = _
ij_javascript_file_name_style = relaxed
ij_javascript_finally_on_new_line = false
ij_javascript_for_brace_force = never
ij_javascript_for_statement_new_line_after_left_paren = false
ij_javascript_for_statement_right_paren_on_new_line = false
ij_javascript_for_statement_wrap = off
ij_javascript_force_quote_style = false
ij_javascript_force_semicolon_style = false
ij_javascript_function_expression_brace_style = end_of_line
ij_javascript_if_brace_force = never
ij_javascript_import_merge_members = global
ij_javascript_import_prefer_absolute_path = global
ij_javascript_import_sort_members = true
ij_javascript_import_sort_module_name = false
ij_javascript_import_use_node_resolution = true
ij_javascript_imports_wrap = on_every_item
ij_javascript_indent_case_from_switch = true
ij_javascript_indent_chained_calls = true
ij_javascript_indent_package_children = 0
ij_javascript_jsx_attribute_value = braces
ij_javascript_keep_blank_lines_in_code = 2
ij_javascript_keep_first_column_comment = true
ij_javascript_keep_indents_on_empty_lines = false
ij_javascript_keep_line_breaks = true
ij_javascript_keep_simple_blocks_in_one_line = false
ij_javascript_keep_simple_methods_in_one_line = false
ij_javascript_line_comment_add_space = true
ij_javascript_line_comment_at_first_column = false
ij_javascript_method_brace_style = end_of_line
ij_javascript_method_call_chain_wrap = off
ij_javascript_method_parameters_new_line_after_left_paren = false
ij_javascript_method_parameters_right_paren_on_new_line = false
ij_javascript_method_parameters_wrap = off
ij_javascript_object_literal_wrap = on_every_item
ij_javascript_object_types_wrap = on_every_item
ij_javascript_parentheses_expression_new_line_after_left_paren = false
ij_javascript_parentheses_expression_right_paren_on_new_line = false
ij_javascript_place_assignment_sign_on_next_line = false
ij_javascript_prefer_as_type_cast = false
ij_javascript_prefer_explicit_types_function_expression_returns = false
ij_javascript_prefer_explicit_types_function_returns = false
ij_javascript_prefer_explicit_types_vars_fields = false
ij_javascript_prefer_parameters_wrap = false
ij_javascript_reformat_c_style_comments = false
ij_javascript_space_after_colon = true
ij_javascript_space_after_comma = true
ij_javascript_space_after_dots_in_rest_parameter = false
ij_javascript_space_after_generator_mult = true
ij_javascript_space_after_property_colon = true
ij_javascript_space_after_quest = true
ij_javascript_space_after_type_colon = true
ij_javascript_space_after_unary_not = false
ij_javascript_space_before_async_arrow_lparen = true
ij_javascript_space_before_catch_keyword = true
ij_javascript_space_before_catch_left_brace = true
ij_javascript_space_before_catch_parentheses = true
ij_javascript_space_before_class_lbrace = true
ij_javascript_space_before_class_left_brace = true
ij_javascript_space_before_colon = true
ij_javascript_space_before_comma = false
ij_javascript_space_before_do_left_brace = true
ij_javascript_space_before_else_keyword = true
ij_javascript_space_before_else_left_brace = true
ij_javascript_space_before_finally_keyword = true
ij_javascript_space_before_finally_left_brace = true
ij_javascript_space_before_for_left_brace = true
ij_javascript_space_before_for_parentheses = true
ij_javascript_space_before_for_semicolon = false
ij_javascript_space_before_function_left_parenth = true
ij_javascript_space_before_generator_mult = false
ij_javascript_space_before_if_left_brace = true
ij_javascript_space_before_if_parentheses = true
ij_javascript_space_before_method_call_parentheses = false
ij_javascript_space_before_method_left_brace = true
ij_javascript_space_before_method_parentheses = false
ij_javascript_space_before_property_colon = false
ij_javascript_space_before_quest = true
ij_javascript_space_before_switch_left_brace = true
ij_javascript_space_before_switch_parentheses = true
ij_javascript_space_before_try_left_brace = true
ij_javascript_space_before_type_colon = false
ij_javascript_space_before_unary_not = false
ij_javascript_space_before_while_keyword = true
ij_javascript_space_before_while_left_brace = true
ij_javascript_space_before_while_parentheses = true
ij_javascript_spaces_around_additive_operators = true
ij_javascript_spaces_around_arrow_function_operator = true
ij_javascript_spaces_around_assignment_operators = true
ij_javascript_spaces_around_bitwise_operators = true
ij_javascript_spaces_around_equality_operators = true
ij_javascript_spaces_around_logical_operators = true
ij_javascript_spaces_around_multiplicative_operators = true
ij_javascript_spaces_around_relational_operators = true
ij_javascript_spaces_around_shift_operators = true
ij_javascript_spaces_around_unary_operator = false
ij_javascript_spaces_within_array_initializer_brackets = false
ij_javascript_spaces_within_brackets = false
ij_javascript_spaces_within_catch_parentheses = false
ij_javascript_spaces_within_for_parentheses = false
ij_javascript_spaces_within_if_parentheses = false
ij_javascript_spaces_within_imports = false
ij_javascript_spaces_within_interpolation_expressions = false
ij_javascript_spaces_within_method_call_parentheses = false
ij_javascript_spaces_within_method_parentheses = false
ij_javascript_spaces_within_object_literal_braces = false
ij_javascript_spaces_within_object_type_braces = true
ij_javascript_spaces_within_parentheses = false
ij_javascript_spaces_within_switch_parentheses = false
ij_javascript_spaces_within_type_assertion = false
ij_javascript_spaces_within_union_types = true
ij_javascript_spaces_within_while_parentheses = false
ij_javascript_special_else_if_treatment = true
ij_javascript_ternary_operation_signs_on_next_line = false
ij_javascript_ternary_operation_wrap = off
ij_javascript_union_types_wrap = on_every_item
ij_javascript_use_chained_calls_group_indents = false
ij_javascript_use_double_quotes = true
ij_javascript_use_explicit_js_extension = auto
ij_javascript_use_path_mapping = always
ij_javascript_use_public_modifier = false
ij_javascript_use_semicolon_after_statement = true
ij_javascript_var_declaration_wrap = normal
ij_javascript_while_brace_force = never
ij_javascript_while_on_new_line = false
ij_javascript_wrap_comments = false
[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config}]
indent_size = 2
ij_json_array_wrapping = split_into_lines
ij_json_keep_blank_lines_in_code = 0
ij_json_keep_indents_on_empty_lines = false
ij_json_keep_line_breaks = true
ij_json_keep_trailing_comma = false
ij_json_object_wrapping = split_into_lines
ij_json_property_alignment = do_not_align
ij_json_space_after_colon = true
ij_json_space_after_comma = true
ij_json_space_before_colon = false
ij_json_space_before_comma = false
ij_json_spaces_within_braces = false
ij_json_spaces_within_brackets = false
ij_json_wrap_long_lines = false
[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}]
ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3
ij_html_align_attributes = true
ij_html_align_text = false
ij_html_attribute_wrap = normal
ij_html_block_comment_add_space = false
ij_html_block_comment_at_first_column = true
ij_html_do_not_align_children_of_min_lines = 0
ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p
ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot
ij_html_enforce_quotes = false
ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var
ij_html_keep_blank_lines = 2
ij_html_keep_indents_on_empty_lines = false
ij_html_keep_line_breaks = true
ij_html_keep_line_breaks_in_text = true
ij_html_keep_whitespaces = false
ij_html_keep_whitespaces_inside = span,pre,textarea
ij_html_line_comment_at_first_column = true
ij_html_new_line_after_last_attribute = never
ij_html_new_line_before_first_attribute = never
ij_html_quote_style = double
ij_html_remove_new_line_before_tags = br
ij_html_space_after_tag_name = false
ij_html_space_around_equality_in_attribute = false
ij_html_space_inside_empty_tag = false
ij_html_text_wrap = normal
[{*.http,*.rest}]
indent_size = 0
ij_continuation_indent_size = 4
ij_http request_call_parameters_wrap = normal
[{*.markdown,*.md}]
ij_markdown_force_one_space_after_blockquote_symbol = true
ij_markdown_force_one_space_after_header_symbol = true
ij_markdown_force_one_space_after_list_bullet = true
ij_markdown_force_one_space_between_words = true
ij_markdown_format_tables = true
ij_markdown_insert_quote_arrows_on_wrap = true
ij_markdown_keep_indents_on_empty_lines = false
ij_markdown_keep_line_breaks_inside_text_blocks = true
ij_markdown_max_lines_around_block_elements = 1
ij_markdown_max_lines_around_header = 1
ij_markdown_max_lines_between_paragraphs = 1
ij_markdown_min_lines_around_block_elements = 1
ij_markdown_min_lines_around_header = 1
ij_markdown_min_lines_between_paragraphs = 1
ij_markdown_wrap_text_if_long = true
ij_markdown_wrap_text_inside_blockquotes = true
[{*.yaml,*.yml}]
indent_size = 2
ij_yaml_align_values_properties = do_not_align
ij_yaml_autoinsert_sequence_marker = true
ij_yaml_block_mapping_on_new_line = false
ij_yaml_indent_sequence_value = true
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_line_breaks = true
ij_yaml_sequence_on_new_line = false
ij_yaml_space_before_colon = false
ij_yaml_spaces_within_braces = true
ij_yaml_spaces_within_brackets = true

View File

@@ -10,10 +10,7 @@ public class AspnetCoreWebContext : IWebContext
{ {
private readonly HttpContext _context; private readonly HttpContext _context;
public AspnetCoreWebContext(HttpContext context) public AspnetCoreWebContext(HttpContext context) { _context = context; }
{
_context = context;
}
public string RequestPath => _context.Request.Path; public string RequestPath => _context.Request.Path;
@@ -82,49 +79,34 @@ public class AspnetCoreWebContext : IWebContext
_requestForm = _context.Request.Form _requestForm = _context.Request.Form
.ToDictionary(p => p.Key, p => p.Value[0]); .ToDictionary(p => p.Key, p => p.Value[0]);
} }
else else { _requestForm = new Dictionary<string, string?>(); }
{
_requestForm = new Dictionary<string, string?>();
}
} }
return _requestForm; return _requestForm;
} }
} }
public void ResponseWrite(string text) public void ResponseWrite(string text) { _context.Response.WriteAsync(text).GetAwaiter().GetResult(); }
{
_context.Response.WriteAsync(text).GetAwaiter().GetResult();
}
public void ResponseWriteBin(byte[] content) public void ResponseWriteBin(byte[] content)
{ {
_context.Response.Body.WriteAsync(content).GetAwaiter().GetResult(); _context.Response.Body.WriteAsync(content).GetAwaiter().GetResult();
} }
public void ResponseFlush() public void ResponseFlush() { _context.Response.Body.FlushAsync().GetAwaiter().GetResult(); }
{
_context.Response.Body.FlushAsync().GetAwaiter().GetResult();
}
public void ResponseRedirect(string url) public void ResponseRedirect(string url) { _context.Response.Redirect(url); }
{
_context.Response.Redirect(url);
}
public void AddResponseCookie(string cookieName, string value, DateTime? expiration = null) public void AddResponseCookie(string cookieName, string value, DateTime? expiration = null)
{ {
_context.Response.Cookies.Append( _context.Response.Cookies.Append(
key: cookieName, key: cookieName,
value: value, value: value,
options: new CookieOptions {Expires = expiration,} options: new CookieOptions { Expires = expiration, }
); );
} }
public void DelResponseCookie(string cookieName) public void DelResponseCookie(string cookieName) { _context.Response.Cookies.Delete(cookieName); }
{
_context.Response.Cookies.Delete(cookieName);
}
public bool ResponseHasStarted => _context.Response.HasStarted; public bool ResponseHasStarted => _context.Response.HasStarted;
@@ -140,10 +122,7 @@ public class AspnetCoreWebContext : IWebContext
set => _context.Response.ContentType = value; set => _context.Response.ContentType = value;
} }
public void SetResponseHeader(string key, string value) public void SetResponseHeader(string key, string value) { _context.Response.Headers.SafeSet(key, value); }
{
_context.Response.Headers.SafeSet(key, value);
}
public void PrepareCacheableResponse() public void PrepareCacheableResponse()
{ {
@@ -161,5 +140,4 @@ public class AspnetCoreWebContext : IWebContext
.ToString("ddd, dd MMM yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); .ToString("ddd, dd MMM yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
_context.Response.Headers.SafeSet("Expires", $"{expireDate} GMT"); _context.Response.Headers.SafeSet("Expires", $"{expireDate} GMT");
} }
} }

View File

@@ -46,7 +46,6 @@ public class GlobalRouterMiddleware
} }
private static bool IsIgnoreException(Exception ex) { return ex is ThreadAbortException; } private static bool IsIgnoreException(Exception ex) { return ex is ThreadAbortException; }
} }
public static class GlobalRouterMiddlewareExtensions public static class GlobalRouterMiddlewareExtensions

View File

@@ -5,15 +5,9 @@ namespace VAR.WebFormsCore.AspNetCore;
public static class DefaultMain public static class DefaultMain
{ {
public static void WebFormCoreMain(string[] args) public static void WebFormCoreMain(string[] args) { CreateHostBuilder(args).Build().Run(); }
{
CreateHostBuilder(args).Build().Run();
}
private static IHostBuilder CreateHostBuilder(string[] args) => private static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args) Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
{
webBuilder.UseStartup<Startup>();
});
} }

View File

@@ -11,14 +11,8 @@ public class Startup
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
// If using Kestrel: // If using Kestrel:
services.Configure<KestrelServerOptions>(options => services.Configure<KestrelServerOptions>(options => { options.AddServerHeader = false; });
{
options.AddServerHeader = false;
});
} }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseGlobalRouterMiddleware(env); }
{
app.UseGlobalRouterMiddleware(env);
}
} }

View File

@@ -7,7 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\VAR.WebFormsCore\VAR.WebFormsCore.csproj" /> <ProjectReference Include="..\VAR.WebFormsCore\VAR.WebFormsCore.csproj"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -5,7 +5,7 @@ using VAR.WebFormsCore.Pages;
namespace VAR.WebFormsCore.TestWebApp; namespace VAR.WebFormsCore.TestWebApp;
public class FrmDefault: PageCommon public class FrmDefault : PageCommon
{ {
private readonly CTextBox _txtText = new() { ID = "txtText", CssClassExtra = "width150px", AllowEmpty = false }; private readonly CTextBox _txtText = new() { ID = "txtText", CssClassExtra = "width150px", AllowEmpty = false };
private readonly Button _btnTest = new() { ID = "btnTest", }; private readonly Button _btnTest = new() { ID = "btnTest", };
@@ -17,10 +17,7 @@ public class FrmDefault: PageCommon
Init += FrmLogin_Init; Init += FrmLogin_Init;
} }
private void FrmLogin_Init(object? sender, EventArgs e) private void FrmLogin_Init(object? sender, EventArgs e) { InitializeControls(); }
{
InitializeControls();
}
private void InitializeControls() private void InitializeControls()
{ {
@@ -38,8 +35,5 @@ public class FrmDefault: PageCommon
Controls.Add(FormUtils.CreateField(string.Empty, _lblMessage)); Controls.Add(FormUtils.CreateField(string.Empty, _lblMessage));
} }
private void BtnTest_Click(object? sender, EventArgs e) private void BtnTest_Click(object? sender, EventArgs e) { _lblMessage.Text = $"Hello World: {_txtText.Text}"; }
{
_lblMessage.Text = $"Hello World: {_txtText.Text}";
}
} }

View File

@@ -4,9 +4,5 @@ namespace VAR.WebFormsCore.TestWebApp;
public static class Program public static class Program
{ {
public static void Main(string[] args) public static void Main(string[] args) { DefaultMain.WebFormCoreMain(args); }
{
DefaultMain.WebFormCoreMain(args);
}
} }

View File

@@ -15,12 +15,7 @@ public class TestWebAppGlobalConfig : IGlobalConfig
public List<string> AllowedExtensions { get; } = new() public List<string> AllowedExtensions { get; } = new()
{ ".png", ".jpg", ".jpeg", ".gif", ".ico", ".wav", ".mp3", ".ogg", ".mp4", ".webm", ".webp", ".mkv", ".avi" }; { ".png", ".jpg", ".jpeg", ".gif", ".ico", ".wav", ".mp3", ".ogg", ".mp4", ".webm", ".webp", ".mkv", ".avi" };
public bool IsUserAuthenticated(IWebContext context) public bool IsUserAuthenticated(IWebContext context) { return false; }
{
return false;
}
public void UserDeauthenticate(IWebContext context) public void UserDeauthenticate(IWebContext context) { }
{
}
} }

View File

@@ -6,8 +6,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\VAR.WebFormsCore.AspNetCore\VAR.WebFormsCore.AspNetCore.csproj" /> <ProjectReference Include="..\VAR.WebFormsCore.AspNetCore\VAR.WebFormsCore.AspNetCore.csproj"/>
<ProjectReference Include="..\VAR.WebFormsCore\VAR.WebFormsCore.csproj" /> <ProjectReference Include="..\VAR.WebFormsCore\VAR.WebFormsCore.csproj"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -13,7 +13,9 @@ public class ObjectActivatorTests
Assert.IsType<object>(result); Assert.IsType<object>(result);
} }
private class TestType { } private class TestType
{
}
[Fact] [Fact]
public void CreateInstance__TestType__TestType() public void CreateInstance__TestType__TestType()

View File

@@ -53,10 +53,7 @@ public class ButtonTests
CommandArgument = commandArgument, CommandArgument = commandArgument,
}; };
string? result = null; string? result = null;
button.Click += (o, _) => button.Click += (o, _) => { result = (o as Button)?.CommandArgument; };
{
result = (o as Button)?.CommandArgument;
};
page.Controls.Add(button); page.Controls.Add(button);
fakeWebContext.RequestForm.Add(button.ClientID, "Clicked"); fakeWebContext.RequestForm.Add(button.ClientID, "Clicked");

View File

@@ -219,10 +219,7 @@ public class CTextBoxTests
}; };
page.Controls.Add(cTextBox); page.Controls.Add(cTextBox);
Button button = new(); Button button = new();
button.Click += (_, _) => button.Click += (_, _) => { cTextBox.SetClientsideHeight(null); };
{
cTextBox.SetClientsideHeight(null);
};
page.Controls.Add(button); page.Controls.Add(button);
fakeWebContext.RequestForm.Add(button.ClientID, "Clicked"); fakeWebContext.RequestForm.Add(button.ClientID, "Clicked");
@@ -258,10 +255,7 @@ public class CTextBoxTests
Button button = new(); Button button = new();
button.Click += (_, _) => button.Click += (_, _) =>
{ {
if (cTextBox.HidSize != null) if (cTextBox.HidSize != null) { cTextBox.HidSize.Value = "[]"; }
{
cTextBox.HidSize.Value = "[]";
}
}; };
page.Controls.Add(button); page.Controls.Add(button);
@@ -288,10 +282,7 @@ public class CTextBoxTests
Button button = new(); Button button = new();
button.Click += (_, _) => button.Click += (_, _) =>
{ {
if (cTextBox.HidSize != null) if (cTextBox.HidSize != null) { cTextBox.HidSize.Value = "{}"; }
{
cTextBox.HidSize.Value = "{}";
}
}; };
page.Controls.Add(button); page.Controls.Add(button);
@@ -373,5 +364,4 @@ public class CTextBoxTests
} }
#endregion IsEmpty #endregion IsEmpty
} }

View File

@@ -52,7 +52,7 @@ public class TextBoxTests
{ {
FakeWebContext fakeWebContext = new(); FakeWebContext fakeWebContext = new();
Page page = new(); Page page = new();
TextBox textBox = new() {TextMode = TextBoxMode.Password, }; TextBox textBox = new() { TextMode = TextBoxMode.Password, };
page.Controls.Add(textBox); page.Controls.Add(textBox);
page.ProcessRequest(fakeWebContext); page.ProcessRequest(fakeWebContext);
@@ -92,7 +92,7 @@ public class TextBoxTests
{ {
FakeWebContext fakeWebContext = new(); FakeWebContext fakeWebContext = new();
Page page = new(); Page page = new();
TextBox textBox = new() {TextMode = TextBoxMode.MultiLine, }; TextBox textBox = new() { TextMode = TextBoxMode.MultiLine, };
page.Controls.Add(textBox); page.Controls.Add(textBox);
page.ProcessRequest(fakeWebContext); page.ProcessRequest(fakeWebContext);

View File

@@ -16,10 +16,7 @@ public class FakeGlobalConfig : IGlobalConfig
private string _loginHandler = string.Empty; private string _loginHandler = string.Empty;
public void FakeSetLoginHandler(string loginHandler) public void FakeSetLoginHandler(string loginHandler) { _loginHandler = loginHandler; }
{
_loginHandler = loginHandler;
}
public string LoginHandler => _loginHandler; public string LoginHandler => _loginHandler;
@@ -27,18 +24,9 @@ public class FakeGlobalConfig : IGlobalConfig
private bool _authenticated; private bool _authenticated;
public void FakeSetAuthenticated(bool authenticated) public void FakeSetAuthenticated(bool authenticated) { _authenticated = authenticated; }
{
_authenticated = authenticated;
}
public bool IsUserAuthenticated(IWebContext context) public bool IsUserAuthenticated(IWebContext context) { return _authenticated; }
{
return _authenticated;
}
public void UserDeauthenticate(IWebContext context) public void UserDeauthenticate(IWebContext context) { _authenticated = false; }
{
_authenticated = false;
}
} }

View File

@@ -5,10 +5,7 @@ namespace VAR.WebFormsCore.Tests.Fakes;
public class FakeWebContext : IWebContext public class FakeWebContext : IWebContext
{ {
public FakeWebContext(string requestMethod = "GET") public FakeWebContext(string requestMethod = "GET") { RequestMethod = requestMethod; }
{
RequestMethod = requestMethod;
}
public string RequestPath => string.Empty; public string RequestPath => string.Empty;
@@ -24,15 +21,9 @@ public class FakeWebContext : IWebContext
public List<WritePackage> FakeWritePackages { get; } = new(); public List<WritePackage> FakeWritePackages { get; } = new();
public void ResponseWrite(string text) public void ResponseWrite(string text) { FakeWritePackages.Add(new WritePackage { Text = text, }); }
{
FakeWritePackages.Add(new WritePackage { Text = text, });
}
public void ResponseWriteBin(byte[] content) public void ResponseWriteBin(byte[] content) { FakeWritePackages.Add(new WritePackage { Bin = content, }); }
{
FakeWritePackages.Add(new WritePackage { Bin = content, });
}
public void ResponseFlush() public void ResponseFlush()
{ {
@@ -50,17 +41,11 @@ public class FakeWebContext : IWebContext
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void DelResponseCookie(string cookieName) public void DelResponseCookie(string cookieName) { throw new NotImplementedException(); }
{
throw new NotImplementedException();
}
private bool _responseHasStarted; private bool _responseHasStarted;
public void FakeSetResponseHasStarted(bool responseHasStarted) public void FakeSetResponseHasStarted(bool responseHasStarted) { _responseHasStarted = responseHasStarted; }
{
_responseHasStarted = responseHasStarted;
}
public bool ResponseHasStarted => _responseHasStarted; public bool ResponseHasStarted => _responseHasStarted;
@@ -70,10 +55,7 @@ public class FakeWebContext : IWebContext
public Dictionary<string, string> FakeResponseHeaders { get; } = new(); public Dictionary<string, string> FakeResponseHeaders { get; } = new();
public void SetResponseHeader(string key, string value) public void SetResponseHeader(string key, string value) { FakeResponseHeaders.Add(key, value); }
{
FakeResponseHeaders.Add(key, value);
}
public void PrepareCacheableResponse() public void PrepareCacheableResponse()
{ {
@@ -93,15 +75,9 @@ public struct WritePackage
public override string ToString() public override string ToString()
{ {
if (Text != null) if (Text != null) { return Text; }
{
return Text;
}
if (Bin == null) if (Bin == null) { return string.Empty; }
{
return string.Empty;
}
string text = Encoding.UTF8.GetString(Bin ?? Array.Empty<byte>()); string text = Encoding.UTF8.GetString(Bin ?? Array.Empty<byte>());
return text; return text;

View File

@@ -17,7 +17,7 @@ public class FrmEchoTests
Assert.Equal(200, fakeWebContext.ResponseStatusCode); Assert.Equal(200, fakeWebContext.ResponseStatusCode);
string result = fakeWebContext.FakeWritePackages.ToString(""); string result = fakeWebContext.FakeWritePackages.ToString("");
Assert.Equal( Assert.Equal(
expected: """ expected: """
<pre><code> <pre><code>
Header:{ } Header:{ }
Query:{ } Query:{ }
@@ -39,7 +39,7 @@ public class FrmEchoTests
Assert.Equal(200, fakeWebContext.ResponseStatusCode); Assert.Equal(200, fakeWebContext.ResponseStatusCode);
string result = fakeWebContext.FakeWritePackages.ToString(""); string result = fakeWebContext.FakeWritePackages.ToString("");
Assert.Equal( Assert.Equal(
expected: """ expected: """
<pre><code> <pre><code>
Header:{ } Header:{ }
Query:{ "Test": "Value" } Query:{ "Test": "Value" }
@@ -61,7 +61,7 @@ public class FrmEchoTests
Assert.Equal(200, fakeWebContext.ResponseStatusCode); Assert.Equal(200, fakeWebContext.ResponseStatusCode);
string result = fakeWebContext.FakeWritePackages.ToString(""); string result = fakeWebContext.FakeWritePackages.ToString("");
Assert.Equal( Assert.Equal(
expected: """ expected: """
<pre><code> <pre><code>
Header:{ } Header:{ }
Query:{ } Query:{ }

View File

@@ -17,7 +17,7 @@ public class FrmErrorTests
Assert.Equal(200, fakeWebContext.ResponseStatusCode); Assert.Equal(200, fakeWebContext.ResponseStatusCode);
string result = fakeWebContext.FakeWritePackages.ToString(""); string result = fakeWebContext.FakeWritePackages.ToString("");
Assert.Equal( Assert.Equal(
expected: """ expected: """
<!DOCTYPE html> <!DOCTYPE html>
<html ><head ><title>Application Error</title><meta content="IE=Edge" http-equiv="X-UA-Compatible" /><meta content="text/html; charset=utf-8" http-equiv="content-type" /><meta name="author" /><meta name="Copyright" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=4, user-scalable=1" /><script type="text/javascript" src="ScriptsBundler?v=1.0.0.0"></script> <html ><head ><title>Application Error</title><meta content="IE=Edge" http-equiv="X-UA-Compatible" /><meta content="text/html; charset=utf-8" http-equiv="content-type" /><meta name="author" /><meta name="Copyright" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=4, user-scalable=1" /><script type="text/javascript" src="ScriptsBundler?v=1.0.0.0"></script>
<link href="StylesBundler?v=1.0.0.0" type="text/css" rel="stylesheet"/> <link href="StylesBundler?v=1.0.0.0" type="text/css" rel="stylesheet"/>
@@ -25,5 +25,4 @@ public class FrmErrorTests
""", """,
actual: result); actual: result);
} }
} }

View File

@@ -11,10 +11,7 @@ public class PageCommonTests
private class TestEmptyForm : PageCommon private class TestEmptyForm : PageCommon
{ {
public TestEmptyForm(bool mustBeAuthenticated) public TestEmptyForm(bool mustBeAuthenticated) { MustBeAuthenticated = mustBeAuthenticated; }
{
MustBeAuthenticated = mustBeAuthenticated;
}
} }
[Fact] [Fact]

View File

@@ -75,10 +75,7 @@ public class PageTests
Page page = new(); Page page = new();
page.Load += (_, _) => page.Load += (_, _) =>
{ {
if (page.IsPostBack) if (page.IsPostBack) { fakeWebContext.FakeSetResponseHasStarted(true); }
{
fakeWebContext.FakeSetResponseHasStarted(true);
}
}; };
page.ProcessRequest(fakeWebContext); page.ProcessRequest(fakeWebContext);
@@ -96,10 +93,7 @@ public class PageTests
Page page = new(); Page page = new();
page.Load += (_, _) => page.Load += (_, _) =>
{ {
if (page.IsPostBack) if (page.IsPostBack) { fakeWebContext.FakeSetResponseHasStarted(true); }
{
fakeWebContext.FakeSetResponseHasStarted(true);
}
}; };
page.ProcessRequest(fakeWebContext); page.ProcessRequest(fakeWebContext);

View File

@@ -9,8 +9,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2"/>
<PackageReference Include="xunit" Version="2.4.2" /> <PackageReference Include="xunit" Version="2.4.2"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
@@ -22,7 +22,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\VAR.WebFormsCore\VAR.WebFormsCore.csproj" /> <ProjectReference Include="..\VAR.WebFormsCore\VAR.WebFormsCore.csproj"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -3,6 +3,18 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FDeconstructionDeclarations/@EntryIndexedValue">DO_NOT_SHOW</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FDeconstructionDeclarations/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FElsewhere/@EntryIndexedValue">DO_NOT_SHOW</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FElsewhere/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FSimpleTypes/@EntryIndexedValue">DO_NOT_SHOW</s:String> <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FSimpleTypes/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_EXISTING_ENUM_ARRANGEMENT/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_EXISTING_EXPR_MEMBER_ARRANGEMENT/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_EMBEDDED_BLOCK_ON_SAME_LINE/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ENUM_ON_SINGLE_LINE/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_METHOD_ON_SINGLE_LINE/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_DECLARATION_LPAR/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ENUM_DECLARATION/@EntryValue">CHOP_IF_LONG</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_PARAMETERS_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=abiword/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=abiword/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Childs/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Childs/@EntryIndexedValue">True</s:Boolean>

View File

@@ -21,7 +21,7 @@ public static class GlobalConfig
x is { IsAbstract: false, IsInterface: false, IsPublic: true } && x is { IsAbstract: false, IsInterface: false, IsPublic: true } &&
iGlobalConfig.IsAssignableFrom(x) iGlobalConfig.IsAssignableFrom(x)
); );
if(foundGlobalConfig != null) if (foundGlobalConfig != null)
{ {
_globalConfig = ObjectActivator.CreateInstance(foundGlobalConfig) as IGlobalConfig; _globalConfig = ObjectActivator.CreateInstance(foundGlobalConfig) as IGlobalConfig;
} }
@@ -40,13 +40,8 @@ public static class GlobalConfig
public string LoginHandler => string.Empty; public string LoginHandler => string.Empty;
public List<string> AllowedExtensions { get; } = new(); public List<string> AllowedExtensions { get; } = new();
public bool IsUserAuthenticated(IWebContext context) public bool IsUserAuthenticated(IWebContext context) { return false; }
{
return false;
}
public void UserDeauthenticate(IWebContext context) public void UserDeauthenticate(IWebContext context) { }
{
}
} }
} }

View File

@@ -96,10 +96,7 @@ public class GlobalRouter
{ {
lock (Handlers) lock (Handlers)
{ {
if (Handlers.ContainsKey(typeName) == false) if (Handlers.ContainsKey(typeName) == false) { Handlers.Add(typeName, type); }
{
Handlers.Add(typeName, type);
}
} }
} }

View File

@@ -29,7 +29,7 @@ public static class MultiLang
_literals = new Dictionary<string, Dictionary<string, object>?>(); _literals = new Dictionary<string, Dictionary<string, object>?>();
JsonParser jsonParser = new JsonParser(); JsonParser jsonParser = new JsonParser();
foreach (string lang in new[] {"en", "es"}) foreach (string lang in new[] { "en", "es" })
{ {
string filePath = GetPrivatePath("Resources", $"Literals.{lang}.json"); string filePath = GetPrivatePath("Resources", $"Literals.{lang}.json");
if (File.Exists(filePath) == false) { continue; } if (File.Exists(filePath) == false) { continue; }
@@ -85,10 +85,7 @@ public static class MultiLang
Dictionary<string, object>? literalCurrentCulture = _literals[culture]; Dictionary<string, object>? literalCurrentCulture = _literals[culture];
if (literalCurrentCulture == null || literalCurrentCulture.ContainsKey(resource) == false) if (literalCurrentCulture == null || literalCurrentCulture.ContainsKey(resource) == false) { return resource; }
{
return resource;
}
return (literalCurrentCulture[resource] as string) ?? resource; return (literalCurrentCulture[resource] as string) ?? resource;
} }

View File

@@ -16,7 +16,7 @@ public static class ObjectActivator
NewExpression newExp = Expression.New(type); NewExpression newExp = Expression.New(type);
LambdaExpression lambda = Expression.Lambda(typeof(Func<object>), newExp); LambdaExpression lambda = Expression.Lambda(typeof(Func<object>), newExp);
Func<object> compiledLambdaNew = (Func<object>) lambda.Compile(); Func<object> compiledLambdaNew = (Func<object>)lambda.Compile();
Creators.Add(type, compiledLambdaNew); Creators.Add(type, compiledLambdaNew);

View File

@@ -7,10 +7,7 @@ public static class ServerHelpers
{ {
private static string? _contentRoot; private static string? _contentRoot;
public static void SetContentRoot(string contentRoot) public static void SetContentRoot(string contentRoot) { _contentRoot = contentRoot; }
{
_contentRoot = contentRoot;
}
public static string MapContentPath(string path) public static string MapContentPath(string path)
{ {
@@ -20,10 +17,7 @@ public static class ServerHelpers
public static string HtmlEncode(string text) public static string HtmlEncode(string text)
{ {
if (string.IsNullOrEmpty(text)) if (string.IsNullOrEmpty(text)) { return text; }
{
return text;
}
StringBuilder sbResult = new(); StringBuilder sbResult = new();
@@ -54,10 +48,7 @@ public static class ServerHelpers
sbResult.Append(((int)ch).ToString(NumberFormatInfo.InvariantInfo)); sbResult.Append(((int)ch).ToString(NumberFormatInfo.InvariantInfo));
sbResult.Append(';'); sbResult.Append(';');
} }
else else { sbResult.Append(ch); }
{
sbResult.Append(ch);
}
break; break;
} }
@@ -69,28 +60,19 @@ public static class ServerHelpers
public static string UrlEncode(string text) public static string UrlEncode(string text)
{ {
if (string.IsNullOrEmpty(text)) if (string.IsNullOrEmpty(text)) { return text; }
{
return text;
}
StringBuilder sbResult = new(); StringBuilder sbResult = new();
foreach (var ch in text) foreach (var ch in text)
{ {
if (ch == ' ') if (ch == ' ') { sbResult.Append('+'); }
{
sbResult.Append('+');
}
else if (IsUrlSafe(ch) == false) else if (IsUrlSafe(ch) == false)
{ {
int intCh = ch; int intCh = ch;
sbResult.Append($"%{intCh:X02}"); sbResult.Append($"%{intCh:X02}");
} }
else else { sbResult.Append(ch); }
{
sbResult.Append(ch);
}
} }
return sbResult.ToString(); return sbResult.ToString();
@@ -108,10 +90,7 @@ public static class ServerHelpers
ch == '!' || ch == '!' ||
ch == '*' || ch == '*' ||
ch == '(' || ch == '(' ||
ch == ')') ch == ')') { return true; }
{
return true;
}
return false; return false;
} }

View File

@@ -7,64 +7,64 @@ public static class StaticFileHelper
{ {
private static readonly Dictionary<string, string> MimeTypeByExtension = new() private static readonly Dictionary<string, string> MimeTypeByExtension = new()
{ {
{".aac", "audio/aac"}, { ".aac", "audio/aac" },
{".abw", "application/x-abiword"}, { ".abw", "application/x-abiword" },
{".arc", "application/octet-stream"}, { ".arc", "application/octet-stream" },
{".avi", "video/x-msvideo"}, { ".avi", "video/x-msvideo" },
{".azw", "application/vnd.amazon.ebook"}, { ".azw", "application/vnd.amazon.ebook" },
{".bin", "application/octet-stream"}, { ".bin", "application/octet-stream" },
{".bz", "application/x-bzip"}, { ".bz", "application/x-bzip" },
{".bz2", "application/x-bzip2"}, { ".bz2", "application/x-bzip2" },
{".csh", "application/x-csh"}, { ".csh", "application/x-csh" },
{".css", "text/css"}, { ".css", "text/css" },
{".csv", "text/csv"}, { ".csv", "text/csv" },
{".doc", "application/msword"}, { ".doc", "application/msword" },
{".epub", "application/epub+zip"}, { ".epub", "application/epub+zip" },
{".gif", "image/gif"}, { ".gif", "image/gif" },
{".htm", "text/html"}, { ".htm", "text/html" },
{".html", "text/html"}, { ".html", "text/html" },
{".ico", "image/x-icon"}, { ".ico", "image/x-icon" },
{".ics", "text/calendar"}, { ".ics", "text/calendar" },
{".jar", "application/java-archive"}, { ".jar", "application/java-archive" },
{".jpg", "image/jpeg"}, { ".jpg", "image/jpeg" },
{".jpeg", "image/jpeg"}, { ".jpeg", "image/jpeg" },
{".js", "application/javascript"}, { ".js", "application/javascript" },
{".json", "application/json"}, { ".json", "application/json" },
{".mid", "audio/midi"}, { ".mid", "audio/midi" },
{".midi", "audio/midi"}, { ".midi", "audio/midi" },
{".mpeg", "video/mpeg"}, { ".mpeg", "video/mpeg" },
{".mpkg", "application/vnd.apple.installer+xml"}, { ".mpkg", "application/vnd.apple.installer+xml" },
{".odp", "application/vnd.oasis.opendocument.presentation"}, { ".odp", "application/vnd.oasis.opendocument.presentation" },
{".ods", "application/vnd.oasis.opendocument.spreadsheet"}, { ".ods", "application/vnd.oasis.opendocument.spreadsheet" },
{".odt", "application/vnd.oasis.opendocument.text"}, { ".odt", "application/vnd.oasis.opendocument.text" },
{".oga", "audio/ogg"}, { ".oga", "audio/ogg" },
{".ogv", "video/ogg"}, { ".ogv", "video/ogg" },
{".ogx", "application/ogg"}, { ".ogx", "application/ogg" },
{".png", "image/png"}, { ".png", "image/png" },
{".pdf", "application/pdf"}, { ".pdf", "application/pdf" },
{".ppt", "application/vnd.ms-powerpoint"}, { ".ppt", "application/vnd.ms-powerpoint" },
{".rar", "application/x-rar-compressed"}, { ".rar", "application/x-rar-compressed" },
{".rtf", "application/rtf"}, { ".rtf", "application/rtf" },
{".sh", "application/x-sh"}, { ".sh", "application/x-sh" },
{".svg", "image/svg+xml"}, { ".svg", "image/svg+xml" },
{".swf", "application/x-shockwave-flash"}, { ".swf", "application/x-shockwave-flash" },
{".tar", "application/x-tar"}, { ".tar", "application/x-tar" },
{".tiff", "image/tiff"}, { ".tiff", "image/tiff" },
{".tif", "image/tiff"}, { ".tif", "image/tiff" },
{".ttf", "font/ttf"}, { ".ttf", "font/ttf" },
{".vsd", "application/vnd.visio"}, { ".vsd", "application/vnd.visio" },
{".wav", "audio/x-wav"}, { ".wav", "audio/x-wav" },
{".weba", "audio/webm"}, { ".weba", "audio/webm" },
{".webm", "video/webm"}, { ".webm", "video/webm" },
{".webp", "image/webp"}, { ".webp", "image/webp" },
{".woff", "font/woff"}, { ".woff", "font/woff" },
{".woff2", "font/woff2"}, { ".woff2", "font/woff2" },
{".xhtml", "application/xhtml+xml"}, { ".xhtml", "application/xhtml+xml" },
{".xls", "application/vnd.ms-excel"}, { ".xls", "application/vnd.ms-excel" },
{".xml", "application/xml"}, { ".xml", "application/xml" },
{".xul", "application/vnd.mozilla.xul+xml"}, { ".xul", "application/vnd.mozilla.xul+xml" },
{".zip", "application/zip"}, { ".zip", "application/zip" },
{".7z", "application/x-7z-compressed"}, { ".7z", "application/x-7z-compressed" },
}; };
public static void ResponseStaticFile(IWebContext context, string filePath) public static void ResponseStaticFile(IWebContext context, string filePath)

View File

@@ -23,5 +23,6 @@ public class Unit
public enum UnitType public enum UnitType
{ {
Pixel, Percentage, Pixel,
Percentage,
} }

View File

@@ -20,10 +20,8 @@ public class Button : Control, IReceivePostbackEvent
textWriter.Write("<input type=\"submit\" "); textWriter.Write("<input type=\"submit\" ");
RenderAttributes(textWriter); RenderAttributes(textWriter);
RenderAttribute(textWriter, "value", Text); RenderAttribute(textWriter, "value", Text);
if (string.IsNullOrEmpty(OnClientClick) == false) if (string.IsNullOrEmpty(OnClientClick) == false) { RenderAttribute(textWriter, "onclick", OnClientClick); }
{
RenderAttribute(textWriter, "onclick", OnClientClick);
}
textWriter.Write(">"); textWriter.Write(">");
base.Render(textWriter); base.Render(textWriter);

View File

@@ -72,7 +72,8 @@ public class CTextBox : Control, INamingContainer, IValidableControl
string strCfgName = $"{ClientID}_cfg"; string strCfgName = $"{ClientID}_cfg";
Dictionary<string, object> cfg = new() Dictionary<string, object> cfg = new()
{ {
{"txtContent", _txtContent.ClientID}, {"hidSize", _hidSize?.ClientID ?? string.Empty}, {"keepSize", KeepSize}, { "txtContent", _txtContent.ClientID }, { "hidSize", _hidSize?.ClientID ?? string.Empty },
{ "keepSize", KeepSize },
}; };
StringBuilder sbCfg = new StringBuilder(); StringBuilder sbCfg = new StringBuilder();
sbCfg.AppendFormat("<script>\n"); sbCfg.AppendFormat("<script>\n");
@@ -87,10 +88,7 @@ public class CTextBox : Control, INamingContainer, IValidableControl
private void CTextBox_PreRender(object? sender, EventArgs e) private void CTextBox_PreRender(object? sender, EventArgs e)
{ {
_txtContent.CssClass = CssClassBase; _txtContent.CssClass = CssClassBase;
if (string.IsNullOrEmpty(CssClassExtra) == false) if (string.IsNullOrEmpty(CssClassExtra) == false) { _txtContent.CssClass = $"{CssClassBase} {CssClassExtra}"; }
{
_txtContent.CssClass = $"{CssClassBase} {CssClassExtra}";
}
if (Page?.IsPostBack == true && (AllowEmpty == false && IsEmpty()) || MarkedInvalid) if (Page?.IsPostBack == true && (AllowEmpty == false && IsEmpty()) || MarkedInvalid)
{ {
@@ -99,10 +97,7 @@ public class CTextBox : Control, INamingContainer, IValidableControl
_txtContent.Attributes.Add("onchange", "ElementRemoveClass(this, 'textBoxInvalid');"); _txtContent.Attributes.Add("onchange", "ElementRemoveClass(this, 'textBoxInvalid');");
if (string.IsNullOrEmpty(PlaceHolder) == false) if (string.IsNullOrEmpty(PlaceHolder) == false) { _txtContent.Attributes.Add("placeholder", PlaceHolder); }
{
_txtContent.Attributes.Add("placeholder", PlaceHolder);
}
if (NextFocusOnEnter != null) if (NextFocusOnEnter != null)
{ {
@@ -131,17 +126,15 @@ public class CTextBox : Control, INamingContainer, IValidableControl
if (sizeObj.ContainsKey("height") == false) { return null; } if (sizeObj.ContainsKey("height") == false) { return null; }
return (int) sizeObj["height"]; return (int)sizeObj["height"];
} }
public void SetClientsideHeight(int? height) public void SetClientsideHeight(int? height)
{ {
if (height == null) if (height == null)
{ {
if (_hidSize != null) if (_hidSize != null) { _hidSize.Value = string.Empty; }
{
_hidSize.Value = string.Empty;
}
return; return;
} }
@@ -151,13 +144,11 @@ public class CTextBox : Control, INamingContainer, IValidableControl
JsonParser jsonParser = new JsonParser(); JsonParser jsonParser = new JsonParser();
sizeObj = jsonParser.Parse(_hidSize?.Value) as Dictionary<string, object?>; sizeObj = jsonParser.Parse(_hidSize?.Value) as Dictionary<string, object?>;
} }
sizeObj ??= new Dictionary<string, object?> { { "height", null }, { "width", null }, { "scrollTop", null }, }; sizeObj ??= new Dictionary<string, object?> { { "height", null }, { "width", null }, { "scrollTop", null }, };
sizeObj["height"] = height; sizeObj["height"] = height;
if (_hidSize != null) if (_hidSize != null) { _hidSize.Value = JsonWriter.WriteObject(sizeObj); }
{
_hidSize.Value = JsonWriter.WriteObject(sizeObj);
}
} }
#endregion Public methods #endregion Public methods

View File

@@ -185,10 +185,7 @@ public class Control
if (_controls != null) if (_controls != null)
{ {
foreach (Control child in _controls) foreach (Control child in _controls) { child.ChildsOfType<T>(controls); }
{
child.ChildsOfType<T>(controls);
}
} }
return controls; return controls;

View File

@@ -7,6 +7,7 @@ public class LiteralControl : Control
public string Content { get; set; } = string.Empty; public string Content { get; set; } = string.Empty;
public LiteralControl() { } public LiteralControl() { }
public LiteralControl(string content) { Content = content; } public LiteralControl(string content) { Content = content; }
protected override void Render(TextWriter textWriter) { textWriter.Write(Content); } protected override void Render(TextWriter textWriter) { textWriter.Write(Content); }

View File

@@ -50,5 +50,7 @@ public class TextBox : Control
public enum TextBoxMode public enum TextBoxMode
{ {
Normal, Password, MultiLine, Normal,
Password,
MultiLine,
} }

View File

@@ -16,18 +16,18 @@ public static class FormUtils
public static Control CreateField(string label, Control fieldControl) public static Control CreateField(string label, Control fieldControl)
{ {
Panel pnlRow = new Panel {CssClass = "formRow"}; Panel pnlRow = new Panel { CssClass = "formRow" };
Panel pnlLabelContainer = new Panel {CssClass = "formLabel width25pc"}; Panel pnlLabelContainer = new Panel { CssClass = "formLabel width25pc" };
pnlRow.Controls.Add(pnlLabelContainer); pnlRow.Controls.Add(pnlLabelContainer);
if (string.IsNullOrEmpty(label) == false) if (string.IsNullOrEmpty(label) == false)
{ {
Label lblField = new Label {Text = label}; Label lblField = new Label { Text = label };
pnlLabelContainer.Controls.Add(lblField); pnlLabelContainer.Controls.Add(lblField);
} }
Panel pnlFieldContainer = new Panel {CssClass = "formField width75pc"}; Panel pnlFieldContainer = new Panel { CssClass = "formField width75pc" };
pnlRow.Controls.Add(pnlFieldContainer); pnlRow.Controls.Add(pnlFieldContainer);
pnlFieldContainer.Controls.Add(fieldControl); pnlFieldContainer.Controls.Add(fieldControl);
@@ -35,10 +35,7 @@ public static class FormUtils
return pnlRow; return pnlRow;
} }
public static bool Control_IsValid(Control control) public static bool Control_IsValid(Control control) { return (control as IValidableControl)?.IsValid() != false; }
{
return (control as IValidableControl)?.IsValid() != false;
}
public static bool Controls_AreValid(ControlCollection controls) public static bool Controls_AreValid(ControlCollection controls)
{ {

View File

@@ -31,14 +31,15 @@ public class FrmError : PageCommon
{ {
Title = "Application Error"; Title = "Application Error";
Label lblErrorTitle = new Label {Text = Title, Tag = "h2"}; Label lblErrorTitle = new Label { Text = Title, Tag = "h2" };
Controls.Add(lblErrorTitle); Controls.Add(lblErrorTitle);
Exception? exAux = (Exception?)_ex; Exception? exAux = (Exception?)_ex;
//if (exAux is HttpUnhandledException && exAux.InnerException != null) { exAux = exAux.InnerException; } //if (exAux is HttpUnhandledException && exAux.InnerException != null) { exAux = exAux.InnerException; }
while (exAux != null) while (exAux != null)
{ {
LiteralControl lblMessage = new LiteralControl($"<p><b>Message:</b> {HttpUtility.HtmlEncode(exAux.Message)}</p>"); LiteralControl lblMessage =
new LiteralControl($"<p><b>Message:</b> {HttpUtility.HtmlEncode(exAux.Message)}</p>");
Controls.Add(lblMessage); Controls.Add(lblMessage);
LiteralControl lblStacktraceTitle = new LiteralControl("<p><b>Stacktrace:</b></p>"); LiteralControl lblStacktraceTitle = new LiteralControl("<p><b>Stacktrace:</b></p>");

View File

@@ -11,7 +11,7 @@ public class PageCommon : Page
private readonly HtmlHead _head = new(); private readonly HtmlHead _head = new();
private readonly HtmlBody _body = new(); private readonly HtmlBody _body = new();
private readonly HtmlForm _form = new() {ID = "formMain"}; private readonly HtmlForm _form = new() { ID = "formMain" };
private readonly Panel _pnlContainer = new(); private readonly Panel _pnlContainer = new();
private readonly Button _btnPostback = new(); private readonly Button _btnPostback = new();
private readonly Button _btnLogout = new(); private readonly Button _btnLogout = new();
@@ -41,10 +41,7 @@ public class PageCommon : Page
{ {
Context?.PrepareUncacheableResponse(); Context?.PrepareUncacheableResponse();
if (Context != null) if (Context != null) { _isAuthenticated = GlobalConfig.Get().IsUserAuthenticated(Context); }
{
_isAuthenticated = GlobalConfig.Get().IsUserAuthenticated(Context);
}
if (MustBeAuthenticated && _isAuthenticated == false) if (MustBeAuthenticated && _isAuthenticated == false)
{ {
@@ -68,10 +65,8 @@ public class PageCommon : Page
private void btnLogout_Click(object? sender, EventArgs e) private void btnLogout_Click(object? sender, EventArgs e)
{ {
if(Context != null) if (Context != null) { GlobalConfig.Get().UserDeauthenticate(Context); }
{
GlobalConfig.Get().UserDeauthenticate(Context);
}
if (MustBeAuthenticated) { Context?.ResponseRedirect(GlobalConfig.Get().LoginHandler); } if (MustBeAuthenticated) { Context?.ResponseRedirect(GlobalConfig.Get().LoginHandler); }
} }
@@ -91,10 +86,10 @@ public class PageCommon : Page
html.Controls.Add(_head); html.Controls.Add(_head);
_head.Controls.Add(new HtmlMeta {HttpEquiv = "X-UA-Compatible", Content = "IE=Edge"}); _head.Controls.Add(new HtmlMeta { HttpEquiv = "X-UA-Compatible", Content = "IE=Edge" });
_head.Controls.Add(new HtmlMeta {HttpEquiv = "content-type", Content = "text/html; charset=utf-8"}); _head.Controls.Add(new HtmlMeta { HttpEquiv = "content-type", Content = "text/html; charset=utf-8" });
_head.Controls.Add(new HtmlMeta {Name = "author", Content = GlobalConfig.Get().Author}); _head.Controls.Add(new HtmlMeta { Name = "author", Content = GlobalConfig.Get().Author });
_head.Controls.Add(new HtmlMeta {Name = "Copyright", Content = GlobalConfig.Get().Copyright}); _head.Controls.Add(new HtmlMeta { Name = "Copyright", Content = GlobalConfig.Get().Copyright });
_head.Controls.Add( _head.Controls.Add(
new HtmlMeta new HtmlMeta
{ {
@@ -114,13 +109,13 @@ public class PageCommon : Page
html.Controls.Add(_body); html.Controls.Add(_body);
_body.Controls.Add(_form); _body.Controls.Add(_form);
var pnlHeader = new Panel {CssClass = "divHeader"}; var pnlHeader = new Panel { CssClass = "divHeader" };
_form.Controls.Add(pnlHeader); _form.Controls.Add(pnlHeader);
HyperLink lnkTitle = new HyperLink {NavigateUrl = "."}; HyperLink lnkTitle = new HyperLink { NavigateUrl = "." };
pnlHeader.Controls.Add(lnkTitle); pnlHeader.Controls.Add(lnkTitle);
var lblTitle = new Label {Text = GlobalConfig.Get().Title, Tag = "h1"}; var lblTitle = new Label { Text = GlobalConfig.Get().Title, Tag = "h1" };
lnkTitle.Controls.Add(lblTitle); lnkTitle.Controls.Add(lblTitle);
_btnPostback.ID = "btnPostback"; _btnPostback.ID = "btnPostback";
@@ -128,7 +123,7 @@ public class PageCommon : Page
pnlHeader.Controls.Add(_btnPostback); pnlHeader.Controls.Add(_btnPostback);
_btnPostback.Style.Add("display", "none"); _btnPostback.Style.Add("display", "none");
var pnlUserInfo = new Panel {CssClass = "divUserInfo"}; var pnlUserInfo = new Panel { CssClass = "divUserInfo" };
pnlHeader.Controls.Add(pnlUserInfo); pnlHeader.Controls.Add(pnlUserInfo);
_btnLogout.ID = "btnLogout"; _btnLogout.ID = "btnLogout";

View File

@@ -13,7 +13,9 @@ function GetElement(element) {
// //
function ElementAddClass(element, classname) { function ElementAddClass(element, classname) {
element = GetElement(element); element = GetElement(element);
if (!element) { return; } if (!element) {
return;
}
var cn = element.className; var cn = element.className;
if (cn.indexOf(classname) !== -1) { if (cn.indexOf(classname) !== -1) {
return; return;
@@ -29,7 +31,9 @@ function ElementAddClass(element, classname) {
// //
function ElementRemoveClass(element, className) { function ElementRemoveClass(element, className) {
element = GetElement(element); element = GetElement(element);
if (!element) { return; } if (!element) {
return;
}
var regex = new RegExp('(?:^|\\s)' + className + '(?!\\S)'); var regex = new RegExp('(?:^|\\s)' + className + '(?!\\S)');
if (regex.test(element.className)) { if (regex.test(element.className)) {
element.className = element.className.replace(regex, ''); element.className = element.className.replace(regex, '');
@@ -41,7 +45,9 @@ function ElementRemoveClass(element, className) {
// //
function ElementToggleClass(element, className) { function ElementToggleClass(element, className) {
element = GetElement(element); element = GetElement(element);
if (!element) { return; } if (!element) {
return;
}
var regex = new RegExp('(?:^|\\s)' + className + '(?!\\S)'); var regex = new RegExp('(?:^|\\s)' + className + '(?!\\S)');
if (regex.test(element.className)) { if (regex.test(element.className)) {
element.className = element.className.replace(regex, ''); element.className = element.className.replace(regex, '');
@@ -71,24 +77,34 @@ function fixedEncodeURIComponent(str) {
if (!window.localStorage) { if (!window.localStorage) {
window.localStorage = { window.localStorage = {
getItem: function (sKey) { getItem: function (sKey) {
if (!sKey || !this.hasOwnProperty(sKey)) { return null; } if (!sKey || !this.hasOwnProperty(sKey)) {
return null;
}
return unescape(document.cookie.replace(new RegExp("(?:^|.*;\\s*)" + escape(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*"), "$1")); return unescape(document.cookie.replace(new RegExp("(?:^|.*;\\s*)" + escape(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*"), "$1"));
}, },
key: function (nKeyId) { return unescape(document.cookie.replace(/\s*\=(?:.(?!;))*$/, "").split(/\s*\=(?:[^;](?!;))*[^;]?;\s*/)[nKeyId]); }, key: function (nKeyId) {
return unescape(document.cookie.replace(/\s*\=(?:.(?!;))*$/, "").split(/\s*\=(?:[^;](?!;))*[^;]?;\s*/)[nKeyId]);
},
setItem: function (sKey, sValue) { setItem: function (sKey, sValue) {
if (!sKey) { return; } if (!sKey) {
return;
}
document.cookie = escape(sKey) + "=" + escape(sValue) + "; path=/"; document.cookie = escape(sKey) + "=" + escape(sValue) + "; path=/";
this.length = document.cookie.match(/\=/g).length; this.length = document.cookie.match(/\=/g).length;
}, },
length: 0, length: 0,
removeItem: function (sKey) { removeItem: function (sKey) {
if (!sKey || !this.hasOwnProperty(sKey)) { return; } if (!sKey || !this.hasOwnProperty(sKey)) {
return;
}
var sExpDate = new Date(); var sExpDate = new Date();
sExpDate.setDate(sExpDate.getDate() - 1); sExpDate.setDate(sExpDate.getDate() - 1);
document.cookie = escape(sKey) + "=; expires=" + sExpDate.toGMTString() + "; path=/"; document.cookie = escape(sKey) + "=; expires=" + sExpDate.toGMTString() + "; path=/";
this.length--; this.length--;
}, },
hasOwnProperty: function (sKey) { return (new RegExp("(?:^|;\\s*)" + escape(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie); } hasOwnProperty: function (sKey) {
return (new RegExp("(?:^|;\\s*)" + escape(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie);
}
}; };
window.localStorage.length = (document.cookie.match(/\=/g) || window.localStorage).length; window.localStorage.length = (document.cookie.match(/\=/g) || window.localStorage).length;
} }

View File

@@ -44,7 +44,7 @@ var CTextBox_Multiline_RestoreSizeData = function (textArea) {
textArea.scrollTop = textArea.cfg.size.scrollTop; textArea.scrollTop = textArea.cfg.size.scrollTop;
} }
} }
textArea.cfg.size = { height: textArea.offsetHeight, width: textArea.offsetWidth, scrollTop: textArea.scrollTop }; textArea.cfg.size = {height: textArea.offsetHeight, width: textArea.offsetWidth, scrollTop: textArea.scrollTop};
}; };
//////////////////////// ////////////////////////
@@ -52,7 +52,7 @@ var CTextBox_Multiline_RestoreSizeData = function (textArea) {
// //
var CTextBox_Multiline_MouseUp = function (e) { var CTextBox_Multiline_MouseUp = function (e) {
var textArea = e.target; var textArea = e.target;
var newSize = { height: textArea.offsetHeight, width: textArea.offsetWidth, scrollTop: textArea.scrollTop }; var newSize = {height: textArea.offsetHeight, width: textArea.offsetWidth, scrollTop: textArea.scrollTop};
if (textArea.cfg.size.height !== newSize.height) { if (textArea.cfg.size.height !== newSize.height) {
textArea.cfg.size = newSize; textArea.cfg.size = newSize;
CTextBox_Multiline_SaveSizeData(textArea); CTextBox_Multiline_SaveSizeData(textArea);
@@ -64,7 +64,7 @@ var CTextBox_Multiline_MouseUp = function (e) {
// //
var CTextBox_Multiline_Scrolled = function (e) { var CTextBox_Multiline_Scrolled = function (e) {
var textArea = e.target; var textArea = e.target;
textArea.cfg.size = { height: textArea.offsetHeight, width: textArea.offsetWidth, scrollTop: textArea.scrollTop }; textArea.cfg.size = {height: textArea.offsetHeight, width: textArea.offsetWidth, scrollTop: textArea.scrollTop};
CTextBox_Multiline_SaveSizeData(textArea); CTextBox_Multiline_SaveSizeData(textArea);
}; };

View File

@@ -49,16 +49,16 @@ h3 {
height: 38px; height: 38px;
} }
.divHeader a { .divHeader a {
text-decoration: none; text-decoration: none;
} }
.divHeader h1 { .divHeader h1 {
font-size: 30px; font-size: 30px;
color: yellow; color: yellow;
margin: 0; margin: 0;
text-shadow: none; text-shadow: none;
} }
.divUserInfo { .divUserInfo {
position: absolute; position: absolute;
@@ -105,9 +105,9 @@ h3 {
vertical-align: top; vertical-align: top;
} }
.formLabel span:last-child::after { .formLabel span:last-child::after {
content: ':'; content: ':';
} }
.formField { .formField {
display: inline-block; display: inline-block;
@@ -126,10 +126,10 @@ h3 {
box-shadow: inset 0 -2px 5px rgba(255, 255, 255, 1), inset 0 2px 5px rgba(128, 128, 128, 1); box-shadow: inset 0 -2px 5px rgba(255, 255, 255, 1), inset 0 2px 5px rgba(128, 128, 128, 1);
} }
.textBox:focus { .textBox:focus {
border: solid 1px black; border: solid 1px black;
box-shadow: 0 0 10px rgba(255, 255, 255, 0.5), inset 0 -2px 5px rgba(255, 255, 255, 1), inset 0 2px 5px rgba(0, 0, 0, 0.5); box-shadow: 0 0 10px rgba(255, 255, 255, 0.5), inset 0 -2px 5px rgba(255, 255, 255, 1), inset 0 2px 5px rgba(0, 0, 0, 0.5);
} }
textarea.textBox { textarea.textBox {
height: 64px; height: 64px;
@@ -142,10 +142,10 @@ textarea.textBox {
border: solid 1px rgb(255, 0, 0); border: solid 1px rgb(255, 0, 0);
} }
.textBoxInvalid:focus { .textBoxInvalid:focus {
box-shadow: 0 0 10px rgba(255, 0, 0, 1), inset 0 -2px 5px rgba(255, 255, 255, 1), inset 0 2px 5px rgba(0, 0, 0, 0.5); box-shadow: 0 0 10px rgba(255, 0, 0, 1), inset 0 -2px 5px rgba(255, 255, 255, 1), inset 0 2px 5px rgba(0, 0, 0, 0.5);
border: solid 1px black; border: solid 1px black;
} }
.button { .button {
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), inset 0 2px 5px rgba(255, 255, 255, 1), inset 0 -2px 5px rgba(128, 128, 128, 1); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), inset 0 2px 5px rgba(255, 255, 255, 1), inset 0 -2px 5px rgba(128, 128, 128, 1);
@@ -165,21 +165,22 @@ textarea.textBox {
padding-right: 10px; padding-right: 10px;
} }
.button:first-child { .button:first-child {
margin-left: 0; margin-left: 0;
} }
.button:hover { .button:hover {
background-color: rgb(220, 220, 220); background-color: rgb(220, 220, 220);
} }
.button:focus {
border: solid 1px black;
}
.button:active { .button:focus {
background-color: rgb(220, 220, 220); border: solid 1px black;
box-shadow: inset 0 2px 5px rgba(255, 255, 255, 1), inset 0 -2px 5px rgba(128, 128, 128, 1); }
}
.button:active {
background-color: rgb(220, 220, 220);
box-shadow: inset 0 2px 5px rgba(255, 255, 255, 1), inset 0 -2px 5px rgba(128, 128, 128, 1);
}
.width25pc { .width25pc {
width: 25% !important; width: 25% !important;

View File

@@ -1,31 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<LangVersion>10</LangVersion> <LangVersion>10</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="Scripts\01. Base.js" /> <None Remove="Scripts\01. Base.js"/>
<None Remove="Scripts\02. Ajax.js" /> <None Remove="Scripts\02. Ajax.js"/>
<None Remove="Scripts\03. Controls.js" /> <None Remove="Scripts\03. Controls.js"/>
<None Remove="Styles\00. Reset.css" /> <None Remove="Styles\00. Reset.css"/>
<None Remove="Styles\01. base.css" /> <None Remove="Styles\01. base.css"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Scripts\01. Base.js" /> <EmbeddedResource Include="Scripts\01. Base.js"/>
<EmbeddedResource Include="Scripts\02. Ajax.js" /> <EmbeddedResource Include="Scripts\02. Ajax.js"/>
<EmbeddedResource Include="Scripts\03. Controls.js" /> <EmbeddedResource Include="Scripts\03. Controls.js"/>
<EmbeddedResource Include="Styles\00. Reset.css" /> <EmbeddedResource Include="Styles\00. Reset.css"/>
<EmbeddedResource Include="Styles\01. base.css" /> <EmbeddedResource Include="Styles\01. base.css"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="VAR.Json" Version="1.2.2" /> <PackageReference Include="VAR.Json" Version="1.2.2"/>
</ItemGroup> </ItemGroup>
</Project> </Project>