Match TFS Changeset 303362
This commit is contained in:
parent
306279760c
commit
053c873d6b
336
.editorconfig
Normal file
336
.editorconfig
Normal file
@ -0,0 +1,336 @@
|
||||
# Remove the line below if you want to inherit .editorconfig settings from higher directories
|
||||
root = true
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
#### Core EditorConfig Options ####
|
||||
|
||||
# Indentation and spacing
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
tab_width = 4
|
||||
|
||||
# New line preferences
|
||||
end_of_line = crlf
|
||||
insert_final_newline = false
|
||||
|
||||
#### .NET Coding Conventions ####
|
||||
|
||||
# Organize usings
|
||||
dotnet_separate_import_directive_groups = false
|
||||
dotnet_sort_system_directives_first = false
|
||||
file_header_template = unset
|
||||
|
||||
# this. and Me. preferences
|
||||
dotnet_style_qualification_for_event = false:error
|
||||
dotnet_style_qualification_for_field = false
|
||||
dotnet_style_qualification_for_method = false:error
|
||||
dotnet_style_qualification_for_property = false:error
|
||||
|
||||
# Language keywords vs BCL types preferences
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true
|
||||
dotnet_style_predefined_type_for_member_access = true
|
||||
|
||||
# Parentheses preferences
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
|
||||
|
||||
# Modifier preferences
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members
|
||||
|
||||
# Expression-level preferences
|
||||
dotnet_style_coalesce_expression = true
|
||||
dotnet_style_collection_initializer = true:warning
|
||||
dotnet_style_explicit_tuple_names = true:warning
|
||||
dotnet_style_namespace_match_folder = true
|
||||
dotnet_style_null_propagation = true:warning
|
||||
dotnet_style_object_initializer = true:warning
|
||||
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||
dotnet_style_prefer_auto_properties = true:warning
|
||||
dotnet_style_prefer_compound_assignment = true:warning
|
||||
dotnet_style_prefer_conditional_expression_over_assignment = false
|
||||
dotnet_style_prefer_conditional_expression_over_return = false
|
||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
|
||||
dotnet_style_prefer_inferred_tuple_names = true:warning
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true:warning
|
||||
dotnet_style_prefer_simplified_interpolation = true
|
||||
|
||||
# Field preferences
|
||||
dotnet_style_readonly_field = true:warning
|
||||
|
||||
# Parameter preferences
|
||||
dotnet_code_quality_unused_parameters = all
|
||||
|
||||
# Suppression preferences
|
||||
dotnet_remove_unnecessary_suppression_exclusions = 0
|
||||
|
||||
# New line preferences
|
||||
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
|
||||
dotnet_style_allow_statement_immediately_after_block_experimental = true
|
||||
|
||||
#### C# Coding Conventions ####
|
||||
|
||||
# var preferences
|
||||
csharp_style_var_elsewhere = false:warning
|
||||
csharp_style_var_for_built_in_types = false:warning
|
||||
csharp_style_var_when_type_is_apparent = false:warning
|
||||
|
||||
# Expression-bodied members
|
||||
csharp_style_expression_bodied_accessors = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_constructors = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_indexers = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_local_functions = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_methods = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_operators = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_properties = when_on_single_line:warning
|
||||
|
||||
# Pattern matching preferences
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:warning
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
|
||||
csharp_style_prefer_not_pattern = true:warning
|
||||
csharp_style_prefer_pattern_matching = true:warning
|
||||
csharp_style_prefer_switch_expression = true:warning
|
||||
|
||||
# Null-checking preferences
|
||||
csharp_style_conditional_delegate_call = true
|
||||
|
||||
# Modifier preferences
|
||||
csharp_prefer_static_local_function = true:warning
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
|
||||
|
||||
# Code-block preferences
|
||||
csharp_prefer_braces = false
|
||||
csharp_prefer_simple_using_statement = true:warning
|
||||
csharp_style_namespace_declarations = file_scoped:warning
|
||||
|
||||
# Expression-level preferences
|
||||
csharp_prefer_simple_default_expression = true:warning
|
||||
csharp_style_deconstructed_variable_declaration = false
|
||||
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
|
||||
csharp_style_inlined_variable_declaration = false
|
||||
csharp_style_pattern_local_over_anonymous_function = true:warning
|
||||
csharp_style_prefer_index_operator = false:warning
|
||||
csharp_style_prefer_null_check_over_type_check = true
|
||||
csharp_style_prefer_range_operator = false:warning
|
||||
csharp_style_throw_expression = true
|
||||
csharp_style_unused_value_assignment_preference = discard_variable:warning
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:warning
|
||||
|
||||
# 'using' directive preferences
|
||||
csharp_using_directive_placement = outside_namespace
|
||||
|
||||
# New line preferences
|
||||
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
|
||||
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
|
||||
csharp_style_allow_embedded_statements_on_same_line_experimental = true
|
||||
|
||||
#### C# Formatting Rules ####
|
||||
|
||||
# New line preferences
|
||||
csharp_new_line_before_catch = true
|
||||
csharp_new_line_before_else = true
|
||||
csharp_new_line_before_finally = true
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = true
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
|
||||
# Space preferences
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
# Wrapping preferences
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = false
|
||||
|
||||
#### Naming styles ####
|
||||
|
||||
# Naming rules
|
||||
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||
|
||||
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning
|
||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field
|
||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||
|
||||
dotnet_naming_rule.enum_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum
|
||||
dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning
|
||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field
|
||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||
|
||||
dotnet_naming_rule.class_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.class_should_be_pascal_case.symbols = class
|
||||
dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.method_should_be_pascal_case.symbols = method
|
||||
dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning
|
||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field
|
||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||
|
||||
dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field
|
||||
dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.property_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.property_should_be_pascal_case.symbols = property
|
||||
dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method
|
||||
dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method
|
||||
dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.event_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.event_should_be_pascal_case.symbols = event
|
||||
dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.delegate_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate
|
||||
dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.struct_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct
|
||||
dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||
|
||||
# Symbol specifications
|
||||
|
||||
dotnet_naming_symbols.class.applicable_kinds = class
|
||||
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.class.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interface.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.struct.applicable_kinds = struct
|
||||
dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.struct.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.enum.applicable_kinds = enum
|
||||
dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.enum.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.delegate.applicable_kinds = delegate
|
||||
dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.delegate.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.event.applicable_kinds = event
|
||||
dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.event.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.method.applicable_kinds = method
|
||||
dotnet_naming_symbols.method.applicable_accessibilities = public
|
||||
dotnet_naming_symbols.method.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_method.applicable_kinds = method
|
||||
dotnet_naming_symbols.private_method.applicable_accessibilities = private
|
||||
dotnet_naming_symbols.private_method.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.abstract_method.applicable_kinds = method
|
||||
dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.abstract_method.required_modifiers = abstract
|
||||
|
||||
dotnet_naming_symbols.static_method.applicable_kinds = method
|
||||
dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.static_method.required_modifiers = static
|
||||
|
||||
dotnet_naming_symbols.property.applicable_kinds = property
|
||||
dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.property.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
|
||||
dotnet_naming_symbols.public_or_protected_field.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.static_field.applicable_kinds = field
|
||||
dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.static_field.required_modifiers = static
|
||||
|
||||
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
|
||||
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected
|
||||
dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static
|
||||
|
||||
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
|
||||
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
|
||||
# Naming styles
|
||||
|
||||
dotnet_naming_style.pascal_case.required_prefix =
|
||||
dotnet_naming_style.pascal_case.required_suffix =
|
||||
dotnet_naming_style.pascal_case.word_separator =
|
||||
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||
dotnet_naming_style.begins_with_i.required_suffix =
|
||||
dotnet_naming_style.begins_with_i.word_separator =
|
||||
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.private_of_internal_field.required_prefix = _
|
||||
dotnet_naming_style.private_of_internal_field.required_suffix =
|
||||
dotnet_naming_style.private_of_internal_field.word_separator =
|
||||
dotnet_naming_style.private_of_internal_field.capitalization = pascal_case
|
9
.gitignore
vendored
9
.gitignore
vendored
@ -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
|
||||
|
10
EDA Viewer.Tests/.vscode/launch.json
vendored
Normal file
10
EDA Viewer.Tests/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach",
|
||||
"processId": 84612
|
||||
}
|
||||
]
|
||||
}
|
166
EDA Viewer.Tests/BackgroundTests.cs
Normal file
166
EDA Viewer.Tests/BackgroundTests.cs
Normal file
@ -0,0 +1,166 @@
|
||||
using EDAViewer.Models;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
namespace EDAViewer.Tests
|
||||
{
|
||||
|
||||
[TestClass]
|
||||
public class BackgroundTests : LoggingUnitTesting, IBackground
|
||||
{
|
||||
|
||||
private static AppSettings _AppSettings;
|
||||
private static string _WorkingDirectory;
|
||||
private static Singleton.IBackground _Background;
|
||||
private static BackgroundTests _LoggingUnitTesting;
|
||||
internal static BackgroundTests LoggingUnitTesting => _LoggingUnitTesting;
|
||||
|
||||
public BackgroundTests() : base(testContext: null, declaringType: null)
|
||||
{
|
||||
if (_LoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public BackgroundTests(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
if (_LoggingUnitTesting is null)
|
||||
_LoggingUnitTesting = new BackgroundTests(testContext);
|
||||
_LoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
_AppSettings = _LoggingUnitTesting.ConfigurationRoot.Get<AppSettings>();
|
||||
Assert.IsFalse(string.IsNullOrEmpty(_AppSettings.WorkingDirectoryName));
|
||||
_WorkingDirectory = Log.GetWorkingDirectory(assembly.GetName().Name, _AppSettings.WorkingDirectoryName);
|
||||
_Background = new Singleton.Background(_LoggingUnitTesting.IsEnvironment, _AppSettings, _WorkingDirectory);
|
||||
_Background.Update(_LoggingUnitTesting.Logger);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(_AppSettings.URLs));
|
||||
Assert.IsFalse(string.IsNullOrEmpty(_AppSettings.Server));
|
||||
Assert.IsFalse(string.IsNullOrEmpty(_AppSettings.MonARessource));
|
||||
Assert.IsNotNull(_Background);
|
||||
}
|
||||
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
if (!(_LoggingUnitTesting.Logger is null))
|
||||
_LoggingUnitTesting.Logger.LogInformation("Cleanup");
|
||||
if (!(_LoggingUnitTesting is null))
|
||||
_LoggingUnitTesting.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(IsEnvironment.Name.WindowsDevelopment))]
|
||||
public void EdaDataCollectionPlansCallback_WindowsDevelopment()
|
||||
{
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
_Logger.LogInformation($"Skipped - {methodBase.Name}");
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(IsEnvironment.Name.WindowsStaging))]
|
||||
public void EdaDataCollectionPlansCallback_WindowsStaging()
|
||||
{
|
||||
_Background.EdaDataCollectionPlansCallback();
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(IsEnvironment.Name.WindowsProduction))]
|
||||
public void EdaDataCollectionPlansCallback_WindowsProduction()
|
||||
{
|
||||
_Background.EdaDataCollectionPlansCallback();
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
public void EdaDataCollectionPlansCallback()
|
||||
{
|
||||
EdaDataCollectionPlansCallback_WindowsDevelopment();
|
||||
EdaDataCollectionPlansCallback_WindowsStaging();
|
||||
EdaDataCollectionPlansCallback_WindowsProduction();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(IsEnvironment.Name.WindowsDevelopment))]
|
||||
public void EDAOutputArchiveCallback_WindowsDevelopment()
|
||||
{
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
_Logger.LogInformation($"Skipped - {methodBase.Name}");
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(IsEnvironment.Name.WindowsStaging))]
|
||||
public void EDAOutputArchiveCallback_WindowsStaging()
|
||||
{
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
_Logger.LogInformation($"Skipped - {methodBase.Name}");
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(IsEnvironment.Name.WindowsProduction))]
|
||||
public void EDAOutputArchiveCallback_WindowsProduction()
|
||||
{
|
||||
_Background.EDAOutputArchiveCallback();
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
public void EDAOutputArchiveCallback()
|
||||
{
|
||||
EDAOutputArchiveCallback_WindowsDevelopment();
|
||||
EDAOutputArchiveCallback_WindowsStaging();
|
||||
EDAOutputArchiveCallback_WindowsProduction();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(IsEnvironment.Name.WindowsDevelopment))]
|
||||
public void LogPathCleanUpByWeekCallback_WindowsDevelopment()
|
||||
{
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
_Logger.LogInformation($"Skipped - {methodBase.Name}");
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(IsEnvironment.Name.WindowsStaging))]
|
||||
public void LogPathCleanUpByWeekCallback_WindowsStaging()
|
||||
{
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
_Logger.LogInformation($"Skipped - {methodBase.Name}");
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(IsEnvironment.Name.WindowsProduction))]
|
||||
public void LogPathCleanUpByWeekCallback_WindowsProduction()
|
||||
{
|
||||
_Background.LogPathCleanUpByWeekCallback();
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
void IBackground.LogPathCleanUpByWeekCallback()
|
||||
{
|
||||
LogPathCleanUpByWeekCallback_WindowsDevelopment();
|
||||
LogPathCleanUpByWeekCallback_WindowsStaging();
|
||||
LogPathCleanUpByWeekCallback_WindowsProduction();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// dotnet build --runtime win-x64
|
||||
// dotnet test --runtime win-x64 --no-build --filter LogPathCleanUpByWeekCallback_WindowsProduction --% -- TestRunParameters.Parameter(name=\"Debug\", value=\"Debugger.IsAttached\")
|
||||
// dotnet test --runtime win-x64 --no-build --filter "ClassName=EDAViewer.Tests.BackgroundTests & TestCategory=WindowsDevelopment" --% -- TestRunParameters.Parameter(name=\"Debug\", value=\"Debugger.IsAttached\")
|
||||
// dotnet test --runtime win-x64 --no-build --filter "ClassName=EDAViewer.Tests.BackgroundTests & TestCategory=WindowsStaging" --% -- TestRunParameters.Parameter(name=\"Debug\", value=\"Debugger.IsAttached\")
|
||||
// dotnet test --runtime win-x64 --no-build --filter "ClassName=EDAViewer.Tests.BackgroundTests & TestCategory=WindowsProduction" --% -- TestRunParameters.Parameter(name=\"Debug\", value=\"Debugger.IsAttached\")
|
51
EDA Viewer.Tests/EDA Viewer.Tests.csproj
Normal file
51
EDA Viewer.Tests/EDA Viewer.Tests.csproj
Normal file
@ -0,0 +1,51 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>EDAViewer.Tests</RootNamespace>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VSTestLogger>trx</VSTestLogger>
|
||||
<VSTestResultsDirectory>../../../Trunk/EDA Viewer/05_TestResults/TestResults</VSTestResultsDirectory>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
|
||||
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
|
||||
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsWindows)'=='true'">
|
||||
<DefineConstants>Windows</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsOSX)'=='true'">
|
||||
<DefineConstants>OSX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsLinux)'=='true'">
|
||||
<DefineConstants>Linux</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.0"/>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0"/>
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8"/>
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.8"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\EDA Viewer\appsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="..\EDA Viewer\appsettings.Staging.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="..\EDA Viewer\appsettings.Development.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../EDA Viewer/EDA Viewer.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
165
EDA Viewer.Tests/HomeControllerTests.cs
Normal file
165
EDA Viewer.Tests/HomeControllerTests.cs
Normal file
@ -0,0 +1,165 @@
|
||||
using EDAViewer.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
namespace EDAViewer.Tests
|
||||
{
|
||||
|
||||
[TestClass]
|
||||
public class HomeControllerTests : LoggingUnitTesting, IHomeController
|
||||
{
|
||||
|
||||
private static string _WorkingDirectory;
|
||||
private static AppSettings _AppSettings;
|
||||
private static Singleton.IBackground _Background;
|
||||
private static Controllers.HomeController _HomeController;
|
||||
private static HomeControllerTests _LoggingUnitTesting;
|
||||
internal static HomeControllerTests LoggingUnitTesting => _LoggingUnitTesting;
|
||||
|
||||
public HomeControllerTests() : base(testContext: null, declaringType: null)
|
||||
{
|
||||
if (_LoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public HomeControllerTests(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
if (_LoggingUnitTesting is null)
|
||||
_LoggingUnitTesting = new HomeControllerTests(testContext);
|
||||
_LoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
_AppSettings = _LoggingUnitTesting.ConfigurationRoot.Get<AppSettings>();
|
||||
Assert.IsFalse(string.IsNullOrEmpty(_AppSettings.WorkingDirectoryName));
|
||||
_WorkingDirectory = Log.GetWorkingDirectory(assembly.GetName().Name, _AppSettings.WorkingDirectoryName);
|
||||
_Background = new Singleton.Background(_LoggingUnitTesting.IsEnvironment, _AppSettings, _WorkingDirectory);
|
||||
_HomeController = new Controllers.HomeController(new NullLogger<Controllers.HomeController>(), _LoggingUnitTesting.IsEnvironment, _Background, _AppSettings);
|
||||
_Background.Update(_LoggingUnitTesting.Logger);
|
||||
Assert.IsNotNull(_Background);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(_AppSettings.URLs));
|
||||
Assert.IsFalse(string.IsNullOrEmpty(_AppSettings.Server));
|
||||
Assert.IsFalse(string.IsNullOrEmpty(_AppSettings.MonARessource));
|
||||
}
|
||||
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
if (!(_LoggingUnitTesting.Logger is null))
|
||||
_LoggingUnitTesting.Logger.LogInformation("Cleanup");
|
||||
if (!(_LoggingUnitTesting is null))
|
||||
_LoggingUnitTesting.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(ActionResult))]
|
||||
public void Background()
|
||||
{
|
||||
IActionResult IActionResult = _HomeController.Background();
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
public IActionResult Background(bool? message_clear, bool? exceptions_clear, bool? set_is_primary_instance, int? invoke_eda_dcp)
|
||||
{
|
||||
Background();
|
||||
return null;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(ActionResult))]
|
||||
public void Encode()
|
||||
{
|
||||
IActionResult IActionResult = _HomeController.Encode();
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
public IActionResult Encode(string value)
|
||||
{
|
||||
Encode();
|
||||
return null;
|
||||
}
|
||||
|
||||
public IActionResult Error()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(ActionResult))]
|
||||
public void Index()
|
||||
{
|
||||
IActionResult IActionResult = _HomeController.Index();
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
IActionResult IHomeController.Index()
|
||||
{
|
||||
Index();
|
||||
return null;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(ActionResult))]
|
||||
public void Privacy()
|
||||
{
|
||||
IActionResult IActionResult = _HomeController.Privacy();
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
IActionResult IHomeController.Privacy()
|
||||
{
|
||||
Privacy();
|
||||
return null;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(ActionResult))]
|
||||
public void ViewEdaHtmlDiff()
|
||||
{
|
||||
IActionResult IActionResult = _HomeController.ViewEdaHtmlDiff();
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
public IActionResult ViewEdaHtmlDiff(WithEnvironment withEnvironment)
|
||||
{
|
||||
ViewEdaHtmlDiff();
|
||||
return null;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(nameof(ActionResult))]
|
||||
public void GetDirectoriesOrFiles()
|
||||
{
|
||||
//ActionResult<IEnumerable<SelectListItem>> GetDirectoriesOrFiles(string path = null, bool? upDirectory = null, string filter = null)
|
||||
ActionResult<IEnumerable<SelectListItem>> actionResults = _HomeController.GetDirectoriesOrFiles();
|
||||
Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
public ActionResult<IEnumerable<SelectListItem>> GetDirectoriesOrFiles(string path, bool? upDirectory, string filter)
|
||||
{
|
||||
GetDirectoriesOrFiles();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// dotnet build --runtime win-x64
|
||||
// dotnet test --runtime win-x64 --no-build --filter GetDirectoriesOrFiles --% -- TestRunParameters.Parameter(name=\"Debug\", value=\"Debugger.IsAttached\")
|
||||
// dotnet test --runtime win-x64 --no-build --filter "ClassName=EDAViewer.Tests.BackgroundTests & TestCategory=WindowsDevelopment" --% -- TestRunParameters.Parameter(name=\"Debug\", value=\"Debugger.IsAttached\")
|
||||
// dotnet test --runtime win-x64 --no-build --filter "ClassName=EDAViewer.Tests.BackgroundTests & TestCategory=WindowsStaging" --% -- TestRunParameters.Parameter(name=\"Debug\", value=\"Debugger.IsAttached\")
|
||||
// dotnet test --runtime win-x64 --no-build --filter "ClassName=EDAViewer.Tests.BackgroundTests & TestCategory=WindowsProduction" --% -- TestRunParameters.Parameter(name=\"Debug\", value=\"Debugger.IsAttached\")
|
1
EDA Viewer.Tests/ReadMe.md
Normal file
1
EDA Viewer.Tests/ReadMe.md
Normal file
@ -0,0 +1 @@
|
||||
dotnet test --runtime win-x64 --no-build --filter "FullyQualifiedName~EDAViewer.Tests & TestCategory=WindowsDevelopment" --% -- TestRunParameters.Parameter(name=\"Debug\", value=\"Debugger.IsAttached\")
|
71
EDA Viewer.Tests/Shared/LoggingUnitTesting.cs
Normal file
71
EDA Viewer.Tests/Shared/LoggingUnitTesting.cs
Normal file
@ -0,0 +1,71 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Shared
|
||||
{
|
||||
|
||||
public class LoggingUnitTesting : UnitTesting, IDisposable
|
||||
{
|
||||
|
||||
protected ILogger<object> _Logger;
|
||||
protected ILoggerFactory _LoggerFactory;
|
||||
protected readonly LogLevel? _DefaultLogLevel;
|
||||
protected readonly LogLevel? _Log4netProviderLogLevel;
|
||||
protected readonly IConfigurationRoot _ConfigurationRoot;
|
||||
public ILogger<object> Logger => _Logger;
|
||||
public LogLevel? DefaultLogLevel => _DefaultLogLevel;
|
||||
public ILoggerFactory LoggerFactory => _LoggerFactory;
|
||||
public IConfigurationRoot ConfigurationRoot => _ConfigurationRoot;
|
||||
public LogLevel? Log4netProviderLogLevel => _Log4netProviderLogLevel;
|
||||
|
||||
public LoggingUnitTesting(TestContext testContext, Type declaringType) : base(testContext, declaringType)
|
||||
{
|
||||
_LoggerFactory = new LoggerFactory();
|
||||
if (testContext is null || declaringType is null)
|
||||
{
|
||||
_ConfigurationRoot = null;
|
||||
_DefaultLogLevel = null;
|
||||
_Log4netProviderLogLevel = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogLevel logLevel;
|
||||
IConfigurationSection configurationSection;
|
||||
List<LogLevel> logLevels = new List<LogLevel>();
|
||||
string defaultLogLevelSection = "Logging:LogLevel:Default";
|
||||
string log4netProviderLogLevelSection = "Logging:LogLevel:Log4netProvider";
|
||||
string[] sections = new string[] { defaultLogLevelSection, log4netProviderLogLevelSection };
|
||||
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
|
||||
.AddEnvironmentVariables()
|
||||
.AddJsonFile(_IsEnvironment.AppSettingsFileName, optional: false, reloadOnChange: true);
|
||||
_ConfigurationRoot = configurationBuilder.Build();
|
||||
foreach (string section in sections)
|
||||
{
|
||||
configurationSection = _ConfigurationRoot.GetSection(section);
|
||||
if (configurationSection is null)
|
||||
logLevel = LogLevel.Debug;
|
||||
else if (!Enum.TryParse<LogLevel>(configurationSection.Value, out logLevel))
|
||||
logLevel = LogLevel.Debug;
|
||||
logLevels.Add(logLevel);
|
||||
}
|
||||
_DefaultLogLevel = logLevels[0];
|
||||
_Log4netProviderLogLevel = logLevels[1];
|
||||
}
|
||||
if (DefaultLogLevel.HasValue)
|
||||
_LoggerFactory.AddProvider(new DebugProvider(DefaultLogLevel.Value));
|
||||
if (DefaultLogLevel.HasValue)
|
||||
_LoggerFactory.AddProvider(new ConsoleProvider(DefaultLogLevel.Value));
|
||||
_Logger = _LoggerFactory.CreateLogger<object>();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_LoggerFactory.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
93
EDA Viewer.Tests/Shared/UnitTesting.cs
Normal file
93
EDA Viewer.Tests/Shared/UnitTesting.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
|
||||
namespace Shared
|
||||
{
|
||||
|
||||
public class UnitTesting
|
||||
{
|
||||
|
||||
protected readonly IsEnvironment _IsEnvironment;
|
||||
|
||||
public IsEnvironment IsEnvironment => _IsEnvironment;
|
||||
|
||||
public UnitTesting(TestContext testContext, Type declaringType)
|
||||
{
|
||||
if (testContext is null || declaringType is null)
|
||||
_IsEnvironment = null;
|
||||
else
|
||||
{
|
||||
string projectDirectory = GetProjectDirectory(testContext);
|
||||
string json = JsonSerializer.Serialize(testContext.Properties);
|
||||
string vsCodeDirectory = Path.Combine(projectDirectory, ".vscode");
|
||||
if (!Directory.Exists(vsCodeDirectory))
|
||||
Directory.CreateDirectory(vsCodeDirectory);
|
||||
string launchText = GetLaunchText();
|
||||
File.WriteAllText(Path.Combine(vsCodeDirectory, "launch.json"), launchText);
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
if (!json.Contains("Debugger.IsAttached") || Debugger.IsAttached)
|
||||
break;
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
MethodBase methodBase = declaringType.GetMethod(testContext.TestName);
|
||||
if (!(methodBase is null))
|
||||
{
|
||||
TestCategoryAttribute testCategoryAttribute = methodBase.GetCustomAttribute<TestCategoryAttribute>();
|
||||
if (!(testCategoryAttribute is null))
|
||||
{
|
||||
foreach (string testCategory in testCategoryAttribute.TestCategories)
|
||||
_IsEnvironment = new IsEnvironment(testCategory);
|
||||
}
|
||||
}
|
||||
if (_IsEnvironment is null)
|
||||
_IsEnvironment = new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string GetProjectDirectory(TestContext testContext)
|
||||
{
|
||||
string result;
|
||||
string[] checkFiles = null;
|
||||
result = Path.GetDirectoryName(testContext.DeploymentDirectory);
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(result))
|
||||
break;
|
||||
checkFiles = Directory.GetFiles(result, "*.Tests.*proj", SearchOption.TopDirectoryOnly);
|
||||
if (checkFiles.Any())
|
||||
break;
|
||||
result = Path.GetDirectoryName(result);
|
||||
}
|
||||
if (string.IsNullOrEmpty(result) || checkFiles is null || !checkFiles.Any())
|
||||
throw new Exception(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static string GetLaunchText()
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.
|
||||
AppendLine("{").
|
||||
AppendLine(" \"configurations\": [").
|
||||
AppendLine(" {").
|
||||
AppendLine(" \"name\": \".NET Core Attach\",").
|
||||
AppendLine(" \"type\": \"coreclr\",").
|
||||
AppendLine(" \"request\": \"attach\",").
|
||||
AppendLine($" \"processId\": {System.Diagnostics.Process.GetCurrentProcess().Id}").
|
||||
AppendLine(" }").
|
||||
AppendLine(" ]").
|
||||
AppendLine("}");
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
16
EDA Viewer/Blazor/Counter.razor
Normal file
16
EDA Viewer/Blazor/Counter.razor
Normal file
@ -0,0 +1,16 @@
|
||||
<h3>Counter</h3>
|
||||
|
||||
<p>
|
||||
Current Count: @i
|
||||
</p>
|
||||
|
||||
<button @onclick="IncrementCounter" class="btn btn-primary">Click Me</button>
|
||||
|
||||
@code {
|
||||
int i = 0;
|
||||
|
||||
private void IncrementCounter()
|
||||
{
|
||||
i += 1;
|
||||
}
|
||||
}
|
167
EDA Viewer/Controllers/HomeController.cs
Normal file
167
EDA Viewer/Controllers/HomeController.cs
Normal file
@ -0,0 +1,167 @@
|
||||
using EDAViewer.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace EDAViewer.Controllers
|
||||
{
|
||||
|
||||
public class HomeController : Controller, IHomeController
|
||||
{
|
||||
|
||||
private readonly Log _Log;
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly IsEnvironment _IsEnvironment;
|
||||
private readonly Singleton.IBackground _Background;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger, IsEnvironment isEnvironment, Singleton.IBackground background, AppSettings appSettings)
|
||||
{
|
||||
_Log = new Log(logger);
|
||||
_Background = background;
|
||||
_AppSettings = appSettings;
|
||||
_IsEnvironment = isEnvironment;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
|
||||
public IActionResult Encode(string value = null)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
result = HttpUtility.UrlEncode(value);
|
||||
return Content(result, "text/plain");
|
||||
}
|
||||
|
||||
public IActionResult Background(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null, int? invoke_eda_dcp = null)
|
||||
{
|
||||
_Background.SendStatusOk();
|
||||
if (message_clear.HasValue && message_clear.Value)
|
||||
_Background.ClearMessage();
|
||||
if (exceptions_clear.HasValue && exceptions_clear.Value)
|
||||
_Background.Exceptions.Clear();
|
||||
if (set_is_primary_instance.HasValue)
|
||||
{
|
||||
if (set_is_primary_instance.Value)
|
||||
_Background.SetIsPrimaryInstance();
|
||||
else
|
||||
_Background.ClearIsPrimaryInstance();
|
||||
}
|
||||
string message;
|
||||
if (string.IsNullOrWhiteSpace(_Background.Message))
|
||||
message = "N/A";
|
||||
else
|
||||
message = _Background.Message;
|
||||
//Response.AppendToLog(_Background.Message);
|
||||
List<Exception> exceptions = new();
|
||||
foreach (Exception exception in _Background.Exceptions)
|
||||
exceptions.Add(exception);
|
||||
ViewBag.Message = message;
|
||||
ViewBag.Exceptions = exceptions;
|
||||
ViewBag.URLs = _AppSettings.URLs;
|
||||
ViewBag.Profile = _IsEnvironment.Profile;
|
||||
ViewBag.WorkingDirectory = _Background.WorkingDirectory;
|
||||
ViewBag.IsPrimaryInstance = _Background.IsPrimaryInstance();
|
||||
ViewBag.ExceptionsCount = string.Concat("Exception(s) - ", exceptions.Count);
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult<IEnumerable<SelectListItem>> GetDirectoriesOrFiles(string path = null, bool? upDirectory = null, string filter = null)
|
||||
{
|
||||
List<SelectListItem> results = new();
|
||||
//System.Threading.Thread.Sleep(1500);
|
||||
//path = @"D:\Tmp";
|
||||
if (string.IsNullOrEmpty(path))
|
||||
path = string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA");
|
||||
if (string.IsNullOrEmpty(filter))
|
||||
filter = "*";
|
||||
if (upDirectory.HasValue && upDirectory.Value && path.Contains('|'))
|
||||
{
|
||||
string[] segments = path.Split('|');
|
||||
path = segments[^1];
|
||||
}
|
||||
//System.IO.File.AppendAllText(string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA\a.txt"), path);
|
||||
string gold = "Gold";
|
||||
if (System.IO.File.Exists(path))
|
||||
{
|
||||
string[] files = Directory.GetFiles(Path.GetDirectoryName(path), filter, SearchOption.TopDirectoryOnly);
|
||||
foreach (string item in files)
|
||||
results.Add(new SelectListItem() { Value = item, Text = Path.GetFileName(item), Group = new SelectListGroup() { Name = "File(s)" } });
|
||||
if (results.Count > 1)
|
||||
results.Insert(0, new SelectListItem() { Value = string.Empty, Text = string.Concat("Select - ", 0, " - ", files.Length) });
|
||||
}
|
||||
else if (Directory.Exists(path))
|
||||
{
|
||||
string[] files = Directory.GetFiles(path, filter, SearchOption.TopDirectoryOnly);
|
||||
string[] directories = Directory.GetDirectories(path, filter, SearchOption.TopDirectoryOnly).Where(l => Path.GetFileName(l) != gold).ToArray();
|
||||
for (short i = 0; i < short.MaxValue; i++)
|
||||
{
|
||||
if (directories.Length != 1 || files.Length != 0)
|
||||
break;
|
||||
else
|
||||
{
|
||||
path = directories[0];
|
||||
files = Directory.GetFiles(path, filter, SearchOption.TopDirectoryOnly);
|
||||
directories = Directory.GetDirectories(path, filter, SearchOption.TopDirectoryOnly).Where(l => Path.GetFileName(l) != gold).ToArray();
|
||||
if (directories.Length == 0 && files.Length == 0)
|
||||
{
|
||||
directories = new string[] { path };
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (string item in directories)
|
||||
results.Add(new SelectListItem() { Value = item, Text = Path.GetFileName(item), Group = new SelectListGroup() { Name = "Directorie(s)" } });
|
||||
foreach (string item in files)
|
||||
results.Add(new SelectListItem() { Value = item, Text = Path.GetFileName(item), Group = new SelectListGroup() { Name = "File(s)" } });
|
||||
if (results.Count > 1)
|
||||
results.Insert(0, new SelectListItem() { Value = string.Empty, Text = string.Concat("Select - ", directories.Length, " - ", files.Length) });
|
||||
}
|
||||
//System.IO.File.AppendAllText(string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA\b.txt"), results.Count.ToString());
|
||||
if (!results.Any())
|
||||
results.Add(new SelectListItem() { Value = path, Text = string.Concat("Nothing Found *{", path, "}") });
|
||||
return results;
|
||||
}
|
||||
|
||||
public IActionResult ViewEdaHtmlDiff(WithEnvironment withEnvironment = null)
|
||||
{
|
||||
if (withEnvironment is null)
|
||||
withEnvironment = new WithEnvironment();
|
||||
string path = string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA");
|
||||
if (!Directory.Exists(path))
|
||||
path = @"C:\";
|
||||
EdaHtmlDiff model = new(withEnvironment, path);
|
||||
ViewBag.message = model.message;
|
||||
return View(model);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// dotnet publish --configuration Release --runtime win-x64 --verbosity normal --self-contained true -o "L:\net5.0\EDAViewer"
|
||||
// dotnet publish --configuration Release --runtime win-x64 --verbosity normal --self-contained true -o "D:\net5.0\EDAViewer"
|
||||
// dotnet publish --configuration Release --runtime win-x64 --verbosity normal --self-contained true -o "D:\.jenkins\publish\manual-Mesa-0\EDAViewer"
|
||||
//http://eaf-dev.mes.infineon.com:8080/job/Mesa/buildWithParameters?token=DotnetRules&projectName=EDA%20Viewer
|
||||
//http://eaf-prod.mes.infineon.com:8080/job/Mesa/buildWithParameters?token=DotnetRules&projectName=EDA%20Viewer
|
||||
//sc create EDAViewer_5003 binPath="D:\.jenkins\publish\manual-Mesa-0\EDAViewer\EDA Viewer.exe"
|
59
EDA Viewer/EDA Viewer.csproj
Normal file
59
EDA Viewer/EDA Viewer.csproj
Normal file
@ -0,0 +1,59 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>EDAViewer</RootNamespace>
|
||||
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
|
||||
<UserSecretsId>d71a673c-be39-45b5-ae5f-4c22639be045</UserSecretsId>
|
||||
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
|
||||
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
|
||||
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsWindows)'=='true'">
|
||||
<DefineConstants>Windows</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsOSX)'=='true'">
|
||||
<DefineConstants>OSX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsLinux)'=='true'">
|
||||
<DefineConstants>Linux</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Infineon.Monitoring.MonA" Version="2.0.0" />
|
||||
<PackageReference Include="Log4net" Version="2.0.12" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="5.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.1.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.1.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.1.4" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\images\" />
|
||||
<Folder Include="wwwroot\js\html5shiv\3.7.2\" />
|
||||
<Folder Include="wwwroot\js\respond\1.4.2\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="appsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="appsettings.Staging.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="appsettings.Development.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
10
EDA Viewer/GlobalSuppressions.cs
Normal file
10
EDA Viewer/GlobalSuppressions.cs
Normal file
@ -0,0 +1,10 @@
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:EDAViewer.Models.WithEnvironment.message")]
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:EDAViewer.Models.WithEnvironment.now_ticks")]
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:EDAViewer.Models.WithEnvironment.user_name")]
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:EDAViewer.Models.WithEnvironment.machine_name")]
|
174
EDA Viewer/HostedService/TimedHostedService.cs
Normal file
174
EDA Viewer/HostedService/TimedHostedService.cs
Normal file
@ -0,0 +1,174 @@
|
||||
using EDAViewer.Singleton;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EDAViewer.HostedService
|
||||
{
|
||||
|
||||
public class TimedHostedService : IHostedService, IDisposable
|
||||
{
|
||||
|
||||
private readonly int _ExecutionCount;
|
||||
private readonly Background _Background;
|
||||
private readonly IsEnvironment _IsEnvironment;
|
||||
private readonly ILogger<TimedHostedService> _Log;
|
||||
|
||||
private Timer _EDAOutputArchiveTimer;
|
||||
private Timer _LogPathCleanUpByWeekTimer;
|
||||
private Timer _EdaDataCollectionPlansTimer;
|
||||
|
||||
public TimedHostedService(IsEnvironment isEnvironment, Background background, IServiceProvider serviceProvider)
|
||||
{
|
||||
_ExecutionCount = 0;
|
||||
_Background = background;
|
||||
_IsEnvironment = isEnvironment;
|
||||
_Log = serviceProvider.GetRequiredService<ILogger<TimedHostedService>>();
|
||||
_EDAOutputArchiveTimer = new Timer(EDAOutputArchiveCallback, null, Timeout.Infinite, Timeout.Infinite);
|
||||
_LogPathCleanUpByWeekTimer = new Timer(LogPathCleanUpByWeekCallback, null, Timeout.Infinite, Timeout.Infinite);
|
||||
_EdaDataCollectionPlansTimer = new Timer(EdaDataCollectionPlansCallback, null, Timeout.Infinite, Timeout.Infinite);
|
||||
}
|
||||
|
||||
public Task StartAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
_Log.LogInformation(string.Concat("Timed Hosted Service: ", nameof(Background), ":", _IsEnvironment.Profile, ":", Environment.ProcessId, " running."));
|
||||
_Background.Update(_Log);
|
||||
if (_IsEnvironment.Development)
|
||||
{
|
||||
int milliSeconds = 3000;
|
||||
_EdaDataCollectionPlansTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_EdaDataCollectionPlansTimer);
|
||||
milliSeconds += 2000;
|
||||
}
|
||||
else if (_IsEnvironment.Staging)
|
||||
{
|
||||
int milliSeconds = 3000;
|
||||
_LogPathCleanUpByWeekTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_LogPathCleanUpByWeekTimer);
|
||||
milliSeconds += 2000;
|
||||
_EdaDataCollectionPlansTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_EdaDataCollectionPlansTimer);
|
||||
milliSeconds += 2000;
|
||||
_EDAOutputArchiveTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_EDAOutputArchiveTimer);
|
||||
milliSeconds += 2000;
|
||||
}
|
||||
else if (_IsEnvironment.Production)
|
||||
{
|
||||
int milliSeconds = 3000;
|
||||
_LogPathCleanUpByWeekTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_LogPathCleanUpByWeekTimer);
|
||||
milliSeconds += 2000;
|
||||
_EdaDataCollectionPlansTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_EdaDataCollectionPlansTimer);
|
||||
milliSeconds += 2000;
|
||||
_EDAOutputArchiveTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_EDAOutputArchiveTimer);
|
||||
milliSeconds += 2000;
|
||||
}
|
||||
else
|
||||
throw new Exception();
|
||||
if (_IsEnvironment.Staging || _IsEnvironment.Production)
|
||||
{
|
||||
string countDirectory = _Background.GetCountDirectory("Start");
|
||||
string checkDirectory = Path.GetPathRoot(countDirectory);
|
||||
if (Directory.Exists(checkDirectory))
|
||||
Directory.CreateDirectory(countDirectory);
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task StopAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
_Log.LogInformation(string.Concat("Timed Hosted Service: ", nameof(Background), ":", _IsEnvironment.Profile, ":", Environment.ProcessId, " is stopping."));
|
||||
_Background.Stop(immediate: true);
|
||||
for (short i = 0; i < short.MaxValue; i++)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
if (_ExecutionCount == 0)
|
||||
break;
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_Background.Dispose();
|
||||
}
|
||||
|
||||
private void LogPathCleanUpByWeekCallback(object state)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_Background.IsPrimaryInstance())
|
||||
_Background.LogPathCleanUpByWeekCallback();
|
||||
}
|
||||
catch (Exception e) { _Background.Catch(e); }
|
||||
try
|
||||
{
|
||||
TimeSpan timeSpan;
|
||||
if (!_Background.IsPrimaryInstance())
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
|
||||
else
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddHours(6).Ticks - DateTime.Now.Ticks);
|
||||
_LogPathCleanUpByWeekTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||
}
|
||||
catch (Exception e) { _Background.Catch(e); }
|
||||
}
|
||||
|
||||
private void EDAOutputArchiveCallback(object state)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_Background.IsPrimaryInstance())
|
||||
_Background.EDAOutputArchiveCallback();
|
||||
}
|
||||
catch (Exception e) { _Background.Catch(e); }
|
||||
try
|
||||
{
|
||||
TimeSpan timeSpan;
|
||||
if (!_Background.IsPrimaryInstance())
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
|
||||
else
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddHours(6).Ticks - DateTime.Now.Ticks);
|
||||
_EDAOutputArchiveTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||
}
|
||||
catch (Exception e) { _Background.Catch(e); }
|
||||
}
|
||||
|
||||
private void EdaDataCollectionPlansCallback(object state)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_Background.IsPrimaryInstance())
|
||||
_Background.EdaDataCollectionPlansCallback();
|
||||
}
|
||||
catch (Exception e) { _Background.Catch(e); }
|
||||
try
|
||||
{
|
||||
TimeSpan timeSpan;
|
||||
if (!_Background.IsPrimaryInstance())
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
|
||||
else
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddHours(2).Ticks - DateTime.Now.Ticks);
|
||||
_EdaDataCollectionPlansTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||
}
|
||||
catch (Exception e) { _Background.Catch(e); }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.Core
|
||||
{
|
||||
public class BackboneComponent
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.Core
|
||||
{
|
||||
public class BackboneStatusCache
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.Core
|
||||
{
|
||||
public interface ILoggingSetupManager
|
||||
{
|
||||
}
|
||||
}
|
6
EDA Viewer/Library/Eaf/Core/AutoGenerated/StatusItem.cs
Normal file
6
EDA Viewer/Library/Eaf/Core/AutoGenerated/StatusItem.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.Core
|
||||
{
|
||||
public class StatusItem
|
||||
{
|
||||
}
|
||||
}
|
48
EDA Viewer/Library/Eaf/Core/Backbone.cs
Normal file
48
EDA Viewer/Library/Eaf/Core/Backbone.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using Library.PeerGroup.GCL.Annotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Eaf.Core
|
||||
{
|
||||
public class Backbone
|
||||
{
|
||||
public const string STATE_ERROR = "Error";
|
||||
public const string STATE_OFFLINE = "Offline";
|
||||
public const string STATE_RUNNING = "Running";
|
||||
public const string STATE_SHUTDOWN = "Shutting Down";
|
||||
public const string STATE_STARTING = "Starting";
|
||||
|
||||
protected Backbone() { }
|
||||
|
||||
[NotNull]
|
||||
public static Backbone Instance { get; }
|
||||
[NotNull]
|
||||
public ILoggingSetupManager LoggingConfigurationManager { get; set; }
|
||||
public BackboneStatusCache Status { get; }
|
||||
public bool IsAutomatedRestartActive { get; }
|
||||
public bool IsReadyForRestart { get; }
|
||||
public string StartTime { get; }
|
||||
public string State { get; }
|
||||
public string Name { get; }
|
||||
public string ConfigurationServiceAddress { get; }
|
||||
public string CellName { get; }
|
||||
protected bool IsInitialized { get; set; }
|
||||
protected Dictionary<string, BackboneComponent> BackboneComponents { get; }
|
||||
|
||||
public void AddBackboneComponent(BackboneComponent backboneComponent) { }
|
||||
public bool ContainsBackboneComponent(string id) { throw new NotImplementedException(); }
|
||||
[Obsolete("Use the capabilities exposed via the Status property -> GetAll. Will be removed with next major release.")]
|
||||
public List<StatusItem> GetAllStatuses() { throw new NotImplementedException(); }
|
||||
public BackboneComponent GetBackboneComponentById(string id) { throw new NotImplementedException(); }
|
||||
public List<T> GetBackboneComponentsOfType<T>() { throw new NotImplementedException(); }
|
||||
public List<BackboneComponent> GetBackboneComponentsOfType(Type type) { throw new NotImplementedException(); }
|
||||
public void RegisterSubprocess(int pid) { }
|
||||
[Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")]
|
||||
public void SetStatus(string statusName, string statusValue) { }
|
||||
[Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")]
|
||||
public void SetStatus(BackboneComponent source, string statusName, string statusValue) { }
|
||||
protected void CloseConnectionOfComponents(List<BackboneComponent> components) { }
|
||||
protected virtual void StopAllComponents() { }
|
||||
protected void StopComponents(List<BackboneComponent> components) { }
|
||||
}
|
||||
}
|
24
EDA Viewer/Library/Eaf/Core/Smtp/EmailMessage.cs
Normal file
24
EDA Viewer/Library/Eaf/Core/Smtp/EmailMessage.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace Library.Eaf.Core.Smtp
|
||||
{
|
||||
|
||||
public class EmailMessage
|
||||
{
|
||||
public EmailMessage() { }
|
||||
public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { }
|
||||
|
||||
public string Body { get; }
|
||||
public MailPriority Priority { get; }
|
||||
public string Subject { get; }
|
||||
|
||||
public EmailMessage PriorityHigh() { throw new NotImplementedException(); }
|
||||
public EmailMessage PriorityLow() { throw new NotImplementedException(); }
|
||||
public EmailMessage PriorityNormal() { throw new NotImplementedException(); }
|
||||
public EmailMessage SetBody(string body) { throw new NotImplementedException(); }
|
||||
public EmailMessage SetPriority(MailPriority priority) { throw new NotImplementedException(); }
|
||||
public EmailMessage SetSubject(string subject) { throw new NotImplementedException(); }
|
||||
|
||||
}
|
||||
|
||||
}
|
9
EDA Viewer/Library/Eaf/Core/Smtp/ISmtp.cs
Normal file
9
EDA Viewer/Library/Eaf/Core/Smtp/ISmtp.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Library.Eaf.Core.Smtp
|
||||
{
|
||||
|
||||
public interface ISmtp
|
||||
{
|
||||
void Send(EmailMessage message);
|
||||
}
|
||||
|
||||
}
|
11
EDA Viewer/Library/Eaf/Core/Smtp/MailPriority.cs
Normal file
11
EDA Viewer/Library/Eaf/Core/Smtp/MailPriority.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Library.Eaf.Core.Smtp
|
||||
{
|
||||
|
||||
public enum MailPriority
|
||||
{
|
||||
Low = 0,
|
||||
Normal = 1,
|
||||
High = 2
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class ChangeDataCollectionHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class DataCollectionRequest
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class EquipmentEvent
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class EquipmentException
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class EquipmentSelfDescription
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class GetParameterValuesHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IConnectionControl
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IDataTracingHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IEquipmentCommandService
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using Library.PeerGroup.GCL.Annotations;
|
||||
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IEquipmentControl : IPackageSource
|
||||
{
|
||||
[NotNull]
|
||||
IEquipmentSelfDescriptionBuilder SelfDescriptionBuilder { get; }
|
||||
[NotNull]
|
||||
IEquipmentDataCollection DataCollection { get; }
|
||||
[NotNull]
|
||||
IEquipmentCommandService Commands { get; }
|
||||
[NotNull]
|
||||
IConnectionControl Connection { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IEquipmentSelfDescriptionBuilder
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IPackage
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface ISelfDescriptionLookup
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IVirtualParameterValuesHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class SetParameterValuesHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class TraceRequest
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
using Library.Eaf.EquipmentCore.DataCollection.Reporting;
|
||||
using Library.Eaf.EquipmentCore.SelfDescription.ElementDescription;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IEquipmentDataCollection
|
||||
{
|
||||
IVirtualParameterValuesHandler VirtualParameterValuesHandler { get; }
|
||||
ISelfDescriptionLookup SelfDescriptionLookup { get; }
|
||||
EquipmentSelfDescription SelfDescription { get; }
|
||||
IEnumerable<DataCollectionRequest> ActiveRequests { get; }
|
||||
IDataTracingHandler DataTracingHandler { get; }
|
||||
|
||||
ParameterValue CreateParameterValue(EquipmentParameter parameter, object value);
|
||||
void NotifyDataTracingAvailable(bool isAvailable);
|
||||
void RegisterChangeDataCollectionHandler(ChangeDataCollectionHandler handler);
|
||||
void RegisterDataTracingHandler(IDataTracingHandler handler);
|
||||
void RegisterGetParameterValuesHandler(GetParameterValuesHandler handler);
|
||||
void RegisterSetParameterValuesHandler(SetParameterValuesHandler handler);
|
||||
void TriggerDeactivate(DataCollectionRequest deactivateRequest);
|
||||
void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters);
|
||||
void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
||||
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters);
|
||||
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
||||
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride);
|
||||
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage);
|
||||
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage);
|
||||
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride);
|
||||
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
||||
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters);
|
||||
void TriggerPerformanceRestored();
|
||||
void TriggerPerformanceWarning();
|
||||
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters);
|
||||
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
||||
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, DateTime equipmentTimeStamp);
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IPackageSource
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using Library.Eaf.EquipmentCore.SelfDescription.ElementDescription;
|
||||
using Library.PeerGroup.GCL.Annotations;
|
||||
using System;
|
||||
|
||||
namespace Library.Eaf.EquipmentCore.DataCollection.Reporting
|
||||
{
|
||||
public class ParameterValue
|
||||
{
|
||||
public ParameterValue(EquipmentParameter definition, object value) { }
|
||||
public ParameterValue(EquipmentParameter definition, object value, DateTime timestamp) { }
|
||||
|
||||
public virtual object Value { get; protected internal set; }
|
||||
[NotNull]
|
||||
public EquipmentParameter Definition { get; }
|
||||
public DateTime Timestamp { get; protected set; }
|
||||
|
||||
public virtual ParameterValue Clone(EquipmentParameter newDefinition) { throw new NotImplementedException(); }
|
||||
public override string ToString() { return base.ToString(); }
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
using Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||
|
||||
namespace Library.Eaf.EquipmentCore.SelfDescription.ElementDescription
|
||||
{
|
||||
public class EquipmentParameter
|
||||
{
|
||||
public EquipmentParameter(EquipmentParameter source, ParameterTypeDefinition typeDefinition) { }
|
||||
public EquipmentParameter(string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { }
|
||||
public EquipmentParameter(string id, string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { }
|
||||
|
||||
public string Name { get; }
|
||||
public string Id { get; }
|
||||
public string Description { get; }
|
||||
public string SourcePath { get; }
|
||||
public string SourceEquipment { get; }
|
||||
public ParameterTypeDefinition TypeDefinition { get; }
|
||||
public bool IsTransient { get; }
|
||||
public bool IsReadOnly { get; }
|
||||
|
||||
public override string ToString() { return base.ToString(); }
|
||||
public string ToStringWithDetails() { return base.ToString(); }
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes
|
||||
{
|
||||
public class Field
|
||||
{
|
||||
public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { }
|
||||
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
public ParameterTypeDefinition TypeDefinition { get; }
|
||||
public bool CanBeNull { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes
|
||||
{
|
||||
public abstract class ParameterTypeDefinition
|
||||
{
|
||||
public ParameterTypeDefinition(string name, string description) { }
|
||||
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
|
||||
public override string ToString() { return base.ToString(); }
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes
|
||||
{
|
||||
public class StructuredType : ParameterTypeDefinition
|
||||
{
|
||||
|
||||
public StructuredType(string name, string description, IList<Field> fields) : base(name, description) { }
|
||||
|
||||
public IList<Field> Fields { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.Management.ConfigurationData.CellAutomation
|
||||
{
|
||||
public interface IConfigurationObject
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace Library.Eaf.Management.ConfigurationData.CellAutomation
|
||||
{
|
||||
[System.Runtime.Serialization.DataContractAttribute(IsReference = true)]
|
||||
public class ModelObjectParameterDefinition : IConfigurationObject
|
||||
{
|
||||
public ModelObjectParameterDefinition() { }
|
||||
public ModelObjectParameterDefinition(string name, ModelObjectParameterType valueType, object defaultValue) { }
|
||||
public ModelObjectParameterDefinition(string name, Type enumType, object defaultValue) { }
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long Id { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual string Name { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual string Value { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual ModelObjectParameterType ValueType { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual string EnumType { get; set; }
|
||||
|
||||
public virtual ModelObjectParameterDefinition Clone() { return null; }
|
||||
public virtual bool IsValidValue(string value) { return false; }
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
namespace Library.Eaf.Management.ConfigurationData.CellAutomation
|
||||
{
|
||||
public enum ModelObjectParameterType
|
||||
{
|
||||
String = 0,
|
||||
Bool = 1,
|
||||
Byte = 2,
|
||||
SignedByte = 3,
|
||||
Integer = 4,
|
||||
UnsignedInteger = 5,
|
||||
LongInteger = 6,
|
||||
UnsignedLongInteger = 7,
|
||||
Double = 8,
|
||||
Float = 9,
|
||||
Enum = 10
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
using Library.PeerGroup.GCL.SecsDriver;
|
||||
using System;
|
||||
|
||||
namespace Library.Eaf.Management.ConfigurationData.Semiconductor.CellInstances
|
||||
{
|
||||
[System.Runtime.Serialization.DataContractAttribute]
|
||||
public class SecsConnectionConfiguration
|
||||
{
|
||||
public SecsConnectionConfiguration() { }
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T6HsmsControlMessage { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T5ConnectionSeperation { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T4InterBlock { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T3MessageReply { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T2Protocol { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T1InterCharacter { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual SerialBaudRate? BaudRate { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual SecsTransportType? PortType { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? Port { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan LinkTestTimer { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual string Host { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? DeviceId { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual HsmsSessionMode? SessionMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual HsmsConnectionMode? ConnectionMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T7ConnectionIdle { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T8NetworkIntercharacter { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
namespace Library.Ifx.Eaf.Common.Configuration
|
||||
{
|
||||
[System.Runtime.Serialization.DataContractAttribute]
|
||||
public class ConnectionSetting
|
||||
{
|
||||
public ConnectionSetting(string name, string value) { }
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string Name { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Ifx.Eaf.EquipmentConnector.File.Component
|
||||
{
|
||||
public class File
|
||||
{
|
||||
public File(string filePath) { throw new NotImplementedException(); }
|
||||
public File(string filePath, DateTime timeFileFound) { throw new NotImplementedException(); }
|
||||
|
||||
public string Path { get; }
|
||||
public DateTime TimeFound { get; }
|
||||
public bool IsErrorFile { get; }
|
||||
public Dictionary<string, string> ContentParameters { get; }
|
||||
|
||||
public File UpdateContentParameters(Dictionary<string, string> contentParameters) { throw new NotImplementedException(); }
|
||||
public File UpdateParsingStatus(bool isErrorFile) { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
using Library.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Ifx.Eaf.EquipmentConnector.File.Component
|
||||
{
|
||||
public class FilePathGenerator
|
||||
{
|
||||
public const char PLACEHOLDER_IDENTIFIER = '%';
|
||||
public const char PLACEHOLDER_SEPARATOR = ':';
|
||||
public const string PLACEHOLDER_NOT_AVAILABLE = "NA";
|
||||
public const string PLACEHOLDER_ORIGINAL_FILE_NAME = "OriginalFileName";
|
||||
public const string PLACEHOLDER_ORIGINAL_FILE_EXTENSION = "OriginalFileExtension";
|
||||
public const string PLACEHOLDER_DATE_TIME = "DateTime";
|
||||
public const string PLACEHOLDER_SUB_FOLDER = "SubFolder";
|
||||
public const string PLACEHOLDER_CELL_NAME = "CellName";
|
||||
|
||||
public FilePathGenerator(FileConnectorConfiguration config, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
|
||||
public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
|
||||
public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
|
||||
|
||||
protected string SubFolderPath { get; }
|
||||
protected FileConnectorConfiguration Configuration { get; }
|
||||
protected File File { get; }
|
||||
protected bool IsErrorFile { get; }
|
||||
protected string DefaultPlaceHolderValue { get; }
|
||||
|
||||
public string GetFullTargetPath() { throw new NotImplementedException(); }
|
||||
public virtual string GetTargetFileName() { throw new NotImplementedException(); }
|
||||
public string GetTargetFolder(bool throwExceptionIfNotExist = true) { throw new NotImplementedException(); }
|
||||
protected virtual string GetSubFolder(string folderPattern, string subFolderPath) { throw new NotImplementedException(); }
|
||||
protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) { throw new NotImplementedException(); }
|
||||
protected string ReplacePlaceholder(string inputPath) { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
using Library.Ifx.Eaf.Common.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Ifx.Eaf.EquipmentConnector.File.Configuration
|
||||
{
|
||||
[System.Runtime.Serialization.DataContractAttribute]
|
||||
public class FileConnectorConfiguration
|
||||
{
|
||||
public const ulong IDLE_EVENT_WAIT_TIME_DEFAULT = 360;
|
||||
public const ulong FILE_HANDLE_TIMEOUT_DEFAULT = 15;
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual bool? TriggerOnChanged { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? PostProcessingRetries { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual bool? CopySourceFolderStructure { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public IfPostProcessingFailsEnum? IfPostProcessingFailsAction { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string AlternateTargetFolder { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public long? FileHandleTimeout { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public bool? DeleteEmptySourceSubFolders { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public long? IdleEventWaitTimeInSeconds { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string FileAgeThreshold { get; set; }
|
||||
public bool? FolderAgeCheckIndividualSubFolders { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual ZipModeEnum? ZipMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public FileAgeFilterEnum? FileAgeFilterMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string ZipTargetFileName { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string ZipErrorTargetFileName { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public long? ZipFileSubFolderLevel { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string DefaultPlaceHolderValue { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public bool? UseZip64Mode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public List<ConnectionSetting> ConnectionSettings { get; set; }
|
||||
public string SourceDirectoryCloaking { get; set; }
|
||||
public string FolderAgeThreshold { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? FileScanningIntervalInSeconds { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual bool? TriggerOnCreated { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? ZipFileTime { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string SourceFileLocation { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string SourceFileFilter { get; set; }
|
||||
public List<string> SourceFileFilters { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual bool? IncludeSubDirectories { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual FileScanningOptionEnum? FileScanningOption { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string TargetFileLocation { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string ErrorTargetFileLocation { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string TargetFileName { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? FileHandleWaitTime { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public IfFileExistEnum? IfFileExistAction { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public long? ConnectionRetryInterval { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public PreProcessingModeEnum? PreProcessingMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public PostProcessingModeEnum? PostProcessingMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public PostProcessingModeEnum? ErrorPostProcessingMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? ZipFileAmount { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string ErrorTargetFileName { get; set; }
|
||||
|
||||
public void Initialize() { throw new NotImplementedException(); }
|
||||
|
||||
public enum PostProcessingModeEnum
|
||||
{
|
||||
None = 0,
|
||||
Move = 1,
|
||||
Copy = 2,
|
||||
Rename = 3,
|
||||
Zip = 4,
|
||||
Delete = 5,
|
||||
MoveFolder = 6,
|
||||
CopyFolder = 7,
|
||||
DeleteFolder = 8
|
||||
}
|
||||
public enum PreProcessingModeEnum
|
||||
{
|
||||
None = 0,
|
||||
Process = 1
|
||||
}
|
||||
public enum IfFileExistEnum
|
||||
{
|
||||
Overwrite = 0,
|
||||
LeaveFiles = 1,
|
||||
Delete = 2
|
||||
}
|
||||
public enum IfPostProcessingFailsEnum
|
||||
{
|
||||
LeaveFiles = 0,
|
||||
Delete = 1
|
||||
}
|
||||
public enum FileScanningOptionEnum
|
||||
{
|
||||
FileWatcher = 0,
|
||||
TimeBased = 1
|
||||
}
|
||||
public enum ZipModeEnum
|
||||
{
|
||||
ZipByAmountOrTime = 0,
|
||||
ZipByFileName = 1,
|
||||
ZipBySubFolderName = 2
|
||||
}
|
||||
public enum FileAgeFilterEnum
|
||||
{
|
||||
IgnoreNewer = 0,
|
||||
IgnoreOlder = 1
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Ifx.Eaf.EquipmentConnector.File.SelfDescription
|
||||
{
|
||||
public class FileConnectorParameterTypeDefinitionProvider
|
||||
{
|
||||
public FileConnectorParameterTypeDefinitionProvider() { }
|
||||
|
||||
public IEnumerable<ParameterTypeDefinition> GetAllParameterTypeDefinition() { return null; }
|
||||
public ParameterTypeDefinition GetParameterTypeDefinition(string name) { return null; }
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace Library.PeerGroup.GCL.Annotations
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.Delegate, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class NotNullAttribute : Attribute
|
||||
{
|
||||
public NotNullAttribute() { }
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace Library.PeerGroup.GCL.SecsDriver
|
||||
{
|
||||
public enum HsmsConnectionMode
|
||||
{
|
||||
Active = 0,
|
||||
Passive = 1
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace Library.PeerGroup.GCL.SecsDriver
|
||||
{
|
||||
public enum HsmsSessionMode
|
||||
{
|
||||
MultiSession = 0,
|
||||
SingleSession = 1
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace Library.PeerGroup.GCL.SecsDriver
|
||||
{
|
||||
public enum SecsTransportType
|
||||
{
|
||||
HSMS = 0,
|
||||
Serial = 1
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
namespace Library.PeerGroup.GCL.SecsDriver
|
||||
{
|
||||
public enum SerialBaudRate
|
||||
{
|
||||
Baud9600 = 0,
|
||||
Baud19200 = 1,
|
||||
Baud4800 = 2,
|
||||
Baud2400 = 3,
|
||||
Baud1200 = 4,
|
||||
Baud300 = 5,
|
||||
Baud150 = 6,
|
||||
Baud38400 = 7,
|
||||
Baud57600 = 8,
|
||||
Baud115200 = 9
|
||||
}
|
||||
}
|
15
EDA Viewer/Models/AppSettings.cs
Normal file
15
EDA Viewer/Models/AppSettings.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace EDAViewer.Models
|
||||
{
|
||||
public class AppSettings
|
||||
{
|
||||
public string Company { get; set; }
|
||||
public string ECEDADatabasePassword { get; set; }
|
||||
public string EncryptedPassword { get; set; }
|
||||
public string IFXEDADatabasePassword { get; set; }
|
||||
public string MonARessource { get; set; }
|
||||
public string Server { get; set; }
|
||||
public string ServiceUser { get; set; }
|
||||
public string URLs { get; set; }
|
||||
public string WorkingDirectoryName { get; set; }
|
||||
}
|
||||
}
|
52
EDA Viewer/Models/EdaHtmlDiff.cs
Normal file
52
EDA Viewer/Models/EdaHtmlDiff.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using EDAViewer.Models;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace EDAViewer.Models
|
||||
{
|
||||
|
||||
public class EdaHtmlDiff : WithEnvironment
|
||||
{
|
||||
|
||||
public string Paths { get; set; }
|
||||
public string CurrentPath { get; set; }
|
||||
public string PathAndFileName { get; set; }
|
||||
|
||||
[Display(Name = "FileName")]
|
||||
[DisplayFormat(ConvertEmptyStringToNull = false)]
|
||||
[Required(ErrorMessage = "Please select an file name", AllowEmptyStrings = false)]
|
||||
public string FileName { get; set; }
|
||||
|
||||
public EdaHtmlDiff()
|
||||
{
|
||||
Common(path: string.Empty);
|
||||
}
|
||||
|
||||
public EdaHtmlDiff(WithEnvironment withEnvironment, string path)
|
||||
{
|
||||
Common(path);
|
||||
if (string.IsNullOrEmpty(withEnvironment.user_name))
|
||||
user_name = "AUTO";
|
||||
else
|
||||
user_name = withEnvironment.user_name;
|
||||
if (string.IsNullOrEmpty(withEnvironment.machine_name))
|
||||
machine_name = "IFX";
|
||||
else
|
||||
machine_name = withEnvironment.machine_name;
|
||||
if (withEnvironment.now_ticks == 0)
|
||||
now_ticks = DateTime.Now.Ticks;
|
||||
else
|
||||
now_ticks = withEnvironment.now_ticks;
|
||||
message = withEnvironment.message;
|
||||
}
|
||||
|
||||
private void Common(string path)
|
||||
{
|
||||
Paths = string.Empty;
|
||||
CurrentPath = path;
|
||||
FileName = string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
9
EDA Viewer/Models/ErrorViewModel.cs
Normal file
9
EDA Viewer/Models/ErrorViewModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace EDAViewer.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
46
EDA Viewer/Models/IBackground.cs
Normal file
46
EDA Viewer/Models/IBackground.cs
Normal file
@ -0,0 +1,46 @@
|
||||
namespace EDAViewer.Models
|
||||
{
|
||||
|
||||
public interface IBackground
|
||||
{
|
||||
void EdaDataCollectionPlansCallback();
|
||||
// public void EdaDataCollectionPlans()
|
||||
// {
|
||||
// long ticks = DateTime.Now.Ticks;
|
||||
// Logic2021Q1 logic2021Q1 = new Logic2021Q1(_Log);
|
||||
// string server = GetServer(debugIsNotEC: false);
|
||||
// string cSharpFormat = "yyyy-MM-dd_hh:mm:ss tt";
|
||||
// string oracleFormat = "yyyy-MM-dd_hh:mi:ss AM";
|
||||
// string edaDataCollectionPlansLastRun = "2020-07-02_10:45:01 AM";
|
||||
// logic2021Q1.EdaDataCollectionPlans(server, server.Contains("_ec_"), edaDataCollectionPlansLastRun, cSharpFormat, oracleFormat);
|
||||
// _Log.Debug(string.Concat("Took ", new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds, " second(s)"));
|
||||
// }
|
||||
void EDAOutputArchiveCallback();
|
||||
// public void EDAOutputArchive()
|
||||
// {
|
||||
// long ticks = DateTime.Now.Ticks;
|
||||
// string server = GetServer(debugIsNotEC: true);
|
||||
// string sourceDirectory = string.Concat(@"\\", server, @"\ec_eda\Staging\Traces");
|
||||
// if (!Directory.Exists(sourceDirectory))
|
||||
// _Log.Debug(string.Concat("// Source directory <", sourceDirectory, "> doesn't exist."));
|
||||
// else
|
||||
// {
|
||||
// Logic2019Q4 logic2019Q4 = new Logic2019Q4(_Log);
|
||||
// logic2019Q4.EDAOutputArchive(sourceDirectory);
|
||||
// }
|
||||
// _Log.Debug(string.Concat("Took ", new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds, " second(s)"));
|
||||
// }
|
||||
void LogPathCleanUpByWeekCallback();
|
||||
// public void LogPathCleanUpByWeek()
|
||||
// {
|
||||
// long ticks = DateTime.Now.Ticks;
|
||||
// string server = GetServer(debugIsNotEC: true);
|
||||
// Logic2019Q3 logic2019Q3 = new Logic2019Q3(_Log);
|
||||
// logic2019Q3.LogPathCleanUpByWeek(server, isEDA: true);
|
||||
// logic2019Q3.LogPathCleanUpByWeek(server, isEAFLog: true);
|
||||
// _Log.Debug(string.Concat("Took ", new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds, " second(s)"));
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
17
EDA Viewer/Models/IHomeController.cs
Normal file
17
EDA Viewer/Models/IHomeController.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace EDAViewer.Models
|
||||
{
|
||||
public interface IHomeController
|
||||
{
|
||||
IActionResult Background(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null, int? invoke_eda_dcp = null);
|
||||
IActionResult Encode(string value = null);
|
||||
IActionResult Error();
|
||||
IActionResult Index();
|
||||
IActionResult Privacy();
|
||||
IActionResult ViewEdaHtmlDiff(WithEnvironment withEnvironment = null);
|
||||
ActionResult<IEnumerable<SelectListItem>> GetDirectoriesOrFiles(string path = null, bool? upDirectory = null, string filter = null);
|
||||
}
|
||||
}
|
14
EDA Viewer/Models/WithEnvironment.cs
Normal file
14
EDA Viewer/Models/WithEnvironment.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace EDAViewer.Models
|
||||
{
|
||||
|
||||
public class WithEnvironment
|
||||
{
|
||||
|
||||
public string message { get; set; }
|
||||
public string user_name { get; set; }
|
||||
public string machine_name { get; set; }
|
||||
public long now_ticks { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
33
EDA Viewer/Program.cs
Normal file
33
EDA Viewer/Program.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Shared;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace EDAViewer
|
||||
{
|
||||
|
||||
public class Program
|
||||
{
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
||||
{
|
||||
IHostBuilder result;
|
||||
IsEnvironment isEnvironment = new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached);
|
||||
result = Host.CreateDefaultBuilder(args)
|
||||
.UseWindowsService()
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
3
EDA Viewer/Properties/AssemblyInfo.cs
Normal file
3
EDA Viewer/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,3 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("EDA Viewer.Tests")]
|
53
EDA Viewer/Shared/EquipmentType.cs
Normal file
53
EDA Viewer/Shared/EquipmentType.cs
Normal file
@ -0,0 +1,53 @@
|
||||
namespace Shared
|
||||
{
|
||||
|
||||
public enum EquipmentType
|
||||
{
|
||||
FileEquipment,
|
||||
SemiEquipment,
|
||||
//
|
||||
DEP08EGANAIXG5,
|
||||
//
|
||||
MET08ANLYSDIFAAST230_Semi,
|
||||
MET08DDUPSFS6420,
|
||||
MET08DDUPSP1TBI,
|
||||
MET08RESIHGCV,
|
||||
MET08RESIMAPCDE,
|
||||
MET08THFTIRQS408M,
|
||||
MET08THFTIRSTRATUS,
|
||||
//
|
||||
MET08AFMD3100,
|
||||
MET08BVHGPROBE,
|
||||
MET08CVHGPROBE802B150,
|
||||
MET08CVHGPROBE802B150_Monthly,
|
||||
MET08CVHGPROBE802B150_Weekly,
|
||||
MET08DDINCAN8620,
|
||||
MET08DDINCAN8620_Daily,
|
||||
MET08EBEAMINTEGRITY26,
|
||||
MET08HALLHL5580,
|
||||
MET08HALLHL5580_Monthly,
|
||||
MET08HALLHL5580_Weekly,
|
||||
MET08MESMICROSCOPE,
|
||||
MET08NDFRESIMAP151C,
|
||||
MET08NDFRESIMAP151C_Verification,
|
||||
MET08PLMAPRPM,
|
||||
MET08PLMAPRPM_Daily,
|
||||
MET08PLMAPRPM_Verification,
|
||||
MET08PLMPPLATO,
|
||||
MET08PRFUSB4000,
|
||||
MET08PRFUSB4000_Daily,
|
||||
MET08PRFUSB4000_Monthly,
|
||||
MET08PRFUSB4000_Weekly,
|
||||
MET08PRFUSB4000_Verification,
|
||||
MET08PRFUSB4000_Villach,
|
||||
MET08UVH44GS100M,
|
||||
MET08VPDSUBCON,
|
||||
MET08WGEOMX203641Q,
|
||||
MET08WGEOMX203641Q_Verification,
|
||||
MET08XRDXPERTPROMRDXL,
|
||||
MET08XRDXPERTPROMRDXL_Monthly,
|
||||
MET08XRDXPERTPROMRDXL_Weekly,
|
||||
METBRXRAYJV7300L
|
||||
}
|
||||
|
||||
}
|
171
EDA Viewer/Shared/IsEnvironment.cs
Normal file
171
EDA Viewer/Shared/IsEnvironment.cs
Normal file
@ -0,0 +1,171 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Shared
|
||||
{
|
||||
|
||||
public class IsEnvironment
|
||||
{
|
||||
|
||||
public enum Name
|
||||
{
|
||||
LinuxDevelopment,
|
||||
LinuxProduction,
|
||||
LinuxStaging,
|
||||
OSXDevelopment,
|
||||
OSXProduction,
|
||||
OSXStaging,
|
||||
WindowsDevelopment,
|
||||
WindowsProduction,
|
||||
WindowsStaging
|
||||
}
|
||||
|
||||
public bool DebuggerWasAttachedDuringConstructor { get; private set; }
|
||||
public bool Development { get; private set; }
|
||||
public bool Linux { get; private set; }
|
||||
public bool OSX { get; private set; }
|
||||
public bool Production { get; private set; }
|
||||
public bool Staging { get; private set; }
|
||||
public bool Windows { get; private set; }
|
||||
public string Profile { get; private set; }
|
||||
public string AppSettingsFileName { get; private set; }
|
||||
public string ASPNetCoreEnvironment { get; private set; }
|
||||
|
||||
public IsEnvironment(string testCategory)
|
||||
{
|
||||
if (testCategory.EndsWith(".json"))
|
||||
{
|
||||
Production = testCategory == "appsettings.json";
|
||||
Staging = testCategory.EndsWith(nameof(Staging));
|
||||
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
||||
Development = testCategory.EndsWith(nameof(Development));
|
||||
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
||||
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
|
||||
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
}
|
||||
else
|
||||
{
|
||||
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
|
||||
OSX = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(OSX));
|
||||
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
Linux = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Linux));
|
||||
Staging = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Staging));
|
||||
Windows = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Windows));
|
||||
Production = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Production));
|
||||
Development = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Development));
|
||||
}
|
||||
Profile = GetProfile();
|
||||
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
|
||||
}
|
||||
|
||||
public IsEnvironment(bool isDevelopment, bool isStaging, bool isProduction)
|
||||
{
|
||||
Staging = isStaging;
|
||||
Production = isProduction;
|
||||
Development = isDevelopment;
|
||||
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
||||
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
||||
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
|
||||
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
Profile = GetProfile();
|
||||
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
|
||||
}
|
||||
|
||||
public IsEnvironment(int? processesCount, bool nullASPNetCoreEnvironmentIsDevelopment, bool nullASPNetCoreEnvironmentIsProduction)
|
||||
{
|
||||
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
||||
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
||||
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
|
||||
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
if (nullASPNetCoreEnvironmentIsDevelopment && nullASPNetCoreEnvironmentIsProduction)
|
||||
throw new Exception();
|
||||
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsProduction)
|
||||
Production = true;
|
||||
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsDevelopment)
|
||||
Development = true;
|
||||
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && !nullASPNetCoreEnvironmentIsDevelopment && !nullASPNetCoreEnvironmentIsProduction)
|
||||
throw new Exception();
|
||||
else
|
||||
{
|
||||
Staging = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Staging));
|
||||
Production = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Production));
|
||||
Development = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Development));
|
||||
}
|
||||
Profile = GetProfile();
|
||||
AppSettingsFileName = GetAppSettingsFileName(processesCount);
|
||||
}
|
||||
|
||||
private string GetProfile()
|
||||
{
|
||||
string result;
|
||||
if (Windows && Production)
|
||||
result = nameof(Production);
|
||||
else if (Windows && Staging)
|
||||
result = nameof(Staging);
|
||||
else if (Windows && Development)
|
||||
result = nameof(Development);
|
||||
else if (Linux && Production)
|
||||
result = nameof(Name.LinuxProduction);
|
||||
else if (Linux && Staging)
|
||||
result = nameof(Name.LinuxStaging);
|
||||
else if (Linux && Development)
|
||||
result = nameof(Name.LinuxDevelopment);
|
||||
else if (OSX && Production)
|
||||
result = nameof(Name.OSXProduction);
|
||||
else if (OSX && Staging)
|
||||
result = nameof(Name.OSXStaging);
|
||||
else if (OSX && Development)
|
||||
result = nameof(Name.OSXDevelopment);
|
||||
else
|
||||
throw new Exception();
|
||||
return result;
|
||||
}
|
||||
|
||||
private string GetAppSettingsFileName(int? processesCount)
|
||||
{
|
||||
string result;
|
||||
if (Production)
|
||||
{
|
||||
if (processesCount is null)
|
||||
result = "appsettings.json";
|
||||
else
|
||||
result = $"appsettings.{processesCount}.json";
|
||||
}
|
||||
else
|
||||
{
|
||||
string environment;
|
||||
if (Staging)
|
||||
environment = nameof(Staging);
|
||||
else if (Development)
|
||||
environment = nameof(Development);
|
||||
else
|
||||
throw new Exception();
|
||||
if (processesCount is null)
|
||||
result = $"appsettings.{environment}.json";
|
||||
else
|
||||
result = $"appsettings.{environment}.{processesCount}.json";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string GetEnvironmentName(IsEnvironment isEnvironment)
|
||||
{
|
||||
string result;
|
||||
if (isEnvironment.Windows)
|
||||
result = nameof(IsEnvironment.Windows);
|
||||
else if (isEnvironment.Linux)
|
||||
result = nameof(IsEnvironment.Linux);
|
||||
else if (isEnvironment.OSX)
|
||||
result = nameof(IsEnvironment.OSX);
|
||||
else
|
||||
throw new Exception();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
96
EDA Viewer/Shared/RijndaelEncryption.cs
Normal file
96
EDA Viewer/Shared/RijndaelEncryption.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Shared
|
||||
{
|
||||
|
||||
public static class RijndaelEncryption
|
||||
{
|
||||
/// <summary>
|
||||
/// Change the Inputkey GUID when you use this code in your own program.
|
||||
/// Keep this inputkey very safe and prevent someone from decoding it some way!!
|
||||
/// Generated 2021-08-10
|
||||
/// </summary>
|
||||
internal const string Inputkey = "970CCEF6-4307-4F6A-9AC8-377DADB889BD";
|
||||
|
||||
/// <summary>
|
||||
/// Encrypt the given text and give the byte array back as a BASE64 string
|
||||
/// </summary>
|
||||
/// <param name="text">The text to encrypt</param>
|
||||
/// <param name="salt">The pasword salt</param>
|
||||
/// <returns>The encrypted text</returns>
|
||||
public static string Encrypt(string text, string salt)
|
||||
{
|
||||
string result;
|
||||
if (string.IsNullOrEmpty(text))
|
||||
throw new ArgumentNullException("text");
|
||||
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
|
||||
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
|
||||
MemoryStream msEncrypt = new MemoryStream();
|
||||
using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
|
||||
using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
|
||||
swEncrypt.Write(text);
|
||||
result = Convert.ToBase64String(msEncrypt.ToArray());
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a string is base64 encoded
|
||||
/// </summary>
|
||||
/// <param name="base64String">The base64 encoded string</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsBase64String(string base64String)
|
||||
{
|
||||
bool result;
|
||||
base64String = base64String.Trim();
|
||||
result = (base64String.Length % 4 == 0) && Regex.IsMatch(base64String, @"^[a-zA-Z0-9\+/]*={0,3}$", RegexOptions.None);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decrypts the given text
|
||||
/// </summary>
|
||||
/// <param name="cipherText">The encrypted BASE64 text</param>
|
||||
/// <param name="salt">The pasword salt</param>
|
||||
/// <returns>De gedecrypte text</returns>
|
||||
public static string Decrypt(string cipherText, string salt)
|
||||
{
|
||||
if (string.IsNullOrEmpty(cipherText))
|
||||
throw new ArgumentNullException("cipherText");
|
||||
if (!IsBase64String(cipherText))
|
||||
throw new Exception("The cipherText input parameter is not base64 encoded");
|
||||
string text;
|
||||
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
|
||||
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
|
||||
byte[] cipher = Convert.FromBase64String(cipherText);
|
||||
using (MemoryStream msDecrypt = new MemoryStream(cipher))
|
||||
{
|
||||
using CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read);
|
||||
using StreamReader srDecrypt = new StreamReader(csDecrypt);
|
||||
text = srDecrypt.ReadToEnd();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new RijndaelManaged class and initialize it
|
||||
/// </summary>
|
||||
/// <param name="salt">The pasword salt</param>
|
||||
/// <returns></returns>
|
||||
private static RijndaelManaged NewRijndaelManaged(string salt)
|
||||
{
|
||||
if (salt == null)
|
||||
throw new ArgumentNullException("salt");
|
||||
byte[] saltBytes = Encoding.ASCII.GetBytes(salt);
|
||||
Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(Inputkey, saltBytes);
|
||||
RijndaelManaged aesAlg = new RijndaelManaged();
|
||||
aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8);
|
||||
aesAlg.IV = key.GetBytes(aesAlg.BlockSize / 8);
|
||||
return aesAlg;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
912
EDA Viewer/Singleton/Background.cs
Normal file
912
EDA Viewer/Singleton/Background.cs
Normal file
@ -0,0 +1,912 @@
|
||||
using EDAViewer.Models;
|
||||
using EDAViewer.Singleton.Helper;
|
||||
using Infineon.Monitoring.MonA;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace EDAViewer.Singleton
|
||||
{
|
||||
|
||||
public partial class Background : IBackground
|
||||
{
|
||||
|
||||
public List<Timer> Timers => _Timers;
|
||||
public string Message { get; private set; }
|
||||
public string WorkingDirectory { get; private set; }
|
||||
public List<Exception> Exceptions { get; private set; }
|
||||
|
||||
private bool _ShuttingDown;
|
||||
private readonly object _Lock;
|
||||
private readonly Calendar _Calendar;
|
||||
private readonly List<Timer> _Timers;
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly string[] _SiEquipmentTypes;
|
||||
private readonly string[] _GaNEquipmentTypes;
|
||||
private readonly IsEnvironment _IsEnvironment;
|
||||
|
||||
private const string _Site = "sjc";
|
||||
|
||||
private Log _Log;
|
||||
private DateTime _PrimaryInstanceSetAt;
|
||||
private string _EdaDataCollectionPlansLastRun;
|
||||
|
||||
public Background(IsEnvironment isEnvironment, AppSettings appSettings, string workingDirectory)
|
||||
{
|
||||
_Log = null;
|
||||
Exceptions = new();
|
||||
_IsEnvironment = isEnvironment;
|
||||
_Lock = new object();
|
||||
_ShuttingDown = false;
|
||||
if (_Lock is null)
|
||||
{ }
|
||||
Message = string.Empty;
|
||||
_AppSettings = appSettings;
|
||||
_Timers = new List<Timer>();
|
||||
_IsEnvironment = isEnvironment;
|
||||
WorkingDirectory = workingDirectory;
|
||||
_PrimaryInstanceSetAt = DateTime.MinValue;
|
||||
_EdaDataCollectionPlansLastRun = string.Empty;
|
||||
_SiEquipmentTypes = GetEquipmentTypes(isGaN: false, isSi: true);
|
||||
_GaNEquipmentTypes = GetEquipmentTypes(isGaN: true, isSi: false);
|
||||
CultureInfo cultureInfo = new CultureInfo("en-US");
|
||||
_Calendar = cultureInfo.Calendar;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (Timer timer in _Timers)
|
||||
timer.Dispose();
|
||||
}
|
||||
|
||||
void IBackground.Update(ILogger<object> logger)
|
||||
{
|
||||
Update(logger);
|
||||
}
|
||||
|
||||
internal void Update(ILogger<object> logger)
|
||||
{
|
||||
_Log = new Log(logger);
|
||||
//https://blog.magnusmontin.net/2018/11/05/platform-conditional-compilation-in-net-core/
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
_Log.Debug("Running on Linux!");
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
_Log.Debug("Running on macOS!");
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
_Log.Debug("Running on Windows!");
|
||||
#if Linux
|
||||
_Log.Debug("Built on Linux!");
|
||||
#elif OSX
|
||||
_Log.Debug("Built on macOS!");
|
||||
#elif Windows
|
||||
_Log.Debug("Built in Windows!");
|
||||
#else
|
||||
()("Built in unkown!");
|
||||
#endif
|
||||
if (string.IsNullOrEmpty(_AppSettings.URLs) && !_IsEnvironment.Development)
|
||||
throw new Exception("Invalid Application Settings URLs!");
|
||||
}
|
||||
|
||||
internal void Catch(Exception exception)
|
||||
{
|
||||
Exceptions.Add(exception);
|
||||
_Log.Error(exception);
|
||||
if (!string.IsNullOrEmpty(_AppSettings.MonARessource))
|
||||
{
|
||||
MonIn monIn = MonIn.GetInstance();
|
||||
monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendStatusOk()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_AppSettings.MonARessource))
|
||||
{
|
||||
MonIn monIn = MonIn.GetInstance();
|
||||
monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Ok);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetCountDirectory(string verb)
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
CultureInfo cultureInfo = new("en-US");
|
||||
Calendar calendar = cultureInfo.Calendar;
|
||||
string weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
//string nameSpace = System.Reflection.Assembly.GetExecutingAssembly().EntryPoint.DeclaringType.Namespace;
|
||||
string nameSpace = GetType().Namespace.Split('.')[0];
|
||||
if (!string.IsNullOrEmpty(_AppSettings.MonARessource))
|
||||
{
|
||||
MonIn monIn = MonIn.GetInstance();
|
||||
monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Up);
|
||||
}
|
||||
return string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA\Counts\", dateTime.ToString("yyyy"), @"\", "Week_", weekOfYear, @"\", dateTime.ToString("yyyy - MM - dd"), @"\", "Application", @"\", nameSpace, @"\", verb, @"\", dateTime.Ticks);
|
||||
}
|
||||
|
||||
public void Stop(bool immediate)
|
||||
{
|
||||
_ShuttingDown = true;
|
||||
foreach (Timer timer in _Timers)
|
||||
timer.Change(Timeout.Infinite, 0);
|
||||
if (!_IsEnvironment.Development)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_AppSettings.MonARessource))
|
||||
{
|
||||
MonIn monIn = MonIn.GetInstance();
|
||||
monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Down);
|
||||
}
|
||||
string countDirectory = GetCountDirectory("Stop");
|
||||
Directory.CreateDirectory(countDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearMessage()
|
||||
{
|
||||
Message = string.Empty;
|
||||
}
|
||||
|
||||
public void SetIsPrimaryInstance()
|
||||
{
|
||||
_PrimaryInstanceSetAt = DateTime.Now;
|
||||
}
|
||||
|
||||
public void ClearIsPrimaryInstance()
|
||||
{
|
||||
_PrimaryInstanceSetAt = DateTime.MinValue;
|
||||
}
|
||||
|
||||
public bool IsPrimaryInstance()
|
||||
{
|
||||
bool result;
|
||||
DateTime dateTime = DateTime.Now.AddDays(-1);
|
||||
result = _PrimaryInstanceSetAt > dateTime;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void EdaDataCollectionPlansCallback()
|
||||
{
|
||||
string cSharpFormat = "yyyy-MM-dd_hh:mm:ss tt";
|
||||
string oracleFormat = "yyyy-MM-dd_hh:mi:ss AM";
|
||||
_Log.Debug(string.Concat("A) _EdaDataCollectionPlansLastRun = ", _EdaDataCollectionPlansLastRun));
|
||||
DataCollectionPlans(_AppSettings, _EdaDataCollectionPlansLastRun, cSharpFormat, oracleFormat);
|
||||
_EdaDataCollectionPlansLastRun = DateTime.Now.ToString(cSharpFormat);
|
||||
_Log.Debug(string.Concat("B) _EdaDataCollectionPlansLastRun = ", _EdaDataCollectionPlansLastRun));
|
||||
}
|
||||
private void DeleteEmptyDirectories(string directory)
|
||||
{
|
||||
string[] files = Directory.GetFiles(directory, "*", SearchOption.AllDirectories);
|
||||
string[] directories = Directory.GetDirectories(directory, "*", SearchOption.AllDirectories);
|
||||
if (files.Length == 0 && directories.Length == 0)
|
||||
Directory.Delete(directory);
|
||||
else
|
||||
{
|
||||
foreach (string subDirectory in Directory.GetDirectories(directory, "*", SearchOption.TopDirectoryOnly))
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
DeleteEmptyDirectories(subDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ZipFilesByDate(string sourceDirectory, SearchOption searchOption = SearchOption.TopDirectoryOnly, string dayFormat = null)
|
||||
{
|
||||
string key;
|
||||
bool addFile;
|
||||
string fileName;
|
||||
string[] segments;
|
||||
string[] subFiles;
|
||||
string weekOfYear;
|
||||
FileInfo fileInfo;
|
||||
DateTime creationTime;
|
||||
DateTime lastWriteTime;
|
||||
Regex regex = new Regex("[a-zA-Z0-9]{1,}");
|
||||
DateTime dateTime = DateTime.Now.AddDays(-6);
|
||||
DateTime firstEmail = new DateTime(2019, 3, 8);
|
||||
CultureInfo cultureInfo = new CultureInfo("en-US");
|
||||
Calendar calendar = cultureInfo.Calendar;
|
||||
int ticksLength = dateTime.Ticks.ToString().Length;
|
||||
Dictionary<string, DateTime> weeks = new Dictionary<string, DateTime>();
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
dateTime = firstEmail.AddDays(i);
|
||||
weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
key = string.Concat(dateTime.ToString("yyyy"), "_Week_", weekOfYear);
|
||||
if (!weeks.ContainsKey(key))
|
||||
weeks.Add(key, dateTime);
|
||||
}
|
||||
weekOfYear = calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
string skipKey = string.Concat(DateTime.Now.ToString("yyyy"), "_Week_", weekOfYear);
|
||||
Dictionary<string, List<string>> keyValuePairs = new Dictionary<string, List<string>>();
|
||||
string[] topDirectories = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
if (topDirectories.Length == 0)
|
||||
topDirectories = new string[] { sourceDirectory };
|
||||
foreach (string topDirectory in topDirectories)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
keyValuePairs.Clear();
|
||||
subFiles = Directory.GetFiles(topDirectory, "*", searchOption);
|
||||
foreach (string subFile in subFiles)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
addFile = false;
|
||||
if (subFile.EndsWith(".zip"))
|
||||
continue;
|
||||
fileName = Path.GetFileName(subFile);
|
||||
fileInfo = new FileInfo(subFile);
|
||||
creationTime = fileInfo.CreationTime;
|
||||
if (creationTime > dateTime)
|
||||
continue;
|
||||
lastWriteTime = fileInfo.LastWriteTime;
|
||||
if (fileName.Contains(lastWriteTime.ToString("yyyyMMdd")) || fileName.Contains(lastWriteTime.ToString("yyyy-MM-dd")) ||
|
||||
fileName.Contains(creationTime.ToString("yyyyMMdd")) || fileName.Contains(creationTime.ToString("yyyy-MM-dd")) ||
|
||||
fileName.Contains(lastWriteTime.ToString("yyMMdd")) || fileName.Contains(lastWriteTime.ToString("yy-MM-dd")) ||
|
||||
fileName.Contains(creationTime.ToString("yyMMdd")) || fileName.Contains(creationTime.ToString("yy-MM-dd")) ||
|
||||
fileName.Contains(lastWriteTime.AddDays(-1).ToString("yyyyMMdd")) || fileName.Contains(lastWriteTime.AddDays(-1).ToString("yyyy-MM-dd")) ||
|
||||
fileName.Contains(creationTime.AddDays(-1).ToString("yyyyMMdd")) || fileName.Contains(creationTime.AddDays(-1).ToString("yyyy-MM-dd")) ||
|
||||
fileName.Contains(lastWriteTime.AddDays(-1).ToString("yyMMdd")) || fileName.Contains(lastWriteTime.AddDays(-1).ToString("yy-MM-dd")) ||
|
||||
fileName.Contains(creationTime.AddDays(-1).ToString("yyMMdd")) || fileName.Contains(creationTime.AddDays(-1).ToString("yy-MM-dd")))
|
||||
addFile = true;
|
||||
if (!addFile && fileName.Length > ticksLength)
|
||||
{
|
||||
MatchCollection matches = regex.Matches(fileName);
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
if (match.Value.Length != ticksLength)
|
||||
continue;
|
||||
if (!long.TryParse(match.Value, out long ticks))
|
||||
continue;
|
||||
addFile = true;
|
||||
break;
|
||||
}
|
||||
if (addFile)
|
||||
break;
|
||||
}
|
||||
if (addFile)
|
||||
{
|
||||
weekOfYear = calendar.GetWeekOfYear(lastWriteTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
if (string.IsNullOrEmpty(dayFormat))
|
||||
key = string.Concat(lastWriteTime.ToString("yyyy"), "_Week_", weekOfYear);
|
||||
else
|
||||
key = string.Concat(lastWriteTime.ToString("yyyy"), "_Week_", weekOfYear, "_", lastWriteTime.ToString(dayFormat));
|
||||
if (key == skipKey)
|
||||
continue;
|
||||
if (!keyValuePairs.ContainsKey(key))
|
||||
keyValuePairs.Add(key, new List<string>());
|
||||
keyValuePairs[key].Add(subFile);
|
||||
}
|
||||
}
|
||||
foreach (KeyValuePair<string, List<string>> element in keyValuePairs)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
key = string.Concat(topDirectory, @"\", element.Key, ".zip");
|
||||
if (File.Exists(key))
|
||||
{
|
||||
for (short i = 101; i < short.MaxValue; i++)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
key = string.Concat(topDirectory, @"\", element.Key, "_", i, ".zip");
|
||||
if (!File.Exists(key))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
lock (_Lock)
|
||||
{
|
||||
using (ZipArchive zip = ZipFile.Open(key, ZipArchiveMode.Create))
|
||||
{
|
||||
foreach (string file in element.Value)
|
||||
{
|
||||
zip.CreateEntryFromFile(file, Path.GetFileName(file));
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
subFiles = Directory.GetFiles(topDirectory, "*.zip", SearchOption.TopDirectoryOnly);
|
||||
foreach (string subFile in subFiles)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
fileName = Path.GetFileNameWithoutExtension(subFile);
|
||||
segments = fileName.Split('_');
|
||||
if (segments.Length > 2)
|
||||
fileName = string.Concat(segments[0], '_', segments[1], '_', segments[2]);
|
||||
if (weeks.ContainsKey(fileName))
|
||||
{
|
||||
try
|
||||
{ File.SetLastWriteTime(subFile, weeks[fileName]); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
if (topDirectory != sourceDirectory)
|
||||
try
|
||||
{ DeleteEmptyDirectories(topDirectory); }
|
||||
catch (Exception) { }
|
||||
//Print(topDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogPathCleanUpByWeek(string server, bool isEDA = false, bool isNA = false)
|
||||
{
|
||||
if (isEDA && isNA)
|
||||
throw new Exception();
|
||||
else if (!isEDA && !isNA)
|
||||
throw new Exception();
|
||||
string share;
|
||||
Tuple<string, string>[] tuples;
|
||||
if (isEDA)
|
||||
{
|
||||
share = string.Concat(@"\\", server, @"\ec_eda");
|
||||
tuples = new Tuple<string, string>[]
|
||||
{
|
||||
new Tuple<string, string>(@"\Staging\Traces\MET08ANLYSDIFAAST230\LogFile", string.Empty),
|
||||
//new Tuple<string, string>(@"\Staging\Traces\DEP08EGANAIXG5HT\R69-HSMS\LogFile", "yyyy_MM_dd"),
|
||||
//new Tuple<string, string>(@"\Staging\Traces\DEP08EGANAIXG5\LogFile\R69-HSMS", "yyyy_MM_dd"),
|
||||
//new Tuple<string, string>(@"\Staging\Traces\DEP08EGANAIXG5HT\R71-HSMS\LogFile", "yyyy_MM_dd"),
|
||||
//new Tuple<string, string>(@"\Staging\Traces\DEP08EGANAIXG5\LogFile\R71-HSMS", "yyyy_MM_dd"),
|
||||
new Tuple<string, string>(@"\Staging\Traces\MET08XRDXPERTPROMRDXL_Monthly\LogFile", string.Empty),
|
||||
new Tuple<string, string>(@"\Staging\Traces\MET08XRDXPERTPROMRDXL_Weekly\LogFile", string.Empty),
|
||||
new Tuple<string, string>(@"\Staging\Traces\MET08DDINCAN8620_Daily\LogFile", string.Empty),
|
||||
new Tuple<string, string>(@"\Staging\Traces\MET08PRFUSB4000\LogFile", string.Empty),
|
||||
};
|
||||
}
|
||||
else if (isNA)
|
||||
throw new Exception();
|
||||
else
|
||||
throw new Exception();
|
||||
string[] files;
|
||||
string weekOfYear;
|
||||
FileInfo fileInfo;
|
||||
string newDirectroy;
|
||||
string sourceDirectory;
|
||||
DateTime lastWriteTime;
|
||||
string[] topDirectories;
|
||||
long twoDays = DateTime.Now.AddDays(-2).Ticks;
|
||||
foreach (Tuple<string, string> tuple in tuples)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
sourceDirectory = string.Concat(share, tuple.Item1);
|
||||
if (!Directory.Exists(sourceDirectory))
|
||||
continue;
|
||||
if (isEDA)
|
||||
topDirectories = new string[] { sourceDirectory };
|
||||
else if (isNA)
|
||||
throw new Exception();
|
||||
else
|
||||
throw new Exception();
|
||||
if (topDirectories.Length == 0)
|
||||
topDirectories = new string[] { sourceDirectory };
|
||||
foreach (string topDirectory in topDirectories)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
files = Directory.GetFiles(topDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
if (file.EndsWith(".zip"))
|
||||
continue;
|
||||
fileInfo = new FileInfo(file);
|
||||
lastWriteTime = fileInfo.LastAccessTime;
|
||||
if (lastWriteTime.Ticks > twoDays)
|
||||
continue;
|
||||
weekOfYear = _Calendar.GetWeekOfYear(lastWriteTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
newDirectroy = string.Concat(topDirectory, @"\", lastWriteTime.ToString("yyyy"), "___Week_", weekOfYear, @"\", lastWriteTime.ToString("yyyy_MM_dd"));
|
||||
if (!Directory.Exists(newDirectroy))
|
||||
Directory.CreateDirectory(newDirectroy);
|
||||
if (!fileInfo.Exists)
|
||||
continue;
|
||||
if (!_ShuttingDown)
|
||||
{
|
||||
lock (_Lock)
|
||||
File.Move(file, string.Concat(newDirectroy, @"\", Path.GetFileName(file)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Tuple<string, string> tuple in tuples)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
sourceDirectory = string.Concat(share, tuple.Item1);
|
||||
if (!Directory.Exists(sourceDirectory))
|
||||
continue;
|
||||
ZipFilesByDate(sourceDirectory, SearchOption.AllDirectories, tuple.Item2);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogPathCleanUpByWeekCallback()
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
if (dateTime.Hour > 8 && dateTime.Hour < 17)
|
||||
{
|
||||
_Log.Debug(string.Concat("A) ", nameof(LogPathCleanUpByWeek)));
|
||||
LogPathCleanUpByWeek(_AppSettings.Server, isEDA: true);
|
||||
_Log.Debug(string.Concat("B) ", nameof(LogPathCleanUpByWeek)));
|
||||
}
|
||||
}
|
||||
|
||||
public void EDAOutputArchive(string sourceDirectory)
|
||||
{
|
||||
string key;
|
||||
string[] files;
|
||||
string[] cellIntaces;
|
||||
string fileWeekOfYear;
|
||||
DateTime fileDateTime;
|
||||
string checkDirectory;
|
||||
string cellInstancesName;
|
||||
string emptyFilesDirectory;
|
||||
int today = DateTime.Now.Day;
|
||||
string recipeArchiveDirectory;
|
||||
Dictionary<string, List<string>> keyValuePairs = new Dictionary<string, List<string>>();
|
||||
string[] equipmentTypes = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string equipmentType in equipmentTypes)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
if (equipmentType.EndsWith(@"\_ Copy") || equipmentType.EndsWith(@"\_ Empty") || equipmentType.EndsWith(@"\CellInstance") || equipmentType.EndsWith(@"\IQS") || equipmentType.EndsWith(@"\Villach"))
|
||||
continue;
|
||||
checkDirectory = string.Concat(equipmentType, @"\Ignore\Recipe");
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
Directory.CreateDirectory(checkDirectory);
|
||||
cellIntaces = Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string cellIntace in cellIntaces)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
keyValuePairs.Clear();
|
||||
cellInstancesName = Path.GetFileName(cellIntace);
|
||||
recipeArchiveDirectory = string.Concat(equipmentType, @"\Ignore\!Archive\Recipe\", cellInstancesName);
|
||||
if (!Directory.Exists(recipeArchiveDirectory))
|
||||
Directory.CreateDirectory(recipeArchiveDirectory);
|
||||
emptyFilesDirectory = string.Concat(equipmentType, @"\Ignore\!Archive\EmptyFiles\", cellInstancesName);
|
||||
if (!Directory.Exists(emptyFilesDirectory))
|
||||
Directory.CreateDirectory(emptyFilesDirectory);
|
||||
files = Directory.GetFiles(cellIntace, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
fileDateTime = new FileInfo(file).LastWriteTime;
|
||||
if (fileDateTime.Day != today)
|
||||
{
|
||||
fileWeekOfYear = _Calendar.GetWeekOfYear(fileDateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
key = string.Concat(fileDateTime.ToString("yyyy-MM-dd"), "_Week_", fileWeekOfYear);
|
||||
if (!keyValuePairs.ContainsKey(key))
|
||||
keyValuePairs.Add(key, new List<string>());
|
||||
keyValuePairs[key].Add(file);
|
||||
}
|
||||
}
|
||||
foreach (KeyValuePair<string, List<string>> element in keyValuePairs)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
lock (_Lock)
|
||||
{
|
||||
key = string.Concat(recipeArchiveDirectory, @"\", element.Key.Split('-')[0]);
|
||||
if (!Directory.Exists(key))
|
||||
Directory.CreateDirectory(key);
|
||||
key = string.Concat(recipeArchiveDirectory, @"\", element.Key.Split('-')[0], @"\", element.Key, ".zip");
|
||||
if (File.Exists(key))
|
||||
{
|
||||
for (short i = 101; i < short.MaxValue; i++)
|
||||
{
|
||||
key = string.Concat(recipeArchiveDirectory, @"\", element.Key.Split('-')[0], @"\", element.Key, "_", i, ".zip");
|
||||
if (!File.Exists(key))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
lock (_Lock)
|
||||
{
|
||||
using ZipArchive zip = ZipFile.Open(key, ZipArchiveMode.Create);
|
||||
foreach (string file in element.Value)
|
||||
{
|
||||
zip.CreateEntryFromFile(file, Path.GetFileName(file));
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void EDAOutputArchiveCallback()
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
if (dateTime.Hour > 8 && dateTime.Hour < 17)
|
||||
{
|
||||
string sourceDirectory = string.Concat(@"\\", _AppSettings.Server, @"\ec_eda\Staging\Traces");
|
||||
if (!Directory.Exists(sourceDirectory))
|
||||
_Log.Debug(string.Concat("// Source directory <", sourceDirectory, "> doesn't exist."));
|
||||
else
|
||||
EDAOutputArchive(sourceDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] GetEquipmentTypes(bool isGaN = false, bool isSi = false)
|
||||
{
|
||||
string[] results;
|
||||
if (isGaN && isSi)
|
||||
throw new Exception();
|
||||
else if (!isGaN && !isSi)
|
||||
isGaN = true;
|
||||
if (isSi)
|
||||
{
|
||||
results = new string[]
|
||||
{
|
||||
Shared.EquipmentType.MET08ANLYSDIFAAST230_Semi.ToString(),
|
||||
Shared.EquipmentType.MET08DDUPSFS6420.ToString(),
|
||||
Shared.EquipmentType.MET08DDUPSP1TBI.ToString(),
|
||||
Shared.EquipmentType.MET08RESIHGCV.ToString(),
|
||||
Shared.EquipmentType.MET08RESIMAPCDE.ToString(),
|
||||
Shared.EquipmentType.MET08THFTIRQS408M.ToString(),
|
||||
Shared.EquipmentType.MET08THFTIRSTRATUS.ToString()
|
||||
};
|
||||
}
|
||||
else if (isGaN)
|
||||
{
|
||||
results = new string[]
|
||||
{
|
||||
Shared.EquipmentType.DEP08EGANAIXG5.ToString(),
|
||||
Shared.EquipmentType.MET08AFMD3100.ToString(),
|
||||
Shared.EquipmentType.MET08BVHGPROBE.ToString(),
|
||||
Shared.EquipmentType.MET08CVHGPROBE802B150.ToString(),
|
||||
Shared.EquipmentType.MET08CVHGPROBE802B150_Monthly.ToString(),
|
||||
Shared.EquipmentType.MET08CVHGPROBE802B150_Weekly.ToString(),
|
||||
Shared.EquipmentType.MET08DDINCAN8620.ToString(),
|
||||
Shared.EquipmentType.MET08DDINCAN8620_Daily.ToString(),
|
||||
Shared.EquipmentType.MET08EBEAMINTEGRITY26.ToString(),
|
||||
Shared.EquipmentType.MET08HALLHL5580.ToString(),
|
||||
Shared.EquipmentType.MET08HALLHL5580_Monthly.ToString(),
|
||||
Shared.EquipmentType.MET08HALLHL5580_Weekly.ToString(),
|
||||
Shared.EquipmentType.MET08MESMICROSCOPE.ToString(),
|
||||
Shared.EquipmentType.MET08NDFRESIMAP151C.ToString(),
|
||||
Shared.EquipmentType.MET08NDFRESIMAP151C_Verification.ToString(),
|
||||
Shared.EquipmentType.MET08PLMAPRPM.ToString(),
|
||||
Shared.EquipmentType.MET08PLMAPRPM_Daily.ToString(),
|
||||
Shared.EquipmentType.MET08PLMAPRPM_Verification.ToString(),
|
||||
Shared.EquipmentType.MET08PLMPPLATO.ToString(),
|
||||
Shared.EquipmentType.MET08PRFUSB4000.ToString(),
|
||||
Shared.EquipmentType.MET08UVH44GS100M.ToString(),
|
||||
Shared.EquipmentType.MET08VPDSUBCON.ToString(),
|
||||
Shared.EquipmentType.MET08WGEOMX203641Q.ToString(),
|
||||
Shared.EquipmentType.MET08WGEOMX203641Q_Verification.ToString(),
|
||||
Shared.EquipmentType.METBRXRAYJV7300L.ToString(),
|
||||
Shared.EquipmentType.MET08XRDXPERTPROMRDXL.ToString(),
|
||||
Shared.EquipmentType.MET08XRDXPERTPROMRDXL_Monthly.ToString(),
|
||||
Shared.EquipmentType.MET08XRDXPERTPROMRDXL_Weekly.ToString()
|
||||
};
|
||||
}
|
||||
else
|
||||
throw new Exception();
|
||||
return results;
|
||||
}
|
||||
|
||||
private Stream ToStream(string @this)
|
||||
{
|
||||
var stream = new MemoryStream();
|
||||
var writer = new StreamWriter(stream);
|
||||
writer.Write(@this);
|
||||
writer.Flush();
|
||||
stream.Position = 0;
|
||||
return stream;
|
||||
}
|
||||
|
||||
private T ParseXML<T>(string @this, bool throwExceptions) where T : class
|
||||
{
|
||||
object result = null;
|
||||
try
|
||||
{
|
||||
Stream stream = ToStream(@this.Trim());
|
||||
var reader = XmlReader.Create(stream, new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document });
|
||||
//XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
|
||||
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T), typeof(T).GetNestedTypes());
|
||||
result = xmlSerializer.Deserialize(reader);
|
||||
stream.Dispose();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (throwExceptions)
|
||||
throw;
|
||||
}
|
||||
return result as T;
|
||||
}
|
||||
|
||||
public void DataCollectionPlans(AppSettings appSettings, string edaDataCollectionPlansLastRun, string cSharpFormat, string oracleFormat)
|
||||
{
|
||||
bool _ShuttingDown = false;
|
||||
object _Lock = new object();
|
||||
bool dev = appSettings.Server.Contains("_ec_");
|
||||
Dictionary<string, Dictionary<ModuleInstanceTypeName, List<List<object>>>> rows = new Dictionary<string, Dictionary<ModuleInstanceTypeName, List<List<object>>>>();
|
||||
//
|
||||
//int moduleinstancetypename = 0;
|
||||
int unitname = 1;
|
||||
//int modulename = 2;
|
||||
int containername = 3;
|
||||
int configurationstate = 4;
|
||||
int configurationproductivestate = 5;
|
||||
//int containermodifiername = 6;
|
||||
int containermodifieddate = 7;
|
||||
int containerconfiguration = 8;
|
||||
int configurationmodifieddate = 9;
|
||||
string objectTypeDirectory;
|
||||
string workingDirectory = string.Concat(@"\\", appSettings.Server, @"\EC_EDA");
|
||||
// ()
|
||||
{
|
||||
object @object;
|
||||
string @string;
|
||||
int fieldCount;
|
||||
List<object> row;
|
||||
string decrypted;
|
||||
string connectionName;
|
||||
string connectionString;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
Array objectTypes = Enum.GetValues(typeof(ModuleInstanceTypeName));
|
||||
List<Tuple<string, string>> connections = new List<Tuple<string, string>>();
|
||||
if (dev)
|
||||
{
|
||||
connectionName = @"DEV";
|
||||
connectionString = EDAViewer.Singleton.Helper.Background.EDADatabase.GetEdaDevelopment();
|
||||
decrypted = RijndaelEncryption.Decrypt(appSettings.IFXEDADatabasePassword, appSettings.Company);
|
||||
connectionString = string.Concat(connectionString, decrypted, ";");
|
||||
connections.Add(new Tuple<string, string>(connectionName, connectionString));
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionName = "Staging";
|
||||
connectionString = EDAViewer.Singleton.Helper.Background.EDADatabase.GetEdaStaging();
|
||||
decrypted = RijndaelEncryption.Decrypt(appSettings.ECEDADatabasePassword, appSettings.Company);
|
||||
connectionString = string.Concat(connectionString, decrypted, ";");
|
||||
connections.Add(new Tuple<string, string>(connectionName, connectionString));
|
||||
connectionName = "Production";
|
||||
connectionString = EDAViewer.Singleton.Helper.Background.EDADatabase.GetEdaProduction();
|
||||
connectionString = string.Concat(connectionString, decrypted, ";");
|
||||
connections.Add(new Tuple<string, string>(connectionName, connectionString));
|
||||
}
|
||||
foreach (Tuple<string, string> connection in connections)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
rows.Add(connection.Item1, new Dictionary<ModuleInstanceTypeName, List<List<object>>>());
|
||||
foreach (ModuleInstanceTypeName objectType in objectTypes)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
if (string.IsNullOrEmpty(edaDataCollectionPlansLastRun))
|
||||
{
|
||||
objectTypeDirectory = string.Concat(workingDirectory, @"\", connection.Item1, @"\", objectType);
|
||||
if (!Directory.Exists(objectTypeDirectory))
|
||||
Directory.CreateDirectory(objectTypeDirectory);
|
||||
else
|
||||
edaDataCollectionPlansLastRun = new DirectoryInfo(objectTypeDirectory).LastWriteTime.ToString(cSharpFormat);
|
||||
}
|
||||
if (!rows[connection.Item1].ContainsKey(objectType))
|
||||
rows[connection.Item1].Add(objectType, new List<List<object>>());
|
||||
using (Oracle.ManagedDataAccess.Client.OracleConnection oracleConnection = new Oracle.ManagedDataAccess.Client.OracleConnection(connection.Item2))
|
||||
{
|
||||
sql.Clear();
|
||||
oracleConnection.Open();
|
||||
sql.Append(" select v.moduleinstancetypename, v.unitname, ").
|
||||
Append(" v.modulename, v.containername, v.configurationstate, ").
|
||||
Append(" v.configurationproductivestate, v.containermodifiername, ").
|
||||
Append(" v.containermodifieddate, v.containerconfiguration, v.configurationmodifieddate ").
|
||||
Append(" from veditconfiguration v ").
|
||||
Append(" where v.moduleinstancetypename = '").Append(objectType.ToString()).Append("' ");
|
||||
//Append(" and v.containerversion in ('4.80', '4.111') ");
|
||||
if (!string.IsNullOrEmpty(edaDataCollectionPlansLastRun))
|
||||
sql.Append(" and greatest(v.containermodifieddate, v.configurationmodifieddate) >= to_date('").Append(edaDataCollectionPlansLastRun).Append("', '").Append(oracleFormat).Append("') ");
|
||||
//Print(sql.ToString());
|
||||
using (Oracle.ManagedDataAccess.Client.OracleCommand oracleCommand = new Oracle.ManagedDataAccess.Client.OracleCommand(sql.ToString(), oracleConnection))
|
||||
{
|
||||
using (Oracle.ManagedDataAccess.Client.OracleDataReader oracleDataReader = oracleCommand.ExecuteReader())
|
||||
{
|
||||
fieldCount = oracleDataReader.FieldCount;
|
||||
while (oracleDataReader.Read())
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
row = new List<object>();
|
||||
for (int c = 0; c < fieldCount; c++)
|
||||
{
|
||||
@object = oracleDataReader.GetValue(c);
|
||||
row.Add(@object);
|
||||
@string = @object.ToString();
|
||||
//if (@string.Length < 128)
|
||||
// _Log.Debug(@string);
|
||||
}
|
||||
rows[connection.Item1][objectType].Add(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rows.Any())
|
||||
{
|
||||
string csv;
|
||||
string xml;
|
||||
string json;
|
||||
string text;
|
||||
string html;
|
||||
Common common;
|
||||
string emptyAPC;
|
||||
string fileName;
|
||||
string edaObjectFile;
|
||||
string goldDirectory;
|
||||
string unitDirectory;
|
||||
string replace = "$$$";
|
||||
string edaObjectDirectory;
|
||||
DateTime lastModifiedDate;
|
||||
DateTime containerModifiedDate;
|
||||
PDSFConfiguration configuration;
|
||||
DateTime configurationModifiedDate;
|
||||
JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true };
|
||||
foreach (KeyValuePair<string, Dictionary<ModuleInstanceTypeName, List<List<object>>>> databaseElement in rows)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
emptyAPC = string.Concat(workingDirectory, @"\", databaseElement.Key, @"\EmptyAPC.xlsx");
|
||||
foreach (KeyValuePair<ModuleInstanceTypeName, List<List<object>>> tableNameElement in databaseElement.Value)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
objectTypeDirectory = string.Concat(workingDirectory, @"\", databaseElement.Key, @"\", tableNameElement.Key);
|
||||
foreach (List<object> rowItem in tableNameElement.Value)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
//foreach (var item in rowItem)
|
||||
// Print(item.ToString());
|
||||
//if (!rowItem[containername].ToString().Contains("Plan_Pdsf_Health_Cp2Mg"))
|
||||
//if (!rowItem[unitname].ToString().Contains("XRD04") || !rowItem[containername].ToString().Contains("Plan_Pdsf"))
|
||||
// continue;
|
||||
containerModifiedDate = DateTime.Parse(rowItem[containermodifieddate].ToString());
|
||||
configurationModifiedDate = DateTime.Parse(rowItem[configurationmodifieddate].ToString());
|
||||
if (containerModifiedDate < configurationModifiedDate)
|
||||
lastModifiedDate = configurationModifiedDate;
|
||||
else
|
||||
lastModifiedDate = containerModifiedDate;
|
||||
goldDirectory = string.Concat(objectTypeDirectory, @"\", rowItem[unitname], @"\", rowItem[containername], @"\Gold");
|
||||
if (!Directory.Exists(goldDirectory))
|
||||
Directory.CreateDirectory(goldDirectory);
|
||||
edaObjectDirectory = string.Concat(objectTypeDirectory, @"\", rowItem[unitname], @"\", rowItem[containername], @"\", rowItem[configurationstate], @"\", rowItem[configurationproductivestate], @"\", lastModifiedDate.ToString("yyyy-MM-dd_"), new TimeSpan(lastModifiedDate.Ticks - new DateTime(lastModifiedDate.Year, lastModifiedDate.Month, lastModifiedDate.Day).Ticks).TotalSeconds);
|
||||
if (!Directory.Exists(edaObjectDirectory))
|
||||
Directory.CreateDirectory(edaObjectDirectory);
|
||||
edaObjectFile = string.Concat(edaObjectDirectory, @"\", rowItem[unitname], " ", rowItem[containername], " - ", replace, " - ", rowItem[configurationstate].ToString(), " ", rowItem[configurationproductivestate].ToString());
|
||||
xml = rowItem[containerconfiguration].ToString();
|
||||
//continue;
|
||||
lock (_Lock)
|
||||
{
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "Raw"), ".xml");
|
||||
File.WriteAllText(fileName, xml);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
common = new Common(ModuleInstanceTypeName.Pdsf, rowItem[unitname], rowItem[containername], rowItem[configurationstate], rowItem[configurationproductivestate]);
|
||||
configuration = ParseXML<PDSFConfiguration>(xml, throwExceptions: true);
|
||||
if (!Directory.Exists(Path.GetPathRoot(configuration.Settings.StoragePath)))
|
||||
continue;
|
||||
if (configuration is null)
|
||||
continue;
|
||||
else
|
||||
{
|
||||
common.Update(configuration);
|
||||
json = JsonSerializer.Serialize(configuration, configuration.GetType(), jsonSerializerOptions);
|
||||
if (!Directory.Exists(common.StoragePath))
|
||||
Directory.CreateDirectory(common.StoragePath);
|
||||
if (!common.StoragePath.Contains(common.UnitName) && (common.StoragePath.Contains(@"01EquipmentIntegration") || common.StoragePath.Contains(@"02BusinessIntegration")))
|
||||
{
|
||||
common.StoragePath = common.StoragePath.Replace("Traces", "Empty");
|
||||
if (!Directory.Exists(common.StoragePath))
|
||||
Directory.CreateDirectory(common.StoragePath);
|
||||
if (common.UnitName != "PRF01")
|
||||
{
|
||||
unitDirectory = string.Concat(Path.GetDirectoryName(common.StoragePath), @"\", common.UnitName);
|
||||
common.StoragePath = string.Concat(unitDirectory, @"\BadPath");
|
||||
if (!Directory.Exists(common.StoragePath))
|
||||
Directory.CreateDirectory(common.StoragePath);
|
||||
common.StoragePath = string.Concat(unitDirectory, @"\LogFile");
|
||||
if (!Directory.Exists(common.StoragePath))
|
||||
Directory.CreateDirectory(common.StoragePath);
|
||||
common.StoragePath = string.Concat(unitDirectory, @"\PollPath");
|
||||
if (!Directory.Exists(common.StoragePath))
|
||||
Directory.CreateDirectory(common.StoragePath);
|
||||
}
|
||||
}
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".csv");
|
||||
File.WriteAllText(fileName, common.ParametersAsCsv);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".json");
|
||||
File.WriteAllText(fileName, json);
|
||||
text = EDAViewer.Singleton.Helper.Background.EdaDCP.GetText(edaObjectFile, common, json);
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".txt");
|
||||
File.WriteAllText(fileName, text);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
html = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToHtml(edaObjectFile, common);
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".html");
|
||||
File.WriteAllText(fileName, html);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
xml = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToDMSGridFormat(edaObjectFile, common, useAlias: false);
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "DMSGridFormat"), ".xml");
|
||||
File.WriteAllText(fileName, xml);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
xml = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToDMSGridFormat(edaObjectFile, common, useAlias: true);
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "DMSGridFormat - Alias"), ".xml");
|
||||
File.WriteAllText(fileName, xml);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
csv = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToAPCParameter(edaObjectFile, common);
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "APCParameter"), ".csv");
|
||||
File.WriteAllText(fileName, csv);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
csv = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToAPCRunKeyNumber(edaObjectFile, common);
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "APCRunKeyNumber"), ".csv");
|
||||
File.WriteAllText(fileName, csv);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "APC"), ".xlsx");
|
||||
if (File.Exists(emptyAPC) && !File.Exists(fileName))
|
||||
{
|
||||
File.Copy(emptyAPC, fileName);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try
|
||||
{ Directory.SetLastWriteTime(objectTypeDirectory, DateTime.Now); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
3821
EDA Viewer/Singleton/Helper/BackgroundEDA - A.cs
Normal file
3821
EDA Viewer/Singleton/Helper/BackgroundEDA - A.cs
Normal file
File diff suppressed because it is too large
Load Diff
29
EDA Viewer/Singleton/Helper/BackgroundEDADatabase.cs
Normal file
29
EDA Viewer/Singleton/Helper/BackgroundEDADatabase.cs
Normal file
@ -0,0 +1,29 @@
|
||||
namespace EDAViewer.Singleton.Helper
|
||||
{
|
||||
|
||||
public partial class Background
|
||||
{
|
||||
|
||||
public partial class EDADatabase
|
||||
{
|
||||
|
||||
public static string GetEdaDevelopment()
|
||||
{
|
||||
return "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimest-db.mes.infineon.com)(port=7001)))(connect_data=(sid=fimest))); User Id=edatest; Password=";
|
||||
}
|
||||
|
||||
public static string GetEdaStaging()
|
||||
{
|
||||
return "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimess-db.ec.local)(port=7001)))(connect_data=(sid=fimess))); User Id=edastag; Password=";
|
||||
}
|
||||
|
||||
public static string GetEdaProduction()
|
||||
{
|
||||
return "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimesp-db.ec.local)(port=7002)))(connect_data=(sid=fimesp))); User Id=edaprod; Password=";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
429
EDA Viewer/Singleton/Helper/BackgroundEdaDCP.cs
Normal file
429
EDA Viewer/Singleton/Helper/BackgroundEdaDCP.cs
Normal file
@ -0,0 +1,429 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace EDAViewer.Singleton.Helper
|
||||
{
|
||||
|
||||
public partial class Background
|
||||
{
|
||||
|
||||
public class EdaDCP
|
||||
{
|
||||
|
||||
internal static string GetEdaObjectToHtml(string edaObjectFile, Common common)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
string title = string.Concat(Path.GetFileName(edaObjectFile), " - ", common.Source);
|
||||
result.AppendLine("<!DOCTYPE html>");
|
||||
result.AppendLine("<html lang=\"en\">");
|
||||
result.AppendLine("<head>");
|
||||
result.AppendLine("<style>table, th, td{border:1px solid black;} td{padding:2px}</style>");
|
||||
result.Append("<title>").Append(title).AppendLine("</title>");
|
||||
result.AppendLine("</head>");
|
||||
result.AppendLine("<body>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Unit Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Container Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Configuration State").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Configuration Productive State").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("LogisticsEquipmentAlias").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Source").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("StoragePath").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("StartTimeFormat").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Filename").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<td nowrap>").Append(common.UnitName).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.ContainerName).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.ConfigurationState).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.ConfigurationProductiveState).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.LogisticsEquipmentAlias).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.Source).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.StoragePath).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.StartTimeFormat).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.Filename).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Use").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Order").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Key").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Placeholder").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.LogisticsAttributes)
|
||||
{
|
||||
if (item.Length > 2 && !item[2].StartsWith("Z_"))
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("ID").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Prefix").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.LogisticsColumns)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Use").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Order").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("FullName").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Alias").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("HardWareId").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Description").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Virtual").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Column#").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.Parameters)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Parent Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("ParameterName").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.GeneralTriggers)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("ResolveGlobalVariableBeforeTrigger").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.StartTriggersDCP)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Fixed").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Scenario").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("DefaultJobIndex").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("DefaultCarrierIndex").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("DefaultSlotIndex").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("DataPool").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.LogisticsTriggers)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("<td>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("KeyName").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("ParameterName").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (KeyValuePair<int, string[]> keyValuePair in common.LogisticsTriggersKeysKeyMapping)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in keyValuePair.Value)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("</td>");
|
||||
result.AppendLine("<td>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("LogisticsKey").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Source").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("MappedParameterName").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (KeyValuePair<int, List<string[]>> keyValuePair in common.LogisticsTriggersCallDefinitionAttributes)
|
||||
{
|
||||
foreach (string[] values in keyValuePair.Value)
|
||||
{
|
||||
if (values.Length > 0 && !values[0].StartsWith("Z_"))
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in values)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
}
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("ResolveGlobalVariableBeforeTrigger").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("ResetGlobalVariablesAfterTrigger").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.StopTriggersDCP)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("</body>");
|
||||
result.AppendLine("</html>");
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
private static string ReplaceNull(object @object)
|
||||
{
|
||||
if (@object is null)
|
||||
return string.Empty;
|
||||
else
|
||||
return @object.ToString();
|
||||
}
|
||||
|
||||
private static void TextResolveEntry(StringBuilder result, dynamic expandoObject, int level, string super, int? i, bool group)
|
||||
{
|
||||
level += 1;
|
||||
foreach (dynamic entry in expandoObject)
|
||||
{
|
||||
if (entry.Value is ExpandoObject)
|
||||
TextResolveEntry(result, entry.Value, level, string.Concat(super, " : ", entry.Key), i, group);
|
||||
else
|
||||
{
|
||||
if (!(entry.Value is ICollection<object>))
|
||||
{
|
||||
if (i is null)
|
||||
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("--->").AppendLine(ReplaceNull(entry.Value));
|
||||
else
|
||||
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!group)
|
||||
{
|
||||
for (i = 0; i.Value < entry.Value.Count; i++)
|
||||
{
|
||||
if (entry.Value[i.Value] is ExpandoObject)
|
||||
TextResolveEntry(result, entry.Value[i.Value], level, string.Concat(super, " : ", entry.Key), i.Value, group);
|
||||
else
|
||||
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value[i.Value]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i.Value < entry.Value.Count; i++)
|
||||
{
|
||||
if (!(entry.Value[i.Value] is ExpandoObject))
|
||||
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value[i.Value]));
|
||||
}
|
||||
for (i = 0; i.Value < entry.Value.Count; i++)
|
||||
{
|
||||
if (entry.Value[i.Value] is ExpandoObject)
|
||||
TextResolveEntry(result, entry.Value[i.Value], level, string.Concat(super, " : ", entry.Key), i.Value, group);
|
||||
}
|
||||
}
|
||||
i = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
level -= 1;
|
||||
}
|
||||
|
||||
internal static string GetText(string edaObjectFile, Common common, string json)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
if (result.Length > 0) //Skipping because System.Text.Json changed the way Expando works
|
||||
{
|
||||
string title = string.Concat(Path.GetFileName(edaObjectFile), " - ", common.Source);
|
||||
dynamic expandoObject = JsonSerializer.Deserialize<ExpandoObject>(json);
|
||||
result.AppendLine(title);
|
||||
result.AppendLine("Loop -> \"Normal\"");
|
||||
result.AppendLine(edaObjectFile);
|
||||
result.AppendLine();
|
||||
TextResolveEntry(result, expandoObject, 0, string.Empty, null, group: false);
|
||||
result.AppendLine();
|
||||
result.AppendLine();
|
||||
result.AppendLine();
|
||||
result.AppendLine(title);
|
||||
result.AppendLine("Loop -> \"Grouped\"");
|
||||
result.AppendLine(edaObjectFile);
|
||||
result.AppendLine();
|
||||
TextResolveEntry(result, expandoObject, 0, string.Empty, null, group: true);
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
internal static string GetEdaObjectToDMSGridFormat(string edaObjectFile, Common common, bool useAlias)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
string[] segments;
|
||||
int? recordStart = null;
|
||||
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName);
|
||||
result.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
|
||||
result.Append("<Format Name=\"").Append(name).Append("\">").AppendLine();
|
||||
result.AppendLine(" <General RecordStart=\"\" RecordLength=\"0\" ReadCommand=\"\" DecimalSeparator=\".\">");
|
||||
result.AppendLine(" <RecordTerminator><13><10></RecordTerminator>");
|
||||
result.AppendLine(" <ColumnSeparator><9></ColumnSeparator>");
|
||||
result.AppendLine(" </General>");
|
||||
result.AppendLine(" <Fields>");
|
||||
for (int i = 0; i < common.Parameters.Count; i++)
|
||||
{
|
||||
if (recordStart is null && common.Parameters[i][3] == "RECORD_START")
|
||||
recordStart = i;
|
||||
if (recordStart.HasValue && common.Parameters[i][0] == "True")
|
||||
{
|
||||
if (useAlias && !string.IsNullOrEmpty(common.Parameters[i][3]))
|
||||
name = common.Parameters[i][3].Replace("'", string.Empty);
|
||||
else
|
||||
{
|
||||
segments = common.Parameters[i][2].Split('/');
|
||||
name = segments[segments.Length - 1];
|
||||
}
|
||||
result.Append(" <Field Name=\"").Append(name).Append("\" ColumnNumber=\"").Append(i + common.LogisticsColumns.Count + 2).Append("\" StartPosition=\"\" Length=\"\" DataType=\"Text\" NullReplacement=\"\" />").AppendLine();
|
||||
}
|
||||
}
|
||||
result.AppendLine(" </Fields>");
|
||||
result.AppendLine(" <Conditions>");
|
||||
result.AppendLine(" <Column />");
|
||||
result.AppendLine(" <Row>");
|
||||
result.AppendLine(" <Condition>");
|
||||
result.AppendLine(" <SkipHeaderCount>7</SkipHeaderCount>");
|
||||
result.AppendLine(" <SkipRowFilter>0</SkipRowFilter>");
|
||||
result.AppendLine(" <SkipRowValue>");
|
||||
result.AppendLine(" </SkipRowValue>");
|
||||
result.AppendLine(" </Condition>");
|
||||
result.AppendLine(" </Row>");
|
||||
result.AppendLine(" </Conditions>");
|
||||
result.AppendLine("</Format>");
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
internal static string GetEdaObjectToAPCParameter(string edaObjectFile, Common common)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
string parameter;
|
||||
string[] segments;
|
||||
string parameterSub35;
|
||||
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName);
|
||||
result.AppendLine("ExportFileVersion=1.0.6");
|
||||
result.AppendLine("ExportFromTabsheet=Para");
|
||||
result.AppendLine("FieldName\tLongName\tMatchMode\tEquipment\tName\tPdsfNameConvCol\tPdsfNameDataType\tType\tChamberInfo\tUnifiedPara\tDateFormat\tUsername\tId\tWorkcenterId\tSite\tArea\tWorkcenter\tValidFrom\tValidTo");
|
||||
result.AppendLine("TIME_PREV_DIFF\tTIME_PREV_DIFF\tEXACT\t*\tTIME_PREV_DIFF\t\tNUMERIC\tRUN\t\tTIME_PREV_DIFF\t\tPHARES\t95069\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
|
||||
result.AppendLine("TIME\tTIME\tEXACT\t*\tTIME\t\tNUMERIC\tRUN\t\tTIME\t\tPHARES\t95070\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
|
||||
for (int i = 0; i < common.Parameters.Count; i++)
|
||||
{
|
||||
if (common.Parameters[i][0] == "True")
|
||||
{
|
||||
segments = common.Parameters[i][2].Split('/');
|
||||
parameter = segments[segments.Length - 1];
|
||||
if (parameter.Length < 35)
|
||||
parameterSub35 = parameter;
|
||||
else
|
||||
parameterSub35 = parameter.Substring(0, 35);
|
||||
result.Append(parameterSub35).Append("\tDIVERSE\tEXACT\t*\t").Append(parameterSub35).AppendLine("\t\tNUMERIC\tRUN\t\t\t\tPHARES\t9000000012\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
|
||||
}
|
||||
}
|
||||
result.AppendLine();
|
||||
result.AppendLine();
|
||||
result.AppendLine();
|
||||
for (int i = 0; i < common.Parameters.Count; i++)
|
||||
{
|
||||
if (common.Parameters[i][0] == "True")
|
||||
{
|
||||
segments = common.Parameters[i][2].Split('/');
|
||||
parameter = segments[segments.Length - 1];
|
||||
result.Append(parameter).Append("\tDIVERSE\tEXACT\t*\t").Append(parameter).AppendLine("\t\tNUMERIC\tRUN\t\t\t\tPHARES\t9000000012\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
|
||||
}
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
internal static string GetEdaObjectToAPCRunKeyNumber(string edaObjectFile, Common common)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
string parameter;
|
||||
string[] segments;
|
||||
string parameterSub21;
|
||||
string parameterSub35;
|
||||
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName);
|
||||
result.AppendLine("ExportFileVersion=1.0.6");
|
||||
result.AppendLine("ExportFromTabsheet=Run-Keynumbers");
|
||||
result.AppendLine("FeatureName\tShortName\tChamber\tComments\tVarMode\tPara\tExclude0\tTrigOn1\tTrigOn2\tTrigOn3\tTrigOff1\tTrigOff2\tTrigOff3\tTrigDelay\tTrigNorm\tTrigNvl\tTrigTrg\tAddCondOn\tActive\tFilter1\tFilter2\tFilter3\tFilter4\tUnit\tId\tWorkcenterId\tSite\tArea\tWorkcenter\tUsername\tValidFrom\tValidTo");
|
||||
for (int i = 0; i < common.Parameters.Count; i++)
|
||||
{
|
||||
if (common.Parameters[i][0] == "True")
|
||||
{
|
||||
segments = common.Parameters[i][2].Split('/');
|
||||
parameter = segments[segments.Length - 1];
|
||||
if (parameter.Length < 35)
|
||||
parameterSub35 = parameter;
|
||||
else
|
||||
parameterSub35 = parameter.Substring(0, 35);
|
||||
if (parameter.Length < 21)
|
||||
parameterSub21 = parameter;
|
||||
else
|
||||
parameterSub21 = parameter.Substring(0, 21);
|
||||
result.Append(parameterSub21).Append("_MIN\t").Append(parameterSub21).Append("_MIN\t\t\tMIN\t").Append(parameterSub35).AppendLine("\t0\tTIME\t=\tRUNSTART\tTIME\t=\tRUNEND\t\t\t\t\t\t1\t\t\t\t\t\t-1\t-1\t\t\t\tECPHARES\t5/2/2017 2:44 PM");
|
||||
}
|
||||
}
|
||||
result.AppendLine();
|
||||
result.AppendLine();
|
||||
result.AppendLine();
|
||||
for (int i = 0; i < common.Parameters.Count; i++)
|
||||
{
|
||||
if (common.Parameters[i][0] == "True")
|
||||
{
|
||||
segments = common.Parameters[i][2].Split('/');
|
||||
parameter = segments[segments.Length - 1];
|
||||
result.Append(parameter).Append("_MIN\t").Append(parameter).Append("_MIN\t\t\tMIN\t").Append(parameter).AppendLine("\t0\tTIME\t=\tRUNSTART\tTIME\t=\tRUNEND\t\t\t\t\t\t1\t\t\t\t\t\t-1\t-1\t\t\t\tECPHARES\t5/2/2017 2:44 PM");
|
||||
}
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
164
EDA Viewer/Singleton/Helper/Common.cs
Normal file
164
EDA Viewer/Singleton/Helper/Common.cs
Normal file
@ -0,0 +1,164 @@
|
||||
using EDAViewer.Singleton.Helper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace EDAViewer.Singleton.Helper
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
public class Common
|
||||
{
|
||||
|
||||
public ModuleInstanceTypeName? ObjectType { get; set; }
|
||||
public string ConfigurationState { get; set; }
|
||||
public string ConfigurationProductiveState { get; set; }
|
||||
public string UnitName { get; set; }
|
||||
public string ContainerName { get; set; }
|
||||
//
|
||||
public string StoragePath { get; set; }
|
||||
public string StartTimeFormat { get; set; }
|
||||
public string Filename { get; set; }
|
||||
//
|
||||
public string Source { get; set; }
|
||||
public string LogisticsEquipmentAlias { get; set; }
|
||||
public List<string[]> LogisticsAttributes { get; set; }
|
||||
public List<string[]> LogisticsColumns { get; set; }
|
||||
public List<string[]> Parameters { get; set; }
|
||||
public string ParametersAsCsv { get; set; }
|
||||
public List<string[]> GeneralTriggers { get; set; }
|
||||
public List<string[]> StartTriggersDCP { get; set; }
|
||||
public List<string[]> LogisticsTriggers { get; set; }
|
||||
public Dictionary<int, string[]> LogisticsTriggersKeysKeyMapping { get; set; }
|
||||
public Dictionary<int, List<string[]>> LogisticsTriggersCallDefinitionAttributes { get; set; }
|
||||
public List<string[]> StopTriggersDCP { get; set; }
|
||||
|
||||
[Obsolete("Only for DeserializeObject")]
|
||||
public Common()
|
||||
{
|
||||
ObjectType = null;
|
||||
ConfigurationState = string.Empty;
|
||||
ConfigurationProductiveState = string.Empty;
|
||||
UnitName = string.Empty;
|
||||
ContainerName = string.Empty;
|
||||
CommonLogic();
|
||||
}
|
||||
|
||||
public Common(ModuleInstanceTypeName objectType, object unitName, object containerName, object configurationState, object configurationProductiveState)
|
||||
{
|
||||
ObjectType = objectType;
|
||||
ConfigurationState = configurationState.ToString();
|
||||
ConfigurationProductiveState = configurationProductiveState.ToString();
|
||||
UnitName = unitName.ToString();
|
||||
ContainerName = containerName.ToString();
|
||||
CommonLogic(configurationState.ToString(), configurationProductiveState.ToString(), unitName.ToString(), containerName.ToString());
|
||||
}
|
||||
|
||||
private void CommonLogic(string configurationState = "", string configurationProductiveState = "", string unitName = "", string containerame = "")
|
||||
{
|
||||
LogisticsAttributes = new List<string[]>();
|
||||
LogisticsColumns = new List<string[]>();
|
||||
Parameters = new List<string[]>();
|
||||
ParametersAsCsv = string.Empty;
|
||||
GeneralTriggers = new List<string[]>();
|
||||
StartTriggersDCP = new List<string[]>();
|
||||
LogisticsTriggers = new List<string[]>();
|
||||
LogisticsTriggersKeysKeyMapping = new Dictionary<int, string[]>();
|
||||
LogisticsTriggersCallDefinitionAttributes = new Dictionary<int, List<string[]>>();
|
||||
StopTriggersDCP = new List<string[]>();
|
||||
}
|
||||
|
||||
public void Update(PDSFConfiguration configuration)
|
||||
{
|
||||
StoragePath = configuration.Settings.StoragePath;
|
||||
StartTimeFormat = configuration.Settings.StartTimeFormat;
|
||||
Filename = configuration.Settings.Filename;
|
||||
//
|
||||
Source = configuration.DataCollection.Source;
|
||||
LogisticsEquipmentAlias = configuration.DataCollection.Logistics.EquipmentAlias;
|
||||
//if (LogisticsEquipmentAlias == "R47-PLC")
|
||||
//{ }
|
||||
foreach (PDSFConfigurationDataCollectionLogisticsAttribute item in (from l in configuration.DataCollection.Logistics.Attributes orderby l.Use descending, l.Order select l))
|
||||
LogisticsAttributes.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.Key, item.Placeholder });
|
||||
foreach (PDSFConfigurationDataCollectionLogisticsColumn item in configuration.DataCollection.Logistics.Columns)
|
||||
LogisticsColumns.Add(new string[] { item.ID.ToString(), item.Prefix });
|
||||
foreach (PDSFConfigurationDataCollectionParameter1 item in (from l in configuration.DataCollection.VirtualParameters orderby l.Use descending, l.Order select l))
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.Alias) && !string.IsNullOrEmpty(item.Conditions.ConditionModel.Name))
|
||||
{
|
||||
if (item.Use)
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
else
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, string.Empty, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.Use)
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
else
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, string.Empty, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
}
|
||||
}
|
||||
foreach (PDSFConfigurationDataCollectionParameter item in (from l in configuration.DataCollection.Parameters orderby l.Use descending, l.Order select l))
|
||||
{
|
||||
if (string.IsNullOrEmpty(item?.Alias) && !string.IsNullOrEmpty(item?.Conditions?.ConditionModel?.Name))
|
||||
{
|
||||
if (item.Use)
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
else
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, string.Empty, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.Use)
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
else
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, string.Empty, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
}
|
||||
}
|
||||
Parameters = (from l in Parameters orderby l[0] descending, l[1] select l).ToList();
|
||||
StringBuilder text = new StringBuilder();
|
||||
//text.AppendLine("\"AliasName\";\"Condition\";\"EventId\";\"ExceptionId\";\"Formula\";\"HardwareId\";\"OrderId\";\"ParameterName\";\"Remark\";\"ReportName\";\"SourceId\";\"Use\"");
|
||||
//"Test";"";"";"";"";"";"1";"MICROSCOPE01/MET08MESMICROSCOPE/Test";"";"MICROSCOPE01/MET08MESMICROSCOPE/FileRead";"";"True""
|
||||
text.AppendLine("\"Use\";\"OrderId\";\"ReportName\";\"ParameterName\";\"AliasName\";\"HardwareId\";\"Remark\";\"Formula\"");
|
||||
foreach (string[] item in Parameters)
|
||||
{
|
||||
for (int i = 0; i < 7; i++)
|
||||
text.Append("\"").Append(item[i]).Append("\";");
|
||||
text.Remove(text.Length - 1, 1);
|
||||
text.AppendLine();
|
||||
}
|
||||
ParametersAsCsv = text.ToString();
|
||||
foreach (PDSFConfigurationDataCollectionGeneralTriggers item in configuration.DataCollection.GeneralTriggers)
|
||||
{
|
||||
foreach (PDSFConfigurationDataCollectionGeneralTriggersVariableModel gv in item.GlobalVariables)
|
||||
GeneralTriggers.Add(new string[] { item.Name, gv.Name, gv.ParameterName, gv.Formula });
|
||||
}
|
||||
{
|
||||
PDSFConfigurationDataCollectionStartTriggersDCP item = configuration.DataCollection.StartTriggers.DCP;
|
||||
if (!(item is null))
|
||||
StartTriggersDCP.Add(new string[] { item.Name, item.Rule, item.ResolveGlobalVariableBeforeTrigger.ToString() });
|
||||
}
|
||||
if (!(configuration.DataCollection.Logistics.Triggers.UpdateTrigger is null))
|
||||
{
|
||||
foreach (PDSFConfigurationDataCollectionLogisticsTriggersUpdateTriggerLogisticRequest item in configuration.DataCollection.Logistics.Triggers.UpdateTrigger.LogisticRequest)
|
||||
{
|
||||
LogisticsTriggers.Add(new string[] { item.Name.ToString(), item.LogisticsColumn.Fixed.ToString(), item.Rule, item.Keys.Scenario, item.Keys.DefaultJobIndex.ToString(), item.Keys.DefaultCarrierIndex.ToString(), item.Keys.DefaultSlotIndex.ToString(), item.DataPool.ToString() });
|
||||
if (!(item.Keys.KeyMapping is null))
|
||||
LogisticsTriggersKeysKeyMapping.Add(item.Name, new string[] { item.Keys.KeyMapping.KeyName, item.Keys.KeyMapping.ParameterName, item.Keys.KeyMapping.Formula });
|
||||
LogisticsTriggersCallDefinitionAttributes.Add(item.Name, new List<string[]>());
|
||||
foreach (PDSFConfigurationDataCollectionLogisticsTriggersUpdateTriggerLogisticRequestCallDefinitionLogisticCallDefinitionAttribute att in item.CallDefinition.Attributes)
|
||||
LogisticsTriggersCallDefinitionAttributes[item.Name].Add(new string[] { att.LogisticsKey, att.Source, att.MappedParameterName, att.Formula });
|
||||
}
|
||||
}
|
||||
{
|
||||
PDSFConfigurationDataCollectionStopTriggersDCP item = configuration.DataCollection.StopTriggers.DCP;
|
||||
if (!(item is null))
|
||||
StopTriggersDCP.Add(new string[] { item.Name, item.Rule, item.ResolveGlobalVariableBeforeTrigger.ToString(), item.ResetGlobalVariablesAfterTrigger.ToString() });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
8
EDA Viewer/Singleton/Helper/ModuleInstanceTypeName.cs
Normal file
8
EDA Viewer/Singleton/Helper/ModuleInstanceTypeName.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace EDAViewer.Singleton.Helper
|
||||
{
|
||||
public enum ModuleInstanceTypeName
|
||||
{
|
||||
Pdsf
|
||||
}
|
||||
|
||||
}
|
28
EDA Viewer/Singleton/IBackground.cs
Normal file
28
EDA Viewer/Singleton/IBackground.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using EDAViewer.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
|
||||
namespace EDAViewer.Singleton
|
||||
{
|
||||
|
||||
public interface IBackground : Models.IBackground, IDisposable
|
||||
{
|
||||
|
||||
void ClearMessage();
|
||||
void SendStatusOk();
|
||||
string Message { get; }
|
||||
bool IsPrimaryInstance();
|
||||
void SetIsPrimaryInstance();
|
||||
void ClearIsPrimaryInstance();
|
||||
string WorkingDirectory { get; }
|
||||
List<Exception> Exceptions { get; }
|
||||
void Update(ILogger<object> logger);
|
||||
string GetCountDirectory(string verb);
|
||||
void LogPathCleanUpByWeek(string server, bool isEDA = false, bool isNA = false);
|
||||
|
||||
}
|
||||
|
||||
}
|
156
EDA Viewer/Startup.cs
Normal file
156
EDA Viewer/Startup.cs
Normal file
@ -0,0 +1,156 @@
|
||||
using EDAViewer.HostedService;
|
||||
using EDAViewer.Models;
|
||||
using EDAViewer.Singleton;
|
||||
using Helper.Log;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Configuration.Json;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
namespace EDAViewer
|
||||
{
|
||||
|
||||
public class Startup
|
||||
{
|
||||
|
||||
private Background _Background;
|
||||
private AppSettings _AppSettings;
|
||||
private readonly IsEnvironment _IsEnvironment;
|
||||
private readonly IConfiguration _Configuration;
|
||||
private readonly IWebHostEnvironment _WebHostEnvironment;
|
||||
|
||||
public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
|
||||
{
|
||||
_Configuration = configuration;
|
||||
_WebHostEnvironment = webHostEnvironment;
|
||||
_IsEnvironment = new IsEnvironment(webHostEnvironment.IsDevelopment(), webHostEnvironment.IsStaging(), webHostEnvironment.IsProduction());
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
LogLevel defaultLogLevel;
|
||||
LogLevel log4netLogLevel;
|
||||
IConfigurationSection configurationSection;
|
||||
configurationSection = _Configuration.GetSection("Logging:LogLevel:Default");
|
||||
if (configurationSection is null || configurationSection.Value is null)
|
||||
defaultLogLevel = LogLevel.Debug;
|
||||
else if (!Enum.TryParse<LogLevel>(configurationSection.Value, out defaultLogLevel))
|
||||
defaultLogLevel = LogLevel.Debug;
|
||||
configurationSection = _Configuration.GetSection("Logging:LogLevel:Log4netProvider");
|
||||
if (configurationSection is null || configurationSection.Value is null)
|
||||
log4netLogLevel = defaultLogLevel;
|
||||
else if (!Enum.TryParse<LogLevel>(configurationSection.Value, out log4netLogLevel))
|
||||
log4netLogLevel = defaultLogLevel;
|
||||
_AppSettings = _Configuration.Get<AppSettings>();
|
||||
if (!_IsEnvironment.Production)
|
||||
_AppSettings.Server = _AppSettings.Server.Replace('.', '_');
|
||||
if (string.IsNullOrEmpty(_AppSettings.WorkingDirectoryName))
|
||||
throw new Exception("Working directory name must have a value!");
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
string workingDirectory = Log.GetWorkingDirectory(assembly.GetName().Name, _AppSettings.WorkingDirectoryName);
|
||||
services.AddLogging(logging =>
|
||||
{
|
||||
logging.AddProvider(new DebugProvider(defaultLogLevel));
|
||||
logging.AddProvider(new ConsoleProvider(defaultLogLevel));
|
||||
logging.AddProvider(new Log4netProvider(typeof(Startup), log4netLogLevel, workingDirectory));
|
||||
});
|
||||
|
||||
services.AddDirectoryBrowser();
|
||||
services.AddControllersWithViews().AddRazorRuntimeCompilation();
|
||||
services.AddServerSideBlazor();
|
||||
|
||||
// services.AddSingleton<WebClient, WebClient>();
|
||||
// services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
|
||||
_Background = new Background(_IsEnvironment, _AppSettings, workingDirectory);
|
||||
services.AddSingleton<Singleton.IBackground, Background>(b => _Background);
|
||||
services.AddSingleton<AppSettings, AppSettings>(appSettings => _AppSettings);
|
||||
services.AddSingleton<IsEnvironment, IsEnvironment>(isEnvironment => _IsEnvironment);
|
||||
services.AddHostedService(t => new TimedHostedService(_IsEnvironment, _Background, t.GetRequiredService<IServiceProvider>()));
|
||||
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "EDAViewer", Version = "v1" });
|
||||
});
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
if (string.IsNullOrEmpty(_AppSettings.URLs))
|
||||
{
|
||||
Environment.ExitCode = -1;
|
||||
lifetime.StopApplication();
|
||||
}
|
||||
|
||||
app.UseDeveloperExceptionPage();
|
||||
|
||||
app.UseSwagger(c =>
|
||||
{
|
||||
c.SerializeAsV2 = true;
|
||||
});
|
||||
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "EDA Viewer API V1");
|
||||
c.RoutePrefix = string.Empty;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days.
|
||||
// You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
|
||||
app.UseSwagger(c =>
|
||||
{
|
||||
c.SerializeAsV2 = true;
|
||||
});
|
||||
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/EDAViewer/swagger/v1/swagger.json", "EDA Viewer API V1");
|
||||
c.RoutePrefix = string.Empty;
|
||||
});
|
||||
}
|
||||
|
||||
app.UseDirectoryBrowser(new DirectoryBrowserOptions
|
||||
{
|
||||
FileProvider = new PhysicalFileProvider(Path.Combine(env.WebRootPath, "images")),
|
||||
RequestPath = "/MyImages"
|
||||
});
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
//endpoints.MapBlazorHub();
|
||||
endpoints.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
47
EDA Viewer/Views/Home/Background.cshtml
Normal file
47
EDA Viewer/Views/Home/Background.cshtml
Normal file
@ -0,0 +1,47 @@
|
||||
@using EDAViewer.Controllers
|
||||
@{
|
||||
ViewBag.Title = "Background";
|
||||
int i = 0;
|
||||
string homeController = nameof(HomeController).Replace("Controller", string.Empty);
|
||||
}
|
||||
|
||||
<div class="jumbotron">
|
||||
<h1>EDA - @(ViewBag.IsPrimaryInstance) - @(ViewBag.Profile) - @(ViewBag.URLs) - 013</h1>
|
||||
<p class="lead">@(ViewBag.WorkingDirectory)</p>
|
||||
<p class="lead">@(ViewBag.Message)</p>
|
||||
<h1>@(ViewBag.ExceptionsCount)</h1>
|
||||
</div>
|
||||
<div>
|
||||
<ul>
|
||||
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))">Background Message</a></li>
|
||||
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-message_clear="true">Background Message Clear</a></li>
|
||||
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-exceptions_clear="true">Background Exceptions Clear</a></li>
|
||||
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-set_is_primary_instance="true">Background Set Is Primary Instance</a></li>
|
||||
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-set_is_primary_instance="false">Background Clear Primary Instance</a></li>
|
||||
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-invoke_eda_dcp="100">Background Invoke EDA DCP Plans Timer Change</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<p> </p>
|
||||
<hr />
|
||||
<div>
|
||||
<form action="">
|
||||
@foreach (Exception exception in ViewBag.Exceptions)
|
||||
{
|
||||
<p>
|
||||
@Html.Raw(string.Concat("<textarea name=\"message_", i, "\" rows='1' cols='400'>", exception.Message, "</textarea>"));
|
||||
</p>
|
||||
<p>
|
||||
@Html.Raw(string.Concat("<textarea name=\"stackTrace_", i, "\" rows='4' cols='400'>", exception.StackTrace, "</textarea>"));
|
||||
</p>
|
||||
<hr />
|
||||
@(i += 1);
|
||||
}
|
||||
</form>
|
||||
</div>
|
||||
@section scripts {
|
||||
<script>
|
||||
$(function () {
|
||||
console.log("ready!");
|
||||
});
|
||||
</script>
|
||||
}
|
12
EDA Viewer/Views/Home/Index.cshtml
Normal file
12
EDA Viewer/Views/Home/Index.cshtml
Normal file
@ -0,0 +1,12 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<component render-mode="ServerPrerendered" type="typeof(EDAViewer.Blazor.Counter)" />
|
||||
</div>
|
6
EDA Viewer/Views/Home/Privacy.cshtml
Normal file
6
EDA Viewer/Views/Home/Privacy.cshtml
Normal file
@ -0,0 +1,6 @@
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
182
EDA Viewer/Views/Home/ViewEdaHtmlDiff.cshtml
Normal file
182
EDA Viewer/Views/Home/ViewEdaHtmlDiff.cshtml
Normal file
@ -0,0 +1,182 @@
|
||||
@model EDAViewer.Models.EdaHtmlDiff
|
||||
@{
|
||||
ViewBag.Title = "EDA HTML Diff";
|
||||
string idForm = "Form";
|
||||
string idSubmit = "Submit";
|
||||
string idUp = "Up";
|
||||
string idRoot = "Root";
|
||||
string idRefresh = "Refresh";
|
||||
string background = "Background"; //Background
|
||||
string viewEdaHtmlDiff = "ViewEdaHtmlDiff"; //ViewEdaHtmlDiff
|
||||
string actionNameForForm = nameof(EDAViewer.Controllers.HomeController.ViewEdaHtmlDiff);
|
||||
string actionNameForList = nameof(EDAViewer.Controllers.HomeController.GetDirectoriesOrFiles);
|
||||
string homeController = nameof(EDAViewer.Controllers.HomeController).Replace("Controller", string.Empty);
|
||||
}
|
||||
|
||||
<div class="jumbotron">
|
||||
<h1>@(ViewBag.Message)</h1>
|
||||
</div>
|
||||
<div>
|
||||
@Html.Raw(ViewBag.Diff)
|
||||
<hr />
|
||||
@Html.Raw(ViewBag.OldText)
|
||||
<hr />
|
||||
@Html.Raw(ViewBag.NewText)
|
||||
<hr />
|
||||
<div style="min-height:44px;">
|
||||
<button id="@(idRoot)" style="margin-left: 50px; margin-bottom:10px" class="btn btn-info">Root Directory</button>
|
||||
<button id="@(idUp)" style="margin-left: 50px; margin-bottom:10px" class="btn btn-info">Up Directory</button>
|
||||
<button id="@(idRefresh)" style="margin-left: 50px; margin-bottom:10px" class="btn btn-info">Refresh List</button>
|
||||
</div>
|
||||
@using (Html.BeginForm(actionNameForForm, homeController, FormMethod.Post, new { id = idForm }))
|
||||
{
|
||||
@Html.AntiForgeryToken();
|
||||
@Html.ValidationSummary(true);
|
||||
@Html.HiddenFor(m => m.user_name)
|
||||
@Html.HiddenFor(m => m.machine_name)
|
||||
@Html.HiddenFor(m => m.now_ticks)
|
||||
@Html.HiddenFor(m => m.PathAndFileName)
|
||||
@Html.HiddenFor(m => m.Paths)
|
||||
<p>
|
||||
@Html.LabelFor(m => m.CurrentPath)
|
||||
@Html.DropDownListFor(m => m.CurrentPath, new SelectList(Enumerable.Empty<SelectListItem>()), htmlAttributes: new { style = "min-width:600px" })
|
||||
@Html.ValidationMessageFor(m => m.CurrentPath)
|
||||
</p>
|
||||
<p>
|
||||
@Html.LabelFor(m => m.FileName)
|
||||
@Html.TextBoxFor(m => m.FileName, htmlAttributes: new { style = "min-width:600px" })
|
||||
@Html.ValidationMessageFor(m => m.FileName)
|
||||
</p>
|
||||
<br />
|
||||
<input type="submit" value="Save" id="@(idSubmit)" class="btn btn-default" />
|
||||
}
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li>@Html.RouteLink("View EDA HTML Diff", new { action = viewEdaHtmlDiff, controller = homeController })</li>
|
||||
<li>@Html.RouteLink("Background Invoke EDA DCP Plans Timer Change", new { action = background, controller = homeController, invoke_eda_dcp = 100 })</li>
|
||||
</ul>
|
||||
</div>
|
||||
@section scripts {
|
||||
<script>
|
||||
//
|
||||
function getEncodedLastPath() {
|
||||
var encodedPath;
|
||||
var control = "@(nameof(Model.Paths))";
|
||||
encodedPath = $("#" + control).val().substr(0, $("#" + control).val().lastIndexOf("|"));
|
||||
$("#" + control).val(encodedPath)
|
||||
encodedPath = encodeURIComponent($("#" + control).val());
|
||||
return encodedPath;
|
||||
}
|
||||
//
|
||||
function getEncodedCurrentPath() {
|
||||
var encodedPath;
|
||||
var control = "@(nameof(Model.CurrentPath))";
|
||||
var pathSelected = $("#" + control).val();
|
||||
if (pathSelected == null) {
|
||||
encodedPath = "";
|
||||
}
|
||||
else {
|
||||
$("#@(nameof(Model.FileName))").val($("#" + control + " option:selected").text());
|
||||
$("#@(nameof(Model.PathAndFileName))").val(pathSelected);
|
||||
encodedPath = encodeURIComponent(pathSelected);
|
||||
}
|
||||
return encodedPath;
|
||||
}
|
||||
//
|
||||
function setList(prefix, encodedPath, upDirectory) {
|
||||
var actionName = prefix + "@(actionNameForList)?path=" + encodedPath + "&upDirectory=" + upDirectory + "&filter=";
|
||||
$('select').empty();
|
||||
$("#@(idUp)").hide();
|
||||
$("#@(idRoot)").hide();
|
||||
$("#@(idRefresh)").hide();
|
||||
$("#@(nameof(Model.CurrentPath))").hide();
|
||||
//
|
||||
$.ajax({
|
||||
url: actionName,
|
||||
type: "GET",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
datatype: JSON,
|
||||
success: function (result) {
|
||||
if (result.length > 7000) {
|
||||
setList("../", encodedPath, upDirectory);
|
||||
}
|
||||
else {
|
||||
var control = "@(nameof(Model.CurrentPath))";
|
||||
$(result).each(function (index, value) {
|
||||
$("#" + control).append($("<option></option>").val(value.value).html(value.text));
|
||||
});
|
||||
console.log("results lenght {" + result.length + "}");
|
||||
if (result.length == 1) {
|
||||
console.log("selecting first option");
|
||||
$("select#elem").attr('selectedIndex', 0);
|
||||
console.log("selected first option");
|
||||
}
|
||||
$("#@(nameof(Model.CurrentPath))").show();
|
||||
$("#@(idRefresh)").show();
|
||||
$("#@(idRoot)").show();
|
||||
$("#@(idUp)").show();
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
console.log(data);
|
||||
},
|
||||
always: function (data) {
|
||||
$("#@(nameof(Model.CurrentPath))").show();
|
||||
$("#@(idRefresh)").show();
|
||||
$("#@(idRoot)").show();
|
||||
$("#@(idUp)").show();
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function () {
|
||||
//
|
||||
console.log("ready!");
|
||||
//
|
||||
$("#@(idRefresh)").click(function (e) {
|
||||
$('#message').html('');
|
||||
var encodedPath = getEncodedCurrentPath();
|
||||
setList("", encodedPath, false);
|
||||
});
|
||||
//
|
||||
$("#@(idUp)").click(function (e) {
|
||||
$('#message').html('');
|
||||
var encodedPath = getEncodedLastPath();
|
||||
setList("", encodedPath, true);
|
||||
});
|
||||
//
|
||||
$("#@(idRoot)").click(function (e) {
|
||||
$('#message').html('');
|
||||
var encodedPath = "";
|
||||
setList("", encodedPath, false);
|
||||
});
|
||||
//
|
||||
$("#@(idSubmit)").click(function (e) {
|
||||
//$("#@(idSubmit)").hide();
|
||||
//e.preventDefault();
|
||||
});
|
||||
//
|
||||
$("select").change(function () {
|
||||
var str = "";
|
||||
$("select option:selected").each(function () {
|
||||
str += $(this).text() + " ";
|
||||
});
|
||||
console.debug(str);
|
||||
if (str.length > 0) {
|
||||
var control = "@(nameof(Model.CurrentPath))";
|
||||
var encodedPath = getEncodedCurrentPath();
|
||||
if (encodedPath.length > 0) {
|
||||
var pathsValue =$("#@(nameof(Model.Paths))").val();
|
||||
$("#@(nameof(Model.Paths))").val(pathsValue + "|" + $("#" + control).val());
|
||||
}
|
||||
setList("", encodedPath, false);
|
||||
}
|
||||
}).change();
|
||||
//
|
||||
$("#@(idForm)").removeAttr("novalidate");
|
||||
//
|
||||
setList("", encodeURIComponent("@(Model.CurrentPath.Replace(@"\",@"\\"))"), false);
|
||||
//
|
||||
});
|
||||
</script>
|
||||
}
|
25
EDA Viewer/Views/Shared/Error.cshtml
Normal file
25
EDA Viewer/Views/Shared/Error.cshtml
Normal file
@ -0,0 +1,25 @@
|
||||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
71
EDA Viewer/Views/Shared/_Layout.cshtml
Normal file
71
EDA Viewer/Views/Shared/_Layout.cshtml
Normal file
@ -0,0 +1,71 @@
|
||||
@using EDAViewer.Controllers
|
||||
@{
|
||||
string index = nameof(HomeController.Index);
|
||||
string privacy = nameof(HomeController.Privacy);
|
||||
string background = nameof(HomeController.Background);
|
||||
string homeController = nameof(HomeController).Replace("Controller", string.Empty);
|
||||
string schemeHostURL = string.Concat(Context.Request.Scheme, "://", Context.Request.Host);
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
@await RenderSectionAsync("Meta", required: false)
|
||||
<title>@ViewData["Title"] - EDAViewer</title>
|
||||
|
||||
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
|
||||
|
||||
<environment exclude="Staging,Development">
|
||||
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="@(schemeHostURL)/Common%20Shared%20Repository/HTML5Shiv/3.7.2/html5shiv.js"></script>
|
||||
<script src="@(schemeHostURL)/Common%20Shared%20Repository/Respond/1.4.2/respond.js"></script>
|
||||
<![endif]-->
|
||||
</environment>
|
||||
|
||||
<link href="~/css/bundles/css.css" rel="stylesheet" />
|
||||
<base href="~/" />
|
||||
@await RenderSectionAsync("Style", required: false)
|
||||
|
||||
<script src="~/js/bundles/modernizr.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" asp-area="" asp-controller="@(homeController)" asp-action="@(index)">EDA Viewer</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="@(homeController)" asp-action="@(background)">Background</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div class="container body-content">
|
||||
@RenderBody()
|
||||
</div>
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2021 - EDAViewer - <a asp-area="" asp-controller="@(homeController)" asp-action="@(privacy)">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/js/bundles/jquery.js"></script>
|
||||
<script src="~/js/bundles/bootstrap.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
<!--script src="_framework/blazor.server.js" asp-append-version="true"></script-->
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
2
EDA Viewer/Views/Shared/_ValidationScriptsPartial.cshtml
Normal file
2
EDA Viewer/Views/Shared/_ValidationScriptsPartial.cshtml
Normal file
@ -0,0 +1,2 @@
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
3
EDA Viewer/Views/_ViewImports.cshtml
Normal file
3
EDA Viewer/Views/_ViewImports.cshtml
Normal file
@ -0,0 +1,3 @@
|
||||
@using EDAViewer
|
||||
@using EDAViewer.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
3
EDA Viewer/Views/_ViewStart.cshtml
Normal file
3
EDA Viewer/Views/_ViewStart.cshtml
Normal file
@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
19
EDA Viewer/appsettings.Development.json
Normal file
19
EDA Viewer/appsettings.Development.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"Company": "Infineon Technologies Americas Corp.",
|
||||
"ECEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
|
||||
"EncryptedPassword": "K1RyLhaIRyJTDbWutsuWWEiO2hTD3h7fW0BV/Cp+Ftw=",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"Microsoft": "Warning",
|
||||
"Log4netProvider": "Debug",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"IFXEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
|
||||
"MonARessource": "EDA_Viewer_IFX",
|
||||
"Server": "messv02ecc1_ec_local",
|
||||
"ServiceUser": "mesedasvc",
|
||||
"URLs": "http://localhost:5000;",
|
||||
"WorkingDirectoryName": "IFXApps"
|
||||
}
|
19
EDA Viewer/appsettings.Staging.json
Normal file
19
EDA Viewer/appsettings.Staging.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"Company": "Infineon Technologies Americas Corp.",
|
||||
"ECEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
|
||||
"EncryptedPassword": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00=",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Log4netProvider": "Information",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"IFXEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
|
||||
"MonARessource": "EDA_Viewer_EC",
|
||||
"Server": "messv02ecc1.ec.local",
|
||||
"ServiceUser": "ECMESEAF",
|
||||
"URLs": "http://localhost:5002;",
|
||||
"WorkingDirectoryName": "IFXApps"
|
||||
}
|
19
EDA Viewer/appsettings.json
Normal file
19
EDA Viewer/appsettings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"Company": "Infineon Technologies Americas Corp.",
|
||||
"ECEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
|
||||
"EncryptedPassword": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00=",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Log4netProvider": "Information",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"IFXEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
|
||||
"MonARessource": "EDA_Viewer_EC",
|
||||
"Server": "messv02ecc1.ec.local",
|
||||
"ServiceUser": "ECMESEAF",
|
||||
"URLs": "http://localhost:5002;",
|
||||
"WorkingDirectoryName": "IFXApps"
|
||||
}
|
1
EDA Viewer/wwwroot/css/bundles/css.css
Normal file
1
EDA Viewer/wwwroot/css/bundles/css.css
Normal file
File diff suppressed because one or more lines are too long
71
EDA Viewer/wwwroot/css/site.css
Normal file
71
EDA Viewer/wwwroot/css/site.css
Normal file
@ -0,0 +1,71 @@
|
||||
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
for details on configuring this project to bundle and minify static web assets. */
|
||||
|
||||
a.navbar-brand {
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* Provide sufficient contrast against white background */
|
||||
a {
|
||||
color: #0366d6;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
/* Sticky footer styles
|
||||
-------------------------------------------------- */
|
||||
html {
|
||||
font-size: 14px;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
html {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
button.accept-policy {
|
||||
font-size: 1rem;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
/* Sticky footer styles
|
||||
-------------------------------------------------- */
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
/* Margin bottom by footer height */
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
line-height: 60px; /* Vertically center the text there */
|
||||
}
|
BIN
EDA Viewer/wwwroot/favicon.ico
Normal file
BIN
EDA Viewer/wwwroot/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
BIN
EDA Viewer/wwwroot/images/OnePixel.gif
Normal file
BIN
EDA Viewer/wwwroot/images/OnePixel.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 807 B |
1
EDA Viewer/wwwroot/js/bundles/bootstrap.js
vendored
Normal file
1
EDA Viewer/wwwroot/js/bundles/bootstrap.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
EDA Viewer/wwwroot/js/bundles/jquery.js
vendored
Normal file
1
EDA Viewer/wwwroot/js/bundles/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
EDA Viewer/wwwroot/js/bundles/jqueryval.js
vendored
Normal file
1
EDA Viewer/wwwroot/js/bundles/jqueryval.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
EDA Viewer/wwwroot/js/bundles/modernizr.js
Normal file
1
EDA Viewer/wwwroot/js/bundles/modernizr.js
Normal file
File diff suppressed because one or more lines are too long
520
EDA Viewer/wwwroot/js/html5shiv/3.7.2/html5shiv-printshiv.js
Normal file
520
EDA Viewer/wwwroot/js/html5shiv/3.7.2/html5shiv-printshiv.js
Normal file
@ -0,0 +1,520 @@
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
;(function(window, document) {
|
||||
/*jshint evil:true */
|
||||
/** version */
|
||||
var version = '3.7.2';
|
||||
|
||||
/** Preset options */
|
||||
var options = window.html5 || {};
|
||||
|
||||
/** Used to skip problem elements */
|
||||
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
|
||||
|
||||
/** Not all elements can be cloned in IE **/
|
||||
var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
|
||||
|
||||
/** Detect whether the browser supports default html5 styles */
|
||||
var supportsHtml5Styles;
|
||||
|
||||
/** Name of the expando, to work with multiple documents or to re-shiv one document */
|
||||
var expando = '_html5shiv';
|
||||
|
||||
/** The id for the the documents expando */
|
||||
var expanID = 0;
|
||||
|
||||
/** Cached data for each document */
|
||||
var expandoData = {};
|
||||
|
||||
/** Detect whether the browser supports unknown elements */
|
||||
var supportsUnknownElements;
|
||||
|
||||
(function() {
|
||||
try {
|
||||
var a = document.createElement('a');
|
||||
a.innerHTML = '<xyz></xyz>';
|
||||
//if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
|
||||
supportsHtml5Styles = ('hidden' in a);
|
||||
|
||||
supportsUnknownElements = a.childNodes.length == 1 || (function() {
|
||||
// assign a false positive if unable to shiv
|
||||
(document.createElement)('a');
|
||||
var frag = document.createDocumentFragment();
|
||||
return (
|
||||
typeof frag.cloneNode == 'undefined' ||
|
||||
typeof frag.createDocumentFragment == 'undefined' ||
|
||||
typeof frag.createElement == 'undefined'
|
||||
);
|
||||
}());
|
||||
} catch(e) {
|
||||
// assign a false positive if detection fails => unable to shiv
|
||||
supportsHtml5Styles = true;
|
||||
supportsUnknownElements = true;
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates a style sheet with the given CSS text and adds it to the document.
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @param {String} cssText The CSS text.
|
||||
* @returns {StyleSheet} The style element.
|
||||
*/
|
||||
function addStyleSheet(ownerDocument, cssText) {
|
||||
var p = ownerDocument.createElement('p'),
|
||||
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
|
||||
|
||||
p.innerHTML = 'x<style>' + cssText + '</style>';
|
||||
return parent.insertBefore(p.lastChild, parent.firstChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of `html5.elements` as an array.
|
||||
* @private
|
||||
* @returns {Array} An array of shived element node names.
|
||||
*/
|
||||
function getElements() {
|
||||
var elements = html5.elements;
|
||||
return typeof elements == 'string' ? elements.split(' ') : elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends the built-in list of html5 elements
|
||||
* @memberOf html5
|
||||
* @param {String|Array} newElements whitespace separated list or array of new element names to shiv
|
||||
* @param {Document} ownerDocument The context document.
|
||||
*/
|
||||
function addElements(newElements, ownerDocument) {
|
||||
var elements = html5.elements;
|
||||
if(typeof elements != 'string'){
|
||||
elements = elements.join(' ');
|
||||
}
|
||||
if(typeof newElements != 'string'){
|
||||
newElements = newElements.join(' ');
|
||||
}
|
||||
html5.elements = elements +' '+ newElements;
|
||||
shivDocument(ownerDocument);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data associated to the given document
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @returns {Object} An object of data.
|
||||
*/
|
||||
function getExpandoData(ownerDocument) {
|
||||
var data = expandoData[ownerDocument[expando]];
|
||||
if (!data) {
|
||||
data = {};
|
||||
expanID++;
|
||||
ownerDocument[expando] = expanID;
|
||||
expandoData[expanID] = data;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a shived element for the given nodeName and document
|
||||
* @memberOf html5
|
||||
* @param {String} nodeName name of the element
|
||||
* @param {Document} ownerDocument The context document.
|
||||
* @returns {Object} The shived element.
|
||||
*/
|
||||
function createElement(nodeName, ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createElement(nodeName);
|
||||
}
|
||||
if (!data) {
|
||||
data = getExpandoData(ownerDocument);
|
||||
}
|
||||
var node;
|
||||
|
||||
if (data.cache[nodeName]) {
|
||||
node = data.cache[nodeName].cloneNode();
|
||||
} else if (saveClones.test(nodeName)) {
|
||||
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
|
||||
} else {
|
||||
node = data.createElem(nodeName);
|
||||
}
|
||||
|
||||
// Avoid adding some elements to fragments in IE < 9 because
|
||||
// * Attributes like `name` or `type` cannot be set/changed once an element
|
||||
// is inserted into a document/fragment
|
||||
// * Link elements with `src` attributes that are inaccessible, as with
|
||||
// a 403 response, will cause the tab/window to crash
|
||||
// * Script elements appended to fragments will execute when their `src`
|
||||
// or `text` property is set
|
||||
return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a shived DocumentFragment for the given document
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The context document.
|
||||
* @returns {Object} The shived DocumentFragment.
|
||||
*/
|
||||
function createDocumentFragment(ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createDocumentFragment();
|
||||
}
|
||||
data = data || getExpandoData(ownerDocument);
|
||||
var clone = data.frag.cloneNode(),
|
||||
i = 0,
|
||||
elems = getElements(),
|
||||
l = elems.length;
|
||||
for(;i<l;i++){
|
||||
clone.createElement(elems[i]);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shivs the `createElement` and `createDocumentFragment` methods of the document.
|
||||
* @private
|
||||
* @param {Document|DocumentFragment} ownerDocument The document.
|
||||
* @param {Object} data of the document.
|
||||
*/
|
||||
function shivMethods(ownerDocument, data) {
|
||||
if (!data.cache) {
|
||||
data.cache = {};
|
||||
data.createElem = ownerDocument.createElement;
|
||||
data.createFrag = ownerDocument.createDocumentFragment;
|
||||
data.frag = data.createFrag();
|
||||
}
|
||||
|
||||
|
||||
ownerDocument.createElement = function(nodeName) {
|
||||
//abort shiv
|
||||
if (!html5.shivMethods) {
|
||||
return data.createElem(nodeName);
|
||||
}
|
||||
return createElement(nodeName, ownerDocument, data);
|
||||
};
|
||||
|
||||
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
|
||||
'var n=f.cloneNode(),c=n.createElement;' +
|
||||
'h.shivMethods&&(' +
|
||||
// unroll the `createElement` calls
|
||||
getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
|
||||
data.createElem(nodeName);
|
||||
data.frag.createElement(nodeName);
|
||||
return 'c("' + nodeName + '")';
|
||||
}) +
|
||||
');return n}'
|
||||
)(html5, data.frag);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Shivs the given document.
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The document to shiv.
|
||||
* @returns {Document} The shived document.
|
||||
*/
|
||||
function shivDocument(ownerDocument) {
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
var data = getExpandoData(ownerDocument);
|
||||
|
||||
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
|
||||
data.hasCSS = !!addStyleSheet(ownerDocument,
|
||||
// corrects block display not defined in IE6/7/8/9
|
||||
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
|
||||
// adds styling not present in IE6/7/8/9
|
||||
'mark{background:#FF0;color:#000}' +
|
||||
// hides non-rendered elements
|
||||
'template{display:none}'
|
||||
);
|
||||
}
|
||||
if (!supportsUnknownElements) {
|
||||
shivMethods(ownerDocument, data);
|
||||
}
|
||||
return ownerDocument;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The `html5` object is exposed so that more elements can be shived and
|
||||
* existing shiving can be detected on iframes.
|
||||
* @type Object
|
||||
* @example
|
||||
*
|
||||
* // options can be changed before the script is included
|
||||
* html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
|
||||
*/
|
||||
var html5 = {
|
||||
|
||||
/**
|
||||
* An array or space separated string of node names of the elements to shiv.
|
||||
* @memberOf html5
|
||||
* @type Array|String
|
||||
*/
|
||||
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video',
|
||||
|
||||
/**
|
||||
* current version of html5shiv
|
||||
*/
|
||||
'version': version,
|
||||
|
||||
/**
|
||||
* A flag to indicate that the HTML5 style sheet should be inserted.
|
||||
* @memberOf html5
|
||||
* @type Boolean
|
||||
*/
|
||||
'shivCSS': (options.shivCSS !== false),
|
||||
|
||||
/**
|
||||
* Is equal to true if a browser supports creating unknown/HTML5 elements
|
||||
* @memberOf html5
|
||||
* @type boolean
|
||||
*/
|
||||
'supportsUnknownElements': supportsUnknownElements,
|
||||
|
||||
/**
|
||||
* A flag to indicate that the document's `createElement` and `createDocumentFragment`
|
||||
* methods should be overwritten.
|
||||
* @memberOf html5
|
||||
* @type Boolean
|
||||
*/
|
||||
'shivMethods': (options.shivMethods !== false),
|
||||
|
||||
/**
|
||||
* A string to describe the type of `html5` object ("default" or "default print").
|
||||
* @memberOf html5
|
||||
* @type String
|
||||
*/
|
||||
'type': 'default',
|
||||
|
||||
// shivs the document according to the specified `html5` object options
|
||||
'shivDocument': shivDocument,
|
||||
|
||||
//creates a shived element
|
||||
createElement: createElement,
|
||||
|
||||
//creates a shived documentFragment
|
||||
createDocumentFragment: createDocumentFragment,
|
||||
|
||||
//extends list of elements
|
||||
addElements: addElements
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// expose html5
|
||||
window.html5 = html5;
|
||||
|
||||
// shiv the document
|
||||
shivDocument(document);
|
||||
|
||||
/*------------------------------- Print Shiv -------------------------------*/
|
||||
|
||||
/** Used to filter media types */
|
||||
var reMedia = /^$|\b(?:all|print)\b/;
|
||||
|
||||
/** Used to namespace printable elements */
|
||||
var shivNamespace = 'html5shiv';
|
||||
|
||||
/** Detect whether the browser supports shivable style sheets */
|
||||
var supportsShivableSheets = !supportsUnknownElements && (function() {
|
||||
// assign a false negative if unable to shiv
|
||||
var docEl = document.documentElement;
|
||||
return !(
|
||||
typeof document.namespaces == 'undefined' ||
|
||||
typeof document.parentWindow == 'undefined' ||
|
||||
typeof docEl.applyElement == 'undefined' ||
|
||||
typeof docEl.removeNode == 'undefined' ||
|
||||
typeof window.attachEvent == 'undefined'
|
||||
);
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Wraps all HTML5 elements in the given document with printable elements.
|
||||
* (eg. the "header" element is wrapped with the "html5shiv:header" element)
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @returns {Array} An array wrappers added.
|
||||
*/
|
||||
function addWrappers(ownerDocument) {
|
||||
var node,
|
||||
nodes = ownerDocument.getElementsByTagName('*'),
|
||||
index = nodes.length,
|
||||
reElements = RegExp('^(?:' + getElements().join('|') + ')$', 'i'),
|
||||
result = [];
|
||||
|
||||
while (index--) {
|
||||
node = nodes[index];
|
||||
if (reElements.test(node.nodeName)) {
|
||||
result.push(node.applyElement(createWrapper(node)));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a printable wrapper for the given element.
|
||||
* @private
|
||||
* @param {Element} element The element.
|
||||
* @returns {Element} The wrapper.
|
||||
*/
|
||||
function createWrapper(element) {
|
||||
var node,
|
||||
nodes = element.attributes,
|
||||
index = nodes.length,
|
||||
wrapper = element.ownerDocument.createElement(shivNamespace + ':' + element.nodeName);
|
||||
|
||||
// copy element attributes to the wrapper
|
||||
while (index--) {
|
||||
node = nodes[index];
|
||||
node.specified && wrapper.setAttribute(node.nodeName, node.nodeValue);
|
||||
}
|
||||
// copy element styles to the wrapper
|
||||
wrapper.style.cssText = element.style.cssText;
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shivs the given CSS text.
|
||||
* (eg. header{} becomes html5shiv\:header{})
|
||||
* @private
|
||||
* @param {String} cssText The CSS text to shiv.
|
||||
* @returns {String} The shived CSS text.
|
||||
*/
|
||||
function shivCssText(cssText) {
|
||||
var pair,
|
||||
parts = cssText.split('{'),
|
||||
index = parts.length,
|
||||
reElements = RegExp('(^|[\\s,>+~])(' + getElements().join('|') + ')(?=[[\\s,>+~#.:]|$)', 'gi'),
|
||||
replacement = '$1' + shivNamespace + '\\:$2';
|
||||
|
||||
while (index--) {
|
||||
pair = parts[index] = parts[index].split('}');
|
||||
pair[pair.length - 1] = pair[pair.length - 1].replace(reElements, replacement);
|
||||
parts[index] = pair.join('}');
|
||||
}
|
||||
return parts.join('{');
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the given wrappers, leaving the original elements.
|
||||
* @private
|
||||
* @params {Array} wrappers An array of printable wrappers.
|
||||
*/
|
||||
function removeWrappers(wrappers) {
|
||||
var index = wrappers.length;
|
||||
while (index--) {
|
||||
wrappers[index].removeNode();
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Shivs the given document for print.
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The document to shiv.
|
||||
* @returns {Document} The shived document.
|
||||
*/
|
||||
function shivPrint(ownerDocument) {
|
||||
var shivedSheet,
|
||||
wrappers,
|
||||
data = getExpandoData(ownerDocument),
|
||||
namespaces = ownerDocument.namespaces,
|
||||
ownerWindow = ownerDocument.parentWindow;
|
||||
|
||||
if (!supportsShivableSheets || ownerDocument.printShived) {
|
||||
return ownerDocument;
|
||||
}
|
||||
if (typeof namespaces[shivNamespace] == 'undefined') {
|
||||
namespaces.add(shivNamespace);
|
||||
}
|
||||
|
||||
function removeSheet() {
|
||||
clearTimeout(data._removeSheetTimer);
|
||||
if (shivedSheet) {
|
||||
shivedSheet.removeNode(true);
|
||||
}
|
||||
shivedSheet= null;
|
||||
}
|
||||
|
||||
ownerWindow.attachEvent('onbeforeprint', function() {
|
||||
|
||||
removeSheet();
|
||||
|
||||
var imports,
|
||||
length,
|
||||
sheet,
|
||||
collection = ownerDocument.styleSheets,
|
||||
cssText = [],
|
||||
index = collection.length,
|
||||
sheets = Array(index);
|
||||
|
||||
// convert styleSheets collection to an array
|
||||
while (index--) {
|
||||
sheets[index] = collection[index];
|
||||
}
|
||||
// concat all style sheet CSS text
|
||||
while ((sheet = sheets.pop())) {
|
||||
// IE does not enforce a same origin policy for external style sheets...
|
||||
// but has trouble with some dynamically created stylesheets
|
||||
if (!sheet.disabled && reMedia.test(sheet.media)) {
|
||||
|
||||
try {
|
||||
imports = sheet.imports;
|
||||
length = imports.length;
|
||||
} catch(er){
|
||||
length = 0;
|
||||
}
|
||||
|
||||
for (index = 0; index < length; index++) {
|
||||
sheets.push(imports[index]);
|
||||
}
|
||||
|
||||
try {
|
||||
cssText.push(sheet.cssText);
|
||||
} catch(er){}
|
||||
}
|
||||
}
|
||||
|
||||
// wrap all HTML5 elements with printable elements and add the shived style sheet
|
||||
cssText = shivCssText(cssText.reverse().join(''));
|
||||
wrappers = addWrappers(ownerDocument);
|
||||
shivedSheet = addStyleSheet(ownerDocument, cssText);
|
||||
|
||||
});
|
||||
|
||||
ownerWindow.attachEvent('onafterprint', function() {
|
||||
// remove wrappers, leaving the original elements, and remove the shived style sheet
|
||||
removeWrappers(wrappers);
|
||||
clearTimeout(data._removeSheetTimer);
|
||||
data._removeSheetTimer = setTimeout(removeSheet, 500);
|
||||
});
|
||||
|
||||
ownerDocument.printShived = true;
|
||||
return ownerDocument;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// expose API
|
||||
html5.type += ' print';
|
||||
html5.shivPrint = shivPrint;
|
||||
|
||||
// shiv for print
|
||||
shivPrint(document);
|
||||
|
||||
}(this, document));
|
4
EDA Viewer/wwwroot/js/html5shiv/3.7.2/html5shiv-printshiv.min.js
vendored
Normal file
4
EDA Viewer/wwwroot/js/html5shiv/3.7.2/html5shiv-printshiv.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=y.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=y.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),y.elements=c+" "+a,j(b)}function f(a){var b=x[a[v]];return b||(b={},w++,a[v]=w,x[w]=b),b}function g(a,c,d){if(c||(c=b),q)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():u.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||t.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),q)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return y.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(y,b.frag)}function j(a){a||(a=b);var d=f(a);return!y.shivCSS||p||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),q||i(a,d),a}function k(a){for(var b,c=a.getElementsByTagName("*"),e=c.length,f=RegExp("^(?:"+d().join("|")+")$","i"),g=[];e--;)b=c[e],f.test(b.nodeName)&&g.push(b.applyElement(l(b)));return g}function l(a){for(var b,c=a.attributes,d=c.length,e=a.ownerDocument.createElement(A+":"+a.nodeName);d--;)b=c[d],b.specified&&e.setAttribute(b.nodeName,b.nodeValue);return e.style.cssText=a.style.cssText,e}function m(a){for(var b,c=a.split("{"),e=c.length,f=RegExp("(^|[\\s,>+~])("+d().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),g="$1"+A+"\\:$2";e--;)b=c[e]=c[e].split("}"),b[b.length-1]=b[b.length-1].replace(f,g),c[e]=b.join("}");return c.join("{")}function n(a){for(var b=a.length;b--;)a[b].removeNode()}function o(a){function b(){clearTimeout(g._removeSheetTimer),d&&d.removeNode(!0),d=null}var d,e,g=f(a),h=a.namespaces,i=a.parentWindow;return!B||a.printShived?a:("undefined"==typeof h[A]&&h.add(A),i.attachEvent("onbeforeprint",function(){b();for(var f,g,h,i=a.styleSheets,j=[],l=i.length,n=Array(l);l--;)n[l]=i[l];for(;h=n.pop();)if(!h.disabled&&z.test(h.media)){try{f=h.imports,g=f.length}catch(o){g=0}for(l=0;g>l;l++)n.push(f[l]);try{j.push(h.cssText)}catch(o){}}j=m(j.reverse().join("")),e=k(a),d=c(a,j)}),i.attachEvent("onafterprint",function(){n(e),clearTimeout(g._removeSheetTimer),g._removeSheetTimer=setTimeout(b,500)}),a.printShived=!0,a)}var p,q,r="3.7.2",s=a.html5||{},t=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,u=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,v="_html5shiv",w=0,x={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",p="hidden"in a,q=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){p=!0,q=!0}}();var y={elements:s.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:r,shivCSS:s.shivCSS!==!1,supportsUnknownElements:q,shivMethods:s.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=y,j(b);var z=/^$|\b(?:all|print)\b/,A="html5shiv",B=!q&&function(){var c=b.documentElement;return!("undefined"==typeof b.namespaces||"undefined"==typeof b.parentWindow||"undefined"==typeof c.applyElement||"undefined"==typeof c.removeNode||"undefined"==typeof a.attachEvent)}();y.type+=" print",y.shivPrint=o,o(b)}(this,document);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user