diff --git a/.gitignore b/.gitignore index 3e759b7..7c7ee90 100644 --- a/.gitignore +++ b/.gitignore @@ -328,3 +328,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 diff --git a/Adaptation/.editorconfig b/Adaptation/.editorconfig new file mode 100644 index 0000000..a3ebdb2 --- /dev/null +++ b/Adaptation/.editorconfig @@ -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 diff --git a/Adaptation/.vscode/format-report.json b/Adaptation/.vscode/format-report.json new file mode 100644 index 0000000..519b578 --- /dev/null +++ b/Adaptation/.vscode/format-report.json @@ -0,0 +1,722 @@ +[ + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "d88d16ae-5c4e-46e1-abfb-ff18247f2739" + }, + "FileName": "ConfigData.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Helpers\\ConfigData.cs", + "FileChanges": [ + { + "LineNumber": 1, + "CharNumber": 1, + "DiagnosticId": "WHITESPACE", + "FormatDescription": "Fix whitespace formatting." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "bb7e7f9c-693f-4888-9c38-f8dfc213e8bc" + }, + "FileName": "ProcessData.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Helpers\\ProcessData.cs", + "FileChanges": [ + { + "LineNumber": 1, + "CharNumber": 1, + "DiagnosticId": "WHITESPACE", + "FormatDescription": "Fix whitespace formatting." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "13cd9ede-a96c-4fb6-b4a7-e5c795fc1664" + }, + "FileName": "FileRead.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\FileRead.cs", + "FileChanges": [ + { + "LineNumber": 1, + "CharNumber": 1, + "DiagnosticId": "WHITESPACE", + "FormatDescription": "Fix whitespace formatting." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "9e1cd5e7-2f78-4af5-a51a-accca7322480" + }, + "FileName": "Logistics.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Logistics.cs", + "FileChanges": [ + { + "LineNumber": 1, + "CharNumber": 1, + "DiagnosticId": "WHITESPACE", + "FormatDescription": "Fix whitespace formatting." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "130644ff-7008-44ea-a32a-8a7bfca0a2a0" + }, + "FileName": "Backbone.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Eaf\\Core\\Backbone.cs", + "FileChanges": [ + { + "LineNumber": 48, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "db33cb97-3ef4-4051-9ecd-a010f1845296" + }, + "FileName": "EmailMessage.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Eaf\\Core\\Smtp\\EmailMessage.cs", + "FileChanges": [ + { + "LineNumber": 24, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "b3a57e2c-f48d-4720-8b3b-fb636cba8379" + }, + "FileName": "ISmtp.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Eaf\\Core\\Smtp\\ISmtp.cs", + "FileChanges": [ + { + "LineNumber": 9, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "6629017c-4546-4310-a6aa-577537007428" + }, + "FileName": "MailPriority.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Eaf\\Core\\Smtp\\MailPriority.cs", + "FileChanges": [ + { + "LineNumber": 11, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "53ac5897-d819-44df-b743-d4c12f9a91d9" + }, + "FileName": "Field.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Eaf\\EquipmentCore\\SelfDescription\\ParameterTypes\\Field.cs", + "FileChanges": [ + { + "LineNumber": 12, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "95bed42a-9999-4845-a15b-68491e9307e9" + }, + "FileName": "ParameterTypeDefinition.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Eaf\\EquipmentCore\\SelfDescription\\ParameterTypes\\ParameterTypeDefinition.cs", + "FileChanges": [ + { + "LineNumber": 12, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "88119dfd-155c-4e25-a114-70ffef081c60" + }, + "FileName": "StructuredType.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Eaf\\EquipmentCore\\SelfDescription\\ParameterTypes\\StructuredType.cs", + "FileChanges": [ + { + "LineNumber": 12, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "4de43dcd-921e-41d0-958e-ce47dc960d59" + }, + "FileName": "FileRead.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\FileHandlers\\FileRead.cs", + "FileChanges": [ + { + "LineNumber": 280, + "CharNumber": 4, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "d88d16ae-5c4e-46e1-abfb-ff18247f2739" + }, + "FileName": "ConfigData.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Helpers\\ConfigData.cs", + "FileChanges": [ + { + "LineNumber": 523, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "470ff21b-3486-44aa-ae4c-afed13cda38c" + }, + "FileName": "ConfigData.Level.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Helpers\\ConfigData.Level.cs", + "FileChanges": [ + { + "LineNumber": 45, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "bb7e7f9c-693f-4888-9c38-f8dfc213e8bc" + }, + "FileName": "ProcessData.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Helpers\\ProcessData.cs", + "FileChanges": [ + { + "LineNumber": 453, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "06c03f0b-096b-421d-91e8-68ba61cb13e7" + }, + "FileName": "ProcessData.HgProbeDetail.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Helpers\\ProcessData.HgProbeDetail.cs", + "FileChanges": [ + { + "LineNumber": 32, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "19febcbc-e2de-4ecc-bd57-1cfa776c7da8" + }, + "FileName": "ProcessData.HgProbeFile.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Helpers\\ProcessData.HgProbeFile.cs", + "FileChanges": [ + { + "LineNumber": 70, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "90e0f9ba-39c2-4be1-ac9d-ac2f1693c87d" + }, + "FileName": "ProcessData.WSRequest.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Helpers\\ProcessData.WSRequest.cs", + "FileChanges": [ + { + "LineNumber": 162, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "07d42733-7594-4d40-ac61-754e59c5f454" + }, + "FileName": "FileConnectorParameterTypeDefinitionProvider.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Ifx\\Eaf\\EquipmentConnector\\File\\SelfDescription\\FileConnectorParameterTypeDefinitionProvider.cs", + "FileChanges": [ + { + "LineNumber": 14, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "f9b0b687-7adb-4eb0-bd2e-2043152cc9e8" + }, + "FileName": "Description.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Duplicator\\Description.cs", + "FileChanges": [ + { + "LineNumber": 148, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "9e1cd5e7-2f78-4af5-a51a-accca7322480" + }, + "FileName": "Logistics.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Logistics.cs", + "FileChanges": [ + { + "LineNumber": 223, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "c05bd63e-6989-4686-8396-d967b102d406" + }, + "FileName": "Logistics2.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Logistics2.cs", + "FileChanges": [ + { + "LineNumber": 81, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "21e35d0e-0e82-4c36-b422-f6d746f666f1" + }, + "FileName": "IDescription.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Methods\\IDescription.cs", + "FileChanges": [ + { + "LineNumber": 25, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "8dfa5ce1-faac-4c51-9f56-fdcd7b89b0ca" + }, + "FileName": "IFileRead.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Methods\\IFileRead.cs", + "FileChanges": [ + { + "LineNumber": 25, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "3a4c0faa-cbf3-4745-8b72-e4e08b86eca8" + }, + "FileName": "ILogistics.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Methods\\ILogistics.cs", + "FileChanges": [ + { + "LineNumber": 8, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "266d8d47-829c-4ac7-a68f-0123f949ec34" + }, + "FileName": "ILogistics2.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Methods\\ILogistics2.cs", + "FileChanges": [ + { + "LineNumber": 8, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "77aff9a3-4ce1-41c5-bc35-91b1837db7cf" + }, + "FileName": "IProcessData.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Methods\\IProcessData.cs", + "FileChanges": [ + { + "LineNumber": 17, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "1a691341-bf79-4553-99be-f9ba199dc0f3" + }, + "FileName": "ISMTP.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Methods\\ISMTP.cs", + "FileChanges": [ + { + "LineNumber": 9, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "3006df3a-c1f4-47ad-919e-60f2f95a91be" + }, + "FileName": "ParameterType.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\ParameterType.cs", + "FileChanges": [ + { + "LineNumber": 13, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "a9ab26d6-5866-451c-b3ee-c220b3e096d9" + }, + "FileName": "ProcessDataStandardFormat.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\ProcessDataStandardFormat.cs", + "FileChanges": [ + { + "LineNumber": 426, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "bdc7f0da-41fe-4b72-9e11-ed9e4c4a8577" + }, + "FileName": "IDescription.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Properties\\IDescription.cs", + "FileChanges": [ + { + "LineNumber": 13, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "154eb5ed-ea73-46ff-bdd6-3858aba13e36" + }, + "FileName": "IFileRead.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Properties\\IFileRead.cs", + "FileChanges": [ + { + "LineNumber": 20, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "15fc86da-34c5-4da0-8fd4-edd28e95d3f0" + }, + "FileName": "ILogistics.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Properties\\ILogistics.cs", + "FileChanges": [ + { + "LineNumber": 25, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "18438843-431f-4b95-9c1b-34433781f09f" + }, + "FileName": "ILogistics2.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Properties\\ILogistics2.cs", + "FileChanges": [ + { + "LineNumber": 17, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "53f26846-2562-494e-aa6c-0015ae5f1353" + }, + "FileName": "IProcessData.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Properties\\IProcessData.cs", + "FileChanges": [ + { + "LineNumber": 13, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "22c73bd3-2fd0-4b86-97a8-2ecc7e4c866a" + }, + "FileName": "IScopeInfo.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Properties\\IScopeInfo.cs", + "FileChanges": [ + { + "LineNumber": 20, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "5a076f2e-46dd-4e9d-a58f-331bf5ff5f56" + }, + "FileName": "Test.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Test.cs", + "FileChanges": [ + { + "LineNumber": 57, + "CharNumber": 2, + "DiagnosticId": "FINALNEWLINE", + "FormatDescription": "Fix final newline. Delete 2 characters." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "9e1cd5e7-2f78-4af5-a51a-accca7322480" + }, + "FileName": "Logistics.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Logistics.cs", + "FileChanges": [ + { + "LineNumber": 1, + "CharNumber": 1, + "DiagnosticId": "IMPORTS", + "FormatDescription": "Fix imports ordering." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "9e1cd5e7-2f78-4af5-a51a-accca7322480" + }, + "FileName": "Logistics.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Shared\\Logistics.cs", + "FileChanges": [ + { + "LineNumber": 186, + "CharNumber": 31, + "DiagnosticId": "IDE0003", + "FormatDescription": "error IDE0003: Name can be simplified." + } + ] + }, + { + "DocumentId": { + "ProjectId": { + "Id": "39ed7366-e68d-48fb-8c3f-a640836170aa" + }, + "Id": "eb4f7a88-7379-4241-879f-195bc633541c" + }, + "FileName": "ProcessData.FileRead.Description.cs", + "FilePath": "L:\\Workspaces\\33_CS29_79_72\\MIT_EAF_Adaptations\\Trunk\\MET08RESIHGCV\\06_SourceCode\\MET08RESIHGCV\\Adaptation\\Helpers\\ProcessData.FileRead.Description.cs", + "FileChanges": [ + { + "LineNumber": 398, + "CharNumber": 41, + "DiagnosticId": "CS1503", + "FormatDescription": "error CS1503: Argument 1: cannot convert from \u0027Adaptation.Helpers.ProcessData.FileRead.Description\u0027 to \u0027IProcessDataDescription\u0027" + } + ] + } +] \ No newline at end of file diff --git a/Adaptation/Eaf/Core/AutoGenerated/BackboneComponent.cs b/Adaptation/Eaf/Core/AutoGenerated/BackboneComponent.cs new file mode 100644 index 0000000..4b83dcf --- /dev/null +++ b/Adaptation/Eaf/Core/AutoGenerated/BackboneComponent.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.Core +{ + public class BackboneComponent + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/AutoGenerated/BackboneStatusCache.cs b/Adaptation/Eaf/Core/AutoGenerated/BackboneStatusCache.cs new file mode 100644 index 0000000..5da2cda --- /dev/null +++ b/Adaptation/Eaf/Core/AutoGenerated/BackboneStatusCache.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.Core +{ + public class BackboneStatusCache + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/AutoGenerated/ILoggingSetupManager.cs b/Adaptation/Eaf/Core/AutoGenerated/ILoggingSetupManager.cs new file mode 100644 index 0000000..ba939e7 --- /dev/null +++ b/Adaptation/Eaf/Core/AutoGenerated/ILoggingSetupManager.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.Core +{ + public interface ILoggingSetupManager + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/AutoGenerated/StatusItem.cs b/Adaptation/Eaf/Core/AutoGenerated/StatusItem.cs new file mode 100644 index 0000000..4dc8f3b --- /dev/null +++ b/Adaptation/Eaf/Core/AutoGenerated/StatusItem.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.Core +{ + public class StatusItem + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/Backbone.cs b/Adaptation/Eaf/Core/Backbone.cs new file mode 100644 index 0000000..d4b6f03 --- /dev/null +++ b/Adaptation/Eaf/Core/Backbone.cs @@ -0,0 +1,48 @@ +using Adaptation.PeerGroup.GCL.Annotations; +using System; +using System.Collections.Generic; + +namespace Adaptation.Eaf.Core +{ + public class Backbone + { + public const string STATE_ERROR = "Error"; + public const string STATE_OFFLINE = "Offline"; + public const string STATE_RUNNING = "Running"; + public const string STATE_SHUTDOWN = "Shutting Down"; + public const string STATE_STARTING = "Starting"; + + protected Backbone() { } + + [NotNull] + public static Backbone Instance { get; } + [NotNull] + public ILoggingSetupManager LoggingConfigurationManager { get; set; } + public BackboneStatusCache Status { get; } + public bool IsAutomatedRestartActive { get; } + public bool IsReadyForRestart { get; } + public string StartTime { get; } + public string State { get; } + public string Name { get; } + public string ConfigurationServiceAddress { get; } + public string CellName { get; } + protected bool IsInitialized { get; set; } + protected Dictionary 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 GetAllStatuses() { throw new NotImplementedException(); } + public BackboneComponent GetBackboneComponentById(string id) { throw new NotImplementedException(); } + public List GetBackboneComponentsOfType() { throw new NotImplementedException(); } + public List 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 components) { } + protected virtual void StopAllComponents() { } + protected void StopComponents(List components) { } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/Smtp/EmailMessage.cs b/Adaptation/Eaf/Core/Smtp/EmailMessage.cs new file mode 100644 index 0000000..f0c2baf --- /dev/null +++ b/Adaptation/Eaf/Core/Smtp/EmailMessage.cs @@ -0,0 +1,24 @@ +using System; + +namespace Adaptation.Eaf.Core.Smtp +{ + + public class EmailMessage + { + public EmailMessage() { } + public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { } + + public string Body { get; } + public MailPriority Priority { get; } + public string Subject { get; } + + public EmailMessage PriorityHigh() { throw new NotImplementedException(); } + public EmailMessage PriorityLow() { throw new NotImplementedException(); } + public EmailMessage PriorityNormal() { throw new NotImplementedException(); } + public EmailMessage SetBody(string body) { throw new NotImplementedException(); } + public EmailMessage SetPriority(MailPriority priority) { throw new NotImplementedException(); } + public EmailMessage SetSubject(string subject) { throw new NotImplementedException(); } + + } + +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/Smtp/ISmtp.cs b/Adaptation/Eaf/Core/Smtp/ISmtp.cs new file mode 100644 index 0000000..3a12278 --- /dev/null +++ b/Adaptation/Eaf/Core/Smtp/ISmtp.cs @@ -0,0 +1,9 @@ +namespace Adaptation.Eaf.Core.Smtp +{ + + public interface ISmtp + { + void Send(EmailMessage message); + } + +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/Smtp/MailPriority.cs b/Adaptation/Eaf/Core/Smtp/MailPriority.cs new file mode 100644 index 0000000..18ee1af --- /dev/null +++ b/Adaptation/Eaf/Core/Smtp/MailPriority.cs @@ -0,0 +1,11 @@ +namespace Adaptation.Eaf.Core.Smtp +{ + + public enum MailPriority + { + Low = 0, + Normal = 1, + High = 2 + } + +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ChangeDataCollectionHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ChangeDataCollectionHandler.cs new file mode 100644 index 0000000..096cfd8 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ChangeDataCollectionHandler.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class ChangeDataCollectionHandler + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/DataCollectionRequest.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/DataCollectionRequest.cs new file mode 100644 index 0000000..f085c14 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/DataCollectionRequest.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class DataCollectionRequest + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentEvent.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentEvent.cs new file mode 100644 index 0000000..fd97bcb --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentEvent.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class EquipmentEvent + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentException.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentException.cs new file mode 100644 index 0000000..1a3babd --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentException.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class EquipmentException + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentSelfDescription.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentSelfDescription.cs new file mode 100644 index 0000000..3697004 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentSelfDescription.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class EquipmentSelfDescription + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/GetParameterValuesHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/GetParameterValuesHandler.cs new file mode 100644 index 0000000..bc26e0f --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/GetParameterValuesHandler.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class GetParameterValuesHandler + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IConnectionControl.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IConnectionControl.cs new file mode 100644 index 0000000..a9e800c --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IConnectionControl.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IConnectionControl + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IDataTracingHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IDataTracingHandler.cs new file mode 100644 index 0000000..3b98f85 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IDataTracingHandler.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IDataTracingHandler + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentCommandService.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentCommandService.cs new file mode 100644 index 0000000..2a54add --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentCommandService.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IEquipmentCommandService + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentControl.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentControl.cs new file mode 100644 index 0000000..a119d2b --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentControl.cs @@ -0,0 +1,16 @@ +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; } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentSelfDescriptionBuilder.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentSelfDescriptionBuilder.cs new file mode 100644 index 0000000..b583e8c --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentSelfDescriptionBuilder.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IEquipmentSelfDescriptionBuilder + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IPackage.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IPackage.cs new file mode 100644 index 0000000..67ef808 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IPackage.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IPackage + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ISelfDescriptionLookup.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ISelfDescriptionLookup.cs new file mode 100644 index 0000000..57b3215 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ISelfDescriptionLookup.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface ISelfDescriptionLookup + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IVirtualParameterValuesHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IVirtualParameterValuesHandler.cs new file mode 100644 index 0000000..64e4621 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IVirtualParameterValuesHandler.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IVirtualParameterValuesHandler + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/SetParameterValuesHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/SetParameterValuesHandler.cs new file mode 100644 index 0000000..200fb13 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/SetParameterValuesHandler.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class SetParameterValuesHandler + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/TraceRequest.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/TraceRequest.cs new file mode 100644 index 0000000..84511e9 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/TraceRequest.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public class TraceRequest + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/IEquipmentDataCollection.cs b/Adaptation/Eaf/EquipmentCore/Control/IEquipmentDataCollection.cs new file mode 100644 index 0000000..7a704b5 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/IEquipmentDataCollection.cs @@ -0,0 +1,39 @@ +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 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 parameters); + void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable parameters, IPackage sourcePackage); + void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters); + void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters, IPackage sourcePackage); + void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride); + void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage); + void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage); + void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride); + void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters, IPackage sourcePackage); + void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters); + void TriggerPerformanceRestored(); + void TriggerPerformanceWarning(); + void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable parameters); + void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable parameters, IPackage sourcePackage); + void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable parameters, DateTime equipmentTimeStamp); + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/IPackageSource.cs b/Adaptation/Eaf/EquipmentCore/Control/IPackageSource.cs new file mode 100644 index 0000000..2c0371e --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/Control/IPackageSource.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.EquipmentCore.Control +{ + public interface IPackageSource + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/DataCollection/Reporting/ParameterValue.cs b/Adaptation/Eaf/EquipmentCore/DataCollection/Reporting/ParameterValue.cs new file mode 100644 index 0000000..9f0b794 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/DataCollection/Reporting/ParameterValue.cs @@ -0,0 +1,20 @@ +using Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription; +using Adaptation.PeerGroup.GCL.Annotations; +using System; + +namespace Adaptation.Eaf.EquipmentCore.DataCollection.Reporting +{ + public class ParameterValue + { + public ParameterValue(EquipmentParameter definition, object value) { } + public ParameterValue(EquipmentParameter definition, object value, DateTime timestamp) { } + + public virtual object Value { get; protected internal set; } + [NotNull] + public EquipmentParameter Definition { get; } + public DateTime Timestamp { get; protected set; } + + public virtual ParameterValue Clone(EquipmentParameter newDefinition) { throw new NotImplementedException(); } + public override string ToString() { return base.ToString(); } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/SelfDescription/ElementDescription/EquipmentParameter.cs b/Adaptation/Eaf/EquipmentCore/SelfDescription/ElementDescription/EquipmentParameter.cs new file mode 100644 index 0000000..852fb8d --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/SelfDescription/ElementDescription/EquipmentParameter.cs @@ -0,0 +1,24 @@ +using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes; + +namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription +{ + public class EquipmentParameter + { + public EquipmentParameter(EquipmentParameter source, ParameterTypeDefinition typeDefinition) { } + public EquipmentParameter(string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { } + public EquipmentParameter(string id, string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { } + + public string Name { get; } + public string Id { get; } + public string Description { get; } + public string SourcePath { get; } + public string SourceEquipment { get; } + public ParameterTypeDefinition TypeDefinition { get; } + public bool IsTransient { get; } + public bool IsReadOnly { get; } + + public override string ToString() { return base.ToString(); } + public string ToStringWithDetails() { return base.ToString(); } + } + +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/Field.cs b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/Field.cs new file mode 100644 index 0000000..a83b45f --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/Field.cs @@ -0,0 +1,12 @@ +namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes +{ + public class Field + { + public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { } + + public string Name { get; } + public string Description { get; } + public ParameterTypeDefinition TypeDefinition { get; } + public bool CanBeNull { get; } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/ParameterTypeDefinition.cs b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/ParameterTypeDefinition.cs new file mode 100644 index 0000000..65ad7dd --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/ParameterTypeDefinition.cs @@ -0,0 +1,12 @@ +namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes +{ + public abstract class ParameterTypeDefinition + { + public ParameterTypeDefinition(string name, string description) { } + + public string Name { get; } + public string Description { get; } + + public override string ToString() { return base.ToString(); } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/StructuredType.cs b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/StructuredType.cs new file mode 100644 index 0000000..24c5856 --- /dev/null +++ b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/StructuredType.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes +{ + public class StructuredType : ParameterTypeDefinition + { + + public StructuredType(string name, string description, IList fields) : base(name, description) { } + + public IList Fields { get; } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/IConfigurationObject.cs b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/IConfigurationObject.cs new file mode 100644 index 0000000..597ace3 --- /dev/null +++ b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/IConfigurationObject.cs @@ -0,0 +1,6 @@ +namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation +{ + public interface IConfigurationObject + { + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterDefinition.cs b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterDefinition.cs new file mode 100644 index 0000000..0b772a2 --- /dev/null +++ b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterDefinition.cs @@ -0,0 +1,26 @@ +using System; + +namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation +{ + [System.Runtime.Serialization.DataContractAttribute(IsReference = true)] + public class ModelObjectParameterDefinition : IConfigurationObject + { + public ModelObjectParameterDefinition() { } + public ModelObjectParameterDefinition(string name, ModelObjectParameterType valueType, object defaultValue) { } + public ModelObjectParameterDefinition(string name, Type enumType, object defaultValue) { } + + [System.Runtime.Serialization.DataMemberAttribute] + public virtual long Id { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual string Name { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual string Value { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual ModelObjectParameterType ValueType { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public virtual string EnumType { get; set; } + + public virtual ModelObjectParameterDefinition Clone() { return null; } + public virtual bool IsValidValue(string value) { return false; } + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterType.cs b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterType.cs new file mode 100644 index 0000000..6f779af --- /dev/null +++ b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterType.cs @@ -0,0 +1,17 @@ +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 + } +} \ No newline at end of file diff --git a/Adaptation/Eaf/Management/ConfigurationData/Semiconductor/CellInstances/SecsConnectionConfiguration.cs b/Adaptation/Eaf/Management/ConfigurationData/Semiconductor/CellInstances/SecsConnectionConfiguration.cs new file mode 100644 index 0000000..91493b0 --- /dev/null +++ b/Adaptation/Eaf/Management/ConfigurationData/Semiconductor/CellInstances/SecsConnectionConfiguration.cs @@ -0,0 +1,44 @@ +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; } + } +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/FileRead.cs b/Adaptation/FileHandlers/FileRead.cs new file mode 100644 index 0000000..8627dff --- /dev/null +++ b/Adaptation/FileHandlers/FileRead.cs @@ -0,0 +1,280 @@ +//using Adaptation.Helpers; +//using Adaptation.Shared; +//using Adaptation.Shared.Metrology; +//using log4net; +//using System; +//using System.Collections.Generic; +//using System.Globalization; +//using System.IO; +//using System.Linq; +//using System.Text.Json; +//using System.Text.RegularExpressions; + +//namespace Adaptation.FileHandlers +//{ + +// public partial class FileRead : ILogic +// { + +// private ConfigData _ConfigData; + +// public FileRead() +// { +// Logistics = new Logistics(); +// _Log = LogManager.GetLogger(typeof(FileRead)); +// } + +// public ILogic ShallowCopy() +// { +// return (ILogic)MemberwiseClone(); +// } + +// public void WaitForThread() +// { +// WaitForThread(thread: null, threadExceptions: null); +// } + +// public Tuple GetOpenInsightTuple() +// { +// Tuple restuls = new Tuple(_ConfigData.OpenInsightSiViewer, _ConfigData); +// return restuls; +// } + +// public Tuple> GetExtractResult(string reportFullPath, string eventName) +// { +// Tuple> 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 +// throw new Exception(); +// if (results.Item2 is null) +// results = new Tuple>(results.Item1, JsonSerializer.Deserialize("[]"), 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> GetExtractResult(string reportFullPath) +// { +// Tuple> results = new Tuple>(string.Empty, null, new List()); +// FileInfo fileInfo = new FileInfo(reportFullPath); +// Logistics = new Logistics(ConfigData.NullData, _ConfigData.CellNames, _ConfigData.MesEntities, fileInfo, useSplitForMID: false); +// SetFileParameterLotID(Logistics.MID); +// if (fileInfo.Length < ConfigData.MinFileLength) +// results.Item3.Add(fileInfo); +// else +// { +// ProcessData processData = new ProcessData(this, _ConfigData, results.Item3); +// if (!(processData.Header is null)) +// { +// string mid = string.Concat(processData.Header.Reactor, "-", processData.Header.RDS, "-", processData.Header.PSN); +// mid = Regex.Replace(mid, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0]; +// Logistics.MID = mid; +// SetFileParameterLotID(mid); +// Logistics.ProcessJobID = processData.Header.Reactor; +// } +// if (processData.Header is null || !processData.Details.Any()) +// throw new Exception(); +// results = processData.GetResults(this, _ConfigData, results.Item3); +// } +// return results; +// } + +// private Tuple> GetDuplicatorExtractResult(string reportFullPath, DateTime dateTime) +// { +// Tuple> results; +// Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); +// Logistics = new Logistics(reportFullPath, pdsf.Item1); +// SetFileParameterLotIDToLogisticsMID(); +// JsonElement pdsdBodyValues = ProcessDataStandardFormat.GetArray(pdsf); +// results = new Tuple>(pdsf.Item1, pdsdBodyValues, new List()); +// List processDataDescriptions = _ConfigData.GetProcessDataDescriptions(pdsdBodyValues); +// Dictionary> keyValuePairs = ProcessData.GetKeyValuePairs(_ConfigData, pdsdBodyValues, processDataDescriptions, extra: false); +// bool isNotUsedInsightMetrologyViewerAttachments = (!(_Configuration.FileScanningIntervalInSeconds > 0) && _ConfigData.Duplicator.Value == ConfigData.Level.IsXToOpenInsightMetrologyViewerAttachments); +// 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) { } +// } +// string duplicateDirectory; +// string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_'); +// if (_ConfigData.Duplicator.Value != ConfigData.Level.IsXToOpenInsight) +// duplicateDirectory = string.Concat(_Configuration.TargetFileLocation, @"\", segments[0]); +// else +// duplicateDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_Configuration.TargetFileLocation)), @"\Data"); +// if (segments.Length > 2) +// duplicateDirectory = string.Concat(duplicateDirectory, @"-", segments[2]); +// if (!Directory.Exists(duplicateDirectory)) +// Directory.CreateDirectory(duplicateDirectory); +// if ((isDummyRun || isNotUsedInsightMetrologyViewerAttachments || _Configuration.FileScanningIntervalInSeconds > 0) && _ConfigData.Duplicator.Value != ConfigData.Level.IsXToArchive && _ConfigData.Duplicator.Value != ConfigData.Level.IsArchive) +// { +// string successDirectory; +// 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); +// } +// CultureInfo cultureInfo = new CultureInfo("en-US"); +// Calendar calendar = cultureInfo.Calendar; +// List> tuples = new List>(); +// string duplicateFile = string.Concat(duplicateDirectory, @"\", Path.GetFileName(reportFullPath)); +// 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 logisticsSequenceMemoryDirectory = string.Concat(_ConfigData.MemoryPath, @"\", _ConfigData.GetEquipmentType(), @"\Source\", weekDirectory, @"\", Logistics.Sequence); +// if (!Directory.Exists(logisticsSequenceMemoryDirectory)) +// Directory.CreateDirectory(logisticsSequenceMemoryDirectory); +// if (_ConfigData.Duplicator.Value == ConfigData.Level.IsXToAPC) +// { +// if (!isDummyRun && _ConfigData.EafHosted) +// File.Copy(reportFullPath, duplicateFile, overwrite: true); +// } +// else +// { +// if (_ConfigData.Duplicator.Value == ConfigData.Level.IsXToOpenInsightMetrologyViewer) +// { +// List fileReadDescriptions = ProcessData.GetProcessDataFileReadDescriptions(_ConfigData, pdsdBodyValues); +// ProcessData.WSRequest wsRequest = new ProcessData.WSRequest(this, fileReadDescriptions); +// if (!isDummyRun && _ConfigData.EafHosted) +// { +// Tuple wsResults = WS.SendData(_ConfigData.OpenInsightMetrologyViewerAPI, wsRequest); +// if (!wsResults.Item2.Success) +// throw new Exception(wsResults.ToString()); +// _Log.Debug(wsResults.Item2.HeaderID); +// File.WriteAllText(string.Concat(logisticsSequenceMemoryDirectory, @"\", nameof(WS.Results), ".json"), wsResults.Item1); +// } +// } +// else +// { +// Test test; +// string lines; +// IScopeInfo scopeInfo; +// foreach (KeyValuePair> keyValuePair in keyValuePairs) +// { +// test = keyValuePair.Key; +// //scopeInfo = new ScopeInfo(this, _ConfigData, test); +// if (_ConfigData.Duplicator.Value != ConfigData.Level.IsXToOpenInsight) +// scopeInfo = new ScopeInfo(this, _ConfigData, test, _ConfigData.IqsFile, _ConfigData.IqsQueryFilter); +// else +// scopeInfo = new ScopeInfo(this, _ConfigData, test, _ConfigData.OpenInsightFilePattern, _ConfigData.IqsQueryFilter); +// //lines = ProcessDataStandardFormat.GetLines(Logistics, scopeInfo, names, values, dateFormat: "M/d/yyyy hh:mm:ss tt", timeFormat: string.Empty, pairedColumns: ExtractResultPairedColumns); +// List fileReadDescriptions = ProcessData.GetProcessDataFileReadDescriptions(_ConfigData, pdsdBodyValues); +// lines = ProcessData.GetLines(this, fileReadDescriptions); +// tuples.Add(new Tuple(scopeInfo, lines)); +// } +// } +// if (_ConfigData.Duplicator.Value == ConfigData.Level.IsXToOpenInsightMetrologyViewerAttachments) +// { +// string[] matchDirectories = Shared1567(reportFullPath, tuples); +// if (!isDummyRun && _ConfigData.EafHosted && !isNotUsedInsightMetrologyViewerAttachments) +// { +// List fileReadDescriptions = ProcessData.GetProcessDataFileReadDescriptions(_ConfigData, pdsdBodyValues); +// ProcessData.PostOpenInsightMetrologyViewerAttachments(_Log, _ConfigData, Logistics, dateTime, logisticsSequenceMemoryDirectory, fileReadDescriptions, matchDirectories[0]); +// } +// } +// } +// if (_ConfigData.Duplicator.Value != ConfigData.Level.IsXToOpenInsightMetrologyViewer && _ConfigData.Duplicator.Value != ConfigData.Level.IsXToOpenInsightMetrologyViewerAttachments) +// Shared0413(dateTime, isDummyRun, successDirectory, duplicateDirectory, tuples, duplicateFile); +// } +// if (_ConfigData.Duplicator.Value == ConfigData.Level.IsXToOpenInsightMetrologyViewerAttachments) +// { +// string destinationDirectory; +// //string destinationDirectory = WriteScopeInfo(_ConfigData.ProgressPath, Logistics, dateTime, duplicateDirectory, tuples); +// FileInfo fileInfo = new FileInfo(reportFullPath); +// string logisticsSequence = Logistics.Sequence.ToString(); +// if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) +// File.SetLastWriteTime(reportFullPath, fileInfo.CreationTime); +// string jobIdDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_ConfigData.FileConnectorConfiguration.TargetFileLocation)), @"\", Logistics.JobID); +// if (!Directory.Exists(jobIdDirectory)) +// Directory.CreateDirectory(jobIdDirectory); +// string[] matchDirectories; +// if (!_ConfigData.EafHosted) +// 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"); +// destinationDirectory = matchDirectories[0]; +// if (isDummyRun) +// Shared0607(reportFullPath, duplicateDirectory, logisticsSequence, destinationDirectory); +// else +// { +// List fileReadDescriptions = ProcessData.GetProcessDataFileReadDescriptions(_ConfigData, pdsdBodyValues); +// ProcessData.WSRequest wsRequest = new ProcessData.WSRequest(this, fileReadDescriptions); +// JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true }; +// string json = JsonSerializer.Serialize(wsRequest, wsRequest.GetType(), jsonSerializerOptions); +// if (_ConfigData.EafHosted) +// Shared1277(reportFullPath, destinationDirectory, logisticsSequence, jobIdDirectory, json); +// else +// { +// string jsonFileName = Path.ChangeExtension(reportFullPath, ".json"); +// string historicalText = File.ReadAllText(jsonFileName); +// if (json != historicalText) +// throw new Exception("File doesn't match historical!"); +// } +// } +// } +// return results; +// } + +// private void MoveArchive() +// { +// CultureInfo cultureInfo = new CultureInfo("en-US"); +// Calendar calendar = cultureInfo.Calendar; +// 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(_ConfigData.FileConnectorConfiguration.TargetFileLocation, @"\", Logistics.JobID); +// if (!Directory.Exists(jobIdDirectory)) +// Directory.CreateDirectory(jobIdDirectory); +// //string destinationArchiveDirectory = string.Concat(jobIdDirectory, @"\!Archive\", weekDirectory); +// string destinationArchiveDirectory = string.Concat(Path.GetDirectoryName(_ConfigData.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); +// } + +// public void Move(string reportFullPath, Tuple> extractResults, Exception exception = null) +// { +// Shared1872(reportFullPath, exception); +// bool isErrorFile = !(exception is 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); +// } +// if (!isErrorFile && _ConfigData.Duplicator is null) +// WriteIO(reportFullPath); +// if (!_ConfigData.EafHosted) +// { +// object @object = GetFilePathGeneratorInfo(reportFullPath, isErrorFile: false); +// if (!(@object is null) && @object is string to) +// { +// if (to.Contains("%")) +// _Log.Debug("Can't debug without EAF Hosting"); +// else +// Shared1124(reportFullPath, extractResults, to, _Configuration.SourceFileLocation, resolvedFileLocation: string.Empty, exception: null); +// } +// } +// } + +// } + +//} \ No newline at end of file diff --git a/Adaptation/Helpers/ConfigData.Level.cs b/Adaptation/Helpers/ConfigData.Level.cs new file mode 100644 index 0000000..27a14f1 --- /dev/null +++ b/Adaptation/Helpers/ConfigData.Level.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; + +namespace Adaptation.Helpers +{ + + public partial class ConfigData + { + public enum Level + { + IsXToOpenInsightMetrologyViewer, //MetrologyWS.SendData(file, string.Concat("http://", serverName, "/api/inbound/MercuryProbe"), headerAttachments); + IsXToIQSSi, //NA -361 + IsXToOpenInsight, //NA -363 + IsXToOpenInsightMetrologyViewerAttachments, //Site-One + IsXToAPC, + IsXToSPaCe, + IsXToArchive, + IsArchive, + IsDummy, + IsNaEDA + } + + public static List> LevelTuples + { + get + { + return new List> + { + new Tuple(0, Level.IsNaEDA, @"\EC_EDA\Staging\Traces\~\Source"), + new Tuple(15, Level.IsXToOpenInsightMetrologyViewer, @"\EC_EAFLog\TracesMES\~\Source"), + new Tuple(-36, Level.IsXToIQSSi, @"\EC_SPC_Si\Traces\~\PollPath"), + new Tuple(-36, Level.IsXToOpenInsight, @"\\messa01ec.ec.local\APPS\Metrology\~\Source"), + new Tuple(36, Level.IsXToOpenInsightMetrologyViewerAttachments, @"\EC_Characterization_Si\In Process\~\Source"), + new Tuple(360, Level.IsXToAPC, @"\EC_APC\Staging\Traces\~\PollPath"), + new Tuple(-36, Level.IsXToSPaCe, @"\EC_SPC_Si\Traces\~\Source"), + new Tuple(180, Level.IsXToArchive, @"\EC_EAFLog\TracesArchive\~\Source"), + new Tuple(36, Level.IsArchive, @"\EC_Characterization_Si\Processed") + //new Tuple("IsDummy" + }; + } + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ConfigData.cs b/Adaptation/Helpers/ConfigData.cs new file mode 100644 index 0000000..5e6c1cd --- /dev/null +++ b/Adaptation/Helpers/ConfigData.cs @@ -0,0 +1,523 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Metrology; +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.Reflection; +using System.Text.Json; +using System.Threading; + +namespace Adaptation.Helpers +{ + + public partial class ConfigData : ConfigDataBase + { + + internal const object NullData = null; + internal const int MinFileLength = 100; + + public string IqsFile { get; private set; } + public string TracePath { get; private set; } + public Level? Duplicator { get; private set; } + public string MemoryPath { get; private set; } + public string VillachPath { get; private set; } + public string ProgressPath { get; private set; } + public string IqsQueryFilter { get; private set; } + public string GhostPCLFileName { get; private set; } + public string LincPDFCFileName { get; private set; } + public string OpenInsightSiViewer { get; private set; } + public string OpenInsightFilePattern { get; private set; } + public string OpenInsightMetrogyViewerAPI { get; private set; } + public static Dictionary> DummyRuns { get; private set; } + + private Timer _Timer; + private int _LastDummyRunIndex; + private readonly Calendar _Calendar; + private readonly string _ReportFullPath; + + public ConfigData(ILogic logic, string cellName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, IList modelObjectParameterDefinitions, string parameterizedModelObjectDefinitionType, bool isEAFHosted) : + base(cellName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, isEAFHosted) + { + _LastDummyRunIndex = -1; + UseCyclicalForDescription = false; + CultureInfo cultureInfo = new CultureInfo("en-US"); + _Calendar = cultureInfo.Calendar; + string firstSourceFileFilter = fileConnectorConfiguration.SourceFileFilter.Split('|')[0]; + if (DummyRuns is null) + DummyRuns = new Dictionary>(); + bool isDuplicator = cellInstanceConnectionName.StartsWith(cellName); + int level = (cellInstanceConnectionName.Length - cellInstanceConnectionName.Replace("-", string.Empty).Length); + if (!isDuplicator) + Duplicator = null; + else + { + CellNames.Add(cellName, cellName); + MesEntities.Add(cellName, cellName); + Duplicator = (Level)level; + } + if (isDuplicator) + ProcessDataDescription = new Duplicator.Description(); + else + ProcessDataDescription = new ProcessData.FileRead.Description(); + if (!isDuplicator) + { + //Verify(fileConnectorConfiguration, cellInstanceConnectionName); + if (!EafHosted) + VerifyProcessDataDescription(logic); + else + WriteExportAliases(logic, cellName, cellInstanceConnectionName); + } + GhostPCLFileName = string.Concat(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), @"\gpcl6win64.exe"); + if (EafHosted && Duplicator.HasValue && Duplicator.Value == Level.IsXToOpenInsightMetrologyViewerAttachments && !File.Exists(GhostPCLFileName)) + throw new Exception("Ghost PCL FileName doesn't Exist!"); + LincPDFCFileName = string.Concat(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), @"\LincPDFC.exe"); + if (EafHosted && Duplicator.HasValue && Duplicator.Value == Level.IsXToOpenInsightMetrologyViewerAttachments && !File.Exists(LincPDFCFileName)) + throw new Exception("LincPDFC FileName doesn't Exist!"); + if (!modelObjectParameterDefinitions.Any()) + { + CellNames.Add(cellName, "****"); + MesEntities.Add(cellName, "****"); + } + else + { + int index; + string key; + string variable = string.Empty; + Dictionary iqsSection = new Dictionary(); + Dictionary pathSection = new Dictionary(); + Dictionary commonSection = new Dictionary(); + Dictionary openInsightSection = new Dictionary(); + foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in modelObjectParameterDefinitions) + { + if (!modelObjectParameterDefinition.Name.Contains('.')) + continue; + else if (modelObjectParameterDefinition.Name.StartsWith("Description.") && (modelObjectParameterDefinition.Name.EndsWith(".EventName") || modelObjectParameterDefinition.Name.EndsWith(".EquipmentType"))) + continue; + index = modelObjectParameterDefinition.Name.IndexOf("."); + if (index <= -1) + continue; + key = modelObjectParameterDefinition.Name.Substring(0, index); + variable = modelObjectParameterDefinition.Name.Substring(index + 1); + if (key == "COMMON") + commonSection.Add(variable, modelObjectParameterDefinition.Value); + //else if (key == "CONNECTION STRINGS") + // connectionStringsSection.Add(variable, modelObjectParameterDefinition.Value); + else if (key == "IQS") + iqsSection.Add(variable, modelObjectParameterDefinition.Value); + else if (key == "OpenInsight") + openInsightSection.Add(variable, modelObjectParameterDefinition.Value); + else if (key == "PATH") + pathSection.Add(variable, modelObjectParameterDefinition.Value); + //else if (key == "REACTOR") + // reactorTuples.Add(new Tuple(variable, modelObjectParameterDefinition.Value)); + //else if (key == "TIBCO") + // tibcoSection.Add(variable, modelObjectParameterDefinition.Value); + else + throw new Exception(cellInstanceConnectionName); + } + if (!iqsSection.Any()) + throw new Exception("IQS section is missing from configuration"); + else + { + key = "FILE"; + if (iqsSection.ContainsKey(key)) + IqsFile = iqsSection[key]; + else + throw new Exception(string.Concat("Missing IQS Configuration entry for ", key)); + if (string.IsNullOrEmpty(IqsFile)) + throw new Exception(string.Format("IQS key {0} is empty", key)); + key = "QUERY"; + if (iqsSection.ContainsKey(key)) + IqsQueryFilter = iqsSection[key]; + else + throw new Exception(string.Concat("Missing IQS Configuration entry for ", key)); + if (string.IsNullOrEmpty(IqsQueryFilter)) + throw new Exception(string.Format("IQS key {0} is empty", key)); + } + if (!pathSection.Any()) + throw new Exception("Path section is missing from configuration"); + else + { + key = "TRACE"; + if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) + TracePath = pathSection[key]; + if (!string.IsNullOrEmpty(TracePath) && !Directory.Exists(TracePath)) + Directory.CreateDirectory(TracePath); + key = "VILLACH"; + if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) + VillachPath = pathSection[key]; + if (!string.IsNullOrEmpty(VillachPath) && !Directory.Exists(VillachPath)) + Directory.CreateDirectory(VillachPath); + key = "Progress"; + if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) + ProgressPath = pathSection[key]; + if (!string.IsNullOrEmpty(ProgressPath) && Directory.Exists(Path.GetPathRoot(ProgressPath)) && !Directory.Exists(ProgressPath)) + Directory.CreateDirectory(ProgressPath); + key = "Memory"; + if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) + MemoryPath = pathSection[key]; + if (!string.IsNullOrEmpty(MemoryPath) && !Directory.Exists(MemoryPath)) + Directory.CreateDirectory(MemoryPath); + } + if (!commonSection.Any()) + throw new Exception("Common section is missing from configuration"); + else + { + key = "CELL_NAMES"; + if (!commonSection.ContainsKey(key) || !commonSection[key].Contains(';') || !commonSection[key].Contains(':')) + throw new Exception(cellInstanceConnectionName); + else + { + string[] segments; + string[] cellNames = commonSection[key].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + foreach (string item in cellNames) + { + segments = item.Split(':'); + CellNames.Add(segments[0].Trim(), segments[1].Trim()); + } + } + if (!string.IsNullOrEmpty(cellName) && !CellNames.ContainsKey(cellName)) + throw new Exception(cellInstanceConnectionName); + key = "MES_ENTITIES"; + if (!commonSection.ContainsKey(key) || !commonSection[key].Contains(';') || !commonSection[key].Contains(':')) + throw new Exception(cellInstanceConnectionName); + else + { + string[] segments; + string[] mesEntity = commonSection[key].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + foreach (string item in mesEntity) + { + segments = item.Split(':'); + MesEntities.Add(segments[0].Trim(), segments[1].Trim()); + } + } + if (!string.IsNullOrEmpty(cellName) && !MesEntities.ContainsKey(cellName)) + throw new Exception(cellInstanceConnectionName); + } + if (!MesEntities.Any()) + throw new Exception(cellInstanceConnectionName); + if (!openInsightSection.Any()) + throw new Exception("OpenInsight section is missing from configuration"); + else + { + key = "MetrologyViewerAPI"; + if (openInsightSection.ContainsKey(key)) + OpenInsightMetrogyViewerAPI = openInsightSection[key]; + if (string.IsNullOrEmpty(OpenInsightMetrogyViewerAPI)) + throw new Exception(string.Format("OpenInsight key {0} is empty", key)); + if (!OpenInsightMetrogyViewerAPI.Contains(":") || !OpenInsightMetrogyViewerAPI.Contains(".")) + throw new Exception(string.Format("OpenInsight key {0} is invalid", key)); + key = "SiViewer"; + if (openInsightSection.ContainsKey(key)) + OpenInsightSiViewer = openInsightSection[key]; + if (string.IsNullOrEmpty(OpenInsightSiViewer)) + throw new Exception(string.Format("OpenInsight key {0} is empty", key)); + if (!OpenInsightSiViewer.Contains(":") || !OpenInsightSiViewer.Contains(".")) + throw new Exception(string.Format("OpenInsight key {0} is invalid", key)); + key = "FilePattern"; + if (openInsightSection.ContainsKey(key)) + OpenInsightFilePattern = openInsightSection[key]; + else + throw new Exception(string.Concat("Missing OpenInsight Configuration entry for ", key)); + if (string.IsNullOrEmpty(OpenInsightFilePattern)) + throw new Exception(string.Format("OpenInsight key {0} is empty", key)); + } + if (IsSourceTimer || IsDatabaseExportToIPDSF || (Duplicator.HasValue && Duplicator.Value == Level.IsDummy)) + { + if (!Directory.Exists(fileConnectorConfiguration.SourceFileLocation)) + Directory.CreateDirectory(fileConnectorConfiguration.SourceFileLocation); + _ReportFullPath = string.Concat(fileConnectorConfiguration.SourceFileLocation, firstSourceFileFilter.Replace("*", @"\")); + if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process) + Callback(null); + else + { + int milliSeconds; + milliSeconds = (int)((fileConnectorConfiguration.FileScanningIntervalInSeconds * 1000) / 2); + _Timer = new Timer(Callback, null, milliSeconds, Timeout.Infinite); + milliSeconds += 2000; + } + } + } + } + + public void CheckProcessDataDescription(Dictionary> results, bool extra) + { + foreach (Test test in results.Keys) + { + if (test == Test.HgCV) + { + if (!(ProcessDataDescription is ProcessData.FileRead.Description)) + ProcessDataDescription = new ProcessData.FileRead.Description(); + } + else + throw new Exception(); + } + } + + private void CallbackIsDummy(string traceDummyFile, List> tuples, bool fileConnectorConfigurationIncludeSubDirectories, bool includeSubDirectoriesExtra) + { + int fileCount; + string[] files; + string monARessource; + string checkDirectory; + string sourceArchiveFile; + string inProcessDirectory; + const string site = "sjc"; + const string monInURL = "http://moninhttp.sjc.infineon.com/input/text"; + MonIn monIn = MonIn.GetInstance(monInURL); + string stateName = string.Concat("Dummy_", _EventName); + foreach (Tuple item in tuples) + { + monARessource = item.Item1; + sourceArchiveFile = item.Item2; + inProcessDirectory = item.Item3; + checkDirectory = item.Item4; + fileCount = item.Item5; + try + { + if (fileCount > 0 || string.IsNullOrEmpty(checkDirectory)) + { + 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); + } + else if (inProcessDirectory == checkDirectory) + continue; + if (!EafHosted) + continue; + if (!File.Exists(sourceArchiveFile)) + continue; + if (!long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence)) + continue; + ZipFile.ExtractToDirectory(sourceArchiveFile, inProcessDirectory); + if (fileConnectorConfigurationIncludeSubDirectories && includeSubDirectoriesExtra) + { + if (_EventName == EventName.FileRead) + checkDirectory = string.Concat(checkDirectory, @"\", sequence); + else if (_EventName == EventName.FileReadDaily) + checkDirectory = string.Concat(checkDirectory, @"\Source\", sequence); + else + throw new Exception(); + } + if (fileConnectorConfigurationIncludeSubDirectories) + files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.AllDirectories); + else + 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 (!fileConnectorConfigurationIncludeSubDirectories) + { + foreach (string file in files) + File.Move(file, string.Concat(checkDirectory, @"\", Path.GetFileName(file))); + } + else + { + string[] directories = Directory.GetDirectories(inProcessDirectory, "*", SearchOption.AllDirectories); + foreach (string directory in directories) + Directory.CreateDirectory(string.Concat(checkDirectory, directory.Substring(inProcessDirectory.Length))); + foreach (string file in files) + File.Move(file, string.Concat(checkDirectory, 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) + { + File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Critical.ToString(), exception.Message, exception.StackTrace }); + monIn.SendStatus(site, monARessource, stateName, State.Critical); + try + { + Eaf.Core.Smtp.ISmtp smtp = Eaf.Core.Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); + Eaf.Core.Smtp.EmailMessage emailMessage = new Eaf.Core.Smtp.EmailMessage(string.Concat("Exception:", EquipmentElementName), string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace), Eaf.Core.Smtp.MailPriority.High); + smtp.Send(emailMessage); + } + catch (Exception) { } + } + } + } + + private void CallbackIsDummy() + { + DateTime dateTime = DateTime.Now; + bool check = (dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday); + if (check) + { + int fileCount; + string[] files; + string monARessource; + string checkDirectory; + string sourceArchiveFile; + string sourceFileLocation; + string targetFileLocation; + string inProcessDirectory; + string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); + string traceDummyDirectory = string.Concat(Path.GetPathRoot(TracePath), @"\TracesDummy\", CellName, @"\Source\", dateTime.ToString("yyyy"), "___Week_", weekOfYear); + if (!Directory.Exists(traceDummyDirectory)) + Directory.CreateDirectory(traceDummyDirectory); + string traceDummyFile = string.Concat(traceDummyDirectory, @"\", dateTime.Ticks, " - ", CellName, ".txt"); + File.AppendAllText(traceDummyFile, string.Empty); + List> tuples = new List>(); + foreach (var keyValuePair in CellNames) + { + monARessource = keyValuePair.Key; + if (!keyValuePair.Value.Contains(@"\")) + continue; + foreach (string sourceFileFilter in FileConnectorConfiguration.SourceFileFilter.Split('|')) + { + if (sourceFileFilter.ToLower().StartsWith(keyValuePair.Value.Replace(@"\", string.Empty))) + sourceFileLocation = Path.GetFullPath(FileConnectorConfiguration.SourceFileLocation); + else if (FileConnectorConfiguration.SourceFileLocation.ToLower().EndsWith(keyValuePair.Value)) + sourceFileLocation = Path.GetFullPath(FileConnectorConfiguration.SourceFileLocation); + else + sourceFileLocation = Path.GetFullPath(string.Concat(FileConnectorConfiguration.SourceFileLocation, @"\", keyValuePair.Value)); + sourceArchiveFile = Path.GetFullPath(string.Concat(sourceFileLocation, @"\", sourceFileFilter)); + targetFileLocation = Path.GetFullPath(string.Concat(FileConnectorConfiguration.TargetFileLocation, @"\", keyValuePair.Value)); + if (!File.Exists(sourceArchiveFile)) + continue; + if (!DummyRuns.ContainsKey(monARessource)) + DummyRuns.Add(monARessource, new List()); + tuples.Add(new Tuple(monARessource, sourceFileLocation, targetFileLocation, sourceArchiveFile, 0)); + } + } + File.AppendAllLines(traceDummyFile, from l in tuples select l.Item4); + if (tuples.Any()) + { + _LastDummyRunIndex += 1; + if (_LastDummyRunIndex >= tuples.Count) + _LastDummyRunIndex = 0; + monARessource = tuples[_LastDummyRunIndex].Item1; + sourceFileLocation = tuples[_LastDummyRunIndex].Item2; + targetFileLocation = tuples[_LastDummyRunIndex].Item3; + sourceArchiveFile = tuples[_LastDummyRunIndex].Item4; + //fileCount = tuples[_LastDummyRunIndex].Item5; + tuples.Clear(); + if (long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence)) + { + if (!DummyRuns[monARessource].Contains(sequence)) + DummyRuns[monARessource].Add(sequence); + inProcessDirectory = string.Concat(ProgressPath, @"\", monARessource, @"\Dummy_in process\", sequence); + checkDirectory = inProcessDirectory; + if (!Directory.Exists(checkDirectory)) + Directory.CreateDirectory(checkDirectory); + files = Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories); + fileCount = files.Length; + if (files.Any()) + { + if (files.Length > 250) + throw new Exception("Safety net!"); + try + { + foreach (string file in files) + File.Delete(file); + } + catch (Exception) { } + } + tuples.Add(new Tuple(monARessource, sourceArchiveFile, inProcessDirectory, checkDirectory, fileCount)); + checkDirectory = targetFileLocation; + files = Directory.GetFiles(checkDirectory, string.Concat("*", sequence, "*"), SearchOption.TopDirectoryOnly); + fileCount = files.Length; + tuples.Add(new Tuple(monARessource, sourceArchiveFile, inProcessDirectory, checkDirectory, fileCount)); + } + } + if (tuples.Any()) + CallbackIsDummy(traceDummyFile, tuples, FileConnectorConfiguration.IncludeSubDirectories.Value, includeSubDirectoriesExtra: false); + } + } + + private void Callback(object state) + { + try + { + if (Duplicator is null) + { + if (File.Exists(_ReportFullPath)) + File.Delete(_ReportFullPath); + File.WriteAllText(_ReportFullPath, string.Empty); + } + else if (Duplicator.Value == Level.IsDummy) + CallbackIsDummy(); + else + throw new Exception(); + } + catch (Exception exception) + { + try + { + Eaf.Core.Smtp.ISmtp smtp = Eaf.Core.Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); + Eaf.Core.Smtp.EmailMessage emailMessage = new Eaf.Core.Smtp.EmailMessage(string.Concat("Exception:", EquipmentElementName), string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace), Eaf.Core.Smtp.MailPriority.High); + smtp.Send(emailMessage); + } + catch (Exception) { } + } + try + { + TimeSpan timeSpan; + if (IsDatabaseExportToIPDSF) + timeSpan = new TimeSpan(DateTime.Now.AddMinutes(1).Ticks - DateTime.Now.Ticks); + else if (IsSourceTimer) + timeSpan = new TimeSpan(DateTime.Now.AddMinutes(15).Ticks - DateTime.Now.Ticks); + else if (Duplicator.HasValue && Duplicator.Value == Level.IsDummy) + timeSpan = new TimeSpan(DateTime.Now.AddSeconds(FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks); + else if (Duplicator.HasValue) + timeSpan = new TimeSpan(DateTime.Now.AddSeconds(30).Ticks - DateTime.Now.Ticks); + else + timeSpan = new TimeSpan(DateTime.Now.AddDays(.5).Ticks - DateTime.Now.Ticks); + if (!(_Timer is null)) + _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite); + else + _Timer = new Timer(Callback, null, (long)timeSpan.TotalMilliseconds, Timeout.Infinite); + } + catch (Exception exception) + { + try + { + Eaf.Core.Smtp.ISmtp smtp = Eaf.Core.Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); + Eaf.Core.Smtp.EmailMessage emailMessage = new Eaf.Core.Smtp.EmailMessage(string.Concat("Exception:", EquipmentElementName), string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace), Eaf.Core.Smtp.MailPriority.High); + smtp.Send(emailMessage); + } + catch (Exception) { } + } + } + + public Tuple> IsManualOIEntry(string reportFullPath) + { + Tuple> results; + string monARessource; + const string site = "sjc"; + string equipment = string.Empty; + string description = string.Empty; + string stateName = "MANUAL_OI_ENTRY"; + string json = File.ReadAllText(reportFullPath); + JsonElement jsonElement = JsonSerializer.Deserialize(json); + results = new Tuple>(string.Empty, jsonElement, new List()); + foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) + { + if (jsonProperty.Name == "Equipment") + equipment = jsonProperty.Value.ToString(); + else if (jsonProperty.Name == "Description") + description = jsonProperty.Value.ToString(); + } + if (string.IsNullOrEmpty(equipment)) + monARessource = CellName; + else + monARessource = equipment; + const string monInURL = "http://moninhttp.sjc.infineon.com/input/text"; + MonIn monIn = MonIn.GetInstance(monInURL); + if (EafHosted) + monIn.SendStatus(site, monARessource, stateName, State.Warning, description); + return results; + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ProcessData.FileRead.Description.cs b/Adaptation/Helpers/ProcessData.FileRead.Description.cs new file mode 100644 index 0000000..04e64cd --- /dev/null +++ b/Adaptation/Helpers/ProcessData.FileRead.Description.cs @@ -0,0 +1,410 @@ +using Adaptation.Shared; +using Adaptation.Shared.Metrology; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.Helpers +{ + + public partial class ProcessData + { + + public class FileRead + { + + public class Description : IProcessDataDescription + { + + 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; } + public string Employee { get; set; } + public string Lot { get; set; } + public string PSN { get; set; } + public string Reactor { get; set; } + public string Recipe { get; set; } + // + public string Area { get; set; } + public string Folder { get; set; } + public string HeaderUniqueId { get; set; } + public string Id { get; set; } + public string Layer { get; set; } + public string Model { get; set; } + public string Pattern { get; set; } + public string Phase { get; set; } + public string Plan { get; set; } + public string RampRate { get; set; } + public string RDS { get; set; } + public string SetupFile { get; set; } + public string StartVoltage { get; set; } + public string StopVoltage { get; set; } + public string UniqueId { get; set; } + public string Wafer { get; set; } + public string WaferSize { get; set; } + public string Zone { get; set; } + // + public string Ccomp { get; set; } + public string CondType { get; set; } + public string FlatZ { get; set; } + public string FlatZMean { get; set; } + public string FlatZRadialGradient { get; set; } + public string FlatZStdDev { get; set; } + public string GLimit { get; set; } + public string Grade { get; set; } + public string GradeMean { get; set; } + public string GradeRadialGradient { get; set; } + public string GradeStdDev { get; set; } + public string NAvg { get; set; } + public string NAvgMean { get; set; } + public string NAvgRadialGradient { get; set; } + public string NAvgStdDev { get; set; } + public string Nsl { get; set; } + public string NslMean { get; set; } + public string NslRadialGradient { get; set; } + public string NslStdDev { get; set; } + public string PhaseMean { get; set; } + public string PhaseRadialGradient { get; set; } + public string PhaseStdDev { get; set; } + public string RhoAvg { get; set; } + public string RhoAvgMean { get; set; } + public string RhoAvgRadialGradient { get; set; } + public string RhoAvgStdDev { get; set; } + public string RhoMethod { get; set; } + public string Rhosl { get; set; } + public string RhoslMean { get; set; } + public string RhoslRadialGradient { get; set; } + public string RhoslStdDev { get; set; } + public string RsMean { get; set; } + public string RsRadialGradient { get; set; } + public string RsStdDev { get; set; } + public string Vd { get; set; } + public string VdMean { get; set; } + public string VdRadialGradient { get; set; } + public string VdStdDev { get; set; } + + public string GetEventDescription() { return "File Has been read and parsed"; } + + public List GetHeaderNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List + { + nameof(Date), + nameof(Employee), + nameof(Lot), + nameof(PSN), + nameof(Reactor), + nameof(Recipe) + }; + return results; + } + + public List GetDetailNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List + { + nameof(Area), + nameof(Folder), + nameof(HeaderUniqueId), + nameof(Id), + nameof(Layer), + nameof(Model), + nameof(Pattern), + nameof(Phase), + nameof(Plan), + nameof(RampRate), + nameof(RDS), + nameof(SetupFile), + nameof(StartVoltage), + nameof(StopVoltage), + nameof(UniqueId), + nameof(Wafer), + nameof(WaferSize), + nameof(Zone) + }; + return results; + } + + public List GetParameterNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List + { + nameof(Ccomp), + nameof(CondType), + nameof(FlatZ), + nameof(FlatZMean), + nameof(FlatZRadialGradient), + nameof(FlatZStdDev), + nameof(GLimit), + nameof(Grade), + nameof(GradeMean), + nameof(GradeRadialGradient), + nameof(GradeStdDev), + nameof(NAvg), + nameof(NAvgMean), + nameof(NAvgRadialGradient), + nameof(NAvgStdDev), + nameof(Nsl), + nameof(NslMean), + nameof(NslRadialGradient), + nameof(NslStdDev), + nameof(PhaseMean), + nameof(PhaseRadialGradient), + nameof(PhaseStdDev), + nameof(RhoAvg), + nameof(RhoAvgMean), + nameof(RhoAvgRadialGradient), + nameof(RhoAvgStdDev), + nameof(RhoMethod), + nameof(Rhosl), + nameof(RhoslMean), + nameof(RhoslRadialGradient), + nameof(RhoslStdDev), + nameof(RsMean), + nameof(RsRadialGradient), + nameof(RsStdDev), + nameof(Vd), + nameof(VdMean), + nameof(VdRadialGradient), + nameof(VdStdDev) + }; + return results; + } + + public List GetPairedParameterNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List(); + return results; + } + + public List GetIgnoreParameterNames(ILogic logic, ConfigDataBase configDataBase, Test test) + { + List results = new List(); + return results; + } + + public List GetNames(ILogic logic, ConfigDataBase configDataBase) + { + List results = new List(); + IProcessDataDescription processDataDescription = GetDefault(logic, configDataBase); + string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType()); + object @object = JsonSerializer.Deserialize(json); + if (!(@object is JsonElement jsonElement)) + throw new Exception(); + foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) + results.Add(jsonProperty.Name); + return results; + } + + public IProcessDataDescription GetDisplayNames(ILogic logic, ConfigDataBase configDataBase) + { + Description result = new Description(); + return result; + } + + public IProcessDataDescription GetDefault(ILogic logic, ConfigDataBase configDataBase) + { + Description result = new Description + { + Test = -1, + Count = 0, + Index = -1, + // + EventName = configDataBase.GetEventName(), + NullData = string.Empty, + JobID = logic.Logistics.JobID, + Sequence = logic.Logistics.Sequence.ToString(), + MesEntity = logic.Logistics.MesEntity, + ReportFullPath = logic.Logistics.ReportFullPath, + ProcessJobID = logic.Logistics.ProcessJobID, + MID = logic.Logistics.MID, + // + Date = nameof(Date), + Employee = nameof(Employee), + Lot = nameof(Lot), + PSN = nameof(PSN), + Reactor = nameof(Reactor), + Recipe = nameof(Recipe), + // + Area = nameof(Area), + Folder = nameof(Folder), + HeaderUniqueId = nameof(HeaderUniqueId), + Id = nameof(Id), + Layer = nameof(Layer), + Model = nameof(Model), + Pattern = nameof(Pattern), + Phase = nameof(Phase), + Plan = nameof(Plan), + RampRate = nameof(RampRate), + RDS = nameof(RDS), + SetupFile = nameof(SetupFile), + StartVoltage = nameof(StartVoltage), + StopVoltage = nameof(StopVoltage), + UniqueId = nameof(UniqueId), + Wafer = nameof(Wafer), + WaferSize = nameof(WaferSize), + Zone = nameof(Zone), + // + Ccomp = nameof(Ccomp), + CondType = nameof(CondType), + FlatZ = nameof(FlatZ), + FlatZMean = nameof(FlatZMean), + FlatZRadialGradient = nameof(FlatZRadialGradient), + FlatZStdDev = nameof(FlatZStdDev), + GLimit = nameof(GLimit), + Grade = nameof(Grade), + GradeMean = nameof(GradeMean), + GradeRadialGradient = nameof(GradeRadialGradient), + GradeStdDev = nameof(GradeStdDev), + NAvg = nameof(NAvg), + NAvgMean = nameof(NAvgMean), + NAvgRadialGradient = nameof(NAvgRadialGradient), + NAvgStdDev = nameof(NAvgStdDev), + Nsl = nameof(Nsl), + NslMean = nameof(NslMean), + NslRadialGradient = nameof(NslRadialGradient), + NslStdDev = nameof(NslStdDev), + PhaseMean = nameof(PhaseMean), + PhaseRadialGradient = nameof(PhaseRadialGradient), + PhaseStdDev = nameof(PhaseStdDev), + RhoAvg = nameof(RhoAvg), + RhoAvgMean = nameof(RhoAvgMean), + RhoAvgRadialGradient = nameof(RhoAvgRadialGradient), + RhoAvgStdDev = nameof(RhoAvgStdDev), + RhoMethod = nameof(RhoMethod), + Rhosl = nameof(Rhosl), + RhoslMean = nameof(RhoslMean), + RhoslRadialGradient = nameof(RhoslRadialGradient), + RhoslStdDev = nameof(RhoslStdDev), + RsMean = nameof(RsMean), + RsRadialGradient = nameof(RsRadialGradient), + RsStdDev = nameof(RsStdDev), + Vd = nameof(Vd), + VdMean = nameof(VdMean), + VdRadialGradient = nameof(VdRadialGradient), + VdStdDev = nameof(VdStdDev), + }; + return result; + } + + public List GetDescription(ILogic logic, ConfigDataBase configDataBase, List tests, IProcessData iProcessData) + { + List results = new List(); + if (iProcessData is null || !(iProcessData is ProcessData processData) || processData.Header is null || !processData.Details.Any()) + results.Add(GetDefault(logic, configDataBase)); + else + { + string nullData; + Description description; + object configDataNullData = ConfigData.NullData; + if (configDataNullData is null) + nullData = string.Empty; + else + nullData = configDataNullData.ToString(); + for (int i = 0; i < processData.Details.Count; i++) + { + description = new Description + { + Test = (int)tests[i], + Count = tests.Count, + Index = i, + // + EventName = configDataBase.GetEventName(), + NullData = nullData, + JobID = logic.Logistics.JobID, + Sequence = logic.Logistics.Sequence.ToString(), + MesEntity = logic.Logistics.MesEntity, + ReportFullPath = logic.Logistics.ReportFullPath, + ProcessJobID = logic.Logistics.ProcessJobID, + MID = logic.Logistics.MID, + // + Date = processData.Header.Date, + Employee = processData.Header.Employee, + Lot = processData.Header.Lot, + PSN = processData.Header.PSN, + Reactor = processData.Header.Reactor, + Recipe = string.Empty, + // + Area = processData.Header.Area, + Folder = processData.Header.Folder, + HeaderUniqueId = processData.Details[i].HeaderUniqueId, + Id = string.Empty, + Layer = processData.Header.Layer, + Model = processData.Header.Model, + Pattern = processData.Header.Pattern, + Phase = processData.Details[i].Phase, + Plan = processData.Header.Plan, + RampRate = processData.Header.RampRate, + RDS = processData.Header.RDS, + SetupFile = processData.Header.SetupFile, + StartVoltage = processData.Header.StartVoltage, + StopVoltage = processData.Header.StopVoltage, + UniqueId = processData.Details[i].UniqueId, + Wafer = processData.Header.Wafer, + WaferSize = processData.Header.WaferSize, + Zone = processData.Header.Zone, + // + Ccomp = processData.Header.Ccomp, + CondType = processData.Header.CondType, + FlatZ = processData.Details[i].FlatZ, + FlatZMean = processData.Header.FlatZMean, + FlatZRadialGradient = processData.Header.FlatZRadialGradient, + FlatZStdDev = processData.Header.FlatZStdDev, + GLimit = processData.Header.GLimit, + Grade = processData.Details[i].Grade, + GradeMean = processData.Header.GradeMean, + GradeRadialGradient = processData.Header.GradeRadialGradient, + GradeStdDev = processData.Header.GradeStdDev, + NAvg = processData.Details[i].NAvg, + NAvgMean = processData.Header.NAvgMean, + NAvgRadialGradient = processData.Header.NAvgRadialGradient, + NAvgStdDev = processData.Header.NAvgStdDev, + Nsl = processData.Details[i].Nsl, + NslMean = processData.Header.NslMean, + NslRadialGradient = processData.Header.NslRadialGradient, + NslStdDev = processData.Header.NslStdDev, + PhaseMean = processData.Header.PhaseMean, + PhaseRadialGradient = processData.Header.PhaseRadialGradient, + PhaseStdDev = processData.Header.PhaseStdDev, + RhoAvg = processData.Details[i].RhoAvg, + RhoAvgMean = processData.Header.RhoAvgMean, + RhoAvgRadialGradient = processData.Header.RhoAvgRadialGradient, + RhoAvgStdDev = processData.Header.RhoAvgStdDev, + RhoMethod = processData.Header.RhoMethod, + Rhosl = processData.Details[i].Rhosl, + RhoslMean = processData.Header.RhoslMean, + RhoslRadialGradient = processData.Header.RhoslRadialGradient, + RhoslStdDev = processData.Header.RhoslStdDev, + RsMean = processData.Header.RsMean, + RsRadialGradient = processData.Header.RsRadialGradient, + RsStdDev = processData.Header.RsStdDev, + Vd = processData.Details[i].Vd, + VdMean = processData.Header.VdMean, + VdRadialGradient = processData.Header.VdRadialGradient, + VdStdDev = processData.Header.VdStdDev + }; + results.Add(description); + } + } + return results; + } + + } + + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ProcessData.HgProbeDetail.cs b/Adaptation/Helpers/ProcessData.HgProbeDetail.cs new file mode 100644 index 0000000..dd0ca70 --- /dev/null +++ b/Adaptation/Helpers/ProcessData.HgProbeDetail.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace Adaptation.Helpers +{ + + public partial class ProcessData + { + + public class HgProbeDetail + { + + public string FlatZ { get; set; } + public string Grade { get; set; } + public string HeaderUniqueId { get; set; } + public string NAvg { get; set; } + public string Nsl { get; set; } + public string Phase { get; set; } + public string RhoAvg { get; set; } + public string Rhosl { get; set; } + public string UniqueId { get; set; } + public string Vd { get; set; } + + public override string ToString() + { + return string.Concat(FlatZ, ";", Grade); + } + + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ProcessData.HgProbeFile.cs b/Adaptation/Helpers/ProcessData.HgProbeFile.cs new file mode 100644 index 0000000..5c58c26 --- /dev/null +++ b/Adaptation/Helpers/ProcessData.HgProbeFile.cs @@ -0,0 +1,70 @@ +using System.Collections.Generic; + +namespace Adaptation.Helpers +{ + + public partial class ProcessData + { + + public class HgProbeFile + { + + public string JobID { get; set; } + public string MesEntity { get; set; } + public string Area { get; set; } + public string Ccomp { get; set; } + public string CondType { get; set; } + public string Date { get; set; } + public string Employee { get; set; } + public string FlatZMean { get; set; } + public string FlatZRadialGradient { get; set; } + public string FlatZStdDev { get; set; } + public string Folder { get; set; } + public string GLimit { get; set; } + public string GradeMean { get; set; } + public string GradeRadialGradient { get; set; } + public string GradeStdDev { get; set; } + public string Layer { get; set; } + public string Lot { get; set; } + public string Model { get; set; } + public string NAvgMean { get; set; } + public string NAvgRadialGradient { get; set; } + public string NAvgStdDev { get; set; } + public string NslMean { get; set; } + public string NslRadialGradient { get; set; } + public string NslStdDev { get; set; } + public string PSN { get; set; } + public string Pattern { get; set; } + public string PhaseMean { get; set; } + public string PhaseRadialGradient { get; set; } + public string PhaseStdDev { get; set; } + public string Plan { get; set; } + public string RDS { get; set; } + public string RampRate { get; set; } + public string Reactor { get; set; } + public string RhoAvgMean { get; set; } + public string RhoAvgRadialGradient { get; set; } + public string RhoAvgStdDev { get; set; } + public string RhoMethod { get; set; } + public string RhoslMean { get; set; } + public string RhoslRadialGradient { get; set; } + public string RhoslStdDev { get; set; } + public string RsMean { get; set; } + public string RsRadialGradient { get; set; } + public string RsStdDev { get; set; } + public string SetupFile { get; set; } + public string StartVoltage { get; set; } + public string StopVoltage { get; set; } + public string UniqueId { get; set; } + public string VdMean { get; set; } + public string VdRadialGradient { get; set; } + public string VdStdDev { get; set; } + public string Wafer { get; set; } + public string WaferSize { get; set; } + public string Zone { get; set; } + + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ProcessData.WSRequest.cs b/Adaptation/Helpers/ProcessData.WSRequest.cs new file mode 100644 index 0000000..4b7a796 --- /dev/null +++ b/Adaptation/Helpers/ProcessData.WSRequest.cs @@ -0,0 +1,162 @@ +using Adaptation.Shared.Metrology; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Adaptation.Helpers +{ + + public partial class ProcessData + { + public class WSRequest + { + public bool SentToMetrology { get; set; } + public bool SentToSPC { get; set; } + // + + public string Area { get; set; } + public string Ccomp { get; set; } + public string CellName { get; set; } + public string CondType { get; set; } + public string Date { get; set; } + public string FlatZMean { get; set; } + public string FlatZRadialGradient { get; set; } + public string FlatZStdDev { get; set; } + public string Folder { get; set; } + public string GLimit { get; set; } + public string GradeMean { get; set; } + public string GradeRadialGradient { get; set; } + public string GradeStdDev { get; set; } + public string Id { get; set; } + public string Layer { get; set; } + public string Lot { get; set; } + public string Model { get; set; } + public string NAvgMean { get; set; } + public string NAvgRadialGradient { get; set; } + public string NAvgStdDev { get; set; } + public string NslMean { get; set; } + public string NslRadialGradient { get; set; } + public string NslStdDev { get; set; } + public string Operator { get; set; } + public string PSN { get; set; } + public string Pattern { get; set; } + public string PhaseMean { get; set; } + public string PhaseRadialGradient { get; set; } + public string PhaseStdDev { get; set; } + public string Plan { get; set; } + public string RDS { get; set; } + public string RampRate { get; set; } + public string Reactor { get; set; } + public string RhoAvgMean { get; set; } + public string RhoAvgRadialGradient { get; set; } + public string RhoAvgStdDev { get; set; } + public string RhoMethod { get; set; } + public string RhoslMean { get; set; } + public string RhoslRadialGradient { get; set; } + public string RhoslStdDev { get; set; } + public string RsMean { get; set; } + public string RsRadialGradient { get; set; } + public string RsStdDev { get; set; } + public string SetupFile { get; set; } + public string StartVoltage { get; set; } + public string StopVoltage { get; set; } + public string UniqueId { get; set; } + public string VdMean { get; set; } + public string VdRadialGradient { get; set; } + public string VdStdDev { get; set; } + public string Wafer { get; set; } + public string WaferSize { get; set; } + public string Zone { get; set; } + public List Details { get; protected set; } + + [Obsolete("For json")] public WSRequest() { } + + internal WSRequest(ILogic logic, List descriptions) + { + Id = string.Empty; + Details = new List(); + CellName = logic.Logistics.MesEntity; + FileRead.Description x = descriptions[0]; + //Header + { + Area = x.Area; + Ccomp = x.Ccomp; + CondType = x.CondType; + Date = x.Date; + FlatZMean = x.FlatZMean; + FlatZRadialGradient = x.FlatZRadialGradient; + FlatZStdDev = x.FlatZStdDev; + Folder = x.Folder; + GLimit = x.GLimit; + GradeMean = x.GradeMean; + GradeRadialGradient = x.GradeRadialGradient; + GradeStdDev = x.GradeStdDev; + Operator = x.Employee; + Layer = x.Layer; + Lot = x.Lot; + Model = x.Model; + NAvgMean = x.NAvgMean; + NAvgRadialGradient = x.NAvgRadialGradient; + NAvgStdDev = x.NAvgStdDev; + NslMean = x.NslMean; + NslRadialGradient = x.NslRadialGradient; + NslStdDev = x.NslStdDev; + PSN = x.PSN; + Pattern = x.Pattern; + PhaseMean = x.PhaseMean; + PhaseRadialGradient = x.PhaseRadialGradient; + PhaseStdDev = x.PhaseStdDev; + Plan = x.Plan; + RDS = x.RDS; + RampRate = x.RampRate; + Reactor = x.Reactor; + RhoAvgMean = x.RhoAvgMean; + RhoAvgRadialGradient = x.RhoAvgRadialGradient; + RhoAvgStdDev = x.RhoAvgStdDev; + RhoMethod = x.RhoMethod; + RhoslMean = x.RhoslMean; + RhoslRadialGradient = x.RhoslRadialGradient; + RhoslStdDev = x.RhoslStdDev; + RsMean = x.RsMean; + RsRadialGradient = x.RsRadialGradient; + RsStdDev = x.RsStdDev; + SetupFile = x.SetupFile; + StartVoltage = x.StartVoltage; + StopVoltage = x.StopVoltage; + UniqueId = x.UniqueId; + VdMean = x.VdMean; + VdRadialGradient = x.VdRadialGradient; + VdStdDev = x.VdStdDev; + Wafer = x.Wafer; + WaferSize = x.WaferSize; + Zone = x.Zone; + } + HgProbeDetail hgProbeDetail; + foreach (FileRead.Description description in descriptions) + { + hgProbeDetail = new HgProbeDetail + { + FlatZ = description.FlatZ, + Grade = description.Grade, + HeaderUniqueId = description.HeaderUniqueId, + NAvg = description.NAvg, + Nsl = description.Nsl, + Phase = description.Phase, + RhoAvg = description.RhoAvg, + Rhosl = description.Rhosl, + UniqueId = description.UniqueId, + Vd = description.Vd + }; + Details.Add(hgProbeDetail); + } + if (Date is null) + Date = logic.Logistics.DateTimeFromSequence.ToString(); + if (UniqueId is null && Details.Any()) + UniqueId = Details[0].HeaderUniqueId; + } + + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ProcessData.cs b/Adaptation/Helpers/ProcessData.cs new file mode 100644 index 0000000..df47641 --- /dev/null +++ b/Adaptation/Helpers/ProcessData.cs @@ -0,0 +1,453 @@ +using Adaptation.Shared; +using Adaptation.Shared.Metrology; +using log4net; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; + +namespace Adaptation.Helpers +{ + + public partial class ProcessData : IProcessData + { + + public HgProbeFile Header { get; private set; } + public List Details { get; private set; } + + private int _I; + private readonly ILog _Log; + private string _Data; + + public ProcessData(ILogic logic, ConfigData configData, List fileInfoCollection) + { + Header = null; + fileInfoCollection.Clear(); + _I = 0; + _Data = string.Empty; + _Log = LogManager.GetLogger(typeof(ProcessData)); + Details = new List(); + Tuple> tuple = Parse(logic, configData, fileInfoCollection); + Details.AddRange(tuple.Item2); + Header = tuple.Item1; + } + + public Tuple> GetResults(ILogic logic, ConfigDataBase configDataBase, List fileInfoCollection) + { + Tuple> results; + if (!(configDataBase is ConfigData configData)) + throw new Exception(); + List tests = new List(); + List descriptions; + EventName eventName = configData.GetEventNameValue(); + if (eventName == EventName.FileRead && Details.Any()) + { + foreach (var item in Details) + tests.Add(Test.HgCV); + descriptions = configData.GetDescription(logic, tests, this); + } + else + throw new Exception(); + if (!configData.EafHosted) + { + new FileRead.Description().GetDescription(logic, configData, tests, this); + } + if (tests.Count != descriptions.Count) + throw new Exception(); + for (int i = 0; i < tests.Count; i++) + { + if (descriptions[i].Test != (int)tests[i]) + throw new Exception(); + } + string json; + if (descriptions[0] is Duplicator.Description) + { + List duplicatorDescriptions = (from l in descriptions select (Duplicator.Description)l).ToList(); + json = JsonSerializer.Serialize(duplicatorDescriptions, duplicatorDescriptions.GetType()); + } + else if (descriptions[0] is FileRead.Description) + { + List fileReadDescriptions = (from l in descriptions select (FileRead.Description)l).ToList(); + json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType()); + } + else + throw new Exception(); + object @object = JsonSerializer.Deserialize(json); + if (!(@object is JsonElement jsonElement)) + throw new Exception(); + results = new Tuple>(logic.Logistics.Logistics1[0], jsonElement, fileInfoCollection); + return results; + } + + public static Dictionary> GetKeyValuePairs(ConfigData configData, JsonElement jsonElement, List processDataDescriptions, bool extra = false) + { + Dictionary> results = configData.GetKeyValuePairs(processDataDescriptions); + configData.CheckProcessDataDescription(results, extra); + return results; + } + + public static List GetProcessDataFileReadDescriptions(ConfigData configData, JsonElement jsonElement) + { + List results = new List(); + List processDataDescriptions = configData.GetIProcessDataDescriptions(jsonElement); + foreach (IProcessDataDescription processDataDescription in processDataDescriptions) + { + if (!(processDataDescription is FileRead.Description description)) + continue; + results.Add(description); + } + return results; + } + + public static string GetLines(ILogic logic, List descriptions) + { + StringBuilder result = new StringBuilder(); + return result.ToString(); + } + + internal static void PostOpenInsightMetrologyViewerAttachments(ILog log, ConfigData configData, Logistics logistics, DateTime dateTime, string logisticsSequenceMemoryDirectory, List descriptions, string matchDirectory) + { + string[] pclFiles = Directory.GetFiles(matchDirectory, "*.pcl", SearchOption.TopDirectoryOnly); + if (pclFiles.Length != 1) + throw new Exception("Invalid source file count!"); + string wsResultsMemoryFile = string.Concat(logisticsSequenceMemoryDirectory, @"\", nameof(WS.Results), ".json"); + if (!File.Exists(wsResultsMemoryFile)) + throw new Exception(string.Concat("Memory file <", wsResultsMemoryFile, "> doesn't exist!")); + string json = File.ReadAllText(wsResultsMemoryFile); + WS.Results metrologyWSRequest = JsonSerializer.Deserialize(json); + long wsResultsHeaderID = metrologyWSRequest.HeaderID; + List pdfFiles = new List(); + pdfFiles.AddRange(Directory.GetFiles(matchDirectory, "*.pdf_old", SearchOption.TopDirectoryOnly)); + foreach (string pdfFile in pdfFiles) + File.Delete(pdfFile); + pdfFiles.Clear(); + pdfFiles.AddRange(Directory.GetFiles(matchDirectory, "*.pdf", SearchOption.TopDirectoryOnly)); + foreach (string pdfFile in pdfFiles) + File.Move(pdfFile, Path.ChangeExtension(pdfFile, ".pdf_old")); + pdfFiles.Clear(); + foreach (string pclFile in pclFiles.OrderBy(l => l)) + pdfFiles.Add(ConvertSourceFileToPdfWithChartData(configData, pclFile)); + if (pdfFiles.Count == 0) + log.Debug("Invalid *.pdf file count!"); + List headerAttachments = new List { new WS.Attachment(descriptions[0].HeaderUniqueId, "Data.pdf", pdfFiles[0]) }; + WS.AttachFiles(configData.OpenInsightMetrogyViewerAPI, wsResultsHeaderID, headerAttachments, dataAttachments: null); + } + + /// + /// Convert the raw data file to parsable file format - in this case from PCL to PDF + /// + /// source file to be converted to PDF + /// + private static string ConvertSourceFileToPdf(ConfigData configData, string sourceFile) + { + string result = Path.ChangeExtension(sourceFile, ".pdf"); + if (!File.Exists(result)) + { + //string arguments = string.Concat("-i \"", sourceFile, "\" -o \"", result, "\""); + string arguments = string.Concat("-dSAFER -dBATCH -dNOPAUSE -dFIXEDMEDIA -dFitPage -dAutoRotatePages=/All -dDEVICEWIDTHPOINTS=792 -dDEVICEHEIGHTPOINTS=612 -sOutputFile=\"", result, "\" -sDEVICE=pdfwrite \"", sourceFile, "\""); + //Process process = Process.Start(configData.LincPDFCFileName, arguments); + Process process = Process.Start(configData.GhostPCLFileName, arguments); + process.WaitForExit(30000); + if (!File.Exists(result)) + throw new Exception("PDF file wasn't created"); + } + return result; + } + + /// + /// Convert the raw data file to parsable file format - in this case from PCL to PDF + /// + /// source file to be converted to PDF + /// + private static string ConvertSourceFileToPdfWithChartData(ConfigData configData, string sourceFile) + { + string result = Path.ChangeExtension(sourceFile, ".pdf"); + if (!File.Exists(result)) + { + string arguments = string.Concat("-i \"", sourceFile, "\" -o \"", result, "\""); + //string arguments = string.Concat("-dSAFER -dBATCH -dNOPAUSE -dFIXEDMEDIA -dFitPage -dAutoRotatePages=/All -dDEVICEWIDTHPOINTS=792 -dDEVICEHEIGHTPOINTS=612 -sOutputFile=\"", result, "\" -sDEVICE=pdfwrite \"", sourceFile, "\""); + Process process = Process.Start(configData.LincPDFCFileName, arguments); + //Process process = Process.Start(configData.GhostPCLFileName, arguments); + process.WaitForExit(30000); + if (!File.Exists(result)) + throw new Exception("PDF file wasn't created"); + } + return result; + } + + private void ScanPast(string text) + { + int num = _Data.IndexOf(text, _I); + if (num > -1) + { + _I = num + text.Length; + } + else + { + _I = _Data.Length; + } + } + + private string GetBefore(string text) + { + int num = _Data.IndexOf(text, _I); + string text2; + if (num > -1) + { + text2 = _Data.Substring(_I, num - _I); + _I = num + text.Length; + return text2.Trim(); + } + text2 = _Data.Substring(_I); + _I = _Data.Length; + return text2.Trim(); + } + + private bool IsNullOrWhiteSpace(string text) + { + for (int i = 0; i < text.Length; i++) + { + if (!char.IsWhiteSpace(text[i])) + { + return false; + } + } + return true; + } + + private bool IsBlankLine() + { + int num = _Data.IndexOf("\n", _I); + return IsNullOrWhiteSpace((num > -1) ? _Data.Substring(_I, num - _I) : _Data.Substring(_I)); + } + + private string GetToEOL() + { + return GetBefore("\n"); + } + + private string GetToken() + { + while (_I < _Data.Length && IsNullOrWhiteSpace(_Data.Substring(_I, 1))) + { + _I++; + } + int j; + for (j = _I; j < _Data.Length && !IsNullOrWhiteSpace(_Data.Substring(j, 1)); j++) + { + } + string text = _Data.Substring(_I, j - _I); + _I = j; + return text.Trim(); + } + + private Tuple> Parse(ILogic logic, ConfigData configData, List fileInfoCollection) + { + Tuple> result; + string headerText; + string sourceFileNamePdf = ConvertSourceFileToPdf(configData, logic.Logistics.ReportFullPath); + fileInfoCollection.Add(new FileInfo(sourceFileNamePdf)); + string altHeaderFileName = Path.ChangeExtension(logic.Logistics.ReportFullPath, ".txt"); + if (File.Exists(altHeaderFileName)) + { + headerText = File.ReadAllText(altHeaderFileName); + fileInfoCollection.Add(new FileInfo(altHeaderFileName)); + } + else + { + //Pdfbox, IKVM.AWT.WinForms + org.apache.pdfbox.pdmodel.PDDocument pdfDocument = org.apache.pdfbox.pdmodel.PDDocument.load(sourceFileNamePdf); + org.apache.pdfbox.util.PDFTextStripper stripper = new org.apache.pdfbox.util.PDFTextStripper(); + headerText = stripper.getText(pdfDocument); + pdfDocument.close(); + File.AppendAllText(altHeaderFileName, headerText); + fileInfoCollection.Add(new FileInfo(altHeaderFileName)); + } + List hgProbeDetails = new List(); + HgProbeFile hgProbeFile = new HgProbeFile { JobID = logic.Logistics.JobID, MesEntity = logic.Logistics.MesEntity, Date = DateTime.Now.ToString() }; + string h = string.Empty; + if (headerText.Contains("G A T E V O L T A G E")) + throw new Exception("Ignore: GATEVOLTAGE runs are not parsed."); + if (!string.IsNullOrEmpty(headerText)) + { + headerText = headerText.Replace("box", ""); + headerText = headerText.Replace("bar", ""); + headerText = headerText.Replace("horiz", ""); + headerText = headerText.Replace("center", ""); + headerText = headerText.Replace("upper", ""); + headerText = headerText.Replace("lower", ""); + headerText = headerText.Replace("right", ""); + headerText = headerText.Replace("left", ""); + headerText = headerText.Replace("thin", ""); + headerText = headerText.Replace("vertical", ""); + headerText = headerText.Replace("line", ""); + headerText = headerText.Replace("middle", ""); + headerText = headerText.Replace("side", ""); + headerText = headerText.Replace("top", ""); // This will change "Stop Voltage" to "S Voltage" + headerText = headerText.Replace("corner", ""); + headerText = headerText.Replace("bottom", ""); + headerText = headerText.Replace("ruleunder", "_"); + headerText = headerText.Replace("@", ""); + headerText = headerText.Replace("*", ""); + _I = 0; + _Data = headerText; + _Log.Debug($"****MERCURY-DATA [002]= {headerText}"); + ScanPast("Operator:"); + hgProbeFile.Employee = GetBefore("Start Voltage:"); + hgProbeFile.StartVoltage = GetBefore("V"); + ScanPast("Wafer :"); + hgProbeFile.Wafer = GetBefore("S Voltage :"); // This is actually "Stop Voltage" + hgProbeFile.StopVoltage = GetBefore("V"); + ScanPast("Lot :"); + if (headerText.Contains("Ramp Rate :")) + hgProbeFile.Lot = GetBefore("Ramp Rate :"); + else if (headerText.Contains("Forward Rate :")) + hgProbeFile.Lot = GetBefore("Forward Rate :"); + else if (headerText.Contains("Conduct Type:")) + hgProbeFile.Lot = GetBefore("Conduct Type:"); + else + hgProbeFile.Lot = string.Empty; + // Remove illegal characters \/:*?"<>| found in the Lot. + hgProbeFile.Lot = Regex.Replace(hgProbeFile.Lot, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0]; + hgProbeFile.RampRate = GetBefore("mV/sec"); + ScanPast("Plan :"); + hgProbeFile.Plan = GetBefore("G limit :"); + //hgProbeFile.GLimit = GetBefore("S "); + hgProbeFile.GLimit = GetBefore("S"); + hgProbeFile.Date = DateTime.Now.ToString(); + ScanPast("Setup File:"); + //hgProbeFile.SetupFile = GetBefore("O O"); + hgProbeFile.SetupFile = GetBefore("O O"); + ScanPast("Wafer size :"); + hgProbeFile.WaferSize = GetBefore("mm"); + ScanPast("Folder :"); + //hgProbeFile.Folder = GetBefore("N N"); + hgProbeFile.Folder = GetBefore("N N"); + ScanPast("Ccomp : "); + hgProbeFile.Ccomp = GetBefore("pF"); + ScanPast("Pattern :"); + //hgProbeFile.Pattern = GetBefore("C C"); + hgProbeFile.Pattern = GetBefore("C C"); + ScanPast("Area:"); + hgProbeFile.Area = GetBefore("cm2"); + ScanPast("Cond Type :"); + hgProbeFile.CondType = GetBefore("Rho Method:"); + //hgProbeFile.RhoMethod = GetBefore("N N"); + hgProbeFile.RhoMethod = GetBefore("N N"); + ScanPast("Model :"); + //hgProbeFile.Model = GetBefore("T T"); + hgProbeFile.Model = GetBefore("T T"); + ScanPast("Navg :"); + hgProbeFile.NAvgMean = GetToken(); + hgProbeFile.NAvgStdDev = GetToken(); + hgProbeFile.NAvgRadialGradient = GetToken(); + ScanPast("Nsl :"); + hgProbeFile.NslMean = GetToken(); + hgProbeFile.NslStdDev = GetToken(); + hgProbeFile.NslRadialGradient = GetToken(); + ScanPast("Vd :"); + hgProbeFile.VdMean = GetToken(); + hgProbeFile.VdStdDev = GetToken(); + hgProbeFile.VdRadialGradient = GetToken(); + ScanPast("Flat Z:"); + hgProbeFile.FlatZMean = GetToken(); + hgProbeFile.FlatZStdDev = GetToken(); + hgProbeFile.FlatZRadialGradient = GetToken(); + ScanPast("Rhoavg:"); + hgProbeFile.RhoAvgMean = GetToken(); + hgProbeFile.RhoAvgStdDev = GetToken(); + hgProbeFile.RhoAvgRadialGradient = GetToken(); + ScanPast("Rhosl :"); + hgProbeFile.RhoslMean = GetToken(); + hgProbeFile.RhoslStdDev = GetToken(); + hgProbeFile.RhoslRadialGradient = GetToken(); + ScanPast("Phase :"); + hgProbeFile.PhaseMean = GetToken(); + hgProbeFile.PhaseStdDev = GetToken(); + hgProbeFile.PhaseRadialGradient = GetToken(); + ScanPast("Grade :"); + hgProbeFile.GradeMean = GetToken(); + hgProbeFile.GradeStdDev = GetToken(); + hgProbeFile.GradeRadialGradient = GetToken(); + ScanPast("Rs :"); + hgProbeFile.RsMean = GetToken(); + hgProbeFile.RsStdDev = GetToken(); + hgProbeFile.RsRadialGradient = GetToken(); + + string lot = hgProbeFile.Lot; + string[] segments = lot.Split('-'); + + if (segments.Length >= 1) + hgProbeFile.Reactor = segments[0]; + + if (segments.Length >= 2) + hgProbeFile.RDS = segments[1]; + + if (segments.Length >= 3) + { + string str = segments[2]; + string[] segmentsB = str.Split('.'); + if (segmentsB.Length >= 1) + hgProbeFile.PSN = segmentsB[0]; + if (segmentsB.Length >= 2) + hgProbeFile.Layer = segmentsB[1]; + } + if (segments.Length >= 4) + hgProbeFile.Zone = segments[3]; + + //ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %"); + ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %"); + string token = GetToken(); + while (!string.IsNullOrEmpty(token)) + { + HgProbeDetail hgProbeDetail = new HgProbeDetail { NAvg = token }; + GetToEOL(); + hgProbeDetail.Nsl = GetToken(); + GetToEOL(); + hgProbeDetail.Vd = GetToken(); + GetToEOL(); + hgProbeDetail.FlatZ = GetToken(); + GetToEOL(); + hgProbeDetail.RhoAvg = GetToken(); + GetToEOL(); + hgProbeDetail.Rhosl = GetToken(); + GetToEOL(); + hgProbeDetail.Phase = GetToken(); + GetToEOL(); + hgProbeDetail.Grade = GetToken(); + hgProbeDetail.UniqueId = string.Concat("_Point-", hgProbeDetails.Count + 1); + hgProbeDetails.Add(hgProbeDetail); + GetToken(); + GetToken(); + GetToken(); + GetToken(); + token = GetToken(); + //if (token.Contains("LincPDF") || token.Contains("MULTIPLE")) + if (token.Contains("MULTIPLE")) + { + //ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %"); + //ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %"); + ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %"); + ScanPast("Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %"); + token = GetToken(); + } + } + } + hgProbeFile.UniqueId = string.Format("{0}_{1}_{2}", logic.Logistics.JobID, hgProbeFile.Lot, Path.GetFileNameWithoutExtension(logic.Logistics.ReportFullPath)); + foreach (HgProbeDetail detail in hgProbeDetails) + { + detail.HeaderUniqueId = hgProbeFile.UniqueId; + detail.UniqueId = string.Concat(detail, detail.UniqueId); + } + fileInfoCollection.Add(new FileInfo(logic.Logistics.ReportFullPath)); + result = new Tuple>(hgProbeFile, hgProbeDetails); + return result; + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/Common/Configuration/ConnectionSetting.cs b/Adaptation/Ifx/Eaf/Common/Configuration/ConnectionSetting.cs new file mode 100644 index 0000000..b6cb4b8 --- /dev/null +++ b/Adaptation/Ifx/Eaf/Common/Configuration/ConnectionSetting.cs @@ -0,0 +1,13 @@ +namespace Adaptation.Ifx.Eaf.Common.Configuration +{ + [System.Runtime.Serialization.DataContractAttribute] + public class ConnectionSetting + { + public ConnectionSetting(string name, string value) { } + + [System.Runtime.Serialization.DataMemberAttribute] + public string Name { get; set; } + [System.Runtime.Serialization.DataMemberAttribute] + public string Value { get; set; } + } +} \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/File.cs b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/File.cs new file mode 100644 index 0000000..4726692 --- /dev/null +++ b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/File.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component +{ + public class File + { + public File(string filePath) { throw new NotImplementedException(); } + public File(string filePath, DateTime timeFileFound) { throw new NotImplementedException(); } + + public string Path { get; } + public DateTime TimeFound { get; } + public bool IsErrorFile { get; } + public Dictionary ContentParameters { get; } + + public File UpdateContentParameters(Dictionary contentParameters) { throw new NotImplementedException(); } + public File UpdateParsingStatus(bool isErrorFile) { throw new NotImplementedException(); } + } +} \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/FilePathGenerator.cs b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/FilePathGenerator.cs new file mode 100644 index 0000000..561725e --- /dev/null +++ b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/FilePathGenerator.cs @@ -0,0 +1,35 @@ +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using System; +using System.Collections.Generic; + +namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component +{ + public class FilePathGenerator + { + public const char PLACEHOLDER_IDENTIFIER = '%'; + public const char PLACEHOLDER_SEPARATOR = ':'; + public const string PLACEHOLDER_NOT_AVAILABLE = "NA"; + public const string PLACEHOLDER_ORIGINAL_FILE_NAME = "OriginalFileName"; + public const string PLACEHOLDER_ORIGINAL_FILE_EXTENSION = "OriginalFileExtension"; + public const string PLACEHOLDER_DATE_TIME = "DateTime"; + public const string PLACEHOLDER_SUB_FOLDER = "SubFolder"; + public const string PLACEHOLDER_CELL_NAME = "CellName"; + + public FilePathGenerator(FileConnectorConfiguration config, Dictionary customPattern = null) { throw new NotImplementedException(); } + public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary customPattern = null) { throw new NotImplementedException(); } + public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary 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(); } + } +} \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/EquipmentConnector/File/Configuration/FileConnectorConfiguration.cs b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Configuration/FileConnectorConfiguration.cs new file mode 100644 index 0000000..5eafd1c --- /dev/null +++ b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Configuration/FileConnectorConfiguration.cs @@ -0,0 +1,135 @@ +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 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 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 + } + } +} \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/EquipmentConnector/File/SelfDescription/FileConnectorParameterTypeDefinitionProvider.cs b/Adaptation/Ifx/Eaf/EquipmentConnector/File/SelfDescription/FileConnectorParameterTypeDefinitionProvider.cs new file mode 100644 index 0000000..55d81fd --- /dev/null +++ b/Adaptation/Ifx/Eaf/EquipmentConnector/File/SelfDescription/FileConnectorParameterTypeDefinitionProvider.cs @@ -0,0 +1,14 @@ +using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes; +using System; +using System.Collections.Generic; + +namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription +{ + public class FileConnectorParameterTypeDefinitionProvider + { + public FileConnectorParameterTypeDefinitionProvider() { } + + public IEnumerable GetAllParameterTypeDefinition() { return null; } + public ParameterTypeDefinition GetParameterTypeDefinition(string name) { return null; } + } +} \ No newline at end of file diff --git a/Adaptation/MET08RESIHGCV.Tests.csproj b/Adaptation/MET08RESIHGCV.Tests.csproj new file mode 100644 index 0000000..bf41fc1 --- /dev/null +++ b/Adaptation/MET08RESIHGCV.Tests.csproj @@ -0,0 +1,73 @@ + + + SAK + SAK + SAK + SAK + + + net5.0 + false + + + trx + ../../../Trunk/DEP08EGANAIXG5/05_TestResults/TestResults + + + true + true + true + + + Windows + + + OSX + + + Linux + + + + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + + + + + + + + + + + + + + NU1701 + + + + + + + + + + Always + + + Always + + + \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/Annotations/NotNullAttribute.cs b/Adaptation/PeerGroup/GCL/Annotations/NotNullAttribute.cs new file mode 100644 index 0000000..c4e64f0 --- /dev/null +++ b/Adaptation/PeerGroup/GCL/Annotations/NotNullAttribute.cs @@ -0,0 +1,10 @@ +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() { } + } +} \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/SecsDriver/HsmsConnectionMode.cs b/Adaptation/PeerGroup/GCL/SecsDriver/HsmsConnectionMode.cs new file mode 100644 index 0000000..82138e2 --- /dev/null +++ b/Adaptation/PeerGroup/GCL/SecsDriver/HsmsConnectionMode.cs @@ -0,0 +1,8 @@ +namespace Adaptation.PeerGroup.GCL.SecsDriver +{ + public enum HsmsConnectionMode + { + Active = 0, + Passive = 1 + } +} \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/SecsDriver/HsmsSessionMode.cs b/Adaptation/PeerGroup/GCL/SecsDriver/HsmsSessionMode.cs new file mode 100644 index 0000000..b52c7a3 --- /dev/null +++ b/Adaptation/PeerGroup/GCL/SecsDriver/HsmsSessionMode.cs @@ -0,0 +1,8 @@ +namespace Adaptation.PeerGroup.GCL.SecsDriver +{ + public enum HsmsSessionMode + { + MultiSession = 0, + SingleSession = 1 + } +} \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/SecsDriver/SecsTransportType.cs b/Adaptation/PeerGroup/GCL/SecsDriver/SecsTransportType.cs new file mode 100644 index 0000000..81181f0 --- /dev/null +++ b/Adaptation/PeerGroup/GCL/SecsDriver/SecsTransportType.cs @@ -0,0 +1,8 @@ +namespace Adaptation.PeerGroup.GCL.SecsDriver +{ + public enum SecsTransportType + { + HSMS = 0, + Serial = 1 + } +} \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/SecsDriver/SerialBaudRate.cs b/Adaptation/PeerGroup/GCL/SecsDriver/SerialBaudRate.cs new file mode 100644 index 0000000..4511319 --- /dev/null +++ b/Adaptation/PeerGroup/GCL/SecsDriver/SerialBaudRate.cs @@ -0,0 +1,16 @@ +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 + } +} \ No newline at end of file diff --git a/Adaptation/Shared/Duplicator/Description.cs b/Adaptation/Shared/Duplicator/Description.cs new file mode 100644 index 0000000..e0031fe --- /dev/null +++ b/Adaptation/Shared/Duplicator/Description.cs @@ -0,0 +1,148 @@ +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() + { + return "File Has been read and parsed"; + } + + List IDescription.GetNames(IFileRead fileRead, Logistics logistics) + { + List results = new(); + IDescription description = GetDefault(fileRead, logistics); + string json = JsonSerializer.Serialize(description, description.GetType()); + object @object = JsonSerializer.Deserialize(json); + if (@object is not JsonElement jsonElement) + throw new Exception(); + foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) + results.Add(jsonProperty.Name); + return results; + } + + List IDescription.GetDetailNames() + { + List results = new(); + return results; + } + + List IDescription.GetHeaderNames() + { + List results = new(); + return results; + } + + IDescription IDescription.GetDisplayNames() + { + Description result = GetDisplayNames(); + return result; + } + + List IDescription.GetParameterNames() + { + List 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(json); + results = ((JsonElement)@object).EnumerateObject().ToArray(); + return results; + } + + List IDescription.GetPairedParameterNames() + { + List results = new(); + return results; + } + + List IDescription.GetIgnoreParameterNames(Test test) + { + List results = new(); + return results; + } + + IDescription IDescription.GetDefaultDescription(IFileRead fileRead, Logistics logistics) + { + Description result = GetDefault(fileRead, logistics); + return result; + } + + Dictionary IDescription.GetDisplayNamesJsonElement(IFileRead fileRead) + { + Dictionary results = new(); + IDescription description = GetDisplayNames(); + string json = JsonSerializer.Serialize(description, description.GetType()); + JsonElement jsonElement = JsonSerializer.Deserialize(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.GetDescriptions(IFileRead fileRead, Logistics logistics, List tests, IProcessData iProcessData) + { + List results = new(); + return results; + } + + private 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, + Date = logistics.DateTimeFromSequence.ToUniversalTime().ToString("MM/dd/yyyy HH:mm:ss") + }; + return result; + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/FileRead.cs b/Adaptation/Shared/FileRead.cs new file mode 100644 index 0000000..1615183 --- /dev/null +++ b/Adaptation/Shared/FileRead.cs @@ -0,0 +1,834 @@ +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 int _HyphenIsArchive; + protected readonly string _ProgressPath; + protected readonly string _EquipmentType; + protected readonly int _HyphenIsXToArchive; + 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> _DummyRuns; + protected readonly Dictionary _FileParameter; + protected readonly string _ParameterizedModelObjectDefinitionType; + protected readonly FileConnectorConfiguration _FileConnectorConfiguration; + protected readonly IList _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 fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted, int hyphenXToArchive, int hyphenIsArchive) + { + _SMTP = smtp; + _IsEvent = isEvent; + _DummyRuns = dummyRuns; + _LastTicksDuration = 0; + _IsEAFHosted = isEAFHosted; + _Description = description; + _FileParameter = fileParameter; + _ReportFullPath = string.Empty; + _HyphenIsArchive = hyphenIsArchive; + _CellInstanceName = cellInstanceName; + _HyphenIsXToArchive = hyphenXToArchive; + _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 < 4) + 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 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 string GetPropertyValue(string cellInstanceConnectionName, IList modelObjectParameters, string propertyName) + { + string result; + List 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 ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList 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 ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList 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 threadExceptions) + { + if (!(thread is null)) + { + ThreadState threadState; + for (short i = 0; i < short.MaxValue; i++) + { + if (thread is null) + break; + else + { + threadState = thread.ThreadState; + if (threadState != ThreadState.Running && threadState != 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 progressPath, Logistics logistics, int? duplicator, string[] exceptionLines) + { + string progressDirectory; + StringBuilder stringBuilder = new(); + if (duplicator is null || duplicator.Value == 0) + progressDirectory = string.Concat(progressPath, @"\EquipmentIntegration"); + else + { + stringBuilder.Clear(); + for (int i = 0; i < duplicator.Value; i++) + { + if (i > 0 && (i % 2) == 0) + stringBuilder.Append(' '); + stringBuilder.Append('-'); + } + progressDirectory = string.Concat(progressPath, @"\", (duplicator.Value + 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 null)) + { + string fileName = string.Concat(progressDirectory, @"\readme.txt"); + try + { File.WriteAllLines(fileName, exceptionLines); } + catch (Exception) { } + } + } + + protected string[] Move(Tuple> extractResults, string to, string from, string resolvedFileLocation, Exception exception) + { + string[] results; + bool isErrorFile = !(exception is null); + if (!to.EndsWith(@"\")) + string.Concat(to, @"\"); + if (!isErrorFile) + results = new 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 null) && !(extractResults.Item4 is null) && extractResults.Item4.Any()) + { + string itemFile; + List 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 null)) + Shared1811(to, sourceFile); + } + Shared0231(directories); + } + return results; + } + + protected IEnumerable GetDirectoriesRecursively(string path, string directoryNameSegment = null) + { + Queue 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> 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 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 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> tuples) + { + bool check; + long preWait; + string tupleFile; + List consumedFileIndices = new(); + List 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 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(IFileRead fileRead, Tuple> extractResults, Exception exception) + { + bool isErrorFile = !(exception is null); + if (!isErrorFile && _IsDuplicator) + { + if (_Hyphens == _HyphenIsXToArchive) + Shared0192(); + else if (_IsEAFHosted && _Hyphens == _HyphenIsArchive) + fileRead.MoveArchive(); + if (_IsEAFHosted && !string.IsNullOrEmpty(_ProgressPath)) + CreateProgressDirectory(_ProgressPath, _Logistics, _Hyphens, exceptionLines: null); + } + if (!_IsEAFHosted) + { + string to; + if (!_FileConnectorConfiguration.TargetFileLocation.EndsWith(Path.DirectorySeparatorChar.ToString())) + to = _FileConnectorConfiguration.TargetFileLocation; + else + to = Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation); + foreach (KeyValuePair 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> extractResults, List headerNames, Dictionary keyValuePairs) + { + object value; + string description; + List 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(); + 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> ReExtract(IFileRead fileRead, List headerNames, Dictionary keyValuePairs) + { + Tuple> 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 Dictionary> GetKeyValuePairs(List descriptions) + { + Dictionary> 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()); + results[testKey].Add(descriptions[i]); + } + return results; + } + + protected List GetDuplicatorDescriptions(JsonElement[] jsonElements) + { + List 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(jsonElement.ToString(), jsonSerializerOptions); + results.Add(description); + } + return results; + } + + protected Tuple>> GetTuple(IFileRead fileRead, IEnumerable descriptions, bool extra = false) + { + Tuple>> result; + Dictionary> keyValuePairs = GetKeyValuePairs(descriptions.ToList()); + Test[] tests = (from l in keyValuePairs select l.Key).ToArray(); + fileRead.CheckTests(tests, extra); + result = new Tuple>>(tests, keyValuePairs); + return result; + } + + protected void Shared0449(string to, string[] exceptionLines) + { + if (_IsDuplicator) + CreateProgressDirectory(_ProgressPath, _Logistics, _Hyphens, exceptionLines); + 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 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 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> 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 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 void Shared0192() + { + if (!string.IsNullOrEmpty(_Logistics.ReportFullPath)) + { + FileInfo fileInfo = new(_Logistics.ReportFullPath); + if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) + File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime); + } + } + + protected string[] Shared1567(string reportFullPath, List> 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 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); + } + + } + +} + +// 2021-12-17 -> Shared - FileRead \ No newline at end of file diff --git a/Adaptation/Shared/Logistics.cs b/Adaptation/Shared/Logistics.cs new file mode 100644 index 0000000..fed85b3 --- /dev/null +++ b/Adaptation/Shared/Logistics.cs @@ -0,0 +1,223 @@ +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 Tags { get; set; } + public List Logistics1 { get; set; } + public List 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(); + Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + Logistics2 = new List(); + } + + 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(); + Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + Logistics2 = new List(); + } + + 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(); + Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + Logistics2 = new List(); + } + 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(); + Logistics2 = new List(); + 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() + { + return (Logistics)MemberwiseClone(); + } + + private string DefaultMesEntity(DateTime dateTime) + { + return string.Concat(dateTime.Ticks, "_MES_ENTITY"); + } + + internal string GetLotViaMostCommonMethod() + { + return MID.Substring(0, MID.Length - 2); + } + + internal string GetPocketNumberViaMostCommonMethod() + { + return 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(); + Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + Logistics2 = new List(); + } + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Logistics2.cs b/Adaptation/Shared/Logistics2.cs new file mode 100644 index 0000000..eaab290 --- /dev/null +++ b/Adaptation/Shared/Logistics2.cs @@ -0,0 +1,81 @@ +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]; + } + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Methods/IDescription.cs b/Adaptation/Shared/Methods/IDescription.cs new file mode 100644 index 0000000..1891e5a --- /dev/null +++ b/Adaptation/Shared/Methods/IDescription.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.Text.Json; + +namespace Adaptation.Shared.Methods +{ + + public interface IDescription + { + + string GetEventDescription(); + List GetDetailNames(); + List GetHeaderNames(); + IDescription GetDisplayNames(); + List GetParameterNames(); + List GetPairedParameterNames(); + List GetIgnoreParameterNames(Test test); + List GetNames(IFileRead fileRead, Logistics logistics); + JsonProperty[] GetDefault(IFileRead fileRead, Logistics logistics); + Dictionary GetDisplayNamesJsonElement(IFileRead fileRead); + IDescription GetDefaultDescription(IFileRead fileRead, Logistics logistics); + List GetDescriptions(IFileRead fileRead, Logistics logistics, List tests, IProcessData iProcessData); + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Methods/IFileRead.cs b/Adaptation/Shared/Methods/IFileRead.cs new file mode 100644 index 0000000..3ff5940 --- /dev/null +++ b/Adaptation/Shared/Methods/IFileRead.cs @@ -0,0 +1,25 @@ +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 GetHeaderNames(); + void CheckTests(Test[] tests, bool extra); + Dictionary GetDisplayNamesJsonElement(); + Tuple> ReExtract(); + List GetDescriptions(IFileRead fileRead, List tests, IProcessData processData); + void Move(Tuple> extractResults, Exception exception = null); + Tuple> GetExtractResult(string reportFullPath, string eventName); + string[] Move(Tuple> extractResults, string to, string from, string resolvedFileLocation, Exception exception); + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Methods/ILogistics.cs b/Adaptation/Shared/Methods/ILogistics.cs new file mode 100644 index 0000000..73fd452 --- /dev/null +++ b/Adaptation/Shared/Methods/ILogistics.cs @@ -0,0 +1,8 @@ +namespace Adaptation.Shared.Methods +{ + + public interface ILogistics : Properties.ILogistics + { + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Methods/ILogistics2.cs b/Adaptation/Shared/Methods/ILogistics2.cs new file mode 100644 index 0000000..ee89538 --- /dev/null +++ b/Adaptation/Shared/Methods/ILogistics2.cs @@ -0,0 +1,8 @@ +namespace Adaptation.Shared.Methods +{ + + public interface ILogistics2 : Properties.ILogistics2 + { + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Methods/IProcessData.cs b/Adaptation/Shared/Methods/IProcessData.cs new file mode 100644 index 0000000..26c69fe --- /dev/null +++ b/Adaptation/Shared/Methods/IProcessData.cs @@ -0,0 +1,17 @@ +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 reactors); + Tuple> GetResults(IFileRead fileRead, Logistics logistics, List fileInfoCollection); + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Methods/ISMTP.cs b/Adaptation/Shared/Methods/ISMTP.cs new file mode 100644 index 0000000..7792d7c --- /dev/null +++ b/Adaptation/Shared/Methods/ISMTP.cs @@ -0,0 +1,9 @@ +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); + } +} \ No newline at end of file diff --git a/Adaptation/Shared/ParameterType.cs b/Adaptation/Shared/ParameterType.cs new file mode 100644 index 0000000..43e548f --- /dev/null +++ b/Adaptation/Shared/ParameterType.cs @@ -0,0 +1,13 @@ +namespace Adaptation.Shared +{ + + public enum ParameterType + { + String = 0, + Integer = 2, + Double = 3, + Boolean = 4, + StructuredType = 5 + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/ProcessDataStandardFormat.cs b/Adaptation/Shared/ProcessDataStandardFormat.cs new file mode 100644 index 0000000..b33fa81 --- /dev/null +++ b/Adaptation/Shared/ProcessDataStandardFormat.cs @@ -0,0 +1,426 @@ +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 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 GetLogisticsColumnsAndBody(string reportFullPath, string[] lines = null) + { + string segment; + List body = new(); + StringBuilder logistics = new(); + if (lines is null) + lines = File.ReadAllLines(reportFullPath); + string[] segments; + if (lines.Length < 7) + segments = new string[] { }; + else + segments = lines[6].Trim().Split('\t'); + List 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.Count(); 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.Count(); i++) + { + if (lines[r].StartsWith("END_HEADER")) + break; + logistics.AppendLine(lines[i]); + } + break; + } + } + return new Tuple(logistics.ToString(), columns.ToArray(), body.ToArray()); + } + + public static JsonElement[] GetArray(Tuple 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("[]"); + 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(string.Concat("[", stringBuilder, "]")); + } + return results; + } + + public static Dictionary> GetDictionary(Tuple pdsf) + { + Dictionary> results = new(); + string[] segments; + string[] columns = pdsf.Item2; + string[] bodyLines = pdsf.Item3; + foreach (string column in columns) + results.Add(column, new List()); + 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>>> GetTestDictionary(Tuple pdsf) + { + Dictionary>> results = new(); + string testColumn = nameof(Test); + Dictionary> keyValuePairs = GetDictionary(pdsf); + if (!keyValuePairs.ContainsKey(testColumn)) + throw new Exception(); + int min; + int max; + Test testKey; + List vs; + string columnKey; + Dictionary> 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()); + results.Add(test, new Dictionary>()); + } + tests[test].Add(i); + } + } + foreach (KeyValuePair> testKeyValuePair in tests) + { + testKey = testKeyValuePair.Key; + min = testKeyValuePair.Value.Min(); + max = testKeyValuePair.Value.Max() + 1; + foreach (KeyValuePair> keyValuePair in keyValuePairs) + results[testKey].Add(keyValuePair.Key, new List()); + foreach (KeyValuePair> 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>>>(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 = ' ') + { + return GetString(SearchFor.EquipmentIntegration, addSpaces, separator); + } + + public static string BusinessIntegration(bool addSpaces = true, char separator = ' ') + { + return GetString(SearchFor.BusinessIntegration, addSpaces, separator); + } + + public static string SystemExport(bool addSpaces = true, char separator = ' ') + { + return GetString(SearchFor.SystemExport, addSpaces, separator); + } + + public static string Archive(bool addSpaces = true, char separator = ' ') + { + return GetString(SearchFor.Archive, addSpaces, separator); + } + + public static string GetLines(Logistics logistics, Properties.IScopeInfo scopeInfo, List names, Dictionary> keyValuePairs, string dateFormat, string timeFormat, List pairedParameterNames, bool useDateTimeFromSequence = true, string format = "", List ignoreParameterNames = null) + { + StringBuilder result = new(); + if (ignoreParameterNames is null) + ignoreParameterNames = new List(); + 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> 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 PDSFToFixedWidth(string reportFullPath) + { + List 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 vs = new(); + List 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; + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Properties/IDescription.cs b/Adaptation/Shared/Properties/IDescription.cs new file mode 100644 index 0000000..c45a6d1 --- /dev/null +++ b/Adaptation/Shared/Properties/IDescription.cs @@ -0,0 +1,13 @@ +namespace Adaptation.Shared.Properties +{ + + public interface IDescription + { + + int Test { get; } + int Count { get; } + int Index { get; } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Properties/IFileRead.cs b/Adaptation/Shared/Properties/IFileRead.cs new file mode 100644 index 0000000..5f30585 --- /dev/null +++ b/Adaptation/Shared/Properties/IFileRead.cs @@ -0,0 +1,20 @@ +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; } + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Properties/ILogistics.cs b/Adaptation/Shared/Properties/ILogistics.cs new file mode 100644 index 0000000..9be989c --- /dev/null +++ b/Adaptation/Shared/Properties/ILogistics.cs @@ -0,0 +1,25 @@ +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 Tags { get; set; } + public List Logistics1 { get; set; } + public List Logistics2 { get; set; } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Properties/ILogistics2.cs b/Adaptation/Shared/Properties/ILogistics2.cs new file mode 100644 index 0000000..d20d326 --- /dev/null +++ b/Adaptation/Shared/Properties/ILogistics2.cs @@ -0,0 +1,17 @@ +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; } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Properties/IProcessData.cs b/Adaptation/Shared/Properties/IProcessData.cs new file mode 100644 index 0000000..29f83af --- /dev/null +++ b/Adaptation/Shared/Properties/IProcessData.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace Adaptation.Shared.Properties +{ + + public interface IProcessData + { + + List Details { get; } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Properties/IScopeInfo.cs b/Adaptation/Shared/Properties/IScopeInfo.cs new file mode 100644 index 0000000..d3e59f6 --- /dev/null +++ b/Adaptation/Shared/Properties/IScopeInfo.cs @@ -0,0 +1,20 @@ +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; } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Test.cs b/Adaptation/Shared/Test.cs new file mode 100644 index 0000000..c833c82 --- /dev/null +++ b/Adaptation/Shared/Test.cs @@ -0,0 +1,57 @@ +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, + Hall = 10, + HgCV = 23, + Lehighton = 13, + Microscope = 46, + MonthlyCV = 4, + MonthlyHall = 11, + MonthlyXRD = 32, + Photoreflectance = 22, + PlatoA = 48, //Largest + 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, + JVXRD = 47, + XRDXY = 30 + } + +} \ No newline at end of file diff --git a/Adaptation/package.json b/Adaptation/package.json new file mode 100644 index 0000000..8247f48 --- /dev/null +++ b/Adaptation/package.json @@ -0,0 +1,8 @@ +{ + "scripts": { + "build": "dotnet build --runtime win-x64 --self-contained", + "dotnet-format": "dotnet format --report .vscode --verbosity detailed --severity error", + "pull": "git pull", + "garbage-collect": "git gc" + } +} \ No newline at end of file diff --git a/FileHandlers/FileRead.cs b/FileHandlers/FileRead.cs new file mode 100644 index 0000000..af17724 --- /dev/null +++ b/FileHandlers/FileRead.cs @@ -0,0 +1,356 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.FileHandlers; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Methods; +using Eaf.Core; +using Eaf.Core.Smtp; +using Eaf.EquipmentCore.DataCollection.Reporting; +using Eaf.EquipmentCore.SelfDescription.ElementDescription; +using Eaf.EquipmentCore.SelfDescription.EquipmentStructure; +using Eaf.EquipmentCore.SelfDescription.ParameterTypes; +using Ifx.Eaf.EquipmentConnector.File.Component.Reader; +using Ifx.Eaf.EquipmentConnector.File.SelfDescription; +using log4net; +using Shared; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; + +namespace MET08RESIHGCV.FileHandlers +{ + + public partial class FileRead : FileReaderHandler, ISMTP + { + + private readonly ILog _Log; + private IFileRead _FileRead; + private EquipmentEvent _EquipmentEvent; + private readonly bool _UseCyclicalForDescription; + private FilePathGenerator _FilePathGeneratorForError; + private FilePathGenerator _FilePathGeneratorForTarget; + private readonly List _EquipmentParameters; + private static readonly Dictionary> _DummyRuns; + + static FileRead() + { + _DummyRuns = new Dictionary>(); + } + + public FileRead() + { + if (FileParameter is null) + FileParameter = new Dictionary(); + _FileRead = null; + _UseCyclicalForDescription = false; + _Log = LogManager.GetLogger(typeof(FileRead)); + _EquipmentParameters = new List(); + } + + public override void CreateSelfDescription() + { + MethodBase methodBase = new StackFrame().GetMethod(); + _Log.Debug(string.Concat(methodBase.Name, " - Entry")); + try + { + if (Equipment is null) + throw new Exception(); + CreateSelfDescription(methodBase); + _Log.Debug(string.Concat(methodBase.Name, " - Try - Exit")); + } + catch (Exception ex) + { + _Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace)); + long breakAfter = DateTime.Now.AddSeconds(30).Ticks; + for (short i = 0; i < short.MaxValue; i++) + { + if (DateTime.Now.Ticks > breakAfter) + break; + Thread.Sleep(500); + } + throw; + } + } + + public override bool Extract(string reportFullPath, string eventName) + { + MethodBase methodBase = new StackFrame().GetMethod(); + _Log.Debug(string.Concat(methodBase.Name, " - Entry - {", reportFullPath, "}")); + Tuple> extractResults = null; + try + { + extractResults = _FileRead.GetExtractResult(reportFullPath, eventName); + TriggerEvents(extractResults); + _FileRead.Move(extractResults); + FilePathGeneratorInfoMove(extractResults); + _FileRead.WaitForThread(); + _Log.Debug(string.Concat(methodBase.Name, " - Try - Exit")); + return true; + } + catch (Exception ex) + { + _Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace)); + _FileRead.Move(extractResults, exception: ex); + FilePathGeneratorInfoMove(extractResults, exception: ex); + return false; + } + } + + private void Send(EmailMessage emailMessage) + { + ISmtp smtp = Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); + if (!(smtp is null)) + smtp.Send(emailMessage); + } + + void ISMTP.SendLowPriorityEmailMessage(string subject, string body) + { + EmailMessage emailMessage = new(subject, body, MailPriority.Low); + Send(emailMessage); + } + + void ISMTP.SendHighPriorityEmailMessage(string subject, string body) + { + EmailMessage emailMessage = new(subject, body, MailPriority.High); + Send(emailMessage); + } + + void ISMTP.SendNormalPriorityEmailMessage(string subject, string body) + { + EmailMessage emailMessage = new(subject, body, MailPriority.Normal); + Send(emailMessage); + } + + private void AddParameterRangeAndEvent() + { + string description; + bool allowNull = false; + EquipmentParameter equipmentParameter; + JsonProperty[] jsonProperties = _FileRead.GetDefault(); + Dictionary keyValuePairs = _FileRead.GetDisplayNamesJsonElement(); + Dictionary parameterTypeDefinitions = new(); + FileConnectorParameterTypeDefinitionProvider fileConnectorParameterTypeDefinitionProvider = new(); + foreach (ParameterTypeDefinition parameterTypeDefinition in fileConnectorParameterTypeDefinitionProvider.GetAllParameterTypeDefinition()) + { + switch (parameterTypeDefinition.Name) + { + case nameof(String): + parameterTypeDefinitions.Add(JsonValueKind.String, parameterTypeDefinition); + break; + case nameof(Double): + parameterTypeDefinitions.Add(JsonValueKind.Number, parameterTypeDefinition); + break; + case nameof(Boolean): + parameterTypeDefinitions.Add(JsonValueKind.True, parameterTypeDefinition); + parameterTypeDefinitions.Add(JsonValueKind.False, parameterTypeDefinition); + break; + default: + break; + } + } + foreach (JsonProperty jsonProperty in jsonProperties) + { + if (jsonProperty.Value.ValueKind == JsonValueKind.Object && !parameterTypeDefinitions.ContainsKey(JsonValueKind.Object)) + { + StructuredType structuredType = new(nameof(StructuredType), string.Empty, new List()); + parameterTypeDefinitions.Add(JsonValueKind.Object, structuredType); + Equipment.SelfDescriptionBuilder.AddParameterTypeDefinition(structuredType); + } + if (!parameterTypeDefinitions.ContainsKey(jsonProperty.Value.ValueKind)) + throw new Exception(string.Concat('{', jsonProperty.Value.ValueKind, "} is not mapped!")); + } + foreach (JsonProperty jsonProperty in jsonProperties) + { + if (jsonProperty.Value.ValueKind == JsonValueKind.Null && !allowNull) + throw new Exception(); + if (jsonProperty.Value.ValueKind != JsonValueKind.String || !keyValuePairs.ContainsKey(jsonProperty.Name)) + description = string.Empty; + else + description = keyValuePairs[jsonProperty.Name].Split('|')[0]; + equipmentParameter = new EquipmentParameter(jsonProperty.Name, parameterTypeDefinitions[jsonProperty.Value.ValueKind], description); + _EquipmentParameters.Add(equipmentParameter); + } + Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.AddParameterRange(_EquipmentParameters); + _EquipmentEvent = new EquipmentEvent(_FileRead.EventName, _FileRead.GetEventDescription(), _EquipmentParameters); + Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.AddEvent(_EquipmentEvent); + } + + private void CreateSelfDescription(MethodBase methodBase) + { + string cellInstanceName; + string equipmentTypeName = string.Empty; + string equipmentDictionaryName = string.Empty; + EquipmentElement equipmentElement = Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.Item; + if (Backbone.Instance?.CellName is null) + cellInstanceName = string.Empty; + else + cellInstanceName = Backbone.Instance.CellName; + string cellInstanceConnectionName = equipmentElement.Name; + FileConnectorConfiguration fileConnectorConfiguration = Mapper.Map(Configuration); + string parameterizedModelObjectDefinitionType = methodBase.DeclaringType.FullName; + IList modelObjectParameters = Mapper.Map(ConfiguredParameters); + _FileRead = CellInstanceConnectionName.Get(this, FileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, _DummyRuns, _UseCyclicalForDescription, isEAFHosted: true); + if (_FileRead.IsEvent) + AddParameterRangeAndEvent(); + } + + private object GetFilePathGeneratorInfo(string reportFullPath, bool isErrorFile) + { + FilePathGeneratorInfo result; + FilePathGenerator filePathGeneratorOriginal; + if (Configuration is null) + result = null; + else + { + if (isErrorFile) + { + if (_FilePathGeneratorForError is null) + _FilePathGeneratorForError = new FilePathGenerator(Configuration, reportFullPath, isErrorFile: true); + filePathGeneratorOriginal = _FilePathGeneratorForError; + } + else + { + if (_FilePathGeneratorForTarget is null) + _FilePathGeneratorForTarget = new FilePathGenerator(Configuration, reportFullPath, isErrorFile: false); + filePathGeneratorOriginal = _FilePathGeneratorForTarget; + } + result = new FilePathGeneratorInfo(filePathGeneratorOriginal, reportFullPath, isErrorFile, FileParameter); + } + return result; + } + + private void FilePathGeneratorInfoMove(Tuple> extractResults, Exception exception = null) + { + bool isErrorFile = !(exception is null); + object filePathGeneratorInfo = GetFilePathGeneratorInfo(_FileRead.ReportFullPath, isErrorFile); + if (!(filePathGeneratorInfo is null) && filePathGeneratorInfo is FilePathGeneratorInfo filePathGenerator) + { + string[] exceptionLines = _FileRead.Move(extractResults, filePathGenerator.To, filePathGenerator.From, filePathGenerator.ResolvedFileLocation, exception); + if (isErrorFile) + { + try + { + StringBuilder stringBuilder = new(); + foreach (string item in exceptionLines) + stringBuilder.Append("<").Append(item).AppendLine(">"); + ISmtp smtp = Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); + EmailMessage emailMessage = new(_FileRead.ExceptionSubject, stringBuilder.ToString(), MailPriority.High); + smtp.Send(emailMessage); + } + catch (Exception) { } + } + } + } + + private List GetParameterValues(List headerNames, JsonElement[] jsonElements, int i) + { + List results = new(); + if (_UseCyclicalForDescription && i > 0) + throw new Exception(); + object value; + List list; + JsonProperty[] jsonProperties = jsonElements[i].EnumerateObject().ToArray(); + if (jsonProperties.Length != _EquipmentParameters.Count) + throw new Exception(); + for (int p = 0; p < jsonProperties.Length; p++) + { + if (!_UseCyclicalForDescription || headerNames.Contains(jsonProperties[p].Name)) + value = jsonProperties[p].Value.ToString(); + else + { + list = new List(); + for (int z = 0; z < jsonElements.Length; z++) + list.Add(new object[] { z, jsonElements[z].GetProperty(jsonProperties[p].Name).ToString() }); + value = list; + } + results.Add(new ParameterValue(_EquipmentParameters[p], value, DateTime.Now)); + } + return results; + } + + private void TriggerEvents(Tuple> extractResults) + { + List headerNames; + List parameters; + if (!_UseCyclicalForDescription) + headerNames = null; + else + headerNames = _FileRead.GetHeaderNames(); + for (int i = 0; i < extractResults.Item3.Length; i++) + { + if (_EquipmentEvent is not null) + { + _Log.Debug(string.Concat("TriggerEvent - {", _FileRead.ReportFullPath, "} ", i, " of ", extractResults.Item3.Length)); + parameters = GetParameterValues(headerNames, extractResults.Item3, i); + if (!(_EquipmentEvent is null)) + Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); + if (_UseCyclicalForDescription) + break; + } + } + } + + public Tuple> ReExtract(string json) + { + Tuple> results; + string cellInstanceName; + if (!json.Contains(nameof(cellInstanceName))) + throw new Exception(); + string equipmentTypeName; + if (!json.Contains(nameof(equipmentTypeName))) + throw new Exception(); + string equipmentDictionaryName; + if (!json.Contains(nameof(equipmentDictionaryName))) + throw new Exception(); + string cellInstanceConnectionName; + if (!json.Contains(nameof(cellInstanceConnectionName))) + throw new Exception(); + if (!json.Contains(nameof(FileConnectorConfiguration))) + throw new Exception(); + if (!json.Contains(nameof(IList))) + throw new Exception(); + string parameterizedModelObjectDefinitionType; + if (!json.Contains(nameof(parameterizedModelObjectDefinitionType))) + throw new Exception(); + Dictionary> dummyRuns = new(); + Dictionary fileParameter = new(); + MethodBase methodBase = new StackFrame().GetMethod(); + JsonElement jsonElement = JsonSerializer.Deserialize(json); + cellInstanceName = jsonElement.GetProperty(nameof(cellInstanceName)).ToString(); + equipmentTypeName = jsonElement.GetProperty(nameof(equipmentTypeName)).ToString(); + equipmentDictionaryName = jsonElement.GetProperty(nameof(equipmentDictionaryName)).ToString(); + cellInstanceConnectionName = jsonElement.GetProperty(nameof(cellInstanceConnectionName)).ToString(); + JsonElement fileConnectorConfigurationJsonElement = jsonElement.GetProperty(nameof(FileConnectorConfiguration)); + parameterizedModelObjectDefinitionType = jsonElement.GetProperty(nameof(parameterizedModelObjectDefinitionType)).ToString(); + if (fileConnectorConfigurationJsonElement.ValueKind != JsonValueKind.Object) + throw new Exception(); + JsonSerializerOptions jsonSerializerOptions = new() { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } }; + FileConnectorConfiguration fileConnectorConfiguration = JsonSerializer.Deserialize(fileConnectorConfigurationJsonElement.ToString(), jsonSerializerOptions); + JsonElement modelObjectParameterDefinitionJsonElement = jsonElement.GetProperty(nameof(IList)); + if (modelObjectParameterDefinitionJsonElement.ValueKind != JsonValueKind.Array) + throw new Exception(); + IList modelObjectParameters = JsonSerializer.Deserialize>(modelObjectParameterDefinitionJsonElement.ToString(), jsonSerializerOptions); + _FileRead = CellInstanceConnectionName.Get(this, FileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, _DummyRuns, _UseCyclicalForDescription, isEAFHosted: false); + results = _FileRead.ReExtract(); + if (results?.Item2 is null) + throw new Exception(); + else + { + TriggerEvents(results); + _FileRead.Move(results); + FilePathGeneratorInfoMove(results); + } + return results; + } + + } + +} +// 2021-12-16 -> FileRead \ No newline at end of file diff --git a/MET08RESIHGCV.csproj b/MET08RESIHGCV.csproj new file mode 100644 index 0000000..71b10a2 --- /dev/null +++ b/MET08RESIHGCV.csproj @@ -0,0 +1,154 @@ + + + + + Debug + AnyCPU + {C8613A7C-78C4-4FE1-B86C-09F80DCCBA6F} + 9.0 + Library + Properties + MET08RESIHGCV + MET08RESIHGCV + v4.7.2 + 512 + SAK + SAK + SAK + SAK + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + x86 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\None\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 7.2.4630.5 + + + 2.36.0 + + + 1.1.1 + + + 5.0.1 + + + + + \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..addcbf4 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MET08RESIHGCV")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MET08RESIHGCV")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c8613a7c-78c4-4fe1-b86c-09f80dccba6f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("2.36.0.0")] +[assembly: AssemblyFileVersion("2.36.0.0")] diff --git a/README.md b/README.md index 0ca446a..a35b228 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ # Introduction -TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project. +MET08RESIHGCV EAF adaptation # Getting Started -TODO: Guide users through getting your code up and running on their own system. In this section you can talk about: -1. Installation process -2. Software dependencies -3. Latest releases -4. API references +1. Framework - MET08RESIHGCV.csproj +2. dotnet core - Adaptation\MET08RESIHGCV.Tests.csproj +3. https://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json +4. https://packagemanagement.eu.infineon.com:4430/packages # Build and Test -TODO: Describe and show how to build your code and run the tests. +See Adaptation\_Tests for dotnet core tests -# Contribute -TODO: Explain how other users and developers can contribute to make your code better. +# TFS +$/MIT_EAF_Adaptations/Trunk/MET08RESIHGCV/06_SourceCode -If you want to learn more about creating good readme files then refer the following [guidelines](https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops). You can also seek inspiration from the below readme files: -- [ASP.NET Core](https://github.com/aspnet/Home) -- [Visual Studio Code](https://github.com/Microsoft/vscode) -- [Chakra Core](https://github.com/Microsoft/ChakraCore) \ No newline at end of file +# Last TFS Changeset +303347 Phares Mike (IFAM IT FI MES) 2/1/2022 5:57:12 PM MET08RESIHGCV - Move solution for Azure DevOps git + +# Git +git@tfs.intra.infineon.com:22/tfs/ManufacturingIT/Mesa_FI/_git/MET08RESIHGCV diff --git a/Shared/FilePathGenerator.cs b/Shared/FilePathGenerator.cs new file mode 100644 index 0000000..c8d1fcd --- /dev/null +++ b/Shared/FilePathGenerator.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using Ifx.Eaf.EquipmentConnector.File.Component; +using Ifx.Eaf.EquipmentConnector.File.Configuration; + +namespace Shared +{ + + public class FilePathGenerator : Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator + { + + public FileConnectorConfiguration FileConnectorConfiguration { get; private set; } + + public FilePathGenerator(FileConnectorConfiguration config, Dictionary customPattern = null) : base(config, customPattern) + { + FileConnectorConfiguration = config; + } + + public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary customPattern = null) : base(config, file, isErrorFile, customPattern) + { + FileConnectorConfiguration = config; + } + + public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary customPattern = null) : base(config, sourceFilePath, isErrorFile, customPattern) + { + FileConnectorConfiguration = config; + } + + public string GetSubFolderPath() + { + return SubFolderPath; + } + + } + +} diff --git a/Shared/FilePathGeneratorInfo.cs b/Shared/FilePathGeneratorInfo.cs new file mode 100644 index 0000000..827a893 --- /dev/null +++ b/Shared/FilePathGeneratorInfo.cs @@ -0,0 +1,66 @@ +using System.IO; + +namespace Shared +{ + + public class FilePathGeneratorInfo + { + + public string To { get; protected set; } + public string From { get; protected set; } + public bool IsErrorFile { get; protected set; } + public string SubFolderPath { get; protected set; } + public string FirstDirectory { get; protected set; } + public string ReportFullPath { get; protected set; } + public string ResolvedFileLocation { get; protected set; } + + public FilePathGeneratorInfo(object originalFilePathGenerator, string reportFullPath, bool isErrorFile, System.Collections.Generic.Dictionary fileParameter) + { + ReportFullPath = reportFullPath; + IsErrorFile = isErrorFile; + if (originalFilePathGenerator is null || originalFilePathGenerator is not FilePathGenerator original) + { + FirstDirectory = string.Empty; + ResolvedFileLocation = string.Empty; + To = string.Empty; + From = string.Empty; + } + else + { + string directorySeparatorChar = Path.DirectorySeparatorChar.ToString(); + FilePathGenerator filePathGenerator = new(original.FileConnectorConfiguration, reportFullPath, isErrorFile); + SubFolderPath = filePathGenerator.GetSubFolderPath(); + if (string.IsNullOrEmpty(SubFolderPath)) + FirstDirectory = SubFolderPath; + else + FirstDirectory = SubFolderPath.Split(Path.DirectorySeparatorChar)[0]; + ResolvedFileLocation = filePathGenerator.GetTargetFolder(); + if (string.IsNullOrEmpty(ResolvedFileLocation) && string.IsNullOrEmpty(SubFolderPath)) + To = string.Empty; + else if (string.IsNullOrEmpty(SubFolderPath)) + To = ResolvedFileLocation; + else + To = string.Concat(ResolvedFileLocation.Replace(SubFolderPath, string.Empty), Path.DirectorySeparatorChar, FirstDirectory); +#if (true) + if (string.IsNullOrEmpty(original.FileConnectorConfiguration.DefaultPlaceHolderValue)) + original.FileConnectorConfiguration.DefaultPlaceHolderValue = "NA"; + if (!(fileParameter is null) && fileParameter.Count == 1 && To.Contains(original.FileConnectorConfiguration.DefaultPlaceHolderValue)) + { + foreach (System.Collections.Generic.KeyValuePair keyValuePair in fileParameter) + To = To.Replace(string.Concat(original.FileConnectorConfiguration.DefaultPlaceHolderValue), keyValuePair.Value); + } +#endif + if (original.FileConnectorConfiguration.SourceFileLocation.EndsWith(directorySeparatorChar)) + From = string.Concat(original.FileConnectorConfiguration.SourceFileLocation, FirstDirectory); + else + From = string.Concat(original.FileConnectorConfiguration.SourceFileLocation, Path.DirectorySeparatorChar, FirstDirectory); + if (From.EndsWith(directorySeparatorChar) && !To.EndsWith(directorySeparatorChar)) + To = string.Concat(To, Path.DirectorySeparatorChar); + else if (To.EndsWith(directorySeparatorChar) && !From.EndsWith(directorySeparatorChar)) + To = To.Remove(To.Length - 1, 1); + } + } + + } + +}