net6.0 Ready to test

This commit is contained in:
Mike Phares 2022-05-09 16:48:57 -07:00
parent 053c873d6b
commit 6c8ad46064
171 changed files with 6547 additions and 48515 deletions

View File

@ -1,137 +1,10 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# C# files
[*.cs] [*.cs]
csharp_indent_block_contents = true
#### Core EditorConfig Options #### csharp_indent_braces = false
csharp_indent_case_contents = true
# Indentation and spacing csharp_indent_case_contents_when_block = true
indent_size = 4 csharp_indent_labels = one_less_than_current
indent_style = space csharp_indent_switch_labels = true
tab_width = 4
# New line preferences
end_of_line = crlf
insert_final_newline = false
#### .NET Coding Conventions ####
# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
file_header_template = unset
# this. and Me. preferences
dotnet_style_qualification_for_event = false:error
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_property = false:error
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members
# Expression-level preferences
dotnet_style_coalesce_expression = true
dotnet_style_collection_initializer = true:warning
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_namespace_match_folder = true
dotnet_style_null_propagation = true:warning
dotnet_style_object_initializer = true:warning
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_compound_assignment = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = false
dotnet_style_prefer_conditional_expression_over_return = false
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_prefer_simplified_boolean_expressions = true:warning
dotnet_style_prefer_simplified_interpolation = true
# Field preferences
dotnet_style_readonly_field = true:warning
# Parameter preferences
dotnet_code_quality_unused_parameters = all
# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = 0
# New line preferences
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
dotnet_style_allow_statement_immediately_after_block_experimental = true
#### C# Coding Conventions ####
# var preferences
csharp_style_var_elsewhere = false:warning
csharp_style_var_for_built_in_types = false:warning
csharp_style_var_when_type_is_apparent = false:warning
# Expression-bodied members
csharp_style_expression_bodied_accessors = when_on_single_line:warning
csharp_style_expression_bodied_constructors = when_on_single_line:warning
csharp_style_expression_bodied_indexers = when_on_single_line:warning
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
csharp_style_expression_bodied_local_functions = when_on_single_line:warning
csharp_style_expression_bodied_methods = when_on_single_line:warning
csharp_style_expression_bodied_operators = when_on_single_line:warning
csharp_style_expression_bodied_properties = when_on_single_line:warning
# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:warning
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_prefer_not_pattern = true:warning
csharp_style_prefer_pattern_matching = true:warning
csharp_style_prefer_switch_expression = true:warning
# Null-checking preferences
csharp_style_conditional_delegate_call = true
# Modifier preferences
csharp_prefer_static_local_function = true:warning
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
# Code-block preferences
csharp_prefer_braces = false
csharp_prefer_simple_using_statement = true:warning
csharp_style_namespace_declarations = file_scoped:warning
# Expression-level preferences
csharp_prefer_simple_default_expression = true:warning
csharp_style_deconstructed_variable_declaration = false
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
csharp_style_inlined_variable_declaration = false
csharp_style_pattern_local_over_anonymous_function = true:warning
csharp_style_prefer_index_operator = false:warning
csharp_style_prefer_null_check_over_type_check = true
csharp_style_prefer_range_operator = false:warning
csharp_style_throw_expression = true
csharp_style_unused_value_assignment_preference = discard_variable:warning
csharp_style_unused_value_expression_statement_preference = discard_variable:warning
# 'using' directive preferences
csharp_using_directive_placement = outside_namespace
# New line preferences
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
csharp_style_allow_embedded_statements_on_same_line_experimental = true
#### C# Formatting Rules ####
# New line preferences
csharp_new_line_before_catch = true csharp_new_line_before_catch = true
csharp_new_line_before_else = true csharp_new_line_before_else = true
csharp_new_line_before_finally = true csharp_new_line_before_finally = true
@ -139,16 +12,13 @@ csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true csharp_new_line_between_query_expression_clauses = true
csharp_prefer_braces = false
# Indentation preferences csharp_prefer_simple_default_expression = true:warning
csharp_indent_block_contents = true csharp_prefer_simple_using_statement = true:warning
csharp_indent_braces = false csharp_prefer_static_local_function = true:warning
csharp_indent_case_contents = true csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
csharp_indent_case_contents_when_block = true csharp_preserve_single_line_blocks = true
csharp_indent_labels = one_less_than_current csharp_preserve_single_line_statements = false
csharp_indent_switch_labels = true
# Space preferences
csharp_space_after_cast = false csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true csharp_space_after_comma = true
@ -171,166 +41,202 @@ csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false csharp_space_between_square_brackets = false
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
# Wrapping preferences csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
csharp_preserve_single_line_blocks = true csharp_style_allow_embedded_statements_on_same_line_experimental = true
csharp_preserve_single_line_statements = false csharp_style_conditional_delegate_call = true
csharp_style_deconstructed_variable_declaration = false
#### Naming styles #### csharp_style_expression_bodied_accessors = when_on_single_line:warning
csharp_style_expression_bodied_constructors = when_on_single_line:warning
# Naming rules csharp_style_expression_bodied_indexers = when_on_single_line:warning
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning csharp_style_expression_bodied_local_functions = when_on_single_line:warning
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface csharp_style_expression_bodied_methods = when_on_single_line:warning
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i csharp_style_expression_bodied_operators = when_on_single_line:warning
csharp_style_expression_bodied_properties = when_on_single_line:warning
dotnet_naming_rule.types_should_be_pascal_case.severity = warning csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
dotnet_naming_rule.types_should_be_pascal_case.symbols = types csharp_style_inlined_variable_declaration = false
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case csharp_style_namespace_declarations = file_scoped:warning
csharp_style_pattern_local_over_anonymous_function = true:warning
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning csharp_style_pattern_matching_over_as_with_null_check = true:warning
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field csharp_style_pattern_matching_over_is_with_cast_check = true:warning
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field csharp_style_prefer_index_operator = true:warning
csharp_style_prefer_not_pattern = true:warning
dotnet_naming_rule.enum_should_be_pascal_case.severity = warning csharp_style_prefer_null_check_over_type_check = true
dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum csharp_style_prefer_pattern_matching = true:warning
dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case csharp_style_prefer_range_operator = true:warning
csharp_style_prefer_switch_expression = true:warning
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning csharp_style_throw_expression = true
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field csharp_style_unused_value_assignment_preference = discard_variable:warning
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field csharp_style_unused_value_expression_statement_preference = discard_variable:warning
csharp_style_var_elsewhere = false:warning
dotnet_naming_rule.class_should_be_pascal_case.severity = warning csharp_style_var_for_built_in_types = false:warning
dotnet_naming_rule.class_should_be_pascal_case.symbols = class csharp_style_var_when_type_is_apparent = false:warning
dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case csharp_using_directive_placement = outside_namespace
dotnet_code_quality_unused_parameters = all
dotnet_naming_rule.method_should_be_pascal_case.severity = warning dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter
dotnet_naming_rule.method_should_be_pascal_case.symbols = method dotnet_code_quality.CAXXXX.api_surface = private, internal
dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations
dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) System.Version.Equals("1", "2"); Version.Equals("1", "2");
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary using System.Text;
dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field
dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.property_should_be_pascal_case.severity = warning
dotnet_naming_rule.property_should_be_pascal_case.symbols = property
dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method
dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning dotnet_naming_rule.class_should_be_pascal_case.severity = warning
dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case dotnet_naming_rule.class_should_be_pascal_case.symbols = class
dotnet_naming_rule.event_should_be_pascal_case.severity = warning
dotnet_naming_rule.event_should_be_pascal_case.symbols = event
dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.delegate_should_be_pascal_case.severity = warning dotnet_naming_rule.delegate_should_be_pascal_case.severity = warning
dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate
dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate
dotnet_naming_rule.struct_should_be_pascal_case.severity = warning dotnet_naming_rule.enum_should_be_pascal_case.severity = warning
dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum
dotnet_naming_rule.event_should_be_pascal_case.severity = warning
dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.event_should_be_pascal_case.symbols = event
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.method_should_be_pascal_case.severity = warning
dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.method_should_be_pascal_case.symbols = method
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
# Symbol specifications dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case
dotnet_naming_symbols.class.applicable_kinds = class dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_symbols.class.required_modifiers = dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field
dotnet_naming_symbols.interface.applicable_kinds = interface dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_symbols.interface.required_modifiers = dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field
dotnet_naming_rule.property_should_be_pascal_case.severity = warning
dotnet_naming_symbols.struct.applicable_kinds = struct dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case
dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_rule.property_should_be_pascal_case.symbols = property
dotnet_naming_symbols.struct.required_modifiers = dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_symbols.enum.applicable_kinds = enum dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field
dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning
dotnet_naming_symbols.enum.required_modifiers = dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field
dotnet_naming_symbols.delegate.applicable_kinds = delegate dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning
dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case
dotnet_naming_symbols.delegate.required_modifiers = dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method
dotnet_naming_rule.struct_should_be_pascal_case.severity = warning
dotnet_naming_symbols.event.applicable_kinds = event dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case
dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct
dotnet_naming_symbols.event.required_modifiers = dotnet_naming_rule.types_should_be_pascal_case.severity = warning
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_symbols.method.applicable_kinds = method dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_symbols.method.applicable_accessibilities = public dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_symbols.method.required_modifiers =
dotnet_naming_symbols.private_method.applicable_kinds = method
dotnet_naming_symbols.private_method.applicable_accessibilities = private
dotnet_naming_symbols.private_method.required_modifiers =
dotnet_naming_symbols.abstract_method.applicable_kinds = method
dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.abstract_method.required_modifiers = abstract
dotnet_naming_symbols.static_method.applicable_kinds = method
dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_method.required_modifiers = static
dotnet_naming_symbols.property.applicable_kinds = property
dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.property.required_modifiers =
dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
dotnet_naming_symbols.public_or_protected_field.required_modifiers =
dotnet_naming_symbols.static_field.applicable_kinds = field
dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_field.required_modifiers = static
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix = dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator = dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.private_of_internal_field.capitalization = pascal_case
dotnet_naming_style.private_of_internal_field.required_prefix = _ dotnet_naming_style.private_of_internal_field.required_prefix = _
dotnet_naming_style.private_of_internal_field.required_suffix = dotnet_naming_style.private_of_internal_field.required_suffix =
dotnet_naming_style.private_of_internal_field.word_separator = dotnet_naming_style.private_of_internal_field.word_separator =
dotnet_naming_style.private_of_internal_field.capitalization = pascal_case dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.abstract_method.applicable_kinds = method
dotnet_naming_symbols.abstract_method.required_modifiers = abstract
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.class.applicable_kinds = class
dotnet_naming_symbols.class.required_modifiers =
dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.delegate.applicable_kinds = delegate
dotnet_naming_symbols.delegate.required_modifiers =
dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.enum.applicable_kinds = enum
dotnet_naming_symbols.enum.required_modifiers =
dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.event.applicable_kinds = event
dotnet_naming_symbols.event.required_modifiers =
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.method.applicable_accessibilities = public
dotnet_naming_symbols.method.applicable_kinds = method
dotnet_naming_symbols.method.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.required_modifiers =
dotnet_naming_symbols.private_method.applicable_accessibilities = private
dotnet_naming_symbols.private_method.applicable_kinds = method
dotnet_naming_symbols.private_method.required_modifiers =
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static
dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.property.applicable_kinds = property
dotnet_naming_symbols.property.required_modifiers =
dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
dotnet_naming_symbols.public_or_protected_field.required_modifiers =
dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_field.applicable_kinds = field
dotnet_naming_symbols.static_field.required_modifiers = static
dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_method.applicable_kinds = method
dotnet_naming_symbols.static_method.required_modifiers = static
dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.struct.applicable_kinds = struct
dotnet_naming_symbols.struct.required_modifiers =
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.required_modifiers =
dotnet_remove_unnecessary_suppression_exclusions = 0
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
dotnet_style_allow_statement_immediately_after_block_experimental = true
dotnet_style_coalesce_expression = true
dotnet_style_collection_initializer = true:warning
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_namespace_match_folder = true
dotnet_style_null_propagation = true:warning
dotnet_style_object_initializer = true:warning
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_compound_assignment = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = false
dotnet_style_prefer_conditional_expression_over_return = false
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_prefer_simplified_boolean_expressions = true:warning
dotnet_style_prefer_simplified_interpolation = true
dotnet_style_qualification_for_event = false:error
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_property = false:error
dotnet_style_readonly_field = true:warning
dotnet_style_require_accessibility_modifiers = for_non_interface_members
end_of_line = crlf
file_header_template = unset
indent_size = 4
indent_style = space
insert_final_newline = false
root = true
tab_width = 4
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822
# https://github.com/dotnet/aspnetcore/blob/main/.editorconfig
# https://github.com/dotnet/project-system/blob/main/.editorconfig

267
.groovy Normal file
View File

@ -0,0 +1,267 @@
#!/usr/bin/env groovy
/* groovylint-disable CompileStatic, ConsecutiveStringConcatenation, DuplicateNumberLiteral, DuplicateStringLiteral, LineLength, NestedBlockDepth, NoDef, VariableTypeRequired */
import groovy.transform.Field
@Field String _DDrive = 'D:/'
@Field String _ExePath = '...'
@Field String _NGINXFile = '...'
@Field String _PortNumber = '...'
@Field String _AssemblyName = '...'
@Field String _NetVersion = 'net6.0'
@Field String _TargetLocation = '...'
@Field String _GitCommitSeven = '...'
@Field String _GitName = 'EDA-Viewer'
@Field String _FirstBeforePlus = '5000'
@Field String _MonARessource = 'EDA_Viewer'
@Field String _ProjectDirectory = 'EDA Viewer'
@Field String _WorkingDirectoryName = 'IFXApps'
@Field String _AgentStaging = 'mestsa07ec-ecmeseaf'
@Field String _AgentProduction = 'messa08ec-ecmeseaf'
@Field String _DDriveNet = "${_DDrive}${_NetVersion}"
@Field String _CredentialsId = 'EDA-Username-Password'
@Field String _AgentDevelopment = 'mestsa003-mesedasvc'
@Field String _Company = 'Infineon Technologies Americas Corp.'
@Field String _ProgramFilesDotnet = 'C:/program files/dotnet/dotnet.exe'
pipeline {
agent {
label env.JENKINS_ENVIRONMENT == 'Development' ? _AgentDevelopment : env.JENKINS_ENVIRONMENT == 'Staging' ? _AgentStaging : env.JENKINS_ENVIRONMENT == 'Production' ? _AgentProduction : 'Else'
}
parameters {
string(name: 'MONA_SUFFIX', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? '_IFX' : '_EC', description: 'MonA Suffix')
string(name: 'GIT_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'mestsa003.infineon.com' : 'mestsa07ec.ec.local', description: 'git server')
string(name: 'DEFAULT_FILE_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'messv02ecc1_ec_local' : 'messv02ecc1.ec.local', description: 'Default file server...')
}
stages {
stage('Git') {
steps {
bat(returnStatus: true, script: 'git init')
bat(returnStatus: true, script: 'git remote add origin \\\\' + params.GIT_SERVER + '\\Git\\' + _GitName + '.git')
bat(returnStatus: true, script: 'git pull origin master')
}
}
stage('Setup') {
steps {
script {
_AssemblyName = "${env.JOB_NAME}"
_GitCommitSeven = '1234567'
// _GitCommitSeven = env.GIT_COMMIT.substring(0, 7)
dir(_ProjectDirectory) {
def files = findFiles(glob: '*.csproj')
if (files.length != 1) {
error("Build failed because couldn't find a *.csproj file")
}
echo """
${files[0].name}
${files[0].path}
${files[0].directory}
${files[0].length}
${files[0].lastModified}
"""
_AssemblyName = files[0].name.split('[.]csproj')[0]
}
_TargetLocation = "\\\\${params.DEFAULT_FILE_SERVER}\\EC_EAFRepository\\${env.JENKINS_ENVIRONMENT}\\DeploymentStorage\\Adaptation_${_AssemblyName}"
withCredentials([usernamePassword(credentialsId: _CredentialsId, passwordVariable: 'password', usernameVariable: 'username')]) {
dir("C:/Users/${username}/AppData/Local/IFXApps/nginx-1.20.1/conf/includes") {
_NGINXFile = "C:/Users/${username}/AppData/Local/IFXApps/nginx-1.20.1/conf/includes/${_AssemblyName}.conf"
def files = findFiles(glob: "${_AssemblyName}.conf")
if (files.length != 1) {
writeFile(file: _NGINXFile, text: "location / { proxy_pass http://localhost:${_FirstBeforePlus}; }")
}
}
}
}
}
}
stage('Read NGINX') {
steps {
script {
String text = readFile(file: _NGINXFile)
String check = text == null ? _FirstBeforePlus : text.split(';')[0]
String[] segments = check.split(':')
if (segments.length != 3) {
_PortNumber = check
}
else {
_PortNumber = (segments[2].toInteger() + 2).toString()
}
_ExePath = "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${_PortNumber}-${env.JOB_NAME}/${_AssemblyName}.exe"
}
}
}
stage('Info') {
steps {
// echo "GIT_URL_N - ${env.GIT_URL_N}"
// echo "BRANCH_NAME ${env.BRANCH_NAME}"
// echo "DEPLOY_VERSION ${env.DEPLOY_VERSION}"
// echo "GIT_AUTHOR_NAME ${env.GIT_AUTHOR_NAME}"
// echo "GIT_LOCAL_BRANCH ${env.GIT_LOCAL_BRANCH}"
// echo "GIT_COMMITTER_EMAIL ${env.GIT_COMMITTER_EMAIL}"
// echo "GIT_PREVIOUS_COMMIT ${env.GIT_PREVIOUS_COMMIT}"
// echo "GIT_PREVIOUS_SUCCESSFUL_COMMIT ${env.GIT_PREVIOUS_SUCCESSFUL_COMMIT}"
echo "_AssemblyName ${_AssemblyName}" // ...
echo "_ExePath ${_ExePath}" // ...
echo "_PortNumber ${_PortNumber}" // ...
echo "BUILD_NUMBER ${env.BUILD_NUMBER}" // 11
echo "DEFAULT_FILE_SERVER ${params.DEFAULT_FILE_SERVER}" // 11
echo "GIT_BRANCH ${env.GIT_BRANCH}" // origin/master
echo "GIT_COMMIT ${env.GIT_COMMIT}" // 73b814069f2cf0173a62a8228815a9bc9ba93c41
echo "GIT_SERVER ${params.GIT_SERVER}" // ...
echo "GIT_URL ${env.GIT_URL}" // D:\ProgramData\Git\....git
echo "JENKINS_ENVIRONMENT ${env.JENKINS_ENVIRONMENT}" // 11
echo "JENKINS_URL ${env.JENKINS_URL}" // http://localhost:8080/
echo "JOB_NAME ${env.JOB_NAME}" // ...
echo "WORKSPACE ${env.WORKSPACE}" // D:\.jenkins\_\...
}
}
// stage('Restore') {
// steps {
// bat(returnStatus: true, script: 'dotnet --info')
// }
// }
stage('Safe storage of app secrets') {
steps {
withCredentials([usernamePassword(credentialsId: _CredentialsId, passwordVariable: 'password', usernameVariable: 'username')]) {
dir(_ProjectDirectory) {
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets init')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "Company" "' + _Company + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "ServiceUser" "' + username + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "BuildNumber" "' + env.BUILD_NUMBER + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "GitCommitSeven" "' + _GitCommitSeven + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "Server" "' + params.DEFAULT_FILE_SERVER + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "URLs" "' + 'http://localhost:' + _PortNumber)
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "WorkingDirectoryName" "' + _WorkingDirectoryName + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "MonARessource" "' + _MonARessource + env.MONA_SUFFIX + '"')
}
}
}
}
// stage('Core Build (packagemanagement.eu.infineon.com)') {
// steps {
// echo "Build number is ${currentBuild.number}"
// dir(_ProjectDirectory) {
// bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
// 'build --runtime win-x64 --self-contained --verbosity quiet --source ' +
// 'https://packagemanagement.eu.infineon.com:4430/api/v2/')
// }
// }
// }
stage('Core Build') {
steps {
echo "Build number is ${currentBuild.number}"
dir(_ProjectDirectory) {
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'build --runtime win-x64 --self-contained --verbosity quiet')
}
}
}
stage('Commit Id') {
steps {
dir(_ProjectDirectory) {
writeFile(file: 'bin/Debug/' + _NetVersion + "/win-x64/${env.GIT_COMMIT}-${env.BUILD_NUMBER}.txt", text: "${env.GIT_URL}")
}
}
}
// stage('Test') {
// options {
// timeout(time: 10, unit: 'MINUTES')
// }
// steps {
// dir(_ProjectDirectory) {
// bat('dotnet --info')
// }
// }
// }
// stage('Version') {
// steps {
// bat('dotnet --info')
// }
// }
stage('Package') {
steps {
dir(_ProjectDirectory) {
fileOperations([fileZipOperation(folderPath: 'bin/Debug/' + _NetVersion + '/win-x64', outputFolderPath: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${_PortNumber}-${env.JOB_NAME}-Debug")])
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*", renameFiles: false, sourceCaptureExpression: '', targetLocation: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${_PortNumber}-${env.JOB_NAME}-Debug", targetNameExpression: '')])
}
}
}
stage('Publish') {
steps {
dir(_ProjectDirectory) {
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'remove reference "../Client/' + env.JOB_NAME + '.Client.csproj"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'publish --configuration Release --runtime win-x64 --verbosity quiet ' +
"--self-contained true --p:Version=6.0.202-${_GitCommitSeven}-${env.BUILD_NUMBER} -o " +
'"' + "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${_PortNumber}-${env.JOB_NAME}" + '"')
}
}
}
stage('Service') {
steps {
withCredentials([usernamePassword(credentialsId: _CredentialsId, passwordVariable: 'password', usernameVariable: 'username')]) {
bat(returnStatus: true, script: 'sc create "' + "${env.JOB_NAME}-${_PortNumber}" + '" ' +
'start= delayed-auto DisplayName="' + "${env.JOB_NAME}-${_PortNumber}" + '" ' +
'binPath= "' + _ExePath + '" ' +
'obj= "' + "${env.USERDOMAIN}\\${username}" + '" password= "' + password + '"')
bat(returnStatus: true, script: 'sc start "' + "${env.JOB_NAME}-${_PortNumber}" + '"')
}
}
}
stage('Upadate NGINX') {
steps {
writeFile(file: _NGINXFile, text: "location / { proxy_pass http://localhost:${_PortNumber}; }")
}
}
stage('NGINX Test and Reload') {
steps {
withCredentials([usernamePassword(credentialsId: _CredentialsId, passwordVariable: 'password', usernameVariable: 'username')]) {
dir("C:/Users/${username}/AppData/Local/IFXApps/nginx-1.20.1") {
script {
int returnStatus = bat(returnStatus: true, script: 'nginx.exe -t')
println("returnStatus ################ ${returnStatus} ####################")
if (returnStatus == 0) {
bat(returnStatus: true, script: 'nginx.exe -s reload')
}
}
}
}
}
}
// stage('Force Fail') {
// steps {
// error("Build failed because of this and that..")
// }
// }
// stage('Copy Files to: file-share') {
// steps {
// dir(_ProjectDirectory + '/bin/Debug/' + _NetVersion + '/win-x64') {
// fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.txt", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
// fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.dll", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
// fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.exe", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
// fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.pdb", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
// }
// }
// }
}
post {
always {
dir(_ProjectDirectory + '/bin') {
deleteDir()
}
dir(_ProjectDirectory + '/obj') {
deleteDir()
}
// cleanWs()
}
}
}

20
EDA Viewer/.vscode/format-report.json vendored Normal file
View File

@ -0,0 +1,20 @@
[
{
"DocumentId": {
"ProjectId": {
"Id": "1c39e10e-5359-42ab-be77-db59c291586c"
},
"Id": "81852d1e-25b8-4230-9e00-0399608db1e6"
},
"FileName": "Background.cshtml.cs",
"FilePath": "G:\\Mesa_FI\\EDA-Viewer\\EDA Viewer\\Pages\\Background.cshtml.cs",
"FileChanges": [
{
"LineNumber": 1,
"CharNumber": 1,
"DiagnosticId": "IMPORTS",
"FormatDescription": "Fix imports ordering."
}
]
}
]

33
EDA Viewer/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,33 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net6.0/win-x64/EDA Viewer.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

41
EDA Viewer/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/EDA Viewer.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/EDA Viewer.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/EDA Viewer.csproj"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@ -1,16 +0,0 @@
<h3>Counter</h3>
<p>
Current Count: @i
</p>
<button @onclick="IncrementCounter" class="btn btn-primary">Click Me</button>
@code {
int i = 0;
private void IncrementCounter()
{
i += 1;
}
}

View File

@ -1,167 +0,0 @@
using EDAViewer.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.Logging;
using Shared;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Web;
namespace EDAViewer.Controllers
{
public class HomeController : Controller, IHomeController
{
private readonly Log _Log;
private readonly AppSettings _AppSettings;
private readonly IsEnvironment _IsEnvironment;
private readonly Singleton.IBackground _Background;
public HomeController(ILogger<HomeController> logger, IsEnvironment isEnvironment, Singleton.IBackground background, AppSettings appSettings)
{
_Log = new Log(logger);
_Background = background;
_AppSettings = appSettings;
_IsEnvironment = isEnvironment;
}
public IActionResult Index()
{
return View();
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
public IActionResult Encode(string value = null)
{
string result = string.Empty;
if (!string.IsNullOrEmpty(value))
result = HttpUtility.UrlEncode(value);
return Content(result, "text/plain");
}
public IActionResult Background(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null, int? invoke_eda_dcp = null)
{
_Background.SendStatusOk();
if (message_clear.HasValue && message_clear.Value)
_Background.ClearMessage();
if (exceptions_clear.HasValue && exceptions_clear.Value)
_Background.Exceptions.Clear();
if (set_is_primary_instance.HasValue)
{
if (set_is_primary_instance.Value)
_Background.SetIsPrimaryInstance();
else
_Background.ClearIsPrimaryInstance();
}
string message;
if (string.IsNullOrWhiteSpace(_Background.Message))
message = "N/A";
else
message = _Background.Message;
//Response.AppendToLog(_Background.Message);
List<Exception> exceptions = new();
foreach (Exception exception in _Background.Exceptions)
exceptions.Add(exception);
ViewBag.Message = message;
ViewBag.Exceptions = exceptions;
ViewBag.URLs = _AppSettings.URLs;
ViewBag.Profile = _IsEnvironment.Profile;
ViewBag.WorkingDirectory = _Background.WorkingDirectory;
ViewBag.IsPrimaryInstance = _Background.IsPrimaryInstance();
ViewBag.ExceptionsCount = string.Concat("Exception(s) - ", exceptions.Count);
return View();
}
public ActionResult<IEnumerable<SelectListItem>> GetDirectoriesOrFiles(string path = null, bool? upDirectory = null, string filter = null)
{
List<SelectListItem> results = new();
//System.Threading.Thread.Sleep(1500);
//path = @"D:\Tmp";
if (string.IsNullOrEmpty(path))
path = string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA");
if (string.IsNullOrEmpty(filter))
filter = "*";
if (upDirectory.HasValue && upDirectory.Value && path.Contains('|'))
{
string[] segments = path.Split('|');
path = segments[^1];
}
//System.IO.File.AppendAllText(string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA\a.txt"), path);
string gold = "Gold";
if (System.IO.File.Exists(path))
{
string[] files = Directory.GetFiles(Path.GetDirectoryName(path), filter, SearchOption.TopDirectoryOnly);
foreach (string item in files)
results.Add(new SelectListItem() { Value = item, Text = Path.GetFileName(item), Group = new SelectListGroup() { Name = "File(s)" } });
if (results.Count > 1)
results.Insert(0, new SelectListItem() { Value = string.Empty, Text = string.Concat("Select - ", 0, " - ", files.Length) });
}
else if (Directory.Exists(path))
{
string[] files = Directory.GetFiles(path, filter, SearchOption.TopDirectoryOnly);
string[] directories = Directory.GetDirectories(path, filter, SearchOption.TopDirectoryOnly).Where(l => Path.GetFileName(l) != gold).ToArray();
for (short i = 0; i < short.MaxValue; i++)
{
if (directories.Length != 1 || files.Length != 0)
break;
else
{
path = directories[0];
files = Directory.GetFiles(path, filter, SearchOption.TopDirectoryOnly);
directories = Directory.GetDirectories(path, filter, SearchOption.TopDirectoryOnly).Where(l => Path.GetFileName(l) != gold).ToArray();
if (directories.Length == 0 && files.Length == 0)
{
directories = new string[] { path };
break;
}
}
}
foreach (string item in directories)
results.Add(new SelectListItem() { Value = item, Text = Path.GetFileName(item), Group = new SelectListGroup() { Name = "Directorie(s)" } });
foreach (string item in files)
results.Add(new SelectListItem() { Value = item, Text = Path.GetFileName(item), Group = new SelectListGroup() { Name = "File(s)" } });
if (results.Count > 1)
results.Insert(0, new SelectListItem() { Value = string.Empty, Text = string.Concat("Select - ", directories.Length, " - ", files.Length) });
}
//System.IO.File.AppendAllText(string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA\b.txt"), results.Count.ToString());
if (!results.Any())
results.Add(new SelectListItem() { Value = path, Text = string.Concat("Nothing Found *{", path, "}") });
return results;
}
public IActionResult ViewEdaHtmlDiff(WithEnvironment withEnvironment = null)
{
if (withEnvironment is null)
withEnvironment = new WithEnvironment();
string path = string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA");
if (!Directory.Exists(path))
path = @"C:\";
EdaHtmlDiff model = new(withEnvironment, path);
ViewBag.message = model.message;
return View(model);
}
}
}
// dotnet publish --configuration Release --runtime win-x64 --verbosity normal --self-contained true -o "L:\net5.0\EDAViewer"
// dotnet publish --configuration Release --runtime win-x64 --verbosity normal --self-contained true -o "D:\net5.0\EDAViewer"
// dotnet publish --configuration Release --runtime win-x64 --verbosity normal --self-contained true -o "D:\.jenkins\publish\manual-Mesa-0\EDAViewer"
//http://eaf-dev.mes.infineon.com:8080/job/Mesa/buildWithParameters?token=DotnetRules&projectName=EDA%20Viewer
//http://eaf-prod.mes.infineon.com:8080/job/Mesa/buildWithParameters?token=DotnetRules&projectName=EDA%20Viewer
//sc create EDAViewer_5003 binPath="D:\.jenkins\publish\manual-Mesa-0\EDAViewer\EDA Viewer.exe"

View File

@ -6,11 +6,16 @@
<SccLocalPath>SAK</SccLocalPath> <SccLocalPath>SAK</SccLocalPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<LangVersion>9.0</LangVersion>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>EDAViewer</RootNamespace>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel> <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<UserSecretsId>d71a673c-be39-45b5-ae5f-4c22639be045</UserSecretsId> <ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<RootNamespace>EDAViewer</RootNamespace>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows> <IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX> <IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux> <IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
@ -26,24 +31,18 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Infineon.Monitoring.MonA" Version="2.0.0" /> <PackageReference Include="Infineon.Monitoring.MonA" Version="2.0.0" />
<PackageReference Include="Log4net" Version="2.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.5" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.1.4" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.1.4" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.1.4" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="wwwroot\images\" /> <PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
<Folder Include="wwwroot\js\html5shiv\3.7.2\" /> </ItemGroup>
<Folder Include="wwwroot\js\respond\1.4.2\" /> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.1" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00021" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="appsettings.json"> <None Include="appsettings.json">

View File

@ -1,10 +0,0 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:EDAViewer.Models.WithEnvironment.message")]
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:EDAViewer.Models.WithEnvironment.now_ticks")]
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:EDAViewer.Models.WithEnvironment.user_name")]
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:EDAViewer.Models.WithEnvironment.machine_name")]

View File

@ -1,34 +1,32 @@
using EDAViewer.Models.Methods;
using EDAViewer.Models.Stateless;
using EDAViewer.Models.Stateless.Methods;
using EDAViewer.Singleton; using EDAViewer.Singleton;
using Microsoft.Extensions.DependencyInjection; using IFX.Shared;
using Microsoft.Extensions.Hosting; using Serilog.Context;
using Microsoft.Extensions.Logging;
using Shared;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace EDAViewer.HostedService namespace EDAViewer.HostedService;
public class TimedHostedService : IHostedService, IDisposable
{ {
public class TimedHostedService : IHostedService, IDisposable private readonly Timer _EDAOutputArchiveTimer;
{ private readonly Timer _LogPathCleanUpByWeekTimer;
private readonly Timer _EdaDataCollectionPlansTimer;
private readonly int _ExecutionCount; private readonly int _ExecutionCount;
private readonly Background _Background; private readonly Serilog.ILogger _Log;
private readonly IsEnvironment _IsEnvironment; private readonly IsEnvironment _IsEnvironment;
private readonly ILogger<TimedHostedService> _Log; private readonly IBackground _BackgroundMethods;
private readonly Models.Properties.IBackground _Background;
private Timer _EDAOutputArchiveTimer; public TimedHostedService(IsEnvironment isEnvironment, Background background)
private Timer _LogPathCleanUpByWeekTimer;
private Timer _EdaDataCollectionPlansTimer;
public TimedHostedService(IsEnvironment isEnvironment, Background background, IServiceProvider serviceProvider)
{ {
_ExecutionCount = 0; _ExecutionCount = 0;
_Background = background; _Background = background;
_IsEnvironment = isEnvironment; _IsEnvironment = isEnvironment;
_Log = serviceProvider.GetRequiredService<ILogger<TimedHostedService>>(); _BackgroundMethods = background;
_Log = Serilog.Log.ForContext<TimedHostedService>();
_EDAOutputArchiveTimer = new Timer(EDAOutputArchiveCallback, null, Timeout.Infinite, Timeout.Infinite); _EDAOutputArchiveTimer = new Timer(EDAOutputArchiveCallback, null, Timeout.Infinite, Timeout.Infinite);
_LogPathCleanUpByWeekTimer = new Timer(LogPathCleanUpByWeekCallback, null, Timeout.Infinite, Timeout.Infinite); _LogPathCleanUpByWeekTimer = new Timer(LogPathCleanUpByWeekCallback, null, Timeout.Infinite, Timeout.Infinite);
_EdaDataCollectionPlansTimer = new Timer(EdaDataCollectionPlansCallback, null, Timeout.Infinite, Timeout.Infinite); _EdaDataCollectionPlansTimer = new Timer(EdaDataCollectionPlansCallback, null, Timeout.Infinite, Timeout.Infinite);
@ -36,139 +34,138 @@ namespace EDAViewer.HostedService
public Task StartAsync(CancellationToken stoppingToken) public Task StartAsync(CancellationToken stoppingToken)
{ {
_Log.LogInformation(string.Concat("Timed Hosted Service: ", nameof(Background), ":", _IsEnvironment.Profile, ":", Environment.ProcessId, " running.")); string? methodName = IMethodName.GetActualAsyncMethodName();
_Background.Update(_Log); using (LogContext.PushProperty("MethodName", methodName))
{
_Log.Info(string.Concat("Timed Hosted Service: ", _IsEnvironment.Profile, ":", Environment.ProcessId, " running."));
int milliSeconds = 3000;
if (_IsEnvironment.Development) if (_IsEnvironment.Development)
{ {
int milliSeconds = 3000; _BackgroundMethods.Update(milliSeconds);
_EdaDataCollectionPlansTimer.Change(milliSeconds, Timeout.Infinite); _ = _EdaDataCollectionPlansTimer.Change(milliSeconds, Timeout.Infinite);
;
_Background.Timers.Add(_EdaDataCollectionPlansTimer); _Background.Timers.Add(_EdaDataCollectionPlansTimer);
milliSeconds += 2000; milliSeconds += 2000;
} }
else if (_IsEnvironment.Staging) else if (_IsEnvironment.Staging)
{ {
int milliSeconds = 3000; _BackgroundMethods.Update(milliSeconds);
_LogPathCleanUpByWeekTimer.Change(milliSeconds, Timeout.Infinite); _ = _EdaDataCollectionPlansTimer.Change(milliSeconds, Timeout.Infinite);
;
_Background.Timers.Add(_LogPathCleanUpByWeekTimer);
milliSeconds += 2000;
_EdaDataCollectionPlansTimer.Change(milliSeconds, Timeout.Infinite);
;
_Background.Timers.Add(_EdaDataCollectionPlansTimer); _Background.Timers.Add(_EdaDataCollectionPlansTimer);
milliSeconds += 2000; milliSeconds += 2000;
_EDAOutputArchiveTimer.Change(milliSeconds, Timeout.Infinite); _ = _EDAOutputArchiveTimer.Change(milliSeconds, Timeout.Infinite);
;
_Background.Timers.Add(_EDAOutputArchiveTimer); _Background.Timers.Add(_EDAOutputArchiveTimer);
milliSeconds += 2000; milliSeconds += 2000;
_ = _LogPathCleanUpByWeekTimer.Change(milliSeconds, Timeout.Infinite);
_Background.Timers.Add(_LogPathCleanUpByWeekTimer);
milliSeconds += 2000;
} }
else if (_IsEnvironment.Production) else if (_IsEnvironment.Production)
{ {
int milliSeconds = 3000; _BackgroundMethods.Update(milliSeconds);
_LogPathCleanUpByWeekTimer.Change(milliSeconds, Timeout.Infinite); _ = _EdaDataCollectionPlansTimer.Change(milliSeconds, Timeout.Infinite);
;
_Background.Timers.Add(_LogPathCleanUpByWeekTimer);
milliSeconds += 2000;
_EdaDataCollectionPlansTimer.Change(milliSeconds, Timeout.Infinite);
;
_Background.Timers.Add(_EdaDataCollectionPlansTimer); _Background.Timers.Add(_EdaDataCollectionPlansTimer);
milliSeconds += 2000; milliSeconds += 2000;
_EDAOutputArchiveTimer.Change(milliSeconds, Timeout.Infinite); _ = _EDAOutputArchiveTimer.Change(milliSeconds, Timeout.Infinite);
;
_Background.Timers.Add(_EDAOutputArchiveTimer); _Background.Timers.Add(_EDAOutputArchiveTimer);
milliSeconds += 2000; milliSeconds += 2000;
_ = _LogPathCleanUpByWeekTimer.Change(milliSeconds, Timeout.Infinite);
_Background.Timers.Add(_LogPathCleanUpByWeekTimer);
milliSeconds += 2000;
} }
else else
throw new Exception(); throw new Exception();
if (_IsEnvironment.Staging || _IsEnvironment.Production) if (_IsEnvironment.Staging || _IsEnvironment.Production)
{ {
string countDirectory = _Background.GetCountDirectory("Start"); string countDirectory = _BackgroundMethods.GetCountDirectory("Start");
string checkDirectory = Path.GetPathRoot(countDirectory); string? checkDirectory = Path.GetPathRoot(countDirectory);
if (Directory.Exists(checkDirectory)) if (Directory.Exists(checkDirectory))
Directory.CreateDirectory(countDirectory); _ = Directory.CreateDirectory(countDirectory);
}
} }
return Task.CompletedTask; return Task.CompletedTask;
} }
public Task StopAsync(CancellationToken stoppingToken) public Task StopAsync(CancellationToken stoppingToken)
{ {
_Log.LogInformation(string.Concat("Timed Hosted Service: ", nameof(Background), ":", _IsEnvironment.Profile, ":", Environment.ProcessId, " is stopping.")); string? methodName = IMethodName.GetActualAsyncMethodName();
_Background.Stop(immediate: true); using (LogContext.PushProperty("MethodName", methodName))
{
_Log.Info(string.Concat("Timed Hosted Service: ", _IsEnvironment.Profile, ":", Environment.ProcessId, " is stopping."));
_BackgroundMethods.Stop(immediate: true);
for (short i = 0; i < short.MaxValue; i++) for (short i = 0; i < short.MaxValue; i++)
{ {
Thread.Sleep(500); Thread.Sleep(500);
if (_ExecutionCount == 0) if (_ExecutionCount == 0)
break; break;
} }
}
return Task.CompletedTask; return Task.CompletedTask;
} }
public void Dispose() public void Dispose()
{ {
_Background.Dispose(); _BackgroundMethods.Dispose();
GC.SuppressFinalize(this);
} }
private void LogPathCleanUpByWeekCallback(object state) private void LogPathCleanUpByWeekCallback(object? state)
{ {
try try
{ {
if (_Background.IsPrimaryInstance()) if (!_BackgroundMethods.IsPrimaryInstance())
_Background.LogPathCleanUpByWeekCallback(); _BackgroundMethods.LogPathCleanUpByWeekCallback();
} }
catch (Exception e) { _Background.Catch(e); } catch (Exception e) { _Log.Error(e, "Error: "); }
try try
{ {
TimeSpan timeSpan; TimeSpan timeSpan;
if (!_Background.IsPrimaryInstance()) if (!_BackgroundMethods.IsPrimaryInstance())
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks); timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
else else
timeSpan = new TimeSpan(DateTime.Now.AddHours(6).Ticks - DateTime.Now.Ticks); timeSpan = new TimeSpan(DateTime.Now.AddHours(6).Ticks - DateTime.Now.Ticks);
_LogPathCleanUpByWeekTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite); _ = _LogPathCleanUpByWeekTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
} }
catch (Exception e) { _Background.Catch(e); } catch (Exception e) { _Log.Error(e, "Error: "); }
} }
private void EDAOutputArchiveCallback(object state) private void EDAOutputArchiveCallback(object? state)
{ {
try try
{ {
if (_Background.IsPrimaryInstance()) if (!_BackgroundMethods.IsPrimaryInstance())
_Background.EDAOutputArchiveCallback(); _BackgroundMethods.EDAOutputArchiveCallback();
} }
catch (Exception e) { _Background.Catch(e); } catch (Exception e) { _Log.Error(e, "Error: "); }
try try
{ {
TimeSpan timeSpan; TimeSpan timeSpan;
if (!_Background.IsPrimaryInstance()) if (!_BackgroundMethods.IsPrimaryInstance())
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks); timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
else else
timeSpan = new TimeSpan(DateTime.Now.AddHours(6).Ticks - DateTime.Now.Ticks); timeSpan = new TimeSpan(DateTime.Now.AddHours(6).Ticks - DateTime.Now.Ticks);
_EDAOutputArchiveTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite); _ = _EDAOutputArchiveTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
} }
catch (Exception e) { _Background.Catch(e); } catch (Exception e) { _Log.Error(e, "Error: "); }
} }
private void EdaDataCollectionPlansCallback(object state) private void EdaDataCollectionPlansCallback(object? state)
{ {
try try
{ {
if (_Background.IsPrimaryInstance()) if (!_BackgroundMethods.IsPrimaryInstance())
_Background.EdaDataCollectionPlansCallback(); _BackgroundMethods.EdaDataCollectionPlansCallback();
} }
catch (Exception e) { _Background.Catch(e); } catch (Exception e) { _Log.Error(e, "Error: "); }
try try
{ {
TimeSpan timeSpan; TimeSpan timeSpan;
if (!_Background.IsPrimaryInstance()) if (!_BackgroundMethods.IsPrimaryInstance())
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks); timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
else else
timeSpan = new TimeSpan(DateTime.Now.AddHours(2).Ticks - DateTime.Now.Ticks); timeSpan = new TimeSpan(DateTime.Now.AddHours(2).Ticks - DateTime.Now.Ticks);
_EdaDataCollectionPlansTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite); _ = _EdaDataCollectionPlansTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
} }
catch (Exception e) { _Background.Catch(e); } catch (Exception e) { _Log.Error(e, "Error: "); }
}
} }
} }

View File

@ -0,0 +1,167 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace IFX.Shared;
public class IsEnvironment
{
public enum Name
{
LinuxDevelopment,
LinuxProduction,
LinuxStaging,
OSXDevelopment,
OSXProduction,
OSXStaging,
WindowsDevelopment,
WindowsProduction,
WindowsStaging
}
public bool DebuggerWasAttachedDuringConstructor { get; private set; }
public bool Development { get; private set; }
public bool Linux { get; private set; }
public bool OSX { get; private set; }
public bool Production { get; private set; }
public bool Staging { get; private set; }
public bool Windows { get; private set; }
public string Profile { get; private set; }
public string AppSettingsFileName { get; private set; }
public string? ASPNetCoreEnvironment { get; private set; }
public IsEnvironment(string testCategory)
{
if (testCategory.EndsWith(".json"))
{
Production = testCategory == "appsettings.json";
Staging = testCategory.EndsWith(nameof(Staging));
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Development = testCategory.EndsWith(nameof(Development));
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
}
else
{
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
OSX = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(OSX));
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
Linux = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Linux));
Staging = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Staging));
Windows = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Windows));
Production = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Production));
Development = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Development));
}
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
}
public IsEnvironment(bool isDevelopment, bool isStaging, bool isProduction)
{
Staging = isStaging;
Production = isProduction;
Development = isDevelopment;
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
}
public IsEnvironment(int? processesCount, bool nullASPNetCoreEnvironmentIsDevelopment, bool nullASPNetCoreEnvironmentIsProduction)
{
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
if (nullASPNetCoreEnvironmentIsDevelopment && nullASPNetCoreEnvironmentIsProduction)
throw new Exception();
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsProduction)
Production = true;
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsDevelopment)
Development = true;
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && !nullASPNetCoreEnvironmentIsDevelopment && !nullASPNetCoreEnvironmentIsProduction)
throw new Exception();
else
{
Staging = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Staging));
Production = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Production));
Development = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Development));
}
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount);
}
private string GetProfile()
{
string result;
if (Windows && Production)
result = nameof(Production);
else if (Windows && Staging)
result = nameof(Staging);
else if (Windows && Development)
result = nameof(Development);
else if (Linux && Production)
result = nameof(Name.LinuxProduction);
else if (Linux && Staging)
result = nameof(Name.LinuxStaging);
else if (Linux && Development)
result = nameof(Name.LinuxDevelopment);
else if (OSX && Production)
result = nameof(Name.OSXProduction);
else if (OSX && Staging)
result = nameof(Name.OSXStaging);
else if (OSX && Development)
result = nameof(Name.OSXDevelopment);
else
throw new Exception();
return result;
}
private string GetAppSettingsFileName(int? processesCount)
{
string result;
if (Production)
{
if (processesCount is null)
result = "appsettings.json";
else
result = $"appsettings.{processesCount}.json";
}
else
{
string environment;
if (Staging)
environment = nameof(Staging);
else if (Development)
environment = nameof(Development);
else
throw new Exception();
if (processesCount is null)
result = $"appsettings.{environment}.json";
else
result = $"appsettings.{environment}.{processesCount}.json";
}
return result;
}
public static string GetEnvironmentName(IsEnvironment isEnvironment)
{
string result;
if (isEnvironment.Windows)
result = nameof(Windows);
else if (isEnvironment.Linux)
result = nameof(Linux);
else if (isEnvironment.OSX)
result = nameof(OSX);
else
throw new Exception();
return result;
}
}

View File

@ -0,0 +1,93 @@
#pragma warning disable SYSLIB0022
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
namespace IFX.Shared;
public static class RijndaelEncryption
{
/// <summary>
/// Change the Inputkey GUID when you use this code in your own program.
/// Keep this inputkey very safe and prevent someone from decoding it some way!!
/// Generated 2021-08-10
/// </summary>
internal const string _Inputkey = "970CCEF6-4307-4F6A-9AC8-377DADB889BD";
/// <summary>
/// Encrypt the given text and give the byte array back as a BASE64 string
/// </summary>
/// <param name="text">The text to encrypt</param>
/// <param name="salt">The pasword salt</param>
/// <returns>The encrypted text</returns>
public static string Encrypt(string text, string salt)
{
string result;
if (string.IsNullOrEmpty(text))
throw new ArgumentNullException(nameof(text));
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
MemoryStream msEncrypt = new();
using (CryptoStream csEncrypt = new(msEncrypt, encryptor, CryptoStreamMode.Write))
using (StreamWriter swEncrypt = new(csEncrypt))
swEncrypt.Write(text);
result = Convert.ToBase64String(msEncrypt.ToArray());
return result;
}
/// <summary>
/// Checks if a string is base64 encoded
/// </summary>
/// <param name="base64String">The base64 encoded string</param>
/// <returns></returns>
public static bool IsBase64String(string base64String)
{
bool result;
base64String = base64String.Trim();
result = (base64String.Length % 4 == 0) && Regex.IsMatch(base64String, @"^[a-zA-Z0-9\+/]*={0,3}$", RegexOptions.None);
return result;
}
/// <summary>
/// Decrypts the given text
/// </summary>
/// <param name="cipherText">The encrypted BASE64 text</param>
/// <param name="salt">The pasword salt</param>
/// <returns>De gedecrypte text</returns>
public static string Decrypt(string cipherText, string salt)
{
if (string.IsNullOrEmpty(cipherText))
throw new ArgumentNullException(nameof(cipherText));
if (!IsBase64String(cipherText))
throw new Exception("The cipherText input parameter is not base64 encoded");
string text;
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
byte[] cipher = Convert.FromBase64String(cipherText);
using (MemoryStream msDecrypt = new(cipher))
{
using CryptoStream csDecrypt = new(msDecrypt, decryptor, CryptoStreamMode.Read);
using StreamReader srDecrypt = new(csDecrypt);
text = srDecrypt.ReadToEnd();
}
return text;
}
/// <summary>
/// Create a new RijndaelManaged class and initialize it
/// </summary>
/// <param name="salt">The pasword salt</param>
/// <returns></returns>
private static RijndaelManaged NewRijndaelManaged(string salt)
{
if (salt == null)
throw new ArgumentNullException(nameof(salt));
byte[] saltBytes = Encoding.ASCII.GetBytes(salt);
Rfc2898DeriveBytes key = new(_Inputkey, saltBytes);
RijndaelManaged aesAlg = new();
aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8);
aesAlg.IV = key.GetBytes(aesAlg.BlockSize / 8);
return aesAlg;
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.Core
{
public class BackboneComponent
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.Core
{
public class BackboneStatusCache
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.Core
{
public interface ILoggingSetupManager
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.Core
{
public class StatusItem
{
}
}

View File

@ -1,48 +0,0 @@
using Library.PeerGroup.GCL.Annotations;
using System;
using System.Collections.Generic;
namespace Library.Eaf.Core
{
public class Backbone
{
public const string STATE_ERROR = "Error";
public const string STATE_OFFLINE = "Offline";
public const string STATE_RUNNING = "Running";
public const string STATE_SHUTDOWN = "Shutting Down";
public const string STATE_STARTING = "Starting";
protected Backbone() { }
[NotNull]
public static Backbone Instance { get; }
[NotNull]
public ILoggingSetupManager LoggingConfigurationManager { get; set; }
public BackboneStatusCache Status { get; }
public bool IsAutomatedRestartActive { get; }
public bool IsReadyForRestart { get; }
public string StartTime { get; }
public string State { get; }
public string Name { get; }
public string ConfigurationServiceAddress { get; }
public string CellName { get; }
protected bool IsInitialized { get; set; }
protected Dictionary<string, BackboneComponent> BackboneComponents { get; }
public void AddBackboneComponent(BackboneComponent backboneComponent) { }
public bool ContainsBackboneComponent(string id) { throw new NotImplementedException(); }
[Obsolete("Use the capabilities exposed via the Status property -> GetAll. Will be removed with next major release.")]
public List<StatusItem> GetAllStatuses() { throw new NotImplementedException(); }
public BackboneComponent GetBackboneComponentById(string id) { throw new NotImplementedException(); }
public List<T> GetBackboneComponentsOfType<T>() { throw new NotImplementedException(); }
public List<BackboneComponent> GetBackboneComponentsOfType(Type type) { throw new NotImplementedException(); }
public void RegisterSubprocess(int pid) { }
[Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")]
public void SetStatus(string statusName, string statusValue) { }
[Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")]
public void SetStatus(BackboneComponent source, string statusName, string statusValue) { }
protected void CloseConnectionOfComponents(List<BackboneComponent> components) { }
protected virtual void StopAllComponents() { }
protected void StopComponents(List<BackboneComponent> components) { }
}
}

View File

@ -1,24 +0,0 @@
using System;
namespace Library.Eaf.Core.Smtp
{
public class EmailMessage
{
public EmailMessage() { }
public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { }
public string Body { get; }
public MailPriority Priority { get; }
public string Subject { get; }
public EmailMessage PriorityHigh() { throw new NotImplementedException(); }
public EmailMessage PriorityLow() { throw new NotImplementedException(); }
public EmailMessage PriorityNormal() { throw new NotImplementedException(); }
public EmailMessage SetBody(string body) { throw new NotImplementedException(); }
public EmailMessage SetPriority(MailPriority priority) { throw new NotImplementedException(); }
public EmailMessage SetSubject(string subject) { throw new NotImplementedException(); }
}
}

View File

@ -1,9 +0,0 @@
namespace Library.Eaf.Core.Smtp
{
public interface ISmtp
{
void Send(EmailMessage message);
}
}

View File

@ -1,11 +0,0 @@
namespace Library.Eaf.Core.Smtp
{
public enum MailPriority
{
Low = 0,
Normal = 1,
High = 2
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public class ChangeDataCollectionHandler
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public class DataCollectionRequest
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public class EquipmentEvent
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public class EquipmentException
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public class EquipmentSelfDescription
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public class GetParameterValuesHandler
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public interface IConnectionControl
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public interface IDataTracingHandler
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public interface IEquipmentCommandService
{
}
}

View File

@ -1,16 +0,0 @@
using Library.PeerGroup.GCL.Annotations;
namespace Library.Eaf.EquipmentCore.Control
{
public interface IEquipmentControl : IPackageSource
{
[NotNull]
IEquipmentSelfDescriptionBuilder SelfDescriptionBuilder { get; }
[NotNull]
IEquipmentDataCollection DataCollection { get; }
[NotNull]
IEquipmentCommandService Commands { get; }
[NotNull]
IConnectionControl Connection { get; }
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public interface IEquipmentSelfDescriptionBuilder
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public interface IPackage
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public interface ISelfDescriptionLookup
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public interface IVirtualParameterValuesHandler
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public class SetParameterValuesHandler
{
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public class TraceRequest
{
}
}

View File

@ -1,39 +0,0 @@
using Library.Eaf.EquipmentCore.DataCollection.Reporting;
using Library.Eaf.EquipmentCore.SelfDescription.ElementDescription;
using System;
using System.Collections.Generic;
namespace Library.Eaf.EquipmentCore.Control
{
public interface IEquipmentDataCollection
{
IVirtualParameterValuesHandler VirtualParameterValuesHandler { get; }
ISelfDescriptionLookup SelfDescriptionLookup { get; }
EquipmentSelfDescription SelfDescription { get; }
IEnumerable<DataCollectionRequest> ActiveRequests { get; }
IDataTracingHandler DataTracingHandler { get; }
ParameterValue CreateParameterValue(EquipmentParameter parameter, object value);
void NotifyDataTracingAvailable(bool isAvailable);
void RegisterChangeDataCollectionHandler(ChangeDataCollectionHandler handler);
void RegisterDataTracingHandler(IDataTracingHandler handler);
void RegisterGetParameterValuesHandler(GetParameterValuesHandler handler);
void RegisterSetParameterValuesHandler(SetParameterValuesHandler handler);
void TriggerDeactivate(DataCollectionRequest deactivateRequest);
void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters);
void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters);
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride);
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage);
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage);
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride);
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters);
void TriggerPerformanceRestored();
void TriggerPerformanceWarning();
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters);
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, DateTime equipmentTimeStamp);
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.EquipmentCore.Control
{
public interface IPackageSource
{
}
}

View File

@ -1,20 +0,0 @@
using Library.Eaf.EquipmentCore.SelfDescription.ElementDescription;
using Library.PeerGroup.GCL.Annotations;
using System;
namespace Library.Eaf.EquipmentCore.DataCollection.Reporting
{
public class ParameterValue
{
public ParameterValue(EquipmentParameter definition, object value) { }
public ParameterValue(EquipmentParameter definition, object value, DateTime timestamp) { }
public virtual object Value { get; protected internal set; }
[NotNull]
public EquipmentParameter Definition { get; }
public DateTime Timestamp { get; protected set; }
public virtual ParameterValue Clone(EquipmentParameter newDefinition) { throw new NotImplementedException(); }
public override string ToString() { return base.ToString(); }
}
}

View File

@ -1,24 +0,0 @@
using Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
namespace Library.Eaf.EquipmentCore.SelfDescription.ElementDescription
{
public class EquipmentParameter
{
public EquipmentParameter(EquipmentParameter source, ParameterTypeDefinition typeDefinition) { }
public EquipmentParameter(string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { }
public EquipmentParameter(string id, string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { }
public string Name { get; }
public string Id { get; }
public string Description { get; }
public string SourcePath { get; }
public string SourceEquipment { get; }
public ParameterTypeDefinition TypeDefinition { get; }
public bool IsTransient { get; }
public bool IsReadOnly { get; }
public override string ToString() { return base.ToString(); }
public string ToStringWithDetails() { return base.ToString(); }
}
}

View File

@ -1,12 +0,0 @@
namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes
{
public class Field
{
public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { }
public string Name { get; }
public string Description { get; }
public ParameterTypeDefinition TypeDefinition { get; }
public bool CanBeNull { get; }
}
}

View File

@ -1,12 +0,0 @@
namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes
{
public abstract class ParameterTypeDefinition
{
public ParameterTypeDefinition(string name, string description) { }
public string Name { get; }
public string Description { get; }
public override string ToString() { return base.ToString(); }
}
}

View File

@ -1,12 +0,0 @@
using System.Collections.Generic;
namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes
{
public class StructuredType : ParameterTypeDefinition
{
public StructuredType(string name, string description, IList<Field> fields) : base(name, description) { }
public IList<Field> Fields { get; }
}
}

View File

@ -1,6 +0,0 @@
namespace Library.Eaf.Management.ConfigurationData.CellAutomation
{
public interface IConfigurationObject
{
}
}

View File

@ -1,26 +0,0 @@
using System;
namespace Library.Eaf.Management.ConfigurationData.CellAutomation
{
[System.Runtime.Serialization.DataContractAttribute(IsReference = true)]
public class ModelObjectParameterDefinition : IConfigurationObject
{
public ModelObjectParameterDefinition() { }
public ModelObjectParameterDefinition(string name, ModelObjectParameterType valueType, object defaultValue) { }
public ModelObjectParameterDefinition(string name, Type enumType, object defaultValue) { }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long Id { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual string Name { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual string Value { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual ModelObjectParameterType ValueType { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual string EnumType { get; set; }
public virtual ModelObjectParameterDefinition Clone() { return null; }
public virtual bool IsValidValue(string value) { return false; }
}
}

View File

@ -1,17 +0,0 @@
namespace Library.Eaf.Management.ConfigurationData.CellAutomation
{
public enum ModelObjectParameterType
{
String = 0,
Bool = 1,
Byte = 2,
SignedByte = 3,
Integer = 4,
UnsignedInteger = 5,
LongInteger = 6,
UnsignedLongInteger = 7,
Double = 8,
Float = 9,
Enum = 10
}
}

View File

@ -1,44 +0,0 @@
using Library.PeerGroup.GCL.SecsDriver;
using System;
namespace Library.Eaf.Management.ConfigurationData.Semiconductor.CellInstances
{
[System.Runtime.Serialization.DataContractAttribute]
public class SecsConnectionConfiguration
{
public SecsConnectionConfiguration() { }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan T6HsmsControlMessage { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan T5ConnectionSeperation { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan T4InterBlock { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan T3MessageReply { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan T2Protocol { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan T1InterCharacter { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual SerialBaudRate? BaudRate { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual SecsTransportType? PortType { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? Port { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan LinkTestTimer { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual string Host { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? DeviceId { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual HsmsSessionMode? SessionMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual HsmsConnectionMode? ConnectionMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan T7ConnectionIdle { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan T8NetworkIntercharacter { get; set; }
}
}

View File

@ -1,13 +0,0 @@
namespace Library.Ifx.Eaf.Common.Configuration
{
[System.Runtime.Serialization.DataContractAttribute]
public class ConnectionSetting
{
public ConnectionSetting(string name, string value) { }
[System.Runtime.Serialization.DataMemberAttribute]
public string Name { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string Value { get; set; }
}
}

View File

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
namespace Library.Ifx.Eaf.EquipmentConnector.File.Component
{
public class File
{
public File(string filePath) { throw new NotImplementedException(); }
public File(string filePath, DateTime timeFileFound) { throw new NotImplementedException(); }
public string Path { get; }
public DateTime TimeFound { get; }
public bool IsErrorFile { get; }
public Dictionary<string, string> ContentParameters { get; }
public File UpdateContentParameters(Dictionary<string, string> contentParameters) { throw new NotImplementedException(); }
public File UpdateParsingStatus(bool isErrorFile) { throw new NotImplementedException(); }
}
}

View File

@ -1,35 +0,0 @@
using Library.Ifx.Eaf.EquipmentConnector.File.Configuration;
using System;
using System.Collections.Generic;
namespace Library.Ifx.Eaf.EquipmentConnector.File.Component
{
public class FilePathGenerator
{
public const char PLACEHOLDER_IDENTIFIER = '%';
public const char PLACEHOLDER_SEPARATOR = ':';
public const string PLACEHOLDER_NOT_AVAILABLE = "NA";
public const string PLACEHOLDER_ORIGINAL_FILE_NAME = "OriginalFileName";
public const string PLACEHOLDER_ORIGINAL_FILE_EXTENSION = "OriginalFileExtension";
public const string PLACEHOLDER_DATE_TIME = "DateTime";
public const string PLACEHOLDER_SUB_FOLDER = "SubFolder";
public const string PLACEHOLDER_CELL_NAME = "CellName";
public FilePathGenerator(FileConnectorConfiguration config, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
protected string SubFolderPath { get; }
protected FileConnectorConfiguration Configuration { get; }
protected File File { get; }
protected bool IsErrorFile { get; }
protected string DefaultPlaceHolderValue { get; }
public string GetFullTargetPath() { throw new NotImplementedException(); }
public virtual string GetTargetFileName() { throw new NotImplementedException(); }
public string GetTargetFolder(bool throwExceptionIfNotExist = true) { throw new NotImplementedException(); }
protected virtual string GetSubFolder(string folderPattern, string subFolderPath) { throw new NotImplementedException(); }
protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) { throw new NotImplementedException(); }
protected string ReplacePlaceholder(string inputPath) { throw new NotImplementedException(); }
}
}

View File

@ -1,135 +0,0 @@
using Library.Ifx.Eaf.Common.Configuration;
using System;
using System.Collections.Generic;
namespace Library.Ifx.Eaf.EquipmentConnector.File.Configuration
{
[System.Runtime.Serialization.DataContractAttribute]
public class FileConnectorConfiguration
{
public const ulong IDLE_EVENT_WAIT_TIME_DEFAULT = 360;
public const ulong FILE_HANDLE_TIMEOUT_DEFAULT = 15;
[System.Runtime.Serialization.DataMemberAttribute]
public virtual bool? TriggerOnChanged { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? PostProcessingRetries { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual bool? CopySourceFolderStructure { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public IfPostProcessingFailsEnum? IfPostProcessingFailsAction { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string AlternateTargetFolder { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public long? FileHandleTimeout { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public bool? DeleteEmptySourceSubFolders { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public long? IdleEventWaitTimeInSeconds { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string FileAgeThreshold { get; set; }
public bool? FolderAgeCheckIndividualSubFolders { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual ZipModeEnum? ZipMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public FileAgeFilterEnum? FileAgeFilterMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string ZipTargetFileName { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string ZipErrorTargetFileName { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public long? ZipFileSubFolderLevel { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string DefaultPlaceHolderValue { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public bool? UseZip64Mode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public List<ConnectionSetting> ConnectionSettings { get; set; }
public string SourceDirectoryCloaking { get; set; }
public string FolderAgeThreshold { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? FileScanningIntervalInSeconds { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual bool? TriggerOnCreated { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? ZipFileTime { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string SourceFileLocation { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string SourceFileFilter { get; set; }
public List<string> SourceFileFilters { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual bool? IncludeSubDirectories { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual FileScanningOptionEnum? FileScanningOption { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string TargetFileLocation { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string ErrorTargetFileLocation { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string TargetFileName { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? FileHandleWaitTime { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public IfFileExistEnum? IfFileExistAction { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public long? ConnectionRetryInterval { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public PreProcessingModeEnum? PreProcessingMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public PostProcessingModeEnum? PostProcessingMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public PostProcessingModeEnum? ErrorPostProcessingMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? ZipFileAmount { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string ErrorTargetFileName { get; set; }
public void Initialize() { throw new NotImplementedException(); }
public enum PostProcessingModeEnum
{
None = 0,
Move = 1,
Copy = 2,
Rename = 3,
Zip = 4,
Delete = 5,
MoveFolder = 6,
CopyFolder = 7,
DeleteFolder = 8
}
public enum PreProcessingModeEnum
{
None = 0,
Process = 1
}
public enum IfFileExistEnum
{
Overwrite = 0,
LeaveFiles = 1,
Delete = 2
}
public enum IfPostProcessingFailsEnum
{
LeaveFiles = 0,
Delete = 1
}
public enum FileScanningOptionEnum
{
FileWatcher = 0,
TimeBased = 1
}
public enum ZipModeEnum
{
ZipByAmountOrTime = 0,
ZipByFileName = 1,
ZipBySubFolderName = 2
}
public enum FileAgeFilterEnum
{
IgnoreNewer = 0,
IgnoreOlder = 1
}
}
}

View File

@ -1,14 +0,0 @@
using Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
using System;
using System.Collections.Generic;
namespace Library.Ifx.Eaf.EquipmentConnector.File.SelfDescription
{
public class FileConnectorParameterTypeDefinitionProvider
{
public FileConnectorParameterTypeDefinitionProvider() { }
public IEnumerable<ParameterTypeDefinition> GetAllParameterTypeDefinition() { return null; }
public ParameterTypeDefinition GetParameterTypeDefinition(string name) { return null; }
}
}

View File

@ -1,10 +0,0 @@
using System;
namespace Library.PeerGroup.GCL.Annotations
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.Delegate, AllowMultiple = false, Inherited = true)]
public sealed class NotNullAttribute : Attribute
{
public NotNullAttribute() { }
}
}

View File

@ -1,8 +0,0 @@
namespace Library.PeerGroup.GCL.SecsDriver
{
public enum HsmsConnectionMode
{
Active = 0,
Passive = 1
}
}

View File

@ -1,8 +0,0 @@
namespace Library.PeerGroup.GCL.SecsDriver
{
public enum HsmsSessionMode
{
MultiSession = 0,
SingleSession = 1
}
}

View File

@ -1,8 +0,0 @@
namespace Library.PeerGroup.GCL.SecsDriver
{
public enum SecsTransportType
{
HSMS = 0,
Serial = 1
}
}

View File

@ -1,16 +0,0 @@
namespace Library.PeerGroup.GCL.SecsDriver
{
public enum SerialBaudRate
{
Baud9600 = 0,
Baud19200 = 1,
Baud4800 = 2,
Baud2400 = 3,
Baud1200 = 4,
Baud300 = 5,
Baud150 = 6,
Baud38400 = 7,
Baud57600 = 8,
Baud115200 = 9
}
}

View File

@ -1,15 +1,52 @@
namespace EDAViewer.Models using System.Text.Json;
using System.Text.Json.Serialization;
namespace EDAViewer.Models;
public class AppSettings
{ {
public class AppSettings
protected string _BuildNumber;
protected string _Company;
protected string _ECEDADatabasePassword;
protected string _GitCommitSeven;
protected string _IFXEDADatabasePassword;
protected string _MonARessource;
protected string _Server;
protected string _URLs;
protected string _WorkingDirectoryName;
public string BuildNumber => _BuildNumber;
public string Company => _Company;
public string ECEDADatabasePassword => _ECEDADatabasePassword;
public string GitCommitSeven => _GitCommitSeven;
public string IFXEDADatabasePassword => _IFXEDADatabasePassword;
public string MonARessource => _MonARessource;
public string Server => _Server;
public string URLs => _URLs;
public string WorkingDirectoryName => _WorkingDirectoryName;
// public AppSettings()
// {
// }
[JsonConstructor]
public AppSettings(string buildNumber, string company, string ecEDADatabasePassword, string gitCommitSeven, string ifxEDADatabasePassword, string monARessource, string server, string urls, string workingDirectoryName)
{ {
public string Company { get; set; } _BuildNumber = buildNumber;
public string ECEDADatabasePassword { get; set; } _Company = company;
public string EncryptedPassword { get; set; } _ECEDADatabasePassword = ecEDADatabasePassword;
public string IFXEDADatabasePassword { get; set; } _GitCommitSeven = gitCommitSeven;
public string MonARessource { get; set; } _IFXEDADatabasePassword = ifxEDADatabasePassword;
public string Server { get; set; } _MonARessource = monARessource;
public string ServiceUser { get; set; } _Server = server;
public string URLs { get; set; } _URLs = urls;
public string WorkingDirectoryName { get; set; } _WorkingDirectoryName = workingDirectoryName;
} }
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
} }

View File

@ -0,0 +1,38 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json;
namespace EDAViewer.Models.Binder;
public class AppSettings
{
[Display(Name = "Build Number"), Required] public string BuildNumber { get; set; }
[Display(Name = "Company"), Required] public string Company { get; set; }
[Display(Name = "EC EDA Database Password"), Required] public string ECEDADatabasePassword { get; set; }
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
[Display(Name = "IFX EDA Database Password"), Required] public string IFXEDADatabasePassword { get; set; }
[Display(Name = "MonA Ressource"), Required] public string MonARessource { get; set; }
[Display(Name = "Server"), Required] public string Server { get; set; }
[Display(Name = "URLs"), Required] public string URLs { get; set; }
[Display(Name = "Working Directory Name"), Required] public string WorkingDirectoryName { get; set; }
public AppSettings()
{
BuildNumber = string.Empty;
Company = string.Empty;
ECEDADatabasePassword = string.Empty;
GitCommitSeven = string.Empty;
IFXEDADatabasePassword = string.Empty;
MonARessource = string.Empty;
Server = string.Empty;
URLs = string.Empty;
WorkingDirectoryName = string.Empty;
}
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
}

View File

@ -1,52 +0,0 @@
using EDAViewer.Models;
using System;
using System.ComponentModel.DataAnnotations;
namespace EDAViewer.Models
{
public class EdaHtmlDiff : WithEnvironment
{
public string Paths { get; set; }
public string CurrentPath { get; set; }
public string PathAndFileName { get; set; }
[Display(Name = "FileName")]
[DisplayFormat(ConvertEmptyStringToNull = false)]
[Required(ErrorMessage = "Please select an file name", AllowEmptyStrings = false)]
public string FileName { get; set; }
public EdaHtmlDiff()
{
Common(path: string.Empty);
}
public EdaHtmlDiff(WithEnvironment withEnvironment, string path)
{
Common(path);
if (string.IsNullOrEmpty(withEnvironment.user_name))
user_name = "AUTO";
else
user_name = withEnvironment.user_name;
if (string.IsNullOrEmpty(withEnvironment.machine_name))
machine_name = "IFX";
else
machine_name = withEnvironment.machine_name;
if (withEnvironment.now_ticks == 0)
now_ticks = DateTime.Now.Ticks;
else
now_ticks = withEnvironment.now_ticks;
message = withEnvironment.message;
}
private void Common(string path)
{
Paths = string.Empty;
CurrentPath = path;
FileName = string.Empty;
}
}
}

View File

@ -1,9 +1,8 @@
namespace EDAViewer.Models namespace EDAViewer.Models;
public class ErrorViewModel
{ {
public class ErrorViewModel public string? RequestId { get; set; }
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
} }

View File

@ -1,46 +0,0 @@
namespace EDAViewer.Models
{
public interface IBackground
{
void EdaDataCollectionPlansCallback();
// public void EdaDataCollectionPlans()
// {
// long ticks = DateTime.Now.Ticks;
// Logic2021Q1 logic2021Q1 = new Logic2021Q1(_Log);
// string server = GetServer(debugIsNotEC: false);
// string cSharpFormat = "yyyy-MM-dd_hh:mm:ss tt";
// string oracleFormat = "yyyy-MM-dd_hh:mi:ss AM";
// string edaDataCollectionPlansLastRun = "2020-07-02_10:45:01 AM";
// logic2021Q1.EdaDataCollectionPlans(server, server.Contains("_ec_"), edaDataCollectionPlansLastRun, cSharpFormat, oracleFormat);
// _Log.Debug(string.Concat("Took ", new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds, " second(s)"));
// }
void EDAOutputArchiveCallback();
// public void EDAOutputArchive()
// {
// long ticks = DateTime.Now.Ticks;
// string server = GetServer(debugIsNotEC: true);
// string sourceDirectory = string.Concat(@"\\", server, @"\ec_eda\Staging\Traces");
// if (!Directory.Exists(sourceDirectory))
// _Log.Debug(string.Concat("// Source directory <", sourceDirectory, "> doesn't exist."));
// else
// {
// Logic2019Q4 logic2019Q4 = new Logic2019Q4(_Log);
// logic2019Q4.EDAOutputArchive(sourceDirectory);
// }
// _Log.Debug(string.Concat("Took ", new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds, " second(s)"));
// }
void LogPathCleanUpByWeekCallback();
// public void LogPathCleanUpByWeek()
// {
// long ticks = DateTime.Now.Ticks;
// string server = GetServer(debugIsNotEC: true);
// Logic2019Q3 logic2019Q3 = new Logic2019Q3(_Log);
// logic2019Q3.LogPathCleanUpByWeek(server, isEDA: true);
// logic2019Q3.LogPathCleanUpByWeek(server, isEAFLog: true);
// _Log.Debug(string.Concat("Took ", new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds, " second(s)"));
// }
}
}

View File

@ -1,17 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Collections.Generic;
namespace EDAViewer.Models
{
public interface IHomeController
{
IActionResult Background(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null, int? invoke_eda_dcp = null);
IActionResult Encode(string value = null);
IActionResult Error();
IActionResult Index();
IActionResult Privacy();
IActionResult ViewEdaHtmlDiff(WithEnvironment withEnvironment = null);
ActionResult<IEnumerable<SelectListItem>> GetDirectoriesOrFiles(string path = null, bool? upDirectory = null, string filter = null);
}
}

View File

@ -0,0 +1,20 @@
namespace EDAViewer.Models.Methods;
public interface IBackground
{
void Catch(Exception exception);
void ClearIsPrimaryInstance();
void ClearMessage();
void Dispose();
bool IsPrimaryInstance();
void SetIsPrimaryInstance();
void Stop(bool immediate);
void Update(int milliSeconds);
string GetCountDirectory(string verb);
void EDAOutputArchiveCallback();
void EdaDataCollectionPlansCallback();
void LogPathCleanUpByWeekCallback();
}

View File

@ -0,0 +1,8 @@
namespace EDAViewer.Models.Properties;
public interface IBackground
{
public List<Timer> Timers { get; }
}

View File

@ -0,0 +1,10 @@
namespace EDAViewer.Models.Properties;
public interface IBackgroundPage
{
public List<Exception> Exceptions { get; }
public string Message { get; }
public string WorkingDirectory { get; }
}

View File

@ -0,0 +1,39 @@
using System.Text.Json;
namespace EDAViewer.Models.Stateless;
public abstract class AppSettings
{
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
{
Models.AppSettings? result;
Binder.AppSettings appSettings = configurationRoot.Get<Binder.AppSettings>();
string json = JsonSerializer.Serialize(appSettings, new JsonSerializerOptions() { WriteIndented = true });
result = JsonSerializer.Deserialize<Models.AppSettings>(json);
if (result is null)
throw new Exception(json);
if (string.IsNullOrEmpty(result.Company))
throw new Exception(json);
string jsonThis = result.ToString();
if (jsonThis != json)
{
int? check = null;
int min = new int[] { json.Length, jsonThis.Length }.Min();
for (int i = 0; i < min; i++)
{
if (json[i] == jsonThis[i])
continue;
check = i;
break;
}
if (check is null)
throw new Exception();
string a = json[..check.Value].Split(',')[^1];
string b = json[check.Value..].Split(',')[0];
throw new Exception($"{a}{b}");
}
return result;
}
}

View File

@ -0,0 +1,10 @@
namespace EDAViewer.Models.Stateless.Methods;
public interface IBackgroundPage
{
void OnGet(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null);
static string GetRouteName() => nameof(IBackgroundPage).Replace("Page", string.Empty)[1..];
}

View File

@ -0,0 +1,10 @@
using System.Runtime.CompilerServices;
namespace EDAViewer.Models.Stateless.Methods;
public interface IMethodName
{
static string? GetActualAsyncMethodName([CallerMemberName] string? name = null) => name;
}

View File

@ -0,0 +1,8 @@
namespace EDAViewer.Models.Stateless.Methods;
public interface IWorkingDirectory
{
static string GetWorkingDirectory(string? executingAssemblyName, string subDirectoryName) => WorkingDirectory.GetWorkingDirectory(executingAssemblyName, subDirectoryName);
}

View File

@ -0,0 +1,50 @@
namespace EDAViewer.Models.Stateless.Methods;
internal abstract class WorkingDirectory
{
internal static string GetWorkingDirectory(string? executingAssemblyName, string subDirectoryName)
{
string result = string.Empty;
if (executingAssemblyName is null)
throw new Exception();
string traceFile;
List<string> directories = new();
Environment.SpecialFolder[] specialFolders = new Environment.SpecialFolder[]
{
Environment.SpecialFolder.LocalApplicationData,
Environment.SpecialFolder.ApplicationData,
Environment.SpecialFolder.History,
Environment.SpecialFolder.CommonApplicationData,
Environment.SpecialFolder.InternetCache
};
foreach (Environment.SpecialFolder specialFolder in specialFolders)
directories.Add(Path.Combine(Environment.GetFolderPath(specialFolder), subDirectoryName, executingAssemblyName));
foreach (string directory in directories)
{
for (int i = 1; i < 3; i++)
{
if (i == 1)
result = directory;
else
result = string.Concat("D", directory[1..]);
try
{
if (!Directory.Exists(result))
_ = Directory.CreateDirectory(result);
traceFile = string.Concat(result, @"\", DateTime.Now.Ticks, ".txt");
File.WriteAllText(traceFile, traceFile);
File.Delete(traceFile);
break;
}
catch (Exception) { result = string.Empty; }
}
if (!string.IsNullOrEmpty(result))
break;
}
if (string.IsNullOrEmpty(result))
throw new Exception("Unable to set working directory!");
return result;
}
}

View File

@ -0,0 +1,10 @@
namespace EDAViewer.Models.Stateless;
public static class SerilogExtensionMethods
{
internal static void Warn(this Serilog.ILogger log, string messageTemplate) => log.Warning(messageTemplate);
internal static void Info(this Serilog.ILogger log, string messageTemplate) => log.Information(messageTemplate);
}

View File

@ -1,14 +0,0 @@
namespace EDAViewer.Models
{
public class WithEnvironment
{
public string message { get; set; }
public string user_name { get; set; }
public string machine_name { get; set; }
public long now_ticks { get; set; }
}
}

View File

@ -0,0 +1,68 @@
@page
@model EDAViewer.Pages.BackgroundPage
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Background</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/app.css" rel="stylesheet" />
</head>
<body>
<div class="main">
<div class="content px-4">
<div class="jumbotron">
<h1>@(nameof(EDAViewer)) -
@(Model.IsPrimaryInstance) -
@(Model.IsEnvironmentProfile) -
@(Model.AppSettingsBuildNumber) -
@(Model.AppSettingsGitCommitSeven) -
@(Model.AppSettingsURLs)</h1>
<p class="lead">@(Model.WorkingDirectory)</p>
<p class="lead">@(Model.Message)</p>
<h1>@(string.Concat("Exception(s) - ", Model.Exceptions.Count))</h1>
</div>
<div>
<ul>
<li><a href="/Index.txt">Index.txt</a></li>
<li><a href="/Background">Background Message</a></li>
<li><a href="/Background/?message_clear=true">Background Message Clear</a></li>
<li><a href="/Background/?exceptions_clear=true">Background Exceptions Clear</a></li>
<li><a href="/Background/?set_is_primary_instance=true">Background Set Is Primary Instance</a></li>
<li><a href="/Background/?set_is_primary_instance=false">Background Clear Primary Instance</a></li>
</ul>
</div>
<p>&nbsp;</p>
<hr />
<div>
<form action="">
@if (Model.Exceptions.Any())
{
int i = 0;
@foreach (Exception exception in Model.Exceptions)
{
<p>
@Html.Raw(string.Concat("<textarea name=\"message_", i, "\" rows='1' cols='400'>",
exception.Message, "</textarea>"));
</p>
<p>
@Html.Raw(string.Concat("<textarea name=\"stackTrace_", i, "\" rows='4' cols='400'>",
exception.StackTrace, "</textarea>"));
</p>
<hr />
@(i += 1)
;
}
}
</form>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,74 @@
using EDAViewer.Models.Stateless.Methods;
using IFX.Shared;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Serilog.Context;
using System.Text.Json;
namespace EDAViewer.Pages;
public class BackgroundPage : PageModel, Models.Properties.IBackgroundPage, IBackgroundPage
{
protected readonly string _AppSettingsBuildNumber;
protected readonly string _AppSettingsGitCommitSeven;
protected readonly string _AppSettingsURLs;
protected readonly List<Exception> _Exceptions;
protected readonly string _IsEnvironmentProfile;
protected string _IsPrimaryInstance;
protected readonly string _Message;
protected readonly string _WorkingDirectory;
public string AppSettingsBuildNumber => _AppSettingsBuildNumber;
public string AppSettingsGitCommitSeven => _AppSettingsGitCommitSeven;
public string AppSettingsURLs => _AppSettingsURLs;
public List<Exception> Exceptions => _Exceptions;
public string IsEnvironmentProfile => _IsEnvironmentProfile;
public string IsPrimaryInstance => _IsPrimaryInstance;
public string Message => _Message;
public string WorkingDirectory => _WorkingDirectory;
private readonly Serilog.ILogger _Log;
private readonly Models.Methods.IBackground _BackgroundMethods;
public BackgroundPage(IsEnvironment isEnvironment, Models.AppSettings appSettings, Singleton.Background background)
{
_Message = background.Message;
_BackgroundMethods = background;
_AppSettingsURLs = appSettings.URLs;
_Exceptions = background.Exceptions;
_IsEnvironmentProfile = isEnvironment.Profile;
_Log = Serilog.Log.ForContext<BackgroundPage>();
_WorkingDirectory = background.WorkingDirectory;
_AppSettingsBuildNumber = appSettings.BuildNumber;
_AppSettingsGitCommitSeven = appSettings.GitCommitSeven;
Models.Methods.IBackground backgroundMethods = background;
_IsPrimaryInstance = backgroundMethods.IsPrimaryInstance().ToString();
}
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
public void OnGet(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null)
{
string? methodName = IMethodName.GetActualAsyncMethodName();
using (LogContext.PushProperty("MethodName", methodName))
{
_Log.Debug("() => ...");
if (message_clear.HasValue && message_clear.Value)
_BackgroundMethods.ClearMessage();
if (exceptions_clear.HasValue && exceptions_clear.Value)
_Exceptions.Clear();
if (set_is_primary_instance.HasValue)
{
if (set_is_primary_instance.Value)
_BackgroundMethods.SetIsPrimaryInstance();
else
_BackgroundMethods.ClearIsPrimaryInstance();
_IsPrimaryInstance = _BackgroundMethods.IsPrimaryInstance().ToString();
}
}
}
}

View File

@ -0,0 +1,42 @@
@page
@model EDAViewer.Pages.ErrorModel
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Error</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/app.css" rel="stylesheet" asp-append-version="true" />
</head>
<body>
<div class="main">
<div class="content px-4">
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,20 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;
namespace EDAViewer.Pages;
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _Logger;
public ErrorModel(ILogger<ErrorModel> logger) => _Logger = logger;
public void OnGet() => RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}

View File

@ -1,33 +1,88 @@
using Microsoft.AspNetCore.Hosting; using EDAViewer.HostedService;
using Microsoft.Extensions.Configuration; using EDAViewer.Models;
using Microsoft.Extensions.Hosting; using EDAViewer.Models.Stateless.Methods;
using Shared; using IFX.Shared;
using System.Diagnostics; using Microsoft.Extensions.Hosting.WindowsServices;
using Serilog;
using System.Reflection;
namespace EDAViewer namespace EDAViewer;
public class Program
{ {
public class Program public static int Main(string[] args)
{ {
LoggerConfiguration loggerConfiguration = new();
public static void Main(string[] args) Assembly assembly = Assembly.GetExecutingAssembly();
string? assemblyName = assembly.GetName()?.Name;
if (string.IsNullOrEmpty(assemblyName))
throw new Exception();
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(new WebApplicationOptions()
{ {
CreateHostBuilder(args).Build().Run(); Args = args,
} ContentRootPath = Path.GetDirectoryName(assembly.Location)
});
public static IHostBuilder CreateHostBuilder(string[] args) _ = webApplicationBuilder.Host.UseWindowsService();
{ _ = webApplicationBuilder.Configuration.AddUserSecrets<Program>();
IHostBuilder result; AppSettings appSettings = Models.Stateless.AppSettings.Get(webApplicationBuilder.Configuration);
IsEnvironment isEnvironment = new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached); if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
result = Host.CreateDefaultBuilder(args) throw new Exception("Working directory name must have a value!");
.UseWindowsService() string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, appSettings.WorkingDirectoryName);
.ConfigureWebHostDefaults(webBuilder => Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
{ _ = ConsoleLoggerConfigurationExtensions.Console(loggerConfiguration.WriteTo);
webBuilder.UseStartup<Startup>(); _ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, webApplicationBuilder.Configuration);
_ = SerilogHostBuilderExtensions.UseSerilog(webApplicationBuilder.Host);
Log.Logger = loggerConfiguration.CreateLogger();
Serilog.ILogger log = Log.ForContext<Program>();
try
{
IsEnvironment isEnvironment = new(webApplicationBuilder.Environment.IsDevelopment(), webApplicationBuilder.Environment.IsStaging(), webApplicationBuilder.Environment.IsProduction());
Singleton.Background background = new(isEnvironment, appSettings, workingDirectory);
if (isEnvironment.Development && string.IsNullOrEmpty(appSettings.URLs))
throw new Exception();
_ = webApplicationBuilder.Services.AddRazorPages();
_ = webApplicationBuilder.Services.AddSingleton<AppSettings, AppSettings>(_ => appSettings);
_ = webApplicationBuilder.Services.AddSingleton<IsEnvironment, IsEnvironment>(_ => isEnvironment);
_ = webApplicationBuilder.Services.AddSingleton<Singleton.Background, Singleton.Background>(_ => background);
_ = webApplicationBuilder.Services.AddHostedService(t => new TimedHostedService(isEnvironment, background));
if (WindowsServiceHelpers.IsWindowsService())
{
_ = webApplicationBuilder.Services.AddSingleton<IHostLifetime, WindowsServiceLifetime>();
_ = webApplicationBuilder.Logging.AddEventLog(settings =>
{
if (string.IsNullOrEmpty(settings.SourceName))
settings.SourceName = webApplicationBuilder.Environment.ApplicationName;
}); });
return result;
} }
WebApplication webApplication = webApplicationBuilder.Build();
if (appSettings.Company == nameof(webApplication.Lifetime.StopApplication))
{
Environment.ExitCode = -1;
webApplication.Lifetime.StopApplication();
}
_ = webApplication.UseExceptionHandler("/Error");
_ = webApplication.Lifetime.ApplicationStopped.Register(Log.CloseAndFlush);
_ = ApplicationBuilderSerilogClientExtensions.UseSerilogIngestion(webApplication);
_ = SerilogApplicationBuilderExtensions.UseSerilogRequestLogging(webApplication);
_ = webApplication.UseDeveloperExceptionPage();
_ = webApplication.UseStaticFiles();
_ = webApplication.UseRouting();
_ = webApplication.MapRazorPages();
log.Information("Starting Web Application");
webApplication.Run();
return 0;
}
catch (Exception ex)
{
log.Fatal(ex, "Host terminated unexpectedly");
return 1;
}
finally
{
Log.CloseAndFlush();
}
} }
} }

View File

@ -1,53 +0,0 @@
namespace Shared
{
public enum EquipmentType
{
FileEquipment,
SemiEquipment,
//
DEP08EGANAIXG5,
//
MET08ANLYSDIFAAST230_Semi,
MET08DDUPSFS6420,
MET08DDUPSP1TBI,
MET08RESIHGCV,
MET08RESIMAPCDE,
MET08THFTIRQS408M,
MET08THFTIRSTRATUS,
//
MET08AFMD3100,
MET08BVHGPROBE,
MET08CVHGPROBE802B150,
MET08CVHGPROBE802B150_Monthly,
MET08CVHGPROBE802B150_Weekly,
MET08DDINCAN8620,
MET08DDINCAN8620_Daily,
MET08EBEAMINTEGRITY26,
MET08HALLHL5580,
MET08HALLHL5580_Monthly,
MET08HALLHL5580_Weekly,
MET08MESMICROSCOPE,
MET08NDFRESIMAP151C,
MET08NDFRESIMAP151C_Verification,
MET08PLMAPRPM,
MET08PLMAPRPM_Daily,
MET08PLMAPRPM_Verification,
MET08PLMPPLATO,
MET08PRFUSB4000,
MET08PRFUSB4000_Daily,
MET08PRFUSB4000_Monthly,
MET08PRFUSB4000_Weekly,
MET08PRFUSB4000_Verification,
MET08PRFUSB4000_Villach,
MET08UVH44GS100M,
MET08VPDSUBCON,
MET08WGEOMX203641Q,
MET08WGEOMX203641Q_Verification,
MET08XRDXPERTPROMRDXL,
MET08XRDXPERTPROMRDXL_Monthly,
MET08XRDXPERTPROMRDXL_Weekly,
METBRXRAYJV7300L
}
}

View File

@ -1,171 +0,0 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Shared
{
public class IsEnvironment
{
public enum Name
{
LinuxDevelopment,
LinuxProduction,
LinuxStaging,
OSXDevelopment,
OSXProduction,
OSXStaging,
WindowsDevelopment,
WindowsProduction,
WindowsStaging
}
public bool DebuggerWasAttachedDuringConstructor { get; private set; }
public bool Development { get; private set; }
public bool Linux { get; private set; }
public bool OSX { get; private set; }
public bool Production { get; private set; }
public bool Staging { get; private set; }
public bool Windows { get; private set; }
public string Profile { get; private set; }
public string AppSettingsFileName { get; private set; }
public string ASPNetCoreEnvironment { get; private set; }
public IsEnvironment(string testCategory)
{
if (testCategory.EndsWith(".json"))
{
Production = testCategory == "appsettings.json";
Staging = testCategory.EndsWith(nameof(Staging));
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Development = testCategory.EndsWith(nameof(Development));
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
}
else
{
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
OSX = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(OSX));
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
Linux = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Linux));
Staging = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Staging));
Windows = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Windows));
Production = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Production));
Development = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Development));
}
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
}
public IsEnvironment(bool isDevelopment, bool isStaging, bool isProduction)
{
Staging = isStaging;
Production = isProduction;
Development = isDevelopment;
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
}
public IsEnvironment(int? processesCount, bool nullASPNetCoreEnvironmentIsDevelopment, bool nullASPNetCoreEnvironmentIsProduction)
{
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
if (nullASPNetCoreEnvironmentIsDevelopment && nullASPNetCoreEnvironmentIsProduction)
throw new Exception();
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsProduction)
Production = true;
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsDevelopment)
Development = true;
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && !nullASPNetCoreEnvironmentIsDevelopment && !nullASPNetCoreEnvironmentIsProduction)
throw new Exception();
else
{
Staging = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Staging));
Production = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Production));
Development = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Development));
}
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount);
}
private string GetProfile()
{
string result;
if (Windows && Production)
result = nameof(Production);
else if (Windows && Staging)
result = nameof(Staging);
else if (Windows && Development)
result = nameof(Development);
else if (Linux && Production)
result = nameof(Name.LinuxProduction);
else if (Linux && Staging)
result = nameof(Name.LinuxStaging);
else if (Linux && Development)
result = nameof(Name.LinuxDevelopment);
else if (OSX && Production)
result = nameof(Name.OSXProduction);
else if (OSX && Staging)
result = nameof(Name.OSXStaging);
else if (OSX && Development)
result = nameof(Name.OSXDevelopment);
else
throw new Exception();
return result;
}
private string GetAppSettingsFileName(int? processesCount)
{
string result;
if (Production)
{
if (processesCount is null)
result = "appsettings.json";
else
result = $"appsettings.{processesCount}.json";
}
else
{
string environment;
if (Staging)
environment = nameof(Staging);
else if (Development)
environment = nameof(Development);
else
throw new Exception();
if (processesCount is null)
result = $"appsettings.{environment}.json";
else
result = $"appsettings.{environment}.{processesCount}.json";
}
return result;
}
public static string GetEnvironmentName(IsEnvironment isEnvironment)
{
string result;
if (isEnvironment.Windows)
result = nameof(IsEnvironment.Windows);
else if (isEnvironment.Linux)
result = nameof(IsEnvironment.Linux);
else if (isEnvironment.OSX)
result = nameof(IsEnvironment.OSX);
else
throw new Exception();
return result;
}
}
}

View File

@ -1,96 +0,0 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
namespace Shared
{
public static class RijndaelEncryption
{
/// <summary>
/// Change the Inputkey GUID when you use this code in your own program.
/// Keep this inputkey very safe and prevent someone from decoding it some way!!
/// Generated 2021-08-10
/// </summary>
internal const string Inputkey = "970CCEF6-4307-4F6A-9AC8-377DADB889BD";
/// <summary>
/// Encrypt the given text and give the byte array back as a BASE64 string
/// </summary>
/// <param name="text">The text to encrypt</param>
/// <param name="salt">The pasword salt</param>
/// <returns>The encrypted text</returns>
public static string Encrypt(string text, string salt)
{
string result;
if (string.IsNullOrEmpty(text))
throw new ArgumentNullException("text");
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
MemoryStream msEncrypt = new MemoryStream();
using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
swEncrypt.Write(text);
result = Convert.ToBase64String(msEncrypt.ToArray());
return result;
}
/// <summary>
/// Checks if a string is base64 encoded
/// </summary>
/// <param name="base64String">The base64 encoded string</param>
/// <returns></returns>
public static bool IsBase64String(string base64String)
{
bool result;
base64String = base64String.Trim();
result = (base64String.Length % 4 == 0) && Regex.IsMatch(base64String, @"^[a-zA-Z0-9\+/]*={0,3}$", RegexOptions.None);
return result;
}
/// <summary>
/// Decrypts the given text
/// </summary>
/// <param name="cipherText">The encrypted BASE64 text</param>
/// <param name="salt">The pasword salt</param>
/// <returns>De gedecrypte text</returns>
public static string Decrypt(string cipherText, string salt)
{
if (string.IsNullOrEmpty(cipherText))
throw new ArgumentNullException("cipherText");
if (!IsBase64String(cipherText))
throw new Exception("The cipherText input parameter is not base64 encoded");
string text;
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
byte[] cipher = Convert.FromBase64String(cipherText);
using (MemoryStream msDecrypt = new MemoryStream(cipher))
{
using CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read);
using StreamReader srDecrypt = new StreamReader(csDecrypt);
text = srDecrypt.ReadToEnd();
}
return text;
}
/// <summary>
/// Create a new RijndaelManaged class and initialize it
/// </summary>
/// <param name="salt">The pasword salt</param>
/// <returns></returns>
private static RijndaelManaged NewRijndaelManaged(string salt)
{
if (salt == null)
throw new ArgumentNullException("salt");
byte[] saltBytes = Encoding.ASCII.GetBytes(salt);
Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(Inputkey, saltBytes);
RijndaelManaged aesAlg = new RijndaelManaged();
aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8);
aesAlg.IV = key.GetBytes(aesAlg.BlockSize / 8);
return aesAlg;
}
}
}

View File

@ -1,86 +1,73 @@
using EDAViewer.Models; using EDAViewer.Models;
using EDAViewer.Models.Methods;
using EDAViewer.Singleton.Helper; using EDAViewer.Singleton.Helper;
using Infineon.Monitoring.MonA; using IFX.Shared;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Shared;
using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
namespace EDAViewer.Singleton namespace EDAViewer.Singleton;
public class Background : Models.Properties.IBackground, IBackground, IDisposable
{ {
public partial class Background : IBackground protected readonly List<Exception> _Exceptions;
{ protected readonly List<Timer> _Timers;
protected readonly string _WorkingDirectory;
protected string _Message;
public List<Exception> Exceptions => _Exceptions;
public List<Timer> Timers => _Timers; public List<Timer> Timers => _Timers;
public string Message { get; private set; } public string Message => _Message;
public string WorkingDirectory { get; private set; } public string WorkingDirectory => _WorkingDirectory;
public List<Exception> Exceptions { get; private set; }
private bool _ShuttingDown; private bool _Stop;
private readonly object _Lock; private readonly object _Lock;
private readonly Calendar _Calendar; private readonly Calendar _Calendar;
private readonly List<Timer> _Timers; private readonly Serilog.ILogger _Log;
private readonly AppSettings _AppSettings;
private readonly string[] _SiEquipmentTypes;
private readonly string[] _GaNEquipmentTypes;
private readonly IsEnvironment _IsEnvironment;
private const string _Site = "sjc";
private Log _Log;
private DateTime _PrimaryInstanceSetAt; private DateTime _PrimaryInstanceSetAt;
private readonly AppSettings _AppSettings;
private readonly IsEnvironment _IsEnvironment;
private string _EdaDataCollectionPlansLastRun; private string _EdaDataCollectionPlansLastRun;
public Background(IsEnvironment isEnvironment, AppSettings appSettings, string workingDirectory) public Background(IsEnvironment isEnvironment, AppSettings appSettings, string workingDirectory)
{ {
_Log = null; _Stop = false;
Exceptions = new(); _Timers = new();
_IsEnvironment = isEnvironment;
_Lock = new object(); _Lock = new object();
_ShuttingDown = false; _Message = string.Empty;
if (_Lock is null)
{ }
Message = string.Empty;
_AppSettings = appSettings; _AppSettings = appSettings;
_Timers = new List<Timer>();
_IsEnvironment = isEnvironment; _IsEnvironment = isEnvironment;
WorkingDirectory = workingDirectory; _Exceptions = new List<Exception>();
_WorkingDirectory = workingDirectory;
_PrimaryInstanceSetAt = DateTime.MinValue; _PrimaryInstanceSetAt = DateTime.MinValue;
_Log = Serilog.Log.ForContext<Background>();
_Calendar = new CultureInfo("en-US").Calendar;
_EdaDataCollectionPlansLastRun = string.Empty; _EdaDataCollectionPlansLastRun = string.Empty;
_SiEquipmentTypes = GetEquipmentTypes(isGaN: false, isSi: true);
_GaNEquipmentTypes = GetEquipmentTypes(isGaN: true, isSi: false);
CultureInfo cultureInfo = new CultureInfo("en-US");
_Calendar = cultureInfo.Calendar;
} }
public void Dispose() void IBackground.Catch(Exception exception)
{ {
_Exceptions.Add(exception);
_Log.Error(exception, "Error:");
}
void IBackground.Stop(bool immediate)
{
if (!_Stop)
_Stop = true;
foreach (Timer timer in _Timers) foreach (Timer timer in _Timers)
timer.Dispose(); _ = timer.Change(Timeout.Infinite, 0);
} }
void IBackground.Update(ILogger<object> logger) void IBackground.Update(int milliSeconds)
{ {
Update(logger); _Log.Debug($"{milliSeconds} milliSecond(s) between timers");
} // https://blog.magnusmontin.net/2018/11/05/platform-conditional-compilation-in-net-core/
internal void Update(ILogger<object> logger)
{
_Log = new Log(logger);
//https://blog.magnusmontin.net/2018/11/05/platform-conditional-compilation-in-net-core/
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
_Log.Debug("Running on Linux!"); _Log.Debug("Running on Linux!");
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
@ -94,89 +81,57 @@ namespace EDAViewer.Singleton
#elif Windows #elif Windows
_Log.Debug("Built in Windows!"); _Log.Debug("Built in Windows!");
#else #else
()("Built in unkown!"); ()("Built in Unknown!");
#endif #endif
if (string.IsNullOrEmpty(_AppSettings.URLs) && !_IsEnvironment.Development) if (string.IsNullOrEmpty(_AppSettings.URLs) && !_IsEnvironment.Development)
throw new Exception("Invalid Application Settings URLs!"); throw new Exception("Invalid Application Settings URLs!");
if (_IsEnvironment.Development)
{
}
else if (_IsEnvironment.Staging)
{
}
else if (_IsEnvironment.Production)
{
}
else
throw new Exception();
} }
internal void Catch(Exception exception) void IBackground.ClearMessage() => _Message = string.Empty;
void IBackground.SetIsPrimaryInstance() => _PrimaryInstanceSetAt = DateTime.Now;
void IBackground.ClearIsPrimaryInstance() => _PrimaryInstanceSetAt = DateTime.MinValue;
void IDisposable.Dispose()
{ {
Exceptions.Add(exception); foreach (Timer timer in _Timers)
_Log.Error(exception); timer.Dispose();
if (!string.IsNullOrEmpty(_AppSettings.MonARessource)) GC.SuppressFinalize(this);
{
MonIn monIn = MonIn.GetInstance();
monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Warning);
}
} }
public void SendStatusOk() void IBackground.Dispose()
{ {
if (!string.IsNullOrEmpty(_AppSettings.MonARessource)) IDisposable disposable = this;
{ disposable.Dispose();
MonIn monIn = MonIn.GetInstance();
monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Ok);
}
} }
public string GetCountDirectory(string verb) void IBackground.EDAOutputArchiveCallback()
{ {
DateTime dateTime = DateTime.Now; DateTime dateTime = DateTime.Now;
CultureInfo cultureInfo = new("en-US"); if (dateTime.Hour is > 8 and < 17)
Calendar calendar = cultureInfo.Calendar;
string weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
//string nameSpace = System.Reflection.Assembly.GetExecutingAssembly().EntryPoint.DeclaringType.Namespace;
string nameSpace = GetType().Namespace.Split('.')[0];
if (!string.IsNullOrEmpty(_AppSettings.MonARessource))
{ {
MonIn monIn = MonIn.GetInstance(); string sourceDirectory = string.Concat(@"\\", _AppSettings.Server, @"\ec_eda\Staging\Traces");
monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Up); if (!Directory.Exists(sourceDirectory))
} _Log.Debug(string.Concat("// Source directory <", sourceDirectory, "> doesn't exist."));
return string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA\Counts\", dateTime.ToString("yyyy"), @"\", "Week_", weekOfYear, @"\", dateTime.ToString("yyyy - MM - dd"), @"\", "Application", @"\", nameSpace, @"\", verb, @"\", dateTime.Ticks); else
EDAOutputArchive(sourceDirectory);
} }
public void Stop(bool immediate)
{
_ShuttingDown = true;
foreach (Timer timer in _Timers)
timer.Change(Timeout.Infinite, 0);
if (!_IsEnvironment.Development)
{
if (!string.IsNullOrEmpty(_AppSettings.MonARessource))
{
MonIn monIn = MonIn.GetInstance();
monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Down);
}
string countDirectory = GetCountDirectory("Stop");
Directory.CreateDirectory(countDirectory);
}
} }
public void ClearMessage() void IBackground.EdaDataCollectionPlansCallback()
{
Message = string.Empty;
}
public void SetIsPrimaryInstance()
{
_PrimaryInstanceSetAt = DateTime.Now;
}
public void ClearIsPrimaryInstance()
{
_PrimaryInstanceSetAt = DateTime.MinValue;
}
public bool IsPrimaryInstance()
{
bool result;
DateTime dateTime = DateTime.Now.AddDays(-1);
result = _PrimaryInstanceSetAt > dateTime;
return result;
}
public void EdaDataCollectionPlansCallback()
{ {
string cSharpFormat = "yyyy-MM-dd_hh:mm:ss tt"; string cSharpFormat = "yyyy-MM-dd_hh:mm:ss tt";
string oracleFormat = "yyyy-MM-dd_hh:mi:ss AM"; string oracleFormat = "yyyy-MM-dd_hh:mi:ss AM";
@ -184,7 +139,49 @@ namespace EDAViewer.Singleton
DataCollectionPlans(_AppSettings, _EdaDataCollectionPlansLastRun, cSharpFormat, oracleFormat); DataCollectionPlans(_AppSettings, _EdaDataCollectionPlansLastRun, cSharpFormat, oracleFormat);
_EdaDataCollectionPlansLastRun = DateTime.Now.ToString(cSharpFormat); _EdaDataCollectionPlansLastRun = DateTime.Now.ToString(cSharpFormat);
_Log.Debug(string.Concat("B) _EdaDataCollectionPlansLastRun = ", _EdaDataCollectionPlansLastRun)); _Log.Debug(string.Concat("B) _EdaDataCollectionPlansLastRun = ", _EdaDataCollectionPlansLastRun));
} }
string IBackground.GetCountDirectory(string verb)
{
DateTime dateTime = DateTime.Now;
string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
//string nameSpace = System.Reflection.Assembly.GetExecutingAssembly().EntryPoint.DeclaringType.Namespace;
string nameSpace = $"{GetType().Namespace}".Split('.')[0];
// if (!_IsEnvironment.DebuggerWasAttachedDuringConstructor && !string.IsNullOrEmpty(_AppSettings.MonARessource))
// {
// MonIn monIn = MonIn.GetInstance();
// monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Up);
// }
return string.Concat(@"\\", _AppSettings.Server, @"\EC_EAF\Counts\", dateTime.ToString("yyyy"), @"\", "Week_", weekOfYear, @"\", dateTime.ToString("yyyy - MM - dd"), @"\", "Application", @"\", nameSpace, @"\", verb, @"\", dateTime.Ticks);
}
void IBackground.LogPathCleanUpByWeekCallback()
{
DateTime dateTime = DateTime.Now;
if (dateTime.Hour is > 8 and < 17)
{
_Log.Debug(string.Concat("A) ", nameof(LogPathCleanUpByWeek)));
LogPathCleanUpByWeek(_AppSettings.Server, isEDA: true);
_Log.Debug(string.Concat("B) ", nameof(LogPathCleanUpByWeek)));
}
}
bool IBackground.IsPrimaryInstance()
{
bool result;
DateTime dateTime = DateTime.Now.AddDays(-1);
result = _PrimaryInstanceSetAt > dateTime;
return result;
}
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
private void DeleteEmptyDirectories(string directory) private void DeleteEmptyDirectories(string directory)
{ {
string[] files = Directory.GetFiles(directory, "*", SearchOption.AllDirectories); string[] files = Directory.GetFiles(directory, "*", SearchOption.AllDirectories);
@ -195,34 +192,34 @@ namespace EDAViewer.Singleton
{ {
foreach (string subDirectory in Directory.GetDirectories(directory, "*", SearchOption.TopDirectoryOnly)) foreach (string subDirectory in Directory.GetDirectories(directory, "*", SearchOption.TopDirectoryOnly))
{ {
if (_ShuttingDown) if (_Stop)
break; break;
DeleteEmptyDirectories(subDirectory); DeleteEmptyDirectories(subDirectory);
} }
} }
} }
private void ZipFilesByDate(string sourceDirectory, SearchOption searchOption = SearchOption.TopDirectoryOnly, string dayFormat = null) private void ZipFilesByDate(string sourceDirectory, SearchOption searchOption = SearchOption.TopDirectoryOnly, string? dayFormat = null)
{ {
string key; string key;
bool addFile; bool addFile;
string fileName; string fileName;
FileInfo fileInfo;
string weekOfYear;
string[] segments; string[] segments;
string[] subFiles; string[] subFiles;
string weekOfYear;
FileInfo fileInfo;
DateTime creationTime; DateTime creationTime;
DateTime lastWriteTime; DateTime lastWriteTime;
Regex regex = new Regex("[a-zA-Z0-9]{1,}"); Regex regex = new("[a-zA-Z0-9]{1,}");
DateTime dateTime = DateTime.Now.AddDays(-6); DateTime firstEmail = new(2019, 3, 8);
DateTime firstEmail = new DateTime(2019, 3, 8); CultureInfo cultureInfo = new("en-US");
CultureInfo cultureInfo = new CultureInfo("en-US");
Calendar calendar = cultureInfo.Calendar; Calendar calendar = cultureInfo.Calendar;
Dictionary<string, DateTime> weeks = new();
DateTime dateTime = DateTime.Now.AddDays(-6);
int ticksLength = dateTime.Ticks.ToString().Length; int ticksLength = dateTime.Ticks.ToString().Length;
Dictionary<string, DateTime> weeks = new Dictionary<string, DateTime>();
for (int i = 0; i < 1000; i++) for (int i = 0; i < 1000; i++)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
dateTime = firstEmail.AddDays(i); dateTime = firstEmail.AddDays(i);
weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
@ -230,21 +227,21 @@ namespace EDAViewer.Singleton
if (!weeks.ContainsKey(key)) if (!weeks.ContainsKey(key))
weeks.Add(key, dateTime); weeks.Add(key, dateTime);
} }
Dictionary<string, List<string>> keyValuePairs = new();
weekOfYear = calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); weekOfYear = calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string skipKey = string.Concat(DateTime.Now.ToString("yyyy"), "_Week_", weekOfYear); string skipKey = string.Concat(DateTime.Now.ToString("yyyy"), "_Week_", weekOfYear);
Dictionary<string, List<string>> keyValuePairs = new Dictionary<string, List<string>>();
string[] topDirectories = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly); string[] topDirectories = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
if (topDirectories.Length == 0) if (topDirectories.Length == 0)
topDirectories = new string[] { sourceDirectory }; topDirectories = new string[] { sourceDirectory };
foreach (string topDirectory in topDirectories) foreach (string topDirectory in topDirectories)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
keyValuePairs.Clear(); keyValuePairs.Clear();
subFiles = Directory.GetFiles(topDirectory, "*", searchOption); subFiles = Directory.GetFiles(topDirectory, "*", searchOption);
foreach (string subFile in subFiles) foreach (string subFile in subFiles)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
addFile = false; addFile = false;
if (subFile.EndsWith(".zip")) if (subFile.EndsWith(".zip"))
@ -269,7 +266,7 @@ namespace EDAViewer.Singleton
MatchCollection matches = regex.Matches(fileName); MatchCollection matches = regex.Matches(fileName);
foreach (Match match in matches) foreach (Match match in matches)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
if (match.Value.Length != ticksLength) if (match.Value.Length != ticksLength)
continue; continue;
@ -297,38 +294,36 @@ namespace EDAViewer.Singleton
} }
foreach (KeyValuePair<string, List<string>> element in keyValuePairs) foreach (KeyValuePair<string, List<string>> element in keyValuePairs)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
key = string.Concat(topDirectory, @"\", element.Key, ".zip"); key = string.Concat(topDirectory, @"\", element.Key, ".zip");
if (File.Exists(key)) if (File.Exists(key))
{ {
for (short i = 101; i < short.MaxValue; i++) for (short i = 101; i < short.MaxValue; i++)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
key = string.Concat(topDirectory, @"\", element.Key, "_", i, ".zip"); key = string.Concat(topDirectory, @"\", element.Key, "_", i, ".zip");
if (!File.Exists(key)) if (!File.Exists(key))
break; break;
} }
} }
if (_ShuttingDown) if (_Stop)
break; break;
lock (_Lock) lock (_Lock)
{ {
using (ZipArchive zip = ZipFile.Open(key, ZipArchiveMode.Create)) using ZipArchive zip = ZipFile.Open(key, ZipArchiveMode.Create);
{
foreach (string file in element.Value) foreach (string file in element.Value)
{ {
zip.CreateEntryFromFile(file, Path.GetFileName(file)); _ = zip.CreateEntryFromFile(file, Path.GetFileName(file));
File.Delete(file); File.Delete(file);
} }
} }
} }
}
subFiles = Directory.GetFiles(topDirectory, "*.zip", SearchOption.TopDirectoryOnly); subFiles = Directory.GetFiles(topDirectory, "*.zip", SearchOption.TopDirectoryOnly);
foreach (string subFile in subFiles) foreach (string subFile in subFiles)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
fileName = Path.GetFileNameWithoutExtension(subFile); fileName = Path.GetFileNameWithoutExtension(subFile);
segments = fileName.Split('_'); segments = fileName.Split('_');
@ -349,7 +344,7 @@ namespace EDAViewer.Singleton
} }
} }
public void LogPathCleanUpByWeek(string server, bool isEDA = false, bool isNA = false) private void LogPathCleanUpByWeek(string server, bool isEDA = false, bool isNA = false)
{ {
if (isEDA && isNA) if (isEDA && isNA)
throw new Exception(); throw new Exception();
@ -387,7 +382,7 @@ namespace EDAViewer.Singleton
long twoDays = DateTime.Now.AddDays(-2).Ticks; long twoDays = DateTime.Now.AddDays(-2).Ticks;
foreach (Tuple<string, string> tuple in tuples) foreach (Tuple<string, string> tuple in tuples)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
sourceDirectory = string.Concat(share, tuple.Item1); sourceDirectory = string.Concat(share, tuple.Item1);
if (!Directory.Exists(sourceDirectory)) if (!Directory.Exists(sourceDirectory))
@ -402,12 +397,12 @@ namespace EDAViewer.Singleton
topDirectories = new string[] { sourceDirectory }; topDirectories = new string[] { sourceDirectory };
foreach (string topDirectory in topDirectories) foreach (string topDirectory in topDirectories)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
files = Directory.GetFiles(topDirectory, "*", SearchOption.TopDirectoryOnly); files = Directory.GetFiles(topDirectory, "*", SearchOption.TopDirectoryOnly);
foreach (string file in files) foreach (string file in files)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
if (file.EndsWith(".zip")) if (file.EndsWith(".zip"))
continue; continue;
@ -418,10 +413,10 @@ namespace EDAViewer.Singleton
weekOfYear = _Calendar.GetWeekOfYear(lastWriteTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); weekOfYear = _Calendar.GetWeekOfYear(lastWriteTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
newDirectroy = string.Concat(topDirectory, @"\", lastWriteTime.ToString("yyyy"), "___Week_", weekOfYear, @"\", lastWriteTime.ToString("yyyy_MM_dd")); newDirectroy = string.Concat(topDirectory, @"\", lastWriteTime.ToString("yyyy"), "___Week_", weekOfYear, @"\", lastWriteTime.ToString("yyyy_MM_dd"));
if (!Directory.Exists(newDirectroy)) if (!Directory.Exists(newDirectroy))
Directory.CreateDirectory(newDirectroy); _ = Directory.CreateDirectory(newDirectroy);
if (!fileInfo.Exists) if (!fileInfo.Exists)
continue; continue;
if (!_ShuttingDown) if (!_Stop)
{ {
lock (_Lock) lock (_Lock)
File.Move(file, string.Concat(newDirectroy, @"\", Path.GetFileName(file))); File.Move(file, string.Concat(newDirectroy, @"\", Path.GetFileName(file)));
@ -431,7 +426,7 @@ namespace EDAViewer.Singleton
} }
foreach (Tuple<string, string> tuple in tuples) foreach (Tuple<string, string> tuple in tuples)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
sourceDirectory = string.Concat(share, tuple.Item1); sourceDirectory = string.Concat(share, tuple.Item1);
if (!Directory.Exists(sourceDirectory)) if (!Directory.Exists(sourceDirectory))
@ -440,18 +435,7 @@ namespace EDAViewer.Singleton
} }
} }
public void LogPathCleanUpByWeekCallback() void EDAOutputArchive(string sourceDirectory)
{
DateTime dateTime = DateTime.Now;
if (dateTime.Hour > 8 && dateTime.Hour < 17)
{
_Log.Debug(string.Concat("A) ", nameof(LogPathCleanUpByWeek)));
LogPathCleanUpByWeek(_AppSettings.Server, isEDA: true);
_Log.Debug(string.Concat("B) ", nameof(LogPathCleanUpByWeek)));
}
}
public void EDAOutputArchive(string sourceDirectory)
{ {
string key; string key;
string[] files; string[] files;
@ -463,34 +447,34 @@ namespace EDAViewer.Singleton
string emptyFilesDirectory; string emptyFilesDirectory;
int today = DateTime.Now.Day; int today = DateTime.Now.Day;
string recipeArchiveDirectory; string recipeArchiveDirectory;
Dictionary<string, List<string>> keyValuePairs = new Dictionary<string, List<string>>(); Dictionary<string, List<string>> keyValuePairs = new();
string[] equipmentTypes = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly); string[] equipmentTypes = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
foreach (string equipmentType in equipmentTypes) foreach (string equipmentType in equipmentTypes)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
if (equipmentType.EndsWith(@"\_ Copy") || equipmentType.EndsWith(@"\_ Empty") || equipmentType.EndsWith(@"\CellInstance") || equipmentType.EndsWith(@"\IQS") || equipmentType.EndsWith(@"\Villach")) if (equipmentType.EndsWith(@"\_ Copy") || equipmentType.EndsWith(@"\_ Empty") || equipmentType.EndsWith(@"\CellInstance") || equipmentType.EndsWith(@"\IQS") || equipmentType.EndsWith(@"\Villach"))
continue; continue;
checkDirectory = string.Concat(equipmentType, @"\Ignore\Recipe"); checkDirectory = string.Concat(equipmentType, @"\Ignore\Recipe");
if (!Directory.Exists(checkDirectory)) if (!Directory.Exists(checkDirectory))
Directory.CreateDirectory(checkDirectory); _ = Directory.CreateDirectory(checkDirectory);
cellIntaces = Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly); cellIntaces = Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly);
foreach (string cellIntace in cellIntaces) foreach (string cellIntace in cellIntaces)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
keyValuePairs.Clear(); keyValuePairs.Clear();
cellInstancesName = Path.GetFileName(cellIntace); cellInstancesName = Path.GetFileName(cellIntace);
recipeArchiveDirectory = string.Concat(equipmentType, @"\Ignore\!Archive\Recipe\", cellInstancesName); recipeArchiveDirectory = string.Concat(equipmentType, @"\Ignore\!Archive\Recipe\", cellInstancesName);
if (!Directory.Exists(recipeArchiveDirectory)) if (!Directory.Exists(recipeArchiveDirectory))
Directory.CreateDirectory(recipeArchiveDirectory); _ = Directory.CreateDirectory(recipeArchiveDirectory);
emptyFilesDirectory = string.Concat(equipmentType, @"\Ignore\!Archive\EmptyFiles\", cellInstancesName); emptyFilesDirectory = string.Concat(equipmentType, @"\Ignore\!Archive\EmptyFiles\", cellInstancesName);
if (!Directory.Exists(emptyFilesDirectory)) if (!Directory.Exists(emptyFilesDirectory))
Directory.CreateDirectory(emptyFilesDirectory); _ = Directory.CreateDirectory(emptyFilesDirectory);
files = Directory.GetFiles(cellIntace, "*", SearchOption.TopDirectoryOnly); files = Directory.GetFiles(cellIntace, "*", SearchOption.TopDirectoryOnly);
foreach (string file in files) foreach (string file in files)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
fileDateTime = new FileInfo(file).LastWriteTime; fileDateTime = new FileInfo(file).LastWriteTime;
if (fileDateTime.Day != today) if (fileDateTime.Day != today)
@ -504,13 +488,13 @@ namespace EDAViewer.Singleton
} }
foreach (KeyValuePair<string, List<string>> element in keyValuePairs) foreach (KeyValuePair<string, List<string>> element in keyValuePairs)
{ {
if (_ShuttingDown) if (_Stop)
break; break;
lock (_Lock) lock (_Lock)
{ {
key = string.Concat(recipeArchiveDirectory, @"\", element.Key.Split('-')[0]); key = string.Concat(recipeArchiveDirectory, @"\", element.Key.Split('-')[0]);
if (!Directory.Exists(key)) if (!Directory.Exists(key))
Directory.CreateDirectory(key); _ = Directory.CreateDirectory(key);
key = string.Concat(recipeArchiveDirectory, @"\", element.Key.Split('-')[0], @"\", element.Key, ".zip"); key = string.Concat(recipeArchiveDirectory, @"\", element.Key.Split('-')[0], @"\", element.Key, ".zip");
if (File.Exists(key)) if (File.Exists(key))
{ {
@ -524,14 +508,14 @@ namespace EDAViewer.Singleton
} }
if (!string.IsNullOrEmpty(key)) if (!string.IsNullOrEmpty(key))
{ {
if (_ShuttingDown) if (_Stop)
break; break;
lock (_Lock) lock (_Lock)
{ {
using ZipArchive zip = ZipFile.Open(key, ZipArchiveMode.Create); using ZipArchive zip = ZipFile.Open(key, ZipArchiveMode.Create);
foreach (string file in element.Value) foreach (string file in element.Value)
{ {
zip.CreateEntryFromFile(file, Path.GetFileName(file)); _ = zip.CreateEntryFromFile(file, Path.GetFileName(file));
File.Delete(file); File.Delete(file);
} }
} }
@ -541,97 +525,24 @@ namespace EDAViewer.Singleton
} }
} }
public void EDAOutputArchiveCallback()
{
DateTime dateTime = DateTime.Now;
if (dateTime.Hour > 8 && dateTime.Hour < 17)
{
string sourceDirectory = string.Concat(@"\\", _AppSettings.Server, @"\ec_eda\Staging\Traces");
if (!Directory.Exists(sourceDirectory))
_Log.Debug(string.Concat("// Source directory <", sourceDirectory, "> doesn't exist."));
else
EDAOutputArchive(sourceDirectory);
}
}
public static string[] GetEquipmentTypes(bool isGaN = false, bool isSi = false)
{
string[] results;
if (isGaN && isSi)
throw new Exception();
else if (!isGaN && !isSi)
isGaN = true;
if (isSi)
{
results = new string[]
{
Shared.EquipmentType.MET08ANLYSDIFAAST230_Semi.ToString(),
Shared.EquipmentType.MET08DDUPSFS6420.ToString(),
Shared.EquipmentType.MET08DDUPSP1TBI.ToString(),
Shared.EquipmentType.MET08RESIHGCV.ToString(),
Shared.EquipmentType.MET08RESIMAPCDE.ToString(),
Shared.EquipmentType.MET08THFTIRQS408M.ToString(),
Shared.EquipmentType.MET08THFTIRSTRATUS.ToString()
};
}
else if (isGaN)
{
results = new string[]
{
Shared.EquipmentType.DEP08EGANAIXG5.ToString(),
Shared.EquipmentType.MET08AFMD3100.ToString(),
Shared.EquipmentType.MET08BVHGPROBE.ToString(),
Shared.EquipmentType.MET08CVHGPROBE802B150.ToString(),
Shared.EquipmentType.MET08CVHGPROBE802B150_Monthly.ToString(),
Shared.EquipmentType.MET08CVHGPROBE802B150_Weekly.ToString(),
Shared.EquipmentType.MET08DDINCAN8620.ToString(),
Shared.EquipmentType.MET08DDINCAN8620_Daily.ToString(),
Shared.EquipmentType.MET08EBEAMINTEGRITY26.ToString(),
Shared.EquipmentType.MET08HALLHL5580.ToString(),
Shared.EquipmentType.MET08HALLHL5580_Monthly.ToString(),
Shared.EquipmentType.MET08HALLHL5580_Weekly.ToString(),
Shared.EquipmentType.MET08MESMICROSCOPE.ToString(),
Shared.EquipmentType.MET08NDFRESIMAP151C.ToString(),
Shared.EquipmentType.MET08NDFRESIMAP151C_Verification.ToString(),
Shared.EquipmentType.MET08PLMAPRPM.ToString(),
Shared.EquipmentType.MET08PLMAPRPM_Daily.ToString(),
Shared.EquipmentType.MET08PLMAPRPM_Verification.ToString(),
Shared.EquipmentType.MET08PLMPPLATO.ToString(),
Shared.EquipmentType.MET08PRFUSB4000.ToString(),
Shared.EquipmentType.MET08UVH44GS100M.ToString(),
Shared.EquipmentType.MET08VPDSUBCON.ToString(),
Shared.EquipmentType.MET08WGEOMX203641Q.ToString(),
Shared.EquipmentType.MET08WGEOMX203641Q_Verification.ToString(),
Shared.EquipmentType.METBRXRAYJV7300L.ToString(),
Shared.EquipmentType.MET08XRDXPERTPROMRDXL.ToString(),
Shared.EquipmentType.MET08XRDXPERTPROMRDXL_Monthly.ToString(),
Shared.EquipmentType.MET08XRDXPERTPROMRDXL_Weekly.ToString()
};
}
else
throw new Exception();
return results;
}
private Stream ToStream(string @this) private Stream ToStream(string @this)
{ {
var stream = new MemoryStream(); MemoryStream? stream = new();
var writer = new StreamWriter(stream); StreamWriter? writer = new(stream);
writer.Write(@this); writer.Write(@this);
writer.Flush(); writer.Flush();
stream.Position = 0; stream.Position = 0;
return stream; return stream;
} }
private T ParseXML<T>(string @this, bool throwExceptions) where T : class private T? ParseXML<T>(string @this, bool throwExceptions) where T : class
{ {
object result = null; object? result = null;
try try
{ {
Stream stream = ToStream(@this.Trim()); Stream stream = ToStream(@this.Trim());
var reader = XmlReader.Create(stream, new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document }); XmlReader? reader = XmlReader.Create(stream, new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document });
//XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); XmlSerializer xmlSerializer = new(typeof(T), typeof(T).GetNestedTypes());
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T), typeof(T).GetNestedTypes());
result = xmlSerializer.Deserialize(reader); result = xmlSerializer.Deserialize(reader);
stream.Dispose(); stream.Dispose();
} }
@ -643,12 +554,12 @@ namespace EDAViewer.Singleton
return result as T; return result as T;
} }
public void DataCollectionPlans(AppSettings appSettings, string edaDataCollectionPlansLastRun, string cSharpFormat, string oracleFormat) private void DataCollectionPlans(AppSettings appSettings, string edaDataCollectionPlansLastRun, string cSharpFormat, string oracleFormat)
{ {
object _Lock = new();
bool _ShuttingDown = false; bool _ShuttingDown = false;
object _Lock = new object();
bool dev = appSettings.Server.Contains("_ec_"); bool dev = appSettings.Server.Contains("_ec_");
Dictionary<string, Dictionary<ModuleInstanceTypeName, List<List<object>>>> rows = new Dictionary<string, Dictionary<ModuleInstanceTypeName, List<List<object>>>>(); Dictionary<string, Dictionary<ModuleInstanceTypeName, List<List<object>>>> rows = new();
// //
//int moduleinstancetypename = 0; //int moduleinstancetypename = 0;
int unitname = 1; int unitname = 1;
@ -665,19 +576,19 @@ namespace EDAViewer.Singleton
// () // ()
{ {
object @object; object @object;
string @string; string? @string;
int fieldCount; int fieldCount;
List<object> row; List<object> row;
string decrypted; string decrypted;
string connectionName; string connectionName;
string connectionString; string connectionString;
StringBuilder sql = new StringBuilder(); StringBuilder sql = new();
Array objectTypes = Enum.GetValues(typeof(ModuleInstanceTypeName)); Array objectTypes = Enum.GetValues(typeof(ModuleInstanceTypeName));
List<Tuple<string, string>> connections = new List<Tuple<string, string>>(); List<Tuple<string, string>> connections = new();
if (dev) if (dev)
{ {
connectionName = @"DEV"; connectionName = @"DEV";
connectionString = EDAViewer.Singleton.Helper.Background.EDADatabase.GetEdaDevelopment(); connectionString = Helper.Background.EDADatabase.GetEdaDevelopment();
decrypted = RijndaelEncryption.Decrypt(appSettings.IFXEDADatabasePassword, appSettings.Company); decrypted = RijndaelEncryption.Decrypt(appSettings.IFXEDADatabasePassword, appSettings.Company);
connectionString = string.Concat(connectionString, decrypted, ";"); connectionString = string.Concat(connectionString, decrypted, ";");
connections.Add(new Tuple<string, string>(connectionName, connectionString)); connections.Add(new Tuple<string, string>(connectionName, connectionString));
@ -685,12 +596,12 @@ namespace EDAViewer.Singleton
else else
{ {
connectionName = "Staging"; connectionName = "Staging";
connectionString = EDAViewer.Singleton.Helper.Background.EDADatabase.GetEdaStaging(); connectionString = Helper.Background.EDADatabase.GetEdaStaging();
decrypted = RijndaelEncryption.Decrypt(appSettings.ECEDADatabasePassword, appSettings.Company); decrypted = RijndaelEncryption.Decrypt(appSettings.ECEDADatabasePassword, appSettings.Company);
connectionString = string.Concat(connectionString, decrypted, ";"); connectionString = string.Concat(connectionString, decrypted, ";");
connections.Add(new Tuple<string, string>(connectionName, connectionString)); connections.Add(new Tuple<string, string>(connectionName, connectionString));
connectionName = "Production"; connectionName = "Production";
connectionString = EDAViewer.Singleton.Helper.Background.EDADatabase.GetEdaProduction(); connectionString = Helper.Background.EDADatabase.GetEdaProduction();
connectionString = string.Concat(connectionString, decrypted, ";"); connectionString = string.Concat(connectionString, decrypted, ";");
connections.Add(new Tuple<string, string>(connectionName, connectionString)); connections.Add(new Tuple<string, string>(connectionName, connectionString));
} }
@ -707,17 +618,17 @@ namespace EDAViewer.Singleton
{ {
objectTypeDirectory = string.Concat(workingDirectory, @"\", connection.Item1, @"\", objectType); objectTypeDirectory = string.Concat(workingDirectory, @"\", connection.Item1, @"\", objectType);
if (!Directory.Exists(objectTypeDirectory)) if (!Directory.Exists(objectTypeDirectory))
Directory.CreateDirectory(objectTypeDirectory); _ = Directory.CreateDirectory(objectTypeDirectory);
else else
edaDataCollectionPlansLastRun = new DirectoryInfo(objectTypeDirectory).LastWriteTime.ToString(cSharpFormat); edaDataCollectionPlansLastRun = new DirectoryInfo(objectTypeDirectory).LastWriteTime.ToString(cSharpFormat);
} }
if (!rows[connection.Item1].ContainsKey(objectType)) if (!rows[connection.Item1].ContainsKey(objectType))
rows[connection.Item1].Add(objectType, new List<List<object>>()); rows[connection.Item1].Add(objectType, new List<List<object>>());
using (Oracle.ManagedDataAccess.Client.OracleConnection oracleConnection = new Oracle.ManagedDataAccess.Client.OracleConnection(connection.Item2)) using (Oracle.ManagedDataAccess.Client.OracleConnection oracleConnection = new(connection.Item2))
{ {
sql.Clear(); _ = sql.Clear();
oracleConnection.Open(); oracleConnection.Open();
sql.Append(" select v.moduleinstancetypename, v.unitname, "). _ = sql.Append(" select v.moduleinstancetypename, v.unitname, ").
Append(" v.modulename, v.containername, v.configurationstate, "). Append(" v.modulename, v.containername, v.configurationstate, ").
Append(" v.configurationproductivestate, v.containermodifiername, "). Append(" v.configurationproductivestate, v.containermodifiername, ").
Append(" v.containermodifieddate, v.containerconfiguration, v.configurationmodifieddate "). Append(" v.containermodifieddate, v.containerconfiguration, v.configurationmodifieddate ").
@ -725,12 +636,10 @@ namespace EDAViewer.Singleton
Append(" where v.moduleinstancetypename = '").Append(objectType.ToString()).Append("' "); Append(" where v.moduleinstancetypename = '").Append(objectType.ToString()).Append("' ");
//Append(" and v.containerversion in ('4.80', '4.111') "); //Append(" and v.containerversion in ('4.80', '4.111') ");
if (!string.IsNullOrEmpty(edaDataCollectionPlansLastRun)) if (!string.IsNullOrEmpty(edaDataCollectionPlansLastRun))
sql.Append(" and greatest(v.containermodifieddate, v.configurationmodifieddate) >= to_date('").Append(edaDataCollectionPlansLastRun).Append("', '").Append(oracleFormat).Append("') "); _ = sql.Append(" and greatest(v.containermodifieddate, v.configurationmodifieddate) >= to_date('").Append(edaDataCollectionPlansLastRun).Append("', '").Append(oracleFormat).Append("') ");
//Print(sql.ToString()); //Print(sql.ToString());
using (Oracle.ManagedDataAccess.Client.OracleCommand oracleCommand = new Oracle.ManagedDataAccess.Client.OracleCommand(sql.ToString(), oracleConnection)) using Oracle.ManagedDataAccess.Client.OracleCommand oracleCommand = new(sql.ToString(), oracleConnection);
{ using Oracle.ManagedDataAccess.Client.OracleDataReader oracleDataReader = oracleCommand.ExecuteReader();
using (Oracle.ManagedDataAccess.Client.OracleDataReader oracleDataReader = oracleCommand.ExecuteReader())
{
fieldCount = oracleDataReader.FieldCount; fieldCount = oracleDataReader.FieldCount;
while (oracleDataReader.Read()) while (oracleDataReader.Read())
{ {
@ -741,14 +650,14 @@ namespace EDAViewer.Singleton
{ {
@object = oracleDataReader.GetValue(c); @object = oracleDataReader.GetValue(c);
row.Add(@object); row.Add(@object);
if (@object is null)
continue;
@string = @object.ToString(); @string = @object.ToString();
//if (@string.Length < 128) //if (@string.Length < 128)
// _Log.Debug(@string); // _Log.Debug(@string);
} }
rows[connection.Item1][objectType].Add(row); rows[connection.Item1][objectType].Add(row);
} }
}
}
}; };
} }
} }
@ -756,13 +665,14 @@ namespace EDAViewer.Singleton
if (rows.Any()) if (rows.Any())
{ {
string csv; string csv;
string xml; string? xml;
string json; string json;
string text; string text;
string html; string html;
Common common; Common common;
string emptyAPC; string emptyAPC;
string fileName; string fileName;
string? modifiedDate;
string edaObjectFile; string edaObjectFile;
string goldDirectory; string goldDirectory;
string unitDirectory; string unitDirectory;
@ -770,9 +680,9 @@ namespace EDAViewer.Singleton
string edaObjectDirectory; string edaObjectDirectory;
DateTime lastModifiedDate; DateTime lastModifiedDate;
DateTime containerModifiedDate; DateTime containerModifiedDate;
PDSFConfiguration configuration; PDSFConfiguration? configuration;
DateTime configurationModifiedDate; DateTime configurationModifiedDate;
JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true }; JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
foreach (KeyValuePair<string, Dictionary<ModuleInstanceTypeName, List<List<object>>>> databaseElement in rows) foreach (KeyValuePair<string, Dictionary<ModuleInstanceTypeName, List<List<object>>>> databaseElement in rows)
{ {
if (_ShuttingDown) if (_ShuttingDown)
@ -792,20 +702,28 @@ namespace EDAViewer.Singleton
//if (!rowItem[containername].ToString().Contains("Plan_Pdsf_Health_Cp2Mg")) //if (!rowItem[containername].ToString().Contains("Plan_Pdsf_Health_Cp2Mg"))
//if (!rowItem[unitname].ToString().Contains("XRD04") || !rowItem[containername].ToString().Contains("Plan_Pdsf")) //if (!rowItem[unitname].ToString().Contains("XRD04") || !rowItem[containername].ToString().Contains("Plan_Pdsf"))
// continue; // continue;
containerModifiedDate = DateTime.Parse(rowItem[containermodifieddate].ToString()); modifiedDate = rowItem[containermodifieddate].ToString();
configurationModifiedDate = DateTime.Parse(rowItem[configurationmodifieddate].ToString()); if (string.IsNullOrEmpty(modifiedDate))
continue;
containerModifiedDate = DateTime.Parse(modifiedDate);
modifiedDate = rowItem[configurationmodifieddate].ToString();
if (string.IsNullOrEmpty(modifiedDate))
continue;
configurationModifiedDate = DateTime.Parse(modifiedDate);
if (containerModifiedDate < configurationModifiedDate) if (containerModifiedDate < configurationModifiedDate)
lastModifiedDate = configurationModifiedDate; lastModifiedDate = configurationModifiedDate;
else else
lastModifiedDate = containerModifiedDate; lastModifiedDate = containerModifiedDate;
goldDirectory = string.Concat(objectTypeDirectory, @"\", rowItem[unitname], @"\", rowItem[containername], @"\Gold"); goldDirectory = string.Concat(objectTypeDirectory, @"\", rowItem[unitname], @"\", rowItem[containername], @"\Gold");
if (!Directory.Exists(goldDirectory)) if (!Directory.Exists(goldDirectory))
Directory.CreateDirectory(goldDirectory); _ = Directory.CreateDirectory(goldDirectory);
edaObjectDirectory = string.Concat(objectTypeDirectory, @"\", rowItem[unitname], @"\", rowItem[containername], @"\", rowItem[configurationstate], @"\", rowItem[configurationproductivestate], @"\", lastModifiedDate.ToString("yyyy-MM-dd_"), new TimeSpan(lastModifiedDate.Ticks - new DateTime(lastModifiedDate.Year, lastModifiedDate.Month, lastModifiedDate.Day).Ticks).TotalSeconds); edaObjectDirectory = string.Concat(objectTypeDirectory, @"\", rowItem[unitname], @"\", rowItem[containername], @"\", rowItem[configurationstate], @"\", rowItem[configurationproductivestate], @"\", lastModifiedDate.ToString("yyyy-MM-dd_"), new TimeSpan(lastModifiedDate.Ticks - new DateTime(lastModifiedDate.Year, lastModifiedDate.Month, lastModifiedDate.Day).Ticks).TotalSeconds);
if (!Directory.Exists(edaObjectDirectory)) if (!Directory.Exists(edaObjectDirectory))
Directory.CreateDirectory(edaObjectDirectory); _ = Directory.CreateDirectory(edaObjectDirectory);
edaObjectFile = string.Concat(edaObjectDirectory, @"\", rowItem[unitname], " ", rowItem[containername], " - ", replace, " - ", rowItem[configurationstate].ToString(), " ", rowItem[configurationproductivestate].ToString()); edaObjectFile = string.Concat(edaObjectDirectory, @"\", rowItem[unitname], " ", rowItem[containername], " - ", replace, " - ", rowItem[configurationstate].ToString(), " ", rowItem[configurationproductivestate].ToString());
xml = rowItem[containerconfiguration].ToString(); xml = rowItem[containerconfiguration].ToString();
if (string.IsNullOrEmpty(xml))
continue;
//continue; //continue;
lock (_Lock) lock (_Lock)
{ {
@ -816,33 +734,35 @@ namespace EDAViewer.Singleton
catch (Exception) { } catch (Exception) { }
common = new Common(ModuleInstanceTypeName.Pdsf, rowItem[unitname], rowItem[containername], rowItem[configurationstate], rowItem[configurationproductivestate]); common = new Common(ModuleInstanceTypeName.Pdsf, rowItem[unitname], rowItem[containername], rowItem[configurationstate], rowItem[configurationproductivestate]);
configuration = ParseXML<PDSFConfiguration>(xml, throwExceptions: true); configuration = ParseXML<PDSFConfiguration>(xml, throwExceptions: true);
if (!Directory.Exists(Path.GetPathRoot(configuration.Settings.StoragePath)))
continue;
if (configuration is null) if (configuration is null)
continue; continue;
if (!Directory.Exists(Path.GetPathRoot(configuration.Settings.StoragePath)))
continue;
else else
{ {
common.Update(configuration); common.Update(configuration);
json = JsonSerializer.Serialize(configuration, configuration.GetType(), jsonSerializerOptions); json = JsonSerializer.Serialize(configuration, configuration.GetType(), jsonSerializerOptions);
if (!Directory.Exists(common.StoragePath)) if (!Directory.Exists(common.StoragePath))
Directory.CreateDirectory(common.StoragePath); _ = Directory.CreateDirectory(common.StoragePath);
if (common?.UnitName is null)
continue;
if (!common.StoragePath.Contains(common.UnitName) && (common.StoragePath.Contains(@"01EquipmentIntegration") || common.StoragePath.Contains(@"02BusinessIntegration"))) if (!common.StoragePath.Contains(common.UnitName) && (common.StoragePath.Contains(@"01EquipmentIntegration") || common.StoragePath.Contains(@"02BusinessIntegration")))
{ {
common.StoragePath = common.StoragePath.Replace("Traces", "Empty"); common.StoragePath = common.StoragePath.Replace("Traces", "Empty");
if (!Directory.Exists(common.StoragePath)) if (!Directory.Exists(common.StoragePath))
Directory.CreateDirectory(common.StoragePath); _ = Directory.CreateDirectory(common.StoragePath);
if (common.UnitName != "PRF01") if (common.UnitName != "PRF01")
{ {
unitDirectory = string.Concat(Path.GetDirectoryName(common.StoragePath), @"\", common.UnitName); unitDirectory = string.Concat(Path.GetDirectoryName(common.StoragePath), @"\", common.UnitName);
common.StoragePath = string.Concat(unitDirectory, @"\BadPath"); common.StoragePath = string.Concat(unitDirectory, @"\BadPath");
if (!Directory.Exists(common.StoragePath)) if (!Directory.Exists(common.StoragePath))
Directory.CreateDirectory(common.StoragePath); _ = Directory.CreateDirectory(common.StoragePath);
common.StoragePath = string.Concat(unitDirectory, @"\LogFile"); common.StoragePath = string.Concat(unitDirectory, @"\LogFile");
if (!Directory.Exists(common.StoragePath)) if (!Directory.Exists(common.StoragePath))
Directory.CreateDirectory(common.StoragePath); _ = Directory.CreateDirectory(common.StoragePath);
common.StoragePath = string.Concat(unitDirectory, @"\PollPath"); common.StoragePath = string.Concat(unitDirectory, @"\PollPath");
if (!Directory.Exists(common.StoragePath)) if (!Directory.Exists(common.StoragePath))
Directory.CreateDirectory(common.StoragePath); _ = Directory.CreateDirectory(common.StoragePath);
} }
} }
fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".csv"); fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".csv");
@ -852,37 +772,37 @@ namespace EDAViewer.Singleton
catch (Exception) { } catch (Exception) { }
fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".json"); fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".json");
File.WriteAllText(fileName, json); File.WriteAllText(fileName, json);
text = EDAViewer.Singleton.Helper.Background.EdaDCP.GetText(edaObjectFile, common, json); text = Helper.Background.EdaDCP.GetText(edaObjectFile, common, json);
fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".txt"); fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".txt");
File.WriteAllText(fileName, text); File.WriteAllText(fileName, text);
try try
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); } { File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
catch (Exception) { } catch (Exception) { }
html = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToHtml(edaObjectFile, common); html = Helper.Background.EdaDCP.GetEdaObjectToHtml(edaObjectFile, common);
fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".html"); fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".html");
File.WriteAllText(fileName, html); File.WriteAllText(fileName, html);
try try
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); } { File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
catch (Exception) { } catch (Exception) { }
xml = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToDMSGridFormat(edaObjectFile, common, useAlias: false); xml = Helper.Background.EdaDCP.GetEdaObjectToDMSGridFormat(edaObjectFile, common, useAlias: false);
fileName = string.Concat(edaObjectFile.Replace(replace, "DMSGridFormat"), ".xml"); fileName = string.Concat(edaObjectFile.Replace(replace, "DMSGridFormat"), ".xml");
File.WriteAllText(fileName, xml); File.WriteAllText(fileName, xml);
try try
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); } { File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
catch (Exception) { } catch (Exception) { }
xml = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToDMSGridFormat(edaObjectFile, common, useAlias: true); xml = Helper.Background.EdaDCP.GetEdaObjectToDMSGridFormat(edaObjectFile, common, useAlias: true);
fileName = string.Concat(edaObjectFile.Replace(replace, "DMSGridFormat - Alias"), ".xml"); fileName = string.Concat(edaObjectFile.Replace(replace, "DMSGridFormat - Alias"), ".xml");
File.WriteAllText(fileName, xml); File.WriteAllText(fileName, xml);
try try
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); } { File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
catch (Exception) { } catch (Exception) { }
csv = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToAPCParameter(edaObjectFile, common); csv = Helper.Background.EdaDCP.GetEdaObjectToAPCParameter(edaObjectFile, common);
fileName = string.Concat(edaObjectFile.Replace(replace, "APCParameter"), ".csv"); fileName = string.Concat(edaObjectFile.Replace(replace, "APCParameter"), ".csv");
File.WriteAllText(fileName, csv); File.WriteAllText(fileName, csv);
try try
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); } { File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
catch (Exception) { } catch (Exception) { }
csv = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToAPCRunKeyNumber(edaObjectFile, common); csv = Helper.Background.EdaDCP.GetEdaObjectToAPCRunKeyNumber(edaObjectFile, common);
fileName = string.Concat(edaObjectFile.Replace(replace, "APCRunKeyNumber"), ".csv"); fileName = string.Concat(edaObjectFile.Replace(replace, "APCRunKeyNumber"), ".csv");
File.WriteAllText(fileName, csv); File.WriteAllText(fileName, csv);
try try
@ -907,6 +827,4 @@ namespace EDAViewer.Singleton
} }
} }
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,16 @@
namespace EDAViewer.Singleton.Helper namespace EDAViewer.Singleton.Helper;
{
public partial class Background public partial class Background
{ {
public partial class EDADatabase public partial class EDADatabase
{ {
public static string GetEdaDevelopment() public static string GetEdaDevelopment() => "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimest-db.mes.infineon.com)(port=7001)))(connect_data=(sid=fimest))); User Id=edatest; Password=";
{
return "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimest-db.mes.infineon.com)(port=7001)))(connect_data=(sid=fimest))); User Id=edatest; Password=";
}
public static string GetEdaStaging() public static string GetEdaStaging() => "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimess-db.ec.local)(port=7001)))(connect_data=(sid=fimess))); User Id=edastag; Password=";
{
return "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimess-db.ec.local)(port=7001)))(connect_data=(sid=fimess))); User Id=edastag; Password=";
}
public static string GetEdaProduction() public static string GetEdaProduction() => "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimesp-db.ec.local)(port=7002)))(connect_data=(sid=fimesp))); User Id=edaprod; Password=";
{
return "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimesp-db.ec.local)(port=7002)))(connect_data=(sid=fimesp))); User Id=edaprod; Password=";
}
}
} }

View File

@ -1,220 +1,219 @@
using System.Collections.Generic;
using System.Dynamic; using System.Dynamic;
using System.IO;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
namespace EDAViewer.Singleton.Helper namespace EDAViewer.Singleton.Helper;
{
public partial class Background public partial class Background
{ {
public class EdaDCP public class EdaDCP
{ {
internal static string GetEdaObjectToHtml(string edaObjectFile, Common common) internal static string GetEdaObjectToHtml(string edaObjectFile, Common common)
{ {
StringBuilder result = new StringBuilder(); StringBuilder result = new();
string title = string.Concat(Path.GetFileName(edaObjectFile), " - ", common.Source); string title = string.Concat(Path.GetFileName(edaObjectFile), " - ", common.Source);
result.AppendLine("<!DOCTYPE html>"); _ = result.AppendLine("<!DOCTYPE html>");
result.AppendLine("<html lang=\"en\">"); _ = result.AppendLine("<html lang=\"en\">");
result.AppendLine("<head>"); _ = result.AppendLine("<head>");
result.AppendLine("<style>table, th, td{border:1px solid black;} td{padding:2px}</style>"); _ = result.AppendLine("<style>table, th, td{border:1px solid black;} td{padding:2px}</style>");
result.Append("<title>").Append(title).AppendLine("</title>"); _ = result.Append("<title>").Append(title).AppendLine("</title>");
result.AppendLine("</head>"); _ = result.AppendLine("</head>");
result.AppendLine("<body>"); _ = result.AppendLine("<body>");
result.AppendLine("<table>"); _ = result.AppendLine("<table>");
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Unit Name").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Unit Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("Container Name").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Container Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("Configuration State").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Configuration State").AppendLine("</th>");
result.Append("<th nowrap>").Append("Configuration Productive State").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Configuration Productive State").AppendLine("</th>");
result.Append("<th nowrap>").Append("LogisticsEquipmentAlias").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("LogisticsEquipmentAlias").AppendLine("</th>");
result.Append("<th nowrap>").Append("Source").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Source").AppendLine("</th>");
result.Append("<th nowrap>").Append("StoragePath").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("StoragePath").AppendLine("</th>");
result.Append("<th nowrap>").Append("StartTimeFormat").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("StartTimeFormat").AppendLine("</th>");
result.Append("<th nowrap>").Append("Filename").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Filename").AppendLine("</th>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
result.Append("<td nowrap>").Append(common.UnitName).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(common.UnitName).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.ContainerName).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(common.ContainerName).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.ConfigurationState).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(common.ConfigurationState).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.ConfigurationProductiveState).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(common.ConfigurationProductiveState).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.LogisticsEquipmentAlias).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(common.LogisticsEquipmentAlias).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.Source).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(common.Source).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.StoragePath).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(common.StoragePath).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.StartTimeFormat).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(common.StartTimeFormat).AppendLine("</td>");
result.Append("<td nowrap>").Append(common.Filename).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(common.Filename).AppendLine("</td>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
result.AppendLine("</table>"); _ = result.AppendLine("</table>");
result.AppendLine("<hr>"); _ = result.AppendLine("<hr>");
result.AppendLine("<table>"); _ = result.AppendLine("<table>");
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Use").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Use").AppendLine("</th>");
result.Append("<th nowrap>").Append("Order").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Order").AppendLine("</th>");
result.Append("<th nowrap>").Append("Key").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Key").AppendLine("</th>");
result.Append("<th nowrap>").Append("Placeholder").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Placeholder").AppendLine("</th>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
foreach (string[] item in common.LogisticsAttributes) foreach (string[] item in common.LogisticsAttributes)
{ {
if (item.Length > 2 && !item[2].StartsWith("Z_")) if (item.Length > 2 && !item[2].StartsWith("Z_"))
{ {
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
foreach (string value in item) foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
} }
} }
result.AppendLine("</table>"); _ = result.AppendLine("</table>");
result.AppendLine("<hr>"); _ = result.AppendLine("<hr>");
result.AppendLine("<table>"); _ = result.AppendLine("<table>");
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("ID").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("ID").AppendLine("</th>");
result.Append("<th nowrap>").Append("Prefix").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Prefix").AppendLine("</th>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
foreach (string[] item in common.LogisticsColumns) foreach (string[] item in common.LogisticsColumns)
{ {
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
foreach (string value in item) foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
} }
result.AppendLine("</table>"); _ = result.AppendLine("</table>");
result.AppendLine("<hr>"); _ = result.AppendLine("<hr>");
result.AppendLine("<table>"); _ = result.AppendLine("<table>");
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Use").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Use").AppendLine("</th>");
result.Append("<th nowrap>").Append("Order").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Order").AppendLine("</th>");
result.Append("<th nowrap>").Append("FullName").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("FullName").AppendLine("</th>");
result.Append("<th nowrap>").Append("Alias").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Alias").AppendLine("</th>");
result.Append("<th nowrap>").Append("HardWareId").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("HardWareId").AppendLine("</th>");
result.Append("<th nowrap>").Append("Description").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Description").AppendLine("</th>");
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
result.Append("<th nowrap>").Append("Virtual").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Virtual").AppendLine("</th>");
result.Append("<th nowrap>").Append("Column#").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Column#").AppendLine("</th>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
foreach (string[] item in common.Parameters) foreach (string[] item in common.Parameters)
{ {
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
foreach (string value in item) foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
} }
result.AppendLine("</table>"); _ = result.AppendLine("</table>");
result.AppendLine("<hr>"); _ = result.AppendLine("<hr>");
result.AppendLine("<table>"); _ = result.AppendLine("<table>");
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Parent Name").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Parent Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("Name").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("ParameterName").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("ParameterName").AppendLine("</th>");
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
foreach (string[] item in common.GeneralTriggers) foreach (string[] item in common.GeneralTriggers)
{ {
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
foreach (string value in item) foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
} }
result.AppendLine("</table>"); _ = result.AppendLine("</table>");
result.AppendLine("<hr>"); _ = result.AppendLine("<hr>");
result.AppendLine("<table>"); _ = result.AppendLine("<table>");
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Name").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("Rule").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
result.Append("<th nowrap>").Append("ResolveGlobalVariableBeforeTrigger").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("ResolveGlobalVariableBeforeTrigger").AppendLine("</th>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
foreach (string[] item in common.StartTriggersDCP) foreach (string[] item in common.StartTriggersDCP)
{ {
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
foreach (string value in item) foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
} }
result.AppendLine("</table>"); _ = result.AppendLine("</table>");
result.AppendLine("<hr>"); _ = result.AppendLine("<hr>");
result.AppendLine("<table>"); _ = result.AppendLine("<table>");
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Name").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("Fixed").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Fixed").AppendLine("</th>");
result.Append("<th nowrap>").Append("Rule").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
result.Append("<th nowrap>").Append("Scenario").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Scenario").AppendLine("</th>");
result.Append("<th nowrap>").Append("DefaultJobIndex").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("DefaultJobIndex").AppendLine("</th>");
result.Append("<th nowrap>").Append("DefaultCarrierIndex").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("DefaultCarrierIndex").AppendLine("</th>");
result.Append("<th nowrap>").Append("DefaultSlotIndex").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("DefaultSlotIndex").AppendLine("</th>");
result.Append("<th nowrap>").Append("DataPool").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("DataPool").AppendLine("</th>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
foreach (string[] item in common.LogisticsTriggers) foreach (string?[] item in common.LogisticsTriggers)
{ {
result.AppendLine("<tr>"); if (item is null)
foreach (string value in item) continue;
result.Append("<td nowrap>").Append(value).AppendLine("</td>"); _ = result.AppendLine("<tr>");
result.AppendLine("<td>"); foreach (string? value in item)
result.AppendLine("<table>"); _ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("<tr>"); _ = result.AppendLine("<td>");
result.Append("<th nowrap>").Append("KeyName").AppendLine("</th>"); _ = result.AppendLine("<table>");
result.Append("<th nowrap>").Append("ParameterName").AppendLine("</th>"); _ = result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("KeyName").AppendLine("</th>");
result.AppendLine("</tr>"); _ = result.Append("<th nowrap>").Append("ParameterName").AppendLine("</th>");
_ = result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
_ = result.AppendLine("</tr>");
foreach (KeyValuePair<int, string[]> keyValuePair in common.LogisticsTriggersKeysKeyMapping) foreach (KeyValuePair<int, string[]> keyValuePair in common.LogisticsTriggersKeysKeyMapping)
{ {
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
foreach (string value in keyValuePair.Value) foreach (string value in keyValuePair.Value)
result.Append("<td nowrap>").Append(value).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
} }
result.AppendLine("</table>"); _ = result.AppendLine("</table>");
result.AppendLine("</td>"); _ = result.AppendLine("</td>");
result.AppendLine("<td>"); _ = result.AppendLine("<td>");
result.AppendLine("<table>"); _ = result.AppendLine("<table>");
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("LogisticsKey").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("LogisticsKey").AppendLine("</th>");
result.Append("<th nowrap>").Append("Source").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Source").AppendLine("</th>");
result.Append("<th nowrap>").Append("MappedParameterName").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("MappedParameterName").AppendLine("</th>");
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
foreach (KeyValuePair<int, List<string[]>> keyValuePair in common.LogisticsTriggersCallDefinitionAttributes) foreach (KeyValuePair<int, List<string[]>> keyValuePair in common.LogisticsTriggersCallDefinitionAttributes)
{ {
foreach (string[] values in keyValuePair.Value) foreach (string[] values in keyValuePair.Value)
{ {
if (values.Length > 0 && !values[0].StartsWith("Z_")) if (values.Length > 0 && !values[0].StartsWith("Z_"))
{ {
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
foreach (string value in values) foreach (string value in values)
result.Append("<td nowrap>").Append(value).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
} }
} }
} }
result.AppendLine("</table>"); _ = result.AppendLine("</table>");
result.AppendLine("</td>"); _ = result.AppendLine("</td>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
} }
result.AppendLine("</table>"); _ = result.AppendLine("</table>");
result.AppendLine("<hr>"); _ = result.AppendLine("<hr>");
result.AppendLine("<table>"); _ = result.AppendLine("<table>");
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
result.Append("<th nowrap>").Append("Name").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
result.Append("<th nowrap>").Append("Rule").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
result.Append("<th nowrap>").Append("ResolveGlobalVariableBeforeTrigger").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("ResolveGlobalVariableBeforeTrigger").AppendLine("</th>");
result.Append("<th nowrap>").Append("ResetGlobalVariablesAfterTrigger").AppendLine("</th>"); _ = result.Append("<th nowrap>").Append("ResetGlobalVariablesAfterTrigger").AppendLine("</th>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
foreach (string[] item in common.StopTriggersDCP) foreach (string[] item in common.StopTriggersDCP)
{ {
result.AppendLine("<tr>"); _ = result.AppendLine("<tr>");
foreach (string value in item) foreach (string value in item)
result.Append("<td nowrap>").Append(value).AppendLine("</td>"); _ = result.Append("<td nowrap>").Append(value).AppendLine("</td>");
result.AppendLine("</tr>"); _ = result.AppendLine("</tr>");
} }
result.AppendLine("</table>"); _ = result.AppendLine("</table>");
result.AppendLine("<hr>"); _ = result.AppendLine("<hr>");
result.AppendLine("</body>"); _ = result.AppendLine("</body>");
result.AppendLine("</html>"); _ = result.AppendLine("</html>");
return result.ToString(); return result.ToString();
} }
private static string ReplaceNull(object @object) private static string? ReplaceNull(object @object)
{ {
if (@object is null) if (@object is null)
return string.Empty; return string.Empty;
@ -231,7 +230,7 @@ namespace EDAViewer.Singleton.Helper
TextResolveEntry(result, entry.Value, level, string.Concat(super, " : ", entry.Key), i, group); TextResolveEntry(result, entry.Value, level, string.Concat(super, " : ", entry.Key), i, group);
else else
{ {
if (!(entry.Value is ICollection<object>)) if (entry.Value is not ICollection<object>)
{ {
if (i is null) if (i is null)
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("--->").AppendLine(ReplaceNull(entry.Value)); result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("--->").AppendLine(ReplaceNull(entry.Value));
@ -254,7 +253,7 @@ namespace EDAViewer.Singleton.Helper
{ {
for (i = 0; i.Value < entry.Value.Count; i++) for (i = 0; i.Value < entry.Value.Count; i++)
{ {
if (!(entry.Value[i.Value] is ExpandoObject)) if (entry.Value[i.Value] is not ExpandoObject)
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value[i.Value])); result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value[i.Value]));
} }
for (i = 0; i.Value < entry.Value.Count; i++) for (i = 0; i.Value < entry.Value.Count; i++)
@ -268,27 +267,29 @@ namespace EDAViewer.Singleton.Helper
} }
} }
level -= 1; level -= 1;
if (level == 0)
{ }
} }
internal static string GetText(string edaObjectFile, Common common, string json) internal static string GetText(string edaObjectFile, Common common, string json)
{ {
StringBuilder result = new StringBuilder(); StringBuilder result = new();
if (result.Length > 0) //Skipping because System.Text.Json changed the way Expando works if (result.Length > 0) //Skipping because System.Text.Json changed the way Expando works
{ {
string title = string.Concat(Path.GetFileName(edaObjectFile), " - ", common.Source); string title = string.Concat(Path.GetFileName(edaObjectFile), " - ", common.Source);
dynamic expandoObject = JsonSerializer.Deserialize<ExpandoObject>(json); dynamic? expandoObject = JsonSerializer.Deserialize<ExpandoObject>(json);
result.AppendLine(title); _ = result.AppendLine(title);
result.AppendLine("Loop -> \"Normal\""); _ = result.AppendLine("Loop -> \"Normal\"");
result.AppendLine(edaObjectFile); _ = result.AppendLine(edaObjectFile);
result.AppendLine(); _ = result.AppendLine();
TextResolveEntry(result, expandoObject, 0, string.Empty, null, group: false); TextResolveEntry(result, expandoObject, 0, string.Empty, null, group: false);
result.AppendLine(); _ = result.AppendLine();
result.AppendLine(); _ = result.AppendLine();
result.AppendLine(); _ = result.AppendLine();
result.AppendLine(title); _ = result.AppendLine(title);
result.AppendLine("Loop -> \"Grouped\""); _ = result.AppendLine("Loop -> \"Grouped\"");
result.AppendLine(edaObjectFile); _ = result.AppendLine(edaObjectFile);
result.AppendLine(); _ = result.AppendLine();
TextResolveEntry(result, expandoObject, 0, string.Empty, null, group: true); TextResolveEntry(result, expandoObject, 0, string.Empty, null, group: true);
} }
return result.ToString(); return result.ToString();
@ -296,17 +297,19 @@ namespace EDAViewer.Singleton.Helper
internal static string GetEdaObjectToDMSGridFormat(string edaObjectFile, Common common, bool useAlias) internal static string GetEdaObjectToDMSGridFormat(string edaObjectFile, Common common, bool useAlias)
{ {
StringBuilder result = new StringBuilder(); StringBuilder result = new();
if (string.IsNullOrEmpty(edaObjectFile))
{ }
string[] segments; string[] segments;
int? recordStart = null; int? recordStart = null;
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName); string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName);
result.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"); _ = result.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
result.Append("<Format Name=\"").Append(name).Append("\">").AppendLine(); _ = result.Append("<Format Name=\"").Append(name).Append("\">").AppendLine();
result.AppendLine(" <General RecordStart=\"\" RecordLength=\"0\" ReadCommand=\"\" DecimalSeparator=\".\">"); _ = result.AppendLine(" <General RecordStart=\"\" RecordLength=\"0\" ReadCommand=\"\" DecimalSeparator=\".\">");
result.AppendLine(" <RecordTerminator>&lt;13&gt;&lt;10&gt;</RecordTerminator>"); _ = result.AppendLine(" <RecordTerminator>&lt;13&gt;&lt;10&gt;</RecordTerminator>");
result.AppendLine(" <ColumnSeparator>&lt;9&gt;</ColumnSeparator>"); _ = result.AppendLine(" <ColumnSeparator>&lt;9&gt;</ColumnSeparator>");
result.AppendLine(" </General>"); _ = result.AppendLine(" </General>");
result.AppendLine(" <Fields>"); _ = result.AppendLine(" <Fields>");
for (int i = 0; i < common.Parameters.Count; i++) for (int i = 0; i < common.Parameters.Count; i++)
{ {
if (recordStart is null && common.Parameters[i][3] == "RECORD_START") if (recordStart is null && common.Parameters[i][3] == "RECORD_START")
@ -318,62 +321,63 @@ namespace EDAViewer.Singleton.Helper
else else
{ {
segments = common.Parameters[i][2].Split('/'); segments = common.Parameters[i][2].Split('/');
name = segments[segments.Length - 1]; name = segments[^1];
} }
result.Append(" <Field Name=\"").Append(name).Append("\" ColumnNumber=\"").Append(i + common.LogisticsColumns.Count + 2).Append("\" StartPosition=\"\" Length=\"\" DataType=\"Text\" NullReplacement=\"\" />").AppendLine(); _ = result.Append(" <Field Name=\"").Append(name).Append("\" ColumnNumber=\"").Append(i + common.LogisticsColumns.Count + 2).Append("\" StartPosition=\"\" Length=\"\" DataType=\"Text\" NullReplacement=\"\" />").AppendLine();
} }
} }
result.AppendLine(" </Fields>"); _ = result.AppendLine(" </Fields>");
result.AppendLine(" <Conditions>"); _ = result.AppendLine(" <Conditions>");
result.AppendLine(" <Column />"); _ = result.AppendLine(" <Column />");
result.AppendLine(" <Row>"); _ = result.AppendLine(" <Row>");
result.AppendLine(" <Condition>"); _ = result.AppendLine(" <Condition>");
result.AppendLine(" <SkipHeaderCount>7</SkipHeaderCount>"); _ = result.AppendLine(" <SkipHeaderCount>7</SkipHeaderCount>");
result.AppendLine(" <SkipRowFilter>0</SkipRowFilter>"); _ = result.AppendLine(" <SkipRowFilter>0</SkipRowFilter>");
result.AppendLine(" <SkipRowValue>"); _ = result.AppendLine(" <SkipRowValue>");
result.AppendLine(" </SkipRowValue>"); _ = result.AppendLine(" </SkipRowValue>");
result.AppendLine(" </Condition>"); _ = result.AppendLine(" </Condition>");
result.AppendLine(" </Row>"); _ = result.AppendLine(" </Row>");
result.AppendLine(" </Conditions>"); _ = result.AppendLine(" </Conditions>");
result.AppendLine("</Format>"); _ = result.AppendLine("</Format>");
return result.ToString(); return result.ToString();
} }
internal static string GetEdaObjectToAPCParameter(string edaObjectFile, Common common) internal static string GetEdaObjectToAPCParameter(string edaObjectFile, Common common)
{ {
StringBuilder result = new StringBuilder(); StringBuilder result = new();
if (string.IsNullOrEmpty(edaObjectFile))
{ }
string parameter; string parameter;
string[] segments; string[] segments;
string parameterSub35; string parameterSub35;
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName); _ = result.AppendLine("ExportFileVersion=1.0.6");
result.AppendLine("ExportFileVersion=1.0.6"); _ = result.AppendLine("ExportFromTabsheet=Para");
result.AppendLine("ExportFromTabsheet=Para"); _ = result.AppendLine("FieldName\tLongName\tMatchMode\tEquipment\tName\tPdsfNameConvCol\tPdsfNameDataType\tType\tChamberInfo\tUnifiedPara\tDateFormat\tUsername\tId\tWorkcenterId\tSite\tArea\tWorkcenter\tValidFrom\tValidTo");
result.AppendLine("FieldName\tLongName\tMatchMode\tEquipment\tName\tPdsfNameConvCol\tPdsfNameDataType\tType\tChamberInfo\tUnifiedPara\tDateFormat\tUsername\tId\tWorkcenterId\tSite\tArea\tWorkcenter\tValidFrom\tValidTo"); _ = result.AppendLine("TIME_PREV_DIFF\tTIME_PREV_DIFF\tEXACT\t*\tTIME_PREV_DIFF\t\tNUMERIC\tRUN\t\tTIME_PREV_DIFF\t\tPHARES\t95069\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
result.AppendLine("TIME_PREV_DIFF\tTIME_PREV_DIFF\tEXACT\t*\tTIME_PREV_DIFF\t\tNUMERIC\tRUN\t\tTIME_PREV_DIFF\t\tPHARES\t95069\t4571\tMesa\t\t\t4/15/2020 6:10 PM"); _ = result.AppendLine("TIME\tTIME\tEXACT\t*\tTIME\t\tNUMERIC\tRUN\t\tTIME\t\tPHARES\t95070\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
result.AppendLine("TIME\tTIME\tEXACT\t*\tTIME\t\tNUMERIC\tRUN\t\tTIME\t\tPHARES\t95070\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
for (int i = 0; i < common.Parameters.Count; i++) for (int i = 0; i < common.Parameters.Count; i++)
{ {
if (common.Parameters[i][0] == "True") if (common.Parameters[i][0] == "True")
{ {
segments = common.Parameters[i][2].Split('/'); segments = common.Parameters[i][2].Split('/');
parameter = segments[segments.Length - 1]; parameter = segments[^1];
if (parameter.Length < 35) if (parameter.Length < 35)
parameterSub35 = parameter; parameterSub35 = parameter;
else else
parameterSub35 = parameter.Substring(0, 35); parameterSub35 = parameter[..35];
result.Append(parameterSub35).Append("\tDIVERSE\tEXACT\t*\t").Append(parameterSub35).AppendLine("\t\tNUMERIC\tRUN\t\t\t\tPHARES\t9000000012\t4571\tMesa\t\t\t4/15/2020 6:10 PM"); _ = result.Append(parameterSub35).Append("\tDIVERSE\tEXACT\t*\t").Append(parameterSub35).AppendLine("\t\tNUMERIC\tRUN\t\t\t\tPHARES\t9000000012\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
} }
} }
result.AppendLine(); _ = result.AppendLine();
result.AppendLine(); _ = result.AppendLine();
result.AppendLine(); _ = result.AppendLine();
for (int i = 0; i < common.Parameters.Count; i++) for (int i = 0; i < common.Parameters.Count; i++)
{ {
if (common.Parameters[i][0] == "True") if (common.Parameters[i][0] == "True")
{ {
segments = common.Parameters[i][2].Split('/'); segments = common.Parameters[i][2].Split('/');
parameter = segments[segments.Length - 1]; parameter = segments[^1];
result.Append(parameter).Append("\tDIVERSE\tEXACT\t*\t").Append(parameter).AppendLine("\t\tNUMERIC\tRUN\t\t\t\tPHARES\t9000000012\t4571\tMesa\t\t\t4/15/2020 6:10 PM"); _ = result.Append(parameter).Append("\tDIVERSE\tEXACT\t*\t").Append(parameter).AppendLine("\t\tNUMERIC\tRUN\t\t\t\tPHARES\t9000000012\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
} }
} }
return result.ToString(); return result.ToString();
@ -381,42 +385,43 @@ namespace EDAViewer.Singleton.Helper
internal static string GetEdaObjectToAPCRunKeyNumber(string edaObjectFile, Common common) internal static string GetEdaObjectToAPCRunKeyNumber(string edaObjectFile, Common common)
{ {
StringBuilder result = new StringBuilder(); StringBuilder result = new();
if (string.IsNullOrEmpty(edaObjectFile))
{ }
string parameter; string parameter;
string[] segments; string[] segments;
string parameterSub21; string parameterSub21;
string parameterSub35; string parameterSub35;
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName); _ = result.AppendLine("ExportFileVersion=1.0.6");
result.AppendLine("ExportFileVersion=1.0.6"); _ = result.AppendLine("ExportFromTabsheet=Run-Keynumbers");
result.AppendLine("ExportFromTabsheet=Run-Keynumbers"); _ = result.AppendLine("FeatureName\tShortName\tChamber\tComments\tVarMode\tPara\tExclude0\tTrigOn1\tTrigOn2\tTrigOn3\tTrigOff1\tTrigOff2\tTrigOff3\tTrigDelay\tTrigNorm\tTrigNvl\tTrigTrg\tAddCondOn\tActive\tFilter1\tFilter2\tFilter3\tFilter4\tUnit\tId\tWorkcenterId\tSite\tArea\tWorkcenter\tUsername\tValidFrom\tValidTo");
result.AppendLine("FeatureName\tShortName\tChamber\tComments\tVarMode\tPara\tExclude0\tTrigOn1\tTrigOn2\tTrigOn3\tTrigOff1\tTrigOff2\tTrigOff3\tTrigDelay\tTrigNorm\tTrigNvl\tTrigTrg\tAddCondOn\tActive\tFilter1\tFilter2\tFilter3\tFilter4\tUnit\tId\tWorkcenterId\tSite\tArea\tWorkcenter\tUsername\tValidFrom\tValidTo");
for (int i = 0; i < common.Parameters.Count; i++) for (int i = 0; i < common.Parameters.Count; i++)
{ {
if (common.Parameters[i][0] == "True") if (common.Parameters[i][0] == "True")
{ {
segments = common.Parameters[i][2].Split('/'); segments = common.Parameters[i][2].Split('/');
parameter = segments[segments.Length - 1]; parameter = segments[^1];
if (parameter.Length < 35) if (parameter.Length < 35)
parameterSub35 = parameter; parameterSub35 = parameter;
else else
parameterSub35 = parameter.Substring(0, 35); parameterSub35 = parameter[..35];
if (parameter.Length < 21) if (parameter.Length < 21)
parameterSub21 = parameter; parameterSub21 = parameter;
else else
parameterSub21 = parameter.Substring(0, 21); parameterSub21 = parameter[..21];
result.Append(parameterSub21).Append("_MIN\t").Append(parameterSub21).Append("_MIN\t\t\tMIN\t").Append(parameterSub35).AppendLine("\t0\tTIME\t=\tRUNSTART\tTIME\t=\tRUNEND\t\t\t\t\t\t1\t\t\t\t\t\t-1\t-1\t\t\t\tECPHARES\t5/2/2017 2:44 PM"); _ = result.Append(parameterSub21).Append("_MIN\t").Append(parameterSub21).Append("_MIN\t\t\tMIN\t").Append(parameterSub35).AppendLine("\t0\tTIME\t=\tRUNSTART\tTIME\t=\tRUNEND\t\t\t\t\t\t1\t\t\t\t\t\t-1\t-1\t\t\t\tECPHARES\t5/2/2017 2:44 PM");
} }
} }
result.AppendLine(); _ = result.AppendLine();
result.AppendLine(); _ = result.AppendLine();
result.AppendLine(); _ = result.AppendLine();
for (int i = 0; i < common.Parameters.Count; i++) for (int i = 0; i < common.Parameters.Count; i++)
{ {
if (common.Parameters[i][0] == "True") if (common.Parameters[i][0] == "True")
{ {
segments = common.Parameters[i][2].Split('/'); segments = common.Parameters[i][2].Split('/');
parameter = segments[segments.Length - 1]; parameter = segments[^1];
result.Append(parameter).Append("_MIN\t").Append(parameter).Append("_MIN\t\t\tMIN\t").Append(parameter).AppendLine("\t0\tTIME\t=\tRUNSTART\tTIME\t=\tRUNEND\t\t\t\t\t\t1\t\t\t\t\t\t-1\t-1\t\t\t\tECPHARES\t5/2/2017 2:44 PM"); _ = result.Append(parameter).Append("_MIN\t").Append(parameter).Append("_MIN\t\t\tMIN\t").Append(parameter).AppendLine("\t0\tTIME\t=\tRUNSTART\tTIME\t=\tRUNEND\t\t\t\t\t\t1\t\t\t\t\t\t-1\t-1\t\t\t\tECPHARES\t5/2/2017 2:44 PM");
} }
} }
return result.ToString(); return result.ToString();
@ -424,6 +429,4 @@ namespace EDAViewer.Singleton.Helper
} }
}
} }

View File

@ -1,72 +1,81 @@
using EDAViewer.Singleton.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
namespace EDAViewer.Singleton.Helper namespace EDAViewer.Singleton.Helper;
[Serializable]
public class Common
{ {
[Serializable] public string? ConfigurationProductiveState { get; set; }
public class Common public string? ConfigurationState { get; set; }
{ public string? ContainerName { get; set; }
public ModuleInstanceTypeName? ObjectType { get; set; } public ModuleInstanceTypeName? ObjectType { get; set; }
public string ConfigurationState { get; set; } public string? UnitName { get; set; }
public string ConfigurationProductiveState { get; set; }
public string UnitName { get; set; }
public string ContainerName { get; set; }
// //
public string StoragePath { get; set; }
public string StartTimeFormat { get; set; }
public string Filename { get; set; } public string Filename { get; set; }
public string StartTimeFormat { get; set; }
public string StoragePath { get; set; }
// //
public string Source { get; set; } public List<string[]> GeneralTriggers { get; set; }
public string LogisticsEquipmentAlias { get; set; }
public List<string[]> LogisticsAttributes { get; set; } public List<string[]> LogisticsAttributes { get; set; }
public List<string[]> LogisticsColumns { get; set; } public List<string[]> LogisticsColumns { get; set; }
public string LogisticsEquipmentAlias { get; set; }
public List<string?[]> LogisticsTriggers { get; set; }
public Dictionary<int, List<string[]>> LogisticsTriggersCallDefinitionAttributes { get; set; }
public Dictionary<int, string[]> LogisticsTriggersKeysKeyMapping { get; set; }
public List<string[]> Parameters { get; set; } public List<string[]> Parameters { get; set; }
public string ParametersAsCsv { get; set; } public string ParametersAsCsv { get; set; }
public List<string[]> GeneralTriggers { get; set; } public string Source { get; set; }
public List<string[]> StartTriggersDCP { get; set; } public List<string[]> StartTriggersDCP { get; set; }
public List<string[]> LogisticsTriggers { get; set; }
public Dictionary<int, string[]> LogisticsTriggersKeysKeyMapping { get; set; }
public Dictionary<int, List<string[]>> LogisticsTriggersCallDefinitionAttributes { get; set; }
public List<string[]> StopTriggersDCP { get; set; } public List<string[]> StopTriggersDCP { get; set; }
[Obsolete("Only for DeserializeObject")] [Obsolete("Only for DeserializeObject")]
public Common() public Common()
{ {
ObjectType = null; ObjectType = null;
ConfigurationState = string.Empty; Parameters = new();
ConfigurationProductiveState = string.Empty; Source = string.Empty;
Filename = string.Empty;
GeneralTriggers = new();
StopTriggersDCP = new();
UnitName = string.Empty; UnitName = string.Empty;
LogisticsColumns = new();
StartTriggersDCP = new();
LogisticsTriggers = new();
StoragePath = string.Empty;
LogisticsAttributes = new();
ContainerName = string.Empty; ContainerName = string.Empty;
CommonLogic(); ParametersAsCsv = string.Empty;
StartTimeFormat = string.Empty;
ConfigurationState = string.Empty;
LogisticsEquipmentAlias = string.Empty;
ConfigurationProductiveState = string.Empty;
LogisticsTriggersKeysKeyMapping = new Dictionary<int, string[]>();
LogisticsTriggersCallDefinitionAttributes = new Dictionary<int, List<string[]>>();
} }
public Common(ModuleInstanceTypeName objectType, object unitName, object containerName, object configurationState, object configurationProductiveState) public Common(ModuleInstanceTypeName objectType, object unitName, object containerName, object configurationState, object configurationProductiveState)
{ {
Parameters = new();
Source = string.Empty;
Filename = string.Empty;
GeneralTriggers = new();
ObjectType = objectType; ObjectType = objectType;
ConfigurationState = configurationState.ToString(); StopTriggersDCP = new();
ConfigurationProductiveState = configurationProductiveState.ToString(); LogisticsColumns = new();
UnitName = unitName.ToString(); StartTriggersDCP = new();
ContainerName = containerName.ToString(); LogisticsTriggers = new();
CommonLogic(configurationState.ToString(), configurationProductiveState.ToString(), unitName.ToString(), containerName.ToString()); StoragePath = string.Empty;
} LogisticsAttributes = new();
private void CommonLogic(string configurationState = "", string configurationProductiveState = "", string unitName = "", string containerame = "")
{
LogisticsAttributes = new List<string[]>();
LogisticsColumns = new List<string[]>();
Parameters = new List<string[]>();
ParametersAsCsv = string.Empty; ParametersAsCsv = string.Empty;
GeneralTriggers = new List<string[]>(); StartTimeFormat = string.Empty;
StartTriggersDCP = new List<string[]>(); UnitName = unitName.ToString();
LogisticsTriggers = new List<string[]>(); LogisticsEquipmentAlias = string.Empty;
ContainerName = containerName.ToString();
ConfigurationState = configurationState.ToString();
LogisticsTriggersKeysKeyMapping = new Dictionary<int, string[]>(); LogisticsTriggersKeysKeyMapping = new Dictionary<int, string[]>();
ConfigurationProductiveState = configurationProductiveState.ToString();
LogisticsTriggersCallDefinitionAttributes = new Dictionary<int, List<string[]>>(); LogisticsTriggersCallDefinitionAttributes = new Dictionary<int, List<string[]>>();
StopTriggersDCP = new List<string[]>();
} }
public void Update(PDSFConfiguration configuration) public void Update(PDSFConfiguration configuration)
@ -111,6 +120,8 @@ namespace EDAViewer.Singleton.Helper
} }
else else
{ {
if (item is null)
continue;
if (item.Use) if (item.Use)
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") }); Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
else else
@ -118,16 +129,16 @@ namespace EDAViewer.Singleton.Helper
} }
} }
Parameters = (from l in Parameters orderby l[0] descending, l[1] select l).ToList(); Parameters = (from l in Parameters orderby l[0] descending, l[1] select l).ToList();
StringBuilder text = new StringBuilder(); StringBuilder text = new();
//text.AppendLine("\"AliasName\";\"Condition\";\"EventId\";\"ExceptionId\";\"Formula\";\"HardwareId\";\"OrderId\";\"ParameterName\";\"Remark\";\"ReportName\";\"SourceId\";\"Use\""); //text.AppendLine("\"AliasName\";\"Condition\";\"EventId\";\"ExceptionId\";\"Formula\";\"HardwareId\";\"OrderId\";\"ParameterName\";\"Remark\";\"ReportName\";\"SourceId\";\"Use\"");
//"Test";"";"";"";"";"";"1";"MICROSCOPE01/MET08MESMICROSCOPE/Test";"";"MICROSCOPE01/MET08MESMICROSCOPE/FileRead";"";"True"" //"Test";"";"";"";"";"";"1";"MICROSCOPE01/MET08MESMICROSCOPE/Test";"";"MICROSCOPE01/MET08MESMICROSCOPE/FileRead";"";"True""
text.AppendLine("\"Use\";\"OrderId\";\"ReportName\";\"ParameterName\";\"AliasName\";\"HardwareId\";\"Remark\";\"Formula\""); _ = text.AppendLine("\"Use\";\"OrderId\";\"ReportName\";\"ParameterName\";\"AliasName\";\"HardwareId\";\"Remark\";\"Formula\"");
foreach (string[] item in Parameters) foreach (string[] item in Parameters)
{ {
for (int i = 0; i < 7; i++) for (int i = 0; i < 7; i++)
text.Append("\"").Append(item[i]).Append("\";"); _ = text.Append('"').Append(item[i]).Append("\";");
text.Remove(text.Length - 1, 1); _ = text.Remove(text.Length - 1, 1);
text.AppendLine(); _ = text.AppendLine();
} }
ParametersAsCsv = text.ToString(); ParametersAsCsv = text.ToString();
foreach (PDSFConfigurationDataCollectionGeneralTriggers item in configuration.DataCollection.GeneralTriggers) foreach (PDSFConfigurationDataCollectionGeneralTriggers item in configuration.DataCollection.GeneralTriggers)
@ -137,28 +148,26 @@ namespace EDAViewer.Singleton.Helper
} }
{ {
PDSFConfigurationDataCollectionStartTriggersDCP item = configuration.DataCollection.StartTriggers.DCP; PDSFConfigurationDataCollectionStartTriggersDCP item = configuration.DataCollection.StartTriggers.DCP;
if (!(item is null)) if (item is not null)
StartTriggersDCP.Add(new string[] { item.Name, item.Rule, item.ResolveGlobalVariableBeforeTrigger.ToString() }); StartTriggersDCP.Add(new string[] { item.Name, item.Rule, item.ResolveGlobalVariableBeforeTrigger.ToString() });
} }
if (!(configuration.DataCollection.Logistics.Triggers.UpdateTrigger is null)) if (configuration.DataCollection.Logistics.Triggers.UpdateTrigger is not null)
{ {
foreach (PDSFConfigurationDataCollectionLogisticsTriggersUpdateTriggerLogisticRequest item in configuration.DataCollection.Logistics.Triggers.UpdateTrigger.LogisticRequest) foreach (PDSFConfigurationDataCollectionLogisticsTriggersUpdateTriggerLogisticRequest item in configuration.DataCollection.Logistics.Triggers.UpdateTrigger.LogisticRequest)
{ {
LogisticsTriggers.Add(new string[] { item.Name.ToString(), item.LogisticsColumn.Fixed.ToString(), item.Rule, item.Keys.Scenario, item.Keys.DefaultJobIndex.ToString(), item.Keys.DefaultCarrierIndex.ToString(), item.Keys.DefaultSlotIndex.ToString(), item.DataPool.ToString() }); LogisticsTriggers.Add(new string?[] { item.Name.ToString(), item.LogisticsColumn.Fixed.ToString(), item.Rule, item.Keys.Scenario, item.Keys.DefaultJobIndex.ToString(), item.Keys.DefaultCarrierIndex.ToString(), item.Keys.DefaultSlotIndex.ToString(), item.DataPool.ToString() });
if (!(item.Keys.KeyMapping is null)) if (item.Keys.KeyMapping is not null)
LogisticsTriggersKeysKeyMapping.Add(item.Name, new string[] { item.Keys.KeyMapping.KeyName, item.Keys.KeyMapping.ParameterName, item.Keys.KeyMapping.Formula }); LogisticsTriggersKeysKeyMapping.Add(item.Name, new string[] { item.Keys.KeyMapping.KeyName, item.Keys.KeyMapping.ParameterName, item.Keys.KeyMapping.Formula });
LogisticsTriggersCallDefinitionAttributes.Add(item.Name, new List<string[]>()); LogisticsTriggersCallDefinitionAttributes.Add(item.Name, new());
foreach (PDSFConfigurationDataCollectionLogisticsTriggersUpdateTriggerLogisticRequestCallDefinitionLogisticCallDefinitionAttribute att in item.CallDefinition.Attributes) foreach (PDSFConfigurationDataCollectionLogisticsTriggersUpdateTriggerLogisticRequestCallDefinitionLogisticCallDefinitionAttribute att in item.CallDefinition.Attributes)
LogisticsTriggersCallDefinitionAttributes[item.Name].Add(new string[] { att.LogisticsKey, att.Source, att.MappedParameterName, att.Formula }); LogisticsTriggersCallDefinitionAttributes[item.Name].Add(new string[] { att.LogisticsKey, att.Source, att.MappedParameterName, att.Formula });
} }
} }
{ {
PDSFConfigurationDataCollectionStopTriggersDCP item = configuration.DataCollection.StopTriggers.DCP; PDSFConfigurationDataCollectionStopTriggersDCP item = configuration.DataCollection.StopTriggers.DCP;
if (!(item is null)) if (item is not null)
StopTriggersDCP.Add(new string[] { item.Name, item.Rule, item.ResolveGlobalVariableBeforeTrigger.ToString(), item.ResetGlobalVariablesAfterTrigger.ToString() }); StopTriggersDCP.Add(new string[] { item.Name, item.Rule, item.ResolveGlobalVariableBeforeTrigger.ToString(), item.ResetGlobalVariablesAfterTrigger.ToString() });
} }
} }
}
} }

View File

@ -1,8 +1,6 @@
namespace EDAViewer.Singleton.Helper namespace EDAViewer.Singleton.Helper;
{
public enum ModuleInstanceTypeName
{
Pdsf
}
public enum ModuleInstanceTypeName
{
Pdsf
} }

View File

@ -1,28 +0,0 @@
using EDAViewer.Models;
using Microsoft.Extensions.Logging;
using Shared;
using System;
using System.Collections.Generic;
using System.Net;
namespace EDAViewer.Singleton
{
public interface IBackground : Models.IBackground, IDisposable
{
void ClearMessage();
void SendStatusOk();
string Message { get; }
bool IsPrimaryInstance();
void SetIsPrimaryInstance();
void ClearIsPrimaryInstance();
string WorkingDirectory { get; }
List<Exception> Exceptions { get; }
void Update(ILogger<object> logger);
string GetCountDirectory(string verb);
void LogPathCleanUpByWeek(string server, bool isEDA = false, bool isNA = false);
}
}

View File

@ -1,156 +0,0 @@
using EDAViewer.HostedService;
using EDAViewer.Models;
using EDAViewer.Singleton;
using Helper.Log;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Models;
using Shared;
using System;
using System.IO;
using System.Net;
using System.Reflection;
namespace EDAViewer
{
public class Startup
{
private Background _Background;
private AppSettings _AppSettings;
private readonly IsEnvironment _IsEnvironment;
private readonly IConfiguration _Configuration;
private readonly IWebHostEnvironment _WebHostEnvironment;
public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
{
_Configuration = configuration;
_WebHostEnvironment = webHostEnvironment;
_IsEnvironment = new IsEnvironment(webHostEnvironment.IsDevelopment(), webHostEnvironment.IsStaging(), webHostEnvironment.IsProduction());
}
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
LogLevel defaultLogLevel;
LogLevel log4netLogLevel;
IConfigurationSection configurationSection;
configurationSection = _Configuration.GetSection("Logging:LogLevel:Default");
if (configurationSection is null || configurationSection.Value is null)
defaultLogLevel = LogLevel.Debug;
else if (!Enum.TryParse<LogLevel>(configurationSection.Value, out defaultLogLevel))
defaultLogLevel = LogLevel.Debug;
configurationSection = _Configuration.GetSection("Logging:LogLevel:Log4netProvider");
if (configurationSection is null || configurationSection.Value is null)
log4netLogLevel = defaultLogLevel;
else if (!Enum.TryParse<LogLevel>(configurationSection.Value, out log4netLogLevel))
log4netLogLevel = defaultLogLevel;
_AppSettings = _Configuration.Get<AppSettings>();
if (!_IsEnvironment.Production)
_AppSettings.Server = _AppSettings.Server.Replace('.', '_');
if (string.IsNullOrEmpty(_AppSettings.WorkingDirectoryName))
throw new Exception("Working directory name must have a value!");
Assembly assembly = Assembly.GetExecutingAssembly();
string workingDirectory = Log.GetWorkingDirectory(assembly.GetName().Name, _AppSettings.WorkingDirectoryName);
services.AddLogging(logging =>
{
logging.AddProvider(new DebugProvider(defaultLogLevel));
logging.AddProvider(new ConsoleProvider(defaultLogLevel));
logging.AddProvider(new Log4netProvider(typeof(Startup), log4netLogLevel, workingDirectory));
});
services.AddDirectoryBrowser();
services.AddControllersWithViews().AddRazorRuntimeCompilation();
services.AddServerSideBlazor();
// services.AddSingleton<WebClient, WebClient>();
// services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
_Background = new Background(_IsEnvironment, _AppSettings, workingDirectory);
services.AddSingleton<Singleton.IBackground, Background>(b => _Background);
services.AddSingleton<AppSettings, AppSettings>(appSettings => _AppSettings);
services.AddSingleton<IsEnvironment, IsEnvironment>(isEnvironment => _IsEnvironment);
services.AddHostedService(t => new TimedHostedService(_IsEnvironment, _Background, t.GetRequiredService<IServiceProvider>()));
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "EDAViewer", Version = "v1" });
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
{
if (env.IsDevelopment())
{
if (string.IsNullOrEmpty(_AppSettings.URLs))
{
Environment.ExitCode = -1;
lifetime.StopApplication();
}
app.UseDeveloperExceptionPage();
app.UseSwagger(c =>
{
c.SerializeAsV2 = true;
});
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "EDA Viewer API V1");
c.RoutePrefix = string.Empty;
});
}
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();
app.UseSwagger(c =>
{
c.SerializeAsV2 = true;
});
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/EDAViewer/swagger/v1/swagger.json", "EDA Viewer API V1");
c.RoutePrefix = string.Empty;
});
}
app.UseDirectoryBrowser(new DirectoryBrowserOptions
{
FileProvider = new PhysicalFileProvider(Path.Combine(env.WebRootPath, "images")),
RequestPath = "/MyImages"
});
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
//endpoints.MapBlazorHub();
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
}
}

View File

@ -1,47 +0,0 @@
@using EDAViewer.Controllers
@{
ViewBag.Title = "Background";
int i = 0;
string homeController = nameof(HomeController).Replace("Controller", string.Empty);
}
<div class="jumbotron">
<h1>EDA - @(ViewBag.IsPrimaryInstance) - @(ViewBag.Profile) - @(ViewBag.URLs) - 013</h1>
<p class="lead">@(ViewBag.WorkingDirectory)</p>
<p class="lead">@(ViewBag.Message)</p>
<h1>@(ViewBag.ExceptionsCount)</h1>
</div>
<div>
<ul>
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))">Background Message</a></li>
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-message_clear="true">Background Message Clear</a></li>
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-exceptions_clear="true">Background Exceptions Clear</a></li>
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-set_is_primary_instance="true">Background Set Is Primary Instance</a></li>
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-set_is_primary_instance="false">Background Clear Primary Instance</a></li>
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-invoke_eda_dcp="100">Background Invoke EDA DCP Plans Timer Change</a></li>
</ul>
</div>
<p>&nbsp;</p>
<hr />
<div>
<form action="">
@foreach (Exception exception in ViewBag.Exceptions)
{
<p>
@Html.Raw(string.Concat("<textarea name=\"message_", i, "\" rows='1' cols='400'>", exception.Message, "</textarea>"));
</p>
<p>
@Html.Raw(string.Concat("<textarea name=\"stackTrace_", i, "\" rows='4' cols='400'>", exception.StackTrace, "</textarea>"));
</p>
<hr />
@(i += 1);
}
</form>
</div>
@section scripts {
<script>
$(function () {
console.log("ready!");
});
</script>
}

View File

@ -1,12 +0,0 @@
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>
<div>
<component render-mode="ServerPrerendered" type="typeof(EDAViewer.Blazor.Counter)" />
</div>

View File

@ -1,6 +0,0 @@
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>

View File

@ -1,182 +0,0 @@
@model EDAViewer.Models.EdaHtmlDiff
@{
ViewBag.Title = "EDA HTML Diff";
string idForm = "Form";
string idSubmit = "Submit";
string idUp = "Up";
string idRoot = "Root";
string idRefresh = "Refresh";
string background = "Background"; //Background
string viewEdaHtmlDiff = "ViewEdaHtmlDiff"; //ViewEdaHtmlDiff
string actionNameForForm = nameof(EDAViewer.Controllers.HomeController.ViewEdaHtmlDiff);
string actionNameForList = nameof(EDAViewer.Controllers.HomeController.GetDirectoriesOrFiles);
string homeController = nameof(EDAViewer.Controllers.HomeController).Replace("Controller", string.Empty);
}
<div class="jumbotron">
<h1>@(ViewBag.Message)</h1>
</div>
<div>
@Html.Raw(ViewBag.Diff)
<hr />
@Html.Raw(ViewBag.OldText)
<hr />
@Html.Raw(ViewBag.NewText)
<hr />
<div style="min-height:44px;">
<button id="@(idRoot)" style="margin-left: 50px; margin-bottom:10px" class="btn btn-info">Root Directory</button>
<button id="@(idUp)" style="margin-left: 50px; margin-bottom:10px" class="btn btn-info">Up Directory</button>
<button id="@(idRefresh)" style="margin-left: 50px; margin-bottom:10px" class="btn btn-info">Refresh List</button>
</div>
@using (Html.BeginForm(actionNameForForm, homeController, FormMethod.Post, new { id = idForm }))
{
@Html.AntiForgeryToken();
@Html.ValidationSummary(true);
@Html.HiddenFor(m => m.user_name)
@Html.HiddenFor(m => m.machine_name)
@Html.HiddenFor(m => m.now_ticks)
@Html.HiddenFor(m => m.PathAndFileName)
@Html.HiddenFor(m => m.Paths)
<p>
@Html.LabelFor(m => m.CurrentPath)
@Html.DropDownListFor(m => m.CurrentPath, new SelectList(Enumerable.Empty<SelectListItem>()), htmlAttributes: new { style = "min-width:600px" })
@Html.ValidationMessageFor(m => m.CurrentPath)
</p>
<p>
@Html.LabelFor(m => m.FileName)
@Html.TextBoxFor(m => m.FileName, htmlAttributes: new { style = "min-width:600px" })
@Html.ValidationMessageFor(m => m.FileName)
</p>
<br />
<input type="submit" value="Save" id="@(idSubmit)" class="btn btn-default" />
}
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.RouteLink("View EDA HTML Diff", new { action = viewEdaHtmlDiff, controller = homeController })</li>
<li>@Html.RouteLink("Background Invoke EDA DCP Plans Timer Change", new { action = background, controller = homeController, invoke_eda_dcp = 100 })</li>
</ul>
</div>
@section scripts {
<script>
//
function getEncodedLastPath() {
var encodedPath;
var control = "@(nameof(Model.Paths))";
encodedPath = $("#" + control).val().substr(0, $("#" + control).val().lastIndexOf("|"));
$("#" + control).val(encodedPath)
encodedPath = encodeURIComponent($("#" + control).val());
return encodedPath;
}
//
function getEncodedCurrentPath() {
var encodedPath;
var control = "@(nameof(Model.CurrentPath))";
var pathSelected = $("#" + control).val();
if (pathSelected == null) {
encodedPath = "";
}
else {
$("#@(nameof(Model.FileName))").val($("#" + control + " option:selected").text());
$("#@(nameof(Model.PathAndFileName))").val(pathSelected);
encodedPath = encodeURIComponent(pathSelected);
}
return encodedPath;
}
//
function setList(prefix, encodedPath, upDirectory) {
var actionName = prefix + "@(actionNameForList)?path=" + encodedPath + "&upDirectory=" + upDirectory + "&filter=";
$('select').empty();
$("#@(idUp)").hide();
$("#@(idRoot)").hide();
$("#@(idRefresh)").hide();
$("#@(nameof(Model.CurrentPath))").hide();
//
$.ajax({
url: actionName,
type: "GET",
contentType: "application/json; charset=utf-8",
datatype: JSON,
success: function (result) {
if (result.length > 7000) {
setList("../", encodedPath, upDirectory);
}
else {
var control = "@(nameof(Model.CurrentPath))";
$(result).each(function (index, value) {
$("#" + control).append($("<option></option>").val(value.value).html(value.text));
});
console.log("results lenght {" + result.length + "}");
if (result.length == 1) {
console.log("selecting first option");
$("select#elem").attr('selectedIndex', 0);
console.log("selected first option");
}
$("#@(nameof(Model.CurrentPath))").show();
$("#@(idRefresh)").show();
$("#@(idRoot)").show();
$("#@(idUp)").show();
}
},
error: function (data) {
console.log(data);
},
always: function (data) {
$("#@(nameof(Model.CurrentPath))").show();
$("#@(idRefresh)").show();
$("#@(idRoot)").show();
$("#@(idUp)").show();
}
});
}
$(document).ready(function () {
//
console.log("ready!");
//
$("#@(idRefresh)").click(function (e) {
$('#message').html('');
var encodedPath = getEncodedCurrentPath();
setList("", encodedPath, false);
});
//
$("#@(idUp)").click(function (e) {
$('#message').html('');
var encodedPath = getEncodedLastPath();
setList("", encodedPath, true);
});
//
$("#@(idRoot)").click(function (e) {
$('#message').html('');
var encodedPath = "";
setList("", encodedPath, false);
});
//
$("#@(idSubmit)").click(function (e) {
//$("#@(idSubmit)").hide();
//e.preventDefault();
});
//
$("select").change(function () {
var str = "";
$("select option:selected").each(function () {
str += $(this).text() + " ";
});
console.debug(str);
if (str.length > 0) {
var control = "@(nameof(Model.CurrentPath))";
var encodedPath = getEncodedCurrentPath();
if (encodedPath.length > 0) {
var pathsValue =$("#@(nameof(Model.Paths))").val();
$("#@(nameof(Model.Paths))").val(pathsValue + "|" + $("#" + control).val());
}
setList("", encodedPath, false);
}
}).change();
//
$("#@(idForm)").removeAttr("novalidate");
//
setList("", encodeURIComponent("@(Model.CurrentPath.Replace(@"\",@"\\"))"), false);
//
});
</script>
}

View File

@ -1,25 +0,0 @@
@model ErrorViewModel
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>

View File

@ -1,71 +0,0 @@
@using EDAViewer.Controllers
@{
string index = nameof(HomeController.Index);
string privacy = nameof(HomeController.Privacy);
string background = nameof(HomeController.Background);
string homeController = nameof(HomeController).Replace("Controller", string.Empty);
string schemeHostURL = string.Concat(Context.Request.Scheme, "://", Context.Request.Host);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
@await RenderSectionAsync("Meta", required: false)
<title>@ViewData["Title"] - EDAViewer</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<environment exclude="Staging,Development">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="@(schemeHostURL)/Common%20Shared%20Repository/HTML5Shiv/3.7.2/html5shiv.js"></script>
<script src="@(schemeHostURL)/Common%20Shared%20Repository/Respond/1.4.2/respond.js"></script>
<![endif]-->
</environment>
<link href="~/css/bundles/css.css" rel="stylesheet" />
<base href="~/" />
@await RenderSectionAsync("Style", required: false)
<script src="~/js/bundles/modernizr.js"></script>
</head>
<body>
<header>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" asp-area="" asp-controller="@(homeController)" asp-action="@(index)">EDA Viewer</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="@(homeController)" asp-action="@(background)">Background</a>
</li>
</ul>
</div>
</div>
</div>
</header>
<div class="container body-content">
@RenderBody()
</div>
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2021 - EDAViewer - <a asp-area="" asp-controller="@(homeController)" asp-action="@(privacy)">Privacy</a>
</div>
</footer>
<script src="~/js/bundles/jquery.js"></script>
<script src="~/js/bundles/bootstrap.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
<!--script src="_framework/blazor.server.js" asp-append-version="true"></script-->
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>

View File

@ -1,2 +0,0 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

View File

@ -1,3 +0,0 @@
@using EDAViewer
@using EDAViewer.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -1,3 +0,0 @@
@{
Layout = "_Layout";
}

View File

@ -1,7 +1,136 @@
{ {
"BuildNumber": "1",
"Company": "Infineon Technologies Americas Corp.", "Company": "Infineon Technologies Americas Corp.",
"Drives": [
{
"Use": false,
"Letter": "a",
"Share": "Floppy Disk",
"User": "",
"Password": ""
},
{
"Use": false,
"Letter": "c",
"Share": "SYSTEM",
"User": "",
"Password": ""
},
{
"Use": false,
"Letter": "d",
"Share": "DATA",
"User": "",
"Password": ""
},
{
"Use": true,
"Letter": "g",
"Share": "\\\\10.95.154.12\\testdata",
"User": "10.95.154.12\\Manager",
"Password": "D6QDJ5g6vjqnNyyRbfbj+g=="
},
{
"Use": false,
"Letter": "h",
"Share": "\\\\10.95.154.13\\COM 5",
"User": "10.95.154.13\\user",
"Password": "tVyC7uPHtScZR8NLInSaxQ=="
},
{
"Use": true,
"Letter": "i",
"Share": "\\\\messdv002.na.infineon.com\\Candela",
"User": "INFINEON\\MESGaNEAF",
"Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k="
},
{
"Use": false,
"Letter": "j",
"Share": "\\\\messdv002.na.infineon.com\\Characterization",
"User": "INFINEON\\MESGaNEAF",
"Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k="
},
{
"Use": true,
"Letter": "k",
"Share": "\\\\messdv002.na.infineon.com\\GaN_NEC\\Characterization",
"User": "INFINEON\\MESGaNEAF",
"Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k="
},
{
"Use": false,
"Letter": "l",
"Share": "TFS",
"User": "",
"Password": ""
},
{
"Use": false,
"Letter": "m",
"Share": "\\\\messdv002.na.infineon.com\\MOCVD",
"User": "EC\\ECMESEAF",
"Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00="
},
{
"Use": true,
"Letter": "n",
"Share": "\\\\10.95.154.22\\C",
"User": "10.95.154.22\\Aixtron",
"Password": "DYVBOr2HJdB7KOhd/IFhLA=="
},
{
"Use": true,
"Letter": "o",
"Share": "\\\\10.95.154.16\\Aixtron",
"User": "10.95.154.16\\Aixtron",
"Password": "DYVBOr2HJdB7KOhd/IFhLA=="
},
{
"Use": true,
"Letter": "p",
"Share": "\\\\10.95.154.15\\Aixtron",
"User": "10.95.154.15\\Aixtron",
"Password": "DYVBOr2HJdB7KOhd/IFhLA=="
},
{
"Use": true,
"Letter": "q",
"Share": "\\\\10.95.154.21\\Data",
"User": "10.95.154.21\\XRD04Admin",
"Password": "v1NOsEOCvbnhzKabspPcCQ=="
},
{
"Use": true,
"Letter": "r",
"Share": "\\\\10.95.154.23\\Data",
"User": "\"10.95.154.23\\infineon us\"",
"Password": "rzXkXdHKetDfsukhZKW0yA=="
},
{
"Use": true,
"Letter": "s",
"Share": "\\\\messv02ecc1.ec.local\\EC_EAFRepository",
"User": "EC\\ECMESEAF",
"Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00="
},
{
"Use": true,
"Letter": "t",
"Share": "\\\\messv02ecc1.ec.local\\EC_EDA",
"User": "EC\\ECEDASvc",
"Password": "IKsJmRVUH3xlv+RRELRbwoXYKwLvF4Re7k1Rigzpwf4="
},
{
"Use": false,
"Letter": "z",
"Share": "DVD Drive",
"User": "",
"Password": ""
}
],
"ECEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==", "ECEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
"EncryptedPassword": "K1RyLhaIRyJTDbWutsuWWEiO2hTD3h7fW0BV/Cp+Ftw=", "GitCommitSeven": "1234567",
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Debug", "Default": "Debug",
@ -12,8 +141,44 @@
}, },
"IFXEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==", "IFXEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
"MonARessource": "EDA_Viewer_IFX", "MonARessource": "EDA_Viewer_IFX",
"Serilog": {
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.File"
],
"MinimumLevel": "Debug",
"WriteTo": [
{
"Name": "Debug",
"Args": {
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
}
},
{
"Name": "Console",
"Args": {
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"path": "%workingDirectory% - Log/log-.txt",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}",
"rollingInterval": "Hour"
}
}
],
"Enrich": [
"FromLogContext",
"WithMachineName",
"WithThreadId"
],
"Properties": {
"Application": "Sample"
}
},
"Server": "messv02ecc1_ec_local", "Server": "messv02ecc1_ec_local",
"ServiceUser": "mesedasvc", "URLs": "http://localhost:5001;",
"URLs": "http://localhost:5000;",
"WorkingDirectoryName": "IFXApps" "WorkingDirectoryName": "IFXApps"
} }

View File

@ -1,7 +1,136 @@
{ {
"BuildNumber": "1",
"Company": "Infineon Technologies Americas Corp.", "Company": "Infineon Technologies Americas Corp.",
"Drives": [
{
"Use": false,
"Letter": "a",
"Share": "Floppy Disk",
"User": "",
"Password": ""
},
{
"Use": false,
"Letter": "c",
"Share": "SYSTEM",
"User": "",
"Password": ""
},
{
"Use": false,
"Letter": "d",
"Share": "DATA",
"User": "",
"Password": ""
},
{
"Use": true,
"Letter": "g",
"Share": "\\\\10.95.154.12\\testdata",
"User": "10.95.154.12\\Manager",
"Password": "D6QDJ5g6vjqnNyyRbfbj+g=="
},
{
"Use": false,
"Letter": "h",
"Share": "\\\\10.95.154.13\\COM 5",
"User": "10.95.154.13\\user",
"Password": "tVyC7uPHtScZR8NLInSaxQ=="
},
{
"Use": true,
"Letter": "i",
"Share": "\\\\messdv002.na.infineon.com\\Candela",
"User": "INFINEON\\MESGaNEAF",
"Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k="
},
{
"Use": false,
"Letter": "j",
"Share": "\\\\messdv002.na.infineon.com\\Characterization",
"User": "INFINEON\\MESGaNEAF",
"Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k="
},
{
"Use": true,
"Letter": "k",
"Share": "\\\\messdv002.na.infineon.com\\GaN_NEC\\Characterization",
"User": "INFINEON\\MESGaNEAF",
"Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k="
},
{
"Use": false,
"Letter": "l",
"Share": "TFS",
"User": "",
"Password": ""
},
{
"Use": false,
"Letter": "m",
"Share": "\\\\messdv002.na.infineon.com\\MOCVD",
"User": "EC\\ECMESEAF",
"Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00="
},
{
"Use": true,
"Letter": "n",
"Share": "\\\\10.95.154.22\\C",
"User": "10.95.154.22\\Aixtron",
"Password": "DYVBOr2HJdB7KOhd/IFhLA=="
},
{
"Use": true,
"Letter": "o",
"Share": "\\\\10.95.154.16\\Aixtron",
"User": "10.95.154.16\\Aixtron",
"Password": "DYVBOr2HJdB7KOhd/IFhLA=="
},
{
"Use": true,
"Letter": "p",
"Share": "\\\\10.95.154.15\\Aixtron",
"User": "10.95.154.15\\Aixtron",
"Password": "DYVBOr2HJdB7KOhd/IFhLA=="
},
{
"Use": true,
"Letter": "q",
"Share": "\\\\10.95.154.21\\Data",
"User": "10.95.154.21\\XRD04Admin",
"Password": "v1NOsEOCvbnhzKabspPcCQ=="
},
{
"Use": true,
"Letter": "r",
"Share": "\\\\10.95.154.23\\Data",
"User": "\"10.95.154.23\\infineon us\"",
"Password": "rzXkXdHKetDfsukhZKW0yA=="
},
{
"Use": true,
"Letter": "s",
"Share": "\\\\messv02ecc1.ec.local\\EC_EAFRepository",
"User": "EC\\ECMESEAF",
"Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00="
},
{
"Use": true,
"Letter": "t",
"Share": "\\\\messv02ecc1.ec.local\\EC_EDA",
"User": "EC\\ECEDASvc",
"Password": "IKsJmRVUH3xlv+RRELRbwoXYKwLvF4Re7k1Rigzpwf4="
},
{
"Use": false,
"Letter": "z",
"Share": "DVD Drive",
"User": "",
"Password": ""
}
],
"ECEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==", "ECEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
"EncryptedPassword": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00=", "GitCommitSeven": "1234567",
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
@ -12,8 +141,44 @@
}, },
"IFXEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==", "IFXEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
"MonARessource": "EDA_Viewer_EC", "MonARessource": "EDA_Viewer_EC",
"Serilog": {
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.File"
],
"MinimumLevel": "Information",
"WriteTo": [
{
"Name": "Debug",
"Args": {
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
}
},
{
"Name": "Console",
"Args": {
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"path": "%workingDirectory% - Log/log-.txt",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}",
"rollingInterval": "Hour"
}
}
],
"Enrich": [
"FromLogContext",
"WithMachineName",
"WithThreadId"
],
"Properties": {
"Application": "Sample"
}
},
"Server": "messv02ecc1.ec.local", "Server": "messv02ecc1.ec.local",
"ServiceUser": "ECMESEAF", "URLs": "http://localhost:5001;",
"URLs": "http://localhost:5002;",
"WorkingDirectoryName": "IFXApps" "WorkingDirectoryName": "IFXApps"
} }

Some files were not shown because too many files have changed in this diff Show More