Ready to start testing
This commit is contained in:
parent
5368852e1b
commit
69f48e9034
10
.gitignore
vendored
10
.gitignore
vendored
@ -22,7 +22,6 @@ x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
@ -328,3 +327,12 @@ ASALocalRun/
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
##
|
||||
## Visual Studio Code
|
||||
##
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
336
Adaptation/.editorconfig
Normal file
336
Adaptation/.editorconfig
Normal file
@ -0,0 +1,336 @@
|
||||
# Remove the line below if you want to inherit .editorconfig settings from higher directories
|
||||
root = true
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
#### Core EditorConfig Options ####
|
||||
|
||||
# Indentation and spacing
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
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_else = true
|
||||
csharp_new_line_before_finally = true
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = true
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
|
||||
# Space preferences
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
# Wrapping preferences
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = false
|
||||
|
||||
#### Naming styles ####
|
||||
|
||||
# Naming rules
|
||||
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||
|
||||
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning
|
||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field
|
||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||
|
||||
dotnet_naming_rule.enum_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum
|
||||
dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case
|
||||
|
||||
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.symbols = public_or_protected_field
|
||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||
|
||||
dotnet_naming_rule.class_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.class_should_be_pascal_case.symbols = class
|
||||
dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.method_should_be_pascal_case.symbols = method
|
||||
dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning
|
||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field
|
||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||
|
||||
dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning
|
||||
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.symbols = abstract_method
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method
|
||||
dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case
|
||||
|
||||
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.symbols = delegate
|
||||
dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.struct_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct
|
||||
dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case
|
||||
|
||||
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
|
||||
|
||||
# Symbol specifications
|
||||
|
||||
dotnet_naming_symbols.class.applicable_kinds = class
|
||||
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.class.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interface.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.struct.applicable_kinds = struct
|
||||
dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.struct.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.enum.applicable_kinds = enum
|
||||
dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.enum.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.delegate.applicable_kinds = delegate
|
||||
dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.delegate.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.event.applicable_kinds = event
|
||||
dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.event.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.method.applicable_kinds = method
|
||||
dotnet_naming_symbols.method.applicable_accessibilities = public
|
||||
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_suffix =
|
||||
dotnet_naming_style.begins_with_i.word_separator =
|
||||
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||
|
||||
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.word_separator =
|
||||
dotnet_naming_style.private_of_internal_field.capitalization = pascal_case
|
46
Adaptation/.vscode/extensions.json
vendored
Normal file
46
Adaptation/.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"adrianwilczynski.asp-net-core-switcher",
|
||||
"adrianwilczynski.namespace",
|
||||
"adrianwilczynski.terminal-commands",
|
||||
"aliasadidev.nugetpackagemanagergui",
|
||||
"bodil.file-browser",
|
||||
"codezombiech.gitignore",
|
||||
"cweijan.vscode-office",
|
||||
"donjayamanne.githistory",
|
||||
"EditorConfig.EditorConfig",
|
||||
"eg2.vscode-npm-script",
|
||||
"esbenp.prettier-vscode",
|
||||
"formulahendry.dotnet-test-explorer",
|
||||
"GitHub.remotehub",
|
||||
"GitHub.vscode-pull-request-github",
|
||||
"hashhar.gitattributes",
|
||||
"hediet.vscode-drawio",
|
||||
"mikeburgh.xml-format",
|
||||
"ms-dotnettools.blazorwasm-companion",
|
||||
"ms-dotnettools.csharp",
|
||||
"ms-dotnettools.vscode-dotnet-runtime",
|
||||
"ms-edgedevtools.vscode-edge-devtools",
|
||||
"ms-vscode-remote.remote-ssh",
|
||||
"ms-vscode-remote.remote-ssh-edit",
|
||||
"ms-vscode.powershell",
|
||||
"patcx.vscode-nuget-gallery",
|
||||
"rangav.vscode-thunder-client",
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"VirtusLab.codetale",
|
||||
"VisualStudioExptTeam.vscodeintellicode",
|
||||
"vscode-icons-team.vscode-icons"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
"virtuslab.codetale",
|
||||
"ms-azuretools.vscode-docker",
|
||||
"christian-kohler.npm-intellisense",
|
||||
"firefox-devtools.vscode-firefox-debug",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"dbaeumer.jshint",
|
||||
"felipecaputo.git-project-manager",
|
||||
"eamodio.gitlens",
|
||||
"hookyqr.beautify",
|
||||
"davidanson.vscode-markdownlint"
|
||||
]
|
||||
}
|
1
Adaptation/.vscode/format-report.json
vendored
Normal file
1
Adaptation/.vscode/format-report.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[]
|
10
Adaptation/.vscode/launch.json
vendored
Normal file
10
Adaptation/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach",
|
||||
"processId": 16816
|
||||
}
|
||||
]
|
||||
}
|
72
Adaptation/.vscode/settings.json
vendored
Normal file
72
Adaptation/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"Analyte",
|
||||
"CICN",
|
||||
"EGANAIXG",
|
||||
"ELODS",
|
||||
"EQPT",
|
||||
"etcs",
|
||||
"GRATXT",
|
||||
"grpf",
|
||||
"Hmmssfff",
|
||||
"hvfet",
|
||||
"Icpms",
|
||||
"IPDSF",
|
||||
"Irmn",
|
||||
"IRMNSPC",
|
||||
"ISMTP",
|
||||
"ISNULL",
|
||||
"JOBID",
|
||||
"JVXRD",
|
||||
"Klarf",
|
||||
"Lehighton",
|
||||
"Lian",
|
||||
"milli",
|
||||
"mvfet",
|
||||
"MVIN",
|
||||
"PDSF",
|
||||
"pdsfc",
|
||||
"PPID",
|
||||
"pptst",
|
||||
"RPMPL",
|
||||
"RPMXY",
|
||||
"rtsp",
|
||||
"RUNMO",
|
||||
"SIASM",
|
||||
"stddev",
|
||||
"Stks",
|
||||
"SUMMO",
|
||||
"Tesseract",
|
||||
"TIBCO",
|
||||
"TMAL",
|
||||
"TMGA",
|
||||
"TXTAPC",
|
||||
"TXTIQS",
|
||||
"Villach",
|
||||
"XRDAI",
|
||||
"XRDFWHM",
|
||||
"XRDSL",
|
||||
"XRDXRR",
|
||||
"XRDXY"
|
||||
],
|
||||
"workbench.colorCustomizations": {
|
||||
"activityBar.activeBackground": "#7ea1d9",
|
||||
"activityBar.activeBorder": "#f8e6ed",
|
||||
"activityBar.background": "#7ea1d9",
|
||||
"activityBar.foreground": "#15202b",
|
||||
"activityBar.inactiveForeground": "#15202b99",
|
||||
"activityBarBadge.background": "#f8e6ed",
|
||||
"activityBarBadge.foreground": "#15202b",
|
||||
"sash.hoverBorder": "#7ea1d9",
|
||||
"statusBar.background": "#5684ce",
|
||||
"statusBar.foreground": "#e7e7e7",
|
||||
"statusBarItem.hoverBackground": "#7ea1d9",
|
||||
"statusBarItem.remoteBackground": "#5684ce",
|
||||
"statusBarItem.remoteForeground": "#e7e7e7",
|
||||
"titleBar.activeBackground": "#5684ce",
|
||||
"titleBar.activeForeground": "#e7e7e7",
|
||||
"titleBar.inactiveBackground": "#5684ce99",
|
||||
"titleBar.inactiveForeground": "#e7e7e799"
|
||||
},
|
||||
"peacock.color": "#5684ce"
|
||||
}
|
101
Adaptation/DEP08SIASM.Tests.csproj
Normal file
101
Adaptation/DEP08SIASM.Tests.csproj
Normal file
@ -0,0 +1,101 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<Nullable>disable</Nullable>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PackageId>Infineon.Mesa.EAF.DEP08SIASM</PackageId>
|
||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||
<Version>6.0.0.0</Version>
|
||||
<Authors>Mike Phares</Authors>
|
||||
<Company>Phares</Company>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VSTestLogger>trx</VSTestLogger>
|
||||
<VSTestResultsDirectory>../../../../DEP08SIASM/05_TestResults/TestResults</VSTestResultsDirectory>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<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>
|
||||
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsWindows)'=='true'">
|
||||
<DefineConstants>Windows</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsOSX)'=='true'">
|
||||
<DefineConstants>OSX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsLinux)'=='true'">
|
||||
<DefineConstants>Linux</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.1" />
|
||||
<PackageReference Include="FFMpegCore" Version="4.7.0" />
|
||||
<PackageReference Include="Instances" Version="1.6.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="6.0.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||
<PackageReference Include="RoboSharp" Version="1.2.5" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
|
||||
<PackageReference Include="System.Data.OleDb" Version="6.0.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="6.0.1" />
|
||||
<PackageReference Include="Tesseract" Version="4.1.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="External.Common.Logging.Core" Version="3.3.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
<PackageReference Include="External.Common.Logging" Version="3.3.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
<PackageReference Include="External.Infineon.Monitoring.MonA" Version="1.2.0.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
<PackageReference Include="External.Infineon.Yoda" Version="5.2.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
<PackageReference Include="External.log4net" Version="2.0.8"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
<PackageReference Include="Tibco.Rendezvous" Version="8.5.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
<PackageReference Include="IKVM.OpenJDK.Media" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
<PackageReference Include="IKVM.OpenJDK.Text" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
<PackageReference Include="IKVM.OpenJDK.Util" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="appsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="appsettings.Development.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="tessdata/eng.traineddata">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="tessdata/pdf.ttf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
5
Adaptation/Eaf/Core/AutoGenerated/BackboneComponent.cs
Normal file
5
Adaptation/Eaf/Core/AutoGenerated/BackboneComponent.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.Core;
|
||||
|
||||
public class BackboneComponent
|
||||
{
|
||||
}
|
5
Adaptation/Eaf/Core/AutoGenerated/BackboneStatusCache.cs
Normal file
5
Adaptation/Eaf/Core/AutoGenerated/BackboneStatusCache.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.Core;
|
||||
|
||||
public class BackboneStatusCache
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.Core;
|
||||
|
||||
public interface ILoggingSetupManager
|
||||
{
|
||||
}
|
5
Adaptation/Eaf/Core/AutoGenerated/StatusItem.cs
Normal file
5
Adaptation/Eaf/Core/AutoGenerated/StatusItem.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.Core;
|
||||
|
||||
public class StatusItem
|
||||
{
|
||||
}
|
53
Adaptation/Eaf/Core/Backbone.cs
Normal file
53
Adaptation/Eaf/Core/Backbone.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using Adaptation.PeerGroup.GCL.Annotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.Eaf.Core;
|
||||
|
||||
public class Backbone
|
||||
{
|
||||
|
||||
#pragma warning disable CA1822
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
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) { }
|
||||
|
||||
}
|
24
Adaptation/Eaf/Core/Smtp/EmailMessage.cs
Normal file
24
Adaptation/Eaf/Core/Smtp/EmailMessage.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace Adaptation.Eaf.Core.Smtp;
|
||||
|
||||
public class EmailMessage
|
||||
{
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
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();
|
||||
|
||||
}
|
6
Adaptation/Eaf/Core/Smtp/ISmtp.cs
Normal file
6
Adaptation/Eaf/Core/Smtp/ISmtp.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace Adaptation.Eaf.Core.Smtp;
|
||||
|
||||
public interface ISmtp
|
||||
{
|
||||
void Send(EmailMessage message);
|
||||
}
|
8
Adaptation/Eaf/Core/Smtp/MailPriority.cs
Normal file
8
Adaptation/Eaf/Core/Smtp/MailPriority.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace Adaptation.Eaf.Core.Smtp;
|
||||
|
||||
public enum MailPriority
|
||||
{
|
||||
Low = 0,
|
||||
Normal = 1,
|
||||
High = 2
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public class ChangeDataCollectionHandler
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public class DataCollectionRequest
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public class EquipmentEvent
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public class EquipmentException
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public class EquipmentSelfDescription
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public class GetParameterValuesHandler
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public interface IConnectionControl
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public interface IDataTracingHandler
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public interface IEquipmentCommandService
|
||||
{
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using Adaptation.PeerGroup.GCL.Annotations;
|
||||
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public interface IEquipmentControl : IPackageSource
|
||||
{
|
||||
[NotNull]
|
||||
IEquipmentSelfDescriptionBuilder SelfDescriptionBuilder { get; }
|
||||
[NotNull]
|
||||
IEquipmentDataCollection DataCollection { get; }
|
||||
[NotNull]
|
||||
IEquipmentCommandService Commands { get; }
|
||||
[NotNull]
|
||||
IConnectionControl Connection { get; }
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public interface IEquipmentSelfDescriptionBuilder
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public interface IPackage
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public interface ISelfDescriptionLookup
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public interface IVirtualParameterValuesHandler
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public class SetParameterValuesHandler
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public class TraceRequest
|
||||
{
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
using Adaptation.Eaf.EquipmentCore.DataCollection.Reporting;
|
||||
using Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.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);
|
||||
}
|
5
Adaptation/Eaf/EquipmentCore/Control/IPackageSource.cs
Normal file
5
Adaptation/Eaf/EquipmentCore/Control/IPackageSource.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.Control;
|
||||
|
||||
public interface IPackageSource
|
||||
{
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription;
|
||||
using Adaptation.PeerGroup.GCL.Annotations;
|
||||
using System;
|
||||
|
||||
namespace Adaptation.Eaf.EquipmentCore.DataCollection.Reporting;
|
||||
|
||||
public class ParameterValue
|
||||
{
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
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() => base.ToString();
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||
|
||||
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription;
|
||||
|
||||
public class EquipmentParameter
|
||||
{
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
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() => base.ToString();
|
||||
public string ToStringWithDetails() => base.ToString();
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||
|
||||
public class Field
|
||||
{
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
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; }
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||
|
||||
public abstract class ParameterTypeDefinition
|
||||
{
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
public ParameterTypeDefinition(string name, string description) { }
|
||||
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
|
||||
public override string ToString() => base.ToString();
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||
|
||||
public class StructuredType : ParameterTypeDefinition
|
||||
{
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
public StructuredType(string name, string description, IList<Field> fields) : base(name, description) { }
|
||||
|
||||
public IList<Field> Fields { get; }
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
|
||||
public interface IConfigurationObject
|
||||
{
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
|
||||
[System.Runtime.Serialization.DataContractAttribute(IsReference = true)]
|
||||
public class ModelObjectParameterDefinition : IConfigurationObject
|
||||
{
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
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() => null;
|
||||
public virtual bool IsValidValue(string value) => false;
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
namespace Adaptation.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
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
using Adaptation.PeerGroup.GCL.SecsDriver;
|
||||
using System;
|
||||
|
||||
namespace Adaptation.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; }
|
||||
}
|
141
Adaptation/FileHandlers/Archive/FileRead.cs
Normal file
141
Adaptation/FileHandlers/Archive/FileRead.cs
Normal file
@ -0,0 +1,141 @@
|
||||
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Duplicator;
|
||||
using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.Archive;
|
||||
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
_Logistics = new Logistics(this);
|
||||
if (_FileParameter is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_ModelObjectParameterDefinitions is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
|
||||
|
||||
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||
|
||||
string IFileRead.GetEventDescription()
|
||||
{
|
||||
string result = _Description.GetEventDescription();
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> IFileRead.GetHeaderNames()
|
||||
{
|
||||
List<string> results = _Description.GetHeaderNames();
|
||||
return results;
|
||||
}
|
||||
|
||||
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||
{
|
||||
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||
return results;
|
||||
}
|
||||
|
||||
JsonProperty[] IFileRead.GetDefault()
|
||||
{
|
||||
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||
return results;
|
||||
}
|
||||
|
||||
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||
{
|
||||
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||
return results;
|
||||
}
|
||||
|
||||
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||
{
|
||||
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
if (string.IsNullOrEmpty(eventName))
|
||||
throw new Exception();
|
||||
_ReportFullPath = reportFullPath;
|
||||
DateTime dateTime = DateTime.Now;
|
||||
results = GetExtractResult(reportFullPath, dateTime);
|
||||
if (results.Item3 is null)
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||
WritePDSF(this, results.Item3);
|
||||
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
List<string> headerNames = _Description.GetHeaderNames();
|
||||
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||
results = ReExtract(this, headerNames, keyValuePairs);
|
||||
return results;
|
||||
}
|
||||
|
||||
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||
{
|
||||
if (_Description is not Description)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
void IFileRead.Callback(object state) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
|
||||
|
||||
private void MoveArchive(DateTime dateTime)
|
||||
{
|
||||
if (dateTime == DateTime.MinValue)
|
||||
{ }
|
||||
string logisticsSequence = _Logistics.Sequence.ToString();
|
||||
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
string weekDirectory = string.Concat(_Logistics.DateTimeFromSequence.ToString("yyyy"), "_Week_", weekOfYear, @"\", _Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd"));
|
||||
string jobIdDirectory = string.Concat(_FileConnectorConfiguration.TargetFileLocation, @"\", _Logistics.JobID);
|
||||
if (!Directory.Exists(jobIdDirectory))
|
||||
_ = Directory.CreateDirectory(jobIdDirectory);
|
||||
//string destinationArchiveDirectory = string.Concat(jobIdDirectory, @"\!Archive\", weekDirectory);
|
||||
string destinationArchiveDirectory = string.Concat(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation), @"\Archive\", _Logistics.JobID, @"\", weekDirectory);
|
||||
if (!Directory.Exists(destinationArchiveDirectory))
|
||||
_ = Directory.CreateDirectory(destinationArchiveDirectory);
|
||||
string[] matchDirectories = new string[] { GetDirectoriesRecursively(jobIdDirectory, logisticsSequence).FirstOrDefault() };
|
||||
if ((matchDirectories is null) || matchDirectories.Length != 1)
|
||||
throw new Exception("Didn't find directory by logistics sequence");
|
||||
string sourceDirectory = Path.GetDirectoryName(matchDirectories[0]);
|
||||
destinationArchiveDirectory = string.Concat(destinationArchiveDirectory, @"\", Path.GetFileName(sourceDirectory));
|
||||
Directory.Move(sourceDirectory, destinationArchiveDirectory);
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||
SetFileParameterLotIDToLogisticsMID();
|
||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
||||
Tuple<Test[], Dictionary<Test, List<Shared.Properties.IDescription>>> tuple = GetTuple(this, descriptions, extra: false);
|
||||
MoveArchive(dateTime);
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tuple.Item1, jsonElements, new List<FileInfo>());
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
40
Adaptation/FileHandlers/CellInstanceConnectionName.cs
Normal file
40
Adaptation/FileHandlers/CellInstanceConnectionName.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.FileHandlers;
|
||||
|
||||
public class CellInstanceConnectionName
|
||||
{
|
||||
|
||||
internal static IFileRead Get(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted)
|
||||
{
|
||||
IFileRead result;
|
||||
bool isDuplicator = cellInstanceConnectionName.StartsWith(cellInstanceName);
|
||||
if (isDuplicator)
|
||||
{
|
||||
string cellInstanceConnectionNameBase = cellInstanceConnectionName.Replace("-", string.Empty);
|
||||
int hyphens = cellInstanceConnectionName.Length - cellInstanceConnectionNameBase.Length;
|
||||
result = hyphens switch
|
||||
{
|
||||
(int)DEP08SIASM.Hyphen.IsArchive => new Archive.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||
(int)DEP08SIASM.Hyphen.IsDummy => new Dummy.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||
(int)DEP08SIASM.Hyphen.IsXToArchive => new ToArchive.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||
_ => new DEP08SIASM.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
result = cellInstanceConnectionName switch
|
||||
{
|
||||
nameof(DownloadJpegFile) => new DownloadJpegFile.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||
nameof(jpeg) => new jpeg.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
|
||||
_ => throw new Exception(),
|
||||
};
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
198
Adaptation/FileHandlers/DEP08SIASM/FileRead.cs
Normal file
198
Adaptation/FileHandlers/DEP08SIASM/FileRead.cs
Normal file
@ -0,0 +1,198 @@
|
||||
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Duplicator;
|
||||
using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
|
||||
namespace Adaptation.FileHandlers.DEP08SIASM;
|
||||
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private readonly bool _IsDummy;
|
||||
private readonly bool _IsXToAPC;
|
||||
private readonly bool _IsXToIQS;
|
||||
private readonly bool _IsXToSPaCe;
|
||||
private readonly bool _IsXToSPaCeVillach;
|
||||
private readonly Dictionary<string, string> _CellNames;
|
||||
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
_Logistics = new Logistics(this);
|
||||
if (_FileParameter is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_ModelObjectParameterDefinitions is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_IsDummy = _Hyphens == (int)Hyphen.IsDummy;
|
||||
_IsXToAPC = _Hyphens == (int)Hyphen.IsXToAPC;
|
||||
_IsXToIQS = _Hyphens == (int)Hyphen.IsXToIQS;
|
||||
_CellNames = new Dictionary<string, string>();
|
||||
_IsXToSPaCe = _Hyphens == (int)Hyphen.IsXToSPaCe;
|
||||
_IsXToSPaCeVillach = _Hyphens == (int)Hyphen.IsXToSPaCeVillach;
|
||||
ModelObjectParameterDefinition[] cellInstanceCollection = GetProperties(cellInstanceConnectionName, modelObjectParameters, "CellInstance.", ".Path");
|
||||
foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in cellInstanceCollection)
|
||||
_CellNames.Add(modelObjectParameterDefinition.Name.Split('.')[1], modelObjectParameterDefinition.Value);
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
|
||||
|
||||
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||
|
||||
string IFileRead.GetEventDescription()
|
||||
{
|
||||
string result = _Description.GetEventDescription();
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> IFileRead.GetHeaderNames()
|
||||
{
|
||||
List<string> results = _Description.GetHeaderNames();
|
||||
return results;
|
||||
}
|
||||
|
||||
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||
{
|
||||
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||
return results;
|
||||
}
|
||||
|
||||
JsonProperty[] IFileRead.GetDefault()
|
||||
{
|
||||
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||
return results;
|
||||
}
|
||||
|
||||
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||
{
|
||||
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||
return results;
|
||||
}
|
||||
|
||||
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||
{
|
||||
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
if (string.IsNullOrEmpty(eventName))
|
||||
throw new Exception();
|
||||
_ReportFullPath = reportFullPath;
|
||||
DateTime dateTime = DateTime.Now;
|
||||
results = GetExtractResult(reportFullPath, dateTime);
|
||||
if (results.Item3 is null)
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||
WritePDSF(this, results.Item3);
|
||||
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
List<string> headerNames = _Description.GetHeaderNames();
|
||||
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||
results = ReExtract(this, headerNames, keyValuePairs);
|
||||
return results;
|
||||
}
|
||||
|
||||
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||
{
|
||||
if (_Description is not Description)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
void IFileRead.Callback(object state) => throw new Exception(string.Concat("Not ", nameof(_IsDummy)));
|
||||
|
||||
protected static List<Description> GetDescriptions(JsonElement[] jsonElements)
|
||||
{
|
||||
List<Description> results = new();
|
||||
Description description;
|
||||
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
|
||||
foreach (JsonElement jsonElement in jsonElements)
|
||||
{
|
||||
if (jsonElement.ValueKind != JsonValueKind.Object)
|
||||
throw new Exception();
|
||||
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
|
||||
results.Add(description);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
string duplicateDirectory;
|
||||
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||
SetFileParameterLotIDToLogisticsMID();
|
||||
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
|
||||
List<Description> descriptions = GetDescriptions(jsonElements);
|
||||
Tuple<Test[], Dictionary<Test, List<Shared.Properties.IDescription>>> tuple = GetTuple(this, from l in descriptions select (Shared.Properties.IDescription)l, extra: false);
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tuple.Item1, jsonElements, new List<FileInfo>());
|
||||
bool isDummyRun = _DummyRuns.Any() && _DummyRuns.ContainsKey(_Logistics.JobID) && _DummyRuns[_Logistics.JobID].Any() && (from l in _DummyRuns[_Logistics.JobID] where l == _Logistics.Sequence select 1).Any();
|
||||
if (isDummyRun)
|
||||
{
|
||||
try
|
||||
{ File.SetLastWriteTime(reportFullPath, dateTime); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
if (isDummyRun || _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||
{
|
||||
string successDirectory;
|
||||
string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_');
|
||||
if (!_IsXToAPC)
|
||||
successDirectory = string.Empty;
|
||||
else
|
||||
{
|
||||
successDirectory = string.Concat(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation), @"\ViewerPath");
|
||||
if (!Directory.Exists(successDirectory))
|
||||
_ = Directory.CreateDirectory(successDirectory);
|
||||
}
|
||||
if (_IsXToSPaCe || _IsXToSPaCeVillach)
|
||||
duplicateDirectory = _FileConnectorConfiguration.TargetFileLocation;
|
||||
else
|
||||
duplicateDirectory = string.Concat(_FileConnectorConfiguration.TargetFileLocation, @"\", segments[0]);
|
||||
if (segments.Length > 2)
|
||||
duplicateDirectory = string.Concat(duplicateDirectory, @"-", segments[2]);
|
||||
if (!Directory.Exists(duplicateDirectory))
|
||||
_ = Directory.CreateDirectory(duplicateDirectory);
|
||||
List<Tuple<Shared.Properties.IScopeInfo, string>> tuples = new();
|
||||
string duplicateFile = string.Concat(duplicateDirectory, @"\", Path.GetFileName(reportFullPath));
|
||||
if (isDummyRun)
|
||||
{
|
||||
foreach (KeyValuePair<Test, List<Shared.Properties.IDescription>> keyValuePair in tuple.Item2)
|
||||
File.Copy(reportFullPath, duplicateFile, overwrite: true);
|
||||
}
|
||||
if (!isDummyRun && _IsEAFHosted)
|
||||
WaitForFileConsumption(_FileConnectorConfiguration.SourceDirectoryCloaking, _Logistics, dateTime, successDirectory, duplicateDirectory, duplicateFile, tuples);
|
||||
else
|
||||
{
|
||||
long breakAfter = DateTime.Now.AddSeconds(_FileConnectorConfiguration.ConnectionRetryInterval.Value).Ticks;
|
||||
for (short i = 0; i < short.MaxValue; i++)
|
||||
{
|
||||
if (!_IsEAFHosted || DateTime.Now.Ticks > breakAfter)
|
||||
break;
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
13
Adaptation/FileHandlers/DEP08SIASM/Hyphen.cs
Normal file
13
Adaptation/FileHandlers/DEP08SIASM/Hyphen.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace Adaptation.FileHandlers.DEP08SIASM;
|
||||
|
||||
public enum Hyphen
|
||||
{
|
||||
IsXToIQS,
|
||||
IsXToOpenInsight,
|
||||
IsXToAPC,
|
||||
IsXToSPaCe,
|
||||
IsXToSPaCeVillach,
|
||||
IsXToArchive,
|
||||
IsArchive,
|
||||
IsDummy,
|
||||
}
|
11
Adaptation/FileHandlers/DEP08SIASM/ProcessData.cs
Normal file
11
Adaptation/FileHandlers/DEP08SIASM/ProcessData.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using Adaptation.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.DEP08SIASM;
|
||||
|
||||
public class ProcessData
|
||||
{
|
||||
}
|
163
Adaptation/FileHandlers/DownloadJpegFile/FileRead.cs
Normal file
163
Adaptation/FileHandlers/DownloadJpegFile/FileRead.cs
Normal file
@ -0,0 +1,163 @@
|
||||
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Duplicator;
|
||||
using Adaptation.Shared.Methods;
|
||||
using FFMpegCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.DownloadJpegFile;
|
||||
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private readonly Timer _Timer;
|
||||
private readonly string _StaticFileServer;
|
||||
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
_Logistics = new Logistics(this);
|
||||
if (_FileParameter is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_ModelObjectParameterDefinitions is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_StaticFileServer = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, string.Concat("CellInstance.", cellInstanceName, ".StaticFileServer"));
|
||||
if (!Debugger.IsAttached && fileConnectorConfiguration.PreProcessingMode != FileConnectorConfiguration.PreProcessingModeEnum.Process)
|
||||
_Timer = new Timer(Callback, null, (int)(fileConnectorConfiguration.FileScanningIntervalInSeconds * 1000), Timeout.Infinite);
|
||||
else
|
||||
{
|
||||
_Timer = new Timer(Callback, null, Timeout.Infinite, Timeout.Infinite);
|
||||
Callback(null);
|
||||
}
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
|
||||
|
||||
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||
|
||||
string IFileRead.GetEventDescription()
|
||||
{
|
||||
string result = _Description.GetEventDescription();
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> IFileRead.GetHeaderNames()
|
||||
{
|
||||
List<string> results = _Description.GetHeaderNames();
|
||||
return results;
|
||||
}
|
||||
|
||||
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||
{
|
||||
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||
return results;
|
||||
}
|
||||
|
||||
JsonProperty[] IFileRead.GetDefault()
|
||||
{
|
||||
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||
return results;
|
||||
}
|
||||
|
||||
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||
{
|
||||
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||
return results;
|
||||
}
|
||||
|
||||
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||
{
|
||||
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
if (string.IsNullOrEmpty(eventName))
|
||||
throw new Exception();
|
||||
_ReportFullPath = reportFullPath;
|
||||
DateTime dateTime = DateTime.Now;
|
||||
results = GetExtractResult(reportFullPath, dateTime);
|
||||
if (results.Item3 is null)
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||
WritePDSF(this, results.Item3);
|
||||
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
List<string> headerNames = _Description.GetHeaderNames();
|
||||
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||
results = ReExtract(this, headerNames, keyValuePairs);
|
||||
return results;
|
||||
}
|
||||
|
||||
void IFileRead.CheckTests(Test[] tests, bool extra) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
|
||||
|
||||
void IFileRead.Callback(object state) => Callback(state);
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
if (reportFullPath is null)
|
||||
{ }
|
||||
if (dateTime == DateTime.MinValue)
|
||||
{ }
|
||||
throw new Exception(string.Concat("See ", nameof(Callback)));
|
||||
}
|
||||
|
||||
private void DownloadJpegFileSynchronously()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_StaticFileServer))
|
||||
throw new Exception();
|
||||
_ = FFMpegArguments
|
||||
.FromUrlInput(new Uri(string.Concat("rtsp://", _StaticFileServer, '/', _FileConnectorConfiguration.SourceDirectoryCloaking)))
|
||||
.OutputToFile(Path.Combine(_FileConnectorConfiguration.TargetFileLocation, $"{_CellInstanceName}_{DateTime.Now.Ticks}{_FileConnectorConfiguration.TargetFileName}"))
|
||||
.ProcessSynchronously(throwOnError: false);
|
||||
//FFMpeg.Snapshot(inputPath, outputPath, new Size(200, 400), TimeSpan.FromMinutes(1));
|
||||
}
|
||||
|
||||
private void Callback(object state)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_IsEAFHosted)
|
||||
DownloadJpegFileSynchronously();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||
try
|
||||
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
try
|
||||
{
|
||||
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
|
||||
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||
try
|
||||
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
308
Adaptation/FileHandlers/Dummy/FileRead.cs
Normal file
308
Adaptation/FileHandlers/Dummy/FileRead.cs
Normal file
@ -0,0 +1,308 @@
|
||||
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Duplicator;
|
||||
using Adaptation.Shared.Methods;
|
||||
using Infineon.Monitoring.MonA;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
|
||||
namespace Adaptation.FileHandlers.Dummy;
|
||||
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
private readonly Timer _Timer;
|
||||
private int _LastDummyRunIndex;
|
||||
private readonly string[] _CellNames;
|
||||
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
_Logistics = new Logistics(this);
|
||||
if (_FileParameter is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_ModelObjectParameterDefinitions is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_LastDummyRunIndex = -1;
|
||||
List<string> cellNames = new();
|
||||
_Timer = new Timer(Callback, null, Timeout.Infinite, Timeout.Infinite);
|
||||
ModelObjectParameterDefinition[] cellInstanceCollection = GetProperties(cellInstanceConnectionName, modelObjectParameters, "CellInstance.", ".Alias");
|
||||
foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in cellInstanceCollection)
|
||||
cellNames.Add(modelObjectParameterDefinition.Name.Split('.')[1]);
|
||||
_CellNames = cellNames.ToArray();
|
||||
if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process)
|
||||
Callback(null);
|
||||
else
|
||||
{
|
||||
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
|
||||
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||
}
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
|
||||
|
||||
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||
|
||||
string IFileRead.GetEventDescription()
|
||||
{
|
||||
string result = _Description.GetEventDescription();
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> IFileRead.GetHeaderNames()
|
||||
{
|
||||
List<string> results = _Description.GetHeaderNames();
|
||||
return results;
|
||||
}
|
||||
|
||||
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||
{
|
||||
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||
return results;
|
||||
}
|
||||
|
||||
JsonProperty[] IFileRead.GetDefault()
|
||||
{
|
||||
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||
return results;
|
||||
}
|
||||
|
||||
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||
{
|
||||
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||
return results;
|
||||
}
|
||||
|
||||
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||
{
|
||||
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName) => throw new Exception(string.Concat("See ", nameof(CallbackFileExists)));
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract() => throw new Exception(string.Concat("See ", nameof(CallbackFileExists)));
|
||||
|
||||
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||
{
|
||||
if (_Description is not Description)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
void IFileRead.Callback(object state) => Callback(state);
|
||||
|
||||
private void CallbackInProcessCleared(string sourceArchiveFile, string traceDummyFile, string targetFileLocation, string monARessource, string inProcessDirectory, long sequence, bool warning)
|
||||
{
|
||||
const string site = "sjc";
|
||||
string stateName = string.Concat("Dummy_", _EventName);
|
||||
const string monInURL = "http://moninhttp.sjc.infineon.com/input/text";
|
||||
MonIn monIn = MonIn.GetInstance(monInURL);
|
||||
try
|
||||
{
|
||||
if (warning)
|
||||
{
|
||||
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Warning.ToString() });
|
||||
_ = monIn.SendStatus(site, monARessource, stateName, State.Warning);
|
||||
for (int i = 1; i < 12; i++)
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
ZipFile.ExtractToDirectory(sourceArchiveFile, inProcessDirectory);
|
||||
string[] files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
if (files.Length > 250)
|
||||
throw new Exception("Safety net!");
|
||||
foreach (string file in files)
|
||||
File.SetLastWriteTime(file, new DateTime(sequence));
|
||||
if (!_FileConnectorConfiguration.IncludeSubDirectories.Value)
|
||||
{
|
||||
foreach (string file in files)
|
||||
File.Move(file, Path.Combine(targetFileLocation, Path.GetFileName(file)));
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] directories = Directory.GetDirectories(inProcessDirectory, "*", SearchOption.AllDirectories);
|
||||
foreach (string directory in directories)
|
||||
_ = Directory.CreateDirectory(string.Concat(targetFileLocation, directory.Substring(inProcessDirectory.Length)));
|
||||
foreach (string file in files)
|
||||
File.Move(file, string.Concat(targetFileLocation, file.Substring(inProcessDirectory.Length)));
|
||||
}
|
||||
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Ok.ToString() });
|
||||
_ = monIn.SendStatus(site, monARessource, stateName, State.Ok);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||
try
|
||||
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
|
||||
catch (Exception) { }
|
||||
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Critical.ToString(), exception.Message, exception.StackTrace });
|
||||
_ = monIn.SendStatus(site, monARessource, stateName, State.Critical);
|
||||
}
|
||||
}
|
||||
|
||||
private void CallbackFileExists(string sourceArchiveFile, string traceDummyFile, string targetFileLocation, string monARessource, long sequence)
|
||||
{
|
||||
string[] files;
|
||||
bool warning = false;
|
||||
if (!_DummyRuns.ContainsKey(monARessource))
|
||||
_DummyRuns.Add(monARessource, new List<long>());
|
||||
if (!_DummyRuns[monARessource].Contains(sequence))
|
||||
_DummyRuns[monARessource].Add(sequence);
|
||||
File.AppendAllLines(traceDummyFile, new string[] { sourceArchiveFile });
|
||||
string inProcessDirectory = Path.Combine(_ProgressPath, "Dummy In-Process", sequence.ToString());
|
||||
if (!Directory.Exists(inProcessDirectory))
|
||||
_ = Directory.CreateDirectory(inProcessDirectory);
|
||||
files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.AllDirectories);
|
||||
if (files.Any())
|
||||
{
|
||||
if (files.Length > 250)
|
||||
throw new Exception("Safety net!");
|
||||
try
|
||||
{
|
||||
foreach (string file in files)
|
||||
File.Delete(file);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
if (_FileConnectorConfiguration.IncludeSubDirectories.Value)
|
||||
files = Directory.GetFiles(targetFileLocation, "*", SearchOption.AllDirectories);
|
||||
else
|
||||
files = Directory.GetFiles(targetFileLocation, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (new FileInfo(file).LastWriteTime.Ticks == sequence)
|
||||
{
|
||||
warning = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CallbackInProcessCleared(sourceArchiveFile, traceDummyFile, targetFileLocation, monARessource, inProcessDirectory, sequence, warning);
|
||||
}
|
||||
|
||||
private string GetCellName(string pathSegment)
|
||||
{
|
||||
string result = string.Empty;
|
||||
foreach (string cellName in _CellNames)
|
||||
{
|
||||
if (pathSegment.ToLower().Contains(cellName.ToLower()))
|
||||
{
|
||||
result = cellName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(result))
|
||||
{
|
||||
int count;
|
||||
List<(string CellName, int Count)> cellNames = new();
|
||||
foreach (string cellName in _CellNames)
|
||||
{
|
||||
count = 0;
|
||||
foreach (char @char in cellName.ToLower())
|
||||
count += pathSegment.Length - pathSegment.ToLower().Replace(@char.ToString(), string.Empty).Length;
|
||||
cellNames.Add(new(cellName, count));
|
||||
}
|
||||
result = (from l in cellNames orderby l.CellName.Length, l.Count descending select l.CellName).First();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void Callback(object state)
|
||||
{
|
||||
try
|
||||
{
|
||||
string pathSegment;
|
||||
string monARessource;
|
||||
DateTime dateTime = DateTime.Now;
|
||||
if (!_FileConnectorConfiguration.TargetFileLocation.Contains(_FileConnectorConfiguration.SourceFileLocation))
|
||||
throw new Exception("Target must start with source");
|
||||
bool check = dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday;
|
||||
if (!_IsEAFHosted || check)
|
||||
{
|
||||
string checkSegment;
|
||||
string checkDirectory;
|
||||
string sourceFileFilter;
|
||||
string sourceArchiveFile;
|
||||
string sourceFileLocation;
|
||||
string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
string traceDummyDirectory = Path.Combine(Path.GetPathRoot(_TracePath), "TracesDummy", _CellInstanceName, "Source", $"{dateTime:yyyy}___Week_{weekOfYear}");
|
||||
if (!Directory.Exists(traceDummyDirectory))
|
||||
_ = Directory.CreateDirectory(traceDummyDirectory);
|
||||
string traceDummyFile = Path.Combine(traceDummyDirectory, $"{dateTime.Ticks} - {_CellInstanceName}.txt");
|
||||
File.AppendAllText(traceDummyFile, string.Empty);
|
||||
if (_FileConnectorConfiguration.SourceFileLocation.EndsWith("\\"))
|
||||
sourceFileLocation = _FileConnectorConfiguration.SourceFileLocation;
|
||||
else
|
||||
sourceFileLocation = string.Concat(_FileConnectorConfiguration.SourceFileLocation, '\\');
|
||||
for (int i = 0; i < _FileConnectorConfiguration.SourceFileFilters.Count; i++)
|
||||
{
|
||||
_LastDummyRunIndex += 1;
|
||||
if (_LastDummyRunIndex >= _FileConnectorConfiguration.SourceFileFilters.Count)
|
||||
_LastDummyRunIndex = 0;
|
||||
sourceFileFilter = _FileConnectorConfiguration.SourceFileFilters[_LastDummyRunIndex];
|
||||
sourceArchiveFile = Path.GetFullPath(string.Concat(sourceFileLocation, sourceFileFilter));
|
||||
if (File.Exists(sourceArchiveFile))
|
||||
{
|
||||
checkSegment = _FileConnectorConfiguration.TargetFileLocation.Substring(sourceFileLocation.Length);
|
||||
checkDirectory = Path.GetDirectoryName(sourceArchiveFile);
|
||||
for (int z = 0; z < int.MaxValue; z++)
|
||||
{
|
||||
if (checkDirectory.Length < sourceFileLocation.Length || !checkDirectory.StartsWith(sourceFileLocation))
|
||||
break;
|
||||
checkDirectory = Path.GetDirectoryName(checkDirectory);
|
||||
if (Directory.Exists(Path.Combine(checkDirectory, checkSegment)))
|
||||
{
|
||||
checkDirectory = Path.Combine(checkDirectory, checkSegment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!checkDirectory.EndsWith(checkSegment))
|
||||
throw new Exception("Could not determine dummy target directory for extract!");
|
||||
if (!long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence))
|
||||
throw new Exception("Invalid file name for source archive file!");
|
||||
pathSegment = checkDirectory.Substring(sourceFileLocation.Length);
|
||||
monARessource = GetCellName(pathSegment);
|
||||
if (string.IsNullOrEmpty(monARessource))
|
||||
throw new Exception("Could not determine which cell archive file is associated with!");
|
||||
if (_IsEAFHosted)
|
||||
CallbackFileExists(sourceArchiveFile, traceDummyFile, checkDirectory, monARessource, sequence);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||
try
|
||||
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
try
|
||||
{
|
||||
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
|
||||
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
|
||||
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
|
||||
try
|
||||
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
304
Adaptation/FileHandlers/FileRead.cs
Normal file
304
Adaptation/FileHandlers/FileRead.cs
Normal file
@ -0,0 +1,304 @@
|
||||
//using Adaptation.Helpers;
|
||||
//using Adaptation.Shared;
|
||||
//using Adaptation.Shared.Deposition;
|
||||
//using log4net;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.IO;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Text.Json;
|
||||
//using System.Threading;
|
||||
|
||||
//namespace Adaptation.FileHandlers
|
||||
//{
|
||||
|
||||
// public partial class FileRead : ILogic
|
||||
// {
|
||||
|
||||
// private ConfigData _ConfigData;
|
||||
|
||||
// public FileRead()
|
||||
// {
|
||||
// Logistics = new Logistics();
|
||||
// _Log = LogManager.GetLogger(typeof(FileRead));
|
||||
// }
|
||||
|
||||
// public ILogic ShallowCopy() => (ILogic)MemberwiseClone();
|
||||
|
||||
// public void WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||
|
||||
// public Tuple<string, ConfigDataBase> GetOpenInsightTuple()
|
||||
// {
|
||||
// Tuple<string, ConfigDataBase> results = new(_ConfigData.OpenInsightGaNViewer, _ConfigData);
|
||||
// return results;
|
||||
// }
|
||||
|
||||
// public Tuple<string, JsonElement?, List<FileInfo>> GetExtractResult(string reportFullPath, string eventName)
|
||||
// {
|
||||
// Tuple<string, JsonElement?, List<FileInfo>> results;
|
||||
// _FileParameter.Clear();
|
||||
// DateTime dateTime = DateTime.Now;
|
||||
// if (_ConfigData.IsEvent && _ConfigData.Duplicator is null)
|
||||
// results = GetExtractResult(reportFullPath);
|
||||
// else if (_ConfigData.Duplicator.HasValue)
|
||||
// results = GetDuplicatorExtractResult(reportFullPath, dateTime);
|
||||
// else
|
||||
// {
|
||||
// results = new Tuple<string, JsonElement?, List<FileInfo>>(string.Empty, null, new List<FileInfo>());
|
||||
// SupportExtractResult(reportFullPath);
|
||||
// }
|
||||
// if (results.Item2 is null)
|
||||
// results = new Tuple<string, JsonElement?, List<FileInfo>>(results.Item1, JsonSerializer.Deserialize<JsonElement>("[]"), results.Item3);
|
||||
// int count = results.Item2.Value.GetArrayLength();
|
||||
// if (count > 0 && _ConfigData.EafHosted)
|
||||
// WritePDSF(results.Item2.Value);
|
||||
// UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||
// return results;
|
||||
// }
|
||||
|
||||
// private Tuple<string, JsonElement?, List<FileInfo>> GetExtractResult(string reportFullPath)
|
||||
// {
|
||||
// Tuple<string, JsonElement?, List<FileInfo>> results = new(string.Empty, null, new List<FileInfo>());
|
||||
// FileInfo fileInfo = new(reportFullPath);
|
||||
// Logistics = new Logistics(ConfigData.NullData, _ConfigData.CellNames, _ConfigData.MesEntities, fileInfo, useSplitForMID: false);
|
||||
// SetFileParameterLotIDToLogisticsMID();
|
||||
// ProcessData processData = new(this, _ConfigData, results.Item3);
|
||||
// if (!processData.AnalysisTXTResults.Any() && !processData.AnalysisXMLResults.Any() && !processData.RunMeasurements.Any())
|
||||
// throw new Exception("No Data");
|
||||
// if (processData.AnalysisTXTResults.Any())
|
||||
// Logistics.MID = processData.AnalysisTXTResults[0].LotID;
|
||||
// else if (processData.RunMeasurements.Any())
|
||||
// {
|
||||
// if (!processData.RunMeasurements[0].MID.StartsWith(_ConfigData.FileConnectorConfiguration.SourceFileFilter.Substring(0, 2)))
|
||||
// Logistics.MID = _ConfigData.FileConnectorConfiguration.SourceFileFilter.Substring(0, 2);
|
||||
// else
|
||||
// Logistics.MID = processData.RunMeasurements[0].MID;
|
||||
// }
|
||||
// string reactor = _ConfigData.GetCurrentReactor(this);
|
||||
// if (string.IsNullOrEmpty(reactor))
|
||||
// throw new Exception("Unable to match Current Reactor");
|
||||
// Logistics.ProcessJobID = reactor;
|
||||
// if (processData.RunMeasurements.Any())
|
||||
// SetFileParameterLotIDToLogisticsMID();
|
||||
// results = processData.GetResults(this, _ConfigData, results.Item3);
|
||||
// return results;
|
||||
// }
|
||||
|
||||
// private Tuple<string, JsonElement?, List<FileInfo>> GetDuplicatorExtractResult(string reportFullPath, DateTime dateTime)
|
||||
// {
|
||||
// Tuple<string, JsonElement?, List<FileInfo>> results;
|
||||
// Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
|
||||
// Logistics = new Logistics(reportFullPath, pdsf.Item1);
|
||||
// SetFileParameterLotIDToLogisticsMID();
|
||||
// JsonElement pdsfBodyValues = ProcessDataStandardFormat.GetArray(pdsf);
|
||||
// results = new Tuple<string, JsonElement?, List<FileInfo>>(pdsf.Item1, pdsfBodyValues, new List<FileInfo>());
|
||||
// List<Duplicator.Description> processDataDescriptions = _ConfigData.GetProcessDataDescriptions(pdsfBodyValues);
|
||||
// Dictionary<Test, List<Duplicator.Description>> keyValuePairs = ProcessData.GetKeyValuePairs(_ConfigData, pdsfBodyValues, processDataDescriptions, extra: false);
|
||||
// bool isDummyRun = (ConfigData.DummyRuns.Any() && ConfigData.DummyRuns.ContainsKey(Logistics.JobID) && ConfigData.DummyRuns[Logistics.JobID].Any() && (from l in ConfigData.DummyRuns[Logistics.JobID] where l == Logistics.Sequence select 1).Any());
|
||||
// if (isDummyRun)
|
||||
// {
|
||||
// try
|
||||
// { File.SetLastWriteTime(reportFullPath, dateTime); }
|
||||
// catch (Exception) { }
|
||||
// }
|
||||
// bool isMock = _ConfigData.Duplicator.Value is ConfigData.Level.IsR69TXTAPCMock or ConfigData.Level.IsR71HealthCp2MgAPCMock or ConfigData.Level.IsR69TXTIQSMock or ConfigData.Level.IsR71XMLIQSMock;
|
||||
// if ((isDummyRun || _Configuration.FileScanningIntervalInSeconds > 0) && _ConfigData.Duplicator.Value != ConfigData.Level.IsArchive && !isMock)
|
||||
// {
|
||||
// string successDirectory;
|
||||
// string duplicateDirectory;
|
||||
// string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_');
|
||||
// if (_ConfigData.Duplicator.Value != ConfigData.Level.IsXToAPC)
|
||||
// successDirectory = string.Empty;
|
||||
// else
|
||||
// {
|
||||
// successDirectory = string.Concat(Path.GetDirectoryName(_Configuration.TargetFileLocation), @"\ViewerPath");
|
||||
// if (!Directory.Exists(successDirectory))
|
||||
// _ = Directory.CreateDirectory(successDirectory);
|
||||
// }
|
||||
// if (_ConfigData.Duplicator.Value is ConfigData.Level.IsXToSPaCe or ConfigData.Level.IsXToSPaCeVillach)
|
||||
// duplicateDirectory = _Configuration.TargetFileLocation;
|
||||
// else
|
||||
// duplicateDirectory = string.Concat(_Configuration.TargetFileLocation, @"\", segments[0]);
|
||||
// if (segments.Length > 2)
|
||||
// duplicateDirectory = string.Concat(duplicateDirectory, @"-", segments[2]);
|
||||
// if (!Directory.Exists(duplicateDirectory))
|
||||
// _ = Directory.CreateDirectory(duplicateDirectory);
|
||||
// string logisticsSequence = Logistics.Sequence.ToString();
|
||||
// List<Tuple<IScopeInfo, string>> tuples = new();
|
||||
// string duplicateFile = string.Concat(duplicateDirectory, @"\", Path.GetFileName(reportFullPath));
|
||||
// if (isDummyRun || _ConfigData.Duplicator.Value != ConfigData.Level.IsXToArchive)
|
||||
// {
|
||||
// Test test;
|
||||
// List<Tuple<IScopeInfo, string>> linesCollection;
|
||||
// foreach (KeyValuePair<Test, List<Duplicator.Description>> keyValuePair in keyValuePairs)
|
||||
// {
|
||||
// test = keyValuePair.Key;
|
||||
// switch (test)
|
||||
// {
|
||||
// case Test.GRATXTCenter:
|
||||
// case Test.GRATXTEdge:
|
||||
// case Test.LogbookCAC:
|
||||
// case Test.GrowthRateXML:
|
||||
// if (_ConfigData.EafHosted)
|
||||
// {
|
||||
// if (_ConfigData.Duplicator.Value != ConfigData.Level.IsXToIQS || reportFullPath.EndsWith("_Health_Cp2Mg.pdsf"))
|
||||
// File.Copy(reportFullPath, duplicateFile, overwrite: true);
|
||||
// else
|
||||
// {
|
||||
// linesCollection = ProcessData.GetLines(this, _ConfigData, pdsfBodyValues, test);
|
||||
// foreach (Tuple<IScopeInfo, string> tuple in linesCollection)
|
||||
// tuples.Add(new Tuple<IScopeInfo, string>(tuple.Item1, tuple.Item2));
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// default:
|
||||
// throw new Exception();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (_ConfigData.Duplicator.Value != ConfigData.Level.IsXToArchive)
|
||||
// Shared0413(dateTime, isDummyRun, successDirectory, duplicateDirectory, tuples, duplicateFile);
|
||||
// else
|
||||
// {
|
||||
// string destinationDirectory = WriteScopeInfo(_ConfigData.ProgressPath, Logistics, dateTime, duplicateDirectory, tuples);
|
||||
// if (isDummyRun)
|
||||
// Shared0607(reportFullPath, duplicateDirectory, logisticsSequence, destinationDirectory);
|
||||
// }
|
||||
// }
|
||||
// return results;
|
||||
// }
|
||||
|
||||
// private void SupportExtractResult(string reportFullPath)
|
||||
// {
|
||||
// ConfigData.ConnectionAction connectionAction = _ConfigData.GetConnectionActionValue();
|
||||
// switch (connectionAction)
|
||||
// {
|
||||
// case ConfigData.ConnectionAction.MoveDLGFile:
|
||||
// case ConfigData.ConnectionAction.MoveDLGFileForParse:
|
||||
// case ConfigData.ConnectionAction.MoveTXTOrXMLFile:
|
||||
// case ConfigData.ConnectionAction.MoveXMLFile:
|
||||
// break;
|
||||
// case ConfigData.ConnectionAction.RenameTXTFile:
|
||||
// if (reportFullPath.Contains('#'))
|
||||
// {
|
||||
// string fourZeroHashTag = "40#";
|
||||
// string sixThreeHashTag = "63#";
|
||||
// string nineFiveHashTag = "95#";
|
||||
// string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_');
|
||||
// if ((from l in segments where l != fourZeroHashTag && l != sixThreeHashTag && l != nineFiveHashTag select l).Any())
|
||||
// {
|
||||
// string wavelengthGroup;
|
||||
// string text = File.ReadAllText(reportFullPath);
|
||||
// if (text.Contains("wavelength 40"))
|
||||
// wavelengthGroup = "40#";
|
||||
// else if (text.Contains("wavelength 63"))
|
||||
// wavelengthGroup = "63#";
|
||||
// else if (text.Contains("wavelength 95"))
|
||||
// wavelengthGroup = "95#";
|
||||
// else
|
||||
// wavelengthGroup = "###";
|
||||
// StringBuilder stringBuilder = new();
|
||||
// for (int i = 0; i < segments.Length; i++)
|
||||
// {
|
||||
// _ = stringBuilder.Append(segments[i]).Append('_');
|
||||
// if (i == 2)
|
||||
// _ = stringBuilder.Append(wavelengthGroup).Append('_');
|
||||
// }
|
||||
// if (stringBuilder.Length > 0)
|
||||
// _ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||
// string fileName = Path.Combine(Path.GetDirectoryName(reportFullPath), stringBuilder.ToString());
|
||||
// File.WriteAllText(fileName, text);
|
||||
// File.Delete(reportFullPath);
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// case ConfigData.ConnectionAction.SplitCACFile:
|
||||
// ProcessData.SplitCACFile(_ConfigData, reportFullPath);
|
||||
// break;
|
||||
// case ConfigData.ConnectionAction.MoveCACFile:
|
||||
// FileInfo fileInfo = new(Path.Combine(_ConfigData.FileConnectorConfiguration.TargetFileLocation, Path.GetFileName(reportFullPath)));
|
||||
// if (fileInfo.Exists && new FileInfo(reportFullPath).LastWriteTime > fileInfo.LastWriteTime)
|
||||
// {
|
||||
// try
|
||||
// { File.Delete(fileInfo.FullName); }
|
||||
// catch (Exception) { }
|
||||
// Thread.Sleep(500);
|
||||
// }
|
||||
// break;
|
||||
// case ConfigData.ConnectionAction.WritePDSFFile:
|
||||
// string mesEntity = _ConfigData.CellName;
|
||||
// FileInfo sourceFileInfo = new(reportFullPath);
|
||||
// string extension = string.Concat(".", _ConfigData.FileConnectorConfiguration.TargetFileName.Split('.')[1]);
|
||||
// string ticks = string.Concat(_ConfigData.FileConnectorConfiguration.TargetFileLocation, @"\", sourceFileInfo.LastWriteTime.Ticks);
|
||||
// FileInfo pdsfFileInfo = new(string.Concat(_ConfigData.FileConnectorConfiguration.TargetFileLocation, @"\", mesEntity, "_", sourceFileInfo.LastWriteTime.ToString("yyMMddHHmmssfff"), "_dlg", extension));
|
||||
// if (pdsfFileInfo.Exists)
|
||||
// throw new Exception("Destination file already exists!");
|
||||
// string pdsfText = ProcessData.GetPDSFTextFromDLG(_ConfigData, mesEntity, sourceFileInfo, useSetpoint: false, writeFiles: false, fullDateTime: false, backFill: true);
|
||||
// File.WriteAllText(ticks, pdsfText);
|
||||
// File.SetLastWriteTime(ticks, sourceFileInfo.LastWriteTime);
|
||||
// File.Move(ticks, pdsfFileInfo.FullName);
|
||||
// break;
|
||||
// case ConfigData.ConnectionAction.RaiseCACFileEvent:
|
||||
// case ConfigData.ConnectionAction.RaiseTXTFileEvent:
|
||||
// case ConfigData.ConnectionAction.RaiseXMLFileEvent:
|
||||
// throw new Exception();
|
||||
// default:
|
||||
// throw new Exception();
|
||||
// }
|
||||
// }
|
||||
|
||||
// private void MoveArchive()
|
||||
// {
|
||||
// const int midLength = 7;
|
||||
// const int midSegment = 5;
|
||||
// const char midPadding = '0';
|
||||
// string destinationDirectory;
|
||||
// string logisticsSequence = Logistics.Sequence.ToString();
|
||||
// string group = Logistics.MID.PadLeft(midLength, midPadding).Substring(0, midSegment).PadRight(midLength, midPadding);
|
||||
// string rootDestinationDirectory = string.Concat(Path.GetDirectoryName(_Configuration.TargetFileLocation), @"\", Logistics.MesEntity);
|
||||
// string[] matchDirectories = new string[] { GetDirectoriesRecursively(rootDestinationDirectory, logisticsSequence).FirstOrDefault() };
|
||||
// if (matchDirectories.Length == 0 || string.IsNullOrEmpty(matchDirectories[0]))
|
||||
// matchDirectories = Directory.GetDirectories(rootDestinationDirectory, string.Concat('*', logisticsSequence, '*'), SearchOption.AllDirectories);
|
||||
// if ((matchDirectories is null) || matchDirectories.Length != 1)
|
||||
// throw new Exception("Didn't find directory by logistics sequence");
|
||||
// if (matchDirectories[0].Contains("_processing failed"))
|
||||
// destinationDirectory = string.Concat(rootDestinationDirectory, @"\", "_Process_Failed");
|
||||
// else if (matchDirectories[0].Contains("_in process"))
|
||||
// destinationDirectory = string.Concat(rootDestinationDirectory, @"\All_other_files_and_folders");
|
||||
// else if (matchDirectories[0].Contains("_processed"))
|
||||
// destinationDirectory = string.Concat(rootDestinationDirectory, @"\- Archive\", group);
|
||||
// else
|
||||
// throw new Exception();
|
||||
// if (!Directory.Exists(destinationDirectory))
|
||||
// _ = Directory.CreateDirectory(destinationDirectory);
|
||||
// string directoryName = Path.GetFileName(matchDirectories[0]);
|
||||
// if (directoryName != logisticsSequence)
|
||||
// throw new Exception("directoryName != logisticsSequence");
|
||||
// else
|
||||
// {
|
||||
// string sourceDirectoryName = Path.GetDirectoryName(matchDirectories[0]);
|
||||
// string destinationDirectoryName = string.Concat(destinationDirectory, @"\", Path.GetFileName(sourceDirectoryName));
|
||||
// if (destinationDirectoryName != sourceDirectoryName)
|
||||
// Directory.Move(sourceDirectoryName, destinationDirectoryName);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public void Move(string reportFullPath, Tuple<string, JsonElement?, List<FileInfo>> extractResults, Exception exception = null)
|
||||
// {
|
||||
// Shared1872(reportFullPath, exception);
|
||||
// bool isErrorFile = exception is not null;
|
||||
// if (!isErrorFile && _ConfigData.Duplicator.HasValue)
|
||||
// {
|
||||
// if (_ConfigData.Duplicator.Value == ConfigData.Level.IsXToArchive)
|
||||
// Shared0192(reportFullPath);
|
||||
// else if (_ConfigData.EafHosted && _ConfigData.Duplicator.Value == ConfigData.Level.IsArchive)
|
||||
// MoveArchive();
|
||||
// if (_ConfigData.EafHosted && !string.IsNullOrEmpty(_ConfigData.ProgressPath))
|
||||
// CreateProgressDirectory(_ConfigData.ProgressPath, Logistics, (int?)_ConfigData.Duplicator, exceptionLines: null);
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
//}
|
140
Adaptation/FileHandlers/ToArchive/FileRead.cs
Normal file
140
Adaptation/FileHandlers/ToArchive/FileRead.cs
Normal file
@ -0,0 +1,140 @@
|
||||
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Duplicator;
|
||||
using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.ToArchive;
|
||||
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
_Logistics = new Logistics(this);
|
||||
if (_FileParameter is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_ModelObjectParameterDefinitions is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||
{
|
||||
bool isErrorFile = exception is not null;
|
||||
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
|
||||
{
|
||||
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
|
||||
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
|
||||
}
|
||||
Move(extractResults, exception);
|
||||
}
|
||||
|
||||
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||
|
||||
string IFileRead.GetEventDescription()
|
||||
{
|
||||
string result = _Description.GetEventDescription();
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> IFileRead.GetHeaderNames()
|
||||
{
|
||||
List<string> results = _Description.GetHeaderNames();
|
||||
return results;
|
||||
}
|
||||
|
||||
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||
{
|
||||
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||
return results;
|
||||
}
|
||||
|
||||
JsonProperty[] IFileRead.GetDefault()
|
||||
{
|
||||
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||
return results;
|
||||
}
|
||||
|
||||
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||
{
|
||||
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||
return results;
|
||||
}
|
||||
|
||||
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||
{
|
||||
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
if (string.IsNullOrEmpty(eventName))
|
||||
throw new Exception();
|
||||
_ReportFullPath = reportFullPath;
|
||||
DateTime dateTime = DateTime.Now;
|
||||
results = GetExtractResult(reportFullPath, dateTime);
|
||||
if (results.Item3 is null)
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||
WritePDSF(this, results.Item3);
|
||||
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
List<string> headerNames = _Description.GetHeaderNames();
|
||||
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||
results = ReExtract(this, headerNames, keyValuePairs);
|
||||
return results;
|
||||
}
|
||||
|
||||
void IFileRead.CheckTests(Test[] tests, bool extra)
|
||||
{
|
||||
if (_Description is not Description)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
void IFileRead.Callback(object state) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
if (dateTime == DateTime.MinValue)
|
||||
{ }
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||
_Logistics = new Logistics(this, reportFullPath, useSplitForMID: true);
|
||||
SetFileParameterLotIDToLogisticsMID();
|
||||
|
||||
string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_');
|
||||
string duplicateDirectory = string.Concat(_FileConnectorConfiguration.TargetFileLocation, @"\", segments[0]);
|
||||
if (segments.Length > 2)
|
||||
duplicateDirectory = string.Concat(duplicateDirectory, @"-", segments[2]);
|
||||
if (!Directory.Exists(duplicateDirectory))
|
||||
_ = Directory.CreateDirectory(duplicateDirectory);
|
||||
|
||||
string logisticsSequence = _Logistics.Sequence.ToString();
|
||||
bool isDummyRun = _DummyRuns.Any() && _DummyRuns.ContainsKey(_Logistics.JobID) && _DummyRuns[_Logistics.JobID].Any() && (from l in _DummyRuns[_Logistics.JobID] where l == _Logistics.Sequence select 1).Any();
|
||||
|
||||
List<Tuple<Shared.Properties.IScopeInfo, string>> tuples = new();
|
||||
|
||||
string destinationDirectory = WriteScopeInfo(_ProgressPath, _Logistics, dateTime, duplicateDirectory, tuples);
|
||||
if (isDummyRun)
|
||||
Shared0607(reportFullPath, duplicateDirectory, logisticsSequence, destinationDirectory);
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
189
Adaptation/FileHandlers/jpeg/Description.cs
Normal file
189
Adaptation/FileHandlers/jpeg/Description.cs
Normal file
@ -0,0 +1,189 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.jpeg;
|
||||
|
||||
public class Description : IDescription
|
||||
{
|
||||
|
||||
public int Test { get; set; }
|
||||
public int Count { get; set; }
|
||||
public int Index { get; set; }
|
||||
//
|
||||
public string EventName { get; set; }
|
||||
public string NullData { get; set; }
|
||||
public string JobID { get; set; }
|
||||
public string Sequence { get; set; }
|
||||
public string MesEntity { get; set; }
|
||||
public string ReportFullPath { get; set; }
|
||||
public string ProcessJobID { get; set; }
|
||||
public string MID { get; set; }
|
||||
//
|
||||
public string Process { get; set; } //5
|
||||
public string Date { get; set; } //6
|
||||
public string Part { get; set; } //7
|
||||
public string Lot { get; set; } //8
|
||||
|
||||
string IDescription.GetEventDescription() => "File Has been read and parsed";
|
||||
|
||||
List<string> IDescription.GetNames(IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
List<string> results = new();
|
||||
IDescription description = GetDefault(fileRead, logistics);
|
||||
string json = JsonSerializer.Serialize(description, description.GetType());
|
||||
object @object = JsonSerializer.Deserialize<object>(json);
|
||||
if (@object is not JsonElement jsonElement)
|
||||
throw new Exception();
|
||||
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
|
||||
results.Add(jsonProperty.Name);
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetDetailNames()
|
||||
{
|
||||
List<string> results = new();
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetHeaderNames()
|
||||
{
|
||||
string[] results = new string[] { nameof(Process), nameof(Date), nameof(Part), nameof(Lot) };
|
||||
return results.ToList();
|
||||
}
|
||||
|
||||
IDescription IDescription.GetDisplayNames()
|
||||
{
|
||||
Description result = GetDisplayNames();
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetParameterNames()
|
||||
{
|
||||
List<string> results = new();
|
||||
return results;
|
||||
}
|
||||
|
||||
JsonProperty[] IDescription.GetDefault(IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
JsonProperty[] results;
|
||||
IDescription description = GetDefault(fileRead, logistics);
|
||||
string json = JsonSerializer.Serialize(description, description.GetType());
|
||||
object @object = JsonSerializer.Deserialize<object>(json);
|
||||
results = ((JsonElement)@object).EnumerateObject().ToArray();
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetPairedParameterNames()
|
||||
{
|
||||
string[] results = new string[] { "Test Name", "Test Value" };
|
||||
return results.ToList();
|
||||
}
|
||||
|
||||
List<string> IDescription.GetIgnoreParameterNames(Test test)
|
||||
{
|
||||
List<string> results = new();
|
||||
return results;
|
||||
}
|
||||
|
||||
IDescription IDescription.GetDefaultDescription(IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
Description result = GetDefault(fileRead, logistics);
|
||||
return result;
|
||||
}
|
||||
|
||||
Dictionary<string, string> IDescription.GetDisplayNamesJsonElement(IFileRead fileRead)
|
||||
{
|
||||
Dictionary<string, string> results = new();
|
||||
IDescription description = GetDisplayNames();
|
||||
string json = JsonSerializer.Serialize(description, description.GetType());
|
||||
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
|
||||
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
|
||||
{
|
||||
if (!results.ContainsKey(jsonProperty.Name))
|
||||
results.Add(jsonProperty.Name, string.Empty);
|
||||
if (jsonProperty.Value is JsonElement jsonPropertyValue)
|
||||
results[jsonProperty.Name] = jsonPropertyValue.ToString();
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData)
|
||||
{
|
||||
List<IDescription> results = new();
|
||||
|
||||
if (iProcessData is null || !iProcessData.Details.Any() || iProcessData is not ProcessData)
|
||||
results.Add(GetDefault(fileRead, logistics));
|
||||
else
|
||||
{
|
||||
string nullData;
|
||||
Description description;
|
||||
object configDataNullData = fileRead.NullData;
|
||||
if (configDataNullData is null)
|
||||
nullData = string.Empty;
|
||||
else
|
||||
nullData = configDataNullData.ToString();
|
||||
for (int i = 0; i < iProcessData.Details.Count; i++)
|
||||
{
|
||||
if (iProcessData.Details[i] is not string detail)
|
||||
continue;
|
||||
description = new Description
|
||||
{
|
||||
Test = (int)tests[i],
|
||||
Count = tests.Count,
|
||||
Index = i,
|
||||
//
|
||||
EventName = fileRead.EventName,
|
||||
NullData = nullData,
|
||||
JobID = fileRead.CellInstanceName,
|
||||
Sequence = logistics.Sequence.ToString(),
|
||||
MesEntity = logistics.MesEntity,
|
||||
ReportFullPath = logistics.ReportFullPath,
|
||||
ProcessJobID = logistics.ProcessJobID,
|
||||
MID = logistics.MID,
|
||||
//
|
||||
Process = logistics.ProcessJobID,
|
||||
Date = logistics.DateTimeFromSequence.Ticks.ToString(),
|
||||
Part = string.Empty,
|
||||
Lot = detail
|
||||
};
|
||||
results.Add(description);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private static Description GetDisplayNames()
|
||||
{
|
||||
Description result = new();
|
||||
return result;
|
||||
}
|
||||
|
||||
private Description GetDefault(IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
Description result = new()
|
||||
{
|
||||
Test = -1,
|
||||
Count = 0,
|
||||
Index = -1,
|
||||
//
|
||||
EventName = fileRead.EventName,
|
||||
NullData = fileRead.NullData,
|
||||
JobID = fileRead.CellInstanceName,
|
||||
Sequence = logistics.Sequence.ToString(),
|
||||
MesEntity = fileRead.MesEntity,
|
||||
ReportFullPath = logistics.ReportFullPath,
|
||||
ProcessJobID = logistics.ProcessJobID,
|
||||
MID = logistics.MID
|
||||
};
|
||||
result.Process = nameof(Process);
|
||||
result.Date = nameof(Date);
|
||||
result.Part = nameof(Part);
|
||||
result.Lot = nameof(Lot);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
137
Adaptation/FileHandlers/jpeg/FileRead.cs
Normal file
137
Adaptation/FileHandlers/jpeg/FileRead.cs
Normal file
@ -0,0 +1,137 @@
|
||||
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.jpeg;
|
||||
|
||||
public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
|
||||
protected readonly Dictionary<string, string> _Reactors;
|
||||
|
||||
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
|
||||
base(new Description(), true, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
|
||||
{
|
||||
_MinFileLength = 10;
|
||||
_NullData = string.Empty;
|
||||
_Logistics = new Logistics(this);
|
||||
if (_FileParameter is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_ModelObjectParameterDefinitions is null)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_Reactors = new Dictionary<string, string>();
|
||||
string reactor = string.Concat("Reactor.", cellInstanceName);
|
||||
ModelObjectParameterDefinition[] reactors = GetProperties(cellInstanceConnectionName, modelObjectParameters, "Reactor.");
|
||||
reactors = (from l in reactors where l.Name.EndsWith(".FilePrefix") select l).ToArray();
|
||||
if (!reactors.Any())
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in reactors)
|
||||
_Reactors.Add(modelObjectParameterDefinition.Name.Split('.')[1], modelObjectParameterDefinition.Value);
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
|
||||
|
||||
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
|
||||
|
||||
string IFileRead.GetEventDescription()
|
||||
{
|
||||
string result = _Description.GetEventDescription();
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> IFileRead.GetHeaderNames()
|
||||
{
|
||||
List<string> results = _Description.GetHeaderNames();
|
||||
return results;
|
||||
}
|
||||
|
||||
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||
{
|
||||
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
|
||||
return results;
|
||||
}
|
||||
|
||||
JsonProperty[] IFileRead.GetDefault()
|
||||
{
|
||||
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
|
||||
return results;
|
||||
}
|
||||
|
||||
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
|
||||
{
|
||||
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
|
||||
return results;
|
||||
}
|
||||
|
||||
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
|
||||
{
|
||||
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
if (string.IsNullOrEmpty(eventName))
|
||||
throw new Exception();
|
||||
_ReportFullPath = reportFullPath;
|
||||
DateTime dateTime = DateTime.Now;
|
||||
results = GetExtractResult(reportFullPath, dateTime);
|
||||
if (results.Item3 is null)
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
|
||||
if (results.Item3.Length > 0 && _IsEAFHosted)
|
||||
WritePDSF(this, results.Item3);
|
||||
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
|
||||
return results;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
List<string> headerNames = _Description.GetHeaderNames();
|
||||
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
|
||||
results = ReExtract(this, headerNames, keyValuePairs);
|
||||
return results;
|
||||
}
|
||||
|
||||
void IFileRead.CheckTests(Test[] tests, bool extra) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
|
||||
|
||||
void IFileRead.Callback(object state) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
|
||||
|
||||
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
|
||||
_Logistics = new Logistics(this, reportFullPath, useSplitForMID: true);
|
||||
SetFileParameterLotIDToLogisticsMID();
|
||||
if (reportFullPath.Length < _MinFileLength)
|
||||
results.Item4.Add(new FileInfo(reportFullPath));
|
||||
else
|
||||
{
|
||||
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4);
|
||||
if (iProcessData is ProcessData _)
|
||||
{
|
||||
if (!iProcessData.Details.Any())
|
||||
throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
|
||||
if (iProcessData.Details[0] is not string detail)
|
||||
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
|
||||
string mid = detail;
|
||||
_Logistics.MID = mid;
|
||||
SetFileParameterLotID(mid);
|
||||
_Logistics.ProcessJobID = iProcessData.GetCurrentReactor(this, _Logistics, _Reactors);
|
||||
}
|
||||
if (!iProcessData.Details.Any())
|
||||
throw new Exception(string.Concat("C) No Data - ", dateTime.Ticks));
|
||||
results = iProcessData.GetResults(this, _Logistics, results.Item4);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
153
Adaptation/FileHandlers/jpeg/ProcessData.cs
Normal file
153
Adaptation/FileHandlers/jpeg/ProcessData.cs
Normal file
@ -0,0 +1,153 @@
|
||||
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Deposition;
|
||||
using Adaptation.Shared.Methods;
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Tesseract;
|
||||
|
||||
namespace Adaptation.FileHandlers.jpeg;
|
||||
|
||||
public class ProcessData : IProcessData
|
||||
{
|
||||
|
||||
private readonly List<object> _Details;
|
||||
|
||||
private readonly ILog _Log;
|
||||
|
||||
public string JobID { get; set; }
|
||||
public string MesEntity { get; set; }
|
||||
|
||||
List<object> Shared.Properties.IProcessData.Details => _Details;
|
||||
|
||||
public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
|
||||
{
|
||||
if (logistics is null)
|
||||
{ }
|
||||
if (fileInfoCollection is null)
|
||||
{ }
|
||||
JobID = logistics.JobID;
|
||||
fileInfoCollection.Clear();
|
||||
_Details = new List<object>();
|
||||
MesEntity = logistics.MesEntity;
|
||||
_Log = LogManager.GetLogger(typeof(ProcessData));
|
||||
Parse(fileRead);
|
||||
}
|
||||
|
||||
private static string Get(string value, bool useSplitForMID)
|
||||
{
|
||||
string result = value;
|
||||
if (useSplitForMID)
|
||||
{
|
||||
if (result.IndexOf(".") > -1)
|
||||
result = result.Split('.')[0].Trim();
|
||||
if (result.IndexOf("_") > -1)
|
||||
result = result.Split('_')[0].Trim();
|
||||
if (result.IndexOf("-") > -1)
|
||||
result = result.Split('-')[0].Trim();
|
||||
}
|
||||
result = string.Concat(result.Substring(0, 1).ToUpper(), result.Substring(1).ToLower());
|
||||
return result;
|
||||
}
|
||||
|
||||
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors)
|
||||
{
|
||||
string result = string.Empty;
|
||||
string filePrefixAsMID;
|
||||
foreach (KeyValuePair<string, string> keyValuePair in reactors)
|
||||
{
|
||||
foreach (string filePrefix in keyValuePair.Value.Split('|'))
|
||||
{
|
||||
filePrefixAsMID = Get(filePrefix, useSplitForMID: true);
|
||||
if (logistics.MID.StartsWith(filePrefix) || logistics.MID.StartsWith(filePrefixAsMID))
|
||||
{
|
||||
result = keyValuePair.Key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(result) && reactors.Count == 1)
|
||||
result = reactors.ElementAt(0).Key;
|
||||
return result;
|
||||
}
|
||||
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
List<Test> tests = new();
|
||||
foreach (object item in _Details)
|
||||
tests.Add(Test.CDE);
|
||||
List<IDescription> descriptions = fileRead.GetDescriptions(fileRead, tests, this);
|
||||
if (tests.Count != descriptions.Count)
|
||||
throw new Exception();
|
||||
for (int i = 0; i < tests.Count; i++)
|
||||
{
|
||||
if (descriptions[i] is not Description description)
|
||||
throw new Exception();
|
||||
if (description.Test != (int)tests[i])
|
||||
throw new Exception();
|
||||
}
|
||||
List<Description> fileReadDescriptions = (from l in descriptions select (Description)l).ToList();
|
||||
string json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType());
|
||||
JsonElement[] jsonElements = JsonSerializer.Deserialize<JsonElement[]>(json);
|
||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(logistics.Logistics1[0], tests.ToArray(), jsonElements, fileInfoCollection);
|
||||
return results;
|
||||
}
|
||||
|
||||
private void Parse(IFileRead fileRead)
|
||||
{
|
||||
List<string> blocks = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
using TesseractEngine engine = new(string.Empty, "eng", EngineMode.Default);
|
||||
using Pix img = Pix.LoadFromFile(fileRead.ReportFullPath);
|
||||
using Page page = engine.Process(img);
|
||||
string text = page.GetText();
|
||||
_Log.Debug(string.Format("Mean confidence: {0}", page.GetMeanConfidence()));
|
||||
_Log.Debug(string.Format("Text (GetText): \r\n{0}", text));
|
||||
_Log.Debug("Text (iterator):");
|
||||
using ResultIterator iter = page.GetIterator();
|
||||
iter.Begin();
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
_ = stringBuilder.Append(iter.GetText(PageIteratorLevel.Word)).Append(' ');
|
||||
if (iter.IsAtFinalOf(PageIteratorLevel.TextLine, PageIteratorLevel.Word) && stringBuilder.Length > 0)
|
||||
{
|
||||
blocks.Add(stringBuilder.ToString());
|
||||
_ = stringBuilder.Clear();
|
||||
}
|
||||
} while (iter.Next(PageIteratorLevel.TextLine, PageIteratorLevel.Word));
|
||||
if (iter.IsAtFinalOf(PageIteratorLevel.Para, PageIteratorLevel.TextLine))
|
||||
_ = stringBuilder.AppendLine();
|
||||
} while (iter.Next(PageIteratorLevel.Para, PageIteratorLevel.TextLine));
|
||||
} while (iter.Next(PageIteratorLevel.Block, PageIteratorLevel.Para));
|
||||
} while (iter.Next(PageIteratorLevel.Block));
|
||||
if (stringBuilder.Length > 0)
|
||||
blocks.Add(stringBuilder.ToString());
|
||||
if (!blocks.Any())
|
||||
_Details.Add(text);
|
||||
else
|
||||
{
|
||||
blocks = (from l in blocks where l.Split(':').Length == 3 select l).ToList();
|
||||
if (!blocks.Any())
|
||||
_Details.Add(text);
|
||||
else
|
||||
_Details.Add(blocks[0]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
16
Adaptation/Ifx/Eaf/Common/Configuration/ConnectionSetting.cs
Normal file
16
Adaptation/Ifx/Eaf/Common/Configuration/ConnectionSetting.cs
Normal file
@ -0,0 +1,16 @@
|
||||
namespace Adaptation.Ifx.Eaf.Common.Configuration;
|
||||
|
||||
[System.Runtime.Serialization.DataContractAttribute]
|
||||
public class ConnectionSetting
|
||||
{
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
public ConnectionSetting(string name, string value) { }
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string Name { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string Value { get; set; }
|
||||
|
||||
}
|
22
Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/File.cs
Normal file
22
Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/File.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component;
|
||||
|
||||
public class File
|
||||
{
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
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();
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component;
|
||||
|
||||
public class FilePathGenerator
|
||||
{
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
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();
|
||||
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
using Adaptation.Ifx.Eaf.Common.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.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
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription;
|
||||
|
||||
public class FileConnectorParameterTypeDefinitionProvider
|
||||
{
|
||||
|
||||
#pragma warning disable CA1822
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
public FileConnectorParameterTypeDefinitionProvider() { }
|
||||
|
||||
public IEnumerable<ParameterTypeDefinition> GetAllParameterTypeDefinition() => null;
|
||||
public ParameterTypeDefinition GetParameterTypeDefinition(string name) => null;
|
||||
|
||||
}
|
9
Adaptation/PeerGroup/GCL/Annotations/NotNullAttribute.cs
Normal file
9
Adaptation/PeerGroup/GCL/Annotations/NotNullAttribute.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Adaptation.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() { }
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
namespace Adaptation.PeerGroup.GCL.SecsDriver;
|
||||
|
||||
public enum HsmsConnectionMode
|
||||
{
|
||||
Active = 0,
|
||||
Passive = 1
|
||||
}
|
7
Adaptation/PeerGroup/GCL/SecsDriver/HsmsSessionMode.cs
Normal file
7
Adaptation/PeerGroup/GCL/SecsDriver/HsmsSessionMode.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace Adaptation.PeerGroup.GCL.SecsDriver;
|
||||
|
||||
public enum HsmsSessionMode
|
||||
{
|
||||
MultiSession = 0,
|
||||
SingleSession = 1
|
||||
}
|
7
Adaptation/PeerGroup/GCL/SecsDriver/SecsTransportType.cs
Normal file
7
Adaptation/PeerGroup/GCL/SecsDriver/SecsTransportType.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace Adaptation.PeerGroup.GCL.SecsDriver;
|
||||
|
||||
public enum SecsTransportType
|
||||
{
|
||||
HSMS = 0,
|
||||
Serial = 1
|
||||
}
|
15
Adaptation/PeerGroup/GCL/SecsDriver/SerialBaudRate.cs
Normal file
15
Adaptation/PeerGroup/GCL/SecsDriver/SerialBaudRate.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace Adaptation.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
|
||||
}
|
33
Adaptation/Shared/Deposition/ScopeInfo.cs
Normal file
33
Adaptation/Shared/Deposition/ScopeInfo.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using Adaptation.Shared.Properties;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Adaptation.Shared.Deposition;
|
||||
|
||||
public class ScopeInfo : IScopeInfo
|
||||
{
|
||||
|
||||
public Enum Enum { get; private set; }
|
||||
public Test Test { get; private set; }
|
||||
public string HTML { get; private set; }
|
||||
public string Title { get; private set; }
|
||||
public int TestValue { get; private set; }
|
||||
public string Header { get; private set; }
|
||||
public string FileName { get; private set; }
|
||||
public string QueryFilter { get; private set; }
|
||||
public string FileNameWithoutExtension { get; private set; }
|
||||
|
||||
public ScopeInfo(IFileRead fileRead, Test test, string extra)
|
||||
{
|
||||
Enum = test;
|
||||
Test = test;
|
||||
HTML = string.Empty;
|
||||
Title = string.Empty;
|
||||
TestValue = (int)test;
|
||||
Header = string.Empty;
|
||||
QueryFilter = string.Empty;
|
||||
FileName = Path.GetFileName(fileRead.ReportFullPath);
|
||||
FileNameWithoutExtension = extra;
|
||||
}
|
||||
|
||||
}
|
142
Adaptation/Shared/Duplicator/Description.cs
Normal file
142
Adaptation/Shared/Duplicator/Description.cs
Normal file
@ -0,0 +1,142 @@
|
||||
using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.Shared.Duplicator;
|
||||
|
||||
public class Description : IDescription, Properties.IDescription
|
||||
{
|
||||
|
||||
public int Test { get; set; }
|
||||
public int Count { get; set; }
|
||||
public int Index { get; set; }
|
||||
//
|
||||
public string EventName { get; set; }
|
||||
public string NullData { get; set; }
|
||||
public string JobID { get; set; }
|
||||
public string Sequence { get; set; }
|
||||
public string MesEntity { get; set; }
|
||||
public string ReportFullPath { get; set; }
|
||||
public string ProcessJobID { get; set; }
|
||||
public string MID { get; set; }
|
||||
public string Date { get; set; } //2021-10-23
|
||||
|
||||
string IDescription.GetEventDescription() => "File Has been read and parsed";
|
||||
|
||||
List<string> IDescription.GetNames(IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
List<string> results = new();
|
||||
IDescription description = GetDefault(fileRead, logistics);
|
||||
string json = JsonSerializer.Serialize(description, description.GetType());
|
||||
object @object = JsonSerializer.Deserialize<object>(json);
|
||||
if (@object is not JsonElement jsonElement)
|
||||
throw new Exception();
|
||||
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
|
||||
results.Add(jsonProperty.Name);
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetDetailNames()
|
||||
{
|
||||
List<string> results = new();
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetHeaderNames()
|
||||
{
|
||||
List<string> results = new();
|
||||
return results;
|
||||
}
|
||||
|
||||
IDescription IDescription.GetDisplayNames()
|
||||
{
|
||||
Description result = GetDisplayNames();
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetParameterNames()
|
||||
{
|
||||
List<string> results = new();
|
||||
return results;
|
||||
}
|
||||
|
||||
JsonProperty[] IDescription.GetDefault(IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
JsonProperty[] results;
|
||||
IDescription description = GetDefault(fileRead, logistics);
|
||||
string json = JsonSerializer.Serialize(description, description.GetType());
|
||||
object @object = JsonSerializer.Deserialize<object>(json);
|
||||
results = ((JsonElement)@object).EnumerateObject().ToArray();
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetPairedParameterNames()
|
||||
{
|
||||
List<string> results = new();
|
||||
return results;
|
||||
}
|
||||
|
||||
List<string> IDescription.GetIgnoreParameterNames(Test test)
|
||||
{
|
||||
List<string> results = new();
|
||||
return results;
|
||||
}
|
||||
|
||||
IDescription IDescription.GetDefaultDescription(IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
Description result = GetDefault(fileRead, logistics);
|
||||
return result;
|
||||
}
|
||||
|
||||
Dictionary<string, string> IDescription.GetDisplayNamesJsonElement(IFileRead fileRead)
|
||||
{
|
||||
Dictionary<string, string> results = new();
|
||||
IDescription description = GetDisplayNames();
|
||||
string json = JsonSerializer.Serialize(description, description.GetType());
|
||||
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
|
||||
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
|
||||
{
|
||||
if (!results.ContainsKey(jsonProperty.Name))
|
||||
results.Add(jsonProperty.Name, string.Empty);
|
||||
if (jsonProperty.Value is JsonElement jsonPropertyValue)
|
||||
results[jsonProperty.Name] = jsonPropertyValue.ToString();
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData)
|
||||
{
|
||||
List<IDescription> results = new();
|
||||
return results;
|
||||
}
|
||||
|
||||
private static Description GetDisplayNames()
|
||||
{
|
||||
Description result = new();
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Description GetDefault(IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
Description result = new()
|
||||
{
|
||||
Test = -1,
|
||||
Count = 0,
|
||||
Index = -1,
|
||||
//
|
||||
EventName = fileRead.EventName,
|
||||
NullData = fileRead.NullData,
|
||||
JobID = fileRead.CellInstanceName,
|
||||
Sequence = logistics.Sequence.ToString(),
|
||||
MesEntity = fileRead.MesEntity,
|
||||
ReportFullPath = logistics.ReportFullPath,
|
||||
ProcessJobID = logistics.ProcessJobID,
|
||||
MID = logistics.MID,
|
||||
Date = logistics.DateTimeFromSequence.ToUniversalTime().ToString("MM/dd/yyyy HH:mm:ss")
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
813
Adaptation/Shared/FileRead.cs
Normal file
813
Adaptation/Shared/FileRead.cs
Normal file
@ -0,0 +1,813 @@
|
||||
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
|
||||
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using Adaptation.Shared.Methods;
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
|
||||
namespace Adaptation.Shared;
|
||||
|
||||
public class FileRead : Properties.IFileRead
|
||||
{
|
||||
|
||||
protected string _NullData;
|
||||
protected readonly ILog _Log;
|
||||
protected long _MinFileLength;
|
||||
protected Logistics _Logistics;
|
||||
protected readonly ISMTP _SMTP;
|
||||
protected readonly int _Hyphens;
|
||||
protected readonly bool _IsEvent;
|
||||
protected string _ReportFullPath;
|
||||
protected long _LastTicksDuration;
|
||||
protected readonly bool _IsEAFHosted;
|
||||
protected readonly string _EventName;
|
||||
protected readonly string _MesEntity;
|
||||
protected readonly string _TracePath;
|
||||
protected readonly bool _IsDuplicator;
|
||||
protected readonly Calendar _Calendar;
|
||||
protected readonly bool _IsSourceTimer;
|
||||
protected readonly string _VillachPath;
|
||||
protected readonly string _ProgressPath;
|
||||
protected readonly string _EquipmentType;
|
||||
protected readonly long _BreakAfterSeconds;
|
||||
protected readonly string _ExceptionSubject;
|
||||
protected readonly string _CellInstanceName;
|
||||
protected readonly string _EventNameFileRead;
|
||||
protected readonly IDescription _Description;
|
||||
protected readonly bool _UseCyclicalForDescription;
|
||||
protected readonly string _CellInstanceConnectionName;
|
||||
protected readonly string _CellInstanceConnectionNameBase;
|
||||
protected readonly Dictionary<string, List<long>> _DummyRuns;
|
||||
protected readonly Dictionary<string, string> _FileParameter;
|
||||
protected readonly string _ParameterizedModelObjectDefinitionType;
|
||||
protected readonly FileConnectorConfiguration _FileConnectorConfiguration;
|
||||
protected readonly IList<ModelObjectParameterDefinition> _ModelObjectParameterDefinitions;
|
||||
|
||||
bool Properties.IFileRead.IsEvent => _IsEvent;
|
||||
string Properties.IFileRead.NullData => _NullData;
|
||||
string Properties.IFileRead.EventName => _EventName;
|
||||
string Properties.IFileRead.MesEntity => _MesEntity;
|
||||
bool Properties.IFileRead.IsEAFHosted => _IsEAFHosted;
|
||||
string Properties.IFileRead.EquipmentType => _EquipmentType;
|
||||
string Properties.IFileRead.ReportFullPath => _ReportFullPath;
|
||||
string Properties.IFileRead.CellInstanceName => _CellInstanceName;
|
||||
string Properties.IFileRead.ExceptionSubject => _ExceptionSubject;
|
||||
bool Properties.IFileRead.UseCyclicalForDescription => _UseCyclicalForDescription;
|
||||
string Properties.IFileRead.CellInstanceConnectionName => _CellInstanceConnectionName;
|
||||
string Properties.IFileRead.ParameterizedModelObjectDefinitionType => _ParameterizedModelObjectDefinitionType;
|
||||
|
||||
public FileRead(IDescription description, bool isEvent, ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted)
|
||||
{
|
||||
_SMTP = smtp;
|
||||
_IsEvent = isEvent;
|
||||
_DummyRuns = dummyRuns;
|
||||
_LastTicksDuration = 0;
|
||||
_IsEAFHosted = isEAFHosted;
|
||||
_Description = description;
|
||||
_FileParameter = fileParameter;
|
||||
_ReportFullPath = string.Empty;
|
||||
_CellInstanceName = cellInstanceName;
|
||||
_Calendar = new CultureInfo("en-US").Calendar;
|
||||
_Log = LogManager.GetLogger(typeof(FileRead));
|
||||
_UseCyclicalForDescription = useCyclicalForDescription;
|
||||
_CellInstanceConnectionName = cellInstanceConnectionName;
|
||||
_ModelObjectParameterDefinitions = modelObjectParameters;
|
||||
_FileConnectorConfiguration = fileConnectorConfiguration;
|
||||
_ParameterizedModelObjectDefinitionType = parameterizedModelObjectDefinitionType;
|
||||
_IsSourceTimer = fileConnectorConfiguration.SourceFileFilter.StartsWith("*Timer.txt");
|
||||
string cellInstanceConnectionNameBase = cellInstanceConnectionName.Replace("-", string.Empty);
|
||||
_Hyphens = cellInstanceConnectionName.Length - cellInstanceConnectionNameBase.Length;
|
||||
_ExceptionSubject = string.Concat("Exception:", _CellInstanceConnectionName, _FileConnectorConfiguration?.SourceDirectoryCloaking);
|
||||
string suffix;
|
||||
string[] segments = _ParameterizedModelObjectDefinitionType.Split('.');
|
||||
string @namespace = segments[0];
|
||||
string eventNameFileRead = "FileRead";
|
||||
string eventName = segments[segments.Length - 1];
|
||||
bool isDuplicator = segments[0] == cellInstanceName;
|
||||
_IsDuplicator = isDuplicator;
|
||||
_CellInstanceConnectionNameBase = cellInstanceConnectionNameBase;
|
||||
if (eventName == eventNameFileRead)
|
||||
suffix = string.Empty;
|
||||
else
|
||||
suffix = string.Concat('_', eventName.Split(new string[] { eventNameFileRead }, StringSplitOptions.RemoveEmptyEntries)[1]);
|
||||
string parameterizedModelObjectDefinitionTypeAppended = string.Concat(@namespace, suffix);
|
||||
if (!isEAFHosted)
|
||||
{
|
||||
if (string.IsNullOrEmpty(equipmentTypeName) || equipmentTypeName != parameterizedModelObjectDefinitionTypeAppended)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (string.IsNullOrEmpty(equipmentDictionaryName) && isEvent)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (!string.IsNullOrEmpty(equipmentDictionaryName) && !isEvent)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
// if (string.IsNullOrEmpty(equipmentDictionaryName) && !isEvent)
|
||||
// throw new Exception(cellInstanceConnectionName);
|
||||
// if (!string.IsNullOrEmpty(equipmentDictionaryName) && isEvent)
|
||||
// throw new Exception(cellInstanceConnectionName);
|
||||
}
|
||||
ModelObjectParameterDefinition[] paths = GetProperties(cellInstanceConnectionName, modelObjectParameters, "Path.");
|
||||
if (paths.Length < 3)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
if (isDuplicator)
|
||||
_MesEntity = string.Empty;
|
||||
else
|
||||
_MesEntity = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, string.Concat("CellInstance.", cellInstanceName, ".Alias"));
|
||||
_TracePath = (from l in paths where l.Name.EndsWith("Trace") select l.Value).FirstOrDefault();
|
||||
_VillachPath = (from l in paths where l.Name.EndsWith("Villach") select l.Value).FirstOrDefault();
|
||||
_ProgressPath = (from l in paths where l.Name.EndsWith("Progress") select l.Value).FirstOrDefault();
|
||||
_EventName = eventName;
|
||||
_EventNameFileRead = eventNameFileRead;
|
||||
_EquipmentType = parameterizedModelObjectDefinitionTypeAppended;
|
||||
long breakAfterSeconds;
|
||||
if (_FileConnectorConfiguration is null)
|
||||
breakAfterSeconds = 360;
|
||||
else
|
||||
{
|
||||
if (_FileConnectorConfiguration.FileScanningOption == FileConnectorConfiguration.FileScanningOptionEnum.TimeBased)
|
||||
breakAfterSeconds = 360;
|
||||
else
|
||||
breakAfterSeconds = Math.Abs(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value);
|
||||
}
|
||||
_BreakAfterSeconds = breakAfterSeconds;
|
||||
UpdateLastTicksDuration(breakAfterSeconds * 10000000);
|
||||
if (_IsDuplicator)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_FileConnectorConfiguration.TargetFileLocation) || string.IsNullOrEmpty(_FileConnectorConfiguration.ErrorTargetFileLocation))
|
||||
throw new Exception("_Configuration is empty?");
|
||||
if (_FileConnectorConfiguration.TargetFileLocation.Contains('%') || _FileConnectorConfiguration.ErrorTargetFileLocation.Contains('%'))
|
||||
throw new Exception("_Configuration is incorrect for a duplicator!");
|
||||
if (_FileConnectorConfiguration is not null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_FileConnectorConfiguration.SourceDirectoryCloaking))
|
||||
throw new Exception("SourceDirectoryCloaking is empty?");
|
||||
if (!_FileConnectorConfiguration.SourceDirectoryCloaking.StartsWith("~"))
|
||||
throw new Exception("SourceDirectoryCloaking is incorrect for a duplicator!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static string GetPropertyValue(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyName)
|
||||
{
|
||||
string result;
|
||||
List<string> results = (from l in modelObjectParameters where l.Name == propertyName select l.Value).ToList();
|
||||
if (results.Count != 1)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
result = results[0];
|
||||
return result;
|
||||
}
|
||||
|
||||
protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix)
|
||||
{
|
||||
ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) select l).ToArray();
|
||||
if (!results.Any())
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
return results;
|
||||
}
|
||||
|
||||
protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix, string propertyNameSuffix)
|
||||
{
|
||||
ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) && l.Name.EndsWith(propertyNameSuffix) select l).ToArray();
|
||||
if (!results.Any())
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
return results;
|
||||
}
|
||||
|
||||
protected void UpdateLastTicksDuration(long ticksDuration)
|
||||
{
|
||||
if (ticksDuration < 50000000)
|
||||
ticksDuration = 50000000;
|
||||
_LastTicksDuration = (long)Math.Ceiling(ticksDuration * .667);
|
||||
}
|
||||
|
||||
protected void WaitForThread(Thread thread, List<Exception> threadExceptions)
|
||||
{
|
||||
if (thread is not null)
|
||||
{
|
||||
ThreadState threadState;
|
||||
for (short i = 0; i < short.MaxValue; i++)
|
||||
{
|
||||
if (thread is null)
|
||||
break;
|
||||
else
|
||||
{
|
||||
threadState = thread.ThreadState;
|
||||
if (threadState is not ThreadState.Running and not ThreadState.WaitSleepJoin)
|
||||
break;
|
||||
}
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
lock (threadExceptions)
|
||||
{
|
||||
if (threadExceptions.Any())
|
||||
{
|
||||
foreach (Exception item in threadExceptions)
|
||||
_Log.Error(string.Concat(item.Message, Environment.NewLine, Environment.NewLine, item.StackTrace));
|
||||
Exception exception = threadExceptions[0];
|
||||
threadExceptions.Clear();
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void CreateProgressDirectory(string[] exceptionLines)
|
||||
{
|
||||
string progressDirectory;
|
||||
StringBuilder stringBuilder = new();
|
||||
if (_Hyphens == 0)
|
||||
progressDirectory = Path.Combine(_ProgressPath, _CellInstanceConnectionName);
|
||||
else
|
||||
{
|
||||
_ = stringBuilder.Clear();
|
||||
for (int i = 0; i < _Hyphens; i++)
|
||||
{
|
||||
if (i > 0 && (i % 2) == 0)
|
||||
_ = stringBuilder.Append(' ');
|
||||
_ = stringBuilder.Append('-');
|
||||
}
|
||||
progressDirectory = string.Concat(_ProgressPath, @"\", (_Hyphens + 1).ToString().PadLeft(2, '0'), " ", stringBuilder).Trim();
|
||||
}
|
||||
DateTime dateTime = DateTime.Now;
|
||||
string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
progressDirectory = string.Concat(progressDirectory, @"\", dateTime.ToString("yyyy"), "_Week_", weekOfYear, @"\", _Logistics.MID, "_", _Logistics.Sequence, "_", DateTime.Now.Ticks - _Logistics.Sequence);
|
||||
if (!Directory.Exists(progressDirectory))
|
||||
_ = Directory.CreateDirectory(progressDirectory);
|
||||
if (exceptionLines is not null)
|
||||
{
|
||||
string fileName = string.Concat(progressDirectory, @"\readme.txt");
|
||||
try
|
||||
{ File.WriteAllLines(fileName, exceptionLines); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
protected string[] Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
|
||||
{
|
||||
string[] results;
|
||||
bool isErrorFile = exception is not null;
|
||||
if (!to.EndsWith(@"\"))
|
||||
_ = string.Concat(to, @"\");
|
||||
if (!isErrorFile)
|
||||
results = Array.Empty<string>();
|
||||
else
|
||||
{
|
||||
results = new string[] { _Logistics.Sequence.ToString(), _Logistics.ReportFullPath, from, resolvedFileLocation, to, string.Empty, string.Empty, exception.Message, string.Empty, string.Empty, exception.StackTrace };
|
||||
Shared0449(to, results);
|
||||
}
|
||||
if (extractResults is not null && extractResults.Item4 is not null && extractResults.Item4.Any())
|
||||
{
|
||||
string itemFile;
|
||||
List<string> directories = new();
|
||||
foreach (FileInfo sourceFile in extractResults.Item4)
|
||||
{
|
||||
if (sourceFile.FullName != _Logistics.ReportFullPath)
|
||||
{
|
||||
itemFile = sourceFile.FullName.Replace(from, to);
|
||||
Shared1880(itemFile, directories, sourceFile, isErrorFile);
|
||||
}
|
||||
else if (!isErrorFile && _Logistics is not null)
|
||||
Shared1811(to, sourceFile);
|
||||
}
|
||||
Shared0231(directories);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
protected static IEnumerable<string> GetDirectoriesRecursively(string path, string directoryNameSegment = null)
|
||||
{
|
||||
Queue<string> queue = new();
|
||||
queue.Enqueue(path);
|
||||
while (queue.Count > 0)
|
||||
{
|
||||
path = queue.Dequeue();
|
||||
foreach (string subDirectory in Directory.GetDirectories(path))
|
||||
{
|
||||
queue.Enqueue(subDirectory);
|
||||
if (string.IsNullOrEmpty(directoryNameSegment) || Path.GetFileName(subDirectory).Contains(directoryNameSegment))
|
||||
yield return subDirectory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected string GetProcessedDirectory(string progressPath, Logistics logistics, DateTime dateTime, string duplicateDirectory)
|
||||
{
|
||||
string result = duplicateDirectory;
|
||||
string logisticsSequence = logistics.Sequence.ToString();
|
||||
string[] matchDirectories;
|
||||
if (!_IsEAFHosted)
|
||||
matchDirectories = new string[] { Path.GetDirectoryName(Path.GetDirectoryName(logistics.ReportFullPath)) };
|
||||
else
|
||||
matchDirectories = new string[] { GetDirectoriesRecursively(Path.GetDirectoryName(progressPath), logisticsSequence).FirstOrDefault() };
|
||||
if (matchDirectories.Length == 0 || string.IsNullOrEmpty(matchDirectories[0]))
|
||||
matchDirectories = Directory.GetDirectories(duplicateDirectory, string.Concat('*', logisticsSequence, '*'), SearchOption.AllDirectories);
|
||||
if ((matchDirectories is null) || matchDirectories.Length != 1)
|
||||
throw new Exception("Didn't find directory by logistics sequence");
|
||||
if (!matchDirectories[0].Contains("_processed"))
|
||||
{
|
||||
result = string.Concat(matchDirectories[0].Split(new string[] { logisticsSequence }, StringSplitOptions.None)[0], logistics.DateTimeFromSequence.ToString("yyyy-MM-dd_hh;mm_tt_"), dateTime.Ticks - logistics.Sequence, "_processed");
|
||||
Directory.Move(matchDirectories[0], result);
|
||||
result = string.Concat(result, @"\", logistics.Sequence);
|
||||
if (!Directory.Exists(result))
|
||||
_ = Directory.CreateDirectory(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected string WriteScopeInfo(string progressPath, Logistics logistics, DateTime dateTime, string duplicateDirectory, List<Tuple<Properties.IScopeInfo, string>> tuples)
|
||||
{
|
||||
string result = GetProcessedDirectory(progressPath, logistics, dateTime, duplicateDirectory);
|
||||
string tupleFile;
|
||||
string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath);
|
||||
string duplicateFile = string.Concat(result, @"\", fileName, ".pdsf");
|
||||
foreach (Tuple<Properties.IScopeInfo, string> tuple in tuples)
|
||||
{
|
||||
if (tuple.Item1.FileName.StartsWith(@"\"))
|
||||
tupleFile = tuple.Item1.FileName;
|
||||
else
|
||||
tupleFile = string.Concat(result, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc");
|
||||
File.WriteAllText(tupleFile, tuple.Item2);
|
||||
}
|
||||
File.Copy(logistics.ReportFullPath, duplicateFile, overwrite: true);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected static string GetTupleFile(Logistics logistics, Properties.IScopeInfo scopeInfo, string duplicateDirectory)
|
||||
{
|
||||
string result;
|
||||
string rds;
|
||||
string dateValue;
|
||||
string datePlaceholder;
|
||||
string[] segments = logistics.MID.Split('-');
|
||||
if (segments.Length < 2)
|
||||
rds = "%RDS%";
|
||||
else
|
||||
rds = segments[1];
|
||||
segments = scopeInfo.FileName.Split(new string[] { "DateTime:" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (segments.Length == 0)
|
||||
result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileNameWithoutExtension.Replace("%RDS%", rds));
|
||||
else
|
||||
{
|
||||
datePlaceholder = "%DateTime%";
|
||||
segments = segments[1].Split('%');
|
||||
dateValue = logistics.DateTimeFromSequence.ToString(segments[0]);
|
||||
foreach (string segment in scopeInfo.FileName.Split('%'))
|
||||
{
|
||||
if (!segment.Contains(segments[0]))
|
||||
continue;
|
||||
datePlaceholder = string.Concat('%', segment, '%');
|
||||
}
|
||||
result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileName.Replace("%RDS%", rds).Replace(datePlaceholder, dateValue));
|
||||
}
|
||||
if (result.Contains('%'))
|
||||
throw new Exception("Placeholder exists!");
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void WaitForFileConsumption(string sourceDirectoryCloaking, Logistics logistics, DateTime dateTime, string successDirectory, string duplicateDirectory, string duplicateFile, List<Tuple<Properties.IScopeInfo, string>> tuples)
|
||||
{
|
||||
bool check;
|
||||
long preWait;
|
||||
string tupleFile;
|
||||
List<int> consumedFileIndices = new();
|
||||
List<string> duplicateFiles = new();
|
||||
bool moreThanAnHour = (_BreakAfterSeconds > 3600);
|
||||
StringBuilder stringBuilder = new();
|
||||
long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks;
|
||||
if (moreThanAnHour)
|
||||
preWait = dateTime.AddSeconds(30).Ticks;
|
||||
else
|
||||
preWait = dateTime.AddTicks(_LastTicksDuration).Ticks;
|
||||
if (!tuples.Any())
|
||||
duplicateFiles.Add(duplicateFile);
|
||||
string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath);
|
||||
string successFile = string.Concat(successDirectory, @"\", Path.GetFileName(logistics.ReportFullPath));
|
||||
foreach (Tuple<Properties.IScopeInfo, string> tuple in tuples)
|
||||
{
|
||||
if (tuple.Item1.FileName.StartsWith(@"\"))
|
||||
tupleFile = tuple.Item1.FileName;
|
||||
else if (!tuple.Item1.FileName.Contains('%'))
|
||||
tupleFile = string.Concat(duplicateDirectory, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc");
|
||||
else
|
||||
tupleFile = GetTupleFile(logistics, tuple.Item1, duplicateDirectory);
|
||||
duplicateFiles.Add(tupleFile);
|
||||
File.WriteAllText(tupleFile, tuple.Item2);
|
||||
}
|
||||
for (short i = 0; i < short.MaxValue; i++)
|
||||
{
|
||||
if (DateTime.Now.Ticks > preWait)
|
||||
break;
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
if (!moreThanAnHour)
|
||||
{
|
||||
for (short z = 0; z < short.MaxValue; z++)
|
||||
{
|
||||
try
|
||||
{
|
||||
check = (string.IsNullOrEmpty(successDirectory) || File.Exists(successFile));
|
||||
if (check)
|
||||
{
|
||||
consumedFileIndices.Clear();
|
||||
for (int i = 0; i < duplicateFiles.Count; i++)
|
||||
{
|
||||
if (!File.Exists(duplicateFiles[i]))
|
||||
consumedFileIndices.Add(i);
|
||||
}
|
||||
if (consumedFileIndices.Count == duplicateFiles.Count)
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
if (DateTime.Now.Ticks > breakAfter)
|
||||
{
|
||||
for (int i = 0; i < duplicateFiles.Count; i++)
|
||||
{
|
||||
if (File.Exists(duplicateFiles[i]))
|
||||
{
|
||||
try
|
||||
{ File.Delete(duplicateFiles[i]); }
|
||||
catch (Exception) { }
|
||||
_ = stringBuilder.Append('<').Append(duplicateFiles[i]).Append("> ");
|
||||
}
|
||||
}
|
||||
throw new Exception(string.Concat("After {", _BreakAfterSeconds, "} seconds, right side of {", sourceDirectoryCloaking, "} didn't consume file(s) ", stringBuilder));
|
||||
}
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void SetFileParameter(string key, string value)
|
||||
{
|
||||
if (_FileConnectorConfiguration is null || _FileConnectorConfiguration.TargetFileLocation.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.ErrorTargetFileLocation.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.TargetFileName.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.ErrorTargetFileName.Contains(string.Concat("%", key, "%")))
|
||||
{
|
||||
if (_FileParameter.ContainsKey(key))
|
||||
_FileParameter[key] = value;
|
||||
else
|
||||
_FileParameter.Add(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected void SetFileParameterLotIDToLogisticsMID(bool includeLogisticsSequence = true)
|
||||
{
|
||||
string key;
|
||||
if (!includeLogisticsSequence)
|
||||
key = "LotID";
|
||||
else
|
||||
key = "LotIDWithLogisticsSequence";
|
||||
string value = string.Concat(_Logistics.MID, "_", _Logistics.Sequence, "_", DateTime.Now.Ticks - _Logistics.Sequence);
|
||||
SetFileParameter(key, value);
|
||||
}
|
||||
|
||||
protected void SetFileParameterLotID(string value, bool includeLogisticsSequence = true)
|
||||
{
|
||||
string key;
|
||||
if (!includeLogisticsSequence)
|
||||
key = "LotID";
|
||||
else
|
||||
{
|
||||
key = "LotIDWithLogisticsSequence";
|
||||
value = string.Concat(value, "_", _Logistics.Sequence, "_", DateTime.Now.Ticks - _Logistics.Sequence);
|
||||
}
|
||||
SetFileParameter(key, value);
|
||||
}
|
||||
|
||||
protected void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements)
|
||||
{
|
||||
string directory;
|
||||
if (!_CellInstanceConnectionName.StartsWith(_CellInstanceName) && _CellInstanceConnectionNameBase == _EquipmentType)
|
||||
directory = Path.Combine(_VillachPath, _EquipmentType, "Target");
|
||||
else
|
||||
directory = Path.Combine(_TracePath, _EquipmentType, "Source", _CellInstanceName, _CellInstanceConnectionName);
|
||||
if (!Directory.Exists(directory))
|
||||
_ = Directory.CreateDirectory(directory);
|
||||
string file = Path.Combine(directory, string.Concat(_Logistics.MesEntity, "_", _Logistics.Sequence, ".ipdsf"));
|
||||
string lines = ProcessDataStandardFormat.GetPDSFText(fileRead, _Logistics, jsonElements, logisticsText: string.Empty);
|
||||
File.WriteAllText(file, lines);
|
||||
if (_Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600)
|
||||
{
|
||||
try
|
||||
{ File.SetLastWriteTime(file, _Logistics.DateTimeFromSequence); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
protected void Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||
{
|
||||
bool isErrorFile = exception is not null;
|
||||
if (!isErrorFile && _IsDuplicator)
|
||||
{
|
||||
if (_IsEAFHosted && !string.IsNullOrEmpty(_ProgressPath))
|
||||
CreateProgressDirectory(exceptionLines: null);
|
||||
}
|
||||
if (!_IsEAFHosted)
|
||||
{
|
||||
string to;
|
||||
if (!_FileConnectorConfiguration.TargetFileLocation.EndsWith(Path.DirectorySeparatorChar.ToString()))
|
||||
to = _FileConnectorConfiguration.TargetFileLocation;
|
||||
else
|
||||
to = Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation);
|
||||
foreach (KeyValuePair<string, string> keyValuePair in _FileParameter)
|
||||
to = to.Replace(string.Concat('%', keyValuePair.Key, '%'), keyValuePair.Value);
|
||||
if (to.Contains('%'))
|
||||
_Log.Debug("Can't debug without EAF Hosting");
|
||||
else
|
||||
_ = Move(extractResults, to, _FileConnectorConfiguration.SourceFileLocation, resolvedFileLocation: string.Empty, exception: null);
|
||||
}
|
||||
}
|
||||
|
||||
protected void TriggerEvents(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, List<string> headerNames, Dictionary<string, string> keyValuePairs)
|
||||
{
|
||||
object value;
|
||||
string description;
|
||||
List<object[]> list;
|
||||
for (int i = 0; i < extractResults.Item3.Length; i++)
|
||||
{
|
||||
_Log.Debug(string.Concat("TriggerEvent - {", _Logistics.ReportFullPath, "} ", i, " of ", extractResults.Item3.Length));
|
||||
foreach (JsonProperty jsonProperty in extractResults.Item3[i].EnumerateObject())
|
||||
{
|
||||
if (jsonProperty.Value.ValueKind != JsonValueKind.String || !keyValuePairs.ContainsKey(jsonProperty.Name))
|
||||
description = string.Empty;
|
||||
else
|
||||
description = keyValuePairs[jsonProperty.Name].Split('|')[0];
|
||||
if (!_UseCyclicalForDescription || headerNames.Contains(jsonProperty.Name))
|
||||
value = jsonProperty.Value.ToString();
|
||||
else
|
||||
{
|
||||
list = new List<object[]>();
|
||||
for (int z = 0; z < extractResults.Item3.Length; z++)
|
||||
list.Add(new object[] { z, extractResults.Item3[z].GetProperty(jsonProperty.Name).ToString() });
|
||||
value = list;
|
||||
}
|
||||
}
|
||||
if (_UseCyclicalForDescription)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected Tuple<string, Test[], JsonElement[], List<FileInfo>> ReExtract(IFileRead fileRead, List<string> headerNames, Dictionary<string, string> keyValuePairs)
|
||||
{
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
|
||||
if (!Directory.Exists(_FileConnectorConfiguration.SourceFileLocation))
|
||||
results = null;
|
||||
else
|
||||
{
|
||||
string[] segments;
|
||||
string[] matches = null;
|
||||
foreach (string subSourceFileFilter in _FileConnectorConfiguration.SourceFileFilters)
|
||||
{
|
||||
segments = subSourceFileFilter.Split('\\');
|
||||
if (_FileConnectorConfiguration.IncludeSubDirectories.Value)
|
||||
matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.AllDirectories);
|
||||
else
|
||||
matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.TopDirectoryOnly);
|
||||
if (matches.Any())
|
||||
break;
|
||||
}
|
||||
if (matches is null || !matches.Any())
|
||||
results = null;
|
||||
else
|
||||
{
|
||||
_ReportFullPath = matches[0];
|
||||
results = fileRead.GetExtractResult(_ReportFullPath, _EventName);
|
||||
if (!_IsEAFHosted)
|
||||
TriggerEvents(results, headerNames, keyValuePairs);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
protected static Dictionary<Test, List<Properties.IDescription>> GetKeyValuePairs(List<Properties.IDescription> descriptions)
|
||||
{
|
||||
Dictionary<Test, List<Properties.IDescription>> results = new();
|
||||
Test testKey;
|
||||
for (int i = 0; i < descriptions.Count; i++)
|
||||
{
|
||||
testKey = (Test)descriptions[i].Test;
|
||||
if (!results.ContainsKey(testKey))
|
||||
results.Add(testKey, new List<Properties.IDescription>());
|
||||
results[testKey].Add(descriptions[i]);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
protected static List<Properties.IDescription> GetDuplicatorDescriptions(JsonElement[] jsonElements)
|
||||
{
|
||||
List<Properties.IDescription> results = new();
|
||||
Duplicator.Description description;
|
||||
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
|
||||
foreach (JsonElement jsonElement in jsonElements)
|
||||
{
|
||||
if (jsonElement.ValueKind != JsonValueKind.Object)
|
||||
throw new Exception();
|
||||
description = JsonSerializer.Deserialize<Duplicator.Description>(jsonElement.ToString(), jsonSerializerOptions);
|
||||
results.Add(description);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
protected static Tuple<Test[], Dictionary<Test, List<Properties.IDescription>>> GetTuple(IFileRead fileRead, IEnumerable<Properties.IDescription> descriptions, bool extra = false)
|
||||
{
|
||||
Tuple<Test[], Dictionary<Test, List<Properties.IDescription>>> result;
|
||||
Dictionary<Test, List<Properties.IDescription>> keyValuePairs = GetKeyValuePairs(descriptions.ToList());
|
||||
Test[] tests = (from l in keyValuePairs select l.Key).ToArray();
|
||||
fileRead.CheckTests(tests, extra);
|
||||
result = new Tuple<Test[], Dictionary<Test, List<Properties.IDescription>>>(tests, keyValuePairs);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void Shared0449(string to, string[] exceptionLines)
|
||||
{
|
||||
if (_IsDuplicator)
|
||||
CreateProgressDirectory(exceptionLines: null);
|
||||
else
|
||||
{
|
||||
string fileName = string.Concat(to, @"\readme.txt");
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(to))
|
||||
_ = Directory.CreateDirectory(to);
|
||||
File.WriteAllLines(fileName, exceptionLines);
|
||||
}
|
||||
catch (Exception ex) { _Log.Error(ex.Message); }
|
||||
}
|
||||
}
|
||||
|
||||
protected void Shared1880(string itemFile, List<string> directories, FileInfo sourceFile, bool isErrorFile)
|
||||
{
|
||||
string itemDirectory;
|
||||
directories.Add(Path.GetDirectoryName(sourceFile.FullName));
|
||||
itemDirectory = Path.GetDirectoryName(itemFile);
|
||||
FileConnectorConfiguration.PostProcessingModeEnum processingModeEnum;
|
||||
if (!isErrorFile)
|
||||
processingModeEnum = _FileConnectorConfiguration.PostProcessingMode.Value;
|
||||
else
|
||||
processingModeEnum = _FileConnectorConfiguration.ErrorPostProcessingMode.Value;
|
||||
if (processingModeEnum != FileConnectorConfiguration.PostProcessingModeEnum.Delete && !Directory.Exists(itemDirectory))
|
||||
{
|
||||
_ = Directory.CreateDirectory(itemDirectory);
|
||||
FileInfo fileInfo = new(_Logistics.ReportFullPath);
|
||||
Directory.SetCreationTime(itemDirectory, fileInfo.LastWriteTime);
|
||||
}
|
||||
if (_IsEAFHosted)
|
||||
{
|
||||
switch (processingModeEnum)
|
||||
{
|
||||
case FileConnectorConfiguration.PostProcessingModeEnum.Move:
|
||||
File.Move(sourceFile.FullName, itemFile);
|
||||
break;
|
||||
case FileConnectorConfiguration.PostProcessingModeEnum.Copy:
|
||||
File.Copy(sourceFile.FullName, itemFile);
|
||||
break;
|
||||
case FileConnectorConfiguration.PostProcessingModeEnum.Delete:
|
||||
File.Delete(sourceFile.FullName);
|
||||
break;
|
||||
default:
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void Shared1811(string to, FileInfo sourceFile)
|
||||
{
|
||||
if (!_IsDuplicator && _FileConnectorConfiguration.SourceFileFilter != "*" && sourceFile.Exists && sourceFile.Length < _MinFileLength)
|
||||
{
|
||||
string directoryName = Path.GetFileName(to);
|
||||
string jobIdDirectory = Path.GetDirectoryName(to);
|
||||
DateTime dateTime = DateTime.Now.AddMinutes(-15);
|
||||
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
string weekDirectory = string.Concat(_Logistics.DateTimeFromSequence.ToString("yyyy"), "_Week_", weekOfYear, @"\", _Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd"));
|
||||
string destinationDirectory = string.Concat(jobIdDirectory, @"\_ Ignore 100 bytes\", weekDirectory, @"\", directoryName);
|
||||
if (!Directory.Exists(destinationDirectory))
|
||||
_ = Directory.CreateDirectory(destinationDirectory);
|
||||
File.Move(sourceFile.FullName, string.Concat(destinationDirectory, @"\", sourceFile.Name));
|
||||
try
|
||||
{
|
||||
string[] checkDirectories = Directory.GetDirectories(jobIdDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string checkDirectory in checkDirectories)
|
||||
{
|
||||
if (!checkDirectory.Contains('_'))
|
||||
continue;
|
||||
if (Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any())
|
||||
continue;
|
||||
if (Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any())
|
||||
continue;
|
||||
if (Directory.GetDirectories(checkDirectory, "*", SearchOption.AllDirectories).Any())
|
||||
continue;
|
||||
if (Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories).Any())
|
||||
continue;
|
||||
if (new DirectoryInfo(checkDirectory).CreationTime > dateTime)
|
||||
continue;
|
||||
Directory.Delete(checkDirectory, recursive: false);
|
||||
}
|
||||
}
|
||||
catch (Exception) { throw; }
|
||||
}
|
||||
}
|
||||
|
||||
protected void Shared0231(List<string> directories)
|
||||
{
|
||||
if (_FileConnectorConfiguration.PostProcessingMode != FileConnectorConfiguration.PostProcessingModeEnum.Copy)
|
||||
{
|
||||
foreach (string directory in (from l in directories orderby l.Split('\\').Length descending select l).Distinct())
|
||||
{
|
||||
if (Directory.Exists(directory) && !Directory.GetFiles(directory).Any())
|
||||
Directory.Delete(directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void Shared0413(DateTime dateTime, bool isDummyRun, string successDirectory, string duplicateDirectory, List<Tuple<Properties.IScopeInfo, string>> tuples, string duplicateFile)
|
||||
{
|
||||
if (!isDummyRun && _IsEAFHosted)
|
||||
WaitForFileConsumption(_FileConnectorConfiguration.SourceDirectoryCloaking, _Logistics, dateTime, successDirectory, duplicateDirectory, duplicateFile, tuples);
|
||||
else
|
||||
{
|
||||
long breakAfter = DateTime.Now.AddSeconds(_FileConnectorConfiguration.ConnectionRetryInterval.Value).Ticks;
|
||||
for (short i = 0; i < short.MaxValue; i++)
|
||||
{
|
||||
if (!_IsEAFHosted || DateTime.Now.Ticks > breakAfter)
|
||||
break;
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static void Shared0607(string reportFullPath, string duplicateDirectory, string logisticsSequence, string destinationDirectory)
|
||||
{
|
||||
if (destinationDirectory == duplicateDirectory)
|
||||
throw new Exception("Check Target File Folder for %LotIDWithLogisticsSequence%_in process on CI (not Duplicator)");
|
||||
if (destinationDirectory.EndsWith(logisticsSequence))
|
||||
destinationDirectory = Path.GetDirectoryName(destinationDirectory);
|
||||
string[] deleteFiles = Directory.GetFiles(destinationDirectory, "*", SearchOption.AllDirectories);
|
||||
if (deleteFiles.Length > 250)
|
||||
throw new Exception("Safety net!");
|
||||
foreach (string file in deleteFiles)
|
||||
File.Delete(file);
|
||||
Directory.Delete(destinationDirectory, recursive: true);
|
||||
File.Delete(reportFullPath);
|
||||
}
|
||||
|
||||
protected string[] Shared1567(string reportFullPath, List<Tuple<Properties.IScopeInfo, string>> tuples)
|
||||
{
|
||||
string[] results;
|
||||
string historicalText;
|
||||
string logisticsSequence = _Logistics.Sequence.ToString();
|
||||
string jobIdDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation)), @"\", _Logistics.JobID);
|
||||
if (!Directory.Exists(jobIdDirectory))
|
||||
_ = Directory.CreateDirectory(jobIdDirectory);
|
||||
string[] matchDirectories;
|
||||
if (!_IsEAFHosted)
|
||||
matchDirectories = new string[] { Path.GetDirectoryName(Path.GetDirectoryName(reportFullPath)) };
|
||||
else
|
||||
matchDirectories = Directory.GetDirectories(jobIdDirectory, string.Concat(_Logistics.MID, '*', logisticsSequence, '*'), SearchOption.TopDirectoryOnly);
|
||||
if ((matchDirectories is null) || matchDirectories.Length != 1)
|
||||
throw new Exception("Didn't find directory by logistics sequence");
|
||||
string fileName = Path.GetFileNameWithoutExtension(reportFullPath);
|
||||
string sequenceDirectory = string.Concat(matchDirectories[0], @"\", logisticsSequence);
|
||||
if (!Directory.Exists(sequenceDirectory))
|
||||
_ = Directory.CreateDirectory(sequenceDirectory);
|
||||
foreach (Tuple<Properties.IScopeInfo, string> tuple in tuples)
|
||||
{
|
||||
fileName = string.Concat(sequenceDirectory, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc");
|
||||
if (_IsEAFHosted)
|
||||
File.WriteAllText(fileName, tuple.Item2);
|
||||
else
|
||||
{
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
historicalText = File.ReadAllText(fileName);
|
||||
if (tuple.Item2 != historicalText)
|
||||
throw new Exception("File doesn't match historical!");
|
||||
}
|
||||
}
|
||||
}
|
||||
results = matchDirectories;
|
||||
return results;
|
||||
}
|
||||
|
||||
protected void Shared1277(string reportFullPath, string destinationDirectory, string logisticsSequence, string jobIdDirectory, string json)
|
||||
{
|
||||
string ecCharacterizationSi = Path.GetDirectoryName(Path.GetDirectoryName(jobIdDirectory));
|
||||
string destinationJobIdDirectory = string.Concat(ecCharacterizationSi, @"\Processed\", _Logistics.JobID);
|
||||
if (!Directory.Exists(destinationJobIdDirectory))
|
||||
_ = Directory.CreateDirectory(destinationJobIdDirectory);
|
||||
destinationJobIdDirectory = string.Concat(destinationJobIdDirectory, @"\", Path.GetFileName(destinationDirectory).Split(new string[] { logisticsSequence }, StringSplitOptions.None)[0], _Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd_hh;mm_tt_"), DateTime.Now.Ticks - _Logistics.Sequence);
|
||||
string sequenceDirectory = string.Concat(destinationJobIdDirectory, @"\", logisticsSequence);
|
||||
string jsonFileName = string.Concat(sequenceDirectory, @"\", Path.GetFileNameWithoutExtension(reportFullPath), ".json");
|
||||
Directory.Move(destinationDirectory, destinationJobIdDirectory);
|
||||
if (!Directory.Exists(sequenceDirectory))
|
||||
_ = Directory.CreateDirectory(sequenceDirectory);
|
||||
File.Copy(reportFullPath, string.Concat(sequenceDirectory, @"\", Path.GetFileName(reportFullPath)), overwrite: true);
|
||||
File.WriteAllText(jsonFileName, json);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 2022-02-14 -> Shared - FileRead
|
208
Adaptation/Shared/Logistics.cs
Normal file
208
Adaptation/Shared/Logistics.cs
Normal file
@ -0,0 +1,208 @@
|
||||
using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Adaptation.Shared;
|
||||
|
||||
public class Logistics : ILogistics
|
||||
{
|
||||
|
||||
public object NullData { get; private set; }
|
||||
public string JobID { get; private set; } //CellName
|
||||
public long Sequence { get; private set; } //Ticks
|
||||
public DateTime DateTimeFromSequence { get; private set; }
|
||||
public double TotalSecondsSinceLastWriteTimeFromSequence { get; private set; }
|
||||
public string MesEntity { get; private set; } //SPC
|
||||
public string ReportFullPath { get; private set; } //Extract file
|
||||
public string ProcessJobID { get; set; } //Reactor (duplicate but I want it in the logistics)
|
||||
public string MID { get; set; } //Lot & Pocket || Lot
|
||||
public List<string> Tags { get; set; }
|
||||
public List<string> Logistics1 { get; set; }
|
||||
public List<Logistics2> Logistics2 { get; set; }
|
||||
|
||||
public Logistics(IFileRead fileRead)
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
NullData = null;
|
||||
Sequence = dateTime.Ticks;
|
||||
DateTimeFromSequence = dateTime;
|
||||
JobID = fileRead.CellInstanceName;
|
||||
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
|
||||
MesEntity = DefaultMesEntity(dateTime);
|
||||
ReportFullPath = string.Empty;
|
||||
ProcessJobID = nameof(ProcessJobID);
|
||||
MID = nameof(MID);
|
||||
Tags = new List<string>();
|
||||
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
||||
Logistics2 = new List<Logistics2>();
|
||||
}
|
||||
|
||||
public Logistics(IFileRead fileRead, string reportFullPath, bool useSplitForMID, int? fileInfoLength = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(fileRead.CellInstanceName))
|
||||
throw new Exception();
|
||||
if (string.IsNullOrEmpty(fileRead.MesEntity))
|
||||
throw new Exception();
|
||||
NullData = fileRead.NullData;
|
||||
FileInfo fileInfo = new(reportFullPath);
|
||||
DateTime dateTime = fileInfo.LastWriteTime;
|
||||
if (fileInfoLength.HasValue && fileInfo.Length < fileInfoLength.Value)
|
||||
dateTime = dateTime.AddTicks(-1);
|
||||
JobID = fileRead.CellInstanceName;
|
||||
Sequence = dateTime.Ticks;
|
||||
DateTimeFromSequence = dateTime;
|
||||
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
|
||||
MesEntity = fileRead.MesEntity;
|
||||
ReportFullPath = fileInfo.FullName;
|
||||
ProcessJobID = nameof(ProcessJobID);
|
||||
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.FullName);
|
||||
if (useSplitForMID)
|
||||
{
|
||||
if (fileNameWithoutExtension.IndexOf(".") > -1)
|
||||
fileNameWithoutExtension = fileNameWithoutExtension.Split('.')[0].Trim();
|
||||
if (fileNameWithoutExtension.IndexOf("_") > -1)
|
||||
fileNameWithoutExtension = fileNameWithoutExtension.Split('_')[0].Trim();
|
||||
if (fileNameWithoutExtension.IndexOf("-") > -1)
|
||||
fileNameWithoutExtension = fileNameWithoutExtension.Split('-')[0].Trim();
|
||||
}
|
||||
MID = string.Concat(fileNameWithoutExtension.Substring(0, 1).ToUpper(), fileNameWithoutExtension.Substring(1).ToLower());
|
||||
Tags = new List<string>();
|
||||
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
||||
Logistics2 = new List<Logistics2>();
|
||||
}
|
||||
|
||||
public Logistics(string reportFullPath, string logistics)
|
||||
{
|
||||
string key;
|
||||
DateTime dateTime;
|
||||
string[] segments;
|
||||
Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
if (!Logistics1.Any() || !Logistics1[0].StartsWith("LOGISTICS_1"))
|
||||
{
|
||||
NullData = null;
|
||||
JobID = "null";
|
||||
dateTime = new FileInfo(reportFullPath).LastWriteTime;
|
||||
Sequence = dateTime.Ticks;
|
||||
DateTimeFromSequence = dateTime;
|
||||
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
|
||||
MesEntity = DefaultMesEntity(dateTime);
|
||||
ReportFullPath = reportFullPath;
|
||||
ProcessJobID = "R##";
|
||||
MID = "null";
|
||||
Tags = new List<string>();
|
||||
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
||||
Logistics2 = new List<Logistics2>();
|
||||
}
|
||||
else
|
||||
{
|
||||
string logistics1Line1 = Logistics1[0];
|
||||
key = "NULL_DATA=";
|
||||
if (!logistics1Line1.Contains(key))
|
||||
NullData = null;
|
||||
else
|
||||
{
|
||||
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
NullData = segments[1].Split(';')[0];
|
||||
}
|
||||
key = "JOBID=";
|
||||
if (!logistics1Line1.Contains(key))
|
||||
JobID = "null";
|
||||
else
|
||||
{
|
||||
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
JobID = segments[1].Split(';')[0];
|
||||
}
|
||||
key = "SEQUENCE=";
|
||||
if (!logistics1Line1.Contains(key))
|
||||
dateTime = new FileInfo(reportFullPath).LastWriteTime;
|
||||
else
|
||||
{
|
||||
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (!long.TryParse(segments[1].Split(';')[0].Split('.')[0], out long sequence) || sequence < new DateTime(1999, 1, 1).Ticks)
|
||||
dateTime = new FileInfo(reportFullPath).LastWriteTime;
|
||||
else
|
||||
dateTime = new DateTime(sequence);
|
||||
}
|
||||
Sequence = dateTime.Ticks;
|
||||
DateTimeFromSequence = dateTime;
|
||||
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
|
||||
DateTime lastWriteTime = new FileInfo(reportFullPath).LastWriteTime;
|
||||
if (TotalSecondsSinceLastWriteTimeFromSequence > 600)
|
||||
{
|
||||
if (lastWriteTime != dateTime)
|
||||
try
|
||||
{ File.SetLastWriteTime(reportFullPath, dateTime); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
key = "MES_ENTITY=";
|
||||
if (!logistics1Line1.Contains(key))
|
||||
MesEntity = DefaultMesEntity(dateTime);
|
||||
else
|
||||
{
|
||||
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
MesEntity = segments[1].Split(';')[0];
|
||||
}
|
||||
ReportFullPath = reportFullPath;
|
||||
key = "PROCESS_JOBID=";
|
||||
if (!logistics1Line1.Contains(key))
|
||||
ProcessJobID = "R##";
|
||||
else
|
||||
{
|
||||
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
ProcessJobID = segments[1].Split(';')[0];
|
||||
}
|
||||
key = "MID=";
|
||||
if (!logistics1Line1.Contains(key))
|
||||
MID = "null";
|
||||
else
|
||||
{
|
||||
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
MID = segments[1].Split(';')[0];
|
||||
}
|
||||
}
|
||||
Logistics2 logistics2;
|
||||
Tags = new List<string>();
|
||||
Logistics2 = new List<Logistics2>();
|
||||
for (int i = 1; i < Logistics1.Count; i++)
|
||||
{
|
||||
if (Logistics1[i].StartsWith("LOGISTICS_2"))
|
||||
{
|
||||
logistics2 = new Logistics2(Logistics1[i]);
|
||||
Logistics2.Add(logistics2);
|
||||
}
|
||||
}
|
||||
for (int i = Logistics1.Count - 1; i > -1; i--)
|
||||
{
|
||||
if (Logistics1[i].StartsWith("LOGISTICS_2"))
|
||||
Logistics1.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
public Logistics ShallowCopy() => (Logistics)MemberwiseClone();
|
||||
|
||||
private static string DefaultMesEntity(DateTime dateTime) => string.Concat(dateTime.Ticks, "_MES_ENTITY");
|
||||
|
||||
internal string GetLotViaMostCommonMethod() => MID.Substring(0, MID.Length - 2);
|
||||
|
||||
internal string GetPocketNumberViaMostCommonMethod() => MID.Substring(MID.Length - 2);
|
||||
|
||||
internal void Update(string dateTime, string processJobID, string mid)
|
||||
{
|
||||
if (!DateTime.TryParse(dateTime, out DateTime dateTimeCasted))
|
||||
dateTimeCasted = DateTime.Now;
|
||||
NullData = null;
|
||||
//JobID = Description.GetCellName();
|
||||
Sequence = dateTimeCasted.Ticks;
|
||||
DateTimeFromSequence = dateTimeCasted;
|
||||
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTimeCasted).TotalSeconds;
|
||||
//MesEntity = DefaultMesEntity(dateTime);
|
||||
//ReportFullPath = string.Empty;
|
||||
ProcessJobID = processJobID;
|
||||
MID = mid;
|
||||
Tags = new List<string>();
|
||||
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
||||
Logistics2 = new List<Logistics2>();
|
||||
}
|
||||
}
|
78
Adaptation/Shared/Logistics2.cs
Normal file
78
Adaptation/Shared/Logistics2.cs
Normal file
@ -0,0 +1,78 @@
|
||||
using System;
|
||||
|
||||
namespace Adaptation.Shared;
|
||||
|
||||
public class Logistics2 : Methods.ILogistics2
|
||||
{
|
||||
|
||||
public string MID { get; private set; }
|
||||
public string RunNumber { get; private set; }
|
||||
public string SatelliteGroup { get; private set; }
|
||||
public string PartNumber { get; private set; }
|
||||
public string PocketNumber { get; private set; }
|
||||
public string WaferLot { get; private set; }
|
||||
public string Recipe { get; private set; }
|
||||
|
||||
public Logistics2(string logistics2)
|
||||
{
|
||||
string key;
|
||||
string[] segments;
|
||||
key = "JOBID=";
|
||||
if (!logistics2.Contains(key))
|
||||
MID = "null";
|
||||
else
|
||||
{
|
||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
MID = segments[1].Split(';')[0];
|
||||
}
|
||||
key = "MID=";
|
||||
if (!logistics2.Contains(key))
|
||||
RunNumber = "null";
|
||||
else
|
||||
{
|
||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
RunNumber = segments[1].Split(';')[0];
|
||||
}
|
||||
key = "INFO=";
|
||||
if (!logistics2.Contains(key))
|
||||
SatelliteGroup = "null";
|
||||
else
|
||||
{
|
||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
SatelliteGroup = segments[1].Split(';')[0];
|
||||
}
|
||||
key = "PRODUCT=";
|
||||
if (!logistics2.Contains(key))
|
||||
PartNumber = "null";
|
||||
else
|
||||
{
|
||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
PartNumber = segments[1].Split(';')[0];
|
||||
}
|
||||
key = "CHAMBER=";
|
||||
if (!logistics2.Contains(key))
|
||||
PocketNumber = "null";
|
||||
else
|
||||
{
|
||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
PocketNumber = segments[1].Split(';')[0];
|
||||
}
|
||||
key = "WAFER_ID=";
|
||||
if (!logistics2.Contains(key))
|
||||
WaferLot = "null";
|
||||
else
|
||||
{
|
||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
WaferLot = segments[1].Split(';')[0];
|
||||
}
|
||||
key = "PPID=";
|
||||
if (!logistics2.Contains(key))
|
||||
Recipe = "null";
|
||||
else
|
||||
{
|
||||
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
|
||||
Recipe = segments[1].Split(';')[0];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
22
Adaptation/Shared/Methods/IDescription.cs
Normal file
22
Adaptation/Shared/Methods/IDescription.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.Shared.Methods;
|
||||
|
||||
public interface IDescription
|
||||
{
|
||||
|
||||
string GetEventDescription();
|
||||
List<string> GetDetailNames();
|
||||
List<string> GetHeaderNames();
|
||||
IDescription GetDisplayNames();
|
||||
List<string> GetParameterNames();
|
||||
List<string> GetPairedParameterNames();
|
||||
List<string> GetIgnoreParameterNames(Test test);
|
||||
List<string> GetNames(IFileRead fileRead, Logistics logistics);
|
||||
JsonProperty[] GetDefault(IFileRead fileRead, Logistics logistics);
|
||||
Dictionary<string, string> GetDisplayNamesJsonElement(IFileRead fileRead);
|
||||
IDescription GetDefaultDescription(IFileRead fileRead, Logistics logistics);
|
||||
List<IDescription> GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData);
|
||||
|
||||
}
|
24
Adaptation/Shared/Methods/IFileRead.cs
Normal file
24
Adaptation/Shared/Methods/IFileRead.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.Shared.Methods;
|
||||
|
||||
public interface IFileRead : Properties.IFileRead
|
||||
{
|
||||
|
||||
void WaitForThread();
|
||||
JsonProperty[] GetDefault();
|
||||
void Callback(object state);
|
||||
string GetEventDescription();
|
||||
List<string> GetHeaderNames();
|
||||
void CheckTests(Test[] tests, bool extra);
|
||||
Dictionary<string, string> GetDisplayNamesJsonElement();
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> ReExtract();
|
||||
List<IDescription> GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData);
|
||||
void Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception = null);
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, string eventName);
|
||||
string[] Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception);
|
||||
|
||||
}
|
5
Adaptation/Shared/Methods/ILogistics.cs
Normal file
5
Adaptation/Shared/Methods/ILogistics.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Shared.Methods;
|
||||
|
||||
public interface ILogistics : Properties.ILogistics
|
||||
{
|
||||
}
|
5
Adaptation/Shared/Methods/ILogistics2.cs
Normal file
5
Adaptation/Shared/Methods/ILogistics2.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace Adaptation.Shared.Methods;
|
||||
|
||||
public interface ILogistics2 : Properties.ILogistics2
|
||||
{
|
||||
}
|
14
Adaptation/Shared/Methods/IProcessData.cs
Normal file
14
Adaptation/Shared/Methods/IProcessData.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.Shared.Methods;
|
||||
|
||||
public interface IProcessData : Properties.IProcessData
|
||||
{
|
||||
|
||||
string GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors);
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection);
|
||||
|
||||
}
|
8
Adaptation/Shared/Methods/ISMTP.cs
Normal file
8
Adaptation/Shared/Methods/ISMTP.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace Adaptation.Shared.Methods;
|
||||
|
||||
public interface ISMTP
|
||||
{
|
||||
void SendLowPriorityEmailMessage(string subject, string body);
|
||||
void SendHighPriorityEmailMessage(string subject, string body);
|
||||
void SendNormalPriorityEmailMessage(string subject, string body);
|
||||
}
|
10
Adaptation/Shared/ParameterType.cs
Normal file
10
Adaptation/Shared/ParameterType.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace Adaptation.Shared;
|
||||
|
||||
public enum ParameterType
|
||||
{
|
||||
String = 0,
|
||||
Integer = 2,
|
||||
Double = 3,
|
||||
Boolean = 4,
|
||||
StructuredType = 5
|
||||
}
|
411
Adaptation/Shared/ProcessDataStandardFormat.cs
Normal file
411
Adaptation/Shared/ProcessDataStandardFormat.cs
Normal file
@ -0,0 +1,411 @@
|
||||
using Adaptation.Shared.Methods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.Shared;
|
||||
|
||||
public class ProcessDataStandardFormat
|
||||
{
|
||||
|
||||
public const string RecordStart = "RECORD_START";
|
||||
|
||||
public enum SearchFor
|
||||
{
|
||||
EquipmentIntegration = 1,
|
||||
BusinessIntegration = 2,
|
||||
SystemExport = 3,
|
||||
Archive = 4
|
||||
}
|
||||
|
||||
public static string GetPDSFText(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, string logisticsText)
|
||||
{
|
||||
string result;
|
||||
if (!jsonElements.Any())
|
||||
result = string.Empty;
|
||||
else
|
||||
{
|
||||
int columns = 0;
|
||||
List<string> lines;
|
||||
string endOffset = "E#######T";
|
||||
string dataOffset = "D#######T";
|
||||
string headerOffset = "H#######T";
|
||||
string format = "MM/dd/yyyy HH:mm:ss";
|
||||
StringBuilder stringBuilder = new();
|
||||
lines = new string[] { "HEADER_TAG\tHEADER_VALUE", "FORMAT\t2.00", "NUMBER_PASSES\t0001", string.Concat("HEADER_OFFSET\t", headerOffset), string.Concat("DATA_OFFSET\t", dataOffset), string.Concat("END_OFFSET\t", endOffset) }.ToList();
|
||||
_ = stringBuilder.Append("\"Time\"").Append('\t');
|
||||
_ = stringBuilder.Append("\"A_LOGISTICS\"").Append('\t');
|
||||
_ = stringBuilder.Append("\"B_LOGISTICS\"").Append('\t');
|
||||
for (int i = 0; i < jsonElements.Length;)
|
||||
{
|
||||
foreach (JsonProperty jsonProperty in jsonElements[0].EnumerateObject())
|
||||
{
|
||||
columns += 1;
|
||||
_ = stringBuilder.Append('"').Append(jsonProperty.Name).Append('"').Append('\t');
|
||||
}
|
||||
break;
|
||||
}
|
||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||
lines.Add(stringBuilder.ToString());
|
||||
for (int i = 0; i < jsonElements.Length; i++)
|
||||
{
|
||||
_ = stringBuilder.Clear();
|
||||
_ = stringBuilder.Append("0.1").Append('\t');
|
||||
_ = stringBuilder.Append('1').Append('\t');
|
||||
_ = stringBuilder.Append('2').Append('\t');
|
||||
foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject())
|
||||
_ = stringBuilder.Append(jsonProperty.Value).Append('\t');
|
||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||
lines.Add(stringBuilder.ToString());
|
||||
}
|
||||
lines.Add(string.Concat("NUM_DATA_ROWS ", jsonElements.Length.ToString().PadLeft(9, '0')));
|
||||
lines.Add(string.Concat("NUM_DATA_COLUMNS ", (columns + 3).ToString().PadLeft(9, '0')));
|
||||
lines.Add("DELIMITER ;");
|
||||
lines.Add(string.Concat("START_TIME_FORMAT ", format));
|
||||
lines.Add(string.Concat("START_TIME ", logistics.DateTimeFromSequence.ToString(format))); //12/26/2019 15:22:44
|
||||
lines.Add(string.Concat("LOGISTICS_COLUMN", '\t', "A_LOGISTICS"));
|
||||
lines.Add(string.Concat("LOGISTICS_COLUMN", '\t', "B_LOGISTICS"));
|
||||
if (!string.IsNullOrEmpty(logisticsText))
|
||||
lines.Add(logisticsText);
|
||||
else
|
||||
{
|
||||
lines.Add(string.Concat("LOGISTICS_1", '\t', "A_CHAMBER=;A_INFO=", fileRead.EventName, ";A_INFO2=", fileRead.EquipmentType, ";A_JOBID=", fileRead.CellInstanceName, ";A_MES_ENTITY=", fileRead.MesEntity, ";A_MID=", logistics.MID, ";A_NULL_DATA=", fileRead.NullData, ";A_PPID=NO_PPID;A_PROCESS_JOBID=", logistics.ProcessJobID, ";A_PRODUCT=;A_SEQUENCE=", logistics.Sequence, ";A_WAFER_ID=;"));
|
||||
lines.Add(string.Concat("LOGISTICS_2", '\t', "B_CHAMBER=;B_INFO=", fileRead.EventName, ";B_INFO2=", fileRead.EquipmentType, ";B_JOBID=", fileRead.CellInstanceName, ";B_MES_ENTITY=", fileRead.MesEntity, ";B_MID=", logistics.MID, ";B_NULL_DATA=", fileRead.NullData, ";B_PPID=NO_PPID;B_PROCESS_JOBID=", logistics.ProcessJobID, ";B_PRODUCT=;B_SEQUENCE=", logistics.Sequence, ";B_WAFER_ID=;"));
|
||||
lines.Add("END_HEADER");
|
||||
}
|
||||
_ = stringBuilder.Clear();
|
||||
foreach (string line in lines)
|
||||
_ = stringBuilder.AppendLine(line);
|
||||
result = stringBuilder.ToString();
|
||||
result = result.Replace(headerOffset, result.IndexOf("NUM_DATA_ROWS").ToString().PadLeft(9, '0')).
|
||||
Replace(dataOffset, result.IndexOf('"').ToString().PadLeft(9, '0')).
|
||||
Replace(endOffset, result.Length.ToString().PadLeft(9, '0'));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Tuple<string, string[], string[]> GetLogisticsColumnsAndBody(string reportFullPath, string[] lines = null)
|
||||
{
|
||||
string segment;
|
||||
List<string> body = new();
|
||||
StringBuilder logistics = new();
|
||||
if (lines is null)
|
||||
lines = File.ReadAllLines(reportFullPath);
|
||||
string[] segments;
|
||||
if (lines.Length < 7)
|
||||
segments = Array.Empty<string>();
|
||||
else
|
||||
segments = lines[6].Trim().Split('\t');
|
||||
List<string> columns = new();
|
||||
for (int c = 0; c < segments.Length; c++)
|
||||
{
|
||||
segment = segments[c].Substring(1, segments[c].Length - 2);
|
||||
if (!columns.Contains(segment))
|
||||
columns.Add(segment);
|
||||
else
|
||||
{
|
||||
for (short i = 1; i < short.MaxValue; i++)
|
||||
{
|
||||
segment = string.Concat(segment, "_", i);
|
||||
if (!columns.Contains(segment))
|
||||
{
|
||||
columns.Add(segment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bool lookForLogistics = false;
|
||||
for (int r = 7; r < lines.Length; r++)
|
||||
{
|
||||
if (lines[r].StartsWith("NUM_DATA_ROWS"))
|
||||
lookForLogistics = true;
|
||||
if (!lookForLogistics)
|
||||
{
|
||||
body.Add(lines[r]);
|
||||
continue;
|
||||
}
|
||||
if (lines[r].StartsWith("LOGISTICS_1"))
|
||||
{
|
||||
for (int i = r; i < lines.Length; i++)
|
||||
{
|
||||
if (lines[r].StartsWith("END_HEADER"))
|
||||
break;
|
||||
_ = logistics.AppendLine(lines[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new Tuple<string, string[], string[]>(logistics.ToString(), columns.ToArray(), body.ToArray());
|
||||
}
|
||||
|
||||
public static JsonElement[] GetArray(Tuple<string, string[], string[]> pdsf, bool lookForNumbers = false)
|
||||
{
|
||||
JsonElement[] results;
|
||||
string logistics = pdsf.Item1;
|
||||
string[] columns = pdsf.Item2;
|
||||
string[] bodyLines = pdsf.Item3;
|
||||
if (!bodyLines.Any() || !bodyLines[0].Contains('\t'))
|
||||
results = JsonSerializer.Deserialize<JsonElement[]>("[]");
|
||||
else
|
||||
{
|
||||
string value;
|
||||
string[] segments;
|
||||
StringBuilder stringBuilder = new();
|
||||
foreach (string bodyLine in bodyLines)
|
||||
{
|
||||
_ = stringBuilder.Append('{');
|
||||
segments = bodyLine.Trim().Split('\t');
|
||||
if (!lookForNumbers)
|
||||
{
|
||||
for (int c = 1; c < segments.Length; c++)
|
||||
{
|
||||
value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\");
|
||||
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\",");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int c = 1; c < segments.Length; c++)
|
||||
{
|
||||
value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\");
|
||||
if (string.IsNullOrEmpty(value))
|
||||
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append("null,");
|
||||
else if (value.All(char.IsDigit))
|
||||
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append(',');
|
||||
else
|
||||
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\",");
|
||||
}
|
||||
}
|
||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||
_ = stringBuilder.AppendLine("},");
|
||||
}
|
||||
_ = stringBuilder.Remove(stringBuilder.Length - 3, 3);
|
||||
results = JsonSerializer.Deserialize<JsonElement[]>(string.Concat("[", stringBuilder, "]"));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public static Dictionary<string, List<string>> GetDictionary(Tuple<string, string[], string[]> pdsf)
|
||||
{
|
||||
Dictionary<string, List<string>> results = new();
|
||||
string[] segments;
|
||||
string[] columns = pdsf.Item2;
|
||||
string[] bodyLines = pdsf.Item3;
|
||||
foreach (string column in columns)
|
||||
results.Add(column, new List<string>());
|
||||
foreach (string bodyLine in bodyLines)
|
||||
{
|
||||
segments = bodyLine.Split('\t');
|
||||
for (int c = 1; c < segments.Length; c++)
|
||||
{
|
||||
if (c >= columns.Length)
|
||||
continue;
|
||||
results[columns[c]].Add(segments[c]);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public static Tuple<string, Dictionary<Test, Dictionary<string, List<string>>>> GetTestDictionary(Tuple<string, string[], string[]> pdsf)
|
||||
{
|
||||
Dictionary<Test, Dictionary<string, List<string>>> results = new();
|
||||
string testColumn = nameof(Test);
|
||||
Dictionary<string, List<string>> keyValuePairs = GetDictionary(pdsf);
|
||||
if (!keyValuePairs.ContainsKey(testColumn))
|
||||
throw new Exception();
|
||||
int min;
|
||||
int max;
|
||||
Test testKey;
|
||||
List<string> vs;
|
||||
string columnKey;
|
||||
Dictionary<Test, List<int>> tests = new();
|
||||
for (int i = 0; i < keyValuePairs[testColumn].Count; i++)
|
||||
{
|
||||
if (Enum.TryParse(keyValuePairs[testColumn][i], out Test test))
|
||||
{
|
||||
if (!results.ContainsKey(test))
|
||||
{
|
||||
tests.Add(test, new List<int>());
|
||||
results.Add(test, new Dictionary<string, List<string>>());
|
||||
}
|
||||
tests[test].Add(i);
|
||||
}
|
||||
}
|
||||
foreach (KeyValuePair<Test, List<int>> testKeyValuePair in tests)
|
||||
{
|
||||
testKey = testKeyValuePair.Key;
|
||||
min = testKeyValuePair.Value.Min();
|
||||
max = testKeyValuePair.Value.Max() + 1;
|
||||
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
|
||||
results[testKey].Add(keyValuePair.Key, new List<string>());
|
||||
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
|
||||
{
|
||||
vs = keyValuePair.Value;
|
||||
columnKey = keyValuePair.Key;
|
||||
for (int i = min; i < max; i++)
|
||||
{
|
||||
if (vs.Count > i)
|
||||
results[testKey][columnKey].Add(vs[i]);
|
||||
else
|
||||
results[testKey][columnKey].Add(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Tuple<string, Dictionary<Test, Dictionary<string, List<string>>>>(pdsf.Item1, results);
|
||||
}
|
||||
|
||||
private static string GetString(SearchFor searchFor, bool addSpaces, char separator = ' ')
|
||||
{
|
||||
if (!addSpaces)
|
||||
return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), searchFor);
|
||||
else
|
||||
return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), separator, searchFor.ToString().Replace("In", string.Concat(separator, "In")).Replace("Ex", string.Concat(separator, "Ex")));
|
||||
}
|
||||
|
||||
public static string EquipmentIntegration(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.EquipmentIntegration, addSpaces, separator);
|
||||
|
||||
public static string BusinessIntegration(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.BusinessIntegration, addSpaces, separator);
|
||||
|
||||
public static string SystemExport(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.SystemExport, addSpaces, separator);
|
||||
|
||||
public static string Archive(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.Archive, addSpaces, separator);
|
||||
|
||||
public static string GetLines(Logistics logistics, Properties.IScopeInfo scopeInfo, List<string> names, Dictionary<string, List<string>> keyValuePairs, string dateFormat, string timeFormat, List<string> pairedParameterNames, bool useDateTimeFromSequence = true, string format = "", List<string> ignoreParameterNames = null)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
if (ignoreParameterNames is null)
|
||||
ignoreParameterNames = new List<string>();
|
||||
if (useDateTimeFromSequence && !string.IsNullOrEmpty(format))
|
||||
throw new Exception();
|
||||
else if (!useDateTimeFromSequence && string.IsNullOrEmpty(format))
|
||||
throw new Exception();
|
||||
string nullData;
|
||||
const string columnDate = "Date";
|
||||
const string columnTime = "Time";
|
||||
const string firstDuplicate = "_1";
|
||||
_ = result.AppendLine(scopeInfo.Header);
|
||||
StringBuilder line = new();
|
||||
if (logistics.NullData is null)
|
||||
nullData = string.Empty;
|
||||
else
|
||||
nullData = logistics.NullData.ToString();
|
||||
int count = (from l in keyValuePairs select l.Value.Count).Min();
|
||||
for (int r = 0; r < count; r++)
|
||||
{
|
||||
_ = line.Clear();
|
||||
_ = line.Append('!');
|
||||
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
|
||||
{
|
||||
if (!names.Contains(keyValuePair.Key))
|
||||
continue;
|
||||
if (ignoreParameterNames.Contains(keyValuePair.Key))
|
||||
continue;
|
||||
if (pairedParameterNames.Contains(keyValuePair.Key))
|
||||
{
|
||||
if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData)
|
||||
continue;
|
||||
else
|
||||
_ = result.Append(line).Append(keyValuePair.Key).Append(';').AppendLine(keyValuePair.Value[r]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (useDateTimeFromSequence && keyValuePair.Key == columnDate)
|
||||
_ = line.Append(logistics.DateTimeFromSequence.ToString(dateFormat));
|
||||
else if (useDateTimeFromSequence && keyValuePair.Key == columnTime)
|
||||
_ = line.Append(logistics.DateTimeFromSequence.ToString(timeFormat));
|
||||
else if (!useDateTimeFromSequence && keyValuePair.Key == columnDate && keyValuePair.Value[r].Length == format.Length)
|
||||
_ = line.Append(DateTime.ParseExact(keyValuePair.Value[r], format, CultureInfo.InvariantCulture).ToString(dateFormat));
|
||||
else if (!useDateTimeFromSequence && keyValuePair.Key == columnTime && keyValuePairs.ContainsKey(string.Concat(keyValuePair.Key, firstDuplicate)) && keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r].Length == format.Length)
|
||||
_ = line.Append(DateTime.ParseExact(keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r], format, CultureInfo.InvariantCulture).ToString(timeFormat));
|
||||
else if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData)
|
||||
_ = line.Append(nullData);
|
||||
else
|
||||
_ = line.Append(keyValuePair.Value[r]);
|
||||
_ = line.Append(';');
|
||||
}
|
||||
}
|
||||
if (!pairedParameterNames.Any())
|
||||
{
|
||||
_ = line.Remove(line.Length - 1, 1);
|
||||
_ = result.AppendLine(line.ToString());
|
||||
}
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
public static List<string> PDSFToFixedWidth(string reportFullPath)
|
||||
{
|
||||
List<string> results = new();
|
||||
if (!File.Exists(reportFullPath))
|
||||
throw new Exception();
|
||||
int[] group;
|
||||
string line;
|
||||
int startsAt = 0;
|
||||
string[] segments;
|
||||
int? currentGroup = null;
|
||||
char inputSeperator = '\t';
|
||||
char outputSeperator = '\t';
|
||||
List<int> vs = new();
|
||||
List<int[]> groups = new();
|
||||
string[] lines = File.ReadAllLines(reportFullPath);
|
||||
StringBuilder stringBuilder = new();
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(lines[i]))
|
||||
continue;
|
||||
segments = lines[i].Split(inputSeperator);
|
||||
if (currentGroup is null)
|
||||
currentGroup = segments.Length;
|
||||
if (segments.Length != currentGroup)
|
||||
{
|
||||
currentGroup = segments.Length;
|
||||
groups.Add(new int[] { startsAt, i - 1 });
|
||||
startsAt = i;
|
||||
}
|
||||
}
|
||||
if (startsAt == lines.Length - 1 && lines[0].Split(inputSeperator).Length != currentGroup)
|
||||
groups.Add(new int[] { lines.Length - 1, lines.Length - 1 });
|
||||
for (int g = 0; g < groups.Count; g++)
|
||||
{
|
||||
vs.Clear();
|
||||
group = groups[g];
|
||||
line = lines[group[0]];
|
||||
segments = line.Split(inputSeperator);
|
||||
for (int s = 0; s < segments.Length; s++)
|
||||
vs.Add(segments[s].Length);
|
||||
for (int i = group[0]; i <= group[1]; i++)
|
||||
{
|
||||
line = lines[i];
|
||||
segments = line.Split(inputSeperator);
|
||||
for (int s = 0; s < segments.Length; s++)
|
||||
{
|
||||
if (vs[s] < segments[s].Length)
|
||||
vs[s] = segments[s].Length;
|
||||
}
|
||||
}
|
||||
_ = stringBuilder.Clear();
|
||||
for (int s = 0; s < segments.Length; s++)
|
||||
_ = stringBuilder.Append((s + 1).ToString().PadLeft(vs[s], ' ')).Append(outputSeperator);
|
||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||
results.Add(stringBuilder.ToString());
|
||||
for (int i = group[0]; i <= group[1]; i++)
|
||||
{
|
||||
line = lines[i];
|
||||
_ = stringBuilder.Clear();
|
||||
segments = line.Split(inputSeperator);
|
||||
for (int s = 0; s < segments.Length; s++)
|
||||
_ = stringBuilder.Append(segments[s].PadLeft(vs[s], ' ')).Append(outputSeperator);
|
||||
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
|
||||
results.Add(stringBuilder.ToString());
|
||||
}
|
||||
results.Add(string.Empty);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
10
Adaptation/Shared/Properties/IDescription.cs
Normal file
10
Adaptation/Shared/Properties/IDescription.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace Adaptation.Shared.Properties;
|
||||
|
||||
public interface IDescription
|
||||
{
|
||||
|
||||
int Test { get; }
|
||||
int Count { get; }
|
||||
int Index { get; }
|
||||
|
||||
}
|
17
Adaptation/Shared/Properties/IFileRead.cs
Normal file
17
Adaptation/Shared/Properties/IFileRead.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace Adaptation.Shared.Properties;
|
||||
|
||||
public interface IFileRead
|
||||
{
|
||||
bool IsEvent { get; }
|
||||
string NullData { get; }
|
||||
string MesEntity { get; }
|
||||
bool IsEAFHosted { get; }
|
||||
string EventName { get; }
|
||||
string EquipmentType { get; }
|
||||
string ReportFullPath { get; }
|
||||
string CellInstanceName { get; }
|
||||
string ExceptionSubject { get; }
|
||||
bool UseCyclicalForDescription { get; }
|
||||
string CellInstanceConnectionName { get; }
|
||||
string ParameterizedModelObjectDefinitionType { get; }
|
||||
}
|
22
Adaptation/Shared/Properties/ILogistics.cs
Normal file
22
Adaptation/Shared/Properties/ILogistics.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.Shared.Properties;
|
||||
|
||||
public interface ILogistics
|
||||
{
|
||||
|
||||
public object NullData { get; }
|
||||
public string JobID { get; } //CellName
|
||||
public long Sequence { get; } //Ticks
|
||||
public DateTime DateTimeFromSequence { get; }
|
||||
public double TotalSecondsSinceLastWriteTimeFromSequence { get; }
|
||||
public string MesEntity { get; } //SPC
|
||||
public string ReportFullPath { get; } //Extract file
|
||||
public string ProcessJobID { get; set; } //Reactor (duplicate but I want it in the logistics)
|
||||
public string MID { get; set; } //Lot & Pocket || Lot
|
||||
public List<string> Tags { get; set; }
|
||||
public List<string> Logistics1 { get; set; }
|
||||
public List<Logistics2> Logistics2 { get; set; }
|
||||
|
||||
}
|
14
Adaptation/Shared/Properties/ILogistics2.cs
Normal file
14
Adaptation/Shared/Properties/ILogistics2.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace Adaptation.Shared.Properties;
|
||||
|
||||
public interface ILogistics2
|
||||
{
|
||||
|
||||
public string MID { get; }
|
||||
public string RunNumber { get; }
|
||||
public string SatelliteGroup { get; }
|
||||
public string PartNumber { get; }
|
||||
public string PocketNumber { get; }
|
||||
public string WaferLot { get; }
|
||||
public string Recipe { get; }
|
||||
|
||||
}
|
10
Adaptation/Shared/Properties/IProcessData.cs
Normal file
10
Adaptation/Shared/Properties/IProcessData.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Adaptation.Shared.Properties;
|
||||
|
||||
public interface IProcessData
|
||||
{
|
||||
|
||||
List<object> Details { get; }
|
||||
|
||||
}
|
17
Adaptation/Shared/Properties/IScopeInfo.cs
Normal file
17
Adaptation/Shared/Properties/IScopeInfo.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace Adaptation.Shared.Properties;
|
||||
|
||||
public interface IScopeInfo
|
||||
{
|
||||
|
||||
Enum Enum { get; }
|
||||
string HTML { get; }
|
||||
string Title { get; }
|
||||
string FileName { get; }
|
||||
int TestValue { get; }
|
||||
string Header { get; }
|
||||
string QueryFilter { get; }
|
||||
string FileNameWithoutExtension { get; }
|
||||
|
||||
}
|
58
Adaptation/Shared/Test.cs
Normal file
58
Adaptation/Shared/Test.cs
Normal file
@ -0,0 +1,58 @@
|
||||
namespace Adaptation.Shared;
|
||||
|
||||
public enum Test
|
||||
{
|
||||
AFMRoughness = 34,
|
||||
BioRadQS408M = 25,
|
||||
BioRadStratus = 26,
|
||||
BreakdownVoltageCenter = 0,
|
||||
BreakdownVoltageEdge = 1,
|
||||
BreakdownVoltageMiddle8in = 2,
|
||||
CandelaKlarfDC = 6,
|
||||
CandelaLaser = 36,
|
||||
CandelaProdU = 39,
|
||||
CandelaPSL = 38,
|
||||
CandelaVerify = 37,
|
||||
CDE = 24,
|
||||
CV = 3,
|
||||
DailyRPMAverage = 19,
|
||||
DailyRPMPLRatio = 20,
|
||||
DailyRPMXY = 18,
|
||||
Denton = 9,
|
||||
DiffusionLength = 45,
|
||||
GRATXTCenter = 51,
|
||||
GRATXTEdge = 52, //Largest
|
||||
GrowthRateXML = 50,
|
||||
Hall = 10,
|
||||
HgCV = 23,
|
||||
JVXRD = 47,
|
||||
Lehighton = 13,
|
||||
LogbookCAC = 49,
|
||||
Microscope = 46,
|
||||
MonthlyCV = 4,
|
||||
MonthlyHall = 11,
|
||||
MonthlyXRD = 32,
|
||||
Photoreflectance = 22,
|
||||
PlatoA = 48,
|
||||
RPMAverage = 16,
|
||||
RPMPLRatio = 17,
|
||||
RPMXY = 15,
|
||||
SP1 = 8,
|
||||
Tencor = 7,
|
||||
UV = 35,
|
||||
VerificationLehighton = 14,
|
||||
VerificationRPM = 21,
|
||||
VerificationWarpAndBow = 29,
|
||||
VpdIcpmsAnalyte = 27,
|
||||
WarpAndBow = 28,
|
||||
WeeklyCV = 5,
|
||||
WeeklyHall = 12,
|
||||
WeeklyXRD = 33,
|
||||
WeeklyXRDAIcomp = 40,
|
||||
WeeklyXRDFWHM002 = 41,
|
||||
WeeklyXRDFWHM105 = 42,
|
||||
WeeklyXRDSLStks = 43,
|
||||
WeeklyXRDXRR = 44,
|
||||
XRDWeightedAverage = 31,
|
||||
XRDXY = 30,
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
using Adaptation.Shared.Methods;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace _Tests.CreateSelfDescription.Staging.v2_39_0;
|
||||
|
||||
[TestClass]
|
||||
public class DEP08SIASM : EAFLoggingUnitTesting
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
internal static DEP08SIASM EAFLoggingUnitTesting { get; private set; }
|
||||
|
||||
public DEP08SIASM() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public DEP08SIASM(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
EAFLoggingUnitTesting = new DEP08SIASM(testContext);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
|
||||
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
|
||||
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
|
||||
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
|
||||
}
|
||||
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
if (EAFLoggingUnitTesting.Logger is not null)
|
||||
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
|
||||
if (EAFLoggingUnitTesting is not null)
|
||||
EAFLoggingUnitTesting.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM()
|
||||
{
|
||||
string check = "~EDA-IQS";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains(check));
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM"));
|
||||
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
|
||||
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM_()
|
||||
{
|
||||
string check = "~IQS-OpenInsight";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains(check));
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM-"));
|
||||
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
|
||||
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM__()
|
||||
{
|
||||
string check = "~OpenInsight-APC";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains(check));
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM--"));
|
||||
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
|
||||
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM___()
|
||||
{
|
||||
string check = "~APC-SPaCe";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains(check));
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM---"));
|
||||
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
|
||||
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM____()
|
||||
{
|
||||
string check = "~SPaCe-SPaCe Villach";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains(check));
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM----"));
|
||||
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
|
||||
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM_____()
|
||||
{
|
||||
string check = "~SPaCe Villach-Archive";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains(check));
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM-----"));
|
||||
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
|
||||
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM______()
|
||||
{
|
||||
string check = "~Archive";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains(check));
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM------"));
|
||||
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
|
||||
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM_______()
|
||||
{
|
||||
string check = "~IsDummy";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains(check));
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM-------"));
|
||||
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
|
||||
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
using Adaptation.Shared.Methods;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace _Tests.CreateSelfDescription.Staging.v2_39_0;
|
||||
|
||||
[TestClass]
|
||||
public class R34_EQPT : EAFLoggingUnitTesting
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
internal static R34_EQPT EAFLoggingUnitTesting { get; private set; }
|
||||
|
||||
public R34_EQPT() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public R34_EQPT(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
EAFLoggingUnitTesting = new R34_EQPT(testContext);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
|
||||
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
|
||||
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
|
||||
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
|
||||
}
|
||||
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
if (EAFLoggingUnitTesting.Logger is not null)
|
||||
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
|
||||
if (EAFLoggingUnitTesting is not null)
|
||||
EAFLoggingUnitTesting.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__R34_EQPT__DownloadJpegFile()
|
||||
{
|
||||
string check = ".jpeg";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = Helpers.Deposition.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
using Adaptation.Shared.Methods;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace _Tests.CreateSelfDescription.Staging.v2_39_0;
|
||||
|
||||
[TestClass]
|
||||
public class R34 : EAFLoggingUnitTesting
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
internal static R34 EAFLoggingUnitTesting { get; private set; }
|
||||
|
||||
public R34() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public R34(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
EAFLoggingUnitTesting = new R34(testContext);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
|
||||
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
|
||||
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
|
||||
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
|
||||
}
|
||||
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
if (EAFLoggingUnitTesting.Logger is not null)
|
||||
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
|
||||
if (EAFLoggingUnitTesting is not null)
|
||||
EAFLoggingUnitTesting.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__R34__jpeg()
|
||||
{
|
||||
string check = "*.jpeg";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = Helpers.Deposition.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
using Adaptation.Shared.Methods;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace _Tests.CreateSelfDescription.Staging.v2_39_0;
|
||||
|
||||
[TestClass]
|
||||
public class R36_EQPT : EAFLoggingUnitTesting
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
internal static R36_EQPT EAFLoggingUnitTesting { get; private set; }
|
||||
|
||||
public R36_EQPT() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public R36_EQPT(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
EAFLoggingUnitTesting = new R36_EQPT(testContext);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
|
||||
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
|
||||
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
|
||||
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
|
||||
}
|
||||
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
if (EAFLoggingUnitTesting.Logger is not null)
|
||||
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
|
||||
if (EAFLoggingUnitTesting is not null)
|
||||
EAFLoggingUnitTesting.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__R36_EQPT__DownloadJpegFile()
|
||||
{
|
||||
string check = ".jpeg";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = Helpers.Deposition.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
using Adaptation.Shared.Methods;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace _Tests.CreateSelfDescription.Staging.v2_39_0;
|
||||
|
||||
[TestClass]
|
||||
public class R36 : EAFLoggingUnitTesting
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
internal static R36 EAFLoggingUnitTesting { get; private set; }
|
||||
|
||||
public R36() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public R36(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
EAFLoggingUnitTesting = new R36(testContext);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
|
||||
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
|
||||
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
|
||||
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
|
||||
}
|
||||
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
if (EAFLoggingUnitTesting.Logger is not null)
|
||||
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
|
||||
if (EAFLoggingUnitTesting is not null)
|
||||
EAFLoggingUnitTesting.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__R36__jpeg()
|
||||
{
|
||||
string check = "*.jpeg";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = Helpers.Deposition.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
}
|
89
Adaptation/_Tests/Extract/Staging/v2.39.0/DEP08SIASM.cs
Normal file
89
Adaptation/_Tests/Extract/Staging/v2.39.0/DEP08SIASM.cs
Normal file
@ -0,0 +1,89 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Methods;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace _Tests.Extract.Staging.v2_39_0;
|
||||
|
||||
[TestClass]
|
||||
public class DEP08SIASM
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
private static CreateSelfDescription.Staging.v2_39_0.DEP08SIASM _DEP08SIASM;
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
CreateSelfDescription.Staging.v2_39_0.DEP08SIASM.ClassInitialize(testContext);
|
||||
_DEP08SIASM = CreateSelfDescription.Staging.v2_39_0.DEP08SIASM.EAFLoggingUnitTesting;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM() => _DEP08SIASM.Staging__v2_39_0__DEP08SIASM__DEP08SIASM();
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM637535051877475932__Health()
|
||||
{
|
||||
string check = "~EDA-IQS";
|
||||
_DEP08SIASM.Staging__v2_39_0__DEP08SIASM__DEP08SIASM();
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
string[] variables = _DEP08SIASM.AdaptationTesting.GetVariables(methodBase, check);
|
||||
IFileRead fileRead = _DEP08SIASM.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
|
||||
Logistics logistics = new(fileRead);
|
||||
_ = Helpers.Deposition.ReExtractComapareUpdatePassDirectory(variables, fileRead, logistics);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM637535051877475932__XML()
|
||||
{
|
||||
string check = "~EDA-IQS";
|
||||
_DEP08SIASM.Staging__v2_39_0__DEP08SIASM__DEP08SIASM();
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
string[] variables = _DEP08SIASM.AdaptationTesting.GetVariables(methodBase, check);
|
||||
IFileRead fileRead = _DEP08SIASM.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
|
||||
Logistics logistics = new(fileRead);
|
||||
_ = Helpers.Deposition.ReExtractComapareUpdatePassDirectory(variables, fileRead, logistics);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM_() => _DEP08SIASM.Staging__v2_39_0__DEP08SIASM__DEP08SIASM_();
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM_637535051877475932__Health()
|
||||
{
|
||||
string check = "~IQS-OpenInsight";
|
||||
_DEP08SIASM.Staging__v2_39_0__DEP08SIASM__DEP08SIASM_();
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
string[] variables = _DEP08SIASM.AdaptationTesting.GetVariables(methodBase, check);
|
||||
IFileRead fileRead = _DEP08SIASM.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
|
||||
Logistics logistics = new(fileRead);
|
||||
_ = Helpers.Deposition.ReExtractComapareUpdatePassDirectory(variables, fileRead, logistics);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM__() => _DEP08SIASM.Staging__v2_39_0__DEP08SIASM__DEP08SIASM__();
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM___() => _DEP08SIASM.Staging__v2_39_0__DEP08SIASM__DEP08SIASM___();
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM____() => _DEP08SIASM.Staging__v2_39_0__DEP08SIASM__DEP08SIASM____();
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM_____() => _DEP08SIASM.Staging__v2_39_0__DEP08SIASM__DEP08SIASM_____();
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM______() => _DEP08SIASM.Staging__v2_39_0__DEP08SIASM__DEP08SIASM______();
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM_______() => _DEP08SIASM.Staging__v2_39_0__DEP08SIASM__DEP08SIASM_______();
|
||||
|
||||
}
|
35
Adaptation/_Tests/Extract/Staging/v2.39.0/R34-EQPT.cs
Normal file
35
Adaptation/_Tests/Extract/Staging/v2.39.0/R34-EQPT.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Methods;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace _Tests.Extract.Staging.v2_39_0;
|
||||
|
||||
[TestClass]
|
||||
public class R34_EQPT
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
private static CreateSelfDescription.Staging.v2_39_0.R34_EQPT _R34_EQPT;
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
CreateSelfDescription.Staging.v2_39_0.R34_EQPT.ClassInitialize(testContext);
|
||||
_R34_EQPT = CreateSelfDescription.Staging.v2_39_0.R34_EQPT.EAFLoggingUnitTesting;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__R34_EQPT__DownloadJpegFile() => _R34_EQPT.Staging__v2_39_0__R34_EQPT__DownloadJpegFile();
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__R34_EQPT__DownloadJpegFile637812143477007703__Normal() => _R34_EQPT.Staging__v2_39_0__R34_EQPT__DownloadJpegFile();
|
||||
|
||||
}
|
44
Adaptation/_Tests/Extract/Staging/v2.39.0/R34.cs
Normal file
44
Adaptation/_Tests/Extract/Staging/v2.39.0/R34.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Methods;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace _Tests.Extract.Staging.v2_39_0;
|
||||
|
||||
[TestClass]
|
||||
public class R34
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
private static CreateSelfDescription.Staging.v2_39_0.R34 _R34;
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
CreateSelfDescription.Staging.v2_39_0.R34.ClassInitialize(testContext);
|
||||
_R34 = CreateSelfDescription.Staging.v2_39_0.R34.EAFLoggingUnitTesting;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__R34__jpeg() => _R34.Staging__v2_39_0__R34__jpeg();
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__R34__jpeg637812143477007703__Normal()
|
||||
{
|
||||
string check = "*.jpeg";
|
||||
_R34.Staging__v2_39_0__R34__jpeg();
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
string[] variables = _R34.AdaptationTesting.GetVariables(methodBase, check);
|
||||
IFileRead fileRead = _R34.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
|
||||
Logistics logistics = new(fileRead);
|
||||
_ = Helpers.Deposition.ReExtractComapareUpdatePassDirectory(variables, fileRead, logistics);
|
||||
}
|
||||
|
||||
}
|
32
Adaptation/_Tests/Extract/Staging/v2.39.0/R36-EQPT.cs
Normal file
32
Adaptation/_Tests/Extract/Staging/v2.39.0/R36-EQPT.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Methods;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace _Tests.Extract.Staging.v2_39_0;
|
||||
|
||||
[TestClass]
|
||||
public class R36_EQPT
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
private static CreateSelfDescription.Staging.v2_39_0.R36_EQPT _R36_EQPT;
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
CreateSelfDescription.Staging.v2_39_0.R36_EQPT.ClassInitialize(testContext);
|
||||
_R36_EQPT = CreateSelfDescription.Staging.v2_39_0.R36_EQPT.EAFLoggingUnitTesting;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__R36_EQPT__DownloadJpegFile() => _R36_EQPT.Staging__v2_39_0__R36_EQPT__DownloadJpegFile();
|
||||
|
||||
}
|
32
Adaptation/_Tests/Extract/Staging/v2.39.0/R36.cs
Normal file
32
Adaptation/_Tests/Extract/Staging/v2.39.0/R36.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Methods;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace _Tests.Extract.Staging.v2_39_0;
|
||||
|
||||
[TestClass]
|
||||
public class R36
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
private static CreateSelfDescription.Staging.v2_39_0.R36 _R36;
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
CreateSelfDescription.Staging.v2_39_0.R36.ClassInitialize(testContext);
|
||||
_R36 = CreateSelfDescription.Staging.v2_39_0.R36.EAFLoggingUnitTesting;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Staging__v2_39_0__R36__jpeg() => _R36.Staging__v2_39_0__R36__jpeg();
|
||||
|
||||
}
|
189
Adaptation/_Tests/Helpers/Deposition.cs
Normal file
189
Adaptation/_Tests/Helpers/Deposition.cs
Normal file
@ -0,0 +1,189 @@
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Methods;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace _Tests.Helpers;
|
||||
|
||||
public class Deposition
|
||||
{
|
||||
|
||||
internal static Tuple<string, string[], string[]> GetLogisticsColumnsAndBody(string fileFullName)
|
||||
{
|
||||
Tuple<string, string[], string[]> results;
|
||||
results = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(fileFullName);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(results.Item1));
|
||||
Assert.IsTrue(results.Item2.Length > 0, "Column check");
|
||||
Assert.IsTrue(results.Item3.Length > 0, "Body check");
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static Tuple<string, string[], string[]> GetLogisticsColumnsAndBody(string searchDirectory, string searchPattern)
|
||||
{
|
||||
Tuple<string, string[], string[]> results;
|
||||
if (searchPattern.Length > 3 && !searchPattern.Contains('*') && File.Exists(searchPattern))
|
||||
results = GetLogisticsColumnsAndBody(searchPattern);
|
||||
else
|
||||
{
|
||||
string[] pdsfFiles;
|
||||
pdsfFiles = Directory.GetFiles(searchDirectory, searchPattern, SearchOption.TopDirectoryOnly);
|
||||
if (!pdsfFiles.Any())
|
||||
_ = Process.Start("explorer.exe", searchDirectory);
|
||||
Assert.IsTrue(pdsfFiles.Any(), "GetFiles check");
|
||||
results = GetLogisticsColumnsAndBody(pdsfFiles[0]);
|
||||
}
|
||||
Assert.IsFalse(string.IsNullOrEmpty(results.Item1));
|
||||
Assert.IsTrue(results.Item2.Length > 0, "Column check");
|
||||
Assert.IsTrue(results.Item3.Length > 0, "Body check");
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static Tuple<string, string[], string[]> GetLogisticsColumnsAndBody(IFileRead fileRead, Logistics logistics, Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult, Tuple<string, string[], string[]> pdsf)
|
||||
{
|
||||
Tuple<string, string[], string[]> results;
|
||||
string text = ProcessDataStandardFormat.GetPDSFText(fileRead, logistics, extractResult.Item3, logisticsText: pdsf.Item1);
|
||||
string[] lines = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
||||
results = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(logistics.ReportFullPath, lines);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(results.Item1));
|
||||
Assert.IsTrue(results.Item2.Length > 0, "Column check");
|
||||
Assert.IsTrue(results.Item3.Length > 0, "Body check");
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static string[] GetItem2(Tuple<string, string[], string[]> pdsf, Tuple<string, string[], string[]> pdsfNew)
|
||||
{
|
||||
JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
|
||||
string jsonOld = JsonSerializer.Serialize(pdsf.Item2, pdsf.Item2.GetType(), jsonSerializerOptions);
|
||||
string jsonNew = JsonSerializer.Serialize(pdsfNew.Item2, pdsfNew.Item2.GetType(), jsonSerializerOptions);
|
||||
return new string[] { jsonOld, jsonNew };
|
||||
}
|
||||
|
||||
internal static string[] GetItem3(Tuple<string, string[], string[]> pdsf, Tuple<string, string[], string[]> pdsfNew)
|
||||
{
|
||||
string joinOld = string.Join(Environment.NewLine, from l in pdsf.Item3 select string.Join('\t', from t in l.Split('\t') where !t.Contains(@"\\") select t));
|
||||
string joinNew = string.Join(Environment.NewLine, from l in pdsfNew.Item3 select string.Join('\t', from t in l.Split('\t') where !t.Contains(@"\\") select t));
|
||||
return new string[] { joinOld, joinNew };
|
||||
}
|
||||
|
||||
internal static void UpdatePassDirectory(string searchDirectory)
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
try
|
||||
{ Directory.SetLastWriteTime(searchDirectory, dateTime); }
|
||||
catch (System.Exception) { }
|
||||
string ticksDirectory = Path.GetDirectoryName(searchDirectory);
|
||||
try
|
||||
{ Directory.SetLastWriteTime(ticksDirectory, dateTime); }
|
||||
catch (System.Exception) { }
|
||||
string[] directories = Directory.GetDirectories(searchDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string directory in directories)
|
||||
{
|
||||
try
|
||||
{ Directory.SetLastWriteTime(directory, dateTime); }
|
||||
catch (System.Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
internal static string GetFileName(MethodBase methodBase)
|
||||
{
|
||||
string result;
|
||||
string connectionName;
|
||||
string seperator = "__";
|
||||
string connectionNameAndTicks;
|
||||
string[] segments = methodBase.Name.Split(new string[] { seperator }, StringSplitOptions.None);
|
||||
string environment = segments[0];
|
||||
string rawVersionName = segments[1];
|
||||
string equipmentTypeDirectory = segments[2];
|
||||
string ticks = DateTime.Now.Ticks.ToString();
|
||||
string comment = segments[segments.Length - 1];
|
||||
string versionName = segments[1].Replace('_', '.');
|
||||
string before = string.Concat(environment, seperator, rawVersionName, seperator, equipmentTypeDirectory, seperator);
|
||||
string after = methodBase.Name.Substring(before.Length);
|
||||
if (after.Length < ticks.Length)
|
||||
{
|
||||
connectionName = after;
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionNameAndTicks = after.Substring(0, after.Length - 2 - comment.Length);
|
||||
connectionName = connectionNameAndTicks.Substring(0, connectionNameAndTicks.Length - ticks.Length);
|
||||
ticks = connectionNameAndTicks.Substring(connectionName.Length);
|
||||
}
|
||||
result = Path.Combine(environment, equipmentTypeDirectory, versionName, $"{environment}__{rawVersionName}__{equipmentTypeDirectory}__{connectionName}", ticks, $"{connectionName.Replace('_', '-')}.json");
|
||||
if (result.Contains('/'))
|
||||
result = string.Concat('/', result);
|
||||
else
|
||||
result = string.Concat('\\', result);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static void CompareSaveTSV(string textFileDirectory, string[] join)
|
||||
{
|
||||
if (join[0] != join[1])
|
||||
{
|
||||
_ = Process.Start("explorer.exe", textFileDirectory);
|
||||
File.WriteAllText(Path.Combine(textFileDirectory, "0.tsv"), join[0]);
|
||||
File.WriteAllText(Path.Combine(textFileDirectory, "1.tsv"), join[1]);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void CompareSaveJSON(string textFileDirectory, string[] json)
|
||||
{
|
||||
if (json[0] != json[1])
|
||||
{
|
||||
_ = Process.Start("explorer.exe", textFileDirectory);
|
||||
File.WriteAllText(Path.Combine(textFileDirectory, "0.json"), json[0]);
|
||||
File.WriteAllText(Path.Combine(textFileDirectory, "1.json"), json[1]);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void CompareSave(string textFileDirectory, Tuple<string, string[], string[]> pdsf, Tuple<string, string[], string[]> pdsfNew)
|
||||
{
|
||||
if (pdsf.Item1 != pdsfNew.Item1)
|
||||
{
|
||||
_ = Process.Start("explorer.exe", textFileDirectory);
|
||||
File.WriteAllText(Path.Combine(textFileDirectory, "0.dat"), pdsf.Item1);
|
||||
File.WriteAllText(Path.Combine(textFileDirectory, "1.dat"), pdsfNew.Item1);
|
||||
}
|
||||
}
|
||||
|
||||
internal static IFileRead GetWriteConfigurationGetFileRead(MethodBase methodBase, string check, Shared.AdaptationTesting adaptationTesting)
|
||||
{
|
||||
IFileRead result;
|
||||
string[] fileNameAndJson = adaptationTesting.GetConfiguration(methodBase);
|
||||
Assert.IsTrue(fileNameAndJson[1].Contains(check));
|
||||
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
|
||||
result = adaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(result.CellInstanceConnectionName));
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static string ReExtractComapareUpdatePassDirectory(string[] variables, IFileRead fileRead, Logistics logistics)
|
||||
{
|
||||
string result;
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
|
||||
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
|
||||
Assert.IsTrue(extractResult.Item3.Length > 0, "extractResult Array Length check!");
|
||||
Assert.IsNotNull(extractResult.Item4);
|
||||
Tuple<string, string[], string[]> pdsf = GetLogisticsColumnsAndBody(variables[2], variables[4]);
|
||||
Tuple<string, string[], string[]> pdsfNew = GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, pdsf);
|
||||
CompareSave(variables[5], pdsf, pdsfNew);
|
||||
Assert.IsTrue(pdsf.Item1 == pdsfNew.Item1, "Item1 check!");
|
||||
string[] json = GetItem2(pdsf, pdsfNew);
|
||||
CompareSaveJSON(variables[5], json);
|
||||
Assert.IsTrue(json[0] == json[1], "Item2 check!");
|
||||
string[] join = GetItem3(pdsf, pdsfNew);
|
||||
CompareSaveTSV(variables[5], join);
|
||||
Assert.IsTrue(join[0] == join[1], "Item3 (Join) check!");
|
||||
UpdatePassDirectory(variables[2]);
|
||||
result = extractResult.Item1;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
164
Adaptation/_Tests/Helpers/Helper.cs
Normal file
164
Adaptation/_Tests/Helpers/Helper.cs
Normal file
@ -0,0 +1,164 @@
|
||||
// using Adaptation.Shared.Deposition;
|
||||
// using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Diagnostics;
|
||||
// using System.IO;
|
||||
// using System.Linq;
|
||||
// using System.Reflection;
|
||||
// using System.Runtime.InteropServices;
|
||||
// using System.Text;
|
||||
// using System.Text.Json;
|
||||
|
||||
// namespace _Tests.Helpers
|
||||
// {
|
||||
|
||||
// public class Helper
|
||||
// {
|
||||
|
||||
// public static string GetLaunchText()
|
||||
// {
|
||||
// StringBuilder result = new();
|
||||
// _ = result.
|
||||
// AppendLine("{").
|
||||
// AppendLine(" \"configurations\": [").
|
||||
// AppendLine(" {").
|
||||
// AppendLine(" \"name\": \".NET Core Attach\",").
|
||||
// AppendLine(" \"type\": \"coreclr\",").
|
||||
// AppendLine(" \"request\": \"attach\",").
|
||||
// AppendLine($" \"processId\": {System.Diagnostics.Process.GetCurrentProcess().Id}").
|
||||
// AppendLine(" }").
|
||||
// AppendLine(" ]").
|
||||
// AppendLine("}");
|
||||
// return result.ToString();
|
||||
// }
|
||||
|
||||
// public static string GetProjectDirectory()
|
||||
// {
|
||||
// string result;
|
||||
// string[] checkFiles = null;
|
||||
// Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
// result = Path.GetDirectoryName(assembly.Location);
|
||||
// for (int i = 0; i < int.MaxValue; i++)
|
||||
// {
|
||||
// if (string.IsNullOrEmpty(result))
|
||||
// break;
|
||||
// checkFiles = Directory.GetFiles(result, "*.Tests.csproj", SearchOption.TopDirectoryOnly);
|
||||
// if (checkFiles.Any())
|
||||
// break;
|
||||
// result = Path.GetDirectoryName(result);
|
||||
// }
|
||||
// if (string.IsNullOrEmpty(result) || checkFiles is null || !checkFiles.Any())
|
||||
// throw new Exception(result);
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// public static string[] GetVariables(string jsonFile, string sourceDirectoryCloaking)
|
||||
// {
|
||||
// string[] results;
|
||||
// string sourceFileFilter = string.Empty;
|
||||
// string sourceFileLocation = string.Empty;
|
||||
// string projectDirectory = GetProjectDirectory();
|
||||
// string equipmentTypeDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(projectDirectory)));
|
||||
// string testResultsDirectory = Path.Combine(equipmentTypeDirectory, "05_TestResults");
|
||||
// FileInfo fileInfo = new(string.Concat(testResultsDirectory, jsonFile));
|
||||
// if (!Directory.Exists(fileInfo.Directory.FullName))
|
||||
// _ = Directory.CreateDirectory(fileInfo.Directory.FullName);
|
||||
// if (!fileInfo.Exists)
|
||||
// _ = Process.Start("explorer.exe", fileInfo.Directory.FullName);
|
||||
// string json = File.ReadAllText(fileInfo.FullName);
|
||||
// Assert.IsTrue(json.Contains(sourceDirectoryCloaking));
|
||||
// JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
|
||||
// foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
|
||||
// {
|
||||
// if (jsonProperty.Name == "SourceFileLocation")
|
||||
// sourceFileLocation = jsonProperty.Value.ToString();
|
||||
// else if (jsonProperty.Name == "SourceFileFilter")
|
||||
// sourceFileFilter = jsonProperty.Value.ToString();
|
||||
// }
|
||||
// results = new string[] { jsonFile, json, sourceFileLocation, sourceFileFilter };
|
||||
|
||||
// Assert.IsFalse(string.IsNullOrEmpty(results[0]));
|
||||
// Assert.IsFalse(string.IsNullOrEmpty(results[1]));
|
||||
// Assert.IsFalse(string.IsNullOrEmpty(results[2]));
|
||||
// Assert.IsFalse(string.IsNullOrEmpty(results[3]));
|
||||
// return results;
|
||||
// }
|
||||
|
||||
// public static Tuple<string, string[], string[]> GetLogisticsColumnsAndBody(string searchDirectory, string searchPattern)
|
||||
// {
|
||||
// Tuple<string, string[], string[]> results;
|
||||
// string[] pdsfFiles;
|
||||
// pdsfFiles = Directory.GetFiles(searchDirectory, searchPattern, SearchOption.TopDirectoryOnly);
|
||||
// if (!pdsfFiles.Any())
|
||||
// _ = Process.Start("explorer.exe", searchDirectory);
|
||||
// Assert.IsTrue(pdsfFiles.Any(), "GetFiles check");
|
||||
// results = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(pdsfFiles[0]);
|
||||
// Assert.IsFalse(string.IsNullOrEmpty(results.Item1));
|
||||
// Assert.IsTrue(results.Item2.Length > 0, "Column check");
|
||||
// Assert.IsTrue(results.Item3.Length > 0, "Body check");
|
||||
// return results;
|
||||
// }
|
||||
|
||||
// public static Tuple<string, string[], string[]> GetLogisticsColumnsAndBody(ConfigDataBase configDataBase, ILogic logic, Tuple<string, JsonElement?, List<FileInfo>> extractResult, Tuple<string, string[], string[]> pdsf)
|
||||
// {
|
||||
// Tuple<string, string[], string[]> results;
|
||||
// string text = ProcessDataStandardFormat.GetPDSFText(logic, configDataBase.GetEventName(), configDataBase.GetEquipmentType(), extractResult.Item2.Value, logisticsText: pdsf.Item1);
|
||||
// string[] lines = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
||||
// results = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(logic.Logistics.ReportFullPath, lines);
|
||||
// Assert.IsFalse(string.IsNullOrEmpty(results.Item1));
|
||||
// Assert.IsTrue(results.Item2.Length > 0, "Column check");
|
||||
// Assert.IsTrue(results.Item3.Length > 0, "Body check");
|
||||
// return results;
|
||||
// }
|
||||
|
||||
// public static string[] GetItem2(Tuple<string, string[], string[]> pdsf, Tuple<string, string[], string[]> pdsfNew)
|
||||
// {
|
||||
// JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
|
||||
// string jsonOld = JsonSerializer.Serialize(pdsf.Item2, pdsf.Item2.GetType(), jsonSerializerOptions);
|
||||
// string jsonNew = JsonSerializer.Serialize(pdsfNew.Item2, pdsfNew.Item2.GetType(), jsonSerializerOptions);
|
||||
// return new string[] { jsonOld, jsonNew };
|
||||
// }
|
||||
|
||||
// public static string[] GetItem3(Tuple<string, string[], string[]> pdsf, Tuple<string, string[], string[]> pdsfNew)
|
||||
// {
|
||||
// string joinOld = string.Join(Environment.NewLine, from l in pdsf.Item3 select string.Join('\t', from t in l.Split('\t') where !t.Contains(@"\\") select t));
|
||||
// string joinNew = string.Join(Environment.NewLine, from l in pdsfNew.Item3 select string.Join('\t', from t in l.Split('\t') where !t.Contains(@"\\") select t));
|
||||
// return new string[] { joinOld, joinNew };
|
||||
// }
|
||||
|
||||
// public static void UpdatePassDirectory(string[] variables, MethodBase methodBase)
|
||||
// {
|
||||
// string passDirectory = Path.Combine(variables[2], methodBase.Name);
|
||||
// if (!Directory.Exists(passDirectory))
|
||||
// _ = Directory.CreateDirectory(passDirectory);
|
||||
// else
|
||||
// Directory.SetLastWriteTime(variables[2], DateTime.Now);
|
||||
// }
|
||||
|
||||
// public static string GetFileName(MethodBase methodBase)
|
||||
// {
|
||||
// string result;
|
||||
// string[] segments = methodBase.Name.Split(new string[] { "__" }, StringSplitOptions.None);
|
||||
// string environment = segments[0];
|
||||
// string rawVersionName = segments[1];
|
||||
// string equipmentTypeDirectory = segments[2];
|
||||
// string ticks = DateTime.Now.Ticks.ToString();
|
||||
// string comment = segments[segments.Length - 1];
|
||||
// string versionName = segments[1].Replace('_', '.');
|
||||
// string before = string.Concat(environment, "__", rawVersionName, "__", equipmentTypeDirectory, "__");
|
||||
// string after = methodBase.Name.Substring(before.Length);
|
||||
// string connectionNameAndTicks = after.Substring(0, after.Length - 2 - comment.Length);
|
||||
// string connectionName = connectionNameAndTicks.Substring(0, connectionNameAndTicks.Length - ticks.Length);
|
||||
// ticks = connectionNameAndTicks.Substring(connectionName.Length);
|
||||
// result = Path.Combine(environment, equipmentTypeDirectory, versionName, $"{environment}__{rawVersionName}__{equipmentTypeDirectory}__{connectionName}", ticks, $"{connectionName.Replace('_', '-')}.json");
|
||||
// if (result.Contains('/'))
|
||||
// result = string.Concat('/', result);
|
||||
// else
|
||||
// result = string.Concat('\\', result);
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// }
|
1046
Adaptation/_Tests/Shared/AdaptationTesting.cs
Normal file
1046
Adaptation/_Tests/Shared/AdaptationTesting.cs
Normal file
File diff suppressed because it is too large
Load Diff
28
Adaptation/_Tests/Shared/EAFLoggingUnitTesting.cs
Normal file
28
Adaptation/_Tests/Shared/EAFLoggingUnitTesting.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
|
||||
namespace Shared;
|
||||
|
||||
public class EAFLoggingUnitTesting : LoggingUnitTesting, IDisposable
|
||||
{
|
||||
|
||||
protected readonly AdaptationTesting _AdaptationTesting;
|
||||
|
||||
public AdaptationTesting AdaptationTesting => _AdaptationTesting;
|
||||
|
||||
public EAFLoggingUnitTesting(TestContext testContext, Type declaringType, bool skipEquipmentDictionary) :
|
||||
base(testContext, declaringType)
|
||||
{
|
||||
if (testContext is null || declaringType is null)
|
||||
_AdaptationTesting = null;
|
||||
else
|
||||
_AdaptationTesting = new AdaptationTesting(testContext, skipEquipmentDictionary);
|
||||
}
|
||||
|
||||
public new void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
}
|
168
Adaptation/_Tests/Shared/IsEnvironment.cs
Normal file
168
Adaptation/_Tests/Shared/IsEnvironment.cs
Normal file
@ -0,0 +1,168 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
36
Adaptation/_Tests/Shared/Log/ConsoleLogger.cs
Normal file
36
Adaptation/_Tests/Shared/Log/ConsoleLogger.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
|
||||
namespace Shared;
|
||||
|
||||
public class ConsoleLogger : ILogger
|
||||
{
|
||||
|
||||
public int EventId { get; set; }
|
||||
|
||||
private readonly string _Name;
|
||||
private readonly LogLevel _LogLevel;
|
||||
|
||||
public ConsoleLogger(LogLevel logLevel, string name)
|
||||
{
|
||||
_Name = name;
|
||||
EventId = 0;
|
||||
_LogLevel = logLevel;
|
||||
if (string.IsNullOrEmpty(_Name))
|
||||
{ }
|
||||
}
|
||||
|
||||
public IDisposable BeginScope<TState>(TState state) => null;
|
||||
|
||||
public bool IsEnabled(LogLevel logLevel) => logLevel >= _LogLevel;
|
||||
|
||||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
||||
{
|
||||
if (IsEnabled(logLevel) && (EventId == 0 || EventId == eventId.Id))
|
||||
{
|
||||
string message = formatter(state, null);
|
||||
Console.WriteLine(message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user