DEP08SIHTRPLC - v2.43.0 - Ready to Test

This commit is contained in:
Mike Phares 2022-07-29 14:57:38 -07:00
parent c567bb44e0
commit 91b162a7eb
108 changed files with 12877 additions and 0 deletions

338
.gitignore vendored Normal file
View File

@ -0,0 +1,338 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
##
## Visual Studio Code
##
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

172
.groovy Normal file
View File

@ -0,0 +1,172 @@
#!/usr/bin/env groovy
/* groovylint-disable CompileStatic, ConsecutiveStringConcatenation, DuplicateNumberLiteral, DuplicateStringLiteral, LineLength, NestedBlockDepth, NoDef, VariableTypeRequired */
import groovy.transform.Field
@Field String _DDrive = 'D:/'
@Field String _AssemblyName = '...'
@Field String _TargetLocation = '...'
@Field String _GitCommitSeven = '...'
@Field String _GitName = 'DEP08SIHTRPLC'
@Field String _TestProjectDirectory = 'Adaptation'
@Field String _AgentStaging = 'mestsa07ec-ecmeseaf'
@Field String _DDriveNet = "${_DDrive}Framework4.8"
@Field String _AgentProduction = 'messa08ec-ecmeseaf'
@Field String _AgentDevelopment = 'mestsa003-mesedasvc'
@Field String _ProgramFilesDotnet = 'C:/Program Files/dotnet/dotnet.exe'
@Field String _ProgramFilesMSBuild = 'C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe'
pipeline {
agent {
label env.JENKINS_ENVIRONMENT == 'Development' ? _AgentDevelopment : env.JENKINS_ENVIRONMENT == 'Staging' ? _AgentStaging : env.JENKINS_ENVIRONMENT == 'Production' ? _AgentProduction : 'Else'
}
parameters {
string(name: 'GIT_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'mestsa003.infineon.com' : 'mestsa07ec.ec.local', description: 'git server')
string(name: 'DEFAULT_FILE_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'messv02ecc1_ec_local' : 'messv02ecc1.ec.local', description: 'Default file server...')
}
stages {
stage('Git') {
steps {
bat(returnStatus: true, script: 'git init')
bat(returnStatus: true, script: 'git remote add origin \\\\' + params.GIT_SERVER + '\\Git\\' + _GitName + '.git')
bat(returnStatus: true, script: 'git pull origin master')
}
}
stage('Setup') {
steps {
script {
_AssemblyName = "${env.JOB_NAME}"
_GitCommitSeven = '1234567'
// _GitCommitSeven = env.GIT_COMMIT.substring(0, 7)
def files = findFiles(glob: '*.csproj')
if (files.length != 1) {
error("Build failed because couldn't find a *.csproj file")
}
echo """
${files[0].name}
${files[0].path}
${files[0].directory}
${files[0].length}
${files[0].lastModified}
"""
_AssemblyName = files[0].name.split('[.]csproj')[0]
_TargetLocation = "\\\\${params.DEFAULT_FILE_SERVER}\\EC_EAFRepository\\${env.JENKINS_ENVIRONMENT}\\DeploymentStorage\\Adaptation_${_AssemblyName}"
}
}
}
stage('Info') {
steps {
echo "_AssemblyName ${_AssemblyName}" // ...
echo "BUILD_NUMBER ${env.BUILD_NUMBER}" // 11
echo "DEFAULT_FILE_SERVER ${params.DEFAULT_FILE_SERVER}" // 11
echo "GIT_BRANCH ${env.GIT_BRANCH}" // origin/master
echo "GIT_COMMIT ${env.GIT_COMMIT}" // 73b814069f2cf0173a62a8228815a9bc9ba93c41
echo "GIT_SERVER ${params.GIT_SERVER}" // ...
echo "GIT_URL ${env.GIT_URL}" // D:\ProgramData\Git\....git
echo "JENKINS_ENVIRONMENT ${env.JENKINS_ENVIRONMENT}" // 11
echo "JENKINS_URL ${env.JENKINS_URL}" // http://localhost:8080/
echo "JOB_NAME ${env.JOB_NAME}" // ...
echo "WORKSPACE ${env.WORKSPACE}" // D:\.jenkins\_\...
}
}
// stage('Restore') {
// steps {
// bat(returnStatus: true, script: 'dotnet --info')
// }
// }
stage('Safe storage of app secrets') {
steps {
dir(_TestProjectDirectory) {
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets init')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "BuildNumber" "' + env.BUILD_NUMBER + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "GitCommitSeven" "' + _GitCommitSeven + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "Server" "' + params.DEFAULT_FILE_SERVER + '"')
}
}
}
stage('Core Build') {
steps {
echo "Build number is ${currentBuild.number}"
dir(_TestProjectDirectory) {
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'build --runtime win-x64 --self-contained --verbosity quiet')
}
}
}
// stage('Test') {
// options {
// timeout(time: 10, unit: 'MINUTES')
// }
// steps {
// dir(_TestProjectDirectory) {
// bat('dotnet --info')
// }
// }
// }
stage('Framework Build') {
steps {
echo "Build number is ${currentBuild.number}"
bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' +
'/target:Restore ' +
'/detailedsummary ' +
'/consoleloggerparameters:PerformanceSummary;ErrorsOnly; ' +
'/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' +
_AssemblyName + '.csproj')
bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' +
'/target:Build ' +
'/detailedsummary ' +
'/consoleloggerparameters:PerformanceSummary;ErrorsOnly; ' +
'/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' +
_AssemblyName + '.csproj')
}
}
stage('Commit Id') {
steps {
dir('bin/Debug') {
writeFile file: "${_AssemblyName}.txt", text: "${env.GIT_COMMIT}-${env.BUILD_NUMBER}-${env.GIT_URL}"
}
}
}
stage('Package') {
steps {
fileOperations([fileZipOperation(folderPath: 'bin/Debug', outputFolderPath: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${env.JOB_NAME}-Debug")])
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*", renameFiles: false, sourceCaptureExpression: '', targetLocation: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${env.JOB_NAME}-Debug", targetNameExpression: '')])
}
}
// stage('Force Fail') {
// steps {
// error("Build failed because of this and that..")
// }
// }
stage('Copy Files to: file-share') {
steps {
dir('bin/Debug') {
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.txt", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.dll", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.exe", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.pdb", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
}
}
}
}
post {
always {
dir('bin') {
deleteDir()
}
dir('obj') {
deleteDir()
}
dir(_TestProjectDirectory + '/bin') {
deleteDir()
}
dir(_TestProjectDirectory + '/obj') {
deleteDir()
}
// cleanWs()
}
}
}

243
Adaptation/.editorconfig Normal file
View File

@ -0,0 +1,243 @@
[*.cs]
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
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
csharp_prefer_braces = false
csharp_prefer_simple_default_expression = true:warning
csharp_prefer_simple_using_statement = true:warning
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
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
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
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
csharp_style_conditional_delegate_call = true
csharp_style_deconstructed_variable_declaration = false
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
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
csharp_style_inlined_variable_declaration = false
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_pattern_local_over_anonymous_function = true:warning
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_index_operator = false:warning
csharp_style_prefer_not_pattern = true:warning
csharp_style_prefer_null_check_over_type_check = true
csharp_style_prefer_pattern_matching = true:warning
csharp_style_prefer_range_operator = false:warning
csharp_style_prefer_switch_expression = true: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
csharp_style_var_elsewhere = false:warning
csharp_style_var_for_built_in_types = false:warning
csharp_style_var_when_type_is_apparent = false:warning
csharp_using_directive_placement = outside_namespace
dotnet_code_quality_unused_parameters = all
dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter
dotnet_code_quality.CAXXXX.api_surface = private, internal
dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations
dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
dotnet_naming_rule.class_should_be_pascal_case.severity = warning
dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.class_should_be_pascal_case.symbols = class
dotnet_naming_rule.delegate_should_be_pascal_case.severity = warning
dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate
dotnet_naming_rule.enum_should_be_pascal_case.severity = warning
dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum
dotnet_naming_rule.event_should_be_pascal_case.severity = warning
dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.event_should_be_pascal_case.symbols = event
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.method_should_be_pascal_case.severity = warning
dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.method_should_be_pascal_case.symbols = method
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method
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.style = private_of_internal_field
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field
dotnet_naming_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.style = private_of_internal_field
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field
dotnet_naming_rule.property_should_be_pascal_case.severity = warning
dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.property_should_be_pascal_case.symbols = property
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field
dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning
dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field
dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method
dotnet_naming_rule.struct_should_be_pascal_case.severity = warning
dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_style.begins_with_i.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.pascal_case.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.private_of_internal_field.capitalization = pascal_case
dotnet_naming_style.private_of_internal_field.required_prefix = _
dotnet_naming_style.private_of_internal_field.required_suffix =
dotnet_naming_style.private_of_internal_field.word_separator =
dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.abstract_method.applicable_kinds = method
dotnet_naming_symbols.abstract_method.required_modifiers = abstract
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.class.applicable_kinds = class
dotnet_naming_symbols.class.required_modifiers =
dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.delegate.applicable_kinds = delegate
dotnet_naming_symbols.delegate.required_modifiers =
dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.enum.applicable_kinds = enum
dotnet_naming_symbols.enum.required_modifiers =
dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.event.applicable_kinds = event
dotnet_naming_symbols.event.required_modifiers =
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.method.applicable_accessibilities = public
dotnet_naming_symbols.method.applicable_kinds = method
dotnet_naming_symbols.method.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.required_modifiers =
dotnet_naming_symbols.private_method.applicable_accessibilities = private
dotnet_naming_symbols.private_method.applicable_kinds = method
dotnet_naming_symbols.private_method.required_modifiers =
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static
dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.property.applicable_kinds = property
dotnet_naming_symbols.property.required_modifiers =
dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
dotnet_naming_symbols.public_or_protected_field.required_modifiers =
dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_field.applicable_kinds = field
dotnet_naming_symbols.static_field.required_modifiers = static
dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_method.applicable_kinds = method
dotnet_naming_symbols.static_method.required_modifiers = static
dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.struct.applicable_kinds = struct
dotnet_naming_symbols.struct.required_modifiers =
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.required_modifiers =
dotnet_remove_unnecessary_suppression_exclusions = 0
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
dotnet_style_allow_statement_immediately_after_block_experimental = true
dotnet_style_coalesce_expression = true
dotnet_style_collection_initializer = true:warning
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_namespace_match_folder = true
dotnet_style_null_propagation = true:warning
dotnet_style_object_initializer = true:warning
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_compound_assignment = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = false
dotnet_style_prefer_conditional_expression_over_return = false
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_prefer_simplified_boolean_expressions = true:warning
dotnet_style_prefer_simplified_interpolation = true
dotnet_style_qualification_for_event = false:error
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_property = false:error
dotnet_style_readonly_field = true:warning
dotnet_style_require_accessibility_modifiers = for_non_interface_members
end_of_line = crlf
file_header_template = unset
indent_size = 4
indent_style = space
insert_final_newline = false
root = true
tab_width = 4
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822
# https://github.com/dotnet/aspnetcore/blob/main/.editorconfig
# https://github.com/dotnet/project-system/blob/main/.editorconfig

46
Adaptation/.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,46 @@
{
"recommendations": [
"adrianwilczynski.asp-net-core-switcher",
"adrianwilczynski.namespace",
"adrianwilczynski.terminal-commands",
"aliasadidev.nugetpackagemanagergui",
"bodil.file-browser",
"codezombiech.gitignore",
"cweijan.vscode-office",
"donjayamanne.githistory",
"EditorConfig.EditorConfig",
"eg2.vscode-npm-script",
"esbenp.prettier-vscode",
"formulahendry.dotnet-test-explorer",
"GitHub.remotehub",
"GitHub.vscode-pull-request-github",
"hashhar.gitattributes",
"hediet.vscode-drawio",
"mikeburgh.xml-format",
"ms-dotnettools.blazorwasm-companion",
"ms-dotnettools.csharp",
"ms-dotnettools.vscode-dotnet-runtime",
"ms-edgedevtools.vscode-edge-devtools",
"ms-vscode-remote.remote-ssh",
"ms-vscode-remote.remote-ssh-edit",
"ms-vscode.powershell",
"patcx.vscode-nuget-gallery",
"rangav.vscode-thunder-client",
"streetsidesoftware.code-spell-checker",
"VirtusLab.codetale",
"VisualStudioExptTeam.vscodeintellicode",
"vscode-icons-team.vscode-icons"
],
"unwantedRecommendations": [
"virtuslab.codetale",
"ms-azuretools.vscode-docker",
"christian-kohler.npm-intellisense",
"firefox-devtools.vscode-firefox-debug",
"dbaeumer.vscode-eslint",
"dbaeumer.jshint",
"felipecaputo.git-project-manager",
"eamodio.gitlens",
"hookyqr.beautify",
"davidanson.vscode-markdownlint"
]
}

1
Adaptation/.vscode/format-report.json vendored Normal file
View File

@ -0,0 +1 @@
[]

10
Adaptation/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"configurations": [
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": 24076
}
]
}

76
Adaptation/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,76 @@
{
"cSpell.words": [
"Analyte",
"CICN",
"EGANAIXG",
"ELODS",
"EQPT",
"etcs",
"GRATXT",
"grpf",
"Hmmssfff",
"hvfet",
"Icpms",
"IPDSF",
"Irmn",
"IRMNSPC",
"ISMTP",
"ISNULL",
"JOBID",
"JVXRD",
"Klarf",
"Lehighton",
"Lian",
"messa",
"milli",
"mvfet",
"MVIN",
"PDSF",
"pdsfc",
"PPID",
"pptst",
"reactno",
"RPMPL",
"RPMXY",
"rtsp",
"RUNMO",
"SIASM",
"statusdtm",
"stddev",
"Stks",
"SUMMO",
"Tesseract",
"TIBCO",
"TMAL",
"TMGA",
"TXTAPC",
"TXTIQS",
"Villach",
"XRDAI",
"XRDFWHM",
"XRDSL",
"XRDXRR",
"XRDXY"
],
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#7ea1d9",
"activityBar.activeBorder": "#f8e6ed",
"activityBar.background": "#7ea1d9",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#f8e6ed",
"activityBarBadge.foreground": "#15202b",
"sash.hoverBorder": "#7ea1d9",
"statusBar.background": "#5684ce",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#7ea1d9",
"statusBarItem.remoteBackground": "#5684ce",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#5684ce",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#5684ce99",
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#5684ce",
"cSpell.enabled": false
}

View File

@ -0,0 +1,95 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup>
<ImplicitUsings>disable</ImplicitUsings>
<IsPackable>false</IsPackable>
<LangVersion>10.0</LangVersion>
<Nullable>disable</Nullable>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<VSTestLogger>trx</VSTestLogger>
<VSTestResultsDirectory>../../../../DEP08SIHTRPLC/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="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="6.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
<PackageReference Include="System.Data.OleDb" Version="6.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.3" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FFMpegCore" Version="4.8.0" />
<PackageReference Include="Infineon.Monitoring.MonA" Version="3.0.0" />
<PackageReference Include="Infineon.Yoda" Version="5.4.1" />
<PackageReference Include="Instances" Version="2.0.0" />
<PackageReference Include="RoboSharp" Version="1.2.7" />
<PackageReference Include="Tesseract" Version="4.1.1" />
<PackageReference Include="Tibco.Rendezvous" Version="8.5.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="External.Common.Logging.Core" Version="3.3.1"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="External.Common.Logging" Version="3.3.1"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="External.log4net" Version="2.0.8"><NoWarn>NU1701</NoWarn></PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.OpenJDK.Media" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.OpenJDK.Text" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.OpenJDK.Util" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.Core;
public class BackboneComponent
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.Core;
public class BackboneStatusCache
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.Core;
public interface ILoggingSetupManager
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.Core;
public class StatusItem
{
}

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public class ChangeDataCollectionHandler
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public class DataCollectionRequest
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public class EquipmentEvent
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public class EquipmentException
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public class EquipmentSelfDescription
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public class GetParameterValuesHandler
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public interface IConnectionControl
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public interface IDataTracingHandler
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public interface IEquipmentCommandService
{
}

View File

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

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public interface IEquipmentSelfDescriptionBuilder
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public interface IPackage
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public interface ISelfDescriptionLookup
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public interface IVirtualParameterValuesHandler
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public class SetParameterValuesHandler
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public class TraceRequest
{
}

View File

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

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.Control;
public interface IPackageSource
{
}

View File

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

View File

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

View File

@ -0,0 +1,15 @@
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
public class Field
{
#pragma warning disable IDE0060
public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { }
public string Name { get; }
public string Description { get; }
public ParameterTypeDefinition TypeDefinition { get; }
public bool CanBeNull { get; }
}

View File

@ -0,0 +1,15 @@
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
public abstract class ParameterTypeDefinition
{
#pragma warning disable IDE0060
public ParameterTypeDefinition(string name, string description) { }
public string Name { get; }
public string Description { get; }
public override string ToString() => base.ToString();
}

View File

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

View File

@ -0,0 +1,5 @@
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
public interface IConfigurationObject
{
}

View File

@ -0,0 +1,29 @@
using System;
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
[System.Runtime.Serialization.DataContract(IsReference = true)]
public class ModelObjectParameterDefinition : IConfigurationObject
{
#pragma warning disable IDE0060
public ModelObjectParameterDefinition() { }
public ModelObjectParameterDefinition(string name, ModelObjectParameterType valueType, object defaultValue) { }
public ModelObjectParameterDefinition(string name, Type enumType, object defaultValue) { }
[System.Runtime.Serialization.DataMember]
public virtual long Id { get; set; }
[System.Runtime.Serialization.DataMember]
public virtual string Name { get; set; }
[System.Runtime.Serialization.DataMember]
public virtual string Value { get; set; }
[System.Runtime.Serialization.DataMember]
public virtual ModelObjectParameterType ValueType { get; set; }
[System.Runtime.Serialization.DataMember]
public virtual string EnumType { get; set; }
public virtual ModelObjectParameterDefinition Clone() => null;
public virtual bool IsValidValue(string value) => false;
}

View File

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

View File

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

View File

@ -0,0 +1,22 @@
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
namespace Adaptation.FileHandlers;
public class CellInstanceConnectionName
{
internal static IFileRead Get(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted)
{
IFileRead result = cellInstanceConnectionName switch
{
nameof(ZipFilesByDate) => new ZipFilesByDate.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted),
_ => throw new Exception($"\"{cellInstanceConnectionName}\" not mapped")
};
return result;
}
}

View File

@ -0,0 +1,341 @@
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
using Adaptation.Shared;
using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading;
namespace Adaptation.FileHandlers.ZipFilesByDate;
public class FileRead : Shared.FileRead, IFileRead
{
private readonly Timer _Timer;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted)
{
_MinFileLength = 10;
_NullData = string.Empty;
_Logistics = new(this);
if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName);
if (_ModelObjectParameterDefinitions is null)
throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
if (!Debugger.IsAttached && fileConnectorConfiguration.PreProcessingMode != FileConnectorConfiguration.PreProcessingModeEnum.Process)
_Timer = new Timer(Callback, null, (int)(fileConnectorConfiguration.FileScanningIntervalInSeconds * 1000), Timeout.Infinite);
else
{
_Timer = new Timer(Callback, null, Timeout.Infinite, Timeout.Infinite);
Callback(null);
}
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
{
bool isErrorFile = exception is not null;
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
{
FileInfo fileInfo = new(_Logistics.ReportFullPath);
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
}
Move(extractResults);
}
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
string IFileRead.GetEventDescription()
{
string result = _Description.GetEventDescription();
return result;
}
List<string> IFileRead.GetHeaderNames()
{
List<string> results = _Description.GetHeaderNames();
return results;
}
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
return results;
}
JsonProperty[] IFileRead.GetDefault()
{
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
return results;
}
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
{
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
return results;
}
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
{
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
if (string.IsNullOrEmpty(eventName))
throw new Exception();
_ReportFullPath = reportFullPath;
DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
List<string> headerNames = _Description.GetHeaderNames();
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
results = ReExtract(this, headerNames, keyValuePairs);
return results;
}
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
if (reportFullPath is null)
{ }
if (dateTime == DateTime.MinValue)
{ }
throw new Exception(string.Concat("See ", nameof(Callback)));
}
private static bool DeleteEmptyDirectories(string rootDirectory)
{
bool result;
if (!Directory.Exists(rootDirectory))
result = false;
else
{
string[] files;
string[] directories = Directory.GetDirectories(rootDirectory, "*", SearchOption.TopDirectoryOnly);
if (directories.Length > 0)
files = Array.Empty<string>();
else
files = Directory.GetFiles(rootDirectory, "*", SearchOption.AllDirectories);
if (directories.Length == 0 && files.Length == 0)
{
result = true;
Directory.Delete(rootDirectory);
}
else
{
result = false;
foreach (string directory in directories)
{
result = DeleteEmptyDirectories(directory);
if (result)
result = DeleteEmptyDirectories(directory);
}
if (files is null)
{
directories = Directory.GetDirectories(rootDirectory, "*", SearchOption.TopDirectoryOnly);
result = directories.Length == 0;
}
}
}
return result;
}
private void ZipFilesByDate(string sourceDirectory, SearchOption searchOption, string dayFormat)
{
string key;
bool addFile;
string fileName;
string[] segments;
string[] subFiles;
string weekOfYear;
FileInfo fileInfo;
DateTime creationTime;
DateTime lastWriteTime;
DateTime nowDateTime = DateTime.Now;
Regex regex = new("[a-zA-Z0-9]{1,}");
DateTime dateTime = DateTime.MinValue;
DateTime firstEmail = new(2019, 3, 8);
CultureInfo cultureInfo = new("en-US");
Calendar calendar = cultureInfo.Calendar;
Dictionary<string, DateTime> weeks = new();
int ticksLength = nowDateTime.AddDays(-6).Ticks.ToString().Length;
for (int i = 0; i < int.MaxValue; i++)
{
dateTime = firstEmail.AddDays(i);
if (dateTime > nowDateTime)
break;
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(nowDateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string skipKey = string.Concat(nowDateTime.ToString("yyyy"), "_Week_", weekOfYear);
Dictionary<string, List<string>> keyValuePairs = new();
string[] topDirectories = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
if (topDirectories.Length == 0)
topDirectories = new string[] { sourceDirectory };
foreach (string topDirectory in topDirectories)
{
keyValuePairs.Clear();
subFiles = Directory.GetFiles(topDirectory, "*", searchOption);
foreach (string subFile in subFiles)
{
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.Cast<Match>())
{
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)
{
key = Path.Combine(topDirectory, $"{element.Key}.zip");
if (File.Exists(key))
{
for (short i = 101; i < short.MaxValue; i++)
{
key = Path.Combine(topDirectory, $"{element.Key}_{i}.zip");
if (!File.Exists(key))
break;
}
}
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)
{
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) { }
}
_Log.Info(topDirectory);
}
}
private void ZipFilesByDate()
{
string checkDirectory;
string dayFormat = string.Empty;
string[] equipmentDirectories = Directory.GetDirectories(_FileConnectorConfiguration.SourceFileLocation, "*", SearchOption.TopDirectoryOnly);
foreach (string equipmentDirectory in equipmentDirectories)
{
checkDirectory = Path.Combine(equipmentDirectory, "PollPath");
if (!Directory.Exists(checkDirectory))
continue;
if (_IsEAFHosted)
ZipFilesByDate(checkDirectory, SearchOption.TopDirectoryOnly, dayFormat);
}
}
private void Callback(object state)
{
try
{
ZipFilesByDate();
}
catch (Exception exception)
{
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
try
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
catch (Exception) { }
}
try
{
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
catch (Exception exception)
{
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
try
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
catch (Exception) { }
}
}
}

View File

@ -0,0 +1,16 @@
namespace Adaptation.Ifx.Eaf.Common.Configuration;
[System.Runtime.Serialization.DataContract]
public class ConnectionSetting
{
#pragma warning disable IDE0060
public ConnectionSetting(string name, string value) { }
[System.Runtime.Serialization.DataMember]
public string Name { get; set; }
[System.Runtime.Serialization.DataMember]
public string Value { get; set; }
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,18 @@
using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
using System.Collections.Generic;
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription;
public class FileConnectorParameterTypeDefinitionProvider
{
#pragma warning disable CA1822
#pragma warning disable CA2254
#pragma warning disable IDE0060
public FileConnectorParameterTypeDefinitionProvider() { }
public IEnumerable<ParameterTypeDefinition> GetAllParameterTypeDefinition() => null;
public ParameterTypeDefinition GetParameterTypeDefinition(string name) => null;
}

View File

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

View File

@ -0,0 +1,7 @@
namespace Adaptation.PeerGroup.GCL.SecsDriver;
public enum HsmsConnectionMode
{
Active = 0,
Passive = 1
}

View File

@ -0,0 +1,7 @@
namespace Adaptation.PeerGroup.GCL.SecsDriver;
public enum HsmsSessionMode
{
MultiSession = 0,
SingleSession = 1
}

View File

@ -0,0 +1,7 @@
namespace Adaptation.PeerGroup.GCL.SecsDriver;
public enum SecsTransportType
{
HSMS = 0,
Serial = 1
}

View File

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

View File

@ -0,0 +1,142 @@
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
namespace Adaptation.Shared.Duplicator;
public class Description : IDescription, Properties.IDescription
{
public int Test { get; set; }
public int Count { get; set; }
public int Index { get; set; }
//
public string EventName { get; set; }
public string NullData { get; set; }
public string JobID { get; set; }
public string Sequence { get; set; }
public string MesEntity { get; set; }
public string ReportFullPath { get; set; }
public string ProcessJobID { get; set; }
public string MID { get; set; }
public string Date { get; set; } //2021-10-23
string IDescription.GetEventDescription() => "File Has been read and parsed";
List<string> IDescription.GetNames(IFileRead fileRead, Logistics logistics)
{
List<string> results = new();
IDescription description = GetDefault(fileRead, logistics);
string json = JsonSerializer.Serialize(description, description.GetType());
object @object = JsonSerializer.Deserialize<object>(json);
if (@object is not JsonElement jsonElement)
throw new Exception();
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
results.Add(jsonProperty.Name);
return results;
}
List<string> IDescription.GetDetailNames()
{
List<string> results = new();
return results;
}
List<string> IDescription.GetHeaderNames()
{
List<string> results = new();
return results;
}
IDescription IDescription.GetDisplayNames()
{
Description result = GetDisplayNames();
return result;
}
List<string> IDescription.GetParameterNames()
{
List<string> results = new();
return results;
}
JsonProperty[] IDescription.GetDefault(IFileRead fileRead, Logistics logistics)
{
JsonProperty[] results;
IDescription description = GetDefault(fileRead, logistics);
string json = JsonSerializer.Serialize(description, description.GetType());
object @object = JsonSerializer.Deserialize<object>(json);
results = ((JsonElement)@object).EnumerateObject().ToArray();
return results;
}
List<string> IDescription.GetPairedParameterNames()
{
List<string> results = new();
return results;
}
List<string> IDescription.GetIgnoreParameterNames(Test test)
{
List<string> results = new();
return results;
}
IDescription IDescription.GetDefaultDescription(IFileRead fileRead, Logistics logistics)
{
Description result = GetDefault(fileRead, logistics);
return result;
}
Dictionary<string, string> IDescription.GetDisplayNamesJsonElement(IFileRead fileRead)
{
Dictionary<string, string> results = new();
IDescription description = GetDisplayNames();
string json = JsonSerializer.Serialize(description, description.GetType());
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
{
if (!results.ContainsKey(jsonProperty.Name))
results.Add(jsonProperty.Name, string.Empty);
if (jsonProperty.Value is JsonElement jsonPropertyValue)
results[jsonProperty.Name] = jsonPropertyValue.ToString();
}
return results;
}
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData)
{
List<IDescription> results = new();
return results;
}
private static Description GetDisplayNames()
{
Description result = new();
return result;
}
private static Description GetDefault(IFileRead fileRead, Logistics logistics)
{
Description result = new()
{
Test = -1,
Count = 0,
Index = -1,
//
EventName = fileRead.EventName,
NullData = fileRead.NullData,
JobID = fileRead.CellInstanceName,
Sequence = logistics.Sequence.ToString(),
MesEntity = fileRead.MesEntity,
ReportFullPath = logistics.ReportFullPath,
ProcessJobID = logistics.ProcessJobID,
MID = logistics.MID,
Date = logistics.DateTimeFromSequence.ToUniversalTime().ToString("MM/dd/yyyy HH:mm:ss")
};
return result;
}
}

View File

@ -0,0 +1,663 @@
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
using Adaptation.Shared.Methods;
using log4net;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
namespace Adaptation.Shared;
public class FileRead : Properties.IFileRead
{
protected string _NullData;
protected readonly ILog _Log;
protected long _MinFileLength;
protected Logistics _Logistics;
protected readonly ISMTP _SMTP;
protected readonly int _Hyphens;
protected readonly bool _IsEvent;
protected string _ReportFullPath;
protected long _LastTicksDuration;
protected readonly bool _IsEAFHosted;
protected readonly string _EventName;
protected readonly string _MesEntity;
protected readonly string _TracePath;
protected readonly bool _IsDuplicator;
protected readonly Calendar _Calendar;
protected readonly bool _IsSourceTimer;
protected readonly string _EquipmentType;
protected readonly long _BreakAfterSeconds;
protected readonly string _ExceptionSubject;
protected readonly string _CellInstanceName;
protected readonly string _EventNameFileRead;
protected readonly IDescription _Description;
protected readonly bool _UseCyclicalForDescription;
protected readonly string _CellInstanceConnectionName;
protected readonly string _CellInstanceConnectionNameBase;
protected readonly Dictionary<string, List<long>> _DummyRuns;
protected readonly Dictionary<string, string> _FileParameter;
protected readonly Dictionary<long, List<string>> _StaticRuns;
protected readonly string _ParameterizedModelObjectDefinitionType;
protected readonly FileConnectorConfiguration _FileConnectorConfiguration;
protected readonly IList<ModelObjectParameterDefinition> _ModelObjectParameterDefinitions;
bool Properties.IFileRead.IsEvent => _IsEvent;
string Properties.IFileRead.NullData => _NullData;
string Properties.IFileRead.EventName => _EventName;
string Properties.IFileRead.MesEntity => _MesEntity;
bool Properties.IFileRead.IsEAFHosted => _IsEAFHosted;
string Properties.IFileRead.EquipmentType => _EquipmentType;
string Properties.IFileRead.ReportFullPath => _ReportFullPath;
string Properties.IFileRead.CellInstanceName => _CellInstanceName;
string Properties.IFileRead.ExceptionSubject => _ExceptionSubject;
bool Properties.IFileRead.UseCyclicalForDescription => _UseCyclicalForDescription;
string Properties.IFileRead.CellInstanceConnectionName => _CellInstanceConnectionName;
string Properties.IFileRead.ParameterizedModelObjectDefinitionType => _ParameterizedModelObjectDefinitionType;
public FileRead(IDescription description, bool isEvent, ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted)
{
_SMTP = smtp;
_IsEvent = isEvent;
_DummyRuns = dummyRuns;
_LastTicksDuration = 0;
_StaticRuns = staticRuns;
_IsEAFHosted = isEAFHosted;
_Description = description;
_FileParameter = fileParameter;
_ReportFullPath = string.Empty;
_CellInstanceName = cellInstanceName;
_Calendar = new CultureInfo("en-US").Calendar;
_Log = LogManager.GetLogger(typeof(FileRead));
_UseCyclicalForDescription = useCyclicalForDescription;
_CellInstanceConnectionName = cellInstanceConnectionName;
_ModelObjectParameterDefinitions = modelObjectParameters;
_FileConnectorConfiguration = fileConnectorConfiguration;
_ParameterizedModelObjectDefinitionType = parameterizedModelObjectDefinitionType;
_IsSourceTimer = fileConnectorConfiguration.SourceFileFilter.StartsWith("*Timer.txt");
string cellInstanceConnectionNameBase = cellInstanceConnectionName.Replace("-", string.Empty);
_Hyphens = cellInstanceConnectionName.Length - cellInstanceConnectionNameBase.Length;
_TracePath = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "Path.Trace");
_ExceptionSubject = string.Concat("Exception:", _CellInstanceConnectionName, _FileConnectorConfiguration?.SourceDirectoryCloaking);
string suffix;
string[] segments = _ParameterizedModelObjectDefinitionType.Split('.');
string @namespace = segments[0];
string eventNameFileRead = "FileRead";
string eventName = segments[segments.Length - 1];
bool isDuplicator = segments[0] == cellInstanceName;
_IsDuplicator = isDuplicator;
_CellInstanceConnectionNameBase = cellInstanceConnectionNameBase;
if (eventName == eventNameFileRead)
suffix = string.Empty;
else
suffix = string.Concat('_', eventName.Split(new string[] { eventNameFileRead }, StringSplitOptions.RemoveEmptyEntries)[1]);
string parameterizedModelObjectDefinitionTypeAppended = string.Concat(@namespace, suffix);
if (!isEAFHosted)
{
if (string.IsNullOrEmpty(equipmentTypeName) || equipmentTypeName != parameterizedModelObjectDefinitionTypeAppended)
throw new Exception(cellInstanceConnectionName);
if (string.IsNullOrEmpty(equipmentDictionaryName) && isEvent)
throw new Exception(cellInstanceConnectionName);
if (!string.IsNullOrEmpty(equipmentDictionaryName) && !isEvent)
throw new Exception(cellInstanceConnectionName);
// if (string.IsNullOrEmpty(equipmentDictionaryName) && !isEvent)
// throw new Exception(cellInstanceConnectionName);
// if (!string.IsNullOrEmpty(equipmentDictionaryName) && isEvent)
// throw new Exception(cellInstanceConnectionName);
}
if (isDuplicator)
_MesEntity = string.Empty;
else
_MesEntity = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, string.Concat("CellInstance.", cellInstanceName, ".Alias"));
_EventName = eventName;
_EventNameFileRead = eventNameFileRead;
_EquipmentType = parameterizedModelObjectDefinitionTypeAppended;
long breakAfterSeconds;
if (_FileConnectorConfiguration is null)
breakAfterSeconds = 360;
else
{
if (_FileConnectorConfiguration.FileScanningOption == FileConnectorConfiguration.FileScanningOptionEnum.TimeBased)
breakAfterSeconds = Math.Abs(_FileConnectorConfiguration.FileHandleTimeout.Value);
else if (_FileConnectorConfiguration.FileScanningOption == FileConnectorConfiguration.FileScanningOptionEnum.FileWatcher)
breakAfterSeconds = Math.Abs(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value);
else
throw new Exception();
}
_BreakAfterSeconds = breakAfterSeconds;
UpdateLastTicksDuration(breakAfterSeconds * 10000000);
if (_IsDuplicator)
{
if (string.IsNullOrEmpty(_FileConnectorConfiguration.TargetFileLocation) || string.IsNullOrEmpty(_FileConnectorConfiguration.ErrorTargetFileLocation))
throw new Exception("_Configuration is empty?");
if (_FileConnectorConfiguration.TargetFileLocation.Contains('%') || _FileConnectorConfiguration.ErrorTargetFileLocation.Contains('%'))
throw new Exception("_Configuration is incorrect for a duplicator!");
// if (_FileConnectorConfiguration is not null)
// {
// if (string.IsNullOrEmpty(_FileConnectorConfiguration.SourceDirectoryCloaking))
// throw new Exception("SourceDirectoryCloaking is empty?");
// if (!_FileConnectorConfiguration.SourceDirectoryCloaking.StartsWith("~"))
// throw new Exception("SourceDirectoryCloaking is incorrect for a duplicator!");
// }
}
}
protected static string GetPropertyValue(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyName)
{
string result;
List<string> results = (from l in modelObjectParameters where l.Name == propertyName select l.Value).ToList();
if (results.Count != 1)
throw new Exception(cellInstanceConnectionName);
result = results[0];
return result;
}
protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix)
{
ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) select l).ToArray();
if (!results.Any())
throw new Exception(cellInstanceConnectionName);
return results;
}
protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix, string propertyNameSuffix)
{
ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) && l.Name.EndsWith(propertyNameSuffix) select l).ToArray();
if (!results.Any())
throw new Exception(cellInstanceConnectionName);
return results;
}
protected void UpdateLastTicksDuration(long ticksDuration)
{
if (ticksDuration < 50000000)
ticksDuration = 50000000;
_LastTicksDuration = (long)Math.Ceiling(ticksDuration * .667);
_Log.Info($"{new TimeSpan(ticksDuration).TotalMilliseconds} TotalMillisecond(s) to process {Environment.NewLine}{_CellInstanceConnectionName}{Environment.NewLine}<{_ReportFullPath}>");
}
protected void WaitForThread(Thread thread, List<Exception> threadExceptions)
{
if (thread is not null)
{
ThreadState threadState;
for (short i = 0; i < short.MaxValue; i++)
{
if (thread is null)
break;
else
{
threadState = thread.ThreadState;
if (threadState is not ThreadState.Running and not ThreadState.WaitSleepJoin)
break;
}
Thread.Sleep(500);
}
lock (threadExceptions)
{
if (threadExceptions.Any())
{
foreach (Exception item in threadExceptions)
_Log.Error(string.Concat(item.Message, Environment.NewLine, Environment.NewLine, item.StackTrace));
Exception exception = threadExceptions[0];
threadExceptions.Clear();
throw exception;
}
}
}
}
private void WriteAllLines(string to, string[] exceptionLines)
{
string fileName = string.Concat(to, @"\readme.txt");
try
{
if (!Directory.Exists(to))
_ = Directory.CreateDirectory(to);
File.WriteAllLines(fileName, exceptionLines);
}
catch (Exception ex) { _Log.Error(ex.Message); }
}
protected string[] Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results;
bool isErrorFile = exception is not null;
if (!to.EndsWith(@"\"))
_ = string.Concat(to, @"\");
if (!isErrorFile)
results = Array.Empty<string>();
else
{
results = new string[] { _Logistics.Sequence.ToString(), _Logistics.ReportFullPath, from, resolvedFileLocation, to, string.Empty, string.Empty, exception.Message, string.Empty, string.Empty, exception.StackTrace };
if (!_IsDuplicator)
WriteAllLines(to, results);
}
if (extractResults is not null && extractResults.Item4 is not null && extractResults.Item4.Any())
{
string itemFile;
List<string> directories = new();
foreach (FileInfo sourceFile in extractResults.Item4)
{
if (sourceFile.FullName != _Logistics.ReportFullPath)
{
itemFile = sourceFile.FullName.Replace(from, to);
Shared1880(itemFile, directories, sourceFile, isErrorFile);
}
else if (!isErrorFile && _Logistics is not null)
Shared1811(to, sourceFile);
}
Shared0231(directories);
}
return results;
}
protected static string GetTupleFile(Logistics logistics, Properties.IScopeInfo scopeInfo, string duplicateDirectory)
{
string result;
string rds;
string dateValue;
string datePlaceholder;
string[] segments = logistics.MID.Split('-');
if (segments.Length < 2)
rds = "%RDS%";
else
rds = segments[1];
segments = scopeInfo.FileName.Split(new string[] { "DateTime:" }, StringSplitOptions.RemoveEmptyEntries);
if (segments.Length == 0)
result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileNameWithoutExtension.Replace("%RDS%", rds));
else
{
datePlaceholder = "%DateTime%";
segments = segments[1].Split('%');
dateValue = logistics.DateTimeFromSequence.ToString(segments[0]);
foreach (string segment in scopeInfo.FileName.Split('%'))
{
if (!segment.Contains(segments[0]))
continue;
datePlaceholder = string.Concat('%', segment, '%');
}
result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileName.Replace("%RDS%", rds).Replace(datePlaceholder, dateValue));
}
if (result.Contains('%'))
throw new Exception("Placeholder exists!");
return result;
}
protected void WaitForFileConsumption(string sourceDirectoryCloaking, Logistics logistics, DateTime dateTime, string successDirectory, string duplicateDirectory, string duplicateFile, List<(Properties.IScopeInfo, string)> tuples)
{
bool check;
long preWait;
string tupleFile;
List<string> duplicateFiles = new();
StringBuilder stringBuilder = new();
List<int> consumedFileIndices = new();
bool moreThanAnHour = _BreakAfterSeconds > 3600;
long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks;
if (_FileConnectorConfiguration?.FileHandleWaitTime is null)
preWait = dateTime.AddMilliseconds(1234).Ticks;
else
preWait = dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
if (!tuples.Any())
duplicateFiles.Add(duplicateFile);
string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath);
string successFile = string.Concat(successDirectory, @"\", Path.GetFileName(logistics.ReportFullPath));
foreach ((Properties.IScopeInfo scopeInfo, string text) in tuples)
{
if (scopeInfo.FileName.StartsWith(@"\"))
tupleFile = scopeInfo.FileName;
else if (!scopeInfo.FileName.Contains('%'))
tupleFile = string.Concat(duplicateDirectory, @"\", fileName, "_", scopeInfo.FileNameWithoutExtension, ".pdsfc");
else
tupleFile = GetTupleFile(logistics, scopeInfo, duplicateDirectory);
duplicateFiles.Add(tupleFile);
File.WriteAllText(tupleFile, text);
}
for (short i = 0; i < short.MaxValue; i++)
{
if (DateTime.Now.Ticks > preWait)
break;
Thread.Sleep(500);
}
if (!moreThanAnHour)
{
for (short z = 0; z < short.MaxValue; z++)
{
try
{
check = string.IsNullOrEmpty(successDirectory) || File.Exists(successFile);
if (check)
{
consumedFileIndices.Clear();
for (int i = 0; i < duplicateFiles.Count; i++)
{
if (!File.Exists(duplicateFiles[i]))
consumedFileIndices.Add(i);
}
if (consumedFileIndices.Count == duplicateFiles.Count)
break;
}
}
catch (Exception) { }
if (DateTime.Now.Ticks > breakAfter)
{
for (int i = 0; i < duplicateFiles.Count; i++)
{
if (File.Exists(duplicateFiles[i]))
{
try
{ File.Delete(duplicateFiles[i]); }
catch (Exception) { }
_ = stringBuilder.Append('<').Append(duplicateFiles[i]).Append("> ");
}
}
throw new Exception(string.Concat("After {", _BreakAfterSeconds, "} seconds, right side of {", sourceDirectoryCloaking, "} didn't consume file(s) ", stringBuilder));
}
Thread.Sleep(500);
}
}
}
protected void SetFileParameter(string key, string value)
{
if (_FileConnectorConfiguration is null || _FileConnectorConfiguration.TargetFileLocation.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.ErrorTargetFileLocation.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.TargetFileName.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.ErrorTargetFileName.Contains(string.Concat("%", key, "%")))
{
if (_FileParameter.ContainsKey(key))
_FileParameter[key] = value;
else
_FileParameter.Add(key, value);
}
}
protected void SetFileParameterLotIDToLogisticsMID(bool includeLogisticsSequence = true)
{
string key;
if (!includeLogisticsSequence)
key = "LotID";
else
key = "LotIDWithLogisticsSequence";
string value = string.Concat(_Logistics.MID, "_", _Logistics.Sequence, "_", DateTime.Now.Ticks - _Logistics.Sequence);
SetFileParameter(key, value);
}
protected void SetFileParameterLotID(string value, bool includeLogisticsSequence = true)
{
string key;
if (!includeLogisticsSequence)
key = "LotID";
else
{
key = "LotIDWithLogisticsSequence";
value = string.Concat(value, "_", _Logistics.Sequence, "_", DateTime.Now.Ticks - _Logistics.Sequence);
}
SetFileParameter(key, value);
}
protected void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements)
{
string directory;
if (!_CellInstanceConnectionName.StartsWith(_CellInstanceName) && _CellInstanceConnectionNameBase == _EquipmentType)
directory = Path.Combine(_TracePath, _EquipmentType, "Target", _CellInstanceName, _CellInstanceConnectionName);
else
directory = Path.Combine(_TracePath, _EquipmentType, "Source", _CellInstanceName, _CellInstanceConnectionName);
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
string file = Path.Combine(directory, string.Concat(_Logistics.MesEntity, "_", _Logistics.Sequence, ".ipdsf"));
string lines = ProcessDataStandardFormat.GetPDSFText(fileRead, _Logistics, jsonElements, logisticsText: string.Empty);
File.WriteAllText(file, lines);
if (_Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600)
{
try
{ File.SetLastWriteTime(file, _Logistics.DateTimeFromSequence); }
catch (Exception) { }
}
}
protected void Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults)
{
if (!_IsEAFHosted)
{
string to;
if (!_FileConnectorConfiguration.TargetFileLocation.EndsWith(Path.DirectorySeparatorChar.ToString()))
to = _FileConnectorConfiguration.TargetFileLocation;
else
to = Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation);
foreach (KeyValuePair<string, string> keyValuePair in _FileParameter)
to = to.Replace(string.Concat('%', keyValuePair.Key, '%'), keyValuePair.Value);
if (to.Contains('%'))
_Log.Debug("Can't debug without EAF Hosting");
else
_ = Move(extractResults, to, _FileConnectorConfiguration.SourceFileLocation, resolvedFileLocation: string.Empty, exception: null);
}
}
protected void TriggerEvents(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, List<string> headerNames, Dictionary<string, string> keyValuePairs)
{
object value;
string description;
List<object[]> list;
for (int i = 0; i < extractResults.Item3.Length; i++)
{
_Log.Debug(string.Concat("TriggerEvent - {", _Logistics.ReportFullPath, "} ", i, " of ", extractResults.Item3.Length));
foreach (JsonProperty jsonProperty in extractResults.Item3[i].EnumerateObject())
{
if (jsonProperty.Value.ValueKind != JsonValueKind.String || !keyValuePairs.ContainsKey(jsonProperty.Name))
description = string.Empty;
else
description = keyValuePairs[jsonProperty.Name].Split('|')[0];
if (!_UseCyclicalForDescription || headerNames.Contains(jsonProperty.Name))
value = jsonProperty.Value.ToString();
else
{
list = new List<object[]>();
for (int z = 0; z < extractResults.Item3.Length; z++)
list.Add(new object[] { z, extractResults.Item3[z].GetProperty(jsonProperty.Name).ToString() });
value = list;
}
}
if (_UseCyclicalForDescription)
break;
}
}
protected Tuple<string, Test[], JsonElement[], List<FileInfo>> ReExtract(IFileRead fileRead, List<string> headerNames, Dictionary<string, string> keyValuePairs)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
if (!Directory.Exists(_FileConnectorConfiguration.SourceFileLocation))
results = null;
else
{
string[] segments;
string[] matches = null;
foreach (string subSourceFileFilter in _FileConnectorConfiguration.SourceFileFilters)
{
segments = subSourceFileFilter.Split('\\');
if (_FileConnectorConfiguration.IncludeSubDirectories.Value)
matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.AllDirectories);
else
matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.TopDirectoryOnly);
if (matches.Any())
break;
}
if (matches is null || !matches.Any())
results = null;
else
{
_ReportFullPath = matches[0];
results = fileRead.GetExtractResult(_ReportFullPath, _EventName);
if (!_IsEAFHosted)
TriggerEvents(results, headerNames, keyValuePairs);
}
}
return results;
}
protected static List<Properties.IDescription> GetDuplicatorDescriptions(JsonElement[] jsonElements)
{
List<Properties.IDescription> results = new();
Duplicator.Description description;
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
foreach (JsonElement jsonElement in jsonElements)
{
if (jsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
description = JsonSerializer.Deserialize<Duplicator.Description>(jsonElement.ToString(), jsonSerializerOptions);
results.Add(description);
}
return results;
}
private void Shared1880(string itemFile, List<string> directories, FileInfo sourceFile, bool isErrorFile)
{
string itemDirectory;
directories.Add(Path.GetDirectoryName(sourceFile.FullName));
itemDirectory = Path.GetDirectoryName(itemFile);
FileConnectorConfiguration.PostProcessingModeEnum processingModeEnum;
if (!isErrorFile)
processingModeEnum = _FileConnectorConfiguration.PostProcessingMode.Value;
else
processingModeEnum = _FileConnectorConfiguration.ErrorPostProcessingMode.Value;
if (processingModeEnum != FileConnectorConfiguration.PostProcessingModeEnum.Delete && !Directory.Exists(itemDirectory))
{
_ = Directory.CreateDirectory(itemDirectory);
FileInfo fileInfo = new(_Logistics.ReportFullPath);
Directory.SetCreationTime(itemDirectory, fileInfo.LastWriteTime);
}
if (_IsEAFHosted)
{
switch (processingModeEnum)
{
case FileConnectorConfiguration.PostProcessingModeEnum.Move:
File.Move(sourceFile.FullName, itemFile);
break;
case FileConnectorConfiguration.PostProcessingModeEnum.Copy:
File.Copy(sourceFile.FullName, itemFile);
break;
case FileConnectorConfiguration.PostProcessingModeEnum.Delete:
File.Delete(sourceFile.FullName);
break;
default:
throw new Exception();
}
}
}
private void Shared1811(string to, FileInfo sourceFile)
{
if (!_IsDuplicator && _FileConnectorConfiguration.SourceFileFilter != "*" && sourceFile.Exists && sourceFile.Length < _MinFileLength)
{
string directoryName = Path.GetFileName(to);
string jobIdDirectory = Path.GetDirectoryName(to);
DateTime dateTime = DateTime.Now.AddMinutes(-15);
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}{@"\"}{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
string destinationDirectory = string.Concat(jobIdDirectory, @"\_ Ignore 100 bytes\", weekDirectory, @"\", directoryName);
if (!Directory.Exists(destinationDirectory))
_ = Directory.CreateDirectory(destinationDirectory);
File.Move(sourceFile.FullName, string.Concat(destinationDirectory, @"\", sourceFile.Name));
try
{
string[] checkDirectories = Directory.GetDirectories(jobIdDirectory, "*", SearchOption.TopDirectoryOnly);
foreach (string checkDirectory in checkDirectories)
{
if (!checkDirectory.Contains('_'))
continue;
if (Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any())
continue;
if (Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any())
continue;
if (Directory.GetDirectories(checkDirectory, "*", SearchOption.AllDirectories).Any())
continue;
if (Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories).Any())
continue;
if (new DirectoryInfo(checkDirectory).CreationTime > dateTime)
continue;
Directory.Delete(checkDirectory, recursive: false);
}
}
catch (Exception) { throw; }
}
}
private void Shared0231(List<string> directories)
{
if (_FileConnectorConfiguration.PostProcessingMode != FileConnectorConfiguration.PostProcessingModeEnum.Copy)
{
foreach (string directory in (from l in directories orderby l.Split('\\').Length descending select l).Distinct())
{
if (Directory.Exists(directory) && !Directory.GetFiles(directory).Any())
Directory.Delete(directory);
}
}
}
protected void WaitForFileConsumption(DateTime dateTime, bool isDummyRun, string successDirectory, string duplicateDirectory, List<(Properties.IScopeInfo, string)> tuples, string duplicateFile)
{
if (!isDummyRun && _IsEAFHosted)
WaitForFileConsumption(_FileConnectorConfiguration.SourceDirectoryCloaking, _Logistics, dateTime, successDirectory, duplicateDirectory, duplicateFile, tuples);
else
{
long breakAfter = DateTime.Now.AddSeconds(_FileConnectorConfiguration.ConnectionRetryInterval.Value).Ticks;
for (short i = 0; i < short.MaxValue; i++)
{
if (!_IsEAFHosted || DateTime.Now.Ticks > breakAfter)
break;
Thread.Sleep(500);
}
}
}
internal static string GetJobIdParentDirectory(string directory)
{
string result;
if (!string.IsNullOrEmpty(Path.GetFileName(directory)))
result = Path.GetFullPath(GetParentParent(directory));
else
result = Path.GetFullPath(GetParentParent(Path.GetDirectoryName(directory)));
if (!Directory.Exists(result))
_ = Directory.CreateDirectory(result);
return result;
}
internal string[] GetInProcessDirectory(string jobIdDirectory)
{
string[] results;
if (!_IsEAFHosted)
results = new string[] { jobIdDirectory };
else
{
string logisticsSequence = _Logistics.Sequence.ToString();
results = Directory.GetDirectories(jobIdDirectory, string.Concat(_Logistics.MID, '*', logisticsSequence, '*'), SearchOption.TopDirectoryOnly);
}
if ((results is null) || results.Length != 1)
throw new Exception("Didn't find directory by logistics sequence");
return results;
}
internal static string GetFileNameAfterUnderscoreSplit(string reportFullPath)
{
string result;
string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_');
if (segments.Length <= 2)
result = segments[0];
else
result = string.Concat(segments[0], segments[2]);
return result;
}
internal static string GetParentParent(string value)
{
string result = Path.GetDirectoryName(Path.GetDirectoryName(value));
return result;
}
}
// 2022-06-08 -> Shared - FileRead

View File

@ -0,0 +1,201 @@
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Adaptation.Shared;
public class Logistics : ILogistics
{
protected readonly DateTime _DateTimeFromSequence;
protected readonly FileInfo _FileInfo;
protected readonly string _JobID;
protected readonly List<string> _Logistics1;
protected readonly List<Logistics2> _Logistics2;
protected string _MID;
protected readonly string _MesEntity;
protected readonly object _NullData;
protected string _ProcessJobID;
protected readonly string _ReportFullPath;
protected readonly long _Sequence;
protected readonly double _TotalSecondsSinceLastWriteTimeFromSequence;
public DateTime DateTimeFromSequence => _DateTimeFromSequence;
public FileInfo FileInfo => _FileInfo;
public string JobID => _JobID;
public List<string> Logistics1 => _Logistics1;
public List<Logistics2> Logistics2 => _Logistics2;
public string MID => _MID;
public string MesEntity => _MesEntity;
public object NullData => _NullData;
public string ProcessJobID => _ProcessJobID;
public string ReportFullPath => _ReportFullPath;
public long Sequence => _Sequence;
public double TotalSecondsSinceLastWriteTimeFromSequence => _TotalSecondsSinceLastWriteTimeFromSequence;
public Logistics(IFileRead fileRead)
{
DateTime dateTime = DateTime.Now;
_NullData = null;
_Sequence = dateTime.Ticks;
_DateTimeFromSequence = dateTime;
_JobID = fileRead.CellInstanceName;
_TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
_MesEntity = DefaultMesEntity(dateTime);
_ReportFullPath = string.Empty;
_ProcessJobID = nameof(ProcessJobID);
_MID = nameof(MID);
_Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
_Logistics2 = new List<Logistics2>();
}
public Logistics(IFileRead fileRead, string reportFullPath, bool useSplitForMID, int? fileInfoLength = null)
{
if (string.IsNullOrEmpty(fileRead.CellInstanceName))
throw new Exception();
if (string.IsNullOrEmpty(fileRead.MesEntity))
throw new Exception();
_NullData = fileRead.NullData;
_FileInfo = new(reportFullPath);
DateTime dateTime = _FileInfo.LastWriteTime;
if (fileInfoLength.HasValue && _FileInfo.Length < fileInfoLength.Value)
dateTime = dateTime.AddTicks(-1);
_JobID = fileRead.CellInstanceName;
_Sequence = dateTime.Ticks;
_DateTimeFromSequence = dateTime;
_TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
_MesEntity = fileRead.MesEntity;
_ReportFullPath = _FileInfo.FullName;
_ProcessJobID = nameof(ProcessJobID);
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(_FileInfo.FullName);
if (useSplitForMID)
{
if (fileNameWithoutExtension.IndexOf(".") > -1)
fileNameWithoutExtension = fileNameWithoutExtension.Split('.')[0].Trim();
if (fileNameWithoutExtension.IndexOf("_") > -1)
fileNameWithoutExtension = fileNameWithoutExtension.Split('_')[0].Trim();
if (fileNameWithoutExtension.IndexOf("-") > -1)
fileNameWithoutExtension = fileNameWithoutExtension.Split('-')[0].Trim();
}
_MID = string.Concat(fileNameWithoutExtension.Substring(0, 1).ToUpper(), fileNameWithoutExtension.Substring(1).ToLower());
_Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
_Logistics2 = new List<Logistics2>();
}
public Logistics(string reportFullPath, string logistics)
{
string key;
DateTime dateTime;
string[] segments;
_FileInfo = new(reportFullPath);
_Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();
if (!Logistics1.Any() || !Logistics1[0].StartsWith("LOGISTICS_1"))
{
_NullData = null;
_JobID = "null";
dateTime = _FileInfo.LastWriteTime;
_Sequence = dateTime.Ticks;
_DateTimeFromSequence = dateTime;
_TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
_MesEntity = DefaultMesEntity(dateTime);
_ReportFullPath = reportFullPath;
_ProcessJobID = "R##";
_MID = "null";
_Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
_Logistics2 = new List<Logistics2>();
}
else
{
string logistics1Line1 = Logistics1[0];
key = "NULL_DATA=";
if (!logistics1Line1.Contains(key))
_NullData = null;
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
_NullData = segments[1].Split(';')[0];
}
key = "JOBID=";
if (!logistics1Line1.Contains(key))
_JobID = "null";
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
_JobID = segments[1].Split(';')[0];
}
key = "SEQUENCE=";
if (!logistics1Line1.Contains(key))
dateTime = _FileInfo.LastWriteTime;
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
if (!long.TryParse(segments[1].Split(';')[0].Split('.')[0], out long sequence) || sequence < new DateTime(1999, 1, 1).Ticks)
dateTime = _FileInfo.LastWriteTime;
else
dateTime = new DateTime(sequence);
}
_Sequence = dateTime.Ticks;
_DateTimeFromSequence = dateTime;
_TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
DateTime lastWriteTime = _FileInfo.LastWriteTime;
if (TotalSecondsSinceLastWriteTimeFromSequence > 600)
{
if (lastWriteTime != dateTime)
try
{ File.SetLastWriteTime(reportFullPath, dateTime); }
catch (Exception) { }
}
key = "MES_ENTITY=";
if (!logistics1Line1.Contains(key))
_MesEntity = DefaultMesEntity(dateTime);
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
_MesEntity = segments[1].Split(';')[0];
}
_ReportFullPath = reportFullPath;
key = "PROCESS_JOBID=";
if (!logistics1Line1.Contains(key))
_ProcessJobID = "R##";
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
_ProcessJobID = segments[1].Split(';')[0];
}
key = "MID=";
if (!logistics1Line1.Contains(key))
_MID = "null";
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
_MID = segments[1].Split(';')[0];
}
}
Logistics2 logistics2;
_Logistics2 = new List<Logistics2>();
for (int i = 1; i < Logistics1.Count; i++)
{
if (Logistics1[i].StartsWith("LOGISTICS_2"))
{
logistics2 = new Logistics2(Logistics1[i]);
Logistics2.Add(logistics2);
}
}
for (int i = Logistics1.Count - 1; i > -1; i--)
{
if (Logistics1[i].StartsWith("LOGISTICS_2"))
Logistics1.RemoveAt(i);
}
}
private static string DefaultMesEntity(DateTime dateTime) => string.Concat(dateTime.Ticks, "_MES_ENTITY");
internal void Update(string mid, string processJobID)
{
_MID = mid;
_ProcessJobID = processJobID;
}
}

View File

@ -0,0 +1,78 @@
using System;
namespace Adaptation.Shared;
public class Logistics2 : Methods.ILogistics2
{
public string MID { get; private set; }
public string RunNumber { get; private set; }
public string SatelliteGroup { get; private set; }
public string PartNumber { get; private set; }
public string PocketNumber { get; private set; }
public string WaferLot { get; private set; }
public string Recipe { get; private set; }
public Logistics2(string logistics2)
{
string key;
string[] segments;
key = "JOBID=";
if (!logistics2.Contains(key))
MID = "null";
else
{
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
MID = segments[1].Split(';')[0];
}
key = "MID=";
if (!logistics2.Contains(key))
RunNumber = "null";
else
{
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
RunNumber = segments[1].Split(';')[0];
}
key = "INFO=";
if (!logistics2.Contains(key))
SatelliteGroup = "null";
else
{
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
SatelliteGroup = segments[1].Split(';')[0];
}
key = "PRODUCT=";
if (!logistics2.Contains(key))
PartNumber = "null";
else
{
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
PartNumber = segments[1].Split(';')[0];
}
key = "CHAMBER=";
if (!logistics2.Contains(key))
PocketNumber = "null";
else
{
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
PocketNumber = segments[1].Split(';')[0];
}
key = "WAFER_ID=";
if (!logistics2.Contains(key))
WaferLot = "null";
else
{
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
WaferLot = segments[1].Split(';')[0];
}
key = "PPID=";
if (!logistics2.Contains(key))
Recipe = "null";
else
{
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
Recipe = segments[1].Split(';')[0];
}
}
}

View File

@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Text.Json;
namespace Adaptation.Shared.Methods;
public interface IDescription
{
string GetEventDescription();
List<string> GetDetailNames();
List<string> GetHeaderNames();
IDescription GetDisplayNames();
List<string> GetParameterNames();
List<string> GetPairedParameterNames();
List<string> GetIgnoreParameterNames(Test test);
List<string> GetNames(IFileRead fileRead, Logistics logistics);
JsonProperty[] GetDefault(IFileRead fileRead, Logistics logistics);
Dictionary<string, string> GetDisplayNamesJsonElement(IFileRead fileRead);
IDescription GetDefaultDescription(IFileRead fileRead, Logistics logistics);
List<IDescription> GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData);
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
namespace Adaptation.Shared.Methods;
public interface IFileRead : Properties.IFileRead
{
void WaitForThread();
JsonProperty[] GetDefault();
string GetEventDescription();
List<string> GetHeaderNames();
Dictionary<string, string> GetDisplayNamesJsonElement();
Tuple<string, Test[], JsonElement[], List<FileInfo>> ReExtract();
List<IDescription> GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData);
void Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception = null);
Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, string eventName);
string[] Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception);
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Shared.Methods;
public interface ILogistics : Properties.ILogistics
{
}

View File

@ -0,0 +1,5 @@
namespace Adaptation.Shared.Methods;
public interface ILogistics2 : Properties.ILogistics2
{
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
namespace Adaptation.Shared.Methods;
public interface IProcessData : Properties.IProcessData
{
string GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors);
Tuple<string, Test[], JsonElement[], List<FileInfo>> GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection);
}

View File

@ -0,0 +1,8 @@
namespace Adaptation.Shared.Methods;
public interface ISMTP
{
void SendLowPriorityEmailMessage(string subject, string body);
void SendHighPriorityEmailMessage(string subject, string body);
void SendNormalPriorityEmailMessage(string subject, string body);
}

View File

@ -0,0 +1,300 @@
using System;
using System.IO;
namespace Adaptation.Shared.Metrology;
public class ScopeInfo : Properties.IScopeInfo
{
public Test Test { get; private set; }
public Enum Enum { get; private set; }
public string HTML { get; private set; }
public string Title { get; private set; }
public string FileName { get; private set; }
public int TestValue { get; private set; }
public string Header { get; private set; }
public string QueryFilter { get; private set; }
public string FileNameWithoutExtension { get; private set; }
public ScopeInfo(Test test, string fileName, string queryFilter = "", string title = "", string html = "")
{
Enum = test;
Test = test;
HTML = html;
Title = title;
FileName = fileName;
TestValue = (int)test;
Header = string.Empty;
QueryFilter = queryFilter;
FileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName);
}
public ScopeInfo(Test test)
{
Enum = test;
Test = test;
TestValue = (int)test;
switch (Test)
{
case Test.AFMRoughness:
FileNameWithoutExtension = "afm_iqs_01";
Header = string.Empty;
QueryFilter = "AFM Roughness";
Title = "AFM";
HTML = @"GaN Epi Data\10 - afm.html";
break;
case Test.BreakdownVoltageCenter:
FileNameWithoutExtension = "bv_iqs_01";
Header = "Reactor;fDate;fRecipeName;Lot;fPocketNumber;g4Scribe;BV Position;BV Value;Tool";
QueryFilter = "Breakdown Voltage";
Title = "Breakdown Voltage-Center";
HTML = @"GaN Epi Data\03 - bv-production.html";
break;
case Test.BreakdownVoltageEdge:
FileNameWithoutExtension = "bv_iqs_01_Edge";
Header = "Reactor;fDate;fRecipeName;Lot;fPocketNumber;g4Scribe;BV Position;BV Value;Tool";
QueryFilter = "Breakdown Voltage - Edge";
Title = "Breakdown Voltage-Edge";
HTML = @"GaN Epi Data\03 - bv-production.html";
break;
case Test.BreakdownVoltageMiddle8in:
FileNameWithoutExtension = "bv_iqs_01_Middle";
Header = "Reactor;fDate;fRecipeName;Lot;fPocketNumber;g4Scribe;BV Position;BV Value;Tool";
QueryFilter = "Breakdown Voltage - Middle";
Title = "Breakdown Voltage-Middle (8 in)";
HTML = @"GaN Epi Data\03 - bv-production.html";
break;
case Test.CV:
FileNameWithoutExtension = "cv_iqs_01";
Header = "Reactor;fDate;fPart;Lot;pocketNumber;g4Scribe;Position;Vp;NdMin;Tool ID;CV Ns;CV Cap";
QueryFilter = "CV_Ns";
Title = "CV";
HTML = @"GaN Epi Data\05 - cv.html";
break;
case Test.MonthlyCV:
FileNameWithoutExtension = "cv_iqs_01";
Header = "Reactor;fDate;fPart;Lot;pocketNumber;g4Scribe;Position;Vp;NdMin;Tool ID;CV Ns;CV Cap";
QueryFilter = "CV_Ns";
Title = "CV Monthly Verification";
HTML = @"Metrology\07 - cv_verif_monthly.html";
break;
case Test.WeeklyCV:
FileNameWithoutExtension = "cv_iqs_01";
Header = "Reactor;fDate;fPart;Lot;pocketNumber;g4Scribe;Position;Vp;NdMin;Tool ID;CV Ns;CV Cap";
QueryFilter = "CV_Ns";
Title = "CV Weekly Verification";
HTML = @"Metrology\16 - cv_verif_weekly.html";
break;
case Test.CandelaKlarfDC:
FileNameWithoutExtension = "candela_iqs_01";
Header = "LotID;OperatorID;RecipeName;CandelaRecipe;WaferID;PocketNumber;RunDate;Epi;SlipLines;Cracks;EpiDef;HazeSpot;SmallLpd;MediumLpd;LargeLpd;Cracks_A;Spirals;Craters;8620 Small;Pits;Tool ID;Defect Count";
QueryFilter = "Candela Cracking";
Title = "Candela";
HTML = @"GaN Epi Data\12 - candela.html";
break;
case Test.CandelaLaser:
FileNameWithoutExtension = "candela_iqs_01";
Header = "LotID;OperatorID;RecipeName;CandelaRecipe;WaferID;PocketNumber;RunDate;Epi;SlipLines;Cracks;EpiDef;HazeSpot;SmallLpd;MediumLpd;LargeLpd;Cracks_A;Spirals;Craters;Pits;Tool ID;Defect Count";
QueryFilter = "Candela Cracking";
Title = "Candela";
HTML = @"GaN Epi Data\12 - candela.html";
break;
case Test.CandelaVerify:
FileNameWithoutExtension = "candela_iqs_01";
Header = string.Concat("LotID;OperatorID;RecipeName;CandelaRecipe;WaferID;PocketNumber;RunDate;RunID;Reactor;", "Slip Lines;Cracks;Epi Def;Haze Spot;Small LPD;Medium LPD;Large LPD;Cracks_A;Spirals;Craters;8620 Small;Pits;Tool ID;Defect Count");
QueryFilter = "Candela Cracking";
Title = "Candela";
HTML = @"GaN Epi Data\12 - candela.html";
break;
case Test.CandelaPSL:
FileNameWithoutExtension = "candela_iqs_01";
Header = string.Empty;
QueryFilter = "102-83nm";
Title = "Candela";
HTML = @"GaN Epi Data\12 - candela.html";
break;
case Test.CandelaProdU:
FileNameWithoutExtension = "candela_iqs_01";
Header = string.Empty;
QueryFilter = "SPE verification";
Title = "Candela";
HTML = @"GaN Epi Data\12 - candela.html";
break;
case Test.Denton:
FileNameWithoutExtension = "denton_iqs_01";
Header = "Tool;fDate;Run;Recipe;Operator;Name;Value";
QueryFilter = "Denton_Voltage_AVG";
Title = "Denton Data";
HTML = @"Support Process\03 - ebeam02_denton_v1.html";
break;
case Test.Hall:
FileNameWithoutExtension = "hall_iqs_01";
Header = "Lot;Tool;TimeDate;RunDate;RunID;Part;Reactor;Scribe;PocketNumber;Tool ID;Name;Value";
QueryFilter = "Hall Rs";
Title = "Hall Data";
HTML = @"GaN Epi Data\04 - hall.html";
break;
case Test.MonthlyHall:
FileNameWithoutExtension = "hall_iqs_01";
Header = "Lot;Tool;TimeDate;RunDate;RunID;Part;Reactor;Scribe;PocketNumber;Tool ID;Name;Value";
QueryFilter = "Hall Rs";
Title = "Hall Monthly Verification";
HTML = @"Metrology\06 - hall_verif_monthly.html";
break;
case Test.WeeklyHall:
FileNameWithoutExtension = "hall_iqs_01";
Header = "Lot;Tool;TimeDate;RunDate;RunID;Part;Reactor;Scribe;PocketNumber;Tool ID;Name;Value";
QueryFilter = "Hall Rs";
Title = "Hall Weekly Verification";
HTML = @"Metrology\15 - hall_verif_weekly.html";
break;
case Test.Lehighton:
FileNameWithoutExtension = "lei_iqs_01";
Header = "Reactor;Date;Recipe;Lot;Pocket;Scribe;Tool;Name;Value";
QueryFilter = "LEI RS Average value";
Title = "Lehighton";
HTML = @"GaN Epi Data\13 - lehighton.html";
break;
case Test.VerificationLehighton:
FileNameWithoutExtension = "___";
Header = "Reactor;Date;Recipe;Lot;Pocket;Scribe;Tool;Name;Value";
QueryFilter = "___";
Title = "LEI Weekly Verification 2 Ohm cm";
HTML = @"Metrology\14 - lei_verif_weekly.html.html";
break;
case Test.Microscope:
FileNameWithoutExtension = string.Empty;
Header = string.Empty;
QueryFilter = "Microscope Center 5x";
Title = "Total Microscope Defects";
HTML = string.Empty;
break;
case Test.RPMXY:
FileNameWithoutExtension = "RPM_Data";
Header = "Lot;Date;Recipe;Reactor;Scribe;Pocket;Tool;Name;Value";
QueryFilter = "Barrier_Composition_RPM_XY";
Title = "RPM XY Data ***&*** View Data";
HTML = @"GaN Epi Data\09 - rpm --- 08 - photoluminescence.html";
break;
case Test.RPMAverage:
FileNameWithoutExtension = "RPMdata-short";
Header = "fProductId;fDate;average;stdDev;fRecipeName;Reactor;g4Scribe;Pocket Number;Tool ID;Recipe From Rpm File";
QueryFilter = "Epi Thickness Mean";
Title = "RPM Average Data";
HTML = @"GaN Epi Data\09 - rpm.html";
break;
case Test.RPMPLRatio:
FileNameWithoutExtension = "PHOTOLUMINESCENCE_data-short";
Header = "fProductId;fDate;g4Scribe;fRecipeName;bandEdge_nm;bandEdge_V;yellowBand_Pmw;yellowBand_nm;yellowBand_V;Reactor;Pocket Number;Tool ID";
QueryFilter = "PL Ratio";
Title = "Photoluminescence: PL Ratio";
HTML = @"GaN Epi Data\08 - photoluminescence.html";
break;
case Test.DailyRPMXY:
FileNameWithoutExtension = "RPM_Data";
Header = "Lot;Date;Recipe;Reactor;Scribe;Pocket;Tool;Name;Value";
QueryFilter = "Barrier_Composition_RPM_XY";
Title = "";
HTML = @"Metrology\?";
break;
case Test.DailyRPMAverage:
FileNameWithoutExtension = "RPMdata-short";
Header = "fProductId;fDate;average;stdDev;fRecipeName;Reactor;g4Scribe;Pocket Number;Tool ID;Recipe From Rpm File";
QueryFilter = "Epi Thickness Mean";
Title = "";
HTML = @"Metrology\?";
break;
case Test.DailyRPMPLRatio:
FileNameWithoutExtension = "PHOTOLUMINESCENCE_data-short";
Header = "fProductId;fDate;g4Scribe;fRecipeName;bandEdge_nm;bandEdge_V;yellowBand_Pmw;yellowBand_nm;yellowBand_V;Reactor;Pocket Number;Tool ID";
QueryFilter = "PL Ratio";
Title = "RPM Daily Verification";
HTML = @"Metrology\17 - rpm_verif_daily.html";
break;
case Test.VerificationRPM:
FileNameWithoutExtension = "PhotoLuminescence_Ver";
Header = "Part;Process;Date;Test;Value";
QueryFilter = "PL Edge Wavelength";
Title = "PL Daily Verification - [PL Edge Wavelength]";
HTML = @"Metrology\18 - photoluminescence_verif_daily.html";
break;
case Test.Photoreflectance:
FileNameWithoutExtension = "photoreflect_iqs_01";
Header = "Lot;Date;Part;Reactor;Scribe;Pocket;Tool;Point;WaferPosition_PR;PR_Peak";
QueryFilter = "PR Barrier Composition";
Title = "Photoreflectance 6 in, Photoreflectance 8 in";
HTML = @"GaN Epi Data\07 - photoreflectance.html";
break;
case Test.UV:
FileNameWithoutExtension = "uv_iqs_01";
Header = string.Empty;
QueryFilter = "UV Broken";
Title = "UV";
HTML = @"GaN Epi Data\15 - uv 2.1.html";
break;
case Test.VpdIcpmsAnalyte:
FileNameWithoutExtension = "VPD_iqs_01";
Header = "Reactor;RunID;RunDate;PartNumber;PocketNumber;WaferScribe;Analyte;Value";
QueryFilter = "Mg";
Title = "VpdIcpmsAnalyteData";
HTML = @"";
break;
case Test.WarpAndBow:
FileNameWithoutExtension = "warp_iqs_01";
Header = "fDate;fRecipeName;fProductId;g4Scribe;warp;bow;tool;Reactor;Pocket ID;bow_range;BowX;BowY;CenterBow";
QueryFilter = "BowCenter";
Title = "Warp and Bow";
HTML = @"GaN Epi Data\14 - warp.html";
break;
case Test.VerificationWarpAndBow:
FileNameWithoutExtension = "warp_ver_iqs_01";
Header = "Part;Process;Date;WaferScribe;totWarp;bow";
QueryFilter = "Bow Calibration";
Title = "6 Inch Warp/Bow Daily Verification, 8 Inch Warp/Bow Daily Verification";
HTML = @"Metrology\19 - warp_cal_daily.html";
break;
case Test.XRDXY:
FileNameWithoutExtension = "xrd_iqs_NEW_01";
Header = "Reactor;fDate;fRecipeName;Lot;pocketNumber;g4Scribe;ToolID;Name;Value;Group";
QueryFilter = "SL Period";
Title = "XRD XY Raw Data Viewer";
HTML = @"GaN Epi Data\11 - xrd.html";
break;
case Test.XRDWeightedAverage:
FileNameWithoutExtension = "xrd_iqs_NEW_01_WtAVG";
Header = "Reactor;fDate;fRecipeName;Lot;pocketNumber;g4Scribe;Name;Value;Group";
//QueryFilter = "Al% Barrier WTAVG";
QueryFilter = "SL Period WTAVG";
Title = "XRD Weighted Average Data";
HTML = @"GaN Epi Data\11 - xrd.html";
break;
case Test.MonthlyXRD:
FileNameWithoutExtension = "xrd_monthly_ver_iqs_01";
Header = "Part;Process;Date;TestName;Value";
QueryFilter = "XRD 2-Theta Position";
Title = "XRD Monthly Verification";
HTML = @"Metrology\03 - xrd_verif_monthly.html";
break;
case Test.WeeklyXRD:
FileNameWithoutExtension = "xrd_weekly_ver_iqs_01";
Header = "Part;Process;Lot;Date;TestName;Value";
QueryFilter = "XRD Weekly AL% Center";
Title = "XRD Weekly Verification";
HTML = @"Metrology\12 - xrd_verif_weekly.html";
break;
case Test.JVXRD:
FileNameWithoutExtension = "xrd_iqs_NEW_01";
Header = "Reactor;fDate;fRecipeName;Lot;pocketNumber;g4Scribe;ToolID;Name;Value;Group";
QueryFilter = "SL Period";
Title = "XRD XY Raw Data Viewer";
HTML = @"GaN Epi Data\11 - xrd.html";
break;
default:
throw new Exception();
}
FileName = string.Concat(FileNameWithoutExtension, ".txt");
}
public ScopeInfo ShallowCopy() => (ScopeInfo)MemberwiseClone();
}

View File

@ -0,0 +1,21 @@
namespace Adaptation.Shared.Metrology;
public partial class WS
{
public class Attachment
{
public string UniqueId { get; set; }
public string DestinationFileName { get; set; }
public string SourceFileName { get; set; }
public Attachment(string uniqueId, string destinationFileName, string sourceFileName)
{
UniqueId = uniqueId;
DestinationFileName = destinationFileName;
SourceFileName = sourceFileName;
}
}
}

View File

@ -0,0 +1,27 @@
using System.Collections.Generic;
using System.Text.Json;
namespace Adaptation.Shared.Metrology;
public partial class WS
{
// this class represents the response from the Inbound API endpoint
public class Results
{
// true or false if data was written to the database
public bool Success { get; set; }
// if true, contains ID of the Header record in the database
public long HeaderID { get; set; }
// if false, this collection will contain a list of errors
public List<string> Errors { get; set; }
// this collection will contain a list of warnings, they will not prevent data from being saved
public List<string> Warnings { get; set; }
// this is just a helper function to make displaying the results easier
public override string ToString() => JsonSerializer.Serialize(this, GetType());
}
}

View File

@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Text.Json;
namespace Adaptation.Shared.Metrology;
public partial class WS
{
public static (string, Results) SendData(string url, object payload, int timeoutSeconds = 120)
{
Results results = new();
string resultsJson = string.Empty;
try
{
string json = JsonSerializer.Serialize(payload, payload.GetType());
if (string.IsNullOrEmpty(url) || !url.Contains(":") || !url.Contains("."))
throw new Exception("Invalid URL");
using (HttpClient httpClient = new())
{
httpClient.Timeout = new TimeSpan(0, 0, 0, timeoutSeconds, 0);
HttpRequestMessage httpRequestMessage = new()
{
RequestUri = new Uri(url),
Method = HttpMethod.Post,
Content = new StringContent(json, Encoding.UTF8, "application/json")
};
HttpResponseMessage httpResponseMessage = httpClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead).Result;
resultsJson = httpResponseMessage.Content.ReadAsStringAsync().Result;
results = JsonSerializer.Deserialize<Results>(resultsJson);
}
if (!results.Success)
results.Errors.Add(results.ToString());
}
catch (Exception e)
{
Exception exception = e;
StringBuilder stringBuilder = new();
while (exception is not null)
{
_ = stringBuilder.AppendLine(exception.Message);
exception = exception.InnerException;
}
if (results.Errors is null)
results.Errors = new List<string>();
results.Errors.Add(stringBuilder.ToString());
}
return new(resultsJson, results);
}
// this method is a wrapper for attaching a file to either a header or data record
// URL is the same URL used for SendData, ex: http://localhost/api/inbound/CDE
// attachToHeaderId is the ID returned by SendData
// attachToDataUniqueId is the string unique ID for the data record, aka the Title of the Sharepoint list entry
// fileContents is a byte array with the contents of the file
// fileName is which attachment this is, image.pdf, data.pdf, data.txt, header.pdf, etc
// timeoutSeconds is configured as the request timeout
// this method will either succeed or throw an exception
// also, this has been made synchronous
public static void AttachFile(string url, long attachToHeaderId, string attachToDataUniqueId, byte[] fileContents, string fileName, int timeoutSeconds = 60)
{
using HttpClient httpClient = new();
string requestUrl = url + "/attachment?headerid=" + attachToHeaderId.ToString();
if (!string.IsNullOrWhiteSpace(attachToDataUniqueId))
{
requestUrl += "&datauniqueid=";
requestUrl += System.Net.WebUtility.UrlEncode(attachToDataUniqueId);
}
requestUrl += "&filename="; // this is just so the web server log shows the filename
requestUrl += System.Net.WebUtility.UrlEncode(fileName);
httpClient.Timeout = new TimeSpan(0, 0, 0, timeoutSeconds, 0);
MultipartFormDataContent multipartFormDataContent = new();
ByteArrayContent byteArrayContent = new(fileContents);
byteArrayContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream");
multipartFormDataContent.Add(byteArrayContent, "attachment", fileName);
HttpResponseMessage httpResponseMessage = httpClient.PostAsync(requestUrl, multipartFormDataContent).Result;
if (httpResponseMessage.IsSuccessStatusCode)
return;
string resultBody = httpResponseMessage.Content.ReadAsStringAsync().Result;
throw new Exception("Attachment failed: " + resultBody);
}
public static void AttachFiles(string url, long headerID, List<Attachment> headerAttachments = null, List<Attachment> dataAttachments = null)
{
try
{
if (headerAttachments is not null)
{
foreach (Attachment attachment in headerAttachments)
AttachFile(url, headerID, "", File.ReadAllBytes(attachment.SourceFileName), attachment.DestinationFileName);
}
if (dataAttachments is not null)
{
foreach (Attachment attachment in dataAttachments)
AttachFile(url, headerID, attachment.UniqueId, File.ReadAllBytes(attachment.SourceFileName), attachment.DestinationFileName);
}
//MessageBox.Show(r.ToString());
}
catch (Exception e)
{
Exception exception = e;
StringBuilder stringBuilder = new();
while (exception is not null)
{
_ = stringBuilder.AppendLine(exception.Message);
exception = exception.InnerException;
}
//MessageBox.Show(msgs.ToString(), "Exception", //MessageBoxButtons.OK, //MessageBoxIcon.Error);
throw new Exception(stringBuilder.ToString());
}
}
}

View File

@ -0,0 +1,10 @@
namespace Adaptation.Shared;
public enum ParameterType
{
String = 0,
Integer = 2,
Double = 3,
Boolean = 4,
StructuredType = 5
}

View File

@ -0,0 +1,409 @@
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
namespace Adaptation.Shared;
public class ProcessDataStandardFormat
{
public enum SearchFor
{
EquipmentIntegration = 1,
BusinessIntegration = 2,
SystemExport = 3,
Archive = 4
}
public static string GetPDSFText(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, string logisticsText)
{
string result;
if (!jsonElements.Any())
result = string.Empty;
else
{
int columns = 0;
List<string> lines;
string endOffset = "E#######T";
string dataOffset = "D#######T";
string headerOffset = "H#######T";
string format = "MM/dd/yyyy HH:mm:ss";
StringBuilder stringBuilder = new();
lines = new string[] { "HEADER_TAG\tHEADER_VALUE", "FORMAT\t2.00", "NUMBER_PASSES\t0001", string.Concat("HEADER_OFFSET\t", headerOffset), string.Concat("DATA_OFFSET\t", dataOffset), string.Concat("END_OFFSET\t", endOffset) }.ToList();
_ = stringBuilder.Append("\"Time\"").Append('\t');
_ = stringBuilder.Append("\"A_LOGISTICS\"").Append('\t');
_ = stringBuilder.Append("\"B_LOGISTICS\"").Append('\t');
for (int i = 0; i < jsonElements.Length;)
{
foreach (JsonProperty jsonProperty in jsonElements[0].EnumerateObject())
{
columns += 1;
_ = stringBuilder.Append('"').Append(jsonProperty.Name).Append('"').Append('\t');
}
break;
}
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
lines.Add(stringBuilder.ToString());
for (int i = 0; i < jsonElements.Length; i++)
{
_ = stringBuilder.Clear();
_ = stringBuilder.Append("0.1").Append('\t');
_ = stringBuilder.Append('1').Append('\t');
_ = stringBuilder.Append('2').Append('\t');
foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject())
_ = stringBuilder.Append(jsonProperty.Value).Append('\t');
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
lines.Add(stringBuilder.ToString());
}
lines.Add(string.Concat("NUM_DATA_ROWS ", jsonElements.Length.ToString().PadLeft(9, '0')));
lines.Add(string.Concat("NUM_DATA_COLUMNS ", (columns + 3).ToString().PadLeft(9, '0')));
lines.Add("DELIMITER ;");
lines.Add(string.Concat("START_TIME_FORMAT ", format));
lines.Add(string.Concat("START_TIME ", logistics.DateTimeFromSequence.ToString(format))); //12/26/2019 15:22:44
lines.Add(string.Concat("LOGISTICS_COLUMN", '\t', "A_LOGISTICS"));
lines.Add(string.Concat("LOGISTICS_COLUMN", '\t', "B_LOGISTICS"));
if (!string.IsNullOrEmpty(logisticsText))
lines.Add(logisticsText);
else
{
lines.Add(string.Concat("LOGISTICS_1", '\t', "A_CHAMBER=;A_INFO=", fileRead.EventName, ";A_INFO2=", fileRead.EquipmentType, ";A_JOBID=", fileRead.CellInstanceName, ";A_MES_ENTITY=", fileRead.MesEntity, ";A_MID=", logistics.MID, ";A_NULL_DATA=", fileRead.NullData, ";A_PPID=NO_PPID;A_PROCESS_JOBID=", logistics.ProcessJobID, ";A_PRODUCT=;A_SEQUENCE=", logistics.Sequence, ";A_WAFER_ID=;"));
lines.Add(string.Concat("LOGISTICS_2", '\t', "B_CHAMBER=;B_INFO=", fileRead.EventName, ";B_INFO2=", fileRead.EquipmentType, ";B_JOBID=", fileRead.CellInstanceName, ";B_MES_ENTITY=", fileRead.MesEntity, ";B_MID=", logistics.MID, ";B_NULL_DATA=", fileRead.NullData, ";B_PPID=NO_PPID;B_PROCESS_JOBID=", logistics.ProcessJobID, ";B_PRODUCT=;B_SEQUENCE=", logistics.Sequence, ";B_WAFER_ID=;"));
lines.Add("END_HEADER");
}
_ = stringBuilder.Clear();
foreach (string line in lines)
_ = stringBuilder.AppendLine(line);
result = stringBuilder.ToString();
result = result.Replace(headerOffset, result.IndexOf("NUM_DATA_ROWS").ToString().PadLeft(9, '0')).
Replace(dataOffset, result.IndexOf('"').ToString().PadLeft(9, '0')).
Replace(endOffset, result.Length.ToString().PadLeft(9, '0'));
}
return result;
}
public static Tuple<string, string[], string[]> GetLogisticsColumnsAndBody(string reportFullPath, string[] lines = null)
{
string segment;
List<string> body = new();
StringBuilder logistics = new();
if (lines is null)
lines = File.ReadAllLines(reportFullPath);
string[] segments;
if (lines.Length < 7)
segments = Array.Empty<string>();
else
segments = lines[6].Trim().Split('\t');
List<string> columns = new();
for (int c = 0; c < segments.Length; c++)
{
segment = segments[c].Substring(1, segments[c].Length - 2);
if (!columns.Contains(segment))
columns.Add(segment);
else
{
for (short i = 1; i < short.MaxValue; i++)
{
segment = string.Concat(segment, "_", i);
if (!columns.Contains(segment))
{
columns.Add(segment);
break;
}
}
}
}
bool lookForLogistics = false;
for (int r = 7; r < lines.Length; r++)
{
if (lines[r].StartsWith("NUM_DATA_ROWS"))
lookForLogistics = true;
if (!lookForLogistics)
{
body.Add(lines[r]);
continue;
}
if (lines[r].StartsWith("LOGISTICS_1"))
{
for (int i = r; i < lines.Length; i++)
{
if (lines[r].StartsWith("END_HEADER"))
break;
_ = logistics.AppendLine(lines[i]);
}
break;
}
}
return new Tuple<string, string[], string[]>(logistics.ToString(), columns.ToArray(), body.ToArray());
}
public static JsonElement[] GetArray(Tuple<string, string[], string[]> pdsf, bool lookForNumbers = false)
{
JsonElement[] results;
string logistics = pdsf.Item1;
string[] columns = pdsf.Item2;
string[] bodyLines = pdsf.Item3;
if (!bodyLines.Any() || !bodyLines[0].Contains('\t'))
results = JsonSerializer.Deserialize<JsonElement[]>("[]");
else
{
string value;
string[] segments;
StringBuilder stringBuilder = new();
foreach (string bodyLine in bodyLines)
{
_ = stringBuilder.Append('{');
segments = bodyLine.Trim().Split('\t');
if (!lookForNumbers)
{
for (int c = 1; c < segments.Length; c++)
{
value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\");
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\",");
}
}
else
{
for (int c = 1; c < segments.Length; c++)
{
value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\");
if (string.IsNullOrEmpty(value))
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append("null,");
else if (value.All(char.IsDigit))
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append(',');
else
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\",");
}
}
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
_ = stringBuilder.AppendLine("},");
}
_ = stringBuilder.Remove(stringBuilder.Length - 3, 3);
results = JsonSerializer.Deserialize<JsonElement[]>(string.Concat("[", stringBuilder, "]"));
}
return results;
}
public static Dictionary<string, List<string>> GetDictionary(Tuple<string, string[], string[]> pdsf)
{
Dictionary<string, List<string>> results = new();
string[] segments;
string[] columns = pdsf.Item2;
string[] bodyLines = pdsf.Item3;
foreach (string column in columns)
results.Add(column, new List<string>());
foreach (string bodyLine in bodyLines)
{
segments = bodyLine.Split('\t');
for (int c = 1; c < segments.Length; c++)
{
if (c >= columns.Length)
continue;
results[columns[c]].Add(segments[c]);
}
}
return results;
}
public static Tuple<string, Dictionary<Test, Dictionary<string, List<string>>>> GetTestDictionary(Tuple<string, string[], string[]> pdsf)
{
Dictionary<Test, Dictionary<string, List<string>>> results = new();
string testColumn = nameof(Test);
Dictionary<string, List<string>> keyValuePairs = GetDictionary(pdsf);
if (!keyValuePairs.ContainsKey(testColumn))
throw new Exception();
int min;
int max;
Test testKey;
List<string> vs;
string columnKey;
Dictionary<Test, List<int>> tests = new();
for (int i = 0; i < keyValuePairs[testColumn].Count; i++)
{
if (Enum.TryParse(keyValuePairs[testColumn][i], out Test test))
{
if (!results.ContainsKey(test))
{
tests.Add(test, new List<int>());
results.Add(test, new Dictionary<string, List<string>>());
}
tests[test].Add(i);
}
}
foreach (KeyValuePair<Test, List<int>> testKeyValuePair in tests)
{
testKey = testKeyValuePair.Key;
min = testKeyValuePair.Value.Min();
max = testKeyValuePair.Value.Max() + 1;
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
results[testKey].Add(keyValuePair.Key, new List<string>());
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
{
vs = keyValuePair.Value;
columnKey = keyValuePair.Key;
for (int i = min; i < max; i++)
{
if (vs.Count > i)
results[testKey][columnKey].Add(vs[i]);
else
results[testKey][columnKey].Add(string.Empty);
}
}
}
return new Tuple<string, Dictionary<Test, Dictionary<string, List<string>>>>(pdsf.Item1, results);
}
private static string GetString(SearchFor searchFor, bool addSpaces, char separator = ' ')
{
if (!addSpaces)
return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), searchFor);
else
return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), separator, searchFor.ToString().Replace("In", string.Concat(separator, "In")).Replace("Ex", string.Concat(separator, "Ex")));
}
public static string EquipmentIntegration(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.EquipmentIntegration, addSpaces, separator);
public static string BusinessIntegration(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.BusinessIntegration, addSpaces, separator);
public static string SystemExport(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.SystemExport, addSpaces, separator);
public static string Archive(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.Archive, addSpaces, separator);
public static string GetLines(Logistics logistics, Properties.IScopeInfo scopeInfo, List<string> names, Dictionary<string, List<string>> keyValuePairs, string dateFormat, string timeFormat, List<string> pairedParameterNames, bool useDateTimeFromSequence = true, string format = "", List<string> ignoreParameterNames = null)
{
StringBuilder result = new();
if (ignoreParameterNames is null)
ignoreParameterNames = new List<string>();
if (useDateTimeFromSequence && !string.IsNullOrEmpty(format))
throw new Exception();
else if (!useDateTimeFromSequence && string.IsNullOrEmpty(format))
throw new Exception();
string nullData;
const string columnDate = "Date";
const string columnTime = "Time";
const string firstDuplicate = "_1";
_ = result.AppendLine(scopeInfo.Header);
StringBuilder line = new();
if (logistics.NullData is null)
nullData = string.Empty;
else
nullData = logistics.NullData.ToString();
int count = (from l in keyValuePairs select l.Value.Count).Min();
for (int r = 0; r < count; r++)
{
_ = line.Clear();
_ = line.Append('!');
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
{
if (!names.Contains(keyValuePair.Key))
continue;
if (ignoreParameterNames.Contains(keyValuePair.Key))
continue;
if (pairedParameterNames.Contains(keyValuePair.Key))
{
if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData)
continue;
else
_ = result.Append(line).Append(keyValuePair.Key).Append(';').AppendLine(keyValuePair.Value[r]);
}
else
{
if (useDateTimeFromSequence && keyValuePair.Key == columnDate)
_ = line.Append(logistics.DateTimeFromSequence.ToString(dateFormat));
else if (useDateTimeFromSequence && keyValuePair.Key == columnTime)
_ = line.Append(logistics.DateTimeFromSequence.ToString(timeFormat));
else if (!useDateTimeFromSequence && keyValuePair.Key == columnDate && keyValuePair.Value[r].Length == format.Length)
_ = line.Append(DateTime.ParseExact(keyValuePair.Value[r], format, CultureInfo.InvariantCulture).ToString(dateFormat));
else if (!useDateTimeFromSequence && keyValuePair.Key == columnTime && keyValuePairs.ContainsKey(string.Concat(keyValuePair.Key, firstDuplicate)) && keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r].Length == format.Length)
_ = line.Append(DateTime.ParseExact(keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r], format, CultureInfo.InvariantCulture).ToString(timeFormat));
else if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData)
_ = line.Append(nullData);
else
_ = line.Append(keyValuePair.Value[r]);
_ = line.Append(';');
}
}
if (!pairedParameterNames.Any())
{
_ = line.Remove(line.Length - 1, 1);
_ = result.AppendLine(line.ToString());
}
}
return result.ToString();
}
public static List<string> PDSFToFixedWidth(string reportFullPath)
{
List<string> results = new();
if (!File.Exists(reportFullPath))
throw new Exception();
int[] group;
string line;
int startsAt = 0;
string[] segments;
int? currentGroup = null;
char inputSeparator = '\t';
char outputSeparator = '\t';
List<int> vs = new();
List<int[]> groups = new();
string[] lines = File.ReadAllLines(reportFullPath);
StringBuilder stringBuilder = new();
for (int i = 0; i < lines.Length; i++)
{
if (string.IsNullOrEmpty(lines[i]))
continue;
segments = lines[i].Split(inputSeparator);
if (currentGroup is null)
currentGroup = segments.Length;
if (segments.Length != currentGroup)
{
currentGroup = segments.Length;
groups.Add(new int[] { startsAt, i - 1 });
startsAt = i;
}
}
if (startsAt == lines.Length - 1 && lines[0].Split(inputSeparator).Length != currentGroup)
groups.Add(new int[] { lines.Length - 1, lines.Length - 1 });
for (int g = 0; g < groups.Count; g++)
{
vs.Clear();
group = groups[g];
line = lines[group[0]];
segments = line.Split(inputSeparator);
for (int s = 0; s < segments.Length; s++)
vs.Add(segments[s].Length);
for (int i = group[0]; i <= group[1]; i++)
{
line = lines[i];
segments = line.Split(inputSeparator);
for (int s = 0; s < segments.Length; s++)
{
if (vs[s] < segments[s].Length)
vs[s] = segments[s].Length;
}
}
_ = stringBuilder.Clear();
for (int s = 0; s < segments.Length; s++)
_ = stringBuilder.Append((s + 1).ToString().PadLeft(vs[s], ' ')).Append(outputSeparator);
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
results.Add(stringBuilder.ToString());
for (int i = group[0]; i <= group[1]; i++)
{
line = lines[i];
_ = stringBuilder.Clear();
segments = line.Split(inputSeparator);
for (int s = 0; s < segments.Length; s++)
_ = stringBuilder.Append(segments[s].PadLeft(vs[s], ' ')).Append(outputSeparator);
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
results.Add(stringBuilder.ToString());
}
results.Add(string.Empty);
}
return results;
}
}

View File

@ -0,0 +1,10 @@
namespace Adaptation.Shared.Properties;
public interface IDescription
{
int Test { get; }
int Count { get; }
int Index { get; }
}

View File

@ -0,0 +1,17 @@
namespace Adaptation.Shared.Properties;
public interface IFileRead
{
bool IsEvent { get; }
string NullData { get; }
string MesEntity { get; }
bool IsEAFHosted { get; }
string EventName { get; }
string EquipmentType { get; }
string ReportFullPath { get; }
string CellInstanceName { get; }
string ExceptionSubject { get; }
bool UseCyclicalForDescription { get; }
string CellInstanceConnectionName { get; }
string ParameterizedModelObjectDefinitionType { get; }
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace Adaptation.Shared.Properties;
public interface ILogistics
{
public DateTime DateTimeFromSequence { get; }
public FileInfo FileInfo { get; }
public string JobID { get; }
public List<string> Logistics1 { get; }
public List<Logistics2> Logistics2 { get; }
public string MID { get; }
public string MesEntity { get; }
public object NullData { get; }
public string ProcessJobID { get; }
public string ReportFullPath { get; }
public long Sequence { get; }
public double TotalSecondsSinceLastWriteTimeFromSequence { get; }
}

View File

@ -0,0 +1,14 @@
namespace Adaptation.Shared.Properties;
public interface ILogistics2
{
public string MID { get; }
public string RunNumber { get; }
public string SatelliteGroup { get; }
public string PartNumber { get; }
public string PocketNumber { get; }
public string WaferLot { get; }
public string Recipe { get; }
}

View File

@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace Adaptation.Shared.Properties;
public interface IProcessData
{
List<object> Details { get; }
}

View File

@ -0,0 +1,17 @@
using System;
namespace Adaptation.Shared.Properties;
public interface IScopeInfo
{
Enum Enum { get; }
string HTML { get; }
string Title { get; }
string FileName { get; }
int TestValue { get; }
string Header { get; }
string QueryFilter { get; }
string FileNameWithoutExtension { get; }
}

58
Adaptation/Shared/Test.cs Normal file
View File

@ -0,0 +1,58 @@
namespace Adaptation.Shared;
public enum Test
{
AFMRoughness = 34,
BioRadQS408M = 25,
BioRadStratus = 26,
BreakdownVoltageCenter = 0,
BreakdownVoltageEdge = 1,
BreakdownVoltageMiddle8in = 2,
CandelaKlarfDC = 6,
CandelaLaser = 36,
CandelaProdU = 39,
CandelaPSL = 38,
CandelaVerify = 37,
CDE = 24,
CV = 3,
DailyRPMAverage = 19,
DailyRPMPLRatio = 20,
DailyRPMXY = 18,
Denton = 9,
DiffusionLength = 45,
GRATXTCenter = 51,
GRATXTEdge = 52, //Largest
GrowthRateXML = 50,
Hall = 10,
HgCV = 23,
JVXRD = 47,
Lehighton = 13,
LogbookCAC = 49,
Microscope = 46,
MonthlyCV = 4,
MonthlyHall = 11,
MonthlyXRD = 32,
Photoreflectance = 22,
PlatoA = 48,
RPMAverage = 16,
RPMPLRatio = 17,
RPMXY = 15,
SP1 = 8,
Tencor = 7,
UV = 35,
VerificationLehighton = 14,
VerificationRPM = 21,
VerificationWarpAndBow = 29,
VpdIcpmsAnalyte = 27,
WarpAndBow = 28,
WeeklyCV = 5,
WeeklyHall = 12,
WeeklyXRD = 33,
WeeklyXRDAIcomp = 40,
WeeklyXRDFWHM002 = 41,
WeeklyXRDFWHM105 = 42,
WeeklyXRDSLStks = 43,
WeeklyXRDXRR = 44,
XRDWeightedAverage = 31,
XRDXY = 30,
}

View File

@ -0,0 +1,60 @@
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace Adaptation._Tests.CreateSelfDescription.Staging.v2_43_0;
[TestClass]
public class DEP08SIHTRPLC : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static DEP08SIHTRPLC EAFLoggingUnitTesting { get; private set; }
public DEP08SIHTRPLC() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public DEP08SIHTRPLC(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
if (EAFLoggingUnitTesting is null)
EAFLoggingUnitTesting = new DEP08SIHTRPLC(testContext);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
}
[ClassCleanup()]
public static void ClassCleanup()
{
if (EAFLoggingUnitTesting.Logger is not null)
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
if (EAFLoggingUnitTesting is not null)
EAFLoggingUnitTesting.Dispose();
}
[TestMethod]
public void Staging__v2_43_0__DEP08SIHTRPLC__ZipFilesByDate()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}

View File

@ -0,0 +1,24 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Adaptation._Tests.Extract.Staging.v2_43_0;
[TestClass]
public class DEP08SIHTRPLC
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Staging.v2_43_0.DEP08SIHTRPLC _DEP08SIHTRPLC;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Staging.v2_43_0.DEP08SIHTRPLC.ClassInitialize(testContext);
_DEP08SIHTRPLC = CreateSelfDescription.Staging.v2_43_0.DEP08SIHTRPLC.EAFLoggingUnitTesting;
}
[TestMethod]
public void Staging__v2_43_0__DEP08SIHTRPLC__ZipFilesByDate() => _DEP08SIHTRPLC.Staging__v2_43_0__DEP08SIHTRPLC__ZipFilesByDate();
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace Adaptation._Tests.Shared;
public class EAFLoggingUnitTesting : LoggingUnitTesting, IDisposable
{
protected readonly AdaptationTesting _AdaptationTesting;
public AdaptationTesting AdaptationTesting => _AdaptationTesting;
public EAFLoggingUnitTesting(TestContext testContext, Type declaringType, bool skipEquipmentDictionary) :
base(testContext, declaringType)
{
if (testContext is null || declaringType is null)
_AdaptationTesting = null;
else
_AdaptationTesting = new AdaptationTesting(testContext, skipEquipmentDictionary);
}
public new void Dispose()
{
base.Dispose();
GC.SuppressFinalize(this);
}
}

View File

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

View File

@ -0,0 +1,36 @@
using Microsoft.Extensions.Logging;
using System;
namespace Adaptation._Tests.Shared.Log;
public class ConsoleLogger : ILogger
{
public int EventId { get; set; }
private readonly string _Name;
private readonly LogLevel _LogLevel;
public ConsoleLogger(LogLevel logLevel, string name)
{
_Name = name;
EventId = 0;
_LogLevel = logLevel;
if (string.IsNullOrEmpty(_Name))
{ }
}
public IDisposable BeginScope<TState>(TState state) => null;
public bool IsEnabled(LogLevel logLevel) => logLevel >= _LogLevel;
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
if (IsEnabled(logLevel) && (EventId == 0 || EventId == eventId.Id))
{
string message = formatter(state, null);
Console.WriteLine(message);
}
}
}

View File

@ -0,0 +1,27 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Concurrent;
namespace Adaptation._Tests.Shared.Log;
public class ConsoleProvider : ILoggerProvider
{
private readonly LogLevel _LogLevel;
private readonly ConcurrentDictionary<string, ConsoleLogger> _Loggers;
public ConsoleProvider(LogLevel logLevel)
{
_LogLevel = logLevel;
_Loggers = new ConcurrentDictionary<string, ConsoleLogger>();
}
public ILogger CreateLogger(string categoryName) => _Loggers.GetOrAdd(categoryName, name => new ConsoleLogger(_LogLevel, name));
public void Dispose()
{
_Loggers.Clear();
GC.SuppressFinalize(this);
}
}

View File

@ -0,0 +1,36 @@
using Microsoft.Extensions.Logging;
using System;
namespace Adaptation._Tests.Shared.Log;
public class DebugLogger : ILogger
{
public int EventId { get; set; }
private readonly string _Name;
private readonly LogLevel _LogLevel;
public DebugLogger(LogLevel logLevel, string name)
{
_Name = name;
EventId = 0;
_LogLevel = logLevel;
if (string.IsNullOrEmpty(_Name))
{ }
}
public IDisposable BeginScope<TState>(TState state) => null;
public bool IsEnabled(LogLevel logLevel) => logLevel >= _LogLevel;
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
if (IsEnabled(logLevel) && (EventId == 0 || EventId == eventId.Id))
{
string message = formatter(state, null);
System.Diagnostics.Debug.Print(message);
}
}
}

View File

@ -0,0 +1,27 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Concurrent;
namespace Adaptation._Tests.Shared.Log;
public class DebugProvider : ILoggerProvider
{
private readonly LogLevel _LogLevel;
private readonly ConcurrentDictionary<string, DebugLogger> _Loggers;
public DebugProvider(LogLevel logLevel)
{
_LogLevel = logLevel;
_Loggers = new ConcurrentDictionary<string, DebugLogger>();
}
public ILogger CreateLogger(string categoryName) => _Loggers.GetOrAdd(categoryName, name => new DebugLogger(_LogLevel, name));
public void Dispose()
{
_Loggers.Clear();
GC.SuppressFinalize(this);
}
}

View File

@ -0,0 +1,49 @@
using Microsoft.Extensions.Logging;
using System;
namespace Adaptation._Tests.Shared.Log;
public class FeedbackLogger : ILogger
{
public int EventId { get; set; }
private readonly string _Name;
private readonly LogLevel _LogLevel;
private readonly IFeedback _Feedback;
public FeedbackLogger(LogLevel logLevel, IFeedback feedback, string name)
{
_Feedback = feedback;
_Name = name;
EventId = 0;
_LogLevel = logLevel;
if (string.IsNullOrEmpty(_Name))
{ }
}
public IDisposable BeginScope<TState>(TState state) => null;
public bool IsEnabled(LogLevel logLevel) => logLevel >= _LogLevel;
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
if (IsEnabled(logLevel) && (EventId == 0 || EventId == eventId.Id))
{
string message = formatter(state, null);
int color = logLevel switch
{
LogLevel.Trace => -1,
LogLevel.Debug => -1,
LogLevel.Information => -16776961,
LogLevel.Warning => -65281,
LogLevel.Error => -65536,
LogLevel.Critical => -65536,
LogLevel.None => -1,
_ => throw new Exception(),
};
_Feedback.Print(message, color);
}
}
}

View File

@ -0,0 +1,29 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Concurrent;
namespace Adaptation._Tests.Shared.Log;
public class FeedbackProvider : ILoggerProvider
{
private readonly LogLevel _LogLevel;
private readonly IFeedback _Feedback;
private readonly ConcurrentDictionary<string, FeedbackLogger> _Loggers;
public FeedbackProvider(LogLevel logLevel, IFeedback feedback)
{
_LogLevel = logLevel;
_Feedback = feedback;
_Loggers = new ConcurrentDictionary<string, FeedbackLogger>();
}
public ILogger CreateLogger(string categoryName) => _Loggers.GetOrAdd(categoryName, name => new FeedbackLogger(_LogLevel, _Feedback, name));
public void Dispose()
{
_Loggers.Clear();
GC.SuppressFinalize(this);
}
}

View File

@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace Adaptation._Tests.Shared.Log;
public interface IFeedback
{
List<string> Messages { get; }
void Print(string message, int color);
}

View File

@ -0,0 +1,139 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
namespace Adaptation._Tests.Shared.Log;
public class Log
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private readonly ILogger _Logger;
public Log(ILogger logger) => _Logger = logger;
public void Black(object message) => _Logger.LogInformation(message.ToString());
public void Blue(object message) => _Logger.LogInformation(message.ToString());
public void Gray(object message) => _Logger.LogInformation(message.ToString());
public void Green(object message) => _Logger.LogInformation(message.ToString());
public void Magenta(string message, Exception exception) => _Logger.LogWarning(message, exception);
public void Red(string message, Exception exception) => _Logger.LogError(message, exception);
public void White(object message) => _Logger.LogInformation(message.ToString());
public void Yellow(string message, Exception exception) => _Logger.LogWarning(message, exception);
//
public void DoLog(LogLevel logLevel, EventId eventId, Exception exception, string message, params object[] args) => _Logger.Log(logLevel, eventId, exception, message, args);
public void DoLog(LogLevel logLevel, EventId eventId, string message, params object[] args) => _Logger.Log(logLevel, eventId, message, args);
public void DoLog(LogLevel logLevel, Exception exception, string message, params object[] args) => _Logger.Log(logLevel, exception, message, args);
public void DoLog(LogLevel logLevel, string message, params object[] args) => _Logger.Log(logLevel, message, args);
public void LogCritical(EventId eventId, Exception exception, string message, params object[] args) => _Logger.LogCritical(eventId, exception, message, args);
public void LogCritical(EventId eventId, string message, params object[] args) => _Logger.LogCritical(eventId, message, args);
public void LogCritical(Exception exception, string message, params object[] args) => _Logger.LogCritical(exception, message, args);
public void LogCritical(string message, params object[] args) => _Logger.LogCritical(message, args);
public void LogDebug(EventId eventId, Exception exception, string message, params object[] args) => _Logger.LogDebug(eventId, exception, message, args);
public void LogDebug(EventId eventId, string message, params object[] args) => _Logger.LogDebug(eventId, message, args);
public void LogDebug(Exception exception, string message, params object[] args) => _Logger.LogDebug(exception, message, args);
public void LogDebug(string message, params object[] args) => _Logger.LogDebug(message, args);
public void LogError(EventId eventId, Exception exception, string message, params object[] args) => _Logger.LogError(eventId, exception, message, args);
public void LogError(EventId eventId, string message, params object[] args) => _Logger.LogError(eventId, message, args);
public void LogError(Exception exception, string message, params object[] args) => _Logger.LogError(message, args);
public void LogError(string message, params object[] args) => _Logger.LogError(message, args);
public void LogInformation(EventId eventId, Exception exception, string message, params object[] args) => _Logger.LogInformation(eventId, exception, message, args);
public void LogInformation(EventId eventId, string message, params object[] args) => _Logger.LogInformation(eventId, message, args);
public void LogInformation(Exception exception, string message, params object[] args) => _Logger.LogInformation(exception, message, args);
public void LogInformation(string message, params object[] args) => _Logger.LogInformation(message, args);
public void LogTrace(EventId eventId, Exception exception, string message, params object[] args) => _Logger.LogTrace(eventId, exception, message, args);
public void LogTrace(EventId eventId, string message, params object[] args) => _Logger.LogTrace(eventId, message, args);
public void LogTrace(Exception exception, string message, params object[] args) => _Logger.LogTrace(exception, message, args);
public void LogTrace(string message, params object[] args) => _Logger.LogTrace(message, args);
public void LogWarning(EventId eventId, Exception exception, string message, params object[] args) => _Logger.LogWarning(eventId, exception, message, args);
public void LogWarning(EventId eventId, string message, params object[] args) => _Logger.LogWarning(eventId, message, args);
public void LogWarning(Exception exception, string message, params object[] args) => _Logger.LogWarning(exception, message, args);
public void LogWarning(string message, params object[] args) => _Logger.LogWarning(message, args);
//
public void Debug() => _Logger.LogDebug(string.Empty);
public void Debug(object message) => _Logger.LogDebug(message.ToString());
public void Debug(string message, Exception exception) => _Logger.LogDebug(exception, message);
public void DebugFormat(IFormatProvider provider, string format, params object[] args) => _Logger.LogDebug(string.Format(provider, format, args));
public void DebugFormat(string format, object arg0, object arg1, object arg2) => _Logger.LogDebug(string.Format(format, arg0, arg1, arg2));
public void DebugFormat(string format, object arg0, object arg1) => _Logger.LogDebug(string.Format(format, arg0, arg1));
public void DebugFormat(string format, object arg0) => _Logger.LogDebug(string.Format(format, arg0));
public void DebugFormat(string format, params object[] args) => _Logger.LogDebug(string.Format(format, args));
public void Error(object message) => _Logger.LogError(message.ToString());
public void Error(string message, Exception exception) => _Logger.LogError(exception, message.ToString());
public void ErrorFormat(IFormatProvider provider, string format, params object[] args) => _Logger.LogError(string.Format(provider, format, args));
public void ErrorFormat(string format, object arg0, object arg1, object arg2) => _Logger.LogError(string.Format(format, arg0, arg1, arg2));
public void ErrorFormat(string format, object arg0, object arg1) => _Logger.LogError(string.Format(format, arg0, arg1));
public void ErrorFormat(string format, object arg0) => _Logger.LogError(string.Format(format, arg0));
public void ErrorFormat(string format, params object[] args) => _Logger.LogError(string.Format(format, args));
public void Fatal(object message) => _Logger.LogCritical(message.ToString());
public void Fatal(string message, Exception exception) => _Logger.LogCritical(exception, message.ToString());
public void FatalFormat(IFormatProvider provider, string format, params object[] args) => _Logger.LogCritical(string.Format(provider, format, args));
public void FatalFormat(string format, object arg0, object arg1, object arg2) => _Logger.LogCritical(string.Format(format, arg0, arg1, arg2));
public void FatalFormat(string format, object arg0, object arg1) => _Logger.LogCritical(string.Format(format, arg0, arg1));
public void FatalFormat(string format, object arg0) => _Logger.LogCritical(string.Format(format, arg0));
public void FatalFormat(string format, params object[] args) => _Logger.LogCritical(string.Format(format, args));
public void Info(object message) => _Logger.LogInformation(message.ToString());
public void Info(string message, Exception exception) => _Logger.LogInformation(exception, message.ToString());
public void InfoFormat(IFormatProvider provider, string format, params object[] args) => _Logger.LogInformation(string.Format(provider, format, args));
public void InfoFormat(string format, object arg0, object arg1, object arg2) => _Logger.LogInformation(string.Format(format, arg0, arg1, arg2));
public void InfoFormat(string format, object arg0, object arg1) => _Logger.LogInformation(string.Format(format, arg0, arg1));
public void InfoFormat(string format, object arg0) => _Logger.LogInformation(string.Format(format, arg0));
public void InfoFormat(string format, params object[] args) => _Logger.LogInformation(string.Format(format, args));
public void Warn(object message) => _Logger.LogWarning(message.ToString());
public void Warn(string message, Exception exception) => _Logger.LogWarning(exception, message.ToString());
public void WarnFormat(IFormatProvider provider, string format, params object[] args) => _Logger.LogWarning(string.Format(provider, format, args));
public void WarnFormat(string format, object arg0, object arg1, object arg2) => _Logger.LogWarning(string.Format(format, arg0, arg1, arg2));
public void WarnFormat(string format, object arg0, object arg1) => _Logger.LogWarning(string.Format(format, arg0, arg1));
public void WarnFormat(string format, object arg0) => _Logger.LogWarning(string.Format(format, arg0));
public void WarnFormat(string format, params object[] args) => _Logger.LogWarning(string.Format(format, args));
public static string GetWorkingDirectory(string executingAssemblyName, string subDirectoryName)
{
string result = string.Empty;
string traceFile;
List<string> directories = new();
Environment.SpecialFolder[] specialFolders = new Environment.SpecialFolder[]
{
Environment.SpecialFolder.LocalApplicationData,
Environment.SpecialFolder.ApplicationData,
Environment.SpecialFolder.History,
Environment.SpecialFolder.CommonApplicationData,
Environment.SpecialFolder.InternetCache
};
foreach (Environment.SpecialFolder specialFolder in specialFolders)
directories.Add(Path.Combine(Environment.GetFolderPath(specialFolder), subDirectoryName, executingAssemblyName));
foreach (string directory in directories)
{
for (int i = 1; i < 3; i++)
{
if (i == 1)
result = directory;
else
result = string.Concat("D", directory[1..]);
try
{
if (!Directory.Exists(result))
_ = Directory.CreateDirectory(result);
traceFile = string.Concat(result, @"\", DateTime.Now.Ticks, ".txt");
File.WriteAllText(traceFile, traceFile);
File.Delete(traceFile);
break;
}
catch (Exception) { result = string.Empty; }
}
if (!string.IsNullOrEmpty(result))
break;
}
if (string.IsNullOrEmpty(result))
throw new Exception("Unable to set working directory!");
return result;
}
}

View File

@ -0,0 +1,112 @@
using Adaptation._Tests.Shared.Log;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.IO;
namespace Adaptation._Tests.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();
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(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 static string GetEnvironmentSpecialDirectory()
{
string result = string.Empty;
string traceFile;
List<string> directories = new();
Environment.SpecialFolder[] specialFolders = new Environment.SpecialFolder[]
{
Environment.SpecialFolder.LocalApplicationData,
Environment.SpecialFolder.ApplicationData,
Environment.SpecialFolder.History,
Environment.SpecialFolder.CommonApplicationData,
Environment.SpecialFolder.InternetCache
};
foreach (Environment.SpecialFolder specialFolder in specialFolders)
directories.Add(Environment.GetFolderPath(specialFolder));
foreach (string directory in directories)
{
for (int i = 1; i < 3; i++)
{
if (i == 1)
result = directory;
else
result = string.Concat("D", directory.Substring(1));
try
{
if (!Directory.Exists(result))
_ = Directory.CreateDirectory(result);
traceFile = string.Concat(result, @"\", DateTime.Now.Ticks, ".txt");
File.WriteAllText(traceFile, traceFile);
File.Delete(traceFile);
break;
}
catch (Exception) { result = string.Empty; }
}
if (!string.IsNullOrEmpty(result))
break;
}
return result;
}
public void Dispose()
{
_LoggerFactory.Dispose();
GC.SuppressFinalize(this);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
using System.Xml.Serialization;
namespace Adaptation._Tests.Shared.PasteSpecialXml.EAF.XML.API.ConfigurationData;
[XmlRoot(ElementName = "ChildBackboneMembers", Namespace = "http://schemas.datacontract.org/2004/07/EafManagement.Configuration.Services")]
public class ChildBackboneMembers
{
[XmlAttribute(AttributeName = "nil", Namespace = "http://www.w3.org/2001/XMLSchema-instance")]
public string Nil { get; set; }
}
[XmlRoot(ElementName = "ConfigurationData", Namespace = "http://schemas.datacontract.org/2004/07/EafManagement.Configuration.Services")]
public class ConfigurationData
{
[XmlElement(ElementName = "ChildBackboneMembers", Namespace = "http://schemas.datacontract.org/2004/07/EafManagement.Configuration.Services")]
public ChildBackboneMembers ChildBackboneMembers { get; set; }
[XmlElement(ElementName = "Data", Namespace = "http://schemas.datacontract.org/2004/07/EafManagement.Configuration.Services")]
public string Data { get; set; }
[XmlAttribute(AttributeName = "xmlns")]
public string Xmlns { get; set; }
[XmlAttribute(AttributeName = "i", Namespace = "http://www.w3.org/2000/xmlns/")]
public string I { get; set; }
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,964 @@
using System;
namespace Adaptation._Tests.Shared.PasteSpecialXml.EAF.XML.API.EquipmentType;
// NOTE: Generated code may require at least .NET Framework 4.5 or .NET Core/Standard 2.0.
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities", IsNullable = false)]
public partial class EquipmentTypeVersion
{
#pragma warning disable IDE1006 // Naming Styles
private string createdByField;
private DateTime creationDateField;
private object descriptionField;
private ExtensionsVersionExtension[] extensionsField;
private DateTime freezeDateField;
private string frozenByField;
private byte idField;
private bool isFrozenField;
private bool isRetiredField;
private DateTime retireDateField;
private object retiredByField;
private SelectedDeploymentPackage[] deploymentPackagesField;
private EquipmentTypeVersionDictionaries dictionariesField;
private string nameField;
private EquipmentTypeVersionParentType parentTypeField;
private ParameterizedModelObjectDefinition[] equipmentComponentsField;
private EventActionSequenceDefinition[] eventActionSequencesField;
private object fileCommunicatorObjectTypesField;
private FileConfiguration fileConfigurationField;
private FileHandlerObjectTypes fileHandlerObjectTypesField;
private ParameterizedModelObjectDefinition[] transientEquipmentObjectTypesField;
private string id1Field;
private string i___typeField;
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities")]
public string CreatedBy
{
get => this.createdByField;
set => this.createdByField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities")]
public DateTime CreationDate
{
get => this.creationDateField;
set => this.creationDateField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities", IsNullable = true)]
public object Description
{
get => this.descriptionField;
set => this.descriptionField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlArray(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities")]
[System.Xml.Serialization.XmlArrayItem("VersionExtension", IsNullable = false)]
public ExtensionsVersionExtension[] Extensions
{
get => this.extensionsField;
set => this.extensionsField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities")]
public DateTime FreezeDate
{
get => this.freezeDateField;
set => this.freezeDateField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities")]
public string FrozenBy
{
get => this.frozenByField;
set => this.frozenByField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities")]
public byte Id
{
get => this.idField;
set => this.idField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities")]
public bool IsFrozen
{
get => this.isFrozenField;
set => this.isFrozenField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities")]
public bool IsRetired
{
get => this.isRetiredField;
set => this.isRetiredField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities")]
public DateTime RetireDate
{
get => this.retireDateField;
set => this.retireDateField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities", IsNullable = true)]
public object RetiredBy
{
get => this.retiredByField;
set => this.retiredByField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayItem("SelectedDeploymentPackage", Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Deployme" +
"nt", IsNullable = false)]
public SelectedDeploymentPackage[] DeploymentPackages
{
get => this.deploymentPackagesField;
set => this.deploymentPackagesField = value;
}
/// <remarks/>
public EquipmentTypeVersionDictionaries Dictionaries
{
get => this.dictionariesField;
set => this.dictionariesField = value;
}
/// <remarks/>
public string Name
{
get => this.nameField;
set => this.nameField = value;
}
/// <remarks/>
public EquipmentTypeVersionParentType ParentType
{
get => this.parentTypeField;
set => this.parentTypeField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlArray(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes")]
[System.Xml.Serialization.XmlArrayItem("ParameterizedModelObjectDefinition", Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation", IsNullable = false)]
public ParameterizedModelObjectDefinition[] EquipmentComponents
{
get => this.equipmentComponentsField;
set => this.equipmentComponentsField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlArray(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes")]
[System.Xml.Serialization.XmlArrayItem("EventActionSequenceDefinition", Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation", IsNullable = false)]
public EventActionSequenceDefinition[] EventActionSequences
{
get => this.eventActionSequencesField;
set => this.eventActionSequencesField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes")]
public object FileCommunicatorObjectTypes
{
get => this.fileCommunicatorObjectTypesField;
set => this.fileCommunicatorObjectTypesField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes")]
public FileConfiguration FileConfiguration
{
get => this.fileConfigurationField;
set => this.fileConfigurationField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes")]
public FileHandlerObjectTypes FileHandlerObjectTypes
{
get => this.fileHandlerObjectTypesField;
set => this.fileHandlerObjectTypesField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlArray(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes")]
[System.Xml.Serialization.XmlArrayItem("ParameterizedModelObjectDefinition", Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation", IsNullable = false)]
public ParameterizedModelObjectDefinition[] TransientEquipmentObjectTypes
{
get => this.transientEquipmentObjectTypesField;
set => this.transientEquipmentObjectTypesField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute("Id", Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")]
public string Id1
{
get => this.id1Field;
set => this.id1Field = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute()]
public string i___type
{
get => this.i___typeField;
set => this.i___typeField = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Deployme" +
"nt")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Deployme" +
"nt", IsNullable = false)]
public partial class SelectedDeploymentPackage
{
private byte idField;
private string packageNameField;
private string packageVersionField;
/// <remarks/>
public byte Id
{
get => this.idField;
set => this.idField = value;
}
/// <remarks/>
public string PackageName
{
get => this.packageNameField;
set => this.packageNameField = value;
}
/// <remarks/>
public string PackageVersion
{
get => this.packageVersionField;
set => this.packageVersionField = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities")]
public partial class ExtensionsVersionExtension
{
private byte idField;
private string classNameField;
private object configurationField;
private string nameField;
private string id1Field;
private string i___typeField;
/// <remarks/>
public byte Id
{
get => this.idField;
set => this.idField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Backbone" +
"s")]
public string ClassName
{
get => this.classNameField;
set => this.classNameField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Backbone" +
"s", IsNullable = true)]
public object Configuration
{
get => this.configurationField;
set => this.configurationField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Backbone" +
"s")]
public string Name
{
get => this.nameField;
set => this.nameField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute("Id", Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")]
public string Id1
{
get => this.id1Field;
set => this.id1Field = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute()]
public string i___type
{
get => this.i___typeField;
set => this.i___typeField = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")]
public partial class EquipmentTypeVersionDictionaries
{
private EquipmentTypeVersionDictionariesEquipmentTypeDictionaryReference equipmentTypeDictionaryReferenceField;
/// <remarks/>
public EquipmentTypeVersionDictionariesEquipmentTypeDictionaryReference EquipmentTypeDictionaryReference
{
get => this.equipmentTypeDictionaryReferenceField;
set => this.equipmentTypeDictionaryReferenceField = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")]
public partial class EquipmentTypeVersionDictionariesEquipmentTypeDictionaryReference
{
private string dictionaryNameField;
private string dictionaryVersionField;
private byte idField;
private string id1Field;
/// <remarks/>
public string DictionaryName
{
get => this.dictionaryNameField;
set => this.dictionaryNameField = value;
}
/// <remarks/>
public string DictionaryVersion
{
get => this.dictionaryVersionField;
set => this.dictionaryVersionField = value;
}
/// <remarks/>
public byte Id
{
get => this.idField;
set => this.idField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute("Id", Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")]
public string Id1
{
get => this.id1Field;
set => this.id1Field = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")]
public partial class EquipmentTypeVersionParentType
{
private byte idField;
private string nameField;
private string id1Field;
/// <remarks/>
public byte Id
{
get => this.idField;
set => this.idField = value;
}
/// <remarks/>
public string Name
{
get => this.nameField;
set => this.nameField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute("Id", Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")]
public string Id1
{
get => this.id1Field;
set => this.id1Field = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation", IsNullable = false)]
public partial class ParameterizedModelObjectDefinition
{
private byte idField;
private string nameField;
private ParameterizedModelObjectDefinitionModelObjectParameterDefinition[] parametersField;
private string typeField;
private string id1Field;
/// <remarks/>
public byte Id
{
get => this.idField;
set => this.idField = value;
}
/// <remarks/>
public string Name
{
get => this.nameField;
set => this.nameField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayItem("ModelObjectParameterDefinition", IsNullable = false)]
public ParameterizedModelObjectDefinitionModelObjectParameterDefinition[] Parameters
{
get => this.parametersField;
set => this.parametersField = value;
}
/// <remarks/>
public string Type
{
get => this.typeField;
set => this.typeField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute("Id", Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")]
public string Id1
{
get => this.id1Field;
set => this.id1Field = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation")]
public partial class ParameterizedModelObjectDefinitionModelObjectParameterDefinition
{
private string enumTypeField;
private byte idField;
private string nameField;
private string valueField;
private string valueTypeField;
private string id1Field;
/// <remarks/>
[System.Xml.Serialization.XmlElement(IsNullable = true)]
public string EnumType
{
get => this.enumTypeField;
set => this.enumTypeField = value;
}
/// <remarks/>
public byte Id
{
get => this.idField;
set => this.idField = value;
}
/// <remarks/>
public string Name
{
get => this.nameField;
set => this.nameField = value;
}
/// <remarks/>
public string Value
{
get => this.valueField;
set => this.valueField = value;
}
/// <remarks/>
public string ValueType
{
get => this.valueTypeField;
set => this.valueTypeField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute("Id", Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")]
public string Id1
{
get => this.id1Field;
set => this.id1Field = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation", IsNullable = false)]
public partial class EventActionSequenceDefinition
{
private EventActionSequenceDefinitionEventActionParameterDefinition[] actionsField;
private string eventTypeField;
private string handledEventField;
private byte idField;
private string id1Field;
/// <remarks/>
[System.Xml.Serialization.XmlArrayItem("EventActionParameterDefinition", IsNullable = false)]
public EventActionSequenceDefinitionEventActionParameterDefinition[] Actions
{
get => this.actionsField;
set => this.actionsField = value;
}
/// <remarks/>
public string EventType
{
get => this.eventTypeField;
set => this.eventTypeField = value;
}
/// <remarks/>
public string HandledEvent
{
get => this.handledEventField;
set => this.handledEventField = value;
}
/// <remarks/>
public byte Id
{
get => this.idField;
set => this.idField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute("Id", Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")]
public string Id1
{
get => this.id1Field;
set => this.id1Field = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes", IsNullable = false)]
public class FileConfiguration
{
private string idField;
/// <remarks/>
[System.Xml.Serialization.XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")]
public string Id
{
get => this.idField;
set => this.idField = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes", IsNullable = false)]
public class FileHandlerObjectTypes
{
private ParameterizedModelObjectDefinition parameterizedModelObjectDefinitionField;
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation")]
public ParameterizedModelObjectDefinition ParameterizedModelObjectDefinition
{
get => this.parameterizedModelObjectDefinitionField;
set => this.parameterizedModelObjectDefinitionField = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" +
"ntities", IsNullable = false)]
public partial class Extensions
{
private ExtensionsVersionExtension[] versionExtensionField;
/// <remarks/>
[System.Xml.Serialization.XmlElement("VersionExtension")]
public ExtensionsVersionExtension[] VersionExtension
{
get => this.versionExtensionField;
set => this.versionExtensionField = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes", IsNullable = false)]
public partial class EquipmentComponents
{
private ParameterizedModelObjectDefinition[] parameterizedModelObjectDefinitionField;
/// <remarks/>
[System.Xml.Serialization.XmlElement("ParameterizedModelObjectDefinition", Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation")]
public ParameterizedModelObjectDefinition[] ParameterizedModelObjectDefinition
{
get => this.parameterizedModelObjectDefinitionField;
set => this.parameterizedModelObjectDefinitionField = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes", IsNullable = false)]
public partial class EventActionSequences
{
private EventActionSequenceDefinition[] eventActionSequenceDefinitionField;
/// <remarks/>
[System.Xml.Serialization.XmlElement("EventActionSequenceDefinition", Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation")]
public EventActionSequenceDefinition[] EventActionSequenceDefinition
{
get => this.eventActionSequenceDefinitionField;
set => this.eventActionSequenceDefinitionField = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" +
"Connector.EquipmentTypes", IsNullable = false)]
public partial class TransientEquipmentObjectTypes
{
private ParameterizedModelObjectDefinition[] parameterizedModelObjectDefinitionField;
/// <remarks/>
[System.Xml.Serialization.XmlElement("ParameterizedModelObjectDefinition", Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation")]
public ParameterizedModelObjectDefinition[] ParameterizedModelObjectDefinition
{
get => this.parameterizedModelObjectDefinitionField;
set => this.parameterizedModelObjectDefinitionField = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation")]
public partial class EventActionSequenceDefinitionEventActionParameterDefinition
{
private byte idField;
private object nameField;
private EventActionSequenceDefinitionEventActionParameterDefinitionModelObjectParameterDefinition[] parametersField;
private string typeField;
private byte positionField;
private string id1Field;
/// <remarks/>
public byte Id
{
get => this.idField;
set => this.idField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(IsNullable = true)]
public object Name
{
get => this.nameField;
set => this.nameField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayItem("ModelObjectParameterDefinition", IsNullable = false)]
public EventActionSequenceDefinitionEventActionParameterDefinitionModelObjectParameterDefinition[] Parameters
{
get => this.parametersField;
set => this.parametersField = value;
}
/// <remarks/>
public string Type
{
get => this.typeField;
set => this.typeField = value;
}
/// <remarks/>
public byte Position
{
get => this.positionField;
set => this.positionField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute("Id", Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")]
public string Id1
{
get => this.id1Field;
set => this.id1Field = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" +
"mation")]
public partial class EventActionSequenceDefinitionEventActionParameterDefinitionModelObjectParameterDefinition
{
private object categoryField;
private object descriptionField;
private object displayNameField;
private object enumTypeField;
private byte idField;
private bool isMandatoryField;
private string nameField;
private byte orderField;
private string valueField;
private string valueTypeField;
private string id1Field;
/// <remarks/>
[System.Xml.Serialization.XmlElement(IsNullable = true)]
public object Category
{
get => this.categoryField;
set => this.categoryField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(IsNullable = true)]
public object Description
{
get => this.descriptionField;
set => this.descriptionField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(IsNullable = true)]
public object DisplayName
{
get => this.displayNameField;
set => this.displayNameField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(IsNullable = true)]
public object EnumType
{
get => this.enumTypeField;
set => this.enumTypeField = value;
}
/// <remarks/>
public byte Id
{
get => this.idField;
set => this.idField = value;
}
/// <remarks/>
public bool IsMandatory
{
get => this.isMandatoryField;
set => this.isMandatoryField = value;
}
/// <remarks/>
public string Name
{
get => this.nameField;
set => this.nameField = value;
}
/// <remarks/>
public byte Order
{
get => this.orderField;
set => this.orderField = value;
}
/// <remarks/>
public string Value
{
get => this.valueField;
set => this.valueField = value;
}
/// <remarks/>
public string ValueType
{
get => this.valueTypeField;
set => this.valueTypeField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute("Id", Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")]
public string Id1
{
get => this.id1Field;
set => this.id1Field = value;
}
}

View File

@ -0,0 +1,90 @@
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 Adaptation._Tests.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 not null)
{
TestCategoryAttribute testCategoryAttribute = methodBase.GetCustomAttribute<TestCategoryAttribute>();
if (testCategoryAttribute is not 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();
_ = result.
AppendLine("{").
AppendLine(" \"configurations\": [").
AppendLine(" {").
AppendLine(" \"name\": \".NET Core Attach\",").
AppendLine(" \"type\": \"coreclr\",").
AppendLine(" \"request\": \"attach\",").
AppendLine($" \"processId\": {Environment.ProcessId}").
AppendLine(" }").
AppendLine(" ]").
AppendLine("}");
return result.ToString();
}
}

View File

@ -0,0 +1,139 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft": "Warning",
"Log4netProvider": "Debug",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Company": "Infineon Technologies Americas Corp.",
"Drives": [
{
"Use": false,
"Letter": "a",
"Share": "Floppy Disk",
"User": "",
"Password": ""
},
{
"Use": false,
"Letter": "c",
"Share": "SYSTEM",
"User": "",
"Password": ""
},
{
"Use": false,
"Letter": "d",
"Share": "DATA",
"User": "",
"Password": ""
},
{
"Use": true,
"Letter": "g",
"Share": "\\\\10.95.154.12\\testdata",
"User": "10.95.154.12\\Manager",
"Password": "D6QDJ5g6vjqnNyyRbfbj+g=="
},
{
"Use": false,
"Letter": "h",
"Share": "\\\\10.95.154.13\\COM 5",
"User": "10.95.154.13\\user",
"Password": "tVyC7uPHtScZR8NLInSaxQ=="
},
{
"Use": true,
"Letter": "i",
"Share": "\\\\messdv002.na.infineon.com\\Candela",
"User": "INFINEON\\MESGaNEAF",
"Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k="
},
{
"Use": false,
"Letter": "j",
"Share": "\\\\messdv002.na.infineon.com\\Characterization",
"User": "INFINEON\\MESGaNEAF",
"Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k="
},
{
"Use": true,
"Letter": "k",
"Share": "\\\\messdv002.na.infineon.com\\GaN_NEC\\Characterization",
"User": "INFINEON\\MESGaNEAF",
"Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k="
},
{
"Use": false,
"Letter": "l",
"Share": "TFS",
"User": "",
"Password": ""
},
{
"Use": false,
"Letter": "m",
"Share": "\\\\messdv002.na.infineon.com\\MOCVD",
"User": "EC\\ECMESEAF",
"Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00="
},
{
"Use": true,
"Letter": "n",
"Share": "\\\\10.95.154.22\\C",
"User": "10.95.154.22\\Aixtron",
"Password": "DYVBOr2HJdB7KOhd/IFhLA=="
},
{
"Use": true,
"Letter": "o",
"Share": "\\\\10.95.154.16\\Aixtron",
"User": "10.95.154.16\\Aixtron",
"Password": "DYVBOr2HJdB7KOhd/IFhLA=="
},
{
"Use": true,
"Letter": "p",
"Share": "\\\\10.95.154.15\\Aixtron",
"User": "10.95.154.15\\Aixtron",
"Password": "DYVBOr2HJdB7KOhd/IFhLA=="
},
{
"Use": true,
"Letter": "q",
"Share": "\\\\10.95.154.21\\Data",
"User": "10.95.154.21\\XRD04Admin",
"Password": "v1NOsEOCvbnhzKabspPcCQ=="
},
{
"Use": true,
"Letter": "r",
"Share": "\\\\10.95.154.23\\Data",
"User": "\"10.95.154.23\\infineon us\"",
"Password": "rzXkXdHKetDfsukhZKW0yA=="
},
{
"Use": true,
"Letter": "s",
"Share": "\\\\messv02ecc1.ec.local\\EC_EAFRepository",
"User": "EC\\ECMESEAF",
"Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00="
},
{
"Use": true,
"Letter": "t",
"Share": "\\\\messv02ecc1.ec.local\\EC_EDA",
"User": "EC\\ECEDASvc",
"Password": "IKsJmRVUH3xlv+RRELRbwoXYKwLvF4Re7k1Rigzpwf4="
},
{
"Use": false,
"Letter": "z",
"Share": "DVD Drive",
"User": "",
"Password": ""
}
]
}

139
Adaptation/appsettings.json Normal file
View File

@ -0,0 +1,139 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Log4netProvider": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Company": "Infineon Technologies Americas Corp.",
"Drives": [
{
"Use": false,
"Letter": "a",
"Share": "Floppy Disk",
"User": "",
"Password": ""
},
{
"Use": false,
"Letter": "c",
"Share": "SYSTEM",
"User": "",
"Password": ""
},
{
"Use": false,
"Letter": "d",
"Share": "DATA",
"User": "",
"Password": ""
},
{
"Use": true,
"Letter": "g",
"Share": "\\\\10.95.154.12\\testdata",
"User": "10.95.154.12\\Manager",
"Password": "D6QDJ5g6vjqnNyyRbfbj+g=="
},
{
"Use": false,
"Letter": "h",
"Share": "\\\\10.95.154.13\\COM 5",
"User": "10.95.154.13\\user",
"Password": "tVyC7uPHtScZR8NLInSaxQ=="
},
{
"Use": true,
"Letter": "i",
"Share": "\\\\messdv002.na.infineon.com\\Candela",
"User": "INFINEON\\MESGaNEAF",
"Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k="
},
{
"Use": false,
"Letter": "j",
"Share": "\\\\messdv002.na.infineon.com\\Characterization",
"User": "INFINEON\\MESGaNEAF",
"Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k="
},
{
"Use": true,
"Letter": "k",
"Share": "\\\\messdv002.na.infineon.com\\GaN_NEC\\Characterization",
"User": "INFINEON\\MESGaNEAF",
"Password": "tLIPgqM6R9hVQOteRnTHwPqIg3Zxv8CohTjFkjkFz8k="
},
{
"Use": false,
"Letter": "l",
"Share": "TFS",
"User": "",
"Password": ""
},
{
"Use": false,
"Letter": "m",
"Share": "\\\\messdv002.na.infineon.com\\MOCVD",
"User": "EC\\ECMESEAF",
"Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00="
},
{
"Use": true,
"Letter": "n",
"Share": "\\\\10.95.154.22\\C",
"User": "10.95.154.22\\Aixtron",
"Password": "DYVBOr2HJdB7KOhd/IFhLA=="
},
{
"Use": true,
"Letter": "o",
"Share": "\\\\10.95.154.16\\Aixtron",
"User": "10.95.154.16\\Aixtron",
"Password": "DYVBOr2HJdB7KOhd/IFhLA=="
},
{
"Use": true,
"Letter": "p",
"Share": "\\\\10.95.154.15\\Aixtron",
"User": "10.95.154.15\\Aixtron",
"Password": "DYVBOr2HJdB7KOhd/IFhLA=="
},
{
"Use": true,
"Letter": "q",
"Share": "\\\\10.95.154.21\\Data",
"User": "10.95.154.21\\XRD04Admin",
"Password": "v1NOsEOCvbnhzKabspPcCQ=="
},
{
"Use": true,
"Letter": "r",
"Share": "\\\\10.95.154.23\\Data",
"User": "\"10.95.154.23\\infineon us\"",
"Password": "rzXkXdHKetDfsukhZKW0yA=="
},
{
"Use": true,
"Letter": "s",
"Share": "\\\\messv02ecc1.ec.local\\EC_EAFRepository",
"User": "EC\\ECMESEAF",
"Password": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00="
},
{
"Use": true,
"Letter": "t",
"Share": "\\\\messv02ecc1.ec.local\\EC_EDA",
"User": "EC\\ECEDASvc",
"Password": "IKsJmRVUH3xlv+RRELRbwoXYKwLvF4Re7k1Rigzpwf4="
},
{
"Use": false,
"Letter": "z",
"Share": "DVD Drive",
"User": "",
"Password": ""
}
]
}

17
Adaptation/package.json Normal file
View File

@ -0,0 +1,17 @@
{
"scripts": {
"Alpha": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"nuget-clear": "dotnet nuget locals all --clear",
"build": "dotnet build --runtime win-x64 --self-contained",
"build-Package-Management": "dotnet build --runtime win-x64 --self-contained --source https://packagemanagement.eu.infineon.com:4430/api/v2/",
"build-nuget-And-Package-Management": "dotnet build --runtime win-x64 --self-contained --source https://api.nuget.org/v3/index.json --source https://packagemanagement.eu.infineon.com:4430/api/v2/",
"build-All-Sources": "dotnet build --runtime win-x64 --self-contained --source https://api.nuget.org/v3/index.json --source https://packagemanagement.eu.infineon.com:4430/api/v2/ --source https://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json --source http://192.168.0.73:5002/v3/index.json",
"dotnet-format": "dotnet format --report .vscode --verbosity detailed --severity warn",
"MSBuild": "\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe\" /target:Build /restore:True /p:RestoreSources=https://api.nuget.org/v3/index.json%3Bhttps://packagemanagement.eu.infineon.com:4430/api/v2/%3Bhttps://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=Debug;TargetFrameworkVersion=v4.8 ../DEP08SIHTRPLC.csproj",
"pull": "git pull",
"garbage-collect": "git gc",
"AT-CreateSelfDescription.Staging.v2_43_0-DEP08SIHTRPLC": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.CreateSelfDescription.Staging.v2_43_0 & ClassName~DEP08SIHTRPLC\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",
"BA-Extract.Staging.v2_43_0-DEP08SIHTRPLC": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_0 & ClassName~DEP08SIHTRPLC\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",
"BB-Extract.Staging.v2_43_0-DEP08SIHTRPLC-Staging__v2_43_0__DEP08SIHTRPLC__ZipFilesByDate": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~Adaptation._Tests.Extract.Staging.v2_43_0 & ClassName~DEP08SIHTRPLC & Name~Staging__v2_43_0__DEP08SIHTRPLC__ZipFilesByDate\" -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")"
}
}

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